Skip to content

Commit 7b16b4c

Browse files
author
rekols
committed
chore: code format
1 parent bfaac53 commit 7b16b4c

22 files changed

Lines changed: 397 additions & 63 deletions

interfaces/pluginsiterface.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
/*
2+
* Copyright (C) 2020 PandaOS Team.
3+
*
4+
* Author: rekols <revenmartin@gmail.com>
5+
*
6+
* This program is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or
9+
* any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU General Public License
17+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
*/
19+
120
#ifndef PLUGINSINTERFACE_H
221
#define PLUGINSINTERFACE_H
322

plugin-battery/batterywidget.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
/*
2+
* Copyright (C) 2020 PandaOS Team.
3+
*
4+
* Author: rekols <revenmartin@gmail.com>
5+
*
6+
* This program is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or
9+
* any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU General Public License
17+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
*/
19+
120
#include "batterywidget.h"
221
#include <QHBoxLayout>
322
#include <QPainter>

plugin-battery/batterywidget.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
/*
2+
* Copyright (C) 2020 PandaOS Team.
3+
*
4+
* Author: rekols <revenmartin@gmail.com>
5+
*
6+
* This program is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or
9+
* any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU General Public License
17+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
*/
19+
120
#ifndef BATTERYWIDGET_H
221
#define BATTERYWIDGET_H
322

plugin-statusnotifier/sniasync.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22

33
SniAsync::SniAsync(const QString &service, const QString &path, const QDBusConnection &connection, QObject *parent/* = 0*/)
44
: QObject(parent)
5-
, mSni{service, path, connection}
5+
, m_sni{service, path, connection}
66
{
77
//forward StatusNotifierItem signals
8-
connect(&mSni, &org::kde::StatusNotifierItem::NewAttentionIcon, this, &SniAsync::NewAttentionIcon);
9-
connect(&mSni, &org::kde::StatusNotifierItem::NewIcon, this, &SniAsync::NewIcon);
10-
connect(&mSni, &org::kde::StatusNotifierItem::NewOverlayIcon, this, &SniAsync::NewOverlayIcon);
11-
connect(&mSni, &org::kde::StatusNotifierItem::NewStatus, this, &SniAsync::NewStatus);
12-
connect(&mSni, &org::kde::StatusNotifierItem::NewTitle, this, &SniAsync::NewTitle);
13-
connect(&mSni, &org::kde::StatusNotifierItem::NewToolTip, this, &SniAsync::NewToolTip);
8+
connect(&m_sni, &org::kde::StatusNotifierItem::NewAttentionIcon, this, &SniAsync::NewAttentionIcon);
9+
connect(&m_sni, &org::kde::StatusNotifierItem::NewIcon, this, &SniAsync::NewIcon);
10+
connect(&m_sni, &org::kde::StatusNotifierItem::NewOverlayIcon, this, &SniAsync::NewOverlayIcon);
11+
connect(&m_sni, &org::kde::StatusNotifierItem::NewStatus, this, &SniAsync::NewStatus);
12+
connect(&m_sni, &org::kde::StatusNotifierItem::NewTitle, this, &SniAsync::NewTitle);
13+
connect(&m_sni, &org::kde::StatusNotifierItem::NewToolTip, this, &SniAsync::NewToolTip);
1414
}
1515

1616
QDBusPendingReply<QDBusVariant> SniAsync::asyncPropGet(QString const & property)
1717
{
18-
QDBusMessage msg = QDBusMessage::createMethodCall(mSni.service(), mSni.path(), QLatin1String("org.freedesktop.DBus.Properties"), QLatin1String("Get"));
19-
msg << mSni.interface() << property;
20-
return mSni.connection().asyncCall(msg);
18+
QDBusMessage msg = QDBusMessage::createMethodCall(m_sni.service(), m_sni.path(), QLatin1String("org.freedesktop.DBus.Properties"), QLatin1String("Get"));
19+
msg << m_sni.interface() << property;
20+
return m_sni.connection().asyncCall(msg);
2121
}

plugin-statusnotifier/sniasync.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,22 +52,22 @@ class SniAsync : public QObject
5252
{
5353
QDBusPendingReply<QVariant> reply = *call;
5454
if (reply.isError())
55-
qDebug().noquote().nospace() << "Error on DBus request(" << mSni.service() << ',' << mSni.path() << "): " << reply.error();
55+
qDebug().noquote().nospace() << "Error on DBus request(" << m_sni.service() << ',' << m_sni.path() << "): " << reply.error();
5656
finished(qdbus_cast<typename std::function<typename call_signature<F>::type>::argument_type>(reply.value()));
5757
call->deleteLater();
5858
}
5959
);
6060
}
6161

6262
//exposed methods from org::kde::StatusNotifierItem
63-
inline QString service() const { return mSni.service(); }
63+
inline QString service() const { return m_sni.service(); }
6464

6565
public slots:
6666
//Forwarded slots from org::kde::StatusNotifierItem
67-
inline QDBusPendingReply<> Activate(int x, int y) { return mSni.Activate(x, y); }
68-
inline QDBusPendingReply<> ContextMenu(int x, int y) { return mSni.ContextMenu(x, y); }
69-
inline QDBusPendingReply<> Scroll(int delta, const QString &orientation) { return mSni.Scroll(delta, orientation); }
70-
inline QDBusPendingReply<> SecondaryActivate(int x, int y) { return mSni.SecondaryActivate(x, y); }
67+
inline QDBusPendingReply<> Activate(int x, int y) { return m_sni.Activate(x, y); }
68+
inline QDBusPendingReply<> ContextMenu(int x, int y) { return m_sni.ContextMenu(x, y); }
69+
inline QDBusPendingReply<> Scroll(int delta, const QString &orientation) { return m_sni.Scroll(delta, orientation); }
70+
inline QDBusPendingReply<> SecondaryActivate(int x, int y) { return m_sni.SecondaryActivate(x, y); }
7171

7272
signals:
7373
//Forwarded signals from org::kde::StatusNotifierItem
@@ -82,7 +82,7 @@ public slots:
8282
QDBusPendingReply<QDBusVariant> asyncPropGet(QString const & property);
8383

8484
private:
85-
org::kde::StatusNotifierItem mSni;
85+
org::kde::StatusNotifierItem m_sni;
8686

8787
};
8888

plugin-statusnotifier/statusnotifierbutton.cpp

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
/* BEGIN_COMMON_COPYRIGHT_HEADER
22
* (c)LGPL2+
33
*
4-
* LXQt - a lightweight, Qt based, desktop toolset
5-
* https://lxqt.org
6-
*
7-
* Copyright: 2015 LXQt team
84
* Authors:
95
* Balázs Béla <balazsbela[at]gmail.com>
106
* Paulo Lieuthier <paulolieuthier@gmail.com>
@@ -54,9 +50,9 @@ namespace
5450

5551
StatusNotifierButton::StatusNotifierButton(QString service, QString objectPath, QWidget *parent)
5652
: QToolButton(parent),
57-
mMenu(nullptr),
58-
mStatus(Passive),
59-
mFallbackIcon(QIcon::fromTheme(QLatin1String("application-x-executable")))
53+
m_menu(nullptr),
54+
m_status(Passive),
55+
m_fallbackIcon(QIcon::fromTheme(QLatin1String("application-x-executable")))
6056
{
6157
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
6258
setAutoRaise(true);
@@ -70,8 +66,8 @@ StatusNotifierButton::StatusNotifierButton(QString service, QString objectPath,
7066

7167
interface->propertyGetAsync(QLatin1String("Menu"), [this] (QDBusObjectPath path) {
7268
if (!path.path().startsWith("/NO_DBUSMENU")) {
73-
mMenu = (new MenuImporter{interface->service(), path.path(), this})->menu();
74-
mMenu->setObjectName(QLatin1String("StatusNotifierMenu"));
69+
m_menu = (new MenuImporter{interface->service(), path.path(), this})->menu();
70+
m_menu->setObjectName(QLatin1String("StatusNotifierMenu"));
7571
}
7672
});
7773

@@ -168,13 +164,13 @@ void StatusNotifierButton::refetchIcon(Status status, const QString& themePath)
168164
switch (status)
169165
{
170166
case Active:
171-
mOverlayIcon = nextIcon;
167+
m_overlayIcon = nextIcon;
172168
break;
173169
case NeedsAttention:
174-
mAttentionIcon = nextIcon;
170+
m_attentionIcon = nextIcon;
175171
break;
176172
case Passive:
177-
mIcon = nextIcon;
173+
m_icon = nextIcon;
178174
break;
179175
}
180176

@@ -207,13 +203,13 @@ void StatusNotifierButton::refetchIcon(Status status, const QString& themePath)
207203
switch (status)
208204
{
209205
case Active:
210-
mOverlayIcon = nextIcon;
206+
m_overlayIcon = nextIcon;
211207
break;
212208
case NeedsAttention:
213-
mAttentionIcon = nextIcon;
209+
m_attentionIcon = nextIcon;
214210
break;
215211
case Passive:
216-
mIcon = nextIcon;
212+
m_icon = nextIcon;
217213
break;
218214
}
219215

@@ -248,10 +244,10 @@ void StatusNotifierButton::newStatus(QString status)
248244
else
249245
newStatus = NeedsAttention;
250246

251-
if (mStatus == newStatus)
247+
if (m_status == newStatus)
252248
return;
253249

254-
mStatus = newStatus;
250+
m_status = newStatus;
255251
resetIcon();
256252
}
257253

@@ -268,8 +264,8 @@ void StatusNotifierButton::mouseReleaseEvent(QMouseEvent *event)
268264
else if (event->button() == Qt::MidButton)
269265
interface->SecondaryActivate(QCursor::pos().x(), QCursor::pos().y());
270266
else if (Qt::RightButton == event->button()) {
271-
if (mMenu) {
272-
mMenu->popup(mapToGlobal(QPoint(0, 0)));
267+
if (m_menu) {
268+
m_menu->popup(mapToGlobal(QPoint(0, 0)));
273269
} else
274270
interface->ContextMenu(QCursor::pos().x(), QCursor::pos().y());
275271
}
@@ -286,16 +282,16 @@ void StatusNotifierButton::resetIcon()
286282
{
287283
setIconSize(QSize(30, 30));
288284

289-
if (mStatus == Active && !mOverlayIcon.isNull())
290-
setIcon(mOverlayIcon);
291-
else if (mStatus == NeedsAttention && !mAttentionIcon.isNull())
292-
setIcon(mAttentionIcon);
293-
else if (!mIcon.isNull()) // mStatus == Passive
294-
setIcon(mIcon);
295-
else if (!mOverlayIcon.isNull())
296-
setIcon(mOverlayIcon);
297-
else if (!mAttentionIcon.isNull())
298-
setIcon(mAttentionIcon);
285+
if (m_status == Active && !m_overlayIcon.isNull())
286+
setIcon(m_overlayIcon);
287+
else if (m_status == NeedsAttention && !m_attentionIcon.isNull())
288+
setIcon(m_attentionIcon);
289+
else if (!m_icon.isNull()) // m_status == Passive
290+
setIcon(m_icon);
291+
else if (!m_overlayIcon.isNull())
292+
setIcon(m_overlayIcon);
293+
else if (!m_attentionIcon.isNull())
294+
setIcon(m_attentionIcon);
299295
else
300-
setIcon(mFallbackIcon);
296+
setIcon(m_fallbackIcon);
301297
}

plugin-statusnotifier/statusnotifierbutton.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
/* BEGIN_COMMON_COPYRIGHT_HEADER
22
* (c)LGPL2+
33
*
4-
* LXQt - a lightweight, Qt based, desktop toolset
5-
* https://lxqt.org
6-
*
7-
* Copyright: 2015 LXQt team
84
* Authors:
95
* Balázs Béla <balazsbela[at]gmail.com>
106
* Paulo Lieuthier <paulolieuthier@gmail.com>
@@ -71,10 +67,10 @@ public slots:
7167

7268
private:
7369
SniAsync *interface;
74-
QMenu *mMenu;
75-
Status mStatus;
70+
QMenu *m_menu;
71+
Status m_status;
7672

77-
QIcon mIcon, mOverlayIcon, mAttentionIcon, mFallbackIcon;
73+
QIcon m_icon, m_overlayIcon, m_attentionIcon, m_fallbackIcon;
7874

7975
protected:
8076
void contextMenuEvent(QContextMenuEvent * event);

plugin-statusnotifier/statusnotifierwidget.cpp

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
/*
2+
* Copyright (C) 2020 PandaOS Team.
3+
*
4+
* Author: rekols <revenmartin@gmail.com>
5+
*
6+
* This program is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or
9+
* any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU General Public License
17+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
*/
19+
120
#include "statusnotifierwidget.h"
221
#include <QApplication>
322
#include <QDebug>
@@ -15,14 +34,14 @@ StatusNotifierWidget::StatusNotifierWidget(QWidget *parent)
1534
QFutureWatcher<StatusNotifierWatcher *> * future_watcher = new QFutureWatcher<StatusNotifierWatcher *>;
1635
connect(future_watcher, &QFutureWatcher<StatusNotifierWatcher *>::finished, this, [this, future_watcher]
1736
{
18-
mWatcher = future_watcher->future().result();
37+
m_watcher = future_watcher->future().result();
1938

20-
connect(mWatcher, &StatusNotifierWatcher::StatusNotifierItemRegistered,
39+
connect(m_watcher, &StatusNotifierWatcher::StatusNotifierItemRegistered,
2140
this, &StatusNotifierWidget::itemAdded);
22-
connect(mWatcher, &StatusNotifierWatcher::StatusNotifierItemUnregistered,
41+
connect(m_watcher, &StatusNotifierWatcher::StatusNotifierItemUnregistered,
2342
this, &StatusNotifierWidget::itemRemoved);
2443

25-
qDebug() << mWatcher->RegisteredStatusNotifierItems();
44+
qDebug() << m_watcher->RegisteredStatusNotifierItems();
2645

2746
future_watcher->deleteLater();
2847
});
@@ -44,7 +63,7 @@ StatusNotifierWidget::StatusNotifierWidget(QWidget *parent)
4463

4564
StatusNotifierWidget::~StatusNotifierWidget()
4665
{
47-
delete mWatcher;
66+
delete m_watcher;
4867
}
4968

5069
void StatusNotifierWidget::itemAdded(QString serviceAndPath)
@@ -55,14 +74,14 @@ void StatusNotifierWidget::itemAdded(QString serviceAndPath)
5574
StatusNotifierButton *button = new StatusNotifierButton(serv, path, this);
5675
button->setFixedSize(30, 30);
5776

58-
mServices.insert(serviceAndPath, button);
77+
m_services.insert(serviceAndPath, button);
5978
m_layout->insertWidget(0, button);
6079
button->show();
6180
}
6281

6382
void StatusNotifierWidget::itemRemoved(const QString &serviceAndPath)
6483
{
65-
StatusNotifierButton *button = mServices.value(serviceAndPath, nullptr);
84+
StatusNotifierButton *button = m_services.value(serviceAndPath, nullptr);
6685
if (button) {
6786
button->deleteLater();
6887
m_layout->removeWidget(button);

plugin-statusnotifier/statusnotifierwidget.h

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
/*
2+
* Copyright (C) 2020 PandaOS Team.
3+
*
4+
* Author: rekols <revenmartin@gmail.com>
5+
*
6+
* This program is free software: you can redistribute it and/or modify
7+
* it under the terms of the GNU General Public License as published by
8+
* the Free Software Foundation, either version 3 of the License, or
9+
* any later version.
10+
*
11+
* This program is distributed in the hope that it will be useful,
12+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
* GNU General Public License for more details.
15+
*
16+
* You should have received a copy of the GNU General Public License
17+
* along with this program. If not, see <http://www.gnu.org/licenses/>.
18+
*/
19+
120
#ifndef STATUSNOTIFIERWIDGET_H
221
#define STATUSNOTIFIERWIDGET_H
322

@@ -20,9 +39,9 @@ public slots:
2039

2140
private:
2241
QHBoxLayout *m_layout;
23-
StatusNotifierWatcher *mWatcher;
42+
StatusNotifierWatcher *m_watcher;
2443

25-
QHash<QString, StatusNotifierButton*> mServices;
44+
QHash<QString, StatusNotifierButton*> m_services;
2645
};
2746

2847
#endif // STATUSNOTIFIERWIDGET_H

0 commit comments

Comments
 (0)