diff src/settingsdialog.cpp @ 472:2d57b81671de

Open the settings dialog at Paths tab when invoking it because of a failure to run hg
author Chris Cannam
date Thu, 14 Jul 2011 13:56:20 +0100
parents 46ef2f03273c
children 7e8688784980
line wrap: on
line diff
--- a/src/settingsdialog.cpp	Thu Jul 14 13:31:07 2011 +0100
+++ b/src/settingsdialog.cpp	Thu Jul 14 13:56:20 2011 +0100
@@ -41,15 +41,15 @@
     QGridLayout *mainLayout = new QGridLayout;
     setLayout(mainLayout);
 
-    QTabWidget *tw = new QTabWidget;
-    mainLayout->addWidget(tw, 0, 0);
+    m_tabs = new QTabWidget;
+    mainLayout->addWidget(m_tabs, 0, 0);
 
 
 //    QGroupBox *meBox = new QGroupBox(tr("User details"));
 //    mainLayout->addWidget(meBox, 0, 0);
 
     QWidget *meBox = new QWidget;
-    tw->addTab(meBox, tr("User details"));
+    m_tabs->addTab(meBox, tr("User details"));
 
     QGridLayout *meLayout = new QGridLayout;
     meBox->setLayout(meLayout);
@@ -73,7 +73,7 @@
 //    mainLayout->addWidget(lookBox, 1, 0);
     
     QWidget *lookBox = new QWidget;
-    tw->addTab(lookBox, tr("Presentation"));
+    m_tabs->addTab(lookBox, tr("Presentation"));
 
     QGridLayout *lookLayout = new QGridLayout;
     lookBox->setLayout(lookLayout);
@@ -106,7 +106,7 @@
     
 
     QWidget *pathsBox = new QWidget;
-    tw->addTab(pathsBox, tr("System application locations"));
+    m_tabs->addTab(pathsBox, tr("System application locations"));
 
 //    QGroupBox *pathsBox = new QGroupBox(tr("System application locations"));
 //    mainLayout->addWidget(pathsBox, 2, 0);
@@ -188,6 +188,16 @@
 }
 
 void
+SettingsDialog::setCurrentTab(Tab t)
+{
+    switch (t) {
+    case PersonalDetailsTab: m_tabs->setCurrentIndex(0); break;
+    case PresentationTab: m_tabs->setCurrentIndex(1); break;
+    case PathsTab: m_tabs->setCurrentIndex(2); break;
+    }
+}
+
+void
 SettingsDialog::hgPathBrowse()
 {
     browseFor(tr("Mercurial program"), m_hgPathLabel);