forked from qt-creator/qt-creator
Gerrit: Add a button for server revalidation
Change-Id: I0ef823aa562093e5e3d63bc2766ab1a95ae259d5 Reviewed-by: Tobias Hunger <tobias.hunger@qt.io> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
This commit is contained in:
committed by
Orgad Shaneh
parent
c1d013437f
commit
db16f265c9
@@ -37,6 +37,7 @@
|
|||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
#include <utils/progressindicator.h>
|
#include <utils/progressindicator.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
#include <utils/utilsicons.h>
|
||||||
#include <utils/theme/theme.h>
|
#include <utils/theme/theme.h>
|
||||||
|
|
||||||
#include <QCompleter>
|
#include <QCompleter>
|
||||||
@@ -110,6 +111,10 @@ GerritDialog::GerritDialog(const QSharedPointer<GerritParameters> &p,
|
|||||||
connect(m_ui->treeView, &QAbstractItemView::activated,
|
connect(m_ui->treeView, &QAbstractItemView::activated,
|
||||||
this, &GerritDialog::slotActivated);
|
this, &GerritDialog::slotActivated);
|
||||||
|
|
||||||
|
m_ui->resetRemoteButton->setIcon(Utils::Icons::RESET_TOOLBAR.icon());
|
||||||
|
connect(m_ui->resetRemoteButton, &QToolButton::clicked,
|
||||||
|
this, [this] { updateRemotes(true); });
|
||||||
|
|
||||||
m_displayButton = addActionButton(tr("&Show"), [this]() { slotFetchDisplay(); });
|
m_displayButton = addActionButton(tr("&Show"), [this]() { slotFetchDisplay(); });
|
||||||
m_cherryPickButton = addActionButton(tr("Cherry &Pick"), [this]() { slotFetchCherryPick(); });
|
m_cherryPickButton = addActionButton(tr("Cherry &Pick"), [this]() { slotFetchCherryPick(); });
|
||||||
m_checkoutButton = addActionButton(tr("C&heckout"), [this]() { slotFetchCheckout(); });
|
m_checkoutButton = addActionButton(tr("C&heckout"), [this]() { slotFetchCheckout(); });
|
||||||
@@ -225,7 +230,7 @@ void GerritDialog::remoteChanged()
|
|||||||
slotRefresh();
|
slotRefresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GerritDialog::updateRemotes()
|
void GerritDialog::updateRemotes(bool forceReload)
|
||||||
{
|
{
|
||||||
m_ui->remoteComboBox->clear();
|
m_ui->remoteComboBox->clear();
|
||||||
if (m_repository.isEmpty() || !QFileInfo(m_repository).isDir())
|
if (m_repository.isEmpty() || !QFileInfo(m_repository).isDir())
|
||||||
@@ -239,7 +244,7 @@ void GerritDialog::updateRemotes()
|
|||||||
while (mapIt.hasNext()) {
|
while (mapIt.hasNext()) {
|
||||||
mapIt.next();
|
mapIt.next();
|
||||||
GerritServer server;
|
GerritServer server;
|
||||||
if (!server.fillFromRemote(mapIt.value(), *m_parameters))
|
if (!server.fillFromRemote(mapIt.value(), *m_parameters, forceReload))
|
||||||
continue;
|
continue;
|
||||||
addRemote(server, mapIt.key());
|
addRemote(server, mapIt.key());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ private:
|
|||||||
void slotFetchCheckout();
|
void slotFetchCheckout();
|
||||||
void slotRefresh();
|
void slotRefresh();
|
||||||
void remoteChanged();
|
void remoteChanged();
|
||||||
void updateRemotes();
|
void updateRemotes(bool forceReload = false);
|
||||||
void addRemote(const GerritServer &server, const QString &name);
|
void addRemote(const GerritServer &server, const QString &name);
|
||||||
|
|
||||||
void manageProgressIndicator();
|
void manageProgressIndicator();
|
||||||
|
|||||||
@@ -65,6 +65,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QToolButton" name="resetRemoteButton">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Refresh Remote Servers</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
|||||||
@@ -118,7 +118,9 @@ QString GerritServer::url(UrlType urlType) const
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GerritServer::fillFromRemote(const QString &remote, const GerritParameters ¶meters)
|
bool GerritServer::fillFromRemote(const QString &remote,
|
||||||
|
const GerritParameters ¶meters,
|
||||||
|
bool forceReload)
|
||||||
{
|
{
|
||||||
const GitRemote r(remote);
|
const GitRemote r(remote);
|
||||||
if (!r.isValid)
|
if (!r.isValid)
|
||||||
@@ -143,7 +145,8 @@ bool GerritServer::fillFromRemote(const QString &remote, const GerritParameters
|
|||||||
curlBinary = parameters.curl;
|
curlBinary = parameters.curl;
|
||||||
if (curlBinary.isEmpty() || !QFile::exists(curlBinary))
|
if (curlBinary.isEmpty() || !QFile::exists(curlBinary))
|
||||||
return false;
|
return false;
|
||||||
switch (loadSettings()) {
|
const StoredHostValidity validity = forceReload ? Invalid : loadSettings();
|
||||||
|
switch (validity) {
|
||||||
case Invalid:
|
case Invalid:
|
||||||
rootPath = r.path;
|
rootPath = r.path;
|
||||||
// Strip the last part of the path, which is always the repo name
|
// Strip the last part of the path, which is always the repo name
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ public:
|
|||||||
static QString defaultHost();
|
static QString defaultHost();
|
||||||
QString hostArgument() const;
|
QString hostArgument() const;
|
||||||
QString url(UrlType urlType = DefaultUrl) const;
|
QString url(UrlType urlType = DefaultUrl) const;
|
||||||
bool fillFromRemote(const QString &remote, const GerritParameters ¶meters);
|
bool fillFromRemote(const QString &remote, const GerritParameters ¶meters, bool forceReload);
|
||||||
StoredHostValidity loadSettings();
|
StoredHostValidity loadSettings();
|
||||||
void saveSettings(StoredHostValidity validity) const;
|
void saveSettings(StoredHostValidity validity) const;
|
||||||
int testConnection();
|
int testConnection();
|
||||||
|
|||||||
Reference in New Issue
Block a user