From: Jari Jarvi Date: Tue, 6 Jul 2010 09:57:52 +0000 (+0300) Subject: Progress indicator is now visible right after SettingsDlg is opened X-Git-Url: https://vcs.maemo.org/git/?p=irwi;a=commitdiff_plain;h=80db15f5916dd18a7d08c3814c75205e226b59fb Progress indicator is now visible right after SettingsDlg is opened --- diff --git a/src/settingsdlg.cpp b/src/settingsdlg.cpp index 8755529..6100100 100644 --- a/src/settingsdlg.cpp +++ b/src/settingsdlg.cpp @@ -11,9 +11,11 @@ #include #include #include +#include SettingsDlg::SettingsDlg(QWidget *parent) : QDialog(parent) + , m_busy(true) { QSettings settings(this); m_layout = new QVBoxLayout(this); @@ -70,6 +72,8 @@ SettingsDlg::SettingsDlg(QWidget *parent) // Create remote by name and update it's info if online m_remote = Remote(selectedRemote); m_remoteNameLabel->setText(selectedRemote); + connect(&m_remote, SIGNAL(infoUpdated()), + this, SLOT(updateRemoteInfo())); m_netConfMan = new QTM_PREPEND_NAMESPACE( QNetworkConfigurationManager)(this); connect(m_netConfMan, SIGNAL(updateCompleted()), @@ -97,7 +101,7 @@ SettingsDlg::~SettingsDlg() void SettingsDlg::setBusy(bool busy) { setAttribute(Qt::WA_Maemo5ShowProgressIndicator, busy); - setEnabled(!busy); + m_busy = busy; } void SettingsDlg::showAdvSettingsDlg() @@ -124,6 +128,8 @@ void SettingsDlg::showAboutDlg() void SettingsDlg::setRemote(Remote r) { m_remote = r; + connect(&m_remote, SIGNAL(infoUpdated()), + this, SLOT(updateRemoteInfo())); updateRemoteInfo(); enableRateBtns(); } @@ -131,13 +137,11 @@ void SettingsDlg::setRemote(Remote r) void SettingsDlg::onNetworkStatusUpdate() { if (m_netConfMan->isOnline()) { - setBusy(); - connect(&m_remote, SIGNAL(infoUpdated()), - this, SLOT(updateRemoteInfo())); m_remote.updateInfo(); enableRateBtns(); } else { m_ratingLabel->setText(tr("Offline")); + setBusy(false); } } @@ -163,6 +167,7 @@ void SettingsDlg::rateDownClicked() void SettingsDlg::processRatingSent() { + setBusy(); enableRateBtns(false); m_remote.updateInfo(); } @@ -173,4 +178,11 @@ void SettingsDlg::enableRateBtns(bool enable) m_rateDownBtn->setEnabled(enable); } +void SettingsDlg::showEvent(QShowEvent *event) +{ + setBusy(m_busy); + QDialog::showEvent(event); +} + + diff --git a/src/settingsdlg.h b/src/settingsdlg.h index 78c72f6..09cda7a 100644 --- a/src/settingsdlg.h +++ b/src/settingsdlg.h @@ -20,6 +20,7 @@ class SettingsDlg : public QDialog public: SettingsDlg(QWidget *parent = 0); ~SettingsDlg(); + void showEvent(class QShowEvent *); private slots: void showAdvSettingsDlg(); @@ -37,6 +38,7 @@ private: void setBusy(bool busy = true); private: + bool m_busy; Remote m_remote; QVBoxLayout *m_layout;