From 8442c89f16bb187aac68f725b2ac7562ef470aa5 Mon Sep 17 00:00:00 2001 From: Matt Thompson Date: Wed, 22 Apr 2009 15:21:42 -0500 Subject: [PATCH] Added Qt4 support to CMake, along with an icon and a test --- CMakeLists.txt | 3 +++ images/tray.png | Bin 0 -> 3872 bytes src/ecoboard/CMakeLists.txt | 7 +++++-- src/ecoboard/application.cpp | 36 ++++++++++++++++++++++++++++++++++++ src/ecoboard/application.h | 27 +++++++++++++++++++++++++++ src/ecoboard/ebresources.qrc | 5 +++++ src/ecoboard/main.cpp | 7 +++++++ src/ecoboard/{test.c => test.c.bak} | 0 8 files changed, 83 insertions(+), 2 deletions(-) create mode 100644 images/tray.png create mode 100644 src/ecoboard/application.cpp create mode 100644 src/ecoboard/application.h create mode 100644 src/ecoboard/ebresources.qrc create mode 100644 src/ecoboard/main.cpp rename src/ecoboard/{test.c => test.c.bak} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index ae2787d..b3ad402 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,9 @@ set(CMAKE_MODULE_PATH find_package(OpenCV REQUIRED) find_package(Qt4 REQUIRED) +#set(QT_USE_QTSCRIPT 1) +include(${QT_USE_FILE}) + include_directories(${OPENCV_INCLUDE_DIR}) add_subdirectory(src) diff --git a/images/tray.png b/images/tray.png new file mode 100644 index 0000000000000000000000000000000000000000..cbaed280f42894f468cdb860bceb556ea6a6425c GIT binary patch literal 3872 zcwPY@58v>KP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iXJ` z6c98CPNa+g000?uMObu0Z*6U5Zgc=ca%Ew3Wn>_CX>@2HM@dakSAh-}000hqNklZrKhAA1P*GkctJv+SD^Z$<i=BUF<(j>nhGOvW>__g?G&&%<7O z@3rR=+vz|-&62j}y7%n=TmR+zF9Td(*Vpy+&%DG}^+N{_9voS{di7Aps*ZK7nbt%y zkr2YNpp=5+I4GA(oX;2B%a<=t&d<;9A08g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+W5?ccTTJu`z79bqnH&1eg^sY62Cz;zml+4FF(f9m8c9|4p7w zVRJLA3@)rZ z!qSKck@N(Rn)C$xUrCSLNYdX4DKkl>E5c#DKcLhNnIOFHvIe0F2&LJf5CUt~tf@Kw z(xpovA~?1^xhMdILVmxwtJI(z#YVG&OseY(PX+~+q_xApSxuXD3p~sZYbMXNMwAEOiS6^Qr zx;J&BQYjagT@{|2of`zWp$Ytb0I-fQMkR?Fhr#8pR4Rpg?zsnd_V@Eh}2k)zyU!8`fjf#%{!7F%T1^RL*aX z{pQRywZ{JI7r*H5ShebXQUq8g>D4m;x&s_^g+|qg= z8LZ#+#@`TasiWSUkj@dz4l#xKJXL`atrKc8q&Vn0IgXPb9UX1I=H{rs_WgPv+qMH? z#Cv}jLNJG0?~ews*+J((aMbA)1X`kd2{ko8vtUx)Oz{&bMPX@8dEXH+3$GkFu&8|T zr2vq-oI8?ArFK9>b3eZx$ReBs3569w3msL2$lrAs#E7cQAu>F{;ZA$t0K`fcM5~)D z9zYAlD@T?h+md_U&p-csmWVrrU;vh91_25+<$$mlimJMRFQ75eVUEX9WYVa%o_g5x-+Rce*dp}xepCqUJm?YnA;EBd!6+T{ zWCwg90O%+{Fib#kFkfua->_2@YJepyKKSavWlg?a)7Zzae)UV&ww-vri?9xh4E9?E zfjIn4dPEQpw6twsc3 z<4rPNN1R<1L)3)JSy))u{`%{$e|`QiVXmJI|ExciN}ggNGESvZ)hzWLV-y6^qn;Fm zN003IV8!EcNY^cvE0w|H$B%zK|1wi=4G#~GB@&6dm^fasE0JUfT-7r${w+exNF)*< zB5B)|_l_QY?VIzbsYYvPXlTT;tRX9AtrHLlCK6I9Ftayq53nNTN>@%w*WG{Q=+V8n izOJw9>-zeV*Z%`0%n`@hrdO5#0000 +#include +#include + +EBApplication::EBApplication(int &argc, char **argv) + : QApplication(argc, argv) +{ + createWidgets(); + createActions(); + createMenus(); + systemTray->show(); +} + +void EBApplication::createActions() +{ + exitAct = new QAction(tr("&Quit"), this); + exitAct->setShortcuts(QKeySequence::New); + exitAct->setStatusTip(tr("Quit EconoBoard")); + connect(exitAct, SIGNAL(triggered()), this, SLOT(quit())); +} + +void EBApplication::createMenus() +{ + trayMenu = new QMenu(); + systemTray->setContextMenu(trayMenu); + + trayMenu->addAction(exitAct); +} + +void EBApplication::createWidgets() +{ + systemTray = new QSystemTrayIcon(QIcon(":tray-img.png")); +} + diff --git a/src/ecoboard/application.h b/src/ecoboard/application.h new file mode 100644 index 0000000..8040cdd --- /dev/null +++ b/src/ecoboard/application.h @@ -0,0 +1,27 @@ +#ifndef MAINWINDOW_H__ +#define MAINWINDOW_H__ + +#include + +class QSystemTrayIcon; +class QMenu; +class QAction; + +class EBApplication : public QApplication +{ + Q_OBJECT + +public: + EBApplication(int &argc, char **argv); + +private: + void createActions(); + void createMenus(); + void createWidgets(); + + QSystemTrayIcon *systemTray; + QMenu *trayMenu; + QAction *exitAct; +}; + +#endif diff --git a/src/ecoboard/ebresources.qrc b/src/ecoboard/ebresources.qrc new file mode 100644 index 0000000..1b7ce18 --- /dev/null +++ b/src/ecoboard/ebresources.qrc @@ -0,0 +1,5 @@ + + +../../images/tray.png + + diff --git a/src/ecoboard/main.cpp b/src/ecoboard/main.cpp new file mode 100644 index 0000000..b928150 --- /dev/null +++ b/src/ecoboard/main.cpp @@ -0,0 +1,7 @@ +#include "application.h" + +int main(int argc, char **argv) +{ + EBApplication app(argc, argv); + return app.exec(); +} diff --git a/src/ecoboard/test.c b/src/ecoboard/test.c.bak similarity index 100% rename from src/ecoboard/test.c rename to src/ecoboard/test.c.bak -- 2.11.4.GIT