Commit 41b51ff6 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh

Git: Preserve reset type

Task-number: QTCREATORBUG-9666
Change-Id: I364bc0eefef376a9a14953b259e9d7b2eb29c228
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent 7da5e163
......@@ -48,6 +48,7 @@ const QLatin1String GitSettings::gitkOptionsKey("GitKOptions");
const QLatin1String GitSettings::logDiffKey("LogDiff");
const QLatin1String GitSettings::repositoryBrowserCmd("RepositoryBrowserCmd");
const QLatin1String GitSettings::graphLogKey("GraphLog");
const QLatin1String GitSettings::lastResetIndexKey("LastResetIndex");
GitSettings::GitSettings()
{
......@@ -68,6 +69,7 @@ GitSettings::GitSettings()
declareKey(logDiffKey, false);
declareKey(repositoryBrowserCmd, QString());
declareKey(graphLogKey, false);
declareKey(lastResetIndexKey, 0);
}
QString GitSettings::gitBinaryPath(bool *ok, QString *errorMessage) const
......
......@@ -61,6 +61,7 @@ public:
static const QLatin1String logDiffKey;
static const QLatin1String repositoryBrowserCmd;
static const QLatin1String graphLogKey;
static const QLatin1String lastResetIndexKey;
QString gitBinaryPath(bool *ok = 0, QString *errorMessage = 0) const;
......
......@@ -180,6 +180,9 @@ LogChangeDialog::LogChangeDialog(bool isReset, QWidget *parent) :
m_resetTypeComboBox->addItem(tr("Hard"), QLatin1String("--hard"));
m_resetTypeComboBox->addItem(tr("Mixed"), QLatin1String("--mixed"));
m_resetTypeComboBox->addItem(tr("Soft"), QLatin1String("--soft"));
GitClient *client = GitPlugin::instance()->gitClient();
m_resetTypeComboBox->setCurrentIndex(client->settings()->intValue(
GitSettings::lastResetIndexKey));
popUpLayout->addWidget(m_resetTypeComboBox);
popUpLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Ignored));
}
......@@ -203,7 +206,15 @@ bool LogChangeDialog::runDialog(const QString &repository, const QString &commit
if (!widget->init(repository, commit, includeRemote))
return false;
return QDialog::exec() == QDialog::Accepted;
if (QDialog::exec() == QDialog::Accepted) {
if (m_resetTypeComboBox) {
GitClient *client = GitPlugin::instance()->gitClient();
client->settings()->setValue(GitSettings::lastResetIndexKey,
m_resetTypeComboBox->currentIndex());
}
return true;
}
return false;
}
QString LogChangeDialog::commit() const
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment