Gerrit: Remove the "Always prompt" setting

It's confusing. The user can just choose the path in the dialog rather
than in a popup

Change-Id: I91422ec9baf5508d3e3d2e552afc6b955fd84748
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Orgad Shaneh
2014-04-02 23:12:39 +03:00
committed by Orgad Shaneh
parent efecd15b1e
commit f7db3258b4
6 changed files with 5 additions and 30 deletions

View File

@@ -164,9 +164,9 @@ GerritDialog::GerritDialog(const QSharedPointer<GerritParameters> &p,
repoPathLayout->addWidget(m_repositoryChooser); repoPathLayout->addWidget(m_repositoryChooser);
detailsLayout->addLayout(repoPathLayout); detailsLayout->addLayout(repoPathLayout);
m_displayButton = addActionButton(QString(), SLOT(slotFetchDisplay())); m_displayButton = addActionButton(tr("&Show"), SLOT(slotFetchDisplay()));
m_cherryPickButton = addActionButton(QString(), SLOT(slotFetchCherryPick())); m_cherryPickButton = addActionButton(tr("Cherry &Pick"), SLOT(slotFetchCherryPick()));
m_checkoutButton = addActionButton(QString(), SLOT(slotFetchCheckout())); m_checkoutButton = addActionButton(tr("&Checkout"), SLOT(slotFetchCheckout()));
m_refreshButton = addActionButton(tr("&Refresh"), SLOT(slotRefresh())); m_refreshButton = addActionButton(tr("&Refresh"), SLOT(slotRefresh()));
connect(m_model, SIGNAL(refreshStateChanged(bool)), connect(m_model, SIGNAL(refreshStateChanged(bool)),
@@ -200,19 +200,8 @@ QString GerritDialog::repositoryPath() const
void GerritDialog::displayRepositoryPath() void GerritDialog::displayRepositoryPath()
{ {
QTC_ASSERT(m_parameters, return); QTC_ASSERT(m_parameters, return);
m_repositoryChooser->setVisible(!m_parameters->promptPath);
m_repositoryChooserLabel->setVisible(!m_parameters->promptPath);
if (m_repositoryChooser->path().isEmpty()) if (m_repositoryChooser->path().isEmpty())
m_repositoryChooser->setPath(m_parameters->repositoryPath); m_repositoryChooser->setPath(m_parameters->repositoryPath);
if (m_parameters->promptPath) {
m_displayButton->setText(tr("&Show..."));
m_cherryPickButton->setText(tr("Cherry &Pick..."));
m_checkoutButton->setText(tr("&Checkout..."));
} else {
m_displayButton->setText(tr("&Show"));
m_cherryPickButton->setText(tr("Cherry &Pick"));
m_checkoutButton->setText(tr("&Checkout"));
}
} }
void GerritDialog::showEvent(QShowEvent *event) void GerritDialog::showEvent(QShowEvent *event)

View File

@@ -92,7 +92,6 @@ GerritOptionsWidget::GerritOptionsWidget(QWidget *parent)
, m_repositoryChooser(new Utils::PathChooser) , m_repositoryChooser(new Utils::PathChooser)
, m_portSpinBox(new QSpinBox(this)) , m_portSpinBox(new QSpinBox(this))
, m_httpsCheckBox(new QCheckBox(tr("HTTPS"))) , m_httpsCheckBox(new QCheckBox(tr("HTTPS")))
, m_promptPathCheckBox(new QCheckBox(tr("Always prompt for repository folder")))
{ {
QFormLayout *formLayout = new QFormLayout(this); QFormLayout *formLayout = new QFormLayout(this);
formLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); formLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
@@ -105,9 +104,6 @@ GerritOptionsWidget::GerritOptionsWidget(QWidget *parent)
formLayout->addRow(tr("&Repository:"), m_repositoryChooser); formLayout->addRow(tr("&Repository:"), m_repositoryChooser);
m_repositoryChooser->setToolTip(tr("Default repository where patches will be applied.")); m_repositoryChooser->setToolTip(tr("Default repository where patches will be applied."));
m_repositoryChooser->setHistoryCompleter(QLatin1String("Git.RepoDir.History")); m_repositoryChooser->setHistoryCompleter(QLatin1String("Git.RepoDir.History"));
formLayout->addRow(tr("Pr&ompt:"), m_promptPathCheckBox);
m_promptPathCheckBox->setToolTip(tr("If checked, user will always be\n"
"asked to confirm the repository path."));
m_portSpinBox->setMinimum(1); m_portSpinBox->setMinimum(1);
m_portSpinBox->setMaximum(65535); m_portSpinBox->setMaximum(65535);
formLayout->addRow(tr("&Port:"), m_portSpinBox); formLayout->addRow(tr("&Port:"), m_portSpinBox);
@@ -127,7 +123,6 @@ GerritParameters GerritOptionsWidget::parameters() const
result.repositoryPath = m_repositoryChooser->path(); result.repositoryPath = m_repositoryChooser->path();
result.port = m_portSpinBox->value(); result.port = m_portSpinBox->value();
result.https = m_httpsCheckBox->isChecked(); result.https = m_httpsCheckBox->isChecked();
result.promptPath = m_promptPathCheckBox->isChecked();
return result; return result;
} }
@@ -139,7 +134,6 @@ void GerritOptionsWidget::setParameters(const GerritParameters &p)
m_repositoryChooser->setPath(p.repositoryPath); m_repositoryChooser->setPath(p.repositoryPath);
m_portSpinBox->setValue(p.port); m_portSpinBox->setValue(p.port);
m_httpsCheckBox->setChecked(p.https); m_httpsCheckBox->setChecked(p.https);
m_promptPathCheckBox->setChecked(p.promptPath);
} }
} // namespace Internal } // namespace Internal

View File

@@ -64,7 +64,6 @@ private:
Utils::PathChooser *m_repositoryChooser; Utils::PathChooser *m_repositoryChooser;
QSpinBox *m_portSpinBox; QSpinBox *m_portSpinBox;
QCheckBox *m_httpsCheckBox; QCheckBox *m_httpsCheckBox;
QCheckBox *m_promptPathCheckBox;
}; };
class GerritOptionsPage : public VcsBase::VcsBaseOptionsPage class GerritOptionsPage : public VcsBase::VcsBaseOptionsPage

View File

@@ -52,7 +52,6 @@ static const char portFlagKeyC[] = "PortFlag";
static const char sshKeyC[] = "Ssh"; static const char sshKeyC[] = "Ssh";
static const char repositoryKeyC[] = "RepoPath"; static const char repositoryKeyC[] = "RepoPath";
static const char httpsKeyC[] = "Https"; static const char httpsKeyC[] = "Https";
static const char promptPathKeyC[] = "PromptPath";
static const char defaultHostC[] = "codereview.qt-project.org"; static const char defaultHostC[] = "codereview.qt-project.org";
static const char defaultSshC[] = "ssh"; static const char defaultSshC[] = "ssh";
static const char savedQueriesKeyC[] = "SavedQueries"; static const char savedQueriesKeyC[] = "SavedQueries";
@@ -101,7 +100,6 @@ GerritParameters::GerritParameters()
: host(QLatin1String(defaultHostC)) : host(QLatin1String(defaultHostC))
, port(defaultPort) , port(defaultPort)
, https(true) , https(true)
, promptPath(true)
, portFlag(QLatin1String(defaultPortFlag)) , portFlag(QLatin1String(defaultPortFlag))
{ {
} }
@@ -121,7 +119,7 @@ QString GerritParameters::sshHostArgument() const
bool GerritParameters::equals(const GerritParameters &rhs) const bool GerritParameters::equals(const GerritParameters &rhs) const
{ {
return port == rhs.port && host == rhs.host && user == rhs.user && promptPath == rhs.promptPath return port == rhs.port && host == rhs.host && user == rhs.user
&& ssh == rhs.ssh && https == rhs.https && repositoryPath == rhs.repositoryPath; && ssh == rhs.ssh && https == rhs.https && repositoryPath == rhs.repositoryPath;
} }
@@ -135,7 +133,6 @@ void GerritParameters::toSettings(QSettings *s) const
s->setValue(QLatin1String(sshKeyC), ssh); s->setValue(QLatin1String(sshKeyC), ssh);
s->setValue(QLatin1String(repositoryKeyC), repositoryPath); s->setValue(QLatin1String(repositoryKeyC), repositoryPath);
s->setValue(QLatin1String(httpsKeyC), https); s->setValue(QLatin1String(httpsKeyC), https);
s->setValue(QLatin1String(promptPathKeyC), promptPath);
s->endGroup(); s->endGroup();
} }
@@ -158,7 +155,6 @@ void GerritParameters::fromSettings(const QSettings *s)
savedQueries = s->value(rootKey + QLatin1String(savedQueriesKeyC), QString()).toString() savedQueries = s->value(rootKey + QLatin1String(savedQueriesKeyC), QString()).toString()
.split(QLatin1String(",")); .split(QLatin1String(","));
https = s->value(rootKey + QLatin1String(httpsKeyC), QVariant(true)).toBool(); https = s->value(rootKey + QLatin1String(httpsKeyC), QVariant(true)).toBool();
promptPath = s->value(rootKey + QLatin1String(promptPathKeyC), QVariant(true)).toBool();
if (ssh.isEmpty()) if (ssh.isEmpty())
ssh = detectSsh(); ssh = detectSsh();
} }

View File

@@ -58,7 +58,6 @@ public:
QString repositoryPath; QString repositoryPath;
QStringList savedQueries; QStringList savedQueries;
bool https; bool https;
bool promptPath;
QString portFlag; QString portFlag;
}; };

View File

@@ -432,10 +432,8 @@ void GerritPlugin::fetch(const QSharedPointer<Gerrit::Internal::GerritChange> &c
QString repository; QString repository;
bool verifiedRepository = false; bool verifiedRepository = false;
if (!m_dialog.isNull() && !m_parameters.isNull() && !m_parameters->promptPath if (!m_dialog.isNull() && !m_parameters.isNull() && QFile::exists(m_dialog->repositoryPath()))
&& QFile::exists(m_dialog->repositoryPath())) {
repository = client->findRepositoryForDirectory(m_dialog->repositoryPath()); repository = client->findRepositoryForDirectory(m_dialog->repositoryPath());
}
if (!repository.isEmpty()) { if (!repository.isEmpty()) {
// Check if remote from a working dir is the same as remote from patch // Check if remote from a working dir is the same as remote from patch