KVIrc 5.2.0
Developer APIs
NotifierWindow.h
Go to the documentation of this file.
1#ifndef _NOTIFIERWINDOW_H_
2#define _NOTIFIERWINDOW_H_
3//=============================================================================
4//
5// File : NotifierWindow.h
6// Creation date : Tue Jul 6 2004 20:25:12 CEST by Szymon Stefanek
7//
8// This file is part of the KVIrc IRC client distribution
9// Copyright (C) 2004 Szymon Stefanek (pragma at kvirc dot net)
10// Copyright (C) 2005-2008 Iacopo Palazzi < iakko(at)siena(dot)linux(dot)it >
11//
12// This program is FREE software. You can redistribute it and/or
13// modify it under the terms of the GNU General Public License
14// as published by the Free Software Foundation; either version 2
15// of the License, or (at your option) any later version.
16//
17// This program is distributed in the HOPE that it will be USEFUL,
18// but WITHOUT ANY WARRANTY; without even the implied warranty of
19// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20// See the GNU General Public License for more details.
21//
22// You should have received a copy of the GNU General Public License
23// along with this program. If not, write to the Free Software Foundation,
24// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25//
26//=============================================================================
27
28#include "NotifierSettings.h"
29
30#include "kvi_settings.h"
31#include "KviQString.h"
32#include "KviPointerList.h"
33#include "KviTimeUtils.h"
34
35#include <QBitmap>
36#include <QColor>
37#include <QCursor>
38#include <QDateTime>
39#include <QImage>
40#include <QPixmap>
41#include <QRect>
42#include <QTimer>
43#include <QWidget>
44#include <QTabWidget>
45#include <QProgressBar>
46#include <QMenu>
47
48class QPainter;
49class KviWindow;
50class NotifierMessage;
52class KviNotifierWindowTabs;
54
56
57class NotifierWindow : public QWidget
58{
59 Q_OBJECT
60public:
63
64protected:
65 QTimer * m_pShowHideTimer = nullptr;
66 QTimer * m_pBlinkTimer = nullptr;
67 QTimer * m_pAutoHideTimer = nullptr;
69 bool m_bBlinkOn = false;
70 double m_dOpacity = 0.0;
71
72 bool m_bCloseDown = false;
73 bool m_bPrevDown = false;
74 bool m_bNextDown = false;
75 bool m_bWriteDown = false;
77
78 QRect m_wndRect;
79
82
83 bool m_bDragging = false;
85 bool m_bDiagonalResizing = false;
86 bool m_bResizing = false;
87
89
90 QPoint m_pntDrag;
91 QPoint m_pntPos;
92 QPoint m_pntClick;
94 QMenu * m_pContextPopup = nullptr;
95 QMenu * m_pDisablePopup = nullptr;
101
102 QCursor m_cursor;
103
104 QTabWidget * m_pWndTabs = nullptr;
105 QProgressBar * m_pProgressBar = nullptr;
107
108public:
109 void doShow(bool bDoAnimate);
110 void doHide(bool bDoAnimate);
112 void addMessage(KviWindow * pWnd, const QString & szImageId, const QString & szText, unsigned int uMessageTime);
114 void showLineEdit(bool bShow);
115 int countTabs() const
116 {
117 if(m_pWndTabs)
118 return m_pWndTabs->count();
119 return 0;
120 }
121 State state() const { return m_eState; }
122protected:
123 void showEvent(QShowEvent * e) override;
124 void hideEvent(QHideEvent * e) override;
125 void paintEvent(QPaintEvent * e) override;
126 void mousePressEvent(QMouseEvent * e) override;
127 void mouseReleaseEvent(QMouseEvent * e) override;
128 void mouseMoveEvent(QMouseEvent * e) override;
129 void leaveEvent(QEvent * e) override;
130#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
131 void enterEvent(QEvent * e) override;
132#else
133 void enterEvent(QEnterEvent * e) override;
134#endif
135 bool eventFilter(QObject * pEdit, QEvent * e) override;
136 void keyPressEvent(QKeyEvent * e) override;
137public slots:
138 void hideNow();
139 void toggleLineEdit();
140 void slotTabCloseRequested(int index);
141protected slots:
142 void blink();
143 void heartbeat();
144 void returnPressed();
145 void updateGui();
146 void fillContextPopup();
147 void disableFor1Minute();
148 void disableFor5Minutes();
149 void disableFor15Minutes();
150 void disableFor30Minutes();
151 void disableFor60Minutes();
153 void disablePermanently();
154 void progressUpdate();
155
156private:
157 void contextPopup(const QPoint & pos);
158 void startBlinking();
159 // void computeRect();
160 void stopShowHideTimer();
161 void stopBlinkTimer();
162 void stopAutoHideTimer();
163 void startAutoHideTimer();
165 void setCursor(int);
166 void resize(QPoint p, bool = true);
168 bool checkResizing(QPoint);
169};
170
171#endif //_NOTIFIERWINDOW_H_
C++ Template based double linked pointer list class.
Helper functions for the QString class.
Time management.
#define kvi_time_t
Definition KviTimeUtils.h:43
State
Definition NotifierSettings.h:62
@ Hidden
Definition NotifierSettings.h:63
kvi_time_t g_tNotifierDisabledUntil
Definition libkvinotifier.cpp:40
Definition KviThemedLineEdit.h:34
Base class for all windows in KVIrc.
Definition KviWindow.h:75
A single message in a notifier window.
Definition NotifierMessage.h:44
Definition NotifierWindowBorder.h:36
Definition NotifierWindow.h:58
void heartbeat()
Definition NotifierWindow.cpp:350
void stopBlinkTimer()
Definition NotifierWindow.cpp:207
void slotTabCloseRequested(int index)
Definition NotifierWindow.cpp:1106
bool shouldHideIfMainWindowGotAttention()
Definition NotifierWindow.cpp:338
void returnPressed()
Definition NotifierWindow.cpp:1069
QTabWidget * m_pWndTabs
Definition NotifierWindow.h:104
void mouseReleaseEvent(QMouseEvent *e) override
Definition NotifierWindow.cpp:691
bool m_bCloseDown
Definition NotifierWindow.h:72
void leaveEvent(QEvent *e) override
Definition NotifierWindow.cpp:898
void disableUntilKVIrcRestarted()
Definition NotifierWindow.cpp:989
State m_eState
Definition NotifierWindow.h:68
QTime m_qtStartedAt
Definition NotifierWindow.h:99
void fillContextPopup()
Definition NotifierWindow.cpp:930
int m_iBlinkCount
Definition NotifierWindow.h:93
void enterEvent(QEnterEvent *e) override
Definition NotifierWindow.cpp:886
void keyPressEvent(QKeyEvent *e) override
Definition NotifierWindow.cpp:719
NotifierWindow()
Definition NotifierWindow.cpp:54
kvi_time_t m_tStartedAt
Definition NotifierWindow.h:98
QPoint m_pntPos
Definition NotifierWindow.h:91
void disableFor15Minutes()
Definition NotifierWindow.cpp:949
void disableFor1Minute()
Definition NotifierWindow.cpp:965
void showEvent(QShowEvent *e) override
Definition NotifierWindow.cpp:502
bool m_bDiagonalResizing
Definition NotifierWindow.h:85
void startAutoHideTimer()
Definition NotifierWindow.cpp:533
int countTabs() const
Definition NotifierWindow.h:115
void stopAutoHideTimer()
Definition NotifierWindow.cpp:215
QMenu * m_pDisablePopup
Definition NotifierWindow.h:95
void disableFor60Minutes()
Definition NotifierWindow.cpp:981
KviThemedLineEdit * m_pLineEdit
Definition NotifierWindow.h:81
bool m_bDisableHideOnMainWindowGotAttention
Definition NotifierWindow.h:100
KviWindow * m_pWindowToRaise
Definition NotifierWindow.h:96
void mouseMoveEvent(QMouseEvent *e) override
Definition NotifierWindow.cpp:598
void resize(QPoint p, bool=true)
Definition NotifierWindow.cpp:829
bool m_bNextDown
Definition NotifierWindow.h:74
void disableFor5Minutes()
Definition NotifierWindow.cpp:957
void showLineEdit(bool bShow)
Definition NotifierWindow.cpp:1010
QRect m_wndRect
Definition NotifierWindow.h:78
int m_whereResizing
Definition NotifierWindow.h:88
~NotifierWindow()
Definition NotifierWindow.cpp:119
bool m_bCrashShowWorkAround
Definition NotifierWindow.h:76
QTimer * m_pShowHideTimer
Definition NotifierWindow.h:65
void hideEvent(QHideEvent *e) override
Definition NotifierWindow.cpp:507
void stopShowHideTimer()
Definition NotifierWindow.cpp:199
void blink()
Definition NotifierWindow.cpp:549
kvi_time_t m_tAutoHideAt
Definition NotifierWindow.h:97
void toggleLineEdit()
Definition NotifierWindow.cpp:1005
State state() const
Definition NotifierWindow.h:121
void doHide(bool bDoAnimate)
Definition NotifierWindow.cpp:448
void addMessage(KviWindow *pWnd, const QString &szImageId, const QString &szText, unsigned int uMessageTime)
Definition NotifierWindow.cpp:140
void setDisableHideOnMainWindowGotAttention(bool b)
Definition NotifierWindow.h:113
QCursor m_cursor
Definition NotifierWindow.h:102
bool checkResizing(QPoint)
Definition NotifierWindow.cpp:728
QPoint m_pntDrag
Definition NotifierWindow.h:90
double m_dOpacity
Definition NotifierWindow.h:70
QProgressBar * m_pProgressBar
Definition NotifierWindow.h:105
NotifierWindowBorder * m_pWndBorder
Definition NotifierWindow.h:106
void hideNow()
Definition NotifierWindow.cpp:437
NotifierMessage * m_pCurrentMessage
Definition NotifierWindow.h:80
void doShow(bool bDoAnimate)
Definition NotifierWindow.cpp:269
void paintEvent(QPaintEvent *e) override
Definition NotifierWindow.cpp:573
QMenu * m_pContextPopup
Definition NotifierWindow.h:94
bool eventFilter(QObject *pEdit, QEvent *e) override
Definition NotifierWindow.cpp:1039
QPoint m_pntClick
Definition NotifierWindow.h:92
void updateGui()
Definition NotifierWindow.cpp:128
bool m_bBlinkOn
Definition NotifierWindow.h:69
void disableFor30Minutes()
Definition NotifierWindow.cpp:973
void progressUpdate()
Definition NotifierWindow.cpp:1093
void mousePressEvent(QMouseEvent *e) override
Definition NotifierWindow.cpp:634
QTimer * m_pAutoHideTimer
Definition NotifierWindow.h:67
bool m_bResizing
Definition NotifierWindow.h:86
bool m_bLeftButtonIsPressed
Definition NotifierWindow.h:84
bool m_bWriteDown
Definition NotifierWindow.h:75
QTimer * m_pBlinkTimer
Definition NotifierWindow.h:66
void startBlinking()
Definition NotifierWindow.cpp:519
void disablePermanently()
Definition NotifierWindow.cpp:999
void contextPopup(const QPoint &pos)
Definition NotifierWindow.cpp:918
void setCursor(int)
Definition NotifierWindow.cpp:867
bool m_bDragging
Definition NotifierWindow.h:83
bool m_bPrevDown
Definition NotifierWindow.h:73
#define e
Definition detector.cpp:70
#define p
Definition detector.cpp:81
This file contains compile time settings.