Skip to content
Snippets Groups Projects
Commit 5e798b0b authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh
Browse files

Gerrit: Improve error message when Gerrit remote is missing


Task-number: QTCREATORBUG-18980
Change-Id: I99336732d59136f9aec9fc0a97fb3135e9c43f65
Reviewed-by: default avatarLeena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: default avatarTobias Hunger <tobias.hunger@qt.io>
parent d717ab4f
No related branches found
No related tags found
No related merge requests found
...@@ -317,9 +317,9 @@ void GerritPlugin::push(const QString &topLevel) ...@@ -317,9 +317,9 @@ void GerritPlugin::push(const QString &topLevel)
// QScopedPointer is required to delete the dialog when leaving the function // QScopedPointer is required to delete the dialog when leaving the function
GerritPushDialog dialog(topLevel, m_reviewers, m_parameters, ICore::mainWindow()); GerritPushDialog dialog(topLevel, m_reviewers, m_parameters, ICore::mainWindow());
if (!dialog.isValid()) { const QString initErrorMessage = dialog.initErrorMessage();
QMessageBox::warning(ICore::mainWindow(), tr("Initialization Failed"), if (!initErrorMessage.isEmpty()) {
tr("Failed to initialize dialog. Aborting.")); QMessageBox::warning(ICore::mainWindow(), tr("Initialization Failed"), initErrorMessage);
return; return;
} }
......
...@@ -135,8 +135,10 @@ GerritPushDialog::GerritPushDialog(const QString &workingDir, const QString &rev ...@@ -135,8 +135,10 @@ GerritPushDialog::GerritPushDialog(const QString &workingDir, const QString &rev
initRemoteBranches(); initRemoteBranches();
if (m_ui->remoteComboBox->isEmpty()) if (m_ui->remoteComboBox->isEmpty()) {
m_initErrorMessage = tr("Cannot find a Gerrit remote. Add one and try again.");
return; return;
}
m_ui->localBranchComboBox->init(workingDir); m_ui->localBranchComboBox->init(workingDir);
connect(m_ui->localBranchComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), connect(m_ui->localBranchComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
...@@ -158,8 +160,6 @@ GerritPushDialog::GerritPushDialog(const QString &workingDir, const QString &rev ...@@ -158,8 +160,6 @@ GerritPushDialog::GerritPushDialog(const QString &workingDir, const QString &rev
connect(m_ui->remoteComboBox, &GerritRemoteChooser::remoteChanged, connect(m_ui->remoteComboBox, &GerritRemoteChooser::remoteChanged,
this, [this] { setRemoteBranches(); }); this, [this] { setRemoteBranches(); });
m_isValid = true;
} }
GerritPushDialog::~GerritPushDialog() GerritPushDialog::~GerritPushDialog()
...@@ -209,9 +209,9 @@ void GerritPushDialog::setChangeRange() ...@@ -209,9 +209,9 @@ void GerritPushDialog::setChangeRange()
tr("Number of commits between %1 and %2: %3").arg(branch, remote, range)); tr("Number of commits between %1 and %2: %3").arg(branch, remote, range));
} }
bool GerritPushDialog::isValid() const QString GerritPushDialog::initErrorMessage() const
{ {
return m_isValid; return m_initErrorMessage;
} }
void GerritPushDialog::storeTopic() void GerritPushDialog::storeTopic()
......
...@@ -56,7 +56,7 @@ public: ...@@ -56,7 +56,7 @@ public:
QString selectedPushType() const; QString selectedPushType() const;
QString selectedTopic() const; QString selectedTopic() const;
QString reviewers() const; QString reviewers() const;
bool isValid() const; QString initErrorMessage() const;
void storeTopic(); void storeTopic();
private: private:
...@@ -73,9 +73,9 @@ private: ...@@ -73,9 +73,9 @@ private:
QString calculateChangeRange(const QString &branch); QString calculateChangeRange(const QString &branch);
QString m_workingDir; QString m_workingDir;
QString m_suggestedRemoteBranch; QString m_suggestedRemoteBranch;
QString m_initErrorMessage;
Ui::GerritPushDialog *m_ui; Ui::GerritPushDialog *m_ui;
RemoteBranchesMap m_remoteBranches; RemoteBranchesMap m_remoteBranches;
bool m_isValid = false;
bool m_hasLocalCommits = false; bool m_hasLocalCommits = false;
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment