Changeset 4792

Show
Ignore:
Timestamp:
11/30/06 05:39:56 (21 months ago)
Author:
erijo
Message:

Patch from Anders Olofsson to add option to hide "user has joined/left conversation" messages. Closes #1442.

Location:
trunk/qt-gui/src
Files:
6 modified

Legend:

Unmodified
Added
Removed
  • trunk/qt-gui/src/ewidgets.cpp

    r4791 r4792  
    712712    m_appendLineBreak = m->m_chatAppendLineBreak; 
    713713  } 
     714  m_showNotices = m->m_showNotices; 
    714715  m_colorRcv = m->m_colorRcv; 
    715716  m_colorSnt = m->m_colorSnt; 
     
    762763    m_appendLineBreak = m->m_chatAppendLineBreak; 
    763764  } 
     765  m_showNotices = m->m_showNotices; 
    764766  m_colorRcv = m->m_colorRcv; 
    765767  m_colorSnt = m->m_colorSnt; 
     
    10841086void CMessageViewWidget::addNotice(QDateTime dt, QString messageText) 
    10851087{ 
     1088  if (!m_showNotices) 
     1089    return; 
     1090 
    10861091  QString color = m_colorNotice.name(); 
    10871092  QString s = ""; 
    10881093  const QString dateTime = dt.toString( m_nDateFormat ); 
    10891094 
    1090   /* Remove trailing line breaks. */ 
    1091   for (unsigned int i = messageText.length() - 1; i >= 0; i--) 
    1092   { 
    1093     if (messageText.at(i) == '\n' || messageText.at(i) == '\r') 
     1095  // Remove trailing line breaks. 
     1096  for (int i = messageText.length(); i >= 0; i--) 
     1097  { 
     1098    if (messageText.at(i - 1) != '\n' && messageText.at(i - 1) != '\r') 
     1099    { 
    10941100      messageText.truncate(i); 
    1095     else 
    1096       break; 
    1097   } 
    1098  
     1101      break; 
     1102    } 
     1103  } 
    10991104 
    11001105  switch (m_nMsgStyle) 
  • trunk/qt-gui/src/ewidgets.h

    r4791 r4792  
    221221  bool m_appendLineBreak; 
    222222  bool m_useBuffer; 
     223  bool m_showNotices; 
    223224  QColor m_colorRcvHistory; 
    224225  QColor m_colorSntHistory; 
  • trunk/qt-gui/src/mainwin.cpp

    r4791 r4792  
    430430  licqConf.ReadBool("TabbedChatting", m_bTabbedChatting, true); 
    431431  licqConf.ReadBool("ShowHistory", m_bShowHistory, true); 
     432  licqConf.ReadBool("ShowNotices", m_showNotices, true); 
    432433  licqConf.ReadBool("AutoPosReplyWin", m_bAutoPosReplyWin, true); 
    433434  licqConf.ReadBool("AutoSendThroughServer", m_bAutoSendThroughServer, false); 
     
    35723573  licqConf.WriteBool("TabbedChatting", m_bTabbedChatting); 
    35733574  licqConf.WriteBool("ShowHistory", m_bShowHistory); 
     3575  licqConf.WriteBool("ShowNotices", m_showNotices); 
    35743576  licqConf.WriteBool("AutoPosReplyWin", m_bAutoPosReplyWin); 
    35753577  licqConf.WriteBool("AutoSendThroughServer", m_bAutoSendThroughServer); 
  • trunk/qt-gui/src/mainwin.h

    r4791 r4792  
    160160       m_bTabbedChatting, 
    161161       m_bShowHistory, 
     162       m_showNotices, 
    162163       m_bDisableDockIcon, 
    163164       m_bSortColumnAscending, 
  • trunk/qt-gui/src/optionsdlg.cpp

    r4791 r4792  
    229229  btnColorChatBkg->setPaletteBackgroundColor(mainwin->m_colorChatBkg); 
    230230  slot_refresh_msgViewer(); 
    231    
     231 
    232232  if (mainwin->m_bMsgChatView) 
    233233  { 
    234234    chkTabbedChatting->setChecked(mainwin->m_bTabbedChatting); 
    235235    chkShowHistory->setChecked(mainwin->m_bShowHistory); 
     236    chkShowNotices->setChecked(mainwin->m_showNotices); 
    236237  } 
    237238  else 
     
    239240    chkTabbedChatting->setEnabled(false); 
    240241    chkShowHistory->setEnabled(false); 
     242    chkShowNotices->setChecked(false); 
    241243  } 
    242244  chkSendTN->setChecked(mainwin->licqDaemon->SendTypingNotification()); 
     
    533535  mainwin->m_bTabbedChatting = chkTabbedChatting->isChecked(); 
    534536  mainwin->m_bShowHistory = chkShowHistory->isChecked(); 
     537  mainwin->m_showNotices = chkShowNotices->isChecked(); 
    535538  mainwin->m_bAutoPosReplyWin = chkAutoPosReplyWin->isChecked(); 
    536539  mainwin->m_bFlashTaskbar = chkFlashTaskbar->isChecked(); 
     
    838841  connect(chkMsgChatView, SIGNAL(toggled(bool)), this, SLOT(slot_useMsgChatView(bool))); 
    839842 
     843  chkShowNotices = new QCheckBox(tr("Show Join/Left Notices"), boxMainWin); 
     844  QWhatsThis::add(chkShowNotices, tr("Show a notice in the chat window when a user joins or leaves the conversation.")); 
     845  connect(chkShowNotices, SIGNAL(toggled(bool)), this, SLOT(slot_refresh_msgViewer())); 
     846 
    840847  chkSendTN = new QCheckBox(tr("Send typing notifications"), boxMainWin); 
    841848  QWhatsThis::add(chkSendTN, tr("Send a notification to the user so they can see when you are typing a message to them")); 
     
    11561163    chkTabbedChatting->setChecked(false); 
    11571164    chkShowHistory->setChecked(false); 
     1165    chkShowNotices->setEnabled(false); 
    11581166  } 
    11591167 
    11601168  chkTabbedChatting->setEnabled(b); 
    11611169  chkShowHistory->setEnabled(b); 
     1170  chkShowNotices->setEnabled(b); 
    11621171} 
    11631172 
     
    16951704  static QDateTime date = QDateTime::currentDateTime(); 
    16961705 
    1697   const char *names[2] = {"Marge", "Homer"}; 
    1698   const char *msgs[8] = { 
     1706  const char* const names[2] = {"Marge", "Homer"}; 
     1707  const char* const msgs[8] = { 
    16991708      QT_TR_NOOP("This is a received message"), 
    17001709      QT_TR_NOOP("This is a sent message"), 
     
    17101719  msgChatViewer->m_extraSpacing = chkChatVertSpacing->isChecked(); 
    17111720  msgChatViewer->m_appendLineBreak = chkChatLineBreak->isChecked(); 
     1721  msgChatViewer->m_showNotices = chkShowNotices->isChecked(); 
    17121722  msgChatViewer->m_colorSnt = btnColorSnt->paletteBackgroundColor(); 
    17131723  msgChatViewer->m_colorRcv = btnColorRcv->paletteBackgroundColor(); 
     
    17291739  msgChatViewer->clear(); 
    17301740  msgHistViewer->clear(); 
     1741 
     1742  QDateTime msgDate = date; 
    17311743  for (unsigned int i = 0; i<7; i++) 
    17321744  { 
    17331745    msgChatViewer->addMsg(i%2 == 0 ? D_RECEIVER : D_SENDER, (i<2), 
    17341746          QString(""), 
    1735           date, 
     1747          msgDate, 
    17361748          true, false, false, false,  
    17371749          names[i % 2], 
     
    17401752    msgHistViewer->addMsg(i%2 == 0 ? D_RECEIVER : D_SENDER, false, 
    17411753          QString(""), 
    1742           date, 
     1754          msgDate, 
    17431755          true, false, false, false, 
    17441756          names[i % 2], 
    17451757          MLView::toRichText(tr(msgs[i]), true, true)); 
    1746   } 
    1747   msgChatViewer->addNotice(date, MLView::toRichText(tr(msgs[7]), true, true)); 
     1758 
     1759    msgDate = msgDate.addSecs(i + 12); 
     1760  } 
     1761  msgDate = msgDate.addSecs(12); 
     1762  msgChatViewer->addNotice(msgDate, MLView::toRichText(tr(msgs[7]), true, true)); 
    17481763 
    17491764  msgHistViewer->updateContent(); 
  • trunk/qt-gui/src/optionsdlg.h

    r4791 r4792  
    115115             *chkFlashTaskbar, *chkAutoSendThroughServer, *chkTabbedChatting, 
    116116             *chkMainWinSticky, *chkMsgWinSticky, *chkSingleLineChatMode, 
    117              *chkEnableMainwinMouseMovement, *chkShowHistory, *chkSendTN; 
     117             *chkEnableMainwinMouseMovement, *chkShowHistory, *chkSendTN, *chkShowNotices; 
    118118   QRadioButton *rdbDockDefault, *rdbDockThemed, *rdbDockSmall; 
    119119   QComboBox *cmbDockTheme, *cmbSortBy;