forked from qt-creator/qt-creator
Git: Move msgRepositoryLabel from StashDialog to GitPlugin
It's being used by many dialogs. Change-Id: I3ef484cf8b9cc56210be1de5b4f201eb2f96ef67 Reviewed-by: André Hartmann <aha_1980@gmx.de>
This commit is contained in:
committed by
Orgad Shaneh
parent
5b50854e57
commit
67933e4c1f
@@ -32,7 +32,6 @@
|
|||||||
#include "gitutils.h"
|
#include "gitutils.h"
|
||||||
#include "gitconstants.h"
|
#include "gitconstants.h"
|
||||||
#include "ui_branchdialog.h"
|
#include "ui_branchdialog.h"
|
||||||
#include "stashdialog.h" // Label helpers
|
|
||||||
|
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/execmenu.h>
|
#include <utils/execmenu.h>
|
||||||
@@ -106,7 +105,7 @@ void BranchDialog::refresh(const QString &repository, bool force)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
m_repository = repository;
|
m_repository = repository;
|
||||||
m_ui->repositoryLabel->setText(StashDialog::msgRepositoryLabel(m_repository));
|
m_ui->repositoryLabel->setText(GitPlugin::msgRepositoryLabel(m_repository));
|
||||||
QString errorMessage;
|
QString errorMessage;
|
||||||
if (!m_model->refresh(m_repository, &errorMessage))
|
if (!m_model->refresh(m_repository, &errorMessage))
|
||||||
VcsOutputWindow::appendError(errorMessage);
|
VcsOutputWindow::appendError(errorMessage);
|
||||||
|
@@ -167,6 +167,13 @@ GitClient *GitPlugin::client()
|
|||||||
return m_instance->m_gitClient;
|
return m_instance->m_gitClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString GitPlugin::msgRepositoryLabel(const QString &repository)
|
||||||
|
{
|
||||||
|
return repository.isEmpty() ?
|
||||||
|
tr("<No repository>") :
|
||||||
|
tr("Repository: %1").arg(QDir::toNativeSeparators(repository));
|
||||||
|
}
|
||||||
|
|
||||||
const VcsBaseSubmitEditorParameters submitParameters = {
|
const VcsBaseSubmitEditorParameters submitParameters = {
|
||||||
Git::Constants::SUBMIT_MIMETYPE,
|
Git::Constants::SUBMIT_MIMETYPE,
|
||||||
Git::Constants::GITSUBMITEDITOR_ID,
|
Git::Constants::GITSUBMITEDITOR_ID,
|
||||||
|
@@ -87,6 +87,7 @@ public:
|
|||||||
|
|
||||||
Gerrit::Internal::GerritPlugin *gerritPlugin() const;
|
Gerrit::Internal::GerritPlugin *gerritPlugin() const;
|
||||||
bool isCommitEditorOpen() const;
|
bool isCommitEditorOpen() const;
|
||||||
|
static QString msgRepositoryLabel(const QString &repository);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void startCommit();
|
void startCommit();
|
||||||
|
@@ -28,7 +28,6 @@
|
|||||||
#include "gitclient.h"
|
#include "gitclient.h"
|
||||||
#include "gitplugin.h"
|
#include "gitplugin.h"
|
||||||
#include "remotemodel.h"
|
#include "remotemodel.h"
|
||||||
#include "stashdialog.h" // for messages
|
|
||||||
#include "ui_remotedialog.h"
|
#include "ui_remotedialog.h"
|
||||||
#include "ui_remoteadditiondialog.h"
|
#include "ui_remoteadditiondialog.h"
|
||||||
|
|
||||||
@@ -114,7 +113,7 @@ void RemoteDialog::refresh(const QString &repository, bool force)
|
|||||||
if (m_remoteModel->workingDirectory() == repository && !force)
|
if (m_remoteModel->workingDirectory() == repository && !force)
|
||||||
return;
|
return;
|
||||||
// Refresh
|
// Refresh
|
||||||
m_ui->repositoryLabel->setText(StashDialog::msgRepositoryLabel(repository));
|
m_ui->repositoryLabel->setText(GitPlugin::msgRepositoryLabel(repository));
|
||||||
if (repository.isEmpty()) {
|
if (repository.isEmpty()) {
|
||||||
m_remoteModel->clear();
|
m_remoteModel->clear();
|
||||||
} else {
|
} else {
|
||||||
|
@@ -151,20 +151,13 @@ StashDialog::~StashDialog()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString StashDialog::msgRepositoryLabel(const QString &repository)
|
|
||||||
{
|
|
||||||
return repository.isEmpty() ?
|
|
||||||
tr("<No repository>") :
|
|
||||||
tr("Repository: %1").arg(QDir::toNativeSeparators(repository));
|
|
||||||
}
|
|
||||||
|
|
||||||
void StashDialog::refresh(const QString &repository, bool force)
|
void StashDialog::refresh(const QString &repository, bool force)
|
||||||
{
|
{
|
||||||
if (m_repository == repository && !force)
|
if (m_repository == repository && !force)
|
||||||
return;
|
return;
|
||||||
// Refresh
|
// Refresh
|
||||||
m_repository = repository;
|
m_repository = repository;
|
||||||
ui->repositoryLabel->setText(msgRepositoryLabel(repository));
|
ui->repositoryLabel->setText(GitPlugin::msgRepositoryLabel(repository));
|
||||||
if (m_repository.isEmpty()) {
|
if (m_repository.isEmpty()) {
|
||||||
m_model->setStashes(QList<Stash>());
|
m_model->setStashes(QList<Stash>());
|
||||||
} else {
|
} else {
|
||||||
|
@@ -52,8 +52,6 @@ public:
|
|||||||
explicit StashDialog(QWidget *parent = 0);
|
explicit StashDialog(QWidget *parent = 0);
|
||||||
~StashDialog() override;
|
~StashDialog() override;
|
||||||
|
|
||||||
static QString msgRepositoryLabel(const QString &repository);
|
|
||||||
|
|
||||||
void refresh(const QString &repository, bool force);
|
void refresh(const QString &repository, bool force);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Reference in New Issue
Block a user