diff options
-rw-r--r-- | mainwindow.cpp | 40 | ||||
-rw-r--r-- | mainwindow.h | 2 | ||||
-rw-r--r-- | mainwindow.ui | 2 |
3 files changed, 29 insertions, 15 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")); |
diff --git a/mainwindow.h b/mainwindow.h index 916f95b..c238fe5 100644 --- a/mainwindow.h +++ b/mainwindow.h | |||
@@ -62,7 +62,7 @@ private slots: | |||
62 | void exitApplication(); | 62 | void exitApplication(); |
63 | //void stateChanged(QNetworkSession::State); | 63 | //void stateChanged(QNetworkSession::State); |
64 | //void onlineStateChanged(bool); | 64 | //void onlineStateChanged(bool); |
65 | void onNetworkConfigurationChanged(); | 65 | //void onNetworkConfigurationChanged(); |
66 | }; | 66 | }; |
67 | 67 | ||
68 | #endif // MAINWINDOW_H | 68 | #endif // MAINWINDOW_H |
diff --git a/mainwindow.ui b/mainwindow.ui index be54347..f280ce2 100644 --- a/mainwindow.ui +++ b/mainwindow.ui | |||
@@ -443,7 +443,7 @@ | |||
443 | <sender>actionUpdate_Status</sender> | 443 | <sender>actionUpdate_Status</sender> |
444 | <signal>triggered()</signal> | 444 | <signal>triggered()</signal> |
445 | <receiver>MainWindow</receiver> | 445 | <receiver>MainWindow</receiver> |
446 | <slot>updateSpaceList()</slot> | 446 | <slot>updateStatus()</slot> |
447 | <hints> | 447 | <hints> |
448 | <hint type="sourcelabel"> | 448 | <hint type="sourcelabel"> |
449 | <x>-1</x> | 449 | <x>-1</x> |