OSDN Git Service

kdeplasma-addons: format and indent
authorIvailo Monev <xakepa10@gmail.com>
Fri, 15 Sep 2023 02:46:56 +0000 (05:46 +0300)
committerIvailo Monev <xakepa10@gmail.com>
Fri, 15 Sep 2023 02:46:56 +0000 (05:46 +0300)
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
kdeplasma-addons/applets/showdesktop/showdesktop.cpp
kdeplasma-addons/applets/showdesktop/showdesktop.h

index 8a87c22..4a5a97d 100644 (file)
@@ -41,10 +41,6 @@ ShowDesktop::ShowDesktop(QObject *parent, const QVariantList &args)
     connect(&m_timer, SIGNAL(timeout()), this, SLOT(minimizeAll()));
 }
 
-ShowDesktop::~ShowDesktop()
-{
-}
-
 void ShowDesktop::init()
 {
     connect(this, SIGNAL(activate()), this, SLOT(minimizeAll()));
@@ -68,12 +64,17 @@ void ShowDesktop::init()
 
 #ifndef MINIMIZE_ONLY
     if (m_wm2ShowingDesktop) {
-        connect(KWindowSystem::self(), SIGNAL(activeWindowChanged(WId)), this, SLOT(reset()));
+        connect(
+            KWindowSystem::self(), SIGNAL(activeWindowChanged(WId)),
+            this, SLOT(reset())
+        );
     }
 #endif
 
-    connect(KGlobalSettings::self(), SIGNAL(iconChanged(int)),
-        this, SLOT(iconSizeChanged(int)));
+    connect(
+        KGlobalSettings::self(), SIGNAL(iconChanged(int)),
+        this, SLOT(iconSizeChanged(int))
+    );
 }
 
 void ShowDesktop::minimizeAll()
@@ -103,8 +104,8 @@ void ShowDesktop::dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
 {
     m_timer.stop();
 }
-#ifndef MINIMIZE_ONLY
 
+#ifndef MINIMIZE_ONLY
 void ShowDesktop::delay()
 {
     m_goingDown = false;
@@ -120,23 +121,21 @@ void ShowDesktop::reset()
 QSizeF ShowDesktop::sizeHint(Qt::SizeHint which, const QSizeF & constraint) const
 {
     if (which == Qt::PreferredSize) {
-        int iconSize;
-
+        int iconSize = 0;
         switch (formFactor()) {
             case Plasma::Planar:
-            case Plasma::MediaCenter:
+            case Plasma::MediaCenter: {
                 iconSize = IconSize(KIconLoader::Desktop);
                 break;
-
+            }
             case Plasma::Horizontal:
-            case Plasma::Vertical:
+            case Plasma::Vertical: {
                 iconSize = IconSize(KIconLoader::Panel);
                 break;
+            }
         }
-
         return QSizeF(iconSize, iconSize);
     }
-
     return Plasma::Applet::sizeHint(which, constraint);
 }
 
@@ -146,7 +145,6 @@ void ShowDesktop::iconSizeChanged(int group)
         updateGeometry();
     }
 }
-
-#endif
+#endif // MINIMIZE_ONLY
 
 #include "moc_showdesktop.cpp"
index dbb48dd..7f94569 100644 (file)
@@ -15,8 +15,8 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#ifndef SHOWDESKTOP_HEADER
-#define SHOWDESKTOP_HEADER
+#ifndef SHOWDESKTOP_H
+#define SHOWDESKTOP_H
 
 //#define MINIMIZE_ONLY
 
 class ShowDesktop : public Plasma::Applet
 {
     Q_OBJECT
-    public:
-        ShowDesktop(QObject *parent, const QVariantList &args);
-        ~ShowDesktop();
+public:
+    ShowDesktop(QObject *parent, const QVariantList &args);
 
-        virtual void init();
+    void init() final;
 
-    public slots:
-        void minimizeAll();
+public slots:
+    void minimizeAll();
 #ifndef MINIMIZE_ONLY
-        void reset();
-        void delay();
+    void reset();
+    void delay();
 #endif
 
-    protected:
-        void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
-        void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
-        QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint = QSizeF()) const;
-        
-    private slots:
-        void iconSizeChanged(int group);
-
-    private:
-        bool m_wm2ShowingDesktop;
+protected:
+    void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
+    void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
+    QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint = QSizeF()) const;
+    
+private slots:
+    void iconSizeChanged(int group);
 
+private:
+    bool m_wm2ShowingDesktop;
 #ifndef MINIMIZE_ONLY
-        bool m_down;
-        bool m_goingDown;
+    bool m_down;
+    bool m_goingDown;
 #endif
-        QTimer m_timer;
+    QTimer m_timer;
 };
 
 K_EXPORT_PLASMA_APPLET(showdesktop, ShowDesktop)
 
-#endif
+#endif // SHOWDESKTOP_H