Commit 6cdb2483 authored by loh.tar's avatar loh.tar
Browse files

Code cosmetics

Rename
  getStatus() -> updateStatus()          # Function returns void
  m_stackedgitViews -> m_stackedGitViews # Better to read/fit others
parent c59ece47
Pipeline #164097 passed with stage
in 12 minutes and 21 seconds
......@@ -291,7 +291,7 @@ GitWidget::GitWidget(KateProject *project, KTextEditor::MainWindow *mainWindow,
connect(&m_gitStatusWatcher, &QFutureWatcher<GitUtils::GitParsedStatus>::finished, this, &GitWidget::parseStatusReady);
connect(m_commitBtn, &QPushButton::clicked, this, &GitWidget::openCommitChangesDialog);
connect(m_commitBtn, &QPushButton::pressed, [=] {
getStatus();
updateStatus();
});
// single / double click
......@@ -307,7 +307,7 @@ GitWidget::GitWidget(KateProject *project, KTextEditor::MainWindow *mainWindow,
// Ensure we are looks good
QTimer::singleShot(0, [=] {
getStatus();
updateStatus();
});
}
......@@ -368,7 +368,7 @@ QProcess *GitWidget::gitp(const QStringList &arguments)
return git;
}
void GitWidget::getStatus(bool untracked, bool submodules)
void GitWidget::updateStatus(bool untracked, bool submodules)
{
if (!isVisible()) {
return; // No need to update
......@@ -406,7 +406,7 @@ void GitWidget::runGitCmd(const QStringList &args, const QString &i18error)
if (es != QProcess::NormalExit || exitCode != 0) {
sendMessage(i18error + QStringLiteral(": ") + QString::fromUtf8(git->readAllStandardError()), true);
} else {
getStatus();
updateStatus();
}
git->deleteLater();
});
......@@ -427,7 +427,7 @@ void GitWidget::runPushPullCmd(const QStringList &args)
QString cmd = gargs.join(QStringLiteral(" "));
QString out = QString::fromUtf8(git->readAll());
sendMessage(i18n("\"%1\" executed successfully: %2", cmd, out), false);
getStatus();
updateStatus();
}
hideCancel();
git->deleteLater();
......@@ -613,7 +613,7 @@ void GitWidget::commitChanges(const QString &msg, const QString &desc, bool sign
sendMessage(i18n("Failed to commit: %1", QString::fromUtf8(git->readAllStandardError())), true);
} else {
m_commitMessage.clear();
getStatus();
updateStatus();
sendMessage(i18n("Changes committed successfully."), false);
}
git->deleteLater();
......@@ -671,7 +671,7 @@ void GitWidget::applyDiff(const QString &fileName, bool staged, bool hunk, KText
}
// must come at the end
QTimer::singleShot(10, this, [this] {
getStatus();
updateStatus();
});
}
delete file;
......@@ -858,7 +858,7 @@ void GitWidget::buildMenu()
m_gitMenu = new QMenu(this);
auto r = m_gitMenu->addAction(i18n("Refresh"), this, [this] {
if (m_project) {
getStatus();
updateStatus();
}
});
r->setIcon(QIcon::fromTheme(QStringLiteral("view-refresh")));
......@@ -903,7 +903,7 @@ void GitWidget::createStashDialog(StashMode m, const QString &gitPath)
m_pluginView->showDiffInFixedView(r);
});
connect(stashDialog, &StashDialog::done, this, [this, stashDialog] {
getStatus();
updateStatus();
stashDialog->deleteLater();
});
stashDialog->openDialog(m);
......
......@@ -44,7 +44,7 @@ public:
~GitWidget();
bool eventFilter(QObject *o, QEvent *e) override;
void getStatus(bool untracked = true, bool submodules = false);
void updateStatus(bool untracked = true, bool submodules = false);
KTextEditor::MainWindow *mainWindow();
// will just proxy the message to the plugin view
......
......@@ -107,7 +107,7 @@ KateProjectPluginView::KateProjectPluginView(KateProjectPlugin *plugin, KTextEdi
m_stackedProjectViews = new QStackedWidget(m_toolView);
m_stackedProjectInfoViews = new QStackedWidget(m_toolInfoView);
m_stackedgitViews = new QStackedWidget(m_gitToolView.get());
m_stackedGitViews = new QStackedWidget(m_gitToolView.get());
connect(m_projectsCombo,
static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
......@@ -123,8 +123,8 @@ KateProjectPluginView::KateProjectPluginView(KateProjectPlugin *plugin, KTextEdi
connect(m_plugin, &KateProjectPlugin::pluginViewProjectClosing, this, &KateProjectPluginView::slotProjectClose);
connect(m_gitStatusRefreshButton, &QToolButton::clicked, this, [this] {
if (auto widget = m_stackedgitViews->currentWidget()) {
qobject_cast<GitWidget *>(widget)->getStatus();
if (auto widget = m_stackedGitViews->currentWidget()) {
qobject_cast<GitWidget *>(widget)->updateStatus();
}
});
......@@ -311,7 +311,7 @@ QPair<KateProjectView *, KateProjectInfoView *> KateProjectPluginView::viewForPr
*/
m_stackedProjectViews->addWidget(view);
m_stackedProjectInfoViews->addWidget(infoView);
m_stackedgitViews->addWidget(gitView);
m_stackedGitViews->addWidget(gitView);
m_projectsCombo->addItem(QIcon::fromTheme(QStringLiteral("project-open")), project->name(), project->fileName());
m_projectsComboGit->addItem(QIcon::fromTheme(QStringLiteral("project-open")), project->name(), project->fileName());
......@@ -474,8 +474,8 @@ void KateProjectPluginView::slotDocumentSaved()
// We need to wait to be sure all files are saved,
// or the update may to early and we miss something
QTimer::singleShot(500, this, [=] {
if (QWidget *current = m_stackedgitViews->currentWidget()) {
static_cast<GitWidget *>(current)->getStatus();
if (QWidget *current = m_stackedGitViews->currentWidget()) {
static_cast<GitWidget *>(current)->updateStatus();
}
});
}
......@@ -485,7 +485,7 @@ void KateProjectPluginView::slotCurrentChanged(int index)
// trigger change of stacked widgets
m_stackedProjectViews->setCurrentIndex(index);
m_stackedProjectInfoViews->setCurrentIndex(index);
m_stackedgitViews->setCurrentIndex(index);
m_stackedGitViews->setCurrentIndex(index);
{
const QSignalBlocker blocker(m_projectsComboGit);
......@@ -504,9 +504,9 @@ void KateProjectPluginView::slotCurrentChanged(int index)
}
// update git focus proxy + update status
if (QWidget *current = m_stackedgitViews->currentWidget()) {
m_stackedgitViews->setFocusProxy(current);
static_cast<GitWidget *>(current)->getStatus();
if (QWidget *current = m_stackedGitViews->currentWidget()) {
m_stackedGitViews->setFocusProxy(current);
static_cast<GitWidget *>(current)->updateStatus();
}
// project file name might have changed
......@@ -638,8 +638,8 @@ void KateProjectPluginView::slotProjectReload()
/**
* Refresh git status
*/
if (auto widget = m_stackedgitViews->currentWidget()) {
qobject_cast<GitWidget *>(widget)->getStatus();
if (auto widget = m_stackedGitViews->currentWidget()) {
qobject_cast<GitWidget *>(widget)->updateStatus();
}
}
......@@ -663,8 +663,8 @@ void KateProjectPluginView::slotProjectClose(KateProject *project)
m_stackedProjectInfoViews->removeWidget(stackedProjectInfoViewsWidget);
delete stackedProjectInfoViewsWidget;
QWidget *stackedgitViewsWidget = m_stackedgitViews->widget(index);
m_stackedgitViews->removeWidget(stackedgitViewsWidget);
QWidget *stackedgitViewsWidget = m_stackedGitViews->widget(index);
m_stackedGitViews->removeWidget(stackedgitViewsWidget);
delete stackedgitViewsWidget;
m_projectsCombo->removeItem(index);
......@@ -752,8 +752,8 @@ void KateProjectPluginView::slotUpdateStatus(bool visible)
return;
}
if (auto widget = m_stackedgitViews->currentWidget()) {
static_cast<GitWidget *>(widget)->getStatus();
if (auto widget = m_stackedGitViews->currentWidget()) {
static_cast<GitWidget *>(widget)->updateStatus();
}
}
......
......@@ -405,7 +405,7 @@ private:
/**
* stacked widget will all currently created git views
*/
QStackedWidget *m_stackedgitViews;
QStackedWidget *m_stackedGitViews;
/**
* project => view
......
Supports Markdown
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