Git: Modernize

* pragma once
* member initialization
* s/struct/class/
* Introduce a static GitPlugin::client() method and use it

Change-Id: Ifdcac86dd16f3cdba11d564d03e9a15f00a6afdb
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Tobias Hunger
2016-02-10 11:19:27 +01:00
parent 7db0023e8c
commit b4195d5174
47 changed files with 229 additions and 419 deletions

View File

@@ -79,7 +79,7 @@ bool LogChangeWidget::init(const QString &repository, const QString &commit, Log
return true;
if (!(flags & Silent)) {
VcsOutputWindow::appendError(
GitPlugin::instance()->client()->msgNoCommits(flags & IncludeRemotes));
GitPlugin::client()->msgNoCommits(flags & IncludeRemotes));
}
return false;
}
@@ -152,14 +152,13 @@ bool LogChangeWidget::populateLog(const QString &repository, const QString &comm
m_model->removeRows(0, rowCount);
// Retrieve log using a custom format "Sha1:Subject [(refs)]"
GitClient *client = GitPlugin::instance()->client();
QStringList arguments;
arguments << QLatin1String("--max-count=1000") << QLatin1String("--format=%h:%s %d");
arguments << (commit.isEmpty() ? QLatin1String("HEAD") : commit);
if (!(flags & IncludeRemotes))
arguments << QLatin1String("--not") << QLatin1String("--remotes");
QString output;
if (!client->synchronousLog(repository, arguments, &output, 0, VcsCommand::NoOutput))
if (!GitPlugin::client()->synchronousLog(repository, arguments, &output, 0, VcsCommand::NoOutput))
return false;
foreach (const QString &line, output.split(QLatin1Char('\n'))) {
const int colonPos = line.indexOf(QLatin1Char(':'));
@@ -211,8 +210,7 @@ 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()->client();
m_resetTypeComboBox->setCurrentIndex(client->settings().intValue(
m_resetTypeComboBox->setCurrentIndex(GitPlugin::client()->settings().intValue(
GitSettings::lastResetIndexKey));
popUpLayout->addWidget(m_resetTypeComboBox);
popUpLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Ignored));
@@ -241,9 +239,8 @@ bool LogChangeDialog::runDialog(const QString &repository,
if (QDialog::exec() == QDialog::Accepted) {
if (m_resetTypeComboBox) {
GitClient *client = GitPlugin::instance()->client();
client->settings().setValue(GitSettings::lastResetIndexKey,
m_resetTypeComboBox->currentIndex());
GitPlugin::client()->settings().setValue(GitSettings::lastResetIndexKey,
m_resetTypeComboBox->currentIndex());
}
return true;
}