Fixed layout hierarchy
[irwi] / src / settingsdlg.cpp
index e92586a..c721f49 100644 (file)
@@ -16,8 +16,8 @@ SettingsDlg::SettingsDlg(QWidget *parent)
 {
     QSettings settings(this);
     m_layout = new QVBoxLayout(this);
-    m_btnLayout = new QHBoxLayout(this);
-    m_remoteNameLayout = new QHBoxLayout(this);
+    m_btnLayout = new QHBoxLayout(m_layout);
+    m_remoteNameLayout = new QHBoxLayout(m_layout);
     
     m_advSettingsBtn = new QPushButton(tr("Advanced"), this);
     m_selectRemoteBtn = new QPushButton(tr("Select remote"), this);
@@ -57,8 +57,6 @@ SettingsDlg::SettingsDlg(QWidget *parent)
     connect(m_rateDownBtn, SIGNAL(clicked()),
             this, SLOT(rateDownClicked()));
  
-    m_layout->addLayout(m_remoteNameLayout);
-    m_layout->addLayout(m_btnLayout);
     this->setLayout(m_layout);
 
     QString selectedRemote = QSettings(this).value("remoteName", "").toString();
@@ -68,6 +66,7 @@ SettingsDlg::SettingsDlg(QWidget *parent)
     } else {
         setRemote(selectedRemote);
         m_remote.updateInfo();
+        setBusy();
     }
 }
 
@@ -85,6 +84,12 @@ SettingsDlg::~SettingsDlg()
     delete m_layout;
 }
 
+void SettingsDlg::setBusy(bool busy)
+{
+    setAttribute(Qt::WA_Maemo5ShowProgressIndicator, busy);
+    setEnabled(!busy);
+}
+
 void SettingsDlg::showAdvSettingsDlg()
 {
     AdvSettingsDlg dlg(this);
@@ -114,6 +119,7 @@ void SettingsDlg::setRemote(Remote r)
 
 void SettingsDlg::setRemote(const QString &name)
 {
+    setBusy();
     m_remote = Remote(name);
     processRemoteChange();
     m_remote.updateInfo();  // request update from server
@@ -128,6 +134,7 @@ void SettingsDlg::processRemoteChange()
 
 void SettingsDlg::updateRemoteInfo()
 {
+    setBusy(false);
     m_remoteNameLabel->setText(m_remote.mfg() + " " + m_remote.name());
     m_ratingLabel->setText(tr("Rating") + ": "
             + QString::number(m_remote.rating()));