Changeset 3467 for branches/protocol_plugin_1_3_0
- Timestamp:
- 04/30/03 14:40:47 (6 years ago)
- Location:
- branches/protocol_plugin_1_3_0/qt-gui/src
- Files:
-
- 39 modified
-
adduserdlg.cpp (modified) (5 diffs)
-
authuserdlg.cpp (modified) (2 diffs)
-
authuserdlg.h (modified) (2 diffs)
-
awaymsgdlg.cpp (modified) (4 diffs)
-
awaymsgdlg.h (modified) (2 diffs)
-
chatdlg.cpp (modified) (4 diffs)
-
chatdlg.h (modified) (3 diffs)
-
ewidgets.cpp (modified) (8 diffs)
-
ewidgets.h (modified) (1 diff)
-
filedlg.cpp (modified) (3 diffs)
-
filedlg.h (modified) (3 diffs)
-
forwarddlg.cpp (modified) (6 diffs)
-
forwarddlg.h (modified) (1 diff)
-
keyrequestdlg.cpp (modified) (5 diffs)
-
keyrequestdlg.h (modified) (1 diff)
-
mainwin.cpp (modified) (63 diffs)
-
mainwin.h (modified) (9 diffs)
-
mmlistview.cpp (modified) (7 diffs)
-
mmlistview.h (modified) (3 diffs)
-
mmsenddlg.cpp (modified) (8 diffs)
-
mmsenddlg.h (modified) (2 diffs)
-
refusedlg.cpp (modified) (1 diff)
-
refusedlg.h (modified) (1 diff)
-
reqauthdlg.cpp (modified) (3 diffs)
-
reqauthdlg.h (modified) (1 diff)
-
showawaymsgdlg.cpp (modified) (6 diffs)
-
showawaymsgdlg.h (modified) (1 diff)
-
sigman.cpp (modified) (2 diffs)
-
sigman.h (modified) (1 diff)
-
userbox.cpp (modified) (32 diffs)
-
userbox.h (modified) (4 diffs)
-
usercodec.cpp (modified) (1 diff)
-
usercodec.h (modified) (2 diffs)
-
usereventdlg.cpp (modified) (44 diffs)
-
usereventdlg.h (modified) (11 diffs)
-
userinfodlg.cpp (modified) (23 diffs)
-
userinfodlg.h (modified) (4 diffs)
-
utilitydlg.cpp (modified) (5 diffs)
-
utilitydlg.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/protocol_plugin_1_3_0/qt-gui/src/adduserdlg.cpp
r3274 r3467 32 32 #include "licq_icqd.h" 33 33 34 //TODO Add a drop down list of the avaialable protocols 35 // that a user may be added for 34 36 AddUserDlg::AddUserDlg(CICQDaemon *s, QWidget *parent) 35 37 : LicqDialog(parent, "AddUserDialog") 36 38 { 37 39 server = s; 38 40 39 41 QBoxLayout *lay = new QBoxLayout(this, QBoxLayout::Down, 8); 40 42 QFrame *frmUin = new QFrame(this); … … 46 48 lay->addStretch(); 47 49 lay->addWidget(frmBtn); 48 50 49 51 QBoxLayout *layUin = new QBoxLayout(frmUin, QBoxLayout::LeftToRight); 50 lblUin = new QLabel(tr("New User UIN:"), frmUin); 52 #ifdef QT_PROTOCOL_PLUGIN 53 lblUin = new QLabel(tr("New User Id:"), frmUin); 51 54 edtUin = new QLineEdit(frmUin); 55 #else 56 lblUin = new QLabel(tr("New User UIN:"), frmUin); 57 edtUin = new QLineEdit(frmUin); 52 58 edtUin->setValidator(new QIntValidator(10000, 2147483647, edtUin)); 59 #endif 53 60 layUin->addWidget(lblUin); 54 61 layUin->addWidget(edtUin); 55 62 56 63 QBoxLayout *layBtn = new QBoxLayout(frmBtn, QBoxLayout::LeftToRight); 57 64 btnOk = new QPushButton(tr("&Ok"), frmBtn); … … 61 68 layBtn->addSpacing(20); 62 69 layBtn->addWidget(btnCancel); 63 70 64 71 setCaption(tr("Licq - Add User")); 65 72 connect (btnOk, SIGNAL(clicked()), SLOT(ok()) ); … … 84 91 void AddUserDlg::ok() 85 92 { 93 #ifdef QT_PROTOCOL_PLUGIN 94 QString strUser = edtUin->text().latin1(); 95 if (!strUser.isEmpty()) 96 { 97 //TODO Get protocol 98 server->AddUserToList(strUser, LICQ_PPID); 99 } 100 #else 86 101 unsigned long nUin = edtUin->text().toULong(); 87 102 if (nUin != 0) … … 91 106 server->icqAlertUser(nUin); 92 107 } 108 #endif 93 109 close(true); 94 110 } -
branches/protocol_plugin_1_3_0/qt-gui/src/authuserdlg.cpp
r3183 r3467 35 35 #include "licq_icqd.h" 36 36 #include "usercodec.h" 37 38 #ifdef QT_PROTOCOL_PLUGIN 39 //TODO Add drop down list of avaiable protocols 40 AuthUserDlg::AuthUserDlg(CICQDaemon *s, const char *szId, unsigned long nPPID, 41 bool bGrant, QWidget *parent) 42 : LicqDialog(parent, "AuthUserDialog", false, WDestructiveClose) 43 { 44 server = s; 45 m_szId = szId ? strdup(szId) : 0; 46 m_nPPID = nPPID; 47 m_bGrant = bGrant; 48 49 if(bGrant) 50 setCaption(tr("Licq - Grant Authorisation")); 51 else 52 setCaption(tr("Licq - Refuse Authorisation")); 53 54 QBoxLayout* toplay = new QVBoxLayout(this, 8, 8); 55 56 lblUin = new QLabel(this); 57 lblUin->setAlignment(AlignCenter); 58 if (m_szId == 0) 59 { 60 lblUin->setText(tr("Authorize which user (Id):")); 61 edtUin = new QLineEdit(this); 62 edtUin->setMinimumWidth(90); 63 connect (edtUin, SIGNAL(returnPressed()), SLOT(ok()) ); 64 QBoxLayout* lay = new QHBoxLayout(toplay); 65 lay->addWidget(lblUin); 66 lay->addWidget(edtUin); 67 } 68 else 69 { 70 edtUin = NULL; 71 toplay->addWidget(lblUin); 72 QString userName; 73 ICQUser *u = gUserManager.FetchUser(m_szId, m_nPPID, LOCK_R); 74 if (u != NULL) { 75 QTextCodec *codec = UserCodec::codecForICQUser(u); 76 userName = QString("%1 (%2)").arg(codec->toUnicode(u->GetAlias())).arg(m_szId); 77 gUserManager.DropUser(u); 78 } else { 79 userName = QString("%1").arg(m_szId); 80 } 81 82 if (bGrant) 83 lblUin->setText(tr("Grant authorization to %1").arg(userName)); 84 else 85 lblUin->setText(tr("Refuse authorization to %1").arg(userName)); 86 } 87 88 toplay->addSpacing(6); 89 90 grpResponse = new QVGroupBox(tr("Response"), this); 91 toplay->addWidget(grpResponse); 92 toplay->setStretchFactor(grpResponse, 2); 93 94 mleResponse = new MLEditWrap(true, grpResponse); 95 96 QBoxLayout* lay = new QHBoxLayout(toplay); 97 lay->addStretch(1); 98 btnOk = new QPushButton(tr("&Ok"), this); 99 btnOk->setMinimumWidth(75); 100 lay->addWidget(btnOk); 101 btnCancel = new QPushButton(tr("&Cancel"), this); 102 btnCancel->setMinimumWidth(75); 103 lay->addWidget(btnCancel); 104 connect (mleResponse, SIGNAL(signal_CtrlEnterPressed()), this, SLOT(ok())); 105 connect (btnOk, SIGNAL(clicked()), SLOT(ok()) ); 106 connect (btnCancel, SIGNAL(clicked()), SLOT(close()) ); 107 108 if (m_szId) 109 mleResponse->setFocus(); 110 else 111 edtUin->setFocus(); 112 113 show(); 114 } 115 #endif 37 116 38 117 AuthUserDlg::AuthUserDlg(CICQDaemon *s, unsigned long nUin, bool bGrant, … … 114 193 void AuthUserDlg::ok() 115 194 { 116 unsigned long nUin = m_nUin; 117 if (nUin == 0) nUin = edtUin->text().toULong(); 118 119 if (nUin != 0) 120 { 121 QTextCodec *codec = UserCodec::codecForUIN(nUin); 195 if (edtUin != NULL) 196 { 197 if (edtUin->text().isEmpty()) return; 198 m_nUin = edtUin->text().toULong(); 199 } 200 201 #ifdef QT_PROTOCOL_PLUGIN 202 if (m_szId == 0) m_szId = strdup(edtUin->text().latin1()); 203 204 if (m_szId != 0) 205 { 206 //TODO 207 QTextCodec *codec = UserCodec::codecForProtoUser(m_szId, LICQ_PPID); 122 208 if (m_bGrant) 123 server->icqAuthorizeGrant( nUin, codec->fromUnicode(mleResponse->text()));124 else 125 server->icqAuthorizeRefuse( nUin, codec->fromUnicode(mleResponse->text()));209 server->icqAuthorizeGrant(strtoul(m_szId, (char **)NULL, 10), codec->fromUnicode(mleResponse->text())); 210 else 211 server->icqAuthorizeRefuse(strtoul(m_szId, (char **)NULL, 10), codec->fromUnicode(mleResponse->text())); 126 212 close(true); 127 213 } 214 #else 215 if (m_nUin) 216 { 217 QTextCodec *codec = UserCodec::codecForUIN(m_nUin); 218 if (m_bGrant) 219 server->icqAuthorizeGrant(m_nUin, codec->fromUnicode(mleResponse->text())); 220 else 221 server->icqAuthorizeRefuse(m_nUin, codec->fromUnicode(mleResponse->text())); 222 close(true); 223 } 224 #endif 128 225 } 129 226 -
branches/protocol_plugin_1_3_0/qt-gui/src/authuserdlg.h
r3183 r3467 18 18 AuthUserDlg (CICQDaemon *s, unsigned long nUin, bool bGrant, 19 19 QWidget *parent = 0); 20 #ifdef QT_PROTOCOL_PLUGIN 21 AuthUserDlg (CICQDaemon *s, const char *szId, unsigned long nPPID, 22 bool bGrant, QWidget *parent = 0); 23 #endif 24 20 25 protected: 21 26 CICQDaemon *server; … … 27 32 28 33 unsigned long m_nUin; 34 #ifdef QT_PROTOCOL_PLUGIN 35 char *m_szId; 36 unsigned long m_nPPID; 37 #endif 38 29 39 bool m_bGrant; 30 40 protected slots: -
branches/protocol_plugin_1_3_0/qt-gui/src/awaymsgdlg.cpp
r3236 r3467 220 220 // ----------------------------------------------------------------------------- 221 221 222 CustomAwayMsgDlg::CustomAwayMsgDlg(unsigned long nUin, QWidget *parent) 222 #ifdef QT_PROTOCOL_PLUGIN 223 CustomAwayMsgDlg::CustomAwayMsgDlg(const char *szId, 224 unsigned long nPPID, QWidget *parent) 223 225 : LicqDialog(parent, "CustomAwayMessageDialog", false, WDestructiveClose) 224 226 { 225 m_nUin = nUin; 227 m_szId = szId ? strdup(szId) : 0; 228 m_nPPID = nPPID; 226 229 227 230 QBoxLayout* top_lay = new QVBoxLayout(this, 10); … … 260 263 l->addWidget(btnCancel); 261 264 265 ICQUser *u = gUserManager.FetchUser(m_szId, m_nPPID, LOCK_R); 266 setCaption(QString(tr("Set Custom Auto Response for %1")) 267 .arg(QString::fromLocal8Bit(u->GetAlias()))); 268 if (*u->CustomAutoResponse()) 269 mleAwayMsg->setText(QString::fromLocal8Bit(u->CustomAutoResponse())); 270 else if (u->StatusToUser() != ICQ_STATUS_OFFLINE) 271 mleAwayMsg->setText(tr("I am currently %1.\nYou can leave me a message.") 272 .arg(ICQUser::StatusToStatusStr(u->StatusToUser(), false))); 273 274 gUserManager.DropUser(u); 275 276 mleAwayMsg->setFocus(); 277 QTimer::singleShot(0, mleAwayMsg, SLOT(selectAll())); 278 279 show(); 280 } 281 #endif 282 283 CustomAwayMsgDlg::CustomAwayMsgDlg(unsigned long nUin, QWidget *parent) 284 : LicqDialog(parent, "CustomAwayMessageDialog", false, WDestructiveClose) 285 { 286 m_nUin = nUin; 287 288 QBoxLayout* top_lay = new QVBoxLayout(this, 10); 289 290 mleAwayMsg = new MLEditWrap(true, this); 291 connect(mleAwayMsg, SIGNAL(signal_CtrlEnterPressed()), this, SLOT(slot_ok())); 292 top_lay->addWidget(mleAwayMsg); 293 294 QBoxLayout* l = new QHBoxLayout(top_lay, 10); 295 296 int bw = 75; 297 QPushButton *btnHints = new QPushButton(tr("&Hints"), this); 298 connect(btnHints, SIGNAL(clicked()), SLOT(slot_hints())); 299 QPushButton *btnOk = new QPushButton(tr("&Ok"), this ); 300 btnOk->setDefault(true); 301 connect( btnOk, SIGNAL(clicked()), SLOT(slot_ok()) ); 302 QPushButton *btnClear = new QPushButton(tr("&Clear"), this ); 303 connect( btnClear, SIGNAL(clicked()), SLOT(slot_clear()) ); 304 QPushButton *btnCancel = new QPushButton(tr("&Cancel"), this ); 305 connect( btnCancel, SIGNAL(clicked()), SLOT(close()) ); 306 bw = QMAX(bw, btnOk->sizeHint().width()); 307 bw = QMAX(bw, btnClear->sizeHint().width()); 308 bw = QMAX(bw, btnCancel->sizeHint().width()); 309 bw = QMAX(bw, btnHints->sizeHint().width()); 310 btnOk->setFixedWidth(bw); 311 btnClear->setFixedWidth(bw); 312 btnCancel->setFixedWidth(bw); 313 btnHints->setFixedWidth(bw); 314 315 l->addStretch(1); 316 l->addSpacing(30); 317 l->addWidget(btnHints); 318 l->addSpacing(20); 319 l->addWidget(btnOk); 320 l->addWidget(btnClear); 321 l->addWidget(btnCancel); 322 262 323 ICQUser *u = gUserManager.FetchUser(m_nUin, LOCK_R); 263 324 setCaption(QString(tr("Set Custom Auto Response for %1")) … … 292 353 s.truncate(s.length()-1); 293 354 355 #ifdef QT_PROTOCOL_PLUGIN 356 ICQUser *u = gUserManager.FetchUser(m_szId, m_nPPID, LOCK_W); 357 #else 294 358 ICQUser *u = gUserManager.FetchUser(m_nUin, LOCK_W); 359 #endif 295 360 if (u != NULL) 296 361 { 297 362 u->SetCustomAutoResponse(s.local8Bit()); 298 363 gUserManager.DropUser(u); 364 #ifdef QT_PROTOCOL_PLUGIN 365 CICQSignal sig(SIGNAL_UPDATExUSER, USER_BASIC, m_szId, m_nPPID); 366 #else 299 367 CICQSignal sig(SIGNAL_UPDATExUSER, USER_BASIC, m_nUin); 368 #endif 300 369 gMainWindow->slot_updatedUser(&sig); 301 370 } … … 306 375 void CustomAwayMsgDlg::slot_clear() 307 376 { 377 #ifdef QT_PROTOCOL_PLUGIN 378 ICQUser *u = gUserManager.FetchUser(m_szId, m_nPPID, LOCK_W); 379 #else 308 380 ICQUser *u = gUserManager.FetchUser(m_nUin, LOCK_W); 381 #endif 309 382 if (u != NULL) 310 383 { 311 384 u->ClearCustomAutoResponse(); 312 385 gUserManager.DropUser(u); 386 #ifdef QT_PROTOCOL_PLUGIN 387 CICQSignal sig(SIGNAL_UPDATExUSER, USER_BASIC, m_szId, m_nPPID); 388 #else 313 389 CICQSignal sig(SIGNAL_UPDATExUSER, USER_BASIC, m_nUin); 390 #endif 314 391 gMainWindow->slot_updatedUser(&sig); 315 392 } -
branches/protocol_plugin_1_3_0/qt-gui/src/awaymsgdlg.h
r3183 r3467 43 43 public: 44 44 CustomAwayMsgDlg(unsigned long, QWidget *parent = 0); 45 #ifdef QT_PROTOCOL_PLUGIN 46 CustomAwayMsgDlg(const char *, unsigned long, QWidget *parent = 0); 47 #endif 45 48 46 49 protected: 47 50 MLEditWrap *mleAwayMsg; 48 51 unsigned long m_nUin; 52 #ifdef QT_PROTOCOL_PLUGIN 53 char *m_szId; 54 unsigned long m_nPPID; 55 #endif 49 56 50 57 protected slots: … … 56 63 57 64 #endif 65 -
branches/protocol_plugin_1_3_0/qt-gui/src/chatdlg.cpp
r3230 r3467 42 42 #include <qclipboard.h> 43 43 #include <qtextstream.h> 44 #include <qwindowsstyle.h>45 44 #include <qmenubar.h> 46 45 #include <qtextcodec.h> … … 111 110 // --------------------------------------------------------------------------- 112 111 113 ChatDlg::ChatDlg(unsigned long _nUin, CICQDaemon *daemon, 112 #ifdef QT_PROTOCOL_PLUGIN 113 ChatDlg::ChatDlg(const char *szId, unsigned long nPPID, CICQDaemon *daemon, 114 114 CMainWindow *m, QWidget *parent) 115 115 : QMainWindow(parent, "ChatDialog", WDestructiveClose) 116 116 { 117 m_nUin = _nUin; 117 m_szId = szId ? strdup(szId) : 0; 118 m_nPPID = nPPID; 118 119 m_bAudio = true; 119 120 licqDaemon = daemon; … … 329 330 } 330 331 } 331 332 333 ++it; 334 } 335 336 tbtEncoding = new QToolButton(barChat); 337 tbtEncoding->setTextLabel(tr("Set Encoding")); 338 tbtEncoding->setPopup(popupEncoding); 339 tbtEncoding->setPopupDelay(0); 340 tbtEncoding->setPixmap(mainwin->pmEncoding); 341 342 // QWidget* dummy = new QWidget(barChat); 343 // barChat->setStretchableWidget(dummy); 344 345 QGridLayout *g = new QGridLayout(widCentral, 2, 1, 6, 4); 346 g->addWidget(boxPane, 0, 0); 347 g->addWidget(boxIRC, 0, 0); 348 349 SwitchToPaneMode(); 350 351 // Add ourselves to the list 352 chatDlgs.push_back(this); 353 354 // Create the chat manager using our font 355 QFontInfo fi(mlePaneLocal->font()); 356 QFontDatabase fd; //QFontInfo.fixedPitch returns incorrect info??? 357 unsigned char style = STYLE_DONTCARE; 358 #if QT_VERSION >= 230 359 if (fd.isFixedPitch(fi.family(), fd.styleString(mlePaneLocal->font()))) 360 style |= STYLE_FIXEDxPITCH; 361 else 362 style |= STYLE_VARIABLExPITCH; 363 #endif 364 unsigned char encoding = UserCodec::charsetForName(codec->name()); 365 //TODO in daemon 366 chatman = new CChatManager(daemon, strtoul(m_szId, (char **)NULL, 10), 367 fi.family().local8Bit(), 368 encoding, style, fi.pointSize(), fi.bold(), fi.italic(), fi.underline(), 369 fi.strikeOut()); 370 371 sn = new QSocketNotifier(chatman->Pipe(), QSocketNotifier::Read); 372 connect(sn, SIGNAL(activated(int)), this, SLOT(slot_chat())); 373 374 // But use the chat manager default colors 375 mlePaneLocal->setForeground(QColor(chatman->ColorFg()[0], 376 chatman->ColorFg()[1], chatman->ColorFg()[2])); 377 mlePaneLocal->setBackground(QColor(chatman->ColorBg()[0], 378 chatman->ColorBg()[1], chatman->ColorBg()[2])); 379 mleIRCLocal->setForeground(QColor(chatman->ColorFg()[0], 380 chatman->ColorFg()[1], chatman->ColorFg()[2])); 381 mleIRCLocal->setBackground(QColor(chatman->ColorBg()[0], 382 chatman->ColorBg()[1], chatman->ColorBg()[2])); 383 mleIRCRemote->setForeground(QColor(chatman->ColorFg()[0], 384 chatman->ColorFg()[1], chatman->ColorFg()[2])); 385 mleIRCRemote->setBackground(QColor(chatman->ColorBg()[0], 386 chatman->ColorBg()[1], chatman->ColorBg()[2])); 387 chatname = QString::fromLocal8Bit(chatman->Name()); 388 lstUsers->insertItem(chatname); 389 lblLocal->setText(tr("Local - %1").arg(chatname)); 390 391 widCentral->setMinimumSize(400, 300); 392 resize(500, 475); 393 show(); 394 } 395 #endif 396 397 ChatDlg::ChatDlg(unsigned long _nUin, CICQDaemon *daemon, 398 CMainWindow *m, QWidget *parent) 399 : QMainWindow(parent, "ChatDialog", WDestructiveClose) 400 { 401 m_nUin = _nUin; 402 m_bAudio = true; 403 licqDaemon = daemon; 404 sn = NULL; 405 mainwin = m; 406 407 m_nMode = CHAT_PANE; 408 409 setCaption(tr("Licq - Chat")); 410 statusBar(); 411 // central widget 412 QWidget* widCentral = new QWidget(this); 413 setCentralWidget(widCentral); 414 415 setOpaqueMoving(true); 416 setToolBarsMovable(true); 417 #if QT_VERSION < 300 418 setDockEnabled(Bottom, true); 419 #else 420 setDockEnabled(DockBottom, true); 421 #endif 422 setUsesBigPixmaps(false); 423 424 // Pane mode setup 425 boxPane = new QGroupBox(widCentral); 426 paneLayout = new QGridLayout(boxPane, 3, 1, 4); 427 remoteLayout = new QGridLayout(2, 1, 4); 428 paneLayout->addLayout(remoteLayout, 0, 0); 429 lblRemote = new QLabel(tr("Remote - Not connected"), boxPane); 430 remoteLayout->addWidget(lblRemote, 0, 0); 431 remoteLayout->setRowStretch(1, 1); 432 433 paneLayout->addRowSpacing(1, 15); 434 435 QGridLayout *llay = new QGridLayout(2, 1, 4); 436 paneLayout->addLayout(llay, 2, 0); 437 lblLocal = new QLabel(boxPane); 438 mlePaneLocal = new CChatWindow(boxPane); 439 mlePaneLocal->setMinimumHeight(100); 440 mlePaneLocal->setMinimumWidth(150); 441 mlePaneLocal->setEnabled(false); 442 llay->addWidget(lblLocal, 0, 0); 443 llay->addWidget(mlePaneLocal, 1, 0); 444 llay->setRowStretch(1, 1); 445 446 // IRC mode setup 447 boxIRC = new QGroupBox(widCentral); 448 QGridLayout *lay = new QGridLayout(boxIRC, 2, 2, 4); 449 mleIRCRemote = new CChatWindow(boxIRC); 450 mleIRCRemote->setReadOnly(true); 451 mleIRCRemote->setMinimumHeight(100); 452 mleIRCRemote->setMinimumWidth(150); 453 lay->addWidget(mleIRCRemote, 0, 0); 454 lstUsers = new QListBox(boxIRC); 455 lay->addMultiCellWidget(lstUsers, 0, 1, 1, 1); 456 mleIRCLocal = new CChatWindow(boxIRC); 457 mleIRCLocal->setEnabled(false); 458 mleIRCLocal->setFixedHeight(mleIRCLocal->fontMetrics().lineSpacing() * 4); 459 lay->addWidget(mleIRCLocal, 1, 0); 460 lay->setRowStretch(0, 1); 461 lay->setColStretch(0, 1); 462 463 // Generic setup 464 mnuMain = new QPopupMenu(this); 465 mnuMain->insertItem(tr("&Audio"), this, SLOT(slot_audio()), ALT + Key_A, mnuChatAudio); 466 mnuMain->insertItem(tr("&Save Chat"), this, SLOT(slot_save()), ALT + Key_S, mnuChatSave); 467 mnuMain->insertSeparator(); 468 mnuMain->insertItem(tr("&Close Chat"), this, SLOT(close()), ALT + Key_Q); 469 mnuMode = new QPopupMenu(this); 470 mnuMode->insertItem(tr("&Pane Mode"), this, SLOT(SwitchToPaneMode())); 471 mnuMode->insertItem(tr("&IRC Mode"), this, SLOT(SwitchToIRCMode())); 472 menuBar()->insertItem(tr("Chat"), mnuMain); 473 menuBar()->insertItem(tr("Mode"), mnuMode); 474 475 mnuMain->setItemChecked(mnuChatAudio, m_bAudio); 476 477 // Toolbar 478 QToolBar* barChat = new QToolBar("label", this); 479 addToolBar(barChat, "Chat Toolbar"); 480 barChat->setHorizontalStretchable(false); 481 barChat->setVerticalStretchable(true); 482 barChat->setFixedHeight(barChat->height()+2); 483 484 // ### FIXME: implement laughing 485 // tbtLaugh = new QToolButton(LeftArrow, barChat); 486 487 QPixmap* pixIgnore = new QPixmap(chatIgnore_xpm); 488 qPixmaps.push_back(pixIgnore); 489 tbtIgnore = new QToolButton(*pixIgnore, tr("Ignore user settings"), 490 tr("Ignores user color settings"), this, SLOT(updateRemoteStyle()), barChat); 491 tbtIgnore->setToggleButton(true); 492 493 QPixmap* pixBeep = new QPixmap(chatBeep_xpm); 494 qPixmaps.push_back(pixBeep); 495 tbtBeep = new QToolButton(*pixBeep, tr("Beep"), 496 tr("Sends a Beep to all recipients"),this, SLOT(chatSendBeep()), barChat); 497 498 barChat->addSeparator(); 499 500 QPixmap* pixFg = new QPixmap(chatChangeFg_xpm); 501 qPixmaps.push_back(pixFg); 502 tbtFg = new QToolButton(*pixFg, tr("Foreground color"), 503 tr("Changes the foreground color"), this, SLOT(changeFrontColor()), barChat); 504 mnuFg = new QPopupMenu(this); 505 506 QPixmap* pixBg = new QPixmap(chatChangeBg_xpm); 507 qPixmaps.push_back(pixBg); 508 tbtBg = new QToolButton(*pixBg, tr("Background color"), 509 tr("Changes the background color"), this, SLOT(changeBackColor()), barChat); 510 511 mnuBg = new QPopupMenu(this); 512 513 for(unsigned int i = 0; i < NUM_COLORS; i++) 514 { 515 QPixmap *pix = new QPixmap(48, 14); 516 qPixmaps.push_back(pix); 517 QPainter p(pix); 518 QColor c (col_array[i*3+0], col_array[i*3+1], col_array[i*3+2]); 519 520 pix->fill(c); 521 p.drawRect(0, 0, 48, 14); 522 523 mnuBg->insertItem(*pix, i); 524 QPixmap* pixf = new QPixmap(48, 14); 525 qPixmaps.push_back(pixf); 526 pixf->fill(colorGroup().background()); 527 QPainter pf(pixf); 528 pf.setPen(c); 529 pf.drawText(5, 12, QString("Abc")); 530 mnuFg->insertItem(*pixf, i); 531 } 532 barChat->addSeparator(); 533 534 QPixmap* pixBold = new QPixmap(chatBold_xpm); 535 qPixmaps.push_back(pixBold); 536 tbtBold = new QToolButton(*pixBold, tr("Bold"), 537 tr("Toggles Bold font") , this, SLOT(fontStyleChanged()), barChat); 538 tbtBold->setToggleButton(true); 539 540 QPixmap* pixItalic = new QPixmap(chatItalic_xpm); 541 qPixmaps.push_back(pixItalic); 542 tbtItalic = new QToolButton(*pixItalic, tr("Italic"), 543 tr("Toggles Italic font"), this, SLOT(fontStyleChanged()), barChat); 544 tbtItalic->setToggleButton(true); 545 546 QPixmap *pixUnder = new QPixmap(chatUnder_xpm); 547 qPixmaps.push_back(pixUnder); 548 tbtUnderline = new QToolButton(*pixUnder, tr("Underline"), 549 tr("Toggles Bold font"), this, SLOT(fontStyleChanged()), barChat); 550 tbtUnderline->setToggleButton(true); 551 552 QPixmap *pixStrike = new QPixmap(chatStrike_xpm); 553 qPixmaps.push_back(pixStrike); 554 tbtStrikeOut = new QToolButton(*pixStrike, tr("StrikeOut"), 555 tr("Toggles StrikeOut font"), this, SLOT(fontStyleChanged()), barChat); 556 tbtStrikeOut->setToggleButton(true); 557 558 tbtBold->setAutoRaise(false); 559 tbtItalic->setAutoRaise(false); 560 tbtUnderline->setAutoRaise(false); 561 tbtStrikeOut->setAutoRaise(false); 562 563 barChat->addSeparator(); 564 565 cmbFontSize = new QComboBox(true, barChat); 566 cmbFontSize->setInsertionPolicy(QComboBox::NoInsertion); 567 //windows font size limit seems to be 1638 (tested 98, 2000) 568 cmbFontSize->setValidator(new QIntValidator(1, 1638, cmbFontSize)); 569 connect(cmbFontSize, SIGNAL(activated(const QString&)), SLOT(fontSizeChanged(const QString&))); 570 cmbFontSize->insertItem(QString::number(font().pointSize())); 571 572 QValueList<int> sizes = QFontDatabase::standardSizes(); 573 for(unsigned i = 0; i < sizes.count(); i++) 574 if(sizes[i] != font().pointSize()) 575 cmbFontSize->insertItem(QString::number(sizes[i])); 576 577 QFontDatabase fb; 578 cmbFontName = new QComboBox(false, barChat); 579 #if 0 580 cmbFontName->setSizeLimit(15); 581 QStringList sl = fb.families(); 582 while(sl.at(55) != sl.end()) sl.remove(sl.at(55)); 583 #endif 584 // cmbFontName->setFixedSize(cmbFontName->sizeHint()); 585 cmbFontName->insertStringList(fb.families()); 586 barChat->setStretchableWidget(cmbFontName); 587 connect(cmbFontName, SIGNAL(activated(const QString&)), SLOT(fontNameChanged(const QString&))); 588 589 barChat->addSeparator(); 590 591 codec = QTextCodec::codecForLocale(); 592 593 QString codec_name = QString::fromLatin1( codec->name() ).lower(); // TODO: determine best codec 594 QPopupMenu *popupEncoding = new QPopupMenu; 595 popupEncoding->setCheckable(true); 596 <
