KVIrc  4.9.2
DeveloperAPIs
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 
48 class QPainter;
49 class KviWindow;
50 class NotifierMessage;
52 class KviNotifierWindowTabs;
53 class KviThemedLineEdit;
54 
56 
57 class NotifierWindow : public QWidget
58 {
59  Q_OBJECT
60 public:
63 
64 protected:
65  QTimer * m_pShowHideTimer;
66  QTimer * m_pBlinkTimer;
67  QTimer * m_pAutoHideTimer;
69  bool m_bBlinkOn;
70  double m_dOpacity;
71 
77 
78  QRect m_wndRect;
79 
82 
87 
89 
90  QPoint m_pntDrag;
91  QPoint m_pntPos;
92  QPoint m_pntClick;
94  QMenu * m_pContextPopup;
95  QMenu * m_pDisablePopup;
101 
102  QCursor m_cursor;
103 
104  QTabWidget * m_pWndTabs;
105  QProgressBar * m_pProgressBar;
107 
108 public:
109  void doShow(bool bDoAnimate);
110  void doHide(bool bDoAnimate);
111  int textWidth();
112  void addMessage(KviWindow * pWnd, const QString & szImageId, const QString & szText, unsigned int uMessageTime);
114  void showLineEdit(bool bShow);
115  inline int countTabs() const
116  {
117  if(m_pWndTabs)
118  return m_pWndTabs->count();
119  return 0;
120  };
121  inline State state() const { return m_eState; };
122 protected:
123  virtual void showEvent(QShowEvent * e);
124  virtual void hideEvent(QHideEvent * e);
125  virtual void paintEvent(QPaintEvent * e);
126  virtual void mousePressEvent(QMouseEvent * e);
127  virtual void mouseReleaseEvent(QMouseEvent * e);
128  virtual void mouseMoveEvent(QMouseEvent * e);
129  virtual void leaveEvent(QEvent * e);
130  virtual void enterEvent(QEvent * e);
131  virtual bool eventFilter(QObject * pEdit, QEvent * e);
132  virtual void keyPressEvent(QKeyEvent * e);
133 public slots:
134  void hideNow();
135  void toggleLineEdit();
136  void slotTabCloseRequested(int index);
137 protected slots:
138  void blink();
139  void heartbeat();
140  void returnPressed();
141  void updateGui();
142  void fillContextPopup();
143  void disableFor1Minute();
144  void disableFor5Minutes();
145  void disableFor15Minutes();
146  void disableFor30Minutes();
147  void disableFor60Minutes();
149  void disablePermanently();
150  void progressUpdate();
151 
152 private:
153  void contextPopup(const QPoint & pos);
154  void startBlinking();
155  // void computeRect();
156  void stopShowHideTimer();
157  void stopBlinkTimer();
158  void stopAutoHideTimer();
159  void startAutoHideTimer();
161  void setCursor(int);
162  void resize(QPoint p, bool = true);
163  void redrawText();
164  bool checkResizing(QPoint);
165 };
166 
167 #endif //_NOTIFIERWINDOW_H_
void startBlinking()
Definition: NotifierWindow.cpp:555
QTimer * m_pShowHideTimer
Definition: NotifierWindow.h:65
void disableFor15Minutes()
Definition: NotifierWindow.cpp:1003
void setDisableHideOnMainWindowGotAttention(bool b)
Definition: NotifierWindow.h:113
void stopShowHideTimer()
Definition: NotifierWindow.cpp:236
KviWindow * m_pWindowToRaise
Definition: NotifierWindow.h:96
Definition: NotifierWindowBorder.h:35
void startAutoHideTimer()
Definition: NotifierWindow.cpp:569
virtual bool eventFilter(QObject *pEdit, QEvent *e)
Definition: NotifierWindow.cpp:1093
virtual void mousePressEvent(QMouseEvent *e)
Definition: NotifierWindow.cpp:692
QMenu * m_pDisablePopup
Definition: NotifierWindow.h:95
virtual void mouseMoveEvent(QMouseEvent *e)
Definition: NotifierWindow.cpp:651
QCursor m_cursor
Definition: NotifierWindow.h:102
void disableFor30Minutes()
Definition: NotifierWindow.cpp:1027
State
Definition: NotifierSettings.h:61
int m_whereResizing
Definition: NotifierWindow.h:88
virtual void showEvent(QShowEvent *e)
Definition: NotifierWindow.cpp:538
void updateGui()
Definition: NotifierWindow.cpp:156
Definition: KviThemedLineEdit.h:33
void stopAutoHideTimer()
Definition: NotifierWindow.cpp:252
QPoint m_pntDrag
Definition: NotifierWindow.h:90
void contextPopup(const QPoint &pos)
Definition: NotifierWindow.cpp:972
void showLineEdit(bool bShow)
Definition: NotifierWindow.cpp:1064
bool checkResizing(QPoint)
Definition: NotifierWindow.cpp:786
kvi_time_t g_tNotifierDisabledUntil
Definition: libkvinotifier.cpp:42
NotifierWindowBorder * m_pWndBorder
Definition: NotifierWindow.h:106
bool m_bPrevDown
Definition: NotifierWindow.h:73
bool m_bLeftButtonIsPressed
Definition: NotifierWindow.h:84
void progressUpdate()
Definition: NotifierWindow.cpp:1147
bool m_bDiagonalResizing
Definition: NotifierWindow.h:85
virtual void keyPressEvent(QKeyEvent *e)
Definition: NotifierWindow.cpp:777
void disableUntilKVIrcRestarted()
Definition: NotifierWindow.cpp:1043
void disablePermanently()
Definition: NotifierWindow.cpp:1053
#define kvi_time_t
Definition: KviTimeUtils.h:43
#define e
Definition: detector.cpp:69
bool m_bDragging
Definition: NotifierWindow.h:83
QTime m_qtStartedAt
Definition: NotifierWindow.h:99
virtual void mouseReleaseEvent(QMouseEvent *e)
Definition: NotifierWindow.cpp:749
void doHide(bool bDoAnimate)
Definition: NotifierWindow.cpp:482
QPoint m_pntClick
Definition: NotifierWindow.h:92
void hideNow()
Definition: NotifierWindow.cpp:471
virtual void enterEvent(QEvent *e)
Definition: NotifierWindow.cpp:941
void blink()
Definition: NotifierWindow.cpp:585
void heartbeat()
Definition: NotifierWindow.cpp:386
QRect m_wndRect
Definition: NotifierWindow.h:78
bool m_bBlinkOn
Definition: NotifierWindow.h:69
void setCursor(int)
Definition: NotifierWindow.cpp:925
bool m_bCrashShowWorkAround
Definition: NotifierWindow.h:76
QPoint m_pntPos
Definition: NotifierWindow.h:91
int m_iBlinkCount
Definition: NotifierWindow.h:93
void stopBlinkTimer()
Definition: NotifierWindow.cpp:244
void fillContextPopup()
Definition: NotifierWindow.cpp:984
KviThemedLineEdit * m_pLineEdit
Definition: NotifierWindow.h:81
bool m_bDisableHideOnMainWindowGotAttention
Definition: NotifierWindow.h:100
virtual void leaveEvent(QEvent *e)
Definition: NotifierWindow.cpp:952
Time management.
void addMessage(KviWindow *pWnd, const QString &szImageId, const QString &szText, unsigned int uMessageTime)
Definition: NotifierWindow.cpp:170
bool shouldHideIfMainWindowGotAttention()
Definition: NotifierWindow.cpp:374
double m_dOpacity
Definition: NotifierWindow.h:70
void disableFor5Minutes()
Definition: NotifierWindow.cpp:1011
C++ Template based double linked pointer list class.
Base class for all windows in KVIrc.
Definition: KviWindow.h:74
NotifierWindow()
Definition: NotifierWindow.cpp:54
QTabWidget * m_pWndTabs
Definition: NotifierWindow.h:104
virtual void paintEvent(QPaintEvent *e)
Definition: NotifierWindow.cpp:609
QProgressBar * m_pProgressBar
Definition: NotifierWindow.h:105
bool m_bNextDown
Definition: NotifierWindow.h:74
int countTabs() const
Definition: NotifierWindow.h:115
virtual void hideEvent(QHideEvent *e)
Definition: NotifierWindow.cpp:543
QTimer * m_pAutoHideTimer
Definition: NotifierWindow.h:67
void slotTabCloseRequested(int index)
Definition: NotifierWindow.cpp:1160
QTimer * m_pBlinkTimer
Definition: NotifierWindow.h:66
kvi_time_t m_tAutoHideAt
Definition: NotifierWindow.h:97
void doShow(bool bDoAnimate)
Definition: NotifierWindow.cpp:305
kvi_time_t m_tStartedAt
Definition: NotifierWindow.h:98
This file contains compile time settings.
NotifierMessage * m_pCurrentMessage
Definition: NotifierWindow.h:80
State m_eState
Definition: NotifierWindow.h:68
State state() const
Definition: NotifierWindow.h:121
bool m_bCloseDown
Definition: NotifierWindow.h:72
bool m_bWriteDown
Definition: NotifierWindow.h:75
Definition: NotifierWindow.h:57
#define p
Definition: detector.cpp:80
A single message in a notifier window.
Definition: NotifierMessage.h:43
QMenu * m_pContextPopup
Definition: NotifierWindow.h:94
Helper functions for the QString class.
void toggleLineEdit()
Definition: NotifierWindow.cpp:1059
void resize(QPoint p, bool=true)
Definition: NotifierWindow.cpp:887
void returnPressed()
Definition: NotifierWindow.cpp:1123
void disableFor60Minutes()
Definition: NotifierWindow.cpp:1035
bool m_bResizing
Definition: NotifierWindow.h:86
void disableFor1Minute()
Definition: NotifierWindow.cpp:1019
~NotifierWindow()
Definition: NotifierWindow.cpp:147