# HG changeset patch
# User Chris Cannam
# Date 1310648180 -3600
# Node ID 2d57b81671dea39140e91e464fa469fe907d079a
# Parent 8a10d3c396e82efbec66faea0abf95c9dcb96695
Open the settings dialog at Paths tab when invoking it because of a failure to run hg
diff -r 8a10d3c396e8 -r 2d57b81671de src/mainwindow.cpp
--- a/src/mainwindow.cpp Thu Jul 14 13:31:07 2011 +0100
+++ b/src/mainwindow.cpp Thu Jul 14 13:56:20 2011 +0100
@@ -1718,7 +1718,13 @@
void MainWindow::settings()
{
+ settings(SettingsDialog::PersonalDetailsTab);
+}
+
+void MainWindow::settings(SettingsDialog::Tab tab)
+{
SettingsDialog *settingsDlg = new SettingsDialog(this);
+ settingsDlg->setCurrentTab(tab);
settingsDlg->exec();
if (settingsDlg->presentationChanged()) {
@@ -2038,7 +2044,7 @@
tr("Failed to run Mercurial"),
tr("The Mercurial program either could not be found or failed to run.
Check that the Mercurial program path is correct in %1.").arg(setstr),
output);
- settings();
+ settings(SettingsDialog::PathsTab);
return;
case ACT_TEST_HG_EXT:
MoreInformationDialog::warning
@@ -2047,7 +2053,7 @@
tr("Failed to run Mercurial with extension enabled"),
tr("The Mercurial program failed to run with the EasyMercurial interaction extension enabled.
This may indicate an installation problem.
You may be able to continue working if you switch off “Use EasyHg Mercurial Extension” in %1. Note that remote repositories that require authentication might not work if you do this.").arg(setstr),
output);
- settings();
+ settings(SettingsDialog::PathsTab);
return;
case ACT_CLONEFROMREMOTE:
// if clone fails, we have no repo
diff -r 8a10d3c396e8 -r 2d57b81671de src/mainwindow.h
--- a/src/mainwindow.h Thu Jul 14 13:31:07 2011 +0100
+++ b/src/mainwindow.h Thu Jul 14 13:56:20 2011 +0100
@@ -23,6 +23,7 @@
#include "common.h"
#include "changeset.h"
#include "hgaction.h"
+#include "settingsdialog.h"
#include
#include
@@ -57,6 +58,7 @@
private slots:
void about();
void settings();
+ void settings(SettingsDialog::Tab);
void open();
void recentMenuActivated();
void changeRemoteRepo();
diff -r 8a10d3c396e8 -r 2d57b81671de src/settingsdialog.cpp
--- 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);
diff -r 8a10d3c396e8 -r 2d57b81671de src/settingsdialog.h
--- a/src/settingsdialog.h Thu Jul 14 13:31:07 2011 +0100
+++ b/src/settingsdialog.h Thu Jul 14 13:56:20 2011 +0100
@@ -24,14 +24,23 @@
#include
#include
#include
+#include
class SettingsDialog : public QDialog
{
Q_OBJECT
public:
+ enum Tab {
+ PersonalDetailsTab,
+ PresentationTab,
+ PathsTab
+ };
+
SettingsDialog(QWidget *parent = 0);
+ void setCurrentTab(Tab tab);
+
bool presentationChanged() {
return m_presentationChanged;
}
@@ -53,6 +62,8 @@
void restoreDefaults();
private:
+ QTabWidget *m_tabs;
+
QLineEdit *m_nameEdit;
QLineEdit *m_emailEdit;
QLineEdit *m_hgPathLabel;