]> jfr.im git - irc/kvirc/KVIrc.git/commitdiff
notifier module: general code cleanup
authorIceN9ne <redacted>
Sat, 21 Oct 2017 22:10:40 +0000 (18:10 -0400)
committerIceN9ne <redacted>
Sat, 21 Oct 2017 22:10:40 +0000 (18:10 -0400)
src/modules/notifier/NotifierMessage.cpp
src/modules/notifier/NotifierMessage.h
src/modules/notifier/NotifierWindow.cpp
src/modules/notifier/NotifierWindow.h
src/modules/notifier/NotifierWindowBorder.h
src/modules/notifier/NotifierWindowTab.cpp
src/modules/notifier/NotifierWindowTab.h
src/modules/notifier/libkvinotifier.cpp

index b0a6e401b5692c7b4af141c3e16e4be4e939d74d..83910e576e05269bc050871f80e66ed91d495bba 100644 (file)
 #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);
index c0179f0e10e4ed13238575237da33ec76e134261..bdc1e7fb95872b812fa3693b500c77d767710f74 100644 (file)
@@ -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
index 4ce8ea027e40ae77c3f26f6f02797c8c2c587d40..086b4d7372ad86810451a52750bcf0896152e688 100644 (file)
 #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();
        }
 
index c85c1d18e084a28340a15d76d411791fd35465ac..de29fb60f53aad5589cedc598d0c2e1cd183263a 100644 (file)
@@ -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;
-
-       bool m_bCloseDown;
-       bool m_bPrevDown;
-       bool m_bNextDown;
-       bool m_bWriteDown;
+       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 = 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();
index df07079d8f0b09469174a5792495767681cf7839..37e86e81b543a3cd766e50e166a53f8db98630b8 100644 (file)
@@ -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 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 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; }
 
        void draw(QPainter *, bool b = false);
        void setPics(bool b = false);
index d02fd095d6b229434b04478000d5098a674a1277..0ec9f2a90f473d7a6d20e6d3bb3bf90b57cf2011 100644 (file)
@@ -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);
        }
 }
 
index 784936aa697f444cfc0e989ac5ccd17748790782..dfc9714cf0c19d130774e1ecc781f1b6cd1faf2e 100644 (file)
 
 #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
index fa21755dff6bdd0a1c798f7999c6846d940b4864..47f8149648c20253f39a087d37af3068e6d2dee0 100644 (file)
@@ -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;