# # # patch "res/forms/dialogs/preferences.ui" # from [94a7e09291b1d7fc2ff63e3692172ecdfd3cad6e] # to [d8b65e5321100212ac03b88626f578dfb7e94299] # # patch "src/GuitoneCore.cpp" # from [20449663ae437a1183473223ccfcc0a3c112f066] # to [9f73d621d82199126a1b9dfd09065e110feb15f1] # # patch "src/model/ContentDiff.cpp" # from [205b1f9f078f60072838a5e185c57a3c79dcb283] # to [c9c42e727a0830e04651662e865646078faf8d02] # # patch "src/model/Inventory.cpp" # from [c3a8fe3d0b7bcea96d6e55a55f53be17d02d2161] # to [0ec28beef2098f8491fc4d8249cc0ae970d84feb] # # patch "src/monotone/MonotoneProcess.cpp" # from [28c3a9da29b6dbc4fa794f498c3dc0b6b251fa77] # to [3073ca21fabac70475a9b433aa5c56beb3184010] # # patch "src/monotone/MonotoneThread.cpp" # from [407f4b1892b30fcb4df4ea1b973fae7ab472caae] # to [7f66c2e34aece73bbffa63813658990ff23747aa] # # patch "src/util/DebugLog.cpp" # from [9215c1c330de41267441b319df00e63855f5da42] # to [981d710b1ccf620eedbdc682d5f03872b0f8502f] # # patch "src/util/Platform.cpp" # from [60434a883a279fb6ec5992d47271388bc46a0e4e] # to [cc0eeb3a58a73ae489790b8190b4e3e9efaae15a] # # patch "src/util/Settings.cpp" # from [5c48b1c403e955ba1107058f8160440e612132ed] # to [003ba7d2afcc6d924286aefdaa7c3619ef0d66b9] # # patch "src/util/Settings.h" # from [db2003cc3ae29f97afdc46c500c5b4583f2e76e4] # to [cdb32058b97bf73a52fee50a9f1c0a1f411f114e] # # patch "src/view/dialogs/ChangesetBrowser.cpp" # from [bb4313d6d73e7cf525442755c01ec05445958927] # to [1bb25d7f5197f6f159ebd816095e741cb0c4fbf3] # # patch "src/view/dialogs/CommitRevision.cpp" # from [6a1ded9f563047b3a5f57ad350af07255c6a7417] # to [c5f86e5286fb9f0ab1e73f7f38ea0d6698942fc8] # # patch "src/view/dialogs/Preferences.cpp" # from [222bec00d87b8dc18bdd11d2a54398ecb9476c64] # to [e60886b2bdbe4d616514c670b16f75d13e101590] # ============================================================ --- res/forms/dialogs/preferences.ui 94a7e09291b1d7fc2ff63e3692172ecdfd3cad6e +++ res/forms/dialogs/preferences.ui d8b65e5321100212ac03b88626f578dfb7e94299 @@ -1,86 +1,93 @@ - + + PreferencesDialog - - + + 0 0 - 458 - 340 + 577 + 335 - + + + 0 + 0 + + + Qt::NoContextMenu - + Preferences - - + + :/icons/guitone.png:/icons/guitone.png - + false - + true - + - - - + + + - + QTabWidget::North - + QTabWidget::Rounded - - 0 + + 2 - + false - - + + General - + - - + + Path to monotone executable - - - + + + - - + + Qt::NoContextMenu - + true - + false - - + + Browse - - - + + + relaxed version check @@ -89,49 +96,49 @@ - - + + Logging - + - - + + enable console logging - + true - - + + enable file logging (%1) - - + + 6 - - + + Log level - + - + Qt::Horizontal - + 40 20 @@ -146,26 +153,26 @@ - - + + Colors - + - + - - + + background color of added lines in diffs - - + + Qt::Horizontal - + 40 20 @@ -174,23 +181,23 @@ - - - + + + 0 0 - + 60 20 - + QFrame::Panel - + QFrame::Sunken @@ -198,20 +205,20 @@ - + - - + + background color of removed lines in diffs - - + + Qt::Horizontal - + 40 20 @@ -220,23 +227,23 @@ - - - + + + 0 0 - + 60 20 - + QFrame::Panel - + QFrame::Sunken @@ -244,11 +251,11 @@ - - + + Qt::Vertical - + 20 146 @@ -258,154 +265,104 @@ - - + + Miscellaneous - - - - + + + + check for updates on application launch - + true - - - + + + read workspace incrementally (faster for big directory trees) - + false - - - + + + disable auto-completion in commit dialog - + false - - - + + + This option effectively disables the generation of reverse diffs. - + fix parent-child selection for diff views - + true - - - + + + save encoding preference as file attribute - + true - - - - ask before opening executable files and files with -the following extensions (comma-separated list): + + + + ask before opening executable files and files with the following extensions: - + true - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 20 - 20 - - - - - - - - + + - - - - Qt::Vertical + + + + read ~/.monotone/monotonerc and _MTN/monotonerc on startup - - - 20 - 71 - - - + - + - - + + Reset Settings - - - Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - 0 - 0 - - - - - - - - Cancel - - - - - OK - - - true - - - @@ -414,65 +371,63 @@ the following extensions (comma-separate ColorPicker QFrame -
ColorPicker.h
+
ColorPicker.h
1
mtnExecutablePath selectMtnExecutable - okButton - cancelButton - + - okButton - clicked() - PreferencesDialog - accept() + askFileOpen + toggled(bool) + askFileOpenExtensions + setEnabled(bool) - - 494 - 563 + + 93 + 469 - - 96 - 254 + + 126 + 496 - cancelButton - clicked() + buttonBox + accepted() PreferencesDialog - reject() + accept() - - 429 - 563 + + 430 + 306 - - 179 - 282 + + 363 + 167 - askFileOpen - toggled(bool) - askFileOpenExtensions - setEnabled(bool) + buttonBox + rejected() + PreferencesDialog + reject() - - 93 - 469 + + 430 + 306 - - 126 - 496 + + 363 + 167 ============================================================ --- src/GuitoneCore.cpp 20449663ae437a1183473223ccfcc0a3c112f066 +++ src/GuitoneCore.cpp 9f73d621d82199126a1b9dfd09065e110feb15f1 @@ -31,7 +31,7 @@ GuitoneCore::GuitoneCore(int & argc, cha : QApplication(argc, argv), monotoneManager(0), updateDialog(0) { // check for updates immediatly on launch - if (Settings::getBool("CheckForUpdates", true)) + if (Settings::getBool("CheckForUpdates")) { checkForApplicationUpdates(true); } @@ -62,7 +62,7 @@ void GuitoneCore::setMonotoneBinaryPath( QString installedVersion; if (!monotoneManager->setMonotoneBinaryPath( Settings::getMtnBinaryPath(), - Settings::getBool("RelaxedVersionCheck", false), + Settings::getBool("RelaxedVersionCheck"), installedVersion)) { QMessageBox::critical( ============================================================ --- src/model/ContentDiff.cpp 205b1f9f078f60072838a5e185c57a3c79dcb283 +++ src/model/ContentDiff.cpp c9c42e727a0830e04651662e865646078faf8d02 @@ -63,7 +63,7 @@ void ContentDiff::readDatabaseDiff(const // sort base and target topologically in case the user accidently chosed // the child as base and the parent as target (and would therefor get a // reverse diff) - if (Settings::getBool("FixUnwantedReverseDiffs", true)) + if (Settings::getBool("FixUnwantedReverseDiffs")) { revs = MonotoneUtil::topsortRevisions(db, revs); } @@ -108,7 +108,7 @@ void ContentDiff::readWorkspaceDiff(cons // sort base and target topologically in case the user accidently chosed // the child as base and the parent as target (and would therefor get a // reverse diff) - if (revs.size() == 2 && Settings::getBool("FixUnwantedReverseDiffs", true)) + if (revs.size() == 2 && Settings::getBool("FixUnwantedReverseDiffs")) { revs = MonotoneUtil::topsortRevisions(MonotoneUtil::getDatabaseFile(ws), revs); } ============================================================ --- src/model/Inventory.cpp c3a8fe3d0b7bcea96d6e55a55f53be17d02d2161 +++ src/model/Inventory.cpp 0ec28beef2098f8491fc4d8249cc0ae970d84feb @@ -57,7 +57,7 @@ void Inventory::read(const QString & pat // if requested, just read one directory level ahead // (useful for big directory trees) - if (!fullQuery && Settings::getBool("ReadWorkspaceIncrementally", false)) + if (!fullQuery && Settings::getBool("ReadWorkspaceIncrementally")) { opts << "depth" << QString::number(QueryLevel); opts << "no-corresponding-renames" << QString(); ============================================================ --- src/monotone/MonotoneProcess.cpp 28c3a9da29b6dbc4fa794f498c3dc0b6b251fa77 +++ src/monotone/MonotoneProcess.cpp 3073ca21fabac70475a9b433aa5c56beb3184010 @@ -79,10 +79,16 @@ void MonotoneProcess::start(const QStrin mtnBinaryPath = Settings::getMtnBinaryPath(); } + QStringList args(params); + if (!Settings::getBool("ReadUserRcFiles")) + { + args << "--norc"; + } + L(QString("starting external monotone process %1 %2") - .arg(mtnBinaryPath).arg(params.join(" "))); + .arg(mtnBinaryPath).arg(args.join(" "))); - QProcess::start(mtnBinaryPath, params); + QProcess::start(mtnBinaryPath, args); } void MonotoneProcess::readOutput() ============================================================ --- src/monotone/MonotoneThread.cpp 407f4b1892b30fcb4df4ea1b973fae7ab472caae +++ src/monotone/MonotoneThread.cpp 7f66c2e34aece73bbffa63813658990ff23747aa @@ -19,6 +19,7 @@ #include "MonotoneThread.h" #include "StdioParser.h" #include "BasicIOParser.h" +#include "Settings.h" #include #include @@ -247,8 +248,12 @@ void MonotoneThread::run() args << "stdio"; args << QString("--automate-stdio-size=%1").arg(StdioBufferSize); args << "--db" << databasePath; - args << "--norc"; + if (!Settings::getBool("ReadUserRcFiles")) + { + args << "--norc"; + } + // check whether we need to work on a specific workspace directory or not if (!workspacePath.isEmpty()) { ============================================================ --- src/util/DebugLog.cpp 9215c1c330de41267441b319df00e63855f5da42 +++ src/util/DebugLog.cpp 981d710b1ccf620eedbdc682d5f03872b0f8502f @@ -39,11 +39,11 @@ DebugLog::DebugLog() DebugLog::DebugLog() { - consoleLogging = Settings::getBool("ConsoleLogEnabled", true); + consoleLogging = Settings::getBool("ConsoleLogEnabled"); int level = Settings::getLogLevel(); if (level >= Fatal && level <= Debug) logLevel = static_cast(level); - if (Settings::getBool("FileLogEnabled", false)) + if (Settings::getBool("FileLogEnabled")) { openLogfile(); } ============================================================ --- src/util/Platform.cpp 60434a883a279fb6ec5992d47271388bc46a0e4e +++ src/util/Platform.cpp cc0eeb3a58a73ae489790b8190b4e3e9efaae15a @@ -74,7 +74,7 @@ bool Platform::openFile(const QString & return openFile(fileInfo.symLinkTarget(), true); } - if (Settings::getBool("AskFileOpen", true)) + if (Settings::getBool("AskFileOpen")) { QString suffix = fileInfo.completeSuffix(); QStringList harmfulSuffixes = ============================================================ --- src/util/Settings.cpp 5c48b1c403e955ba1107058f8160440e612132ed +++ src/util/Settings.cpp 003ba7d2afcc6d924286aefdaa7c3619ef0d66b9 @@ -38,9 +38,20 @@ Settings::Settings() : QSettings() Settings::Settings() : QSettings() { - // set a couple of system-wide defaults stringDefaults.insert("DiffColorAddedLines", "#90EE90"); stringDefaults.insert("DiffColorRemovedLines", "#FFCC99"); + + boolDefaults.insert("ConsoleLogEnabled", true); + boolDefaults.insert("FileLogEnabled", false); + boolDefaults.insert("CheckForUpdates", true); + boolDefaults.insert("DisableChangelogAutoCompletion", false); + boolDefaults.insert("FixUnwantedReverseDiffs", true); + boolDefaults.insert("SaveEncodingAsFileAttribute", true); + boolDefaults.insert("RelaxedVersionCheck", false); + boolDefaults.insert("AskFileOpen", true); + boolDefaults.insert("ReadWorkspaceIncrementally", false); + boolDefaults.insert("ReadUserRcFiles", false); + boolDefaults.insert("ChangesetBrowserTree", false); } Settings::~Settings() {} @@ -51,10 +62,12 @@ void Settings::setBool(const QString & n singleton()->setValue(name, value); } -bool Settings::getBool(const QString & name, bool defaultValue) +bool Settings::getBool(const QString & name) { I(!name.isEmpty()); - return singleton()->value(name, defaultValue).toBool(); + Settings * settings = singleton(); + I(settings->boolDefaults.contains(name)); + return singleton()->value(name, settings->boolDefaults.value(name)).toBool(); } void Settings::setString(const QString & name, const QString & value) ============================================================ --- src/util/Settings.h db2003cc3ae29f97afdc46c500c5b4583f2e76e4 +++ src/util/Settings.h cdb32058b97bf73a52fee50a9f1c0a1f411f114e @@ -28,7 +28,7 @@ public: public: static void setBool(const QString &, bool); - static bool getBool(const QString &, bool); + static bool getBool(const QString &); static void setString(const QString &, const QString &); static QString getString(const QString &, const QString & defaultValue = QString()); @@ -69,6 +69,7 @@ private: static Settings * instance; QMap stringDefaults; + QMap boolDefaults; }; #endif ============================================================ --- src/view/dialogs/ChangesetBrowser.cpp bb4313d6d73e7cf525442755c01ec05445958927 +++ src/view/dialogs/ChangesetBrowser.cpp 1bb25d7f5197f6f159ebd816095e741cb0c4fbf3 @@ -34,7 +34,7 @@ ChangesetBrowser::ChangesetBrowser(QWidg changesetsSplitter->restoreState(); changeLogSplitter->restoreState(); - tree = Settings::getBool("ChangesetBrowserTree", false); + tree = Settings::getBool("ChangesetBrowserTree"); displayBranchesAsTree->setText( !tree ? tr("display branches as tree") : tr("display branches flat") ); ============================================================ --- src/view/dialogs/CommitRevision.cpp 6a1ded9f563047b3a5f57ad350af07255c6a7417 +++ src/view/dialogs/CommitRevision.cpp c5f86e5286fb9f0ab1e73f7f38ea0d6698942fc8 @@ -209,7 +209,7 @@ void CommitRevision::revisionRead() { changesAgainstParent->addItems(revModel->getParentRevisions()); - if (!Settings::getBool("DisableChangelogAutoCompletion", false)) + if (!Settings::getBool("DisableChangelogAutoCompletion")) { changelogEntry->setCompleterStrings(revModel->getPathsForCompletion()); } ============================================================ --- src/view/dialogs/Preferences.cpp 222bec00d87b8dc18bdd11d2a54398ecb9476c64 +++ src/view/dialogs/Preferences.cpp e60886b2bdbe4d616514c670b16f75d13e101590 @@ -59,12 +59,12 @@ void Preferences::init() mtnExecutablePath->setText(Settings::getMtnBinaryPath()); enableConsoleLog->setCheckState( - Settings::getBool("ConsoleLogEnabled", true) ? + Settings::getBool("ConsoleLogEnabled") ? Qt::Checked : Qt::Unchecked ); enableFileLog->setCheckState( - Settings::getBool("FileLogEnabled", false) ? + Settings::getBool("FileLogEnabled") ? Qt::Checked : Qt::Unchecked ); @@ -86,27 +86,27 @@ void Preferences::init() logLevel->setCurrentIndex(lvl - 1); checkForUpdates->setCheckState( - Settings::getBool("CheckForUpdates", true) ? + Settings::getBool("CheckForUpdates") ? Qt::Checked : Qt::Unchecked ); readWorkspaceIncrementally->setCheckState( - Settings::getBool("ReadWorkspaceIncrementally", false) ? + Settings::getBool("ReadWorkspaceIncrementally") ? Qt::Checked : Qt::Unchecked ); disableChangelogAutoCompletion->setCheckState( - Settings::getBool("DisableChangelogAutoCompletion", false) ? + Settings::getBool("DisableChangelogAutoCompletion") ? Qt::Checked : Qt::Unchecked ); fixUnwantedReverseDiffs->setCheckState( - Settings::getBool("FixUnwantedReverseDiffs", true) ? + Settings::getBool("FixUnwantedReverseDiffs") ? Qt::Checked : Qt::Unchecked ); saveEncodingAsFileAttribute->setCheckState( - Settings::getBool("SaveEncodingAsFileAttribute", true) ? + Settings::getBool("SaveEncodingAsFileAttribute") ? Qt::Checked : Qt::Unchecked ); @@ -118,12 +118,12 @@ void Preferences::init() QColor(Settings::getString("DiffColorRemovedLines")) ); relaxedVersionCheck->setCheckState( - Settings::getBool("RelaxedVersionCheck", false) ? + Settings::getBool("RelaxedVersionCheck") ? Qt::Checked : Qt::Unchecked ); askFileOpen->setCheckState( - Settings::getBool("AskFileOpen", true) ? + Settings::getBool("AskFileOpen") ? Qt::Checked : Qt::Unchecked ); @@ -132,9 +132,14 @@ void Preferences::init() ); readWorkspaceIncrementally->setCheckState( - Settings::getBool("ReadWorkspaceIncrementally", false) ? + Settings::getBool("ReadWorkspaceIncrementally") ? Qt::Checked : Qt::Unchecked ); + + readUserRcFiles->setCheckState( + Settings::getBool("ReadUserRcFiles") ? + Qt::Checked : Qt::Unchecked + ); } void Preferences::accept() @@ -166,14 +171,12 @@ void Preferences::accept() return; } + bool requireRestart = false; + bool requireReload = false; + if (oldPath != newPath) { - QMessageBox::information( - this, - tr("Notice"), - tr("You need to restart guitone to use the new monotone binary."), - QMessageBox::Ok - ); + requireRestart = true; Settings::setMtnBinaryPath(newPath); } @@ -199,18 +202,42 @@ void Preferences::accept() Settings::setString("DiffColorAddedLines", colorPickerAddedLines->getSelectedColor().name()); Settings::setString("DiffColorRemovedLines", colorPickerRemovedLines->getSelectedColor().name()); - if (Settings::getBool("ReadWorkspaceIncrementally", false) != + if (Settings::getBool("ReadWorkspaceIncrementally") != readWorkspaceIncrementally->isChecked()) { + requireReload = true; + Settings::setBool("ReadWorkspaceIncrementally", + readWorkspaceIncrementally->isChecked()); + } + + if (Settings::getBool("ReadUserRcFiles") != + readUserRcFiles->isChecked()) + { + requireReload = true; + Settings::setBool("ReadUserRcFiles", + readUserRcFiles->isChecked()); + } + + if (requireRestart) + { QMessageBox::information( this, tr("Notice"), - tr("You need to reload your workspace(s) in order to apply this new setting."), + tr("You need to restart guitone to use the new settings."), QMessageBox::Ok ); - Settings::setBool("ReadWorkspaceIncrementally", - readWorkspaceIncrementally->isChecked()); } + else + if (requireReload) + { + QMessageBox::information( + this, + tr("Notice"), + tr("You need to reopen your currently open databases and / or " + "workspaces to use the new settings."), + QMessageBox::Ok + ); + } done(QDialog::Accepted); }