aboutsummaryrefslogtreecommitdiff
path: root/dev-tools/systray-tester/Trayapp.h
diff options
context:
space:
mode:
Diffstat (limited to 'dev-tools/systray-tester/Trayapp.h')
-rw-r--r--dev-tools/systray-tester/Trayapp.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/dev-tools/systray-tester/Trayapp.h b/dev-tools/systray-tester/Trayapp.h
new file mode 100644
index 00000000..54fa8a6b
--- /dev/null
+++ b/dev-tools/systray-tester/Trayapp.h
@@ -0,0 +1,49 @@
+// QT Includes
+#include <QApplication>
+#include <QSystemTrayIcon>
+#include <QMenu>
+#include <QTimer>
+
+#include <LuminaXDG.h>
+
+class TrayApp : public QSystemTrayIcon {
+ Q_OBJECT
+
+private:
+ QTimer *timer;
+ int iconnum;
+
+private slots:
+ void ChangeIcon(){
+ this->setToolTip("Icon Number:"+QString::number(iconnum));
+ QString ico;
+ //Rotate the icon every time
+ if(iconnum <=0){ ico = "arrow-left"; iconnum=1; }
+ else if(iconnum==1){ ico = "arrow-up"; iconnum=2; }
+ else if(iconnum==2){ ico = "arrow-right"; iconnum=3; }
+ else{ico = "arrow-down"; iconnum=0; }
+ this->setIcon( LXDG::findIcon(ico,"") );
+ }
+
+ void StopTest(){
+ QApplication::exit(0);
+ }
+
+public:
+ TrayApp() : QSystemTrayIcon(){
+ iconnum = 0;
+ this->setContextMenu(new QMenu());
+ this->contextMenu()->addAction("Stop Test", this, SLOT(StopTest()) );
+ timer = new QTimer(this);
+ timer->setInterval(3000); //change every 3 seconds
+ connect(timer, SIGNAL(timeout()), this, SLOT(ChangeIcon()) );
+ ChangeIcon(); //get it updated now
+ timer->start();
+ }
+ virtual ~TrayApp(){}
+
+
+
+
+
+};
bgstack15