summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Slimber/Qt/QtMenulet.h')
-rw-r--r--Slimber/Qt/QtMenulet.h110
1 files changed, 55 insertions, 55 deletions
diff --git a/Slimber/Qt/QtMenulet.h b/Slimber/Qt/QtMenulet.h
index d6a7a4d..fa17d21 100644
--- a/Slimber/Qt/QtMenulet.h
+++ b/Slimber/Qt/QtMenulet.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010 Isode Limited.
+ * Copyright (c) 2010-2016 Isode Limited.
* All rights reserved.
* See the COPYING file for more information.
*/
@@ -8,75 +8,75 @@
#include <QCoreApplication>
#include <QMenu>
-#include <QString>
-#include <QSystemTrayIcon>
#include <QObject>
#include <QPixmap>
#include <QPointer>
+#include <QString>
+#include <QSystemTrayIcon>
-#include "Slimber/Menulet.h"
-#include "Slimber/Qt/QtAboutDialog.h"
+#include <Slimber/Menulet.h>
+#include <Slimber/Qt/QtAboutDialog.h>
class QtMenulet : public QObject, public Menulet {
- Q_OBJECT
- public:
- QtMenulet() {
- trayIcon.setIcon(QPixmap(":/icons/UsersOffline.png"));
- trayIcon.setContextMenu(&menu);
- trayIcon.show();
- }
+ Q_OBJECT
+ public:
+ QtMenulet() {
+ trayIcon.setIcon(QPixmap(":/icons/UsersOffline.png"));
+ trayIcon.setContextMenu(&menu);
+ trayIcon.show();
+ }
- void clear() {
- menu.clear();
- }
+ void clear() {
+ menu.clear();
+ }
- void addItem(const std::string& name, const std::string& icon) {
- menu.addAction(getIcon(icon), QString::fromUtf8(name.c_str()));
- }
+ void addItem(const std::string& name, const std::string& icon) {
+ menu.addAction(getIcon(icon), QString::fromUtf8(name.c_str()));
+ }
- void addAboutItem() {
- menu.addAction("About", this, SLOT(showAboutDialog()));
- }
+ void addAboutItem() {
+ menu.addAction("About", this, SLOT(showAboutDialog()));
+ }
- void addRestartItem() {
- menu.addAction("Restart", this, SLOT(restart()));
- }
+ void addRestartItem() {
+ menu.addAction("Restart", this, SLOT(restart()));
+ }
- void addExitItem() {
- menu.addAction("Exit", qApp, SLOT(quit()));
- }
+ void addExitItem() {
+ menu.addAction("Exit", qApp, SLOT(quit()));
+ }
- void addSeparator() {
- menu.addSeparator();
- }
+ void addSeparator() {
+ menu.addSeparator();
+ }
- void setIcon(const std::string& icon) {
- trayIcon.setIcon(getIcon(icon));
- }
+ void setIcon(const std::string& icon) {
+ trayIcon.setIcon(getIcon(icon));
+ }
- private:
- QPixmap getIcon(const std::string& name) {
- return QPixmap(":/icons/" + QString::fromUtf8(name.c_str()) + ".png");
- }
+ private:
+ QPixmap getIcon(const std::string& name) {
+ return QPixmap(":/icons/" + QString::fromUtf8(name.c_str()) + ".png");
+ }
- private slots:
- void showAboutDialog() {
- if (aboutDialog) {
- aboutDialog->raise();
- aboutDialog->activateWindow();
- }
- else {
- aboutDialog = new QtAboutDialog();
- aboutDialog->show();
- }
- }
+ private slots:
+ void showAboutDialog() {
+ if (aboutDialog) {
+ aboutDialog->raise();
+ aboutDialog->activateWindow();
+ }
+ else {
+ aboutDialog = new QtAboutDialog();
+ aboutDialog->show();
+ }
+ }
- void restart() {
- onRestartClicked();
- }
+ void restart() {
+ onRestartClicked();
+ }
- private:
- QMenu menu;
- QSystemTrayIcon trayIcon;
- QPointer<QtAboutDialog> aboutDialog;
+ private:
+ QMenu menu;
+ QSystemTrayIcon trayIcon;
+ QPointer<QtAboutDialog> aboutDialog;
};