# HG changeset patch # User Chris Cannam # Date 1313593744 -3600 # Node ID 896b7903e8f25f1bd715cbef58811c28855f7335 # Parent a582c6417004c63bbea82c295893480f3bd45b37 Make "Show all files" persistent (fixing #203), and rationalise some config group names (noting that "General" is actually the default group "" as it appears in the config file, not the name of a group called "General": that appears as "%General") diff -r a582c6417004 -r 896b7903e8f2 src/filestatuswidget.cpp --- a/src/filestatuswidget.cpp Wed Aug 17 15:53:17 2011 +0100 +++ b/src/filestatuswidget.cpp Wed Aug 17 16:09:04 2011 +0100 @@ -157,15 +157,27 @@ m_showAllFiles = new QCheckBox(tr("Show all files"), this); m_showAllFiles->setEnabled(false); layout->addWidget(m_showAllFiles, ++row, 0, Qt::AlignLeft); + + QSettings settings; + m_showAllFiles->setChecked(settings.value("showall", false).toBool()); + connect(m_showAllFiles, SIGNAL(toggled(bool)), - this, SIGNAL(showAllChanged(bool))); + this, SIGNAL(showAllChanged())); } FileStatusWidget::~FileStatusWidget() { + QSettings settings; + settings.setValue("showall", m_showAllFiles->isChecked()); + delete m_dateReference; } +bool FileStatusWidget::shouldShowAll() const +{ + return m_showAllFiles->isChecked(); +} + QString FileStatusWidget::labelFor(FileStates::State s, bool addHighlightExplanation) { QSettings settings; diff -r a582c6417004 -r 896b7903e8f2 src/filestatuswidget.h --- a/src/filestatuswidget.h Wed Aug 17 15:53:17 2011 +0100 +++ b/src/filestatuswidget.h Wed Aug 17 16:09:04 2011 +0100 @@ -54,9 +54,11 @@ QStringList getSelectedAddableFiles() const; QStringList getSelectedRemovableFiles() const; + bool shouldShowAll() const; + signals: void selectionChanged(); - void showAllChanged(bool); + void showAllChanged(); void annotateFiles(QStringList); void diffFiles(QStringList); diff -r a582c6417004 -r 896b7903e8f2 src/hgrunner.cpp --- a/src/hgrunner.cpp Wed Aug 17 15:53:17 2011 +0100 +++ b/src/hgrunner.cpp Wed Aug 17 16:09:04 2011 +0100 @@ -499,9 +499,6 @@ return; } - QSettings settings; - settings.beginGroup("General"); - if (executable == "") { // This is a Hg command executable = getHgBinaryName(); @@ -516,6 +513,7 @@ if (action.mayBeInteractive()) { params.push_front("ui.interactive=true"); params.push_front("--config"); + QSettings settings; if (settings.value("useextension", true).toBool()) { params = addExtensionOptions(params); } diff -r a582c6417004 -r 896b7903e8f2 src/hgtabwidget.cpp --- a/src/hgtabwidget.cpp Wed Aug 17 15:53:17 2011 +0100 +++ b/src/hgtabwidget.cpp Wed Aug 17 16:09:04 2011 +0100 @@ -37,8 +37,8 @@ connect(m_fileStatusWidget, SIGNAL(selectionChanged()), this, SIGNAL(selectionChanged())); - connect(m_fileStatusWidget, SIGNAL(showAllChanged(bool)), - this, SIGNAL(showAllChanged(bool))); + connect(m_fileStatusWidget, SIGNAL(showAllChanged()), + this, SIGNAL(showAllChanged())); connect(m_fileStatusWidget, SIGNAL(annotateFiles(QStringList)), this, SIGNAL(annotateFiles(QStringList))); @@ -268,3 +268,8 @@ setCurrentWidget(m_historyWidget); } +bool HgTabWidget::shouldShowAll() const +{ + return m_fileStatusWidget->shouldShowAll(); +} + diff -r a582c6417004 -r 896b7903e8f2 src/hgtabwidget.h --- a/src/hgtabwidget.h Wed Aug 17 15:53:17 2011 +0100 +++ b/src/hgtabwidget.h Wed Aug 17 16:09:04 2011 +0100 @@ -70,9 +70,11 @@ QStringList getSelectedAddableFiles() const; QStringList getSelectedRemovableFiles() const; + bool shouldShowAll() const; + signals: void selectionChanged(); - void showAllChanged(bool); + void showAllChanged(); void commit(); void revert(); diff -r a582c6417004 -r 896b7903e8f2 src/mainwindow.cpp --- a/src/mainwindow.cpp Wed Aug 17 15:53:17 2011 +0100 +++ b/src/mainwindow.cpp Wed Aug 17 16:09:04 2011 +0100 @@ -111,8 +111,8 @@ connect(m_hgTabs, SIGNAL(selectionChanged()), this, SLOT(enableDisableActions())); - connect(m_hgTabs, SIGNAL(showAllChanged(bool)), - this, SLOT(showAllChanged(bool))); + connect(m_hgTabs, SIGNAL(showAllChanged()), + this, SLOT(showAllChanged())); setUnifiedTitleAndToolBarOnMac(true); connectActions(); @@ -206,9 +206,8 @@ m_hgTabs->clearSelections(); } -void MainWindow::showAllChanged(bool s) +void MainWindow::showAllChanged() { - m_showAllFiles = s; hgQueryPaths(); } @@ -257,6 +256,8 @@ void MainWindow::hgQueryPaths() { + m_showAllFiles = m_hgTabs->shouldShowAll(); + // Quickest is to just read the file QFileInfo hgrc(m_workFolderPath + "/.hg/hgrc"); @@ -1334,7 +1335,7 @@ MultiChoiceDialog::DirectoryArg); QSettings settings; - settings.beginGroup("General"); + settings.beginGroup(""); QString lastChoice = settings.value("lastopentype", "remote").toString(); if (lastChoice != "local" && lastChoice != "remote" && @@ -2445,7 +2446,6 @@ case ACT_TEST_HG: { QSettings settings; - settings.beginGroup("General"); if (settings.value("useextension", true).toBool()) { hgTestExtension(); } else if (m_workFolderPath == "") { diff -r a582c6417004 -r 896b7903e8f2 src/mainwindow.h --- a/src/mainwindow.h Wed Aug 17 15:53:17 2011 +0100 +++ b/src/mainwindow.h Wed Aug 17 16:09:04 2011 +0100 @@ -65,7 +65,7 @@ void changeRemoteRepo(bool initial); void startupDialog(); void clearSelections(); - void showAllChanged(bool); + void showAllChanged(); void hgTest(); void hgTestExtension(); diff -r a582c6417004 -r 896b7903e8f2 src/settingsdialog.cpp --- a/src/settingsdialog.cpp Wed Aug 17 15:53:17 2011 +0100 +++ b/src/settingsdialog.cpp Wed Aug 17 16:09:04 2011 +0100 @@ -410,7 +410,7 @@ settings.remove("sshbinary"); settings.remove("extensionpath"); settings.endGroup(); - settings.beginGroup("General"); + settings.beginGroup(""); settings.remove("useextension"); settings.endGroup(); } @@ -439,7 +439,7 @@ m_sshPathLabel->setText(settings.value("sshbinary").toString()); m_extensionPathLabel->setText(settings.value("extensionpath").toString()); settings.endGroup(); - settings.beginGroup("General"); + settings.beginGroup(""); m_useExtension->setChecked(settings.value("useextension", true).toBool()); settings.endGroup(); } @@ -486,7 +486,7 @@ settings.setValue("sshbinary", m_sshPathLabel->text()); settings.setValue("extensionpath", m_extensionPathLabel->text()); settings.endGroup(); - settings.beginGroup("General"); + settings.beginGroup(""); settings.setValue("useextension", m_useExtension->isChecked()); settings.endGroup(); QDialog::accept();