diff options
author | Max Christian Pohle | 2015-12-06 19:11:35 +0100 |
---|---|---|
committer | Max Christian Pohle | 2015-12-06 19:11:35 +0100 |
commit | 42e703bf9876432056a556fc0dbc1c3f5ac01976 (patch) | |
tree | 9c25d673cd9f4e2d2a759e61ccbb4b3348e3efbd /mainwindow.cpp | |
parent | 950bf7952bd31c64fb0e5536daec4c6881276d74 (diff) | |
download | qspacestatus-42e703bf9876432056a556fc0dbc1c3f5ac01976.tar.bz2 qspacestatus-42e703bf9876432056a556fc0dbc1c3f5ac01976.zip |
version 1.0 release candidate
successfully tested for about one week.
Diffstat (limited to 'mainwindow.cpp')
-rw-r--r-- | mainwindow.cpp | 40 |
1 files changed, 27 insertions, 13 deletions
diff --git a/mainwindow.cpp b/mainwindow.cpp index b27876c..812efeb 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp | |||
@@ -1,21 +1,11 @@ | |||
1 | #include "mainwindow.h" | 1 | #include "mainwindow.h" |
2 | #include "ui_mainwindow.h" | 2 | #include "ui_mainwindow.h" |
3 | #include <QDebug> | 3 | #include <QDebug> |
4 | 4 | /* | |
5 | void MainWindow::onNetworkConfigurationChanged() | 5 | void MainWindow::onNetworkConfigurationChanged() |
6 | { | 6 | { |
7 | qDebug() << "configuration changed\n"; | ||
8 | if(this->mgr->isOnline()) | ||
9 | { | ||
10 | if(this->ui->comboBox->count() == 0) | ||
11 | { | ||
12 | this->updateSpaceList(); | ||
13 | this->updateStatus(); | ||
14 | } | ||
15 | else | ||
16 | this->updateStatus(); | ||
17 | } | ||
18 | } | 7 | } |
8 | */ | ||
19 | 9 | ||
20 | MainWindow::MainWindow(QWidget *parent) : | 10 | MainWindow::MainWindow(QWidget *parent) : |
21 | QMainWindow(parent), | 11 | QMainWindow(parent), |
@@ -36,7 +26,7 @@ MainWindow::MainWindow(QWidget *parent) : | |||
36 | 26 | ||
37 | 27 | ||
38 | this->timer = new QTimer(); | 28 | this->timer = new QTimer(); |
39 | this->connect(this->timer, SIGNAL(timeout()), this, SLOT(updateSpaceList())); | 29 | this->connect(this->timer, SIGNAL(timeout()), this, SLOT(updateStatus())); |
40 | // update every five minutes... | 30 | // update every five minutes... |
41 | this->timer->start(60000 * 5); | 31 | this->timer->start(60000 * 5); |
42 | 32 | ||
@@ -44,14 +34,38 @@ MainWindow::MainWindow(QWidget *parent) : | |||
44 | //this->currentIcon = new QIcon(this->pixmap); | 34 | //this->currentIcon = new QIcon(this->pixmap); |
45 | 35 | ||
46 | this->mgr = new QNetworkConfigurationManager(); | 36 | this->mgr = new QNetworkConfigurationManager(); |
37 | /* | ||
38 | connect(this->mgr, | ||
39 | SIGNAL(configurationChanged(const QNetworkConfiguration &)), | ||
40 | this, | ||
41 | SLOT(onNetworkConfigurationChanged())); | ||
42 | */ | ||
43 | /* | ||
47 | connect(this->mgr, | 44 | connect(this->mgr, |
48 | SIGNAL(configurationChanged(const QNetworkConfiguration &)), | 45 | SIGNAL(configurationChanged(const QNetworkConfiguration &)), |
49 | this, | 46 | this, |
50 | SLOT(onNetworkConfigurationChanged())); | 47 | SLOT(onNetworkConfigurationChanged())); |
48 | */ | ||
49 | connect(this->mgr, &QNetworkConfigurationManager::configurationChanged, | ||
50 | [=] | ||
51 | { | ||
52 | qDebug() << "configuration changed" << endl; | ||
53 | if(this->mgr->isOnline()) | ||
54 | { | ||
55 | if(this->ui->comboBox->count() == 0) | ||
56 | { | ||
57 | this->updateSpaceList(); | ||
58 | this->updateStatus(); | ||
59 | } | ||
60 | else | ||
61 | this->updateStatus(); | ||
62 | } | ||
63 | }); | ||
51 | 64 | ||
52 | connect(this->mgr, &QNetworkConfigurationManager::onlineStateChanged, | 65 | connect(this->mgr, &QNetworkConfigurationManager::onlineStateChanged, |
53 | [=] (bool b) | 66 | [=] (bool b) |
54 | { | 67 | { |
68 | qDebug() << "QNetworkConfigurationManager::onlineStateChanged\n" << endl; | ||
55 | if(!b) | 69 | if(!b) |
56 | { | 70 | { |
57 | this->qsystemtrayicon->setIcon(QIcon::fromTheme("network-error")); | 71 | this->qsystemtrayicon->setIcon(QIcon::fromTheme("network-error")); |