diff options
author | Alex Borisov <b0ric.alex@gmail.com> | 2012-03-24 00:28:40 +0200 |
---|---|---|
committer | Alex Borisov <b0ric.alex@gmail.com> | 2012-03-24 00:28:40 +0200 |
commit | db10b50c84a4aaf5014e0f164b3f4f79ca222429 (patch) | |
tree | 8d4e05390d478046d9bc602f5bee91e07b6e8170 /client/ProxyClientApp.cpp | |
parent | 05712da90682fed84e2ecf7e3037d8aed29ecf83 (diff) |
FIX: speed calc problem, tray click fix, other
Diffstat (limited to 'client/ProxyClientApp.cpp')
-rw-r--r-- | client/ProxyClientApp.cpp | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/client/ProxyClientApp.cpp b/client/ProxyClientApp.cpp index e111001..c20d232 100644 --- a/client/ProxyClientApp.cpp +++ b/client/ProxyClientApp.cpp @@ -2,7 +2,6 @@ #include <QtGui> #include "client.h" -#include "Dialog.h" #include "Proxifier.h" #include "ProxyClientApp.h" #include "UpdatedConfig.h" @@ -10,7 +9,9 @@ using namespace std; ProxyClientApp::ProxyClientApp(int &argc, char *argv[]): QApplication(argc, argv) -{ +{ + dialog = NULL; + /* initiates UpdatedConfig singleton that start sending configuration requests */ UpdatedConfig *cfg = UpdatedConfig::CurrentConfig(); connect(cfg, SIGNAL(updated()), @@ -73,17 +74,28 @@ ProxyClientApp::ProxyClientApp(int &argc, char *argv[]): QApplication(argc, argv void ProxyClientApp::trayActivated(QSystemTrayIcon::ActivationReason reason) { - if (reason == QSystemTrayIcon::Trigger) + if (reason != QSystemTrayIcon::Trigger) { - showProxyDialog(); - } + return; + } + + if (dialog == NULL) + { + showProxyDialog(); + } + else + { + dialog->reject(); + delete dialog; + dialog = NULL; + } } void ProxyClientApp::showProxyDialog() { - Logger::Trace("Creating proxy dialog.\n"); - ProxyDialog *dialog = new ProxyDialog(); - dialog->show(); + dialog = new ProxyDialog(); + dialog->setAttribute(Qt::WA_DeleteOnClose); + dialog->show(); } void ProxyClientApp::configUpdated() |