Changeset 4838
- Timestamp:
- 01/27/07 18:23:17 (23 months ago)
- Location:
- branches/qt-gui_qt4
- Files:
-
- 7 modified
-
. (modified) (1 prop)
-
src/ewidgets.cpp (modified) (3 diffs)
-
src/ewidgets.h (modified) (2 diffs)
-
src/mlview.cpp (modified) (1 diff)
-
src/usereventdlg.cpp (modified) (2 diffs)
-
src/userinfodlg.cpp (modified) (3 diffs)
-
src/userinfodlg.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/qt-gui_qt4
- Property svnmerge-integrated changed from /trunk/qt-gui:1-4775,4778-4794,4800 to /trunk/qt-gui:1-4775,4778-4794,4797-4833,4835-4837
-
branches/qt-gui_qt4/src/ewidgets.cpp
r4810 r4838 57 57 #include "licq_history.h" 58 58 #include "licq_events.h" 59 #include "licq_user.h" 59 60 #include "mainwin.h" 60 61 #include "eventdesc.h" … … 466 467 } 467 468 469 // ----------------------------------------------------------------------------- 470 471 CTimeZoneField::CTimeZoneField(QWidget *parent) 472 : QSpinBox(-24, 24, 1, parent) 473 { 474 // The world is round so let timezones wrap 475 setWrapping(true); 476 477 // Plus and minus seems more fitting than up and down 478 setButtonSymbols(QSpinBox::PlusMinus); 479 480 // Force the input to be in format GMT+500, GMT-1030, etc... 481 setPrefix("GMT"); 482 setValidator(new QRegExpValidator(QRegExp("^[\\+\\-](1[012]|\\d)[03]0$|^Unknown$"), this)); 483 484 // Allow the value to be undefined as well. This will replace the lowest value (-24) 485 setSpecialValueText(tr("Unknown")); 486 } 487 488 void CTimeZoneField::setData(char data) 489 { 490 // The spinbox uses the lowest value to mark the undefined state but the constant is some other value so we need to change it 491 // For all defined values, the sign is inverted 492 setValue(data == TIMEZONE_UNKNOWN ? undefinedValue : static_cast<int>(-data)); 493 } 494 495 char CTimeZoneField::data() 496 { 497 int v = value(); 498 if (v == undefinedValue) 499 return TIMEZONE_UNKNOWN; 500 return static_cast<char>(-v); 501 } 502 503 QString CTimeZoneField::mapValueToText(int v) 504 { 505 // The internal value in the spinbox is 30min intervals so convert it to something more readable 506 return QString("%1%2%3").arg(v < 0 ? "-" : "+").arg(abs(v) / 2).arg(v % 2 ? "30" : "00"); 507 } 508 509 int CTimeZoneField::mapTextToValue(bool *ok) 510 { 511 // The user entered something so now we must try and convert it back to the internal int 512 QRegExp rx("^(\\+|-)(\\d+)(0|3)0$"); 513 if (rx.search(cleanText()) == -1) 514 { 515 *ok = false; 516 return 0; 517 } 518 int ret = rx.cap(2).toInt() * 2; 519 if (rx.cap(3) == "3") 520 ret++; 521 if (rx.cap(1) == "-") 522 ret = -ret; 523 *ok = true; 524 return ret; 525 } 468 526 469 527 // ----------------------------------------------------------------------------- … … 473 531 { 474 532 setTextFormat(Qt::RichText); 475 } ;533 } 476 534 477 535 // ----------------------------------------------------------------------------- -
branches/qt-gui_qt4/src/ewidgets.h
r4810 r4838 40 40 #include <QtCore/QEvent> 41 41 #include <QtCore/QStringList> 42 #include <qspinbox.h> 42 43 43 44 #include "mlview.h" … … 146 147 }; 147 148 149 /* ----------------------------------------------------------------------------- */ 150 151 /** 152 * Input field for timezones. 153 */ 154 class CTimeZoneField : public QSpinBox 155 { 156 public: 157 CTimeZoneField(QWidget *parent); 158 void setData(char data); 159 char data(); 160 protected: 161 QString mapValueToText(int v); 162 int mapTextToValue(bool* ok); 163 164 static const int undefinedValue = -24; 165 }; 148 166 149 167 /* ----------------------------------------------------------------------------- */ -
branches/qt-gui_qt4/src/mlview.cpp
r4801 r4838 86 86 "[a-z0-9.-]+\\.([a-z]+|[0-9]+)" // hostname.tld or ip address 87 87 "(:[0-9]+)?" // optional port 88 "(/( [-\\w%{}|\\\\^~`;/?:@=&$_.+!*'(),#]|\\[|\\])*)?");88 "(/(([-\\w%{}|\\\\^~`;/?:@=&$_.+!*'(),#]|\\[|\\])*[^.,:;?!\\s])*)?"); 89 89 reURL.setMinimal(false); 90 90 reURL.setCaseSensitive(false); -
branches/qt-gui_qt4/src/usereventdlg.cpp
r4801 r4838 1646 1646 if (tmp != "") 1647 1647 mleHistory->append(tmp); 1648 1649 mleHistory->GotoEnd(); 1648 1650 } 1649 1651 } … … 2355 2357 disconnect (sigman, SIGNAL(signal_doneUserFcn(ICQEvent *)), this, SLOT(sendDone_common(ICQEvent *))); 2356 2358 2359 if (mleSend != NULL) 2360 mleSend->setFocus(); 2361 2357 2362 if (e->Result() != EVENT_ACKED) 2358 2363 { -
branches/qt-gui_qt4/src/userinfodlg.cpp
r4822 r4838 315 315 lay->addWidget(nfoStatus, CR, 1); 316 316 lay->addWidget(new QLabel(tr("Timezone:"), p), CR, 3); 317 nfoTime = new CInfoField(p, true);318 lay->addWidget( nfoTime, CR, 4);317 tznZone = new CTimeZoneField(p); 318 lay->addWidget(tznZone, CR, 4); 319 319 320 320 lay->addWidget(new QLabel(tr("Name:"), p), ++CR, 0); … … 421 421 } 422 422 nfoIp->setData(ip); 423 if (u->GetTimezone() == TIMEZONE_UNKNOWN) 424 nfoTime->setText(tr("Unknown")); 425 else 426 { 427 nfoTime->setText(tr("GMT%1%2%3") 428 .arg(u->GetTimezone() > 0 ? "-" : "+") 429 .arg(abs(u->GetTimezone() / 2)).arg(u->GetTimezone() % 2 ? "30" : "00") ); 430 } 423 tznZone->setData(u->GetTimezone()); 431 424 nfoStatus->setData(u->StatusStr()); 432 425 if (m_bOwner) 433 426 { 427 // Owner timezone is not editable, it is taken from system timezone instead 428 tznZone->setEnabled(false); 429 434 430 const SCountry *c = GetCountryByCode(u->GetCountryCode()); 435 431 if (c == NULL) … … 498 494 u->SetCountryCode(GetCountryByIndex(i)->nCode); 499 495 } 496 u->SetTimezone(tznZone->data()); 500 497 501 498 u->SetEnableSave(true); -
branches/qt-gui_qt4/src/userinfodlg.h
r4794 r4838 108 108 *nfoAlias, *nfoIp, *nfoUin, *nfoCity, *nfoState, 109 109 *nfoZipCode, *nfoAddress, *nfoCountry, *nfoFax, *nfoCellular, 110 *nfoPhone, *nfo Time, *nfoStatus;110 *nfoPhone, *nfoStatus; 111 111 QCheckBox *chkKeepAliasOnUpdate; 112 112 CEComboBox *cmbCountry; 113 113 QLabel *lblAuth, *lblICQHomepage; 114 CTimeZoneField *tznZone; 114 115 115 116 // More info
