diff options
| author | 2017-10-21 18:10:40 -0400 | |
|---|---|---|
| committer | 2017-10-21 18:10:40 -0400 | |
| commit | e9f3c2248ab67e1265667de5ddc6bc59ce235c98 (patch) | |
| tree | 1f5d9b5954582e6c68f69ae0226e7b969c6549fa /src/modules/notifier | |
| parent | Make the issue/PR templates much simpler. (#2301) (diff) | |
| download | KVIrc-e9f3c2248ab67e1265667de5ddc6bc59ce235c98.tar.gz KVIrc-e9f3c2248ab67e1265667de5ddc6bc59ce235c98.tar.bz2 KVIrc-e9f3c2248ab67e1265667de5ddc6bc59ce235c98.zip | |
notifier module: general code cleanup
Diffstat (limited to 'src/modules/notifier')
| -rw-r--r-- | src/modules/notifier/NotifierMessage.cpp | 15 | ||||
| -rw-r--r-- | src/modules/notifier/NotifierMessage.h | 15 | ||||
| -rw-r--r-- | src/modules/notifier/NotifierWindow.cpp | 114 | ||||
| -rw-r--r-- | src/modules/notifier/NotifierWindow.h | 70 | ||||
| -rw-r--r-- | src/modules/notifier/NotifierWindowBorder.h | 63 | ||||
| -rw-r--r-- | src/modules/notifier/NotifierWindowTab.cpp | 28 | ||||
| -rw-r--r-- | src/modules/notifier/NotifierWindowTab.h | 24 | ||||
| -rw-r--r-- | src/modules/notifier/libkvinotifier.cpp | 8 |
8 files changed, 127 insertions, 210 deletions
diff --git a/src/modules/notifier/NotifierMessage.cpp b/src/modules/notifier/NotifierMessage.cpp index b0a6e401b..83910e576 100644 --- a/src/modules/notifier/NotifierMessage.cpp +++ b/src/modules/notifier/NotifierMessage.cpp @@ -33,17 +33,8 @@ #include <QResizeEvent> NotifierMessage::NotifierMessage(QPixmap * pPixmap, const QString & szText) + : m_szText{szText}, m_pPixmap{pPixmap} { - m_pLabel0 = nullptr; - m_pLabel1 = nullptr; - - m_szText = szText; - m_pPixmap = pPixmap; - - //QByteArray utf8 = szText.toUtf8(); - //if(utf8.data()) - // qDebug("NOTIFIER TEXT MESSAGE: \n%s\n",utf8.data()); - m_pHBox = new QHBoxLayout(this); m_pHBox->setSpacing(SPACING); m_pHBox->setMargin(SPACING); @@ -63,14 +54,14 @@ NotifierMessage::~NotifierMessage() void NotifierMessage::updateGui() { - bool bShowImages = KVI_OPTION_BOOL(KviOption_boolIrcViewShowImages); - if(m_pLabel0) delete m_pLabel0; if(m_pLabel1) delete m_pLabel1; + bool bShowImages = KVI_OPTION_BOOL(KviOption_boolIrcViewShowImages); + if(bShowImages) { m_pLabel0 = new QLabel(this); diff --git a/src/modules/notifier/NotifierMessage.h b/src/modules/notifier/NotifierMessage.h index c0179f0e1..bdc1e7fb9 100644 --- a/src/modules/notifier/NotifierMessage.h +++ b/src/modules/notifier/NotifierMessage.h @@ -44,6 +44,7 @@ class NotifierMessage : public QWidget { friend class NotifierWindow; + Q_OBJECT public: /** * \brief Constructs the NotifierMessage object @@ -61,25 +62,25 @@ private: /// The message text QString m_szText; /// The message icon (can be null) - QPixmap * m_pPixmap; + QPixmap * m_pPixmap = nullptr; /// Layout for the labels - QHBoxLayout * m_pHBox; + QHBoxLayout * m_pHBox = nullptr; /// Label for the message icon - QLabel * m_pLabel0; + QLabel * m_pLabel0 = nullptr; /// Label for the message text - QLabel * m_pLabel1; + QLabel * m_pLabel1 = nullptr; public: /** * \brief Returns the original irc message - * \return QString + * \return const QString & */ - inline QString text() const { return m_szText; }; + inline const QString & text() const { return m_szText; } /** * \brief Returns the message icon * \return QPixmap * */ - inline QPixmap * pixmap() const { return m_pPixmap; }; + inline QPixmap * pixmap() const { return m_pPixmap; } /** * \brief Updates the aspect of this message * \return void diff --git a/src/modules/notifier/NotifierWindow.cpp b/src/modules/notifier/NotifierWindow.cpp index 4ce8ea027..086b4d737 100644 --- a/src/modules/notifier/NotifierWindow.cpp +++ b/src/modules/notifier/NotifierWindow.cpp @@ -38,43 +38,34 @@ #include "KviThemedLineEdit.h" #include <QApplication> -#include <QImage> #include <QDesktopWidget> -#include <QToolTip> #include <QEvent> -#include <QPen> #include <QFontMetrics> -#include <QRegExp> +#include <QImage> +#include <QMouseEvent> #include <QPainter> #include <QPaintEvent> -#include <QMouseEvent> +#include <QPen> +#include <QRegExp> +#include <QToolTip> extern NotifierWindow * g_pNotifierWindow; NotifierWindow::NotifierWindow() - : QWidget(nullptr, + : QWidget(nullptr, Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | #if defined(COMPILE_ON_WINDOWS) || defined(COMPILE_ON_MINGW) - Qt::FramelessWindowHint | Qt::Tool | Qt::WindowStaysOnTopHint) + Qt::Tool) #else - Qt::FramelessWindowHint | #ifndef COMPILE_ON_MAC - Qt::Tool | Qt::X11BypassWindowManagerHint | + Qt::Tool | Qt::X11BypassWindowManagerHint #endif - Qt::WindowStaysOnTopHint) + ) #endif { setObjectName("kvirc_notifier_window"); g_pNotifierWindow = this; - m_eState = Hidden; - m_dOpacity = 0.0; - m_pShowHideTimer = nullptr; - m_pBlinkTimer = nullptr; - m_tAutoHideAt = 0; - m_tStartedAt = 0; - m_pAutoHideTimer = nullptr; - m_pWndBorder = new NotifierWindowBorder(); setFocusPolicy(Qt::NoFocus); @@ -83,24 +74,6 @@ NotifierWindow::NotifierWindow() hide(); - m_bBlinkOn = false; - - m_bCloseDown = false; - m_bPrevDown = false; - m_bNextDown = false; - m_bWriteDown = false; - - m_bLeftButtonIsPressed = false; - m_bDiagonalResizing = false; - m_bResizing = false; - - m_pContextPopup = nullptr; - m_pDisablePopup = nullptr; - - m_bDragging = false; - - m_bDisableHideOnMainWindowGotAttention = false; - // Positioning the notifier bottom-right QDesktopWidget * pDesktop = QApplication::desktop(); QRect r = pDesktop->availableGeometry(pDesktop->primaryScreen()); @@ -162,19 +135,15 @@ void NotifierWindow::updateGui() m_pLineEdit->setFont(KVI_OPTION_FONT(KviOption_fontNotifier)); for(int i = 0; i < m_pWndTabs->count(); ++i) - { ((NotifierWindowTab *)m_pWndTabs->widget(i))->updateGui(); - } } void NotifierWindow::addMessage(KviWindow * pWnd, const QString & szImageId, const QString & szText, unsigned int uMessageTime) { - QPixmap * pIcon; + QPixmap * pIcon = nullptr; QString szMessage = szText; szMessage.replace(QRegExp("\r([^\r])*\r([^\r])+\r"), "\\2"); - if(szImageId.isEmpty()) - pIcon = nullptr; - else + if(!szImageId.isEmpty()) pIcon = g_pIconManager->getImage(szImageId); NotifierMessage * pMessage = new NotifierMessage(pIcon ? new QPixmap(*pIcon) : nullptr, szMessage); @@ -192,9 +161,7 @@ void NotifierWindow::addMessage(KviWindow * pWnd, const QString & szImageId, con } if(!pTab) - { pTab = new NotifierWindowTab(pWnd, m_pWndTabs); - } //if the notifier is already visible, don't steal the focus from the current tab! //the user could be writing a message on it (bug #678) @@ -223,11 +190,8 @@ void NotifierWindow::addMessage(KviWindow * pWnd, const QString & szImageId, con m_tAutoHideAt = 0; } - if(pWnd) - { - if(pWnd->hasAttention(KviWindow::MainWindowIsVisible)) - m_bDisableHideOnMainWindowGotAttention = true; - } + if(pWnd && pWnd->hasAttention(KviWindow::MainWindowIsVisible)) + m_bDisableHideOnMainWindowGotAttention = true; if(isVisible()) update(); @@ -385,8 +349,6 @@ bool NotifierWindow::shouldHideIfMainWindowGotAttention() void NotifierWindow::heartbeat() { - bool bIncreasing; - double targetOpacity = 0; switch(m_eState) { case Hidden: @@ -410,7 +372,7 @@ void NotifierWindow::heartbeat() else { m_dOpacity += OPACITY_STEP; - targetOpacity = isActiveWindow() ? KVI_OPTION_UINT(KviOption_uintNotifierActiveTransparency) : KVI_OPTION_UINT(KviOption_uintNotifierInactiveTransparency); + double targetOpacity = isActiveWindow() ? KVI_OPTION_UINT(KviOption_uintNotifierActiveTransparency) : KVI_OPTION_UINT(KviOption_uintNotifierInactiveTransparency); targetOpacity /= 100; if(m_dOpacity >= targetOpacity) @@ -429,9 +391,10 @@ void NotifierWindow::heartbeat() } break; case FocusingOn: - targetOpacity = KVI_OPTION_UINT(KviOption_uintNotifierActiveTransparency); + { + double targetOpacity = KVI_OPTION_UINT(KviOption_uintNotifierActiveTransparency); targetOpacity /= 100; - bIncreasing = targetOpacity > m_dOpacity; + bool bIncreasing = targetOpacity > m_dOpacity; m_dOpacity += bIncreasing ? OPACITY_STEP : -(OPACITY_STEP); if((bIncreasing && (m_dOpacity >= targetOpacity)) || (!bIncreasing && (m_dOpacity <= targetOpacity))) { @@ -441,13 +404,15 @@ void NotifierWindow::heartbeat() } setWindowOpacity(m_dOpacity); + } break; case FocusingOff: - targetOpacity = KVI_OPTION_UINT(KviOption_uintNotifierInactiveTransparency); + { + double targetOpacity = KVI_OPTION_UINT(KviOption_uintNotifierInactiveTransparency); targetOpacity /= 100; - bIncreasing = targetOpacity > m_dOpacity; + bool bIncreasing = targetOpacity > m_dOpacity; m_dOpacity += bIncreasing ? OPACITY_STEP : -(OPACITY_STEP); - //qDebug("%f %f %i %i",m_dOpacity,targetOpacity,bIncreasing,(m_dOpacity >= targetOpacity)); + if((bIncreasing && (m_dOpacity >= targetOpacity)) || (!bIncreasing && (m_dOpacity <= targetOpacity))) { m_dOpacity = targetOpacity; @@ -456,6 +421,7 @@ void NotifierWindow::heartbeat() } setWindowOpacity(m_dOpacity); + } break; case Hiding: m_dOpacity -= OPACITY_STEP; @@ -512,7 +478,6 @@ void NotifierWindow::doHide(bool bDoAnimate) if((!bDoAnimate) || (x() != m_pWndBorder->x()) || (y() != m_pWndBorder->y())) { - //qDebug("just hide quickly with notifier x() %d and notifier y() % - WBorderx() %d and WBordery() %d and bDoanimate %d",x(),y(),m_pWndBorder->x(),m_pWndBorder->y(),bDoAnimate); // the user asked to not animate or // the window has been moved and the animation would suck anyway // just hide quickly @@ -520,7 +485,6 @@ void NotifierWindow::doHide(bool bDoAnimate) } else { - //qDebug("starting hide animation notifier x() %d and notifier y() % - WBorderx() %d and WBordery() %d and bDoanimate %d",x(),y(),m_pWndBorder->x(),m_pWndBorder->y(),bDoAnimate); m_pShowHideTimer = new QTimer(); connect(m_pShowHideTimer, SIGNAL(timeout()), this, SLOT(heartbeat())); m_dOpacity = 1.0 - OPACITY_STEP; @@ -613,35 +577,18 @@ void NotifierWindow::paintEvent(QPaintEvent * e) if(width() != m_pWndBorder->width() || height() != m_pWndBorder->height()) m_pWndBorder->resize(size()); - if(m_bBlinkOn) - { - m_pWndBorder->draw(pPaint, true); - } - else - { - m_pWndBorder->draw(pPaint); - } + m_pWndBorder->draw(pPaint, m_bBlinkOn); pPaint->setPen(KVI_OPTION_COLOR(KviOption_colorNotifierTitleForeground)); pPaint->setFont(KVI_OPTION_FONT(KviOption_fontNotifierTitle)); QString szTitle = "KVIrc - "; NotifierWindowTab * pTab = (NotifierWindowTab *)m_pWndTabs->currentWidget(); - if(pTab) - { - if(pTab->wnd()) - { - szTitle += pTab->wnd()->plainTextCaption(); - } - else - { - szTitle += "notifier"; - } - } + if(pTab && pTab->wnd()) + szTitle += pTab->wnd()->plainTextCaption(); else - { szTitle += "notifier"; - } + pPaint->drawText(m_pWndBorder->titleRect(), Qt::AlignLeft | Qt::AlignVCenter | Qt::TextSingleLine, szTitle); delete pPaint; @@ -652,19 +599,14 @@ void NotifierWindow::mouseMoveEvent(QMouseEvent * e) { if(!m_bLeftButtonIsPressed) { - if(checkResizing(e->pos())) - goto sartelo; - - if(m_pWndBorder->captionRect().contains(e->pos())) + if(!checkResizing(e->pos()) && m_pWndBorder->captionRect().contains(e->pos())) { if(m_pWndBorder->closeRect().contains(e->pos())) m_pWndBorder->setCloseIcon(WDG_ICON_OVER); else m_pWndBorder->setCloseIcon(WDG_ICON_OUT); - goto sartelo; } - sartelo: update(); } diff --git a/src/modules/notifier/NotifierWindow.h b/src/modules/notifier/NotifierWindow.h index c85c1d18e..de29fb60f 100644 --- a/src/modules/notifier/NotifierWindow.h +++ b/src/modules/notifier/NotifierWindow.h @@ -62,28 +62,28 @@ public: ~NotifierWindow(); protected: - QTimer * m_pShowHideTimer; - QTimer * m_pBlinkTimer; - QTimer * m_pAutoHideTimer; - State m_eState; - bool m_bBlinkOn; - double m_dOpacity; + QTimer * m_pShowHideTimer = nullptr; + QTimer * m_pBlinkTimer = nullptr; + QTimer * m_pAutoHideTimer = nullptr; + State m_eState = Hidden; + bool m_bBlinkOn = false; + double m_dOpacity = 0.0; - bool m_bCloseDown; - bool m_bPrevDown; - bool m_bNextDown; - bool m_bWriteDown; + bool m_bCloseDown = false; + bool m_bPrevDown = false; + bool m_bNextDown = false; + bool m_bWriteDown = false; bool m_bCrashShowWorkAround; QRect m_wndRect; - NotifierMessage * m_pCurrentMessage; - KviThemedLineEdit * m_pLineEdit; + NotifierMessage * m_pCurrentMessage = nullptr; + KviThemedLineEdit * m_pLineEdit = nullptr; - bool m_bDragging; - bool m_bLeftButtonIsPressed; - bool m_bDiagonalResizing; - bool m_bResizing; + bool m_bDragging = false; + bool m_bLeftButtonIsPressed = false; + bool m_bDiagonalResizing = false; + bool m_bResizing = false; int m_whereResizing; @@ -91,19 +91,19 @@ protected: QPoint m_pntPos; QPoint m_pntClick; int m_iBlinkCount; - QMenu * m_pContextPopup; - QMenu * m_pDisablePopup; - KviWindow * m_pWindowToRaise; - kvi_time_t m_tAutoHideAt; - kvi_time_t m_tStartedAt; + QMenu * m_pContextPopup = nullptr; + QMenu * m_pDisablePopup = nullptr; + KviWindow * m_pWindowToRaise = nullptr; + kvi_time_t m_tAutoHideAt = 0; + kvi_time_t m_tStartedAt = 0; QTime m_qtStartedAt; - bool m_bDisableHideOnMainWindowGotAttention; + bool m_bDisableHideOnMainWindowGotAttention = false; QCursor m_cursor; - QTabWidget * m_pWndTabs; - QProgressBar * m_pProgressBar; - NotifierWindowBorder * m_pWndBorder; + QTabWidget * m_pWndTabs = nullptr; + QProgressBar * m_pProgressBar = nullptr; + NotifierWindowBorder * m_pWndBorder = nullptr; public: void doShow(bool bDoAnimate); @@ -120,16 +120,16 @@ public: }; inline State state() const { return m_eState; }; protected: - virtual void showEvent(QShowEvent * e); - virtual void hideEvent(QHideEvent * e); - virtual void paintEvent(QPaintEvent * e); - virtual void mousePressEvent(QMouseEvent * e); - virtual void mouseReleaseEvent(QMouseEvent * e); - virtual void mouseMoveEvent(QMouseEvent * e); - virtual void leaveEvent(QEvent * e); - virtual void enterEvent(QEvent * e); - virtual bool eventFilter(QObject * pEdit, QEvent * e); - virtual void keyPressEvent(QKeyEvent * e); + void showEvent(QShowEvent * e) override; + void hideEvent(QHideEvent * e) override; + void paintEvent(QPaintEvent * e) override; + void mousePressEvent(QMouseEvent * e) override; + void mouseReleaseEvent(QMouseEvent * e) override; + void mouseMoveEvent(QMouseEvent * e) override; + void leaveEvent(QEvent * e) override; + void enterEvent(QEvent * e) override; + bool eventFilter(QObject * pEdit, QEvent * e) override; + void keyPressEvent(QKeyEvent * e) override; public slots: void hideNow(); void toggleLineEdit(); diff --git a/src/modules/notifier/NotifierWindowBorder.h b/src/modules/notifier/NotifierWindowBorder.h index df07079d8..37e86e81b 100644 --- a/src/modules/notifier/NotifierWindowBorder.h +++ b/src/modules/notifier/NotifierWindowBorder.h @@ -26,9 +26,9 @@ #include "NotifierSettings.h" -#include <QSize> -#include <QRect> #include <QPixmap> +#include <QRect> +#include <QSize> class QPainter; @@ -38,9 +38,6 @@ public: NotifierWindowBorder(QSize = QSize(WDG_MIN_WIDTH, WDG_MIN_HEIGHT)); ~NotifierWindowBorder(); - // ================================ - // Put members declaration below... - // ================================ private: QRect m_rct; QPoint m_pnt; @@ -52,18 +49,18 @@ private: QRect m_titleRect; // Pictures - QPixmap * m_pixSX; - QPixmap * m_pixDX; - QPixmap * m_pixDWN; - QPixmap * m_pixDWNSX; - QPixmap * m_pixDWNDX; - QPixmap * m_pixCaptionSX; - QPixmap * m_pixCaptionDX; - QPixmap * m_pixCaptionBKG; - QPixmap * m_pixIconClose_out; - QPixmap * m_pixIconClose_over; - QPixmap * m_pixIconClose_clicked; - QPixmap * m_pixIconClose; + QPixmap * m_pixSX = nullptr; + QPixmap * m_pixDX = nullptr; + QPixmap * m_pixDWN = nullptr; + QPixmap * m_pixDWNSX = nullptr; + QPixmap * m_pixDWNDX = nullptr; + QPixmap * m_pixCaptionSX = nullptr; + QPixmap * m_pixCaptionDX = nullptr; + QPixmap * m_pixCaptionBKG = nullptr; + QPixmap * m_pixIconClose_out = nullptr; + QPixmap * m_pixIconClose_over = nullptr; + QPixmap * m_pixIconClose_clicked = nullptr; + QPixmap * m_pixIconClose = nullptr; QPixmap m_pixSX_N; QPixmap m_pixDX_N; @@ -105,23 +102,23 @@ public: { setWidth(w); setHeight(h); - }; + } void resize(QSize r) { setWidth(r.width()); setHeight(r.height()); - }; + } void setGeometry(QRect r) { r.topLeft(); - r.size(); /*qDebug("x,y: %d,%d", r.x(), r.y()); qDebug("w,h: %d,%d", r.width(), r.height());*/ - }; + r.size(); + } void setGeometry(QPoint p, QSize s) { setPoint(p.x(), p.y()); setWidth(s.width()); setHeight(s.height()); - }; + } void setPoint(int x, int y) { @@ -129,23 +126,23 @@ public: m_pnt.setY(y); m_rct.setX(x); m_rct.setY(y); - }; + } void setCloseIcon(int state); void resetIcons(); // writing methods... - inline int x() const { return m_pnt.x(); }; - inline int y() const { return m_pnt.y(); }; - inline int width() const { return m_rct.width(); }; - inline int height() const { return m_rct.height(); }; - inline int baseLine() const { return (y() + height()); }; + inline int x() const { return m_pnt.x(); } + inline int y() const { return m_pnt.y(); } + inline int width() const { return m_rct.width(); } + inline int height() const { return m_rct.height(); } + inline int baseLine() const { return (y() + height()); } - inline QRect bodyRect() const { return m_bodyRect; }; - inline QRect captionRect() const { return m_captionRect; }; - inline QRect rect() const { return m_rct; }; - inline QRect closeRect() const { return m_closeIconRect; }; - inline QRect titleRect() const { return m_titleRect; }; + inline QRect bodyRect() const { return m_bodyRect; } + inline QRect captionRect() const { return m_captionRect; } + inline QRect rect() const { return m_rct; } + inline QRect closeRect() const { return m_closeIconRect; } + inline QRect titleRect() const { return m_titleRect; } void draw(QPainter *, bool b = false); void setPics(bool b = false); diff --git a/src/modules/notifier/NotifierWindowTab.cpp b/src/modules/notifier/NotifierWindowTab.cpp index d02fd095d..0ec9f2a90 100644 --- a/src/modules/notifier/NotifierWindowTab.cpp +++ b/src/modules/notifier/NotifierWindowTab.cpp @@ -36,9 +36,9 @@ #include "KviPixmapUtils.h" #include "KviWindow.h" -#include <QScrollBar> -#include <QResizeEvent> #include <QPainter> +#include <QResizeEvent> +#include <QScrollBar> #include <QTabWidget> #include <QVBoxLayout> #include <QWidget> @@ -51,9 +51,8 @@ extern KVIRC_API QPixmap * g_pShadedChildGlobalDesktopBackground; extern NotifierWindow * g_pNotifierWindow; NotifierWindowTab::NotifierWindowTab(KviWindow * pWnd, QTabWidget * pParent) - : QScrollArea(pParent) + : QScrollArea(pParent), m_pWnd{pWnd}, m_pParent{pParent} { - m_pWnd = pWnd; if(m_pWnd) { m_szLabel = m_pWnd->windowName(); @@ -65,11 +64,8 @@ NotifierWindowTab::NotifierWindowTab(KviWindow * pWnd, QTabWidget * pParent) m_szLabel = "----"; } - if(pParent) - { - m_pParent = pParent; + if(m_pParent) m_pParent->addTab(this, m_szLabel); - } setFocusPolicy(Qt::NoFocus); setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); @@ -170,24 +166,18 @@ void NotifierWindowTab::closeMe() { int iIdx = m_pParent->indexOf(this); if(iIdx != -1) - { g_pNotifierWindow->slotTabCloseRequested(iIdx); - } } } void NotifierWindowTab::resizeEvent(QResizeEvent *) { - if(m_pVBox) + int iWidth = viewport()->width(); + for(int i = 0; i < m_pVBox->count(); i++) { - int iWidth = viewport()->width(); - NotifierMessage * pMessage; - for(int i = 0; i < m_pVBox->count(); i++) - { - pMessage = (NotifierMessage *)m_pVBox->itemAt(i)->widget(); - if(pMessage) - pMessage->setFixedWidth(iWidth); - } + NotifierMessage * pMessage = (NotifierMessage *)m_pVBox->itemAt(i)->widget(); + if(pMessage) + pMessage->setFixedWidth(iWidth); } } diff --git a/src/modules/notifier/NotifierWindowTab.h b/src/modules/notifier/NotifierWindowTab.h index 784936aa6..dfc9714cf 100644 --- a/src/modules/notifier/NotifierWindowTab.h +++ b/src/modules/notifier/NotifierWindowTab.h @@ -36,11 +36,11 @@ #include <QScrollArea> +class KviWindow; +class QPainter; +class QTabWidget; class QVBoxLayout; class QWidget; -class QTabWidget; -class QPainter; -class KviWindow; /** * \class NotifierWindowTab @@ -65,10 +65,10 @@ public: private: QString m_szLabel; - KviWindow * m_pWnd; - QTabWidget * m_pParent; - QVBoxLayout * m_pVBox; - QWidget * m_pVWidget; + KviWindow * m_pWnd = nullptr; + QTabWidget * m_pParent = nullptr; + QVBoxLayout * m_pVBox = nullptr; + QWidget * m_pVWidget = nullptr; public: /** @@ -88,17 +88,17 @@ public: * \brief Returns the name of the current window * \return QString */ - inline QString label() const { return m_szLabel; }; + inline QString label() const { return m_szLabel; } /** * \brief Returns the pointer of the current window * \return KviWindow * */ - inline KviWindow * wnd() const { return m_pWnd; }; + inline KviWindow * wnd() const { return m_pWnd; } protected: - virtual void mouseDoubleClickEvent(QMouseEvent * e); - virtual void resizeEvent(QResizeEvent * e); - virtual void paintEvent(QPaintEvent * e); + void mouseDoubleClickEvent(QMouseEvent * e) override; + void resizeEvent(QResizeEvent * e) override; + void paintEvent(QPaintEvent * e) override; private slots: /** * \brief Emitted when the scrollbar range is changed diff --git a/src/modules/notifier/libkvinotifier.cpp b/src/modules/notifier/libkvinotifier.cpp index fa21755df..47f814964 100644 --- a/src/modules/notifier/libkvinotifier.cpp +++ b/src/modules/notifier/libkvinotifier.cpp @@ -36,8 +36,6 @@ #include "KviTimeUtils.h" #include "KviOptions.h" -#include <QSplitter> - NotifierWindow * g_pNotifierWindow = nullptr; kvi_time_t g_tNotifierDisabledUntil = 0; @@ -255,10 +253,8 @@ static bool notifier_kvs_cmd_show(KviKvsModuleCommandCall * c) static bool notifier_kvs_fnc_isEnabled(KviKvsModuleFunctionCall * c) { - bool bCheck; - if(!KVI_OPTION_BOOL(KviOption_boolEnableNotifier)) - bCheck = false; - else + bool bCheck = false; + if(KVI_OPTION_BOOL(KviOption_boolEnableNotifier)) bCheck = g_tNotifierDisabledUntil < kvi_unixTime(); c->returnValue()->setBoolean(bCheck); return true; |
