diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp
index d48d5805f26..c952df8b1bf 100644
--- a/src/plugins/git/gitclient.cpp
+++ b/src/plugins/git/gitclient.cpp
@@ -99,19 +99,19 @@ public:
DiffShow
};
- GitDiffSwitcher(Core::IEditor *parentEditor, GitClient *gitClient, GitClient::DiffEditorType switchToType)
+ GitDiffSwitcher(Core::IEditor *parentEditor, GitClient *gitClient)
: QObject(parentEditor),
m_editor(parentEditor),
- m_gitClient(gitClient),
- m_editorType(switchToType)
+ m_gitClient(gitClient)
{
- QIcon actionIcon = switchToType == GitClient::SideBySideDiffEditor
- ? QIcon(QLatin1String(Core::Constants::ICON_SIDE_BY_SIDE_DIFF))
- : QIcon(QLatin1String(Core::Constants::ICON_TEXT_DIFF));
+ m_usingDiffEditor = gitClient->settings()->boolValue(GitSettings::useDiffEditorKey);
+ QIcon actionIcon = m_usingDiffEditor
+ ? QIcon(QLatin1String(Core::Constants::ICON_TEXT_DIFF))
+ : QIcon(QLatin1String(Core::Constants::ICON_SIDE_BY_SIDE_DIFF));
- const QString actionToolTip = switchToType == GitClient::SideBySideDiffEditor
- ? tr("Switch to Side By Side Diff Editor")
- : tr("Switch to Text Diff Editor");
+ const QString actionToolTip = m_usingDiffEditor
+ ? tr("Switch to Text Diff Editor")
+ : tr("Switch to Side By Side Diff Editor");
QAction *switchAction = new QAction(actionIcon, actionToolTip, parentEditor);
parentEditor->toolBar()->addAction(switchAction);
@@ -140,7 +140,7 @@ private:
GitClient *m_gitClient;
QString m_workingDirectory;
DiffType m_diffType;
- GitClient::DiffEditorType m_editorType;
+ bool m_usingDiffEditor;
QString m_fileName;
QStringList m_stagedFiles;
QStringList m_unstagedFiles;
@@ -153,24 +153,25 @@ private:
void GitDiffSwitcher::execute()
{
+ m_gitClient->settings()->setValue(GitSettings::useDiffEditorKey, !m_usingDiffEditor);
switch (m_diffType) {
case DiffRepository:
- m_gitClient->diff(m_workingDirectory, QStringList(), QStringList(), m_editorType);
+ m_gitClient->diff(m_workingDirectory, QStringList(), QStringList());
break;
case DiffFile:
- m_gitClient->diff(m_workingDirectory, m_fileName, m_editorType);
+ m_gitClient->diff(m_workingDirectory, m_fileName);
break;
case DiffFileList:
- m_gitClient->diff(m_workingDirectory, m_unstagedFiles, m_stagedFiles, m_editorType);
+ m_gitClient->diff(m_workingDirectory, m_unstagedFiles, m_stagedFiles);
break;
case DiffProjectList:
- m_gitClient->diff(m_workingDirectory, m_projectFiles, QStringList(), m_editorType);
+ m_gitClient->diff(m_workingDirectory, m_projectFiles, QStringList());
break;
case DiffBranch:
- m_gitClient->diffBranch(m_workingDirectory, m_baseArguments, m_branchName, m_editorType);
+ m_gitClient->diffBranch(m_workingDirectory, m_baseArguments, m_branchName);
break;
case DiffShow:
- m_gitClient->show(m_fileName, m_id, m_baseArguments, m_displayName, m_editorType);
+ m_gitClient->show(m_fileName, m_id, m_baseArguments, m_displayName);
break;
default:
break;
@@ -594,8 +595,7 @@ public:
void executeCommand()
{
- m_client->diff(m_workingDirectory, m_unstagedFileNames, m_stagedFileNames,
- GitClient::SimpleTextDiffEditor);
+ m_client->diff(m_workingDirectory, m_unstagedFileNames, m_stagedFileNames);
}
private:
@@ -615,7 +615,7 @@ public:
void executeCommand()
{
- m_client->diff(m_workingDirectory, m_fileName, GitClient::SimpleTextDiffEditor);
+ m_client->diff(m_workingDirectory, m_fileName);
}
private:
@@ -634,8 +634,7 @@ public:
void executeCommand()
{
- m_client->diffBranch(m_workingDirectory, baseArguments(), m_branchName,
- GitClient::SimpleTextDiffEditor);
+ m_client->diffBranch(m_workingDirectory, baseArguments(), m_branchName);
}
private:
@@ -670,8 +669,7 @@ public:
void executeCommand()
{
- m_client->show(m_workingDirectory, m_id, baseArguments(), QString(),
- GitClient::SimpleTextDiffEditor);
+ m_client->show(m_workingDirectory, m_id, baseArguments());
}
private:
@@ -1064,16 +1062,12 @@ VcsBase::VcsBaseEditorWidget *GitClient::createVcsEditor(
void GitClient::diff(const QString &workingDirectory,
const QStringList &unstagedFileNames,
- const QStringList &stagedFileNames,
- DiffEditorType editorType)
+ const QStringList &stagedFileNames)
{
const QString title = tr("Git Diff");
const int timeout = settings()->intValue(GitSettings::timeoutKey);
- const bool showSideBySideEditor = (editorType == DefaultDiffEditor
- && settings()->boolValue(GitSettings::useDiffEditorKey))
- || editorType == SideBySideDiffEditor;
Core::IEditor *newEditor = 0;
- if (showSideBySideEditor) {
+ if (settings()->boolValue(GitSettings::useDiffEditorKey)) {
const char *propertyName = "sideBySideOriginalFileName";
DiffEditor::DiffEditor *diffEditor = findExistingDiffEditor(propertyName, workingDirectory);
if (!diffEditor) {
@@ -1168,8 +1162,7 @@ void GitClient::diff(const QString &workingDirectory,
command->execute();
}
if (newEditor) {
- GitDiffSwitcher *switcher = new GitDiffSwitcher(newEditor, this,
- showSideBySideEditor ? SimpleTextDiffEditor : SideBySideDiffEditor);
+ GitDiffSwitcher *switcher = new GitDiffSwitcher(newEditor, this);
switcher->setWorkingDirectory(workingDirectory);
if (unstagedFileNames.empty() && stagedFileNames.empty()) {
// local repository diff
@@ -1186,17 +1179,12 @@ void GitClient::diff(const QString &workingDirectory,
}
}
-void GitClient::diff(const QString &workingDirectory,
- const QString &fileName,
- DiffEditorType editorType)
+void GitClient::diff(const QString &workingDirectory, const QString &fileName)
{
const QString title = tr("Git Diff \"%1\"").arg(fileName);
- const bool showSideBySideEditor = (editorType == DefaultDiffEditor
- && settings()->boolValue(GitSettings::useDiffEditorKey))
- || editorType == SideBySideDiffEditor;
const QString sourceFile = VcsBase::VcsBaseEditorWidget::getSource(workingDirectory, fileName);
Core::IEditor *newEditor = 0;
- if (showSideBySideEditor) {
+ if (settings()->boolValue(GitSettings::useDiffEditorKey)) {
const char *propertyName = "sideBySideOriginalFileName";
DiffEditor::DiffEditor *diffEditor = findExistingDiffEditor(propertyName, sourceFile);
if (!diffEditor) {
@@ -1244,8 +1232,7 @@ void GitClient::diff(const QString &workingDirectory,
executeGit(workingDirectory, cmdArgs, vcsEditor);
}
if (newEditor) {
- GitDiffSwitcher *switcher = new GitDiffSwitcher(newEditor, this,
- showSideBySideEditor ? SimpleTextDiffEditor : SideBySideDiffEditor);
+ GitDiffSwitcher *switcher = new GitDiffSwitcher(newEditor, this);
switcher->setWorkingDirectory(workingDirectory);
switcher->setDiffType(GitDiffSwitcher::DiffFile);
switcher->setFileName(fileName);
@@ -1254,15 +1241,11 @@ void GitClient::diff(const QString &workingDirectory,
void GitClient::diffBranch(const QString &workingDirectory,
const QStringList &diffArgs,
- const QString &branchName,
- DiffEditorType editorType)
+ const QString &branchName)
{
const QString title = tr("Git Diff Branch \"%1\"").arg(branchName);
- const bool showSideBySideEditor = (editorType == DefaultDiffEditor
- && settings()->boolValue(GitSettings::useDiffEditorKey))
- || editorType == SideBySideDiffEditor;
Core::IEditor *newEditor = 0;
- if (showSideBySideEditor) {
+ if (settings()->boolValue(GitSettings::useDiffEditorKey)) {
const char *propertyName = "sideBySideBranchName";
DiffEditor::DiffEditor *diffEditor = findExistingDiffEditor(propertyName, branchName);
if (!diffEditor) {
@@ -1308,8 +1291,7 @@ void GitClient::diffBranch(const QString &workingDirectory,
executeGit(workingDirectory, cmdArgs, vcsEditor);
}
if (newEditor) {
- GitDiffSwitcher *switcher = new GitDiffSwitcher(newEditor, this,
- showSideBySideEditor ? SimpleTextDiffEditor : SideBySideDiffEditor);
+ GitDiffSwitcher *switcher = new GitDiffSwitcher(newEditor, this);
switcher->setWorkingDirectory(workingDirectory);
switcher->setDiffType(GitDiffSwitcher::DiffBranch);
switcher->setBaseArguments(diffArgs);
@@ -1409,8 +1391,7 @@ static inline QString msgCannotShow(const QString &sha)
}
void GitClient::show(const QString &source, const QString &id,
- const QStringList &args, const QString &name,
- DiffEditorType editorType)
+ const QStringList &args, const QString &name)
{
if (!canShow(id)) {
outputWindow()->appendError(msgCannotShow(id));
@@ -1420,11 +1401,8 @@ void GitClient::show(const QString &source, const QString &id,
const QString title = tr("Git Show \"%1\"").arg(name.isEmpty() ? id : name);
const QFileInfo sourceFi(source);
const QString workingDirectory = sourceFi.isDir() ? sourceFi.absoluteFilePath() : sourceFi.absolutePath();
- const bool showSideBySideEditor = (editorType == DefaultDiffEditor
- && settings()->boolValue(GitSettings::useDiffEditorKey))
- || editorType == SideBySideDiffEditor;
Core::IEditor *newEditor = 0;
- if (showSideBySideEditor) {
+ if (settings()->boolValue(GitSettings::useDiffEditorKey)) {
const char *propertyName = "sideBySideShow";
DiffEditor::DiffEditor *diffEditor = findExistingDiffEditor(propertyName, id);
if (!diffEditor) {
@@ -1470,8 +1448,7 @@ void GitClient::show(const QString &source, const QString &id,
executeGit(workingDirectory, arguments, vcsEditor);
}
if (newEditor) {
- GitDiffSwitcher *switcher = new GitDiffSwitcher(newEditor, this,
- showSideBySideEditor ? SimpleTextDiffEditor : SideBySideDiffEditor);
+ GitDiffSwitcher *switcher = new GitDiffSwitcher(newEditor, this);
switcher->setDiffType(GitDiffSwitcher::DiffShow);
switcher->setFileName(source);
switcher->setBaseArguments(args);
diff --git a/src/plugins/git/gitclient.h b/src/plugins/git/gitclient.h
index 6e4a990baf7..610a08498ed 100644
--- a/src/plugins/git/gitclient.h
+++ b/src/plugins/git/gitclient.h
@@ -127,12 +127,6 @@ public:
StashFlag m_flags;
};
- enum DiffEditorType {
- DefaultDiffEditor, // value taken from settings
- SideBySideDiffEditor,
- SimpleTextDiffEditor
- };
-
static const char *stashNamePrefix;
explicit GitClient(GitSettings *settings);
@@ -144,17 +138,13 @@ public:
QString findRepositoryForDirectory(const QString &dir);
QString findGitDirForRepository(const QString &repositoryDir) const;
- void diff(const QString &workingDirectory,
- const QString &fileName,
- DiffEditorType editorType = DefaultDiffEditor);
+ void diff(const QString &workingDirectory, const QString &fileName);
void diff(const QString &workingDirectory,
const QStringList &unstagedFileNames,
- const QStringList &stagedFileNames = QStringList(),
- DiffEditorType editorType = DefaultDiffEditor);
+ const QStringList &stagedFileNames = QStringList());
void diffBranch(const QString &workingDirectory,
const QStringList &diffArgs,
- const QString &branchName,
- DiffEditorType editorType = DefaultDiffEditor);
+ const QString &branchName);
void merge(const QString &workingDirectory, const QStringList &unmergedFileNames = QStringList());
void status(const QString &workingDirectory);
@@ -341,8 +331,7 @@ public slots:
void show(const QString &source,
const QString &id,
const QStringList &args = QStringList(),
- const QString &name = QString(),
- DiffEditorType editorType = DefaultDiffEditor);
+ const QString &name = QString());
void saveSettings();
private slots:
diff --git a/src/plugins/git/settingspage.cpp b/src/plugins/git/settingspage.cpp
index 08b4875e44c..a76d07bc2cc 100644
--- a/src/plugins/git/settingspage.cpp
+++ b/src/plugins/git/settingspage.cpp
@@ -70,7 +70,6 @@ GitSettings SettingsPageWidget::settings() const
rc.setValue(GitSettings::pathKey, m_ui.pathLineEdit->text());
rc.setValue(GitSettings::logCountKey, m_ui.logCountSpinBox->value());
rc.setValue(GitSettings::timeoutKey, m_ui.timeoutSpinBox->value());
- rc.setValue(GitSettings::useDiffEditorKey, m_ui.useDiffEditorCheckBox->isChecked());
rc.setValue(GitSettings::pullRebaseKey, m_ui.pullRebaseCheckBox->isChecked());
rc.setValue(GitSettings::showTagsKey, m_ui.showTagsCheckBox->isChecked());
rc.setValue(GitSettings::promptOnSubmitKey, m_ui.promptToSubmitCheckBox->isChecked());
@@ -85,7 +84,6 @@ void SettingsPageWidget::setSettings(const GitSettings &s)
m_ui.pathLineEdit->setText(s.stringValue(GitSettings::pathKey));
m_ui.logCountSpinBox->setValue(s.intValue(GitSettings::logCountKey));
m_ui.timeoutSpinBox->setValue(s.intValue(GitSettings::timeoutKey));
- m_ui.useDiffEditorCheckBox->setChecked(s.boolValue(GitSettings::useDiffEditorKey));
m_ui.pullRebaseCheckBox->setChecked(s.boolValue(GitSettings::pullRebaseKey));
m_ui.showTagsCheckBox->setChecked(s.boolValue(GitSettings::showTagsKey));
m_ui.promptToSubmitCheckBox->setChecked(s.boolValue(GitSettings::promptOnSubmitKey));
diff --git a/src/plugins/git/settingspage.ui b/src/plugins/git/settingspage.ui
index 26b51f527f7..5e010df2a3b 100644
--- a/src/plugins/git/settingspage.ui
+++ b/src/plugins/git/settingspage.ui
@@ -7,7 +7,7 @@
0
0
705
- 436
+ 459
@@ -60,32 +60,25 @@
Miscellaneous
- -
-
+
-
+
- Log count:
+ Pull with rebase
- -
-
-
- Note that huge amount of commits might take some time.
+
-
+
+
+ Qt::Horizontal
-
- 1000
+
+
+ 211
+ 20
+
-
- 1000
-
-
-
- -
-
-
- Timeout:
-
-
+
-
@@ -103,19 +96,6 @@
- -
-
-
- Qt::Horizontal
-
-
-
- 211
- 20
-
-
-
-
-
@@ -123,27 +103,40 @@
- -
-
+
-
+
- Pull with rebase
+ Log count:
- -
+
-
+
+
+ Timeout:
+
+
+
+ -
+
+
+ Note that huge amount of commits might take some time.
+
+
+ 1000
+
+
+ 1000
+
+
+
+ -
Show tags in Branches dialog
- -
-
-
- Show diff side-by-side
-
-
-