Changeset 4474

Show
Ignore:
Timestamp:
07/03/06 04:27:11 (2 years ago)
Author:
erijo
Message:

Single line chat mode: send messages with enter, insert new lines with
ctrl+enter. Defaults to off. Closes #676.

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

Legend:

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

    r4472 r4474  
    448448  licqConf.ReadBool("MainWinSticky", m_bMainWinSticky, false); 
    449449  licqConf.ReadBool("MsgWinSticky", m_bMsgWinSticky, false); 
     450  licqConf.ReadBool("SingleLineChatMode", m_bSingleLineChatMode, false); 
    450451 
    451452  licqConf.ReadStr("ReceiveMessageColor", szTemp, "red"); 
     
    36413642  licqConf.WriteBool("MainWinSticky", m_bMainWinSticky); 
    36423643  licqConf.WriteBool("MsgWinSticky", m_bMsgWinSticky); 
     3644  licqConf.WriteBool("SingleLineChatMode", m_bSingleLineChatMode); 
    36433645 
    36443646  licqConf.WriteNum("ChatMessageStyle", m_nMsgStyle); 
  • trunk/qt-gui/src/mainwin.h

    r4443 r4474  
    157157       m_bMainWinSticky, 
    158158       m_bMsgWinSticky, 
     159       m_bSingleLineChatMode, 
    159160       m_bShowUserIcons; 
    160161 
  • trunk/qt-gui/src/mledit.cpp

    r4454 r4474  
    4747    setWordWrap(NoWrap); 
    4848  } 
    49  
    50   QAccel *a = new QAccel( this ); 
    51   a->connectItem(a->insertItem(Key_Enter + CTRL), 
    52                  this, SIGNAL(signal_CtrlEnterPressed())); 
    53   a->connectItem(a->insertItem(Key_Return + CTRL), 
    54                  this, SIGNAL(signal_CtrlEnterPressed())); 
    5549 
    5650  if (editFont) 
     
    183177      clear(); 
    184178      break; 
     179    case Key_Return: 
     180    case Key_Enter: 
     181      emit signal_CtrlEnterPressed(); 
     182      break; 
    185183    default: 
    186184      QMultiLineEdit::keyPressEvent(e); 
  • trunk/qt-gui/src/mledit.h

    r3246 r4474  
    1515  void GotoEnd(); 
    1616 
    17   using QMultiLineEdit::hasMarkedText; 
    18   using QMultiLineEdit::markedText; 
     17  using QMultiLineEdit::newLine; // make newLine() public 
    1918 
    2019  void setBackground(const QColor&); 
  • trunk/qt-gui/src/optionsdlg.cpp

    r4472 r4474  
    243243  chkMainWinSticky->setChecked(mainwin->m_bMainWinSticky); 
    244244  chkMsgWinSticky->setChecked(mainwin->m_bMsgWinSticky); 
     245  chkSingleLineChatMode->setChecked(mainwin->m_bSingleLineChatMode); 
    245246  popEmail->setChecked(mainwin->m_bPopEmail); 
    246247  popPhone->setChecked(mainwin->m_bPopPhone); 
     
    541542  mainwin->changeMainWinSticky(chkMainWinSticky->isChecked()); 
    542543  mainwin->m_bMsgWinSticky = chkMsgWinSticky->isChecked(); 
     544  mainwin->m_bSingleLineChatMode = chkSingleLineChatMode->isChecked(); 
    543545 
    544546  mainwin->m_bPopEmail= popEmail->isChecked(); 
     
    825827   "with your mouse")); 
    826828 
     829  chkSingleLineChatMode = new QCheckBox(tr("Single line chat mode"), boxMainWin); 
     830  QWhatsThis::add(chkSingleLineChatMode, tr("In single line chat mode you send messages with Enter " 
     831    "and insert new lines with Ctrl+Enter, opposite of the normal mode")); 
     832 
    827833  chkMsgChatView = new QCheckBox(tr("Chatmode Messageview"), boxMainWin); 
    828834  QWhatsThis::add(chkMsgChatView, tr("Show the current chat history in Send Window")); 
  • trunk/qt-gui/src/optionsdlg.h

    r4472 r4474  
    9494             *chkAlwaysShowONU, *chkScrollBar, *chkShowExtIcons, 
    9595             *chkSysBack, *chkSendFromClipboard, *chkMsgChatView, *chkAutoPosReplyWin, 
    96          *chkFlashTaskbar, *chkAutoSendThroughServer, *chkTabbedChatting, 
    97          *chkMainWinSticky, *chkMsgWinSticky, 
     96             *chkFlashTaskbar, *chkAutoSendThroughServer, *chkTabbedChatting, 
     97             *chkMainWinSticky, *chkMsgWinSticky, *chkSingleLineChatMode, 
    9898             *chkEnableMainwinMouseMovement, *chkShowHistory, *chkSendTN; 
    9999   QRadioButton *rdbDockDefault, *rdbDockThemed, *rdbDockSmall; 
  • trunk/qt-gui/src/usereventdlg.cpp

    r4452 r4474  
    3232#include <qcheckbox.h> 
    3333#include <qdatetime.h> 
     34#include <qevent.h> 
    3435#include <qfileinfo.h> 
    3536#include <qvbox.h> 
     
    17791780 
    17801781  mleSend = new MLEditWrap(true, splView, true); 
     1782  mleSend->installEventFilter(this); // Enables send with enter 
     1783 
    17811784  if (mainwin->m_bMsgChatView) 
    17821785  { 
     
    17971800UserSendCommon::~UserSendCommon() 
    17981801{ 
     1802} 
     1803 
     1804#undef KeyPress 
     1805bool UserSendCommon::eventFilter(QObject *watched, QEvent *e) 
     1806{ 
     1807  if (watched == mleSend) 
     1808  { 
     1809    // If we're in single line chat mode we send messages with Enter and 
     1810    // insert new lines with Ctrl+Enter. 
     1811    if (mainwin->m_bSingleLineChatMode && e->type() == QEvent::KeyPress) 
     1812    { 
     1813      QKeyEvent *key = static_cast<QKeyEvent*>(e); 
     1814      const bool isEnter = (key->key() == Key_Enter || key->key() == Key_Return); 
     1815      if (isEnter) 
     1816      { 
     1817       if (key->state() & ControlButton) 
     1818          mleSend->newLine(); 
     1819        else 
     1820          btnSend->animateClick(); 
     1821        return true; // filter the event out 
     1822      } 
     1823    } 
     1824    return false; 
     1825  } 
     1826  else 
     1827    return UserEventCommon::eventFilter(watched, e); 
    17991828} 
    18001829 
     
    28352864  edtItem = new CInfoField(mainWidget, false); 
    28362865  h_lay->addWidget(edtItem); 
     2866  edtItem->installEventFilter(this); 
    28372867 
    28382868  m_sBaseTitle += tr(" - URL"); 
     
    28482878UserSendUrlEvent::~UserSendUrlEvent() 
    28492879{ 
     2880} 
     2881 
     2882bool UserSendUrlEvent::eventFilter(QObject *watched, QEvent *e) 
     2883{ 
     2884  if (watched == edtItem) 
     2885  { 
     2886    if (e->type() == QEvent::KeyPress) 
     2887    { 
     2888      QKeyEvent *key = static_cast<QKeyEvent*>(e); 
     2889      const bool isEnter = (key->key() == Key_Enter || key->key() == Key_Return); 
     2890      if (isEnter && (mainwin->m_bSingleLineChatMode || key->state() & ControlButton)) 
     2891      { 
     2892        btnSend->animateClick(); 
     2893        return true; // filter the event out 
     2894      } 
     2895    } 
     2896    return false; 
     2897  } 
     2898  else 
     2899    return UserSendCommon::eventFilter(watched, e); 
    28502900} 
    28512901 
  • trunk/qt-gui/src/usereventdlg.h

    r4452 r4474  
    258258                 const char *name = 0); 
    259259  virtual ~UserSendCommon(); 
     260  virtual bool eventFilter(QObject *watched, QEvent *e); 
    260261 
    261262  void setText(const QString& txt); 
     
    356357                  const char *_szId, unsigned long _nPPID, QWidget *parent = 0); 
    357358  virtual ~UserSendUrlEvent(); 
     359  virtual bool eventFilter(QObject *watched, QEvent *e); 
    358360 
    359361  void setUrl(const QString& url, const QString& description);