Changeset 6108 for trunk/qt4-gui/src/userevents
- Timestamp:
- 03/16/08 18:46:17 (9 months ago)
- Location:
- trunk/qt4-gui/src/userevents
- Files:
-
- 19 modified
-
usereventcommon.cpp (modified) (17 diffs)
-
usereventcommon.h (modified) (6 diffs)
-
usereventtabdlg.cpp (modified) (15 diffs)
-
usereventtabdlg.h (modified) (1 diff)
-
usersendchatevent.cpp (modified) (7 diffs)
-
usersendchatevent.h (modified) (1 diff)
-
usersendcommon.cpp (modified) (49 diffs)
-
usersendcommon.h (modified) (2 diffs)
-
usersendcontactevent.cpp (modified) (9 diffs)
-
usersendcontactevent.h (modified) (1 diff)
-
usersendfileevent.cpp (modified) (9 diffs)
-
usersendfileevent.h (modified) (1 diff)
-
usersendmsgevent.cpp (modified) (10 diffs)
-
usersendsmsevent.cpp (modified) (6 diffs)
-
usersendsmsevent.h (modified) (1 diff)
-
usersendurlevent.cpp (modified) (9 diffs)
-
usersendurlevent.h (modified) (1 diff)
-
userviewevent.cpp (modified) (39 diffs)
-
userviewevent.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/qt4-gui/src/userevents/usereventcommon.cpp
r6103 r6108 57 57 /* TRANSLATOR LicqQtGui::UserEventCommon */ 58 58 59 using std::list; 60 using std::string; 61 59 62 UserEventCommon::UserEventCommon(QString id, unsigned long ppid, QWidget* parent, const char* name) 60 63 : QWidget(parent), … … 94 97 myConvoId = 0; 95 98 96 top_hlay= new QHBoxLayout(this);97 top_lay= new QVBoxLayout();98 top_hlay->addLayout(top_lay);99 top_hlay->setStretchFactor(top_lay, 1);99 myTophLayout = new QHBoxLayout(this); 100 myTopLayout = new QVBoxLayout(); 101 myTophLayout->addLayout(myTopLayout); 102 myTophLayout->setStretchFactor(myTopLayout, 1); 100 103 101 104 QHBoxLayout* layt = new QHBoxLayout(); 102 top_lay->addLayout(layt);105 myTopLayout->addLayout(layt); 103 106 104 107 myToolBar = new QToolBar(); … … 119 122 layt->addWidget(myTimezone); 120 123 121 myMenu = myToolBar->addAction(tr("Menu"), this, SLOT(s lotUserMenu()));124 myMenu = myToolBar->addAction(tr("Menu"), this, SLOT(showUserMenu())); 122 125 myMenu->setShortcut(Qt::ALT + Qt::Key_M); 123 126 pushToolTip(myMenu, tr("Open user menu")); … … 126 129 myMenu->setEnabled(false); 127 130 128 myHistory = myToolBar->addAction(tr("History..."), this, SLOT(s lotShowHistory()));131 myHistory = myToolBar->addAction(tr("History..."), this, SLOT(showHistory())); 129 132 myHistory->setShortcut(Qt::ALT + Qt::Key_H); 130 133 pushToolTip(myHistory, tr("Show user history")); 131 134 132 myInfo = myToolBar->addAction(tr("User Info..."), this, SLOT(s lotShowUserInfo()));135 myInfo = myToolBar->addAction(tr("User Info..."), this, SLOT(showUserInfo())); 133 136 myInfo->setShortcut(Qt::ALT + Qt::Key_I); 134 137 pushToolTip(myInfo, tr("Show user information")); 135 138 136 popupEncoding= new QMenu(this);139 myEncodingsMenu = new QMenu(this); 137 140 138 141 myEncoding = myToolBar->addAction(tr("Encoding"), this, SLOT(showEncodingsMenu())); 139 142 myEncoding->setShortcut(Qt::ALT + Qt::Key_O); 140 143 pushToolTip(myEncoding, tr("Select the text encoding used for outgoing messages.")); 141 myEncoding->setMenu( popupEncoding);144 myEncoding->setMenu(myEncodingsMenu); 142 145 143 146 myToolBar->addSeparator(); 144 147 145 mySecure = myToolBar->addAction(tr("Secure Channel"), this, SLOT(s lotSwitchSecurity()));148 mySecure = myToolBar->addAction(tr("Secure Channel"), this, SLOT(switchSecurity())); 146 149 mySecure->setShortcut(Qt::ALT + Qt::Key_E); 147 150 pushToolTip(mySecure, tr("Open / Close secure channel")); … … 149 152 mySecure->setEnabled(false); 150 153 151 tmrTime= NULL;152 tmrTyping= NULL;154 myTimeTimer = NULL; 155 myTypingTimer = NULL; 153 156 154 157 ICQUser* u = gUserManager.FetchUser(myUsers.front().c_str(), myPpid, LOCK_R); … … 172 175 } 173 176 174 encodingsGroup = new QActionGroup(this);175 connect( encodingsGroup, SIGNAL(triggered(QAction*)), SLOT(slotSetEncoding(QAction*)));177 myEncodingsGroup = new QActionGroup(this); 178 connect(myEncodingsGroup, SIGNAL(triggered(QAction*)), SLOT(setEncoding(QAction*))); 176 179 177 180 QString codec_name = QString::fromLatin1(myCodec->name()).toLower(); … … 190 193 continue; 191 194 192 QAction* a = new QAction(UserCodec::nameForEncoding(it->encoding), encodingsGroup);195 QAction* a = new QAction(UserCodec::nameForEncoding(it->encoding), myEncodingsGroup); 193 196 a->setCheckable(true); 194 197 a->setData(it->mib); … … 200 203 { 201 204 // if the current encoding does not appear in the minimal list 202 popupEncoding->insertSeparator(popupEncoding->actions()[0]);203 popupEncoding->insertAction(popupEncoding->actions()[0], a);205 myEncodingsMenu->insertSeparator(myEncodingsMenu->actions()[0]); 206 myEncodingsMenu->insertAction(myEncodingsMenu->actions()[0], a); 204 207 } 205 208 else 206 209 { 207 popupEncoding->addAction(a);210 myEncodingsMenu->addAction(a); 208 211 } 209 212 } … … 211 214 // We might be called from a slot so connect the signal only after all the 212 215 // existing signals are handled. 213 QTimer::singleShot(0, this, SLOT( slotConnectSignal()));214 215 m ainWidget = new QVBoxLayout();216 m ainWidget->setContentsMargins(0, 0, 0, 0);217 top_lay->addLayout(mainWidget);216 QTimer::singleShot(0, this, SLOT(connectSignal())); 217 218 myMainWidget = new QVBoxLayout(); 219 myMainWidget->setContentsMargins(0, 0, 0, 0); 220 myTopLayout->addLayout(myMainWidget); 218 221 219 222 updateIcons(); … … 223 226 if (!Config::Chat::instance()->tabbedChatting() && 224 227 Config::Chat::instance()->msgWinSticky()) 225 QTimer::singleShot(100, this, SLOT(s lotSetMsgWinSticky()));228 QTimer::singleShot(100, this, SLOT(setMsgWinSticky())); 226 229 } 227 230 … … 259 262 if (type == ICQ_TYPING_ACTIVE) 260 263 { 261 if ( tmrTyping->isActive())262 tmrTyping->stop();263 tmrTyping->setSingleShot(true);264 tmrTyping->start(10000);264 if (myTypingTimer->isActive()) 265 myTypingTimer->stop(); 266 myTypingTimer->setSingleShot(true); 267 myTypingTimer->start(10000); 265 268 266 269 QPalette p = myTimezone->palette(); … … 289 292 { 290 293 myRemoteTimeOffset = u->LocalTimeOffset(); 291 slotUpdateTime();292 293 if ( tmrTime== NULL)294 { 295 tmrTime= new QTimer(this);296 connect( tmrTime, SIGNAL(timeout()), SLOT(slotUpdateTime()));297 tmrTime->start(3000);298 } 299 } 300 301 if ( tmrTyping== NULL)302 { 303 tmrTyping= new QTimer(this);304 connect( tmrTyping, SIGNAL(timeout()), SLOT(slotUpdateTyping()));294 updateTime(); 295 296 if (myTimeTimer == NULL) 297 { 298 myTimeTimer = new QTimer(this); 299 connect(myTimeTimer, SIGNAL(timeout()), SLOT(updateTime())); 300 myTimeTimer->start(3000); 301 } 302 } 303 304 if (myTypingTimer == NULL) 305 { 306 myTypingTimer = new QTimer(this); 307 connect(myTypingTimer, SIGNAL(timeout()), SLOT(updateTyping())); 305 308 } 306 309 … … 345 348 } 346 349 347 void UserEventCommon:: slotConnectSignal()350 void UserEventCommon::connectSignal() 348 351 { 349 352 connect(LicqGui::instance()->signalManager(), 350 SIGNAL(updatedUser(CICQSignal*)), SLOT( slotUserUpdated(CICQSignal*)));351 } 352 353 void UserEventCommon::s lotSetEncoding(QAction* action)353 SIGNAL(updatedUser(CICQSignal*)), SLOT(updatedUser(CICQSignal*))); 354 } 355 356 void UserEventCommon::setEncoding(QAction* action) 354 357 { 355 358 int encodingMib = action->data().toUInt(); … … 384 387 } 385 388 386 void UserEventCommon::s lotSetMsgWinSticky(bool sticky)389 void UserEventCommon::setMsgWinSticky(bool sticky) 387 390 { 388 391 Support::changeWinSticky(winId(), sticky); 389 392 } 390 393 391 void UserEventCommon::s lotShowHistory()394 void UserEventCommon::showHistory() 392 395 { 393 396 new HistoryDlg(myUsers.front().c_str(), myPpid); 394 397 } 395 398 396 void UserEventCommon::s lotShowUserInfo()399 void UserEventCommon::showUserInfo() 397 400 { 398 401 LicqGui::instance()->showInfoDialog(mnuUserGeneral, myUsers.front().c_str(), myPpid, true); 399 402 } 400 403 401 void UserEventCommon::s lotSwitchSecurity()404 void UserEventCommon::switchSecurity() 402 405 { 403 406 new KeyRequestDlg(QString::fromAscii(myUsers.front().c_str()), myPpid); 404 407 } 405 408 406 void UserEventCommon:: slotUpdateTime()409 void UserEventCommon::updateTime() 407 410 { 408 411 QDateTime t; … … 411 414 } 412 415 413 void UserEventCommon:: slotUpdateTyping()416 void UserEventCommon::updateTyping() 414 417 { 415 418 // MSN needs this, ICQ/AIM doesn't send additional packets … … 429 432 } 430 433 431 void UserEventCommon::s lotUserMenu()434 void UserEventCommon::showUserMenu() 432 435 { 433 436 // Tell menu which contact to use and show it immediately. … … 444 447 } 445 448 446 void UserEventCommon:: slotUserUpdated(CICQSignal* sig)449 void UserEventCommon::updatedUser(CICQSignal* sig) 447 450 { 448 451 if (myPpid != sig->PPID() || !isUserInConvo(sig->Id())) -
trunk/qt4-gui/src/userevents/usereventcommon.h
r6103 r6108 36 36 class ICQUser; 37 37 38 using std::list;39 using std::string;40 41 38 42 39 namespace LicqQtGui … … 55 52 unsigned long ppid() { return myPpid; } 56 53 unsigned long convoId() { return myConvoId; } 57 list<string>& convoUsers() { return myUsers; }54 std::list<std::string>& convoUsers() { return myUsers; } 58 55 void setConvoId(unsigned long n) { myConvoId = n; } 59 56 void addEventTag(unsigned long n) { if (n) myEventTag.push_back(n); } … … 70 67 unsigned long myConvoId; 71 68 time_t myRemoteTimeOffset; 72 list<string> myUsers;69 std::list<std::string> myUsers; 73 70 unsigned long mySendFuncs; 74 71 … … 81 78 QString myProgressMsg; 82 79 83 QHBoxLayout* top_hlay;84 QVBoxLayout* top_lay;85 QVBoxLayout* m ainWidget;80 QHBoxLayout* myTophLayout; 81 QVBoxLayout* myTopLayout; 82 QVBoxLayout* myMainWidget; 86 83 QToolBar* myToolBar; 87 QMenu* popupEncoding;88 QActionGroup* encodingsGroup;84 QMenu* myEncodingsMenu; 85 QActionGroup* myEncodingsGroup; 89 86 QAction* myMenu; 90 87 QAction* myHistory; … … 97 94 InfoField* myTimezone; 98 95 QTextCodec* myCodec; 99 QTimer* tmrTime;100 QTimer* tmrTyping;96 QTimer* myTimeTimer; 97 QTimer* myTypingTimer; 101 98 102 99 void flashTaskbar(); … … 112 109 virtual void updateIcons(); 113 110 114 void slotConnectSignal();115 void s lotSetEncoding(QAction* action);116 void s lotSetMsgWinSticky(bool sticky = true);117 void s lotShowHistory();118 void s lotShowUserInfo();119 void s lotSwitchSecurity();120 void slotUpdateTime();121 void slotUpdateTyping();122 void s lotUserMenu();111 void connectSignal(); 112 void setEncoding(QAction* action); 113 void setMsgWinSticky(bool sticky = true); 114 void showHistory(); 115 void showUserInfo(); 116 void switchSecurity(); 117 void updateTime(); 118 void updateTyping(); 119 void showUserMenu(); 123 120 void showEncodingsMenu(); 124 void slotUserUpdated(CICQSignal* sig);121 void updatedUser(CICQSignal* sig); 125 122 126 123 signals: -
trunk/qt4-gui/src/userevents/usereventtabdlg.cpp
r6082 r6108 43 43 /* TRANSLATOR LicqQtGui::UserEventTabDlg */ 44 44 45 using std::list; 46 using std::string; 47 45 48 UserEventTabDlg::UserEventTabDlg(QWidget* parent, const char* name) 46 49 : QWidget(parent) … … 55 58 setGeometry(Config::Chat::instance()->dialogRect()); 56 59 57 tabw = new TabWidget(); 58 lay->addWidget(tabw); 59 60 connect(tabw, SIGNAL(currentChanged(int)), 61 SLOT(slotCurrentChanged(int))); 62 connect(tabw, SIGNAL(mouseMiddleClick(QWidget*)), 63 SLOT(slotRemoveTab(QWidget*))); 60 myTabs = new TabWidget(); 61 lay->addWidget(myTabs); 62 63 connect(myTabs, SIGNAL(currentChanged(int)), SLOT(currentChanged(int))); 64 connect(myTabs, SIGNAL(mouseMiddleClick(QWidget*)), SLOT(removeTab(QWidget*))); 64 65 } 65 66 … … 78 79 79 80 label = QString::fromUtf8(u->GetAlias()); 80 index = tabw->insertTab(index, tab, label);81 index = myTabs->insertTab(index, tab, label); 81 82 updateTabLabel(u); 82 83 gUserManager.DropUser(u); 83 QWidget* fw = tabw->focusWidget();84 QWidget* fw = myTabs->focusWidget(); 84 85 if (Config::Chat::instance()->autoFocus()) 85 tabw->setCurrentIndex(index);86 myTabs->setCurrentIndex(index); 86 87 else 87 88 if (fw != NULL) … … 91 92 void UserEventTabDlg::selectTab(QWidget* tab) 92 93 { 93 tabw->setCurrentIndex(tabw->indexOf(tab));94 myTabs->setCurrentIndex(myTabs->indexOf(tab)); 94 95 updateTitle(tab); 95 96 } … … 97 98 void UserEventTabDlg::replaceTab(QWidget* oldTab, UserEventCommon* newTab) 98 99 { 99 addTab(newTab, tabw->indexOf(oldTab));100 slotRemoveTab(oldTab);100 addTab(newTab, myTabs->indexOf(oldTab)); 101 removeTab(oldTab); 101 102 } 102 103 103 104 bool UserEventTabDlg::tabIsSelected(QWidget* tab) 104 105 { 105 return ( tabw->currentIndex() == tabw->indexOf(tab));106 return (myTabs->currentIndex() == myTabs->indexOf(tab)); 106 107 } 107 108 108 109 bool UserEventTabDlg::tabExists(QWidget* tab) 109 110 { 110 return ( tabw->indexOf(tab) != -1);111 return (myTabs->indexOf(tab) != -1); 111 112 } 112 113 … … 134 135 } 135 136 136 tabw->setTabText(tabw->indexOf(tab), newLabel);137 myTabs->setTabText(myTabs->indexOf(tab), newLabel); 137 138 } 138 139 … … 142 143 return; 143 144 144 for (int index = 0; index < tabw->count(); index++)145 for (int index = 0; index < myTabs->count(); index++) 145 146 { 146 UserEventCommon* tab = dynamic_cast<UserEventCommon*>( tabw->widget(index));147 UserEventCommon* tab = dynamic_cast<UserEventCommon*>(myTabs->widget(index)); 147 148 148 149 if (tab->ppid() == u->PPID() && tab->isUserInConvo(u->IdString())) … … 177 178 178 179 icon = IconManager::instance()->iconForEvent(SubCommand); 179 tabw->setTabColor(tab, QColor("blue"));180 myTabs->setTabColor(tab, QColor("blue")); 180 181 181 182 // to clear it.. … … 187 188 188 189 if (u->GetTyping() == ICQ_TYPING_ACTIVE) 189 tabw->setTabColor(tab, Config::Chat::instance()->tabTypingColor());190 myTabs->setTabColor(tab, Config::Chat::instance()->tabTypingColor()); 190 191 else 191 tabw->setTabColor(tab, QColor("black"));192 myTabs->setTabColor(tab, QColor("black")); 192 193 } 193 194 194 tabw->setTabIcon(index, icon);195 if ( tabw->currentIndex() == index)195 myTabs->setTabIcon(index, icon); 196 if (myTabs->currentIndex() == index) 196 197 setWindowIcon(icon); 197 198 … … 203 204 void UserEventTabDlg::setTyping(ICQUser* u, int convoId) 204 205 { 205 for (int index = 0; index < tabw->count(); index++)206 for (int index = 0; index < myTabs->count(); index++) 206 207 { 207 UserEventCommon* tab = dynamic_cast<UserEventCommon*>( tabw->widget(index));208 UserEventCommon* tab = dynamic_cast<UserEventCommon*>(myTabs->widget(index)); 208 209 209 210 if (tab->convoId() == static_cast<unsigned long>(convoId) && … … 227 228 * changed. 228 229 */ 229 void UserEventTabDlg:: slotCurrentChanged(int index)230 { 231 QWidget* tab = tabw->widget(index);230 void UserEventTabDlg::currentChanged(int index) 231 { 232 QWidget* tab = myTabs->widget(index); 232 233 tab->setFocus(); // prevents users from accidentally typing in the wrong widget 233 234 updateTitle(tab); … … 235 236 } 236 237 237 void UserEventTabDlg:: slotMoveLeft()238 { 239 tabw->setPreviousPage();240 } 241 242 void UserEventTabDlg:: slotMoveRight()243 { 244 tabw->setNextPage();245 } 246 247 void UserEventTabDlg:: slotRemoveTab(QWidget* tab)248 { 249 if ( tabw->count() > 1)238 void UserEventTabDlg::moveLeft() 239 { 240 myTabs->setPreviousPage(); 241 } 242 243 void UserEventTabDlg::moveRight() 244 { 245 myTabs->setNextPage(); 246 } 247 248 void UserEventTabDlg::removeTab(QWidget* tab) 249 { 250 if (myTabs->count() > 1) 250 251 { 251 int index = tabw->indexOf(tab);252 tabw->removeTab(index);252 int index = myTabs->indexOf(tab); 253 myTabs->removeTab(index); 253 254 tab->close(); 254 255 tab->setEnabled(false); … … 259 260 } 260 261 261 void UserEventTabDlg::s lotSetMsgWinSticky(bool sticky)262 void UserEventTabDlg::setMsgWinSticky(bool sticky) 262 263 { 263 264 Support::changeWinSticky(winId(), sticky); … … 270 271 setWindowTitle(title); 271 272 272 QIcon icon = tabw->tabIcon(tabw->indexOf(tab));273 QIcon icon = myTabs->tabIcon(myTabs->indexOf(tab)); 273 274 if (!icon.isNull()) 274 275 setWindowIcon(icon); … … 281 282 282 283 UserSendCommon* e = dynamic_cast<UserSendCommon*>(tab); 283 QTimer::singleShot(e->clearDelay, e, SLOT( slotClearNewEvents()));284 QTimer::singleShot(e->clearDelay, e, SLOT(clearNewEvents())); 284 285 } 285 286 -
trunk/qt4-gui/src/userevents/usereventtabdlg.h
r6046 r6108 58 58 59 59 public slots: 60 void slotCurrentChanged(int index);61 void slotMoveLeft();62 void slotMoveRight();63 void slotRemoveTab(QWidget* tab);64 void s lotSetMsgWinSticky(bool sticky = true);60 void currentChanged(int index); 61 void moveLeft(); 62 void moveRight(); 63 void removeTab(QWidget* tab); 64 void setMsgWinSticky(bool sticky = true); 65 65 66 66 private: 67 TabWidget* tabw;67 TabWidget* myTabs; 68 68 69 69 void updateTitle(QWidget* tab); -
trunk/qt4-gui/src/userevents/usersendchatevent.cpp
r6097 r6108 51 51 { 52 52 myChatPort = 0; 53 chkMass->setChecked(false);54 chkMass->setEnabled(false);53 myMassMessageCheck->setChecked(false); 54 myMassMessageCheck->setEnabled(false); 55 55 myForeColor->setEnabled(false); 56 56 myBackColor->setEnabled(false); 57 57 58 m ainWidget->addWidget(splView);58 myMainWidget->addWidget(myViewSplitter); 59 59 60 60 if (!Config::Chat::instance()->msgChatView()) 61 m leSend->setMinimumHeight(150);61 myMessageEdit->setMinimumHeight(150); 62 62 63 63 QHBoxLayout* h_lay = new QHBoxLayout(); 64 m ainWidget->addLayout(h_lay);65 lblItem= new QLabel(tr("Multiparty: "));66 h_lay->addWidget( lblItem);64 myMainWidget->addLayout(h_lay); 65 myItemLabel = new QLabel(tr("Multiparty: ")); 66 h_lay->addWidget(myItemLabel); 67 67 68 edtItem= new InfoField(false);69 h_lay->addWidget( edtItem);68 myItemEdit = new InfoField(false); 69 h_lay->addWidget(myItemEdit); 70 70 71 btnBrowse= new QPushButton(tr("Invite"));72 connect( btnBrowse, SIGNAL(clicked()), SLOT(inviteUser()));73 h_lay->addWidget( btnBrowse);71 myBrowseButton = new QPushButton(tr("Invite")); 72 connect(myBrowseButton, SIGNAL(clicked()), SLOT(inviteUser())); 73 h_lay->addWidget(myBrowseButton); 74 74 75 75 myBaseTitle += tr(" - Chat Request"); … … 80 80 81 81 setWindowTitle(myBaseTitle); 82 grpSendType->actions().at(ChatEvent)->setChecked(true);82 myEventTypeGroup->actions().at(ChatEvent)->setChecked(true); 83 83 } 84 84 … … 118 118 void UserSendChatEvent::resetSettings() 119 119 { 120 m leSend->clear();121 edtItem->clear();122 m leSend->setFocus();123 slotMassMessageToggled(false);120 myMessageEdit->clear(); 121 myItemEdit->clear(); 122 myMessageEdit->setFocus(); 123 massMessageToggled(false); 124 124 } 125 125 … … 134 134 if (j->exec() && (chatDlg = j->JoinedChat()) != NULL) 135 135 { 136 edtItem->setText(j->ChatClients());136 myItemEdit->setText(j->ChatClients());
