kdeplasma-addons: format and indent

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-09-15 05:46:56 +03:00
parent cbc029d43c
commit 1c8b53127e
2 changed files with 37 additions and 41 deletions

View file

@ -41,10 +41,6 @@ ShowDesktop::ShowDesktop(QObject *parent, const QVariantList &args)
connect(&m_timer, SIGNAL(timeout()), this, SLOT(minimizeAll())); connect(&m_timer, SIGNAL(timeout()), this, SLOT(minimizeAll()));
} }
ShowDesktop::~ShowDesktop()
{
}
void ShowDesktop::init() void ShowDesktop::init()
{ {
connect(this, SIGNAL(activate()), this, SLOT(minimizeAll())); connect(this, SIGNAL(activate()), this, SLOT(minimizeAll()));
@ -68,12 +64,17 @@ void ShowDesktop::init()
#ifndef MINIMIZE_ONLY #ifndef MINIMIZE_ONLY
if (m_wm2ShowingDesktop) { if (m_wm2ShowingDesktop) {
connect(KWindowSystem::self(), SIGNAL(activeWindowChanged(WId)), this, SLOT(reset())); connect(
KWindowSystem::self(), SIGNAL(activeWindowChanged(WId)),
this, SLOT(reset())
);
} }
#endif #endif
connect(KGlobalSettings::self(), SIGNAL(iconChanged(int)), connect(
this, SLOT(iconSizeChanged(int))); KGlobalSettings::self(), SIGNAL(iconChanged(int)),
this, SLOT(iconSizeChanged(int))
);
} }
void ShowDesktop::minimizeAll() void ShowDesktop::minimizeAll()
@ -103,8 +104,8 @@ void ShowDesktop::dragLeaveEvent(QGraphicsSceneDragDropEvent *event)
{ {
m_timer.stop(); m_timer.stop();
} }
#ifndef MINIMIZE_ONLY
#ifndef MINIMIZE_ONLY
void ShowDesktop::delay() void ShowDesktop::delay()
{ {
m_goingDown = false; m_goingDown = false;
@ -120,23 +121,21 @@ void ShowDesktop::reset()
QSizeF ShowDesktop::sizeHint(Qt::SizeHint which, const QSizeF & constraint) const QSizeF ShowDesktop::sizeHint(Qt::SizeHint which, const QSizeF & constraint) const
{ {
if (which == Qt::PreferredSize) { if (which == Qt::PreferredSize) {
int iconSize; int iconSize = 0;
switch (formFactor()) { switch (formFactor()) {
case Plasma::Planar: case Plasma::Planar:
case Plasma::MediaCenter: case Plasma::MediaCenter: {
iconSize = IconSize(KIconLoader::Desktop); iconSize = IconSize(KIconLoader::Desktop);
break; break;
}
case Plasma::Horizontal: case Plasma::Horizontal:
case Plasma::Vertical: case Plasma::Vertical: {
iconSize = IconSize(KIconLoader::Panel); iconSize = IconSize(KIconLoader::Panel);
break; break;
} }
}
return QSizeF(iconSize, iconSize); return QSizeF(iconSize, iconSize);
} }
return Plasma::Applet::sizeHint(which, constraint); return Plasma::Applet::sizeHint(which, constraint);
} }
@ -146,7 +145,6 @@ void ShowDesktop::iconSizeChanged(int group)
updateGeometry(); updateGeometry();
} }
} }
#endif // MINIMIZE_ONLY
#endif
#include "moc_showdesktop.cpp" #include "moc_showdesktop.cpp"

View file

@ -15,8 +15,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef SHOWDESKTOP_HEADER #ifndef SHOWDESKTOP_H
#define SHOWDESKTOP_HEADER #define SHOWDESKTOP_H
//#define MINIMIZE_ONLY //#define MINIMIZE_ONLY
@ -27,30 +27,28 @@
class ShowDesktop : public Plasma::Applet class ShowDesktop : public Plasma::Applet
{ {
Q_OBJECT Q_OBJECT
public: public:
ShowDesktop(QObject *parent, const QVariantList &args); ShowDesktop(QObject *parent, const QVariantList &args);
~ShowDesktop();
virtual void init(); void init() final;
public slots: public slots:
void minimizeAll(); void minimizeAll();
#ifndef MINIMIZE_ONLY #ifndef MINIMIZE_ONLY
void reset(); void reset();
void delay(); void delay();
#endif #endif
protected: protected:
void dragEnterEvent(QGraphicsSceneDragDropEvent *event); void dragEnterEvent(QGraphicsSceneDragDropEvent *event);
void dragLeaveEvent(QGraphicsSceneDragDropEvent *event); void dragLeaveEvent(QGraphicsSceneDragDropEvent *event);
QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint = QSizeF()) const; QSizeF sizeHint(Qt::SizeHint which, const QSizeF & constraint = QSizeF()) const;
private slots: private slots:
void iconSizeChanged(int group); void iconSizeChanged(int group);
private: private:
bool m_wm2ShowingDesktop; bool m_wm2ShowingDesktop;
#ifndef MINIMIZE_ONLY #ifndef MINIMIZE_ONLY
bool m_down; bool m_down;
bool m_goingDown; bool m_goingDown;
@ -60,4 +58,4 @@ class ShowDesktop : public Plasma::Applet
K_EXPORT_PLASMA_APPLET(showdesktop, ShowDesktop) K_EXPORT_PLASMA_APPLET(showdesktop, ShowDesktop)
#endif #endif // SHOWDESKTOP_H