changeset 628:5dc24f89b791

* "Use extension" check box now appears to the left of the button and label, and enables/disables the button and label depending on its state
author Sam Izzo <sam@humbug.net>
date Sun, 26 Aug 2012 02:39:08 +1000
parents d39d236a0ce8
children 080258d897db
files src/settingsdialog.cpp src/settingsdialog.h
diffstat 2 files changed, 17 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/settingsdialog.cpp	Sun Aug 26 02:38:24 2012 +1000
+++ b/src/settingsdialog.cpp	Sun Aug 26 02:39:08 2012 +1000
@@ -157,18 +157,17 @@
     pathsLayout->addWidget(browse, row++, 1);
     connect(browse, SIGNAL(clicked()), this, SLOT(sshPathBrowse()));
 
-    pathsLayout->addWidget(new QLabel(tr("EasyHg Mercurial extension:")), row, 0);
+    //!!! more info plz
+    m_useExtension = new QCheckBox(tr("Use EasyHg Mercurial extension"));
+    pathsLayout->addWidget(m_useExtension, row, 0);
+    connect(m_useExtension, SIGNAL(stateChanged(int)), this, SLOT(useExtension(int)));
 
     m_extensionPathLabel = new QLineEdit();
     pathsLayout->addWidget(m_extensionPathLabel, row, 2);
 
-    browse = new QPushButton(tr("Browse..."));
-    pathsLayout->addWidget(browse, row++, 1);
-    connect(browse, SIGNAL(clicked()), this, SLOT(extensionPathBrowse()));
-
-    //!!! more info plz
-    m_useExtension = new QCheckBox(tr("Use EasyHg Mercurial extension"));
-    pathsLayout->addWidget(m_useExtension, row++, 2);
+    m_extensionBrowse = new QPushButton(tr("Browse..."));
+    pathsLayout->addWidget(m_extensionBrowse, row++, 1);
+    connect(m_extensionBrowse, SIGNAL(clicked()), this, SLOT(extensionPathBrowse()));
 
     pathsLayout->setRowStretch(row, 20);
 
@@ -225,6 +224,13 @@
 }
 
 void
+SettingsDialog::useExtension(int)
+{
+    m_extensionPathLabel->setEnabled(m_useExtension->isChecked());
+    m_extensionBrowse->setEnabled(m_useExtension->isChecked());
+}
+
+void
 SettingsDialog::browseFor(QString title, QLineEdit *edit)
 {
     QString origin = edit->text();
@@ -448,6 +454,7 @@
     settings.endGroup();
     settings.beginGroup("");
     m_useExtension->setChecked(settings.value("useextension", true).toBool());
+    useExtension(m_useExtension->isChecked());
     settings.endGroup();
 }
 
--- a/src/settingsdialog.h	Sun Aug 26 02:38:24 2012 +1000
+++ b/src/settingsdialog.h	Sun Aug 26 02:39:08 2012 +1000
@@ -55,6 +55,7 @@
     void mergePathBrowse();
     void sshPathBrowse();
     void extensionPathBrowse();
+    void useExtension(int);
 
     void accept();
     void reset();
@@ -84,6 +85,7 @@
     QComboBox *m_workHistoryArrangement;
 #endif
 
+    QPushButton *m_extensionBrowse;
     QPushButton *m_ok;
 
     bool m_presentationChanged;