Changeset 4857
- Timestamp:
- 02/16/07 05:47:30 (19 months ago)
- Location:
- trunk/qt-gui/src
- Files:
-
- 5 modified
-
mainwin.cpp (modified) (2 diffs)
-
mledit.cpp (modified) (4 diffs)
-
mledit.h (modified) (2 diffs)
-
optionsdlg.cpp (modified) (3 diffs)
-
optionsdlg.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/qt-gui/src/mainwin.cpp
r4844 r4857 409 409 delete MLEditWrap::editFont; 410 410 MLEditWrap::editFont = new QFont(f); 411 licqConf.ReadBool("UseDoubleReturn", MLEditWrap::useDoubleReturn, false); 411 412 412 413 licqConf.ReadBool("GridLines", m_bGridLines, false); … … 3535 3536 *MLEditWrap::editFont == defaultFont) ? 3536 3537 "default" : MLEditWrap::editFont->toString().latin1()); 3538 licqConf.WriteBool("UseDoubleReturn", MLEditWrap::useDoubleReturn); 3537 3539 licqConf.WriteBool("GridLines", m_bGridLines); 3538 3540 licqConf.WriteBool("FontStyles", m_bFontStyles); -
trunk/qt-gui/src/mledit.cpp
r4800 r4857 33 33 34 34 QFont *MLEditWrap::editFont = NULL; 35 bool MLEditWrap::useDoubleReturn = false; 35 36 36 37 MLEditWrap::MLEditWrap (bool wordWrap, QWidget* parent, bool /* doQuotes */, const char *name) 37 : MLEditWrapBase(parent, name), m_fixSetTextNewlines(true) 38 : MLEditWrapBase(parent, name), 39 m_fixSetTextNewlines(true), 40 m_lastKeyWasReturn(false) 38 41 { 39 42 setTextFormat(Qt::PlainText); … … 124 127 const bool isControl = e->state() & ControlButton; 125 128 129 // Get flag from last time and reset it before any possible returns 130 bool lastKeyWasReturn = m_lastKeyWasReturn; 131 m_lastKeyWasReturn = false; 132 126 133 if (isShift && e->key() == Key_Insert) 127 134 return paste(); … … 150 157 case Key_Return: 151 158 case Key_Enter: 152 emit signal_CtrlEnterPressed(); 159 if (useDoubleReturn) 160 insert("\n"); 161 else 162 emit signal_CtrlEnterPressed(); 153 163 break; 154 164 default: … … 156 166 } 157 167 return; 168 } 169 170 if ((e->state() & Qt::KeyButtonMask) == 0) 171 { 172 switch (e->key()) 173 { 174 case Key_Return: 175 case Key_Enter: 176 if (lastKeyWasReturn && useDoubleReturn) 177 { 178 // Return pressed twice, remove the previous line break and emit signal 179 moveCursor(QTextEdit::MoveBackward, true); 180 del(); 181 emit signal_CtrlEnterPressed(); 182 return; 183 } 184 else 185 { 186 // Return pressed once 187 m_lastKeyWasReturn = true; 188 } 189 break; 190 } 158 191 } 159 192 -
trunk/qt-gui/src/mledit.h
r4531 r4857 68 68 69 69 static QFont *editFont; 70 static bool useDoubleReturn; 70 71 71 72 protected: … … 85 86 private: 86 87 bool m_fixSetTextNewlines; 88 bool m_lastKeyWasReturn; 87 89 }; 88 90 -
trunk/qt-gui/src/optionsdlg.cpp
r4849 r4857 250 250 chkMsgWinSticky->setChecked(mainwin->m_bMsgWinSticky); 251 251 chkSingleLineChatMode->setChecked(mainwin->m_bSingleLineChatMode); 252 chkUseDoubleReturn->setChecked(MLEditWrap::useDoubleReturn); 252 253 popPicture->setChecked(mainwin->m_bPopPicture); 253 254 popAlias->setChecked(mainwin->m_bPopAlias); … … 546 547 mainwin->m_bMsgWinSticky = chkMsgWinSticky->isChecked(); 547 548 mainwin->m_bSingleLineChatMode = chkSingleLineChatMode->isChecked(); 549 MLEditWrap::useDoubleReturn = chkUseDoubleReturn->isChecked(); 548 550 549 551 mainwin->m_bPopPicture = popPicture->isChecked(); … … 832 834 "and insert new lines with Ctrl+Enter, opposite of the normal mode")); 833 835 836 chkUseDoubleReturn = new QCheckBox(tr("Use double return"), boxMainWin); 837 QWhatsThis::add(chkUseDoubleReturn, tr("Hitting Return twice will be used instead of Ctrl+Return " 838 "to send messages and close input dialogs. Multiple new lines can be inserted with Ctrl+Return.")); 839 834 840 chkMsgChatView = new QCheckBox(tr("Chatmode Messageview"), boxMainWin); 835 841 QWhatsThis::add(chkMsgChatView, tr("Show the current chat history in Send Window")); -
trunk/qt-gui/src/optionsdlg.h
r4844 r4857 114 114 *chkSysBack, *chkSendFromClipboard, *chkMsgChatView, *chkAutoPosReplyWin, 115 115 *chkFlashTaskbar, *chkAutoSendThroughServer, *chkTabbedChatting, 116 *chkMainWinSticky, *chkMsgWinSticky, *chkSingleLineChatMode, 116 *chkMainWinSticky, *chkMsgWinSticky, *chkSingleLineChatMode, *chkUseDoubleReturn, 117 117 *chkEnableMainwinMouseMovement, *chkShowHistory, *chkSendTN, *chkShowNotices; 118 118 QRadioButton *rdbDockDefault, *rdbDockThemed, *rdbDockSmall;
