~ubuntu-branches/ubuntu/saucy/kvirc/saucy

« back to all changes in this revision

Viewing changes to src/kvirc/ui/KviIrcView_events.cpp

  • Committer: Package Import Robot
  • Author(s): Mark Purcell
  • Date: 2013-05-18 19:36:33 UTC
  • mfrom: (22.1.4 sid)
  • Revision ID: package-import@ubuntu.com-20130518193633-kuhzryg7jstqvxpr
Tags: 4:4.2.0-2
Upload to unstable 

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
#include "kvi_out.h"
41
41
#include "KviTopicWidget.h"
42
42
#include "KviQueryWindow.h"
 
43
#include "KviMainWindow.h"
43
44
#include "KviWindow.h"
44
45
 
45
46
#include <QClipboard>
216
217
                        if(KviChannelWindow * c = console()->connection()->findChannel(szLinkTextPart))
217
218
                        {
218
219
                                // already there
219
 
                                c->raise();
220
 
                                c->setFocus();
 
220
                                g_pMainWindow->setActiveWindow(c);
221
221
                                return;
222
222
                        }
223
223
 
244
244
                KviKvsScript::run(szKvsCommand,m_pKviWindow,&lParams);
245
245
}
246
246
 
 
247
 
 
248
bool KviIrcView::checkMarkerArea(const QPoint & mousePos)
 
249
{
 
250
        return (m_lineMarkArea.isValid() && m_lineMarkArea.contains(mousePos)) ? true : false;
 
251
}
 
252
 
247
253
void KviIrcView::mousePressEvent(QMouseEvent * e)
248
254
{
249
255
        if(m_pKviWindow->input())
258
264
        // Left button handler
259
265
 
260
266
        // We are inside the line marker
261
 
        if(checkMarkerArea(m_lineMarkArea,e->pos()))
 
267
        if(checkMarkerArea(e->pos()))
262
268
        {
263
269
                scrollToMarker();
264
270
        }
435
441
                        szSelectionText.append(QChar(pC->type));
436
442
                        if((pC->colors.fore != KviControlCodes::NoChange) && (pC->colors.fore != KviControlCodes::Transparent))
437
443
                        {
438
 
                                if(pC->colors.fore > 9)szSelectionText.append(QChar('1'));
 
444
                                if(pC->colors.fore > 9)
 
445
                                        szSelectionText.append(QChar('1'));
 
446
                                else
 
447
                                        szSelectionText.append(QChar('0'));
439
448
                                szSelectionText.append(QChar((pC->colors.fore%10)+'0'));
440
449
                        }
441
450
                        if((pC->colors.back != KviControlCodes::NoChange) && (pC->colors.back != KviControlCodes::Transparent) )
442
451
                        {
443
452
                                szSelectionText.append(QChar(','));
444
 
                                if(pC->colors.back > 9)szSelectionText.append(QChar('1'));
 
453
                                if(pC->colors.back > 9)
 
454
                                        szSelectionText.append(QChar('1'));
 
455
                                else
 
456
                                        szSelectionText.append(QChar('0'));
445
457
                                szSelectionText.append(QChar((pC->colors.back%10)+'0'));
446
458
                        }
447
459
                break;
655
667
 
656
668
void KviIrcView::mouseMoveEvent(QMouseEvent * e)
657
669
{
658
 
        bool bCursorOverMarker = checkMarkerArea(m_lineMarkArea,e->pos());
 
670
        bool bCursorOverMarker = checkMarkerArea(e->pos());
659
671
 
660
672
        if(m_bMouseIsDown && (e->buttons() & Qt::LeftButton)) // m_bMouseIsDown MUST BE true...(otherwise the mouse entered the window with the button pressed ?)
661
673
        {
783
795
        QString linkCmd;
784
796
        QString linkText;
785
797
        QRect rctLink;
786
 
        QRect markerArea;
787
 
 
788
 
        // Check if the mouse is over the marker icon
789
 
        // 16(width) + 5(border) = 21
790
 
        int widgetWidth = width()-m_pScrollBar->width();
791
 
        int x = widgetWidth - 21;
792
 
        int y = KVI_IRCVIEW_VERTICAL_BORDER;
793
 
 
794
 
        markerArea = QRect(QPoint(x,y),QSize(16,16));
795
 
        if(checkMarkerArea(markerArea,pnt))
796
 
                doMarkerToolTip(markerArea);
 
798
 
 
799
        if(checkMarkerArea(pnt))
 
800
                doMarkerToolTip();
797
801
 
798
802
        // Check if the mouse is over a link
799
803
        KviIrcViewWrappedBlock * linkUnderMouse = getLinkUnderMouse(pnt.x(),pnt.y(),&rctLink,&linkCmd,&linkText);
803
807
        else m_pLastLinkUnderMouse = 0;
804
808
}
805
809
 
806
 
void KviIrcView::doMarkerToolTip(const QRect &rct)
 
810
void KviIrcView::doMarkerToolTip()
807
811
{
808
812
        QString tip;
809
813
        tip = "<table width=\"100%\">" \
814
818
 
815
819
        if(tip.isEmpty())return;
816
820
 
817
 
        m_pToolTip->doTip(rct,tip);
 
821
        m_pToolTip->doTip(m_lineMarkArea,tip);
818
822
}
819
823
 
820
824
void KviIrcView::doLinkToolTip(const QRect &rct,QString &linkCmd,QString &linkText)