From 6793f1f962214f51006d091e6bc369b6e01528a2 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint <Friedemann.Kleint@nokia.com> Date: Wed, 16 Jun 2010 09:05:50 +0200 Subject: [PATCH] VCS[git]: Add arguments setting for gitk, add to locator. Task-number: QTCREATORBUG-1577 --- src/plugins/git/gitclient.cpp | 6 ++++-- src/plugins/git/gitplugin.cpp | 2 +- src/plugins/git/gitsettings.cpp | 6 +++++- src/plugins/git/gitsettings.h | 1 + src/plugins/git/settingspage.cpp | 2 ++ src/plugins/git/settingspage.ui | 29 ++++++++++++++++++++--------- 6 files changed, 33 insertions(+), 13 deletions(-) diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp index b735007ec39..ef098ccb05c 100644 --- a/src/plugins/git/gitclient.cpp +++ b/src/plugins/git/gitclient.cpp @@ -1272,12 +1272,14 @@ void GitClient::launchGitK(const QString &workingDirectory) #ifdef Q_OS_WIN // Launch 'wish' shell from git binary directory with the gitk located there const QString binary = gitBinDirectory + QLatin1String("/wish"); - const QStringList arguments(gitBinDirectory + QLatin1String("/gitk")); + QStringList arguments(gitBinDirectory + QLatin1String("/gitk")); #else // Simple: Run gitk from binary path const QString binary = gitBinDirectory + QLatin1String("/gitk"); - const QStringList arguments; + QStringList arguments; #endif + if (!m_settings.gitkOptions.isEmpty()) + arguments.append(m_settings.gitkOptions.split(QLatin1Char(' '))); outwin->appendCommand(workingDirectory, binary, arguments); // This should always use QProcess::startDetached (as not to kill // the child), but that does not have an environment parameter. diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index 119530b8ca8..941d8d49a7f 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -418,7 +418,7 @@ bool GitPlugin::initialize(const QStringList &arguments, QString *errorMessage) createRepositoryAction(actionManager, gitContainer, tr("Launch gitk"), QLatin1String("Git.LaunchGitK"), - globalcontext, false, &GitClient::launchGitK); + globalcontext, true, &GitClient::launchGitK); gitContainer->addAction(createSeparator(actionManager, globalcontext, QLatin1String("Git.Sep.Global"), this)); diff --git a/src/plugins/git/gitsettings.cpp b/src/plugins/git/gitsettings.cpp index 9d67fcb2b7b..2fe8aa492a9 100644 --- a/src/plugins/git/gitsettings.cpp +++ b/src/plugins/git/gitsettings.cpp @@ -46,6 +46,7 @@ static const char promptToSubmitKeyC[] = "PromptForSubmit"; static const char omitAnnotationDateKeyC[] = "OmitAnnotationDate"; static const char spaceIgnorantBlameKeyC[] = "SpaceIgnorantBlame"; static const char diffPatienceKeyC[] = "DiffPatience"; +static const char gitkOptionsKeyC[] = "GitKOptions"; enum { defaultPullRebase = 0, @@ -84,6 +85,7 @@ void GitSettings::fromSettings(QSettings *settings) omitAnnotationDate = settings->value(QLatin1String(omitAnnotationDateKeyC), false).toBool(); spaceIgnorantBlame = settings->value(QLatin1String(spaceIgnorantBlameKeyC), true).toBool(); diffPatience = settings->value(QLatin1String(diffPatienceKeyC), true).toBool(); + gitkOptions = settings->value(QLatin1String(gitkOptionsKeyC)).toString(); settings->endGroup(); } @@ -99,6 +101,7 @@ void GitSettings::toSettings(QSettings *settings) const settings->setValue(QLatin1String(omitAnnotationDateKeyC), omitAnnotationDate); settings->setValue(QLatin1String(spaceIgnorantBlameKeyC), spaceIgnorantBlame); settings->setValue(QLatin1String(diffPatienceKeyC), diffPatience); + settings->setValue(QLatin1String(gitkOptionsKeyC), gitkOptions); settings->endGroup(); } @@ -108,7 +111,8 @@ bool GitSettings::equals(const GitSettings &s) const && timeoutSeconds == s.timeoutSeconds && promptToSubmit == s.promptToSubmit && pullRebase == s.pullRebase && omitAnnotationDate == s.omitAnnotationDate && spaceIgnorantBlame == s.spaceIgnorantBlame - && diffPatience == s.diffPatience; + && diffPatience == s.diffPatience + && gitkOptions == s.gitkOptions; } QString GitSettings::gitBinaryPath(bool *ok, QString *errorMessage) const diff --git a/src/plugins/git/gitsettings.h b/src/plugins/git/gitsettings.h index b3c51595ab6..960e9d6c219 100644 --- a/src/plugins/git/gitsettings.h +++ b/src/plugins/git/gitsettings.h @@ -60,6 +60,7 @@ struct GitSettings bool omitAnnotationDate; bool spaceIgnorantBlame; bool diffPatience; + QString gitkOptions; }; inline bool operator==(const GitSettings &p1, const GitSettings &p2) diff --git a/src/plugins/git/settingspage.cpp b/src/plugins/git/settingspage.cpp index e93cc7fea6d..06d80bfd799 100644 --- a/src/plugins/git/settingspage.cpp +++ b/src/plugins/git/settingspage.cpp @@ -61,6 +61,7 @@ GitSettings SettingsPageWidget::settings() const rc.omitAnnotationDate = m_ui.omitAnnotationDataCheckBox->isChecked(); rc.spaceIgnorantBlame = m_ui.spaceIgnorantBlameCheckBox->isChecked(); rc.diffPatience = m_ui.diffPatienceCheckBox->isChecked(); + rc.gitkOptions = m_ui.gitkOptionsLineEdit->text().trimmed(); return rc; } @@ -75,6 +76,7 @@ void SettingsPageWidget::setSettings(const GitSettings &s) m_ui.omitAnnotationDataCheckBox->setChecked(s.omitAnnotationDate); m_ui.spaceIgnorantBlameCheckBox->setChecked(s.spaceIgnorantBlame); m_ui.diffPatienceCheckBox->setChecked(s.diffPatience); + m_ui.gitkOptionsLineEdit->setText(s.gitkOptions); } void SettingsPageWidget::setSystemPath() diff --git a/src/plugins/git/settingspage.ui b/src/plugins/git/settingspage.ui index 072bb6f39d2..ec069aa4f2e 100644 --- a/src/plugins/git/settingspage.ui +++ b/src/plugins/git/settingspage.ui @@ -2,14 +2,6 @@ <ui version="4.0"> <class>Git::Internal::SettingsPage</class> <widget class="QWidget" name="Git::Internal::SettingsPage"> - <property name="geometry"> - <rect> - <x>0</x> - <y>0</y> - <width>409</width> - <height>385</height> - </rect> - </property> <layout class="QVBoxLayout" name="verticalLayout"> <item> <widget class="QGroupBox" name="environmentGroupBox"> @@ -45,7 +37,7 @@ </layout> </item> <item> - <layout class="QHBoxLayout" name="horizontalLayout_2"> + <layout class="QHBoxLayout" name="noteHorizontalLayout"> <item> <widget class="QLabel" name="noteLabel"> <property name="text"> @@ -152,6 +144,25 @@ </layout> </widget> </item> + <item> + <widget class="QGroupBox" name="gitkGroupBox"> + <property name="title"> + <string>Gitk</string> + </property> + <layout class="QFormLayout" name="formLayout_2"> + <item row="0" column="0"> + <widget class="QLabel" name="gitkOptionsLabel"> + <property name="text"> + <string>Arguments:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QLineEdit" name="gitkOptionsLineEdit"/> + </item> + </layout> + </widget> + </item> <item> <spacer name="verticalSpacer"> <property name="orientation"> -- GitLab