diff options
Diffstat (limited to 'src/kvirc/ui/kvi_input.cpp')
-rw-r--r-- | src/kvirc/ui/kvi_input.cpp | 106 |
1 files changed, 0 insertions, 106 deletions
diff --git a/src/kvirc/ui/kvi_input.cpp b/src/kvirc/ui/kvi_input.cpp index fe88713..095b581 100644 --- a/src/kvirc/ui/kvi_input.cpp +++ b/src/kvirc/ui/kvi_input.cpp @@ -194,13 +194,8 @@ KviInputEditor::KviInputEditor(TQWidget * par,KviWindow *wnd,KviUserListView * v setInputMethodEnabled(true); -#ifdef COMPILE_USE_QT4 - setAutoFillBackground(false); - setFocusPolicy(TQ_StrongFocus); -#else setBackgroundMode(TQt::NoBackground); setFocusPolicy(TQ_StrongFocus); -#endif setAcceptDrops(true); setFrameStyle( LineEditPanel ); setFrameShadow( Plain ); @@ -208,11 +203,7 @@ KviInputEditor::KviInputEditor(TQWidget * par,KviWindow *wnd,KviUserListView * v m_pIconMenu = new KviTalPopupMenu(); connect(m_pIconMenu,TQT_SIGNAL(activated(int)),this,TQT_SLOT(iconPopupActivated(int))); -#ifdef COMPILE_USE_QT4 - setCursor(TQt::IBeamCursor); -#else setCursor(IbeamCursor); -#endif } KviInputEditor::~KviInputEditor() @@ -301,31 +292,14 @@ TQSize KviInputEditor::sizeHint() const int h = TQMAX(fm.lineSpacing(), 14) + 2*2; /* innerMargin */ int w = fm.width( 'x' ) * 17; // "some" int m = frameWidth() * 2; -#ifdef COMPILE_USE_QT4 - TQStyleOption opt; - opt.initFrom(this); - return (style()->sizeFromContents(TQStyle::CT_LineEdit,&opt, - TQSize( w + m, h + m ). - expandedTo(TQApplication::globalStrut()),this)); -#else return (style().tqsizeFromContents(TQStyle::CT_LineEdit, this, TQSize( w + m, h + m ). expandedTo(TQApplication::globalStrut()))); -#endif } #define KVI_INPUT_DEF_BACK 100 #define KVI_INPUT_DEF_FORE 101 -#ifdef COMPILE_USE_QT4 -void KviInputEditor::paintEvent(TQPaintEvent *e) -{ - TQPainter p(this); - SET_ANTI_ALIASING(p); - drawFrame(&p); - drawContents(&p); -} -#endif void KviInputEditor::drawContents(TQPainter *p) { @@ -513,11 +487,7 @@ void KviInputEditor::drawContents(TQPainter *p) while(m_iBlockLen < m_iCursorPosition) { TQChar c = m_szTextBuffer.at(m_iBlockLen); -#ifdef COMPILE_USE_QT4 - m_iLastCursorXPosition+= c.unicode() < 32 ? fm.width(getSubstituteChar(c.unicode())) + 3 : fm.width(c); -#else m_iLastCursorXPosition+= (c.unicode() < 256) ? g_iInputFontCharWidth[c.unicode()] : fm.width(c); -#endif m_iBlockLen++; } @@ -531,12 +501,7 @@ void KviInputEditor::drawContents(TQPainter *p) pa.setPen(KVI_OPTION_COLOR(KviOption_colorInputForeground)); } -#ifdef COMPILE_USE_QT4 - // The other version of drawPixmap seems to be buggy - p->drawPixmap(rect.x(),rect.y(),rect.width(),rect.height(),*pDoubleBufferPixmap,0,0,widgetWidth,widgetHeight); -#else p->drawPixmap(rect.x(),rect.y(),*pDoubleBufferPixmap,0,0,widgetWidth,widgetHeight); -#endif } void KviInputEditor::drawTextBlock(TQPainter * pa,TQFontMetrics & fm,int curXPos,int textBaseline,int charIdx,int len,bool bSelected) @@ -635,11 +600,7 @@ void KviInputEditor::extractNextBlock(int idx,TQFontMetrics & fm,int curXPos,int (c != TQChar(KVI_TEXT_ICON)))) { m_iBlockLen++; -#ifdef COMPILE_USE_QT4 - int xxx = c.unicode() < 32 ? fm.width(getSubstituteChar(c.unicode())) + 3 : fm.width(c);; -#else int xxx = (c.unicode() < 256 ? g_iInputFontCharWidth[c.unicode()] : fm.width(c)); -#endif m_iBlockWidth +=xxx; curXPos +=xxx; idx++; @@ -785,11 +746,7 @@ void KviInputEditor::mousePressEvent(TQMouseEvent *e) { szClip = c->text(TQClipboard::Clipboard); -#ifdef COMPILE_USE_QT4 - int occ = szClip.count(TQChar('\n')); -#else int occ = szClip.contains(TQChar('\n')); -#endif if(!szClip.isEmpty()) { @@ -821,11 +778,7 @@ void KviInputEditor::mousePressEvent(TQMouseEvent *e) l->setFrameStyle(TQFrame::Raised | TQFrame::StyledPanel); l->setMargin(5); // FIXME: This does NOT work under TQt 4.x (they seem to consider it as bad UI design) -#ifndef COMPILE_USE_QT4 g_pInputPopup->insertItem(l); -#else - delete l; -#endif } } @@ -1229,10 +1182,7 @@ void KviInputEditor::focusInEvent(TQFocusEvent *) update(); } // XIM handling... -#ifndef COMPILE_USE_QT4 - // THIS SEEMS TO BE GONE IN TQt4.x ? (even if the documentation states that it *should* be there) setMicroFocusHint(1,1,width() - 2,height() - 2,true,0); -#endif } void KviInputEditor::focusOutEvent(TQFocusEvent *) @@ -1297,23 +1247,12 @@ void KviInputEditor::imComposeEvent(TQIMEvent *e) { // replace the old pre-edit string with e->text() m_bUpdatesEnabled = false; -#ifdef COMPILE_USE_QT4 - // TQt 4.x ?????????? - m_iIMLength = replaceSegment(m_iIMStart, m_iIMLength, e->commitString()); - - // update selection inside the pre-edit - m_iIMSelectionBegin = m_iIMStart + e->replacementStart(); - m_iIMSelectionLength = e->replacementLength(); - moveCursorTo(m_iIMSelectionBegin); - -#else m_iIMLength = replaceSegment(m_iIMStart, m_iIMLength, e->text()); // update selection inside the pre-edit m_iIMSelectionBegin = m_iIMStart + e->cursorPos(); m_iIMSelectionLength = e->selectionLength(); moveCursorTo(m_iIMSelectionBegin); -#endif // repaint @@ -1328,12 +1267,7 @@ void KviInputEditor::imEndEvent(TQIMEvent *e) { // replace the preedit area with the IM result text m_bUpdatesEnabled = false; -#ifdef COMPILE_USE_QT4 - // TQt 4.x ?????????? - m_iIMLength = replaceSegment(m_iIMStart, m_iIMLength, e->commitString()); -#else m_iIMLength = replaceSegment(m_iIMStart, m_iIMLength, e->text()); -#endif // move cursor to after the IM result text moveCursorTo(m_iIMStart + m_iIMLength); @@ -2074,19 +2008,11 @@ void KviInputEditor::moveRightFirstVisibleCharToShowCursor() TQChar c = m_szTextBuffer.at(m_iCursorPosition); -#ifdef COMPILE_USE_QT4 - m_iLastCursorXPosition += c.unicode() < 32 ? fm.width(getSubstituteChar(c.unicode())) + 3 : fm.width(c);; -#else m_iLastCursorXPosition += (c.unicode() < 256) ? g_iInputFontCharWidth[c.unicode()] : fm.width(c); -#endif while(m_iLastCursorXPosition >= contentsRect().width()-2*KVI_INPUT_MARGIN) { c = m_szTextBuffer.at(m_iFirstVisibleChar); -#ifdef COMPILE_USE_QT4 - m_iLastCursorXPosition -= c.unicode() < 32 ? fm.width(getSubstituteChar(c.unicode())) + 3 : fm.width(c);; -#else m_iLastCursorXPosition -= (c.unicode() < 256) ? g_iInputFontCharWidth[c.unicode()] : fm.width(c); -#endif m_iFirstVisibleChar++; } } @@ -2117,11 +2043,7 @@ int KviInputEditor::charIndexFromXPosition(int xPos) while(curChar < bufLen) { TQChar c = m_szTextBuffer.at(curChar); -#ifdef COMPILE_USE_QT4 - int widthCh = c.unicode() < 32 ? fm.width(getSubstituteChar(c.unicode())) + 3 : fm.width(c);; -#else int widthCh = (c.unicode() < 256) ? g_iInputFontCharWidth[c.unicode()] : fm.width(c); -#endif if(xPos < (curXPos+(widthCh/2)))return curChar; else if(xPos < (curXPos+widthCh))return (curChar+1); { @@ -2140,11 +2062,7 @@ int KviInputEditor::xPositionFromCharIndex(TQFontMetrics& fm,int chIdx,bool bCo while(curChar < chIdx) { TQChar c = m_szTextBuffer.at(curChar); -#ifdef COMPILE_USE_QT4 - curXPos += c.unicode() < 32 ? fm.width(getSubstituteChar(c.unicode())) + 3 : fm.width(c);; -#else curXPos += (c.unicode() < 256) ? g_iInputFontCharWidth[c.unicode()] : fm.width(c); -#endif curChar++; } return curXPos; @@ -2160,11 +2078,7 @@ int KviInputEditor::xPositionFromCharIndex(int chIdx,bool bContentsCoords) while(curChar < chIdx) { TQChar c = m_szTextBuffer.at(curChar); -#ifdef COMPILE_USE_QT4 - curXPos += c.unicode() < 32 ? g_pLastFontMetrics->width(getSubstituteChar(c.unicode())) + 3 : g_pLastFontMetrics->width(c); -#else curXPos += (c.unicode() < 256) ? g_iInputFontCharWidth[c.unicode()] : g_pLastFontMetrics->width(c); -#endif curChar++; } return curXPos; @@ -2325,11 +2239,6 @@ KviInput::KviInput(KviWindow *par,KviUserListView * view) m_pButtonContainer=new KviTalHBox(this); m_pButtonContainer->setSpacing(0); -#ifdef COMPILE_USE_QT4 - m_pButtonContainer->setSizePolicy(TQSizePolicy(TQSizePolicy::Minimum,TQSizePolicy::Preferred)); -// if(m_pButtonContainer->layout()) -// m_pButtonContainer->layout()->setSizeConstraint(TQLayout::SetMinimumSize); -#endif m_pHistoryButton = new KviStyledToolButton(m_pButtonContainer,"historybutton"); m_pHistoryButton->setUsesBigPixmap(false); @@ -2386,20 +2295,9 @@ KviInput::KviInput(KviWindow *par,KviUserListView * view) m_pInputEditor = new KviInputEditor(this,par,view); connect(m_pInputEditor,TQT_SIGNAL(enterPressed()),this,TQT_SLOT(inputEditorEnterPressed())); -#ifdef COMPILE_USE_QT4 - m_pInputEditor->setSizePolicy(TQSizePolicy(TQSizePolicy::Expanding,TQSizePolicy::Ignored)); -#else m_pInputEditor->setSizePolicy(TQSizePolicy(TQSizePolicy::Ignored,TQSizePolicy::Ignored)); -#endif -#ifdef COMPILE_USE_QT4 - m_pMultiEditorButton->setAutoRaise(true); - m_pCommandlineModeButton->setAutoRaise(true); - m_pIconButton->setAutoRaise(true); - m_pHistoryButton->setAutoRaise(true); - m_pHideToolsButton->setAutoRaise(true); -#endif pLayout->setStretchFactor(m_pInputEditor,100000); pLayout->setStretchFactor(m_pButtonContainer,0); @@ -2473,11 +2371,7 @@ void KviInput::keyPressEvent(TQKeyEvent *e) { if(szText[0] != '/') { -#ifdef COMPILE_USE_QT4 - int nLines = szText.count('\n') + 1; -#else int nLines = szText.contains('\n') + 1; -#endif if(nLines > 15) { int nRet = TQMessageBox::question( |