diff --git a/.gitignore b/.gitignore index d6d8d0b..2ecfc52 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ /SysTray-X /app/SysTray-X/.qmake.stash /app/SysTray-X/SysTray-X.pro.user.* +/bin +/bin-* diff --git a/app/SysTray-X/SysTray-X.pro b/app/SysTray-X/SysTray-X.pro index 2daff68..8caf52d 100644 --- a/app/SysTray-X/SysTray-X.pro +++ b/app/SysTray-X/SysTray-X.pro @@ -170,7 +170,8 @@ HEADERS += \ FORMS += \ debugwidget.ui \ - preferences.ui + preferences.ui \ + aboutdialog.ui # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin diff --git a/app/SysTray-X/SysTray-X.qrc b/app/SysTray-X/SysTray-X.qrc index 529b922..0be4112 100644 --- a/app/SysTray-X/SysTray-X.qrc +++ b/app/SysTray-X/SysTray-X.qrc @@ -10,5 +10,6 @@ files/icons/window-close.png files/icons/window-restore.png files/icons/mail-unread.png + files/icons/help-about.png diff --git a/app/SysTray-X/aboutdialog.ui b/app/SysTray-X/aboutdialog.ui new file mode 100644 index 0000000..53ca934 --- /dev/null +++ b/app/SysTray-X/aboutdialog.ui @@ -0,0 +1,138 @@ + + + AboutDialog + + + + 0 + 0 + 284 + 186 + + + + About SysTray-X + + + + + + + + SysTray-X Companion App by Ximi1970 + + + + + + + Version: + + + + + + + 0.0.1 + + + + + + + Build: + + + + + + + 0 + + + + + + + Hash: + + + + + + + 0 + + + + + + + Branch: + + + + + + + master + + + + + + + Qt::Horizontal + + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Close + + + + + + + + + buttonBox + accepted() + AboutDialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + AboutDialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/app/SysTray-X/files/icons/help-about.png b/app/SysTray-X/files/icons/help-about.png new file mode 100644 index 0000000..29b62ea Binary files /dev/null and b/app/SysTray-X/files/icons/help-about.png differ diff --git a/app/SysTray-X/preferences.cpp b/app/SysTray-X/preferences.cpp index 5e12263..105bfec 100644 --- a/app/SysTray-X/preferences.cpp +++ b/app/SysTray-X/preferences.cpp @@ -34,6 +34,14 @@ Preferences::Preferences( QObject *parent ) : QObject( parent ) m_poll_interval = 30; m_debug = false; + + m_version_major = QLatin1String( APP_VERSION_MAJOR ); + m_version_minor = QLatin1String( APP_VERSION_MINOR ); + m_version_patch = QLatin1String( APP_VERSION_PATCH ); + + m_version_build = QLatin1String( APP_BUILD ); + m_version_hash = QLatin1String( APP_GITHASH ); + m_version_branch = QLatin1String( APP_GITBRANCH ); } @@ -257,3 +265,39 @@ void Preferences::setDebug( bool state ) emit signalDebugChange(); } } + + +/* + * Get the software version. + */ +QString Preferences::getVersion() const +{ + return m_version_major + "." + m_version_minor + "." + m_version_patch; +} + + +/* + * Get the number of commits. + */ +QString Preferences::getBuild() const +{ + return m_version_build; +} + + +/* + * Get the git hash. + */ +QString Preferences::getHash() const +{ + return m_version_hash; +} + + +/* + * Get the software version. + */ +QString Preferences::getBranch() const +{ + return m_version_branch; +} diff --git a/app/SysTray-X/preferences.h b/app/SysTray-X/preferences.h index d0f09ea..bc3154c 100644 --- a/app/SysTray-X/preferences.h +++ b/app/SysTray-X/preferences.h @@ -163,6 +163,34 @@ class Preferences : public QObject */ void setDebug( bool state ); + /** + * @brief getVersion. Get the software version. + * + * @return The version. + */ + QString getVersion() const; + + /** + * @brief getBuild. Get the git number of commits. + * + * @return The number of commits. + */ + QString getBuild() const; + + /** + * @brief getHash. Get the git hash. + * + * @return The hash. + */ + QString getHash() const; + + /** + * @brief getBuild. Get the git branch. + * + * @return The branch. + */ + QString getBranch() const; + signals: /** @@ -246,6 +274,37 @@ class Preferences : public QObject * @brief m_debug. Display debug window. */ bool m_debug; + + /** + * @brief m_version_major. Major version number. + */ + QString m_version_major; + + /** + * @brief m_version_minor. Minor version number. + */ + QString m_version_minor; + + /** + * @brief m_version_patch. patch version number. + */ + QString m_version_patch; + + /** + * @brief m_version_build. Git commits count. + */ + QString m_version_build; + + /** + * @brief m_version_build. Git hash. + */ + QString m_version_hash; + + /** + * @brief m_version_build. Git branch. + */ + QString m_version_branch; + }; #endif // PREFERENCES_H diff --git a/app/SysTray-X/systrayx.cpp b/app/SysTray-X/systrayx.cpp index cc8dad7..2cc0209 100644 --- a/app/SysTray-X/systrayx.cpp +++ b/app/SysTray-X/systrayx.cpp @@ -157,6 +157,10 @@ void SysTrayX::createActions() m_pref_action->setIcon( QIcon( ":/files/icons/gtk-preferences.png" ) ); connect( m_pref_action, &QAction::triggered, m_pref_dialog, &PreferencesDialog::showNormal ); + m_about_action = new QAction(tr("&About"), this); + m_about_action->setIcon( QIcon( ":/files/icons/gtk-preferences.png" ) ); + connect( m_about_action, &QAction::triggered, this, &SysTrayX::slotAbout ); + m_quit_action = new QAction( tr("&Quit"), this ); m_quit_action->setIcon( QIcon( ":/files/icons/window-close.png" ) ); connect( m_quit_action, &QAction::triggered, this, &SysTrayX::slotShutdown ); @@ -181,6 +185,7 @@ void SysTrayX::createTrayIcon() m_tray_icon_menu->addAction( m_showhide_action ); m_tray_icon_menu->addSeparator(); m_tray_icon_menu->addAction( m_pref_action ); + m_tray_icon_menu->addAction( m_about_action ); m_tray_icon_menu->addSeparator(); m_tray_icon_menu->addAction( m_quit_action ); @@ -236,3 +241,22 @@ void SysTrayX::slotShutdown() */ QCoreApplication::quit(); } + + +/* + * Show the about dialog + */ +void SysTrayX::slotAbout() +{ + Ui::AboutDialog ui; + QDialog dialog; + + ui.setupUi( &dialog ); + + ui.version->setText( m_preferences->getVersion() ); + ui.build->setText( m_preferences->getBuild() ); + ui.hash->setText( m_preferences->getHash() ); + ui.branch->setText( m_preferences->getBranch() ); + + dialog.exec(); +} diff --git a/app/SysTray-X/systrayx.h b/app/SysTray-X/systrayx.h index efbd8d0..79c3823 100644 --- a/app/SysTray-X/systrayx.h +++ b/app/SysTray-X/systrayx.h @@ -5,6 +5,7 @@ * Local includes */ #include "ui_debugwidget.h" +#include "ui_aboutdialog.h" #include "preferences.h" /* @@ -87,6 +88,11 @@ class SysTrayX : public QObject */ void slotShutdown(); + /** + * @brief slotAbout. Hnadle about request from the menu. + */ + void slotAbout(); + private: /** @@ -127,9 +133,10 @@ class SysTrayX : public QObject /** * @brief m_xxxx_action. Pointer to the menu actions. */ - QAction* m_pref_action; - QAction* m_quit_action; QAction* m_showhide_action; + QAction* m_pref_action; + QAction* m_about_action; + QAction* m_quit_action; }; #endif // SYSTRAYX_H diff --git a/webext/background.js b/webext/background.js index 7d8e7c8..2c0968d 100644 --- a/webext/background.js +++ b/webext/background.js @@ -6,7 +6,9 @@ var SysTrayX = { pollInterval: "30" }, - platformInfo: undefined + platformInfo: undefined, + + version: 0 }; SysTrayX.Messaging = { @@ -357,6 +359,10 @@ async function start() { console.log("Arch: " + SysTrayX.platformInfo.arch); console.log("Nack-Arch: " + SysTrayX.platformInfo.nacl_arch); + // Get addon version + SysTrayX.version = browser.runtime.getManifest().version; + console.log("Addon version: "+SysTrayX.version); + // Init defaults before everything await getDefaultIcon();