forked from qt-creator/qt-creator
Git: GerritPushDialog: Use Layouting
Change-Id: I5b0a95680e683cf6e5b938b4a4a74bfc0c5b45e2 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
@@ -15,7 +15,7 @@ add_qtc_plugin(Git
|
||||
gerrit/gerritoptionspage.cpp gerrit/gerritoptionspage.h
|
||||
gerrit/gerritparameters.cpp gerrit/gerritparameters.h
|
||||
gerrit/gerritplugin.cpp gerrit/gerritplugin.h
|
||||
gerrit/gerritpushdialog.cpp gerrit/gerritpushdialog.h gerrit/gerritpushdialog.ui
|
||||
gerrit/gerritpushdialog.cpp gerrit/gerritpushdialog.h
|
||||
gerrit/gerritremotechooser.cpp gerrit/gerritremotechooser.h
|
||||
gerrit/gerritserver.cpp gerrit/gerritserver.h
|
||||
git.qrc
|
||||
|
@@ -2,20 +2,23 @@
|
||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
|
||||
|
||||
#include "gerritpushdialog.h"
|
||||
#include "ui_gerritpushdialog.h"
|
||||
|
||||
#include "branchcombobox.h"
|
||||
#include "gerritremotechooser.h"
|
||||
|
||||
#include "../gitclient.h"
|
||||
#include "../gitconstants.h"
|
||||
#include "../gittr.h"
|
||||
#include "../logchangedialog.h"
|
||||
|
||||
#include <utils/icon.h>
|
||||
#include <utils/stringutils.h>
|
||||
#include <utils/layoutbuilder.h>
|
||||
#include <utils/theme/theme.h>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCheckBox>
|
||||
#include <QDateTime>
|
||||
#include <QDir>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QPushButton>
|
||||
#include <QRegularExpressionValidator>
|
||||
#include <QVersionNumber>
|
||||
@@ -44,7 +47,7 @@ protected:
|
||||
|
||||
QString GerritPushDialog::determineRemoteBranch(const QString &localBranch)
|
||||
{
|
||||
const QString earliestCommit = m_ui->commitView->earliestCommit();
|
||||
const QString earliestCommit = m_commitView->earliestCommit();
|
||||
if (earliestCommit.isEmpty())
|
||||
return {};
|
||||
|
||||
@@ -100,62 +103,93 @@ void GerritPushDialog::initRemoteBranches()
|
||||
BranchDate bd(ref.mid(refBranchIndex + 1), QDateTime::fromSecsSinceEpoch(timeT).date());
|
||||
m_remoteBranches.insertMulti(ref.left(refBranchIndex), bd);
|
||||
}
|
||||
m_ui->remoteComboBox->updateRemotes(false);
|
||||
m_remoteComboBox->updateRemotes(false);
|
||||
}
|
||||
|
||||
GerritPushDialog::GerritPushDialog(const Utils::FilePath &workingDir, const QString &reviewerList,
|
||||
QSharedPointer<GerritParameters> parameters, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
m_workingDir(workingDir),
|
||||
m_ui(new Ui::GerritPushDialog)
|
||||
QSharedPointer<GerritParameters> parameters, QWidget *parent)
|
||||
: QDialog(parent)
|
||||
, m_localBranchComboBox(new BranchComboBox)
|
||||
, m_remoteComboBox(new GerritRemoteChooser)
|
||||
, m_targetBranchComboBox(new QComboBox)
|
||||
, m_commitView(new LogChangeWidget)
|
||||
, m_infoLabel(new QLabel(tr("Number of commits")))
|
||||
, m_topicLineEdit(new QLineEdit)
|
||||
, m_draftCheckBox(new QCheckBox(tr("&Draft/private")))
|
||||
, m_wipCheckBox(new QCheckBox(tr("&Work-in-progress")))
|
||||
, m_reviewersLineEdit(new QLineEdit)
|
||||
, m_buttonBox(new QDialogButtonBox)
|
||||
, m_workingDir(workingDir)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
m_ui->repositoryLabel->setText(workingDir.toUserOutput());
|
||||
m_ui->remoteComboBox->setRepository(workingDir);
|
||||
m_ui->remoteComboBox->setParameters(parameters);
|
||||
m_ui->remoteComboBox->setAllowDups(true);
|
||||
m_draftCheckBox->setToolTip(tr("Checked - Mark change as private.\n"
|
||||
"Unchecked - Remove mark.\n"
|
||||
"Partially checked - Do not change current state."));
|
||||
m_commitView->setToolTip(tr("Pushes the selected commit and all dependent commits."));
|
||||
m_reviewersLineEdit->setToolTip(tr("Comma-separated list of reviewers.\n"
|
||||
"\n"
|
||||
"Reviewers can be specified by nickname or email address. Spaces not allowed.\n"
|
||||
"\n"
|
||||
"Partial names can be used if they are unambiguous."));
|
||||
m_wipCheckBox->setTristate(true);
|
||||
m_buttonBox->setStandardButtons(QDialogButtonBox::Cancel | QDialogButtonBox::Ok);
|
||||
connect(m_buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
||||
connect(m_buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||
|
||||
auto delegate = new PushItemDelegate(m_ui->commitView);
|
||||
using namespace Utils::Layouting;
|
||||
|
||||
Grid {
|
||||
tr("Push:"), workingDir.toUserOutput(), m_localBranchComboBox, br,
|
||||
tr("To:"), m_remoteComboBox, m_targetBranchComboBox, br,
|
||||
tr("Commits:"), br,
|
||||
Span(3, m_commitView), br,
|
||||
Span(3, m_infoLabel), br,
|
||||
Span(3, Form {
|
||||
tr("&Topic:"), Row { m_topicLineEdit, m_draftCheckBox, m_wipCheckBox }, br,
|
||||
tr("&Reviewers:"), m_reviewersLineEdit, br
|
||||
}), br,
|
||||
Span(3, m_buttonBox)
|
||||
}.attachTo(this);
|
||||
|
||||
m_remoteComboBox->setRepository(workingDir);
|
||||
m_remoteComboBox->setParameters(parameters);
|
||||
m_remoteComboBox->setAllowDups(true);
|
||||
|
||||
auto delegate = new PushItemDelegate(m_commitView);
|
||||
delegate->setParent(this);
|
||||
|
||||
initRemoteBranches();
|
||||
|
||||
if (m_ui->remoteComboBox->isEmpty()) {
|
||||
if (m_remoteComboBox->isEmpty()) {
|
||||
m_initErrorMessage = Git::Tr::tr("Cannot find a Gerrit remote. Add one and try again.");
|
||||
return;
|
||||
}
|
||||
|
||||
m_ui->localBranchComboBox->init(workingDir);
|
||||
connect(m_ui->localBranchComboBox, &QComboBox::currentIndexChanged,
|
||||
m_localBranchComboBox->init(workingDir);
|
||||
connect(m_localBranchComboBox, &QComboBox::currentIndexChanged,
|
||||
this, &GerritPushDialog::updateCommits);
|
||||
|
||||
connect(m_ui->targetBranchComboBox, &QComboBox::currentIndexChanged,
|
||||
connect(m_targetBranchComboBox, &QComboBox::currentIndexChanged,
|
||||
this, &GerritPushDialog::setChangeRange);
|
||||
|
||||
connect(m_ui->targetBranchComboBox, &QComboBox::currentTextChanged,
|
||||
connect(m_targetBranchComboBox, &QComboBox::currentTextChanged,
|
||||
this, &GerritPushDialog::validate);
|
||||
|
||||
updateCommits(m_ui->localBranchComboBox->currentIndex());
|
||||
updateCommits(m_localBranchComboBox->currentIndex());
|
||||
onRemoteChanged(true);
|
||||
|
||||
QRegularExpressionValidator *noSpaceValidator = new QRegularExpressionValidator(QRegularExpression("^\\S+$"), this);
|
||||
m_ui->reviewersLineEdit->setText(reviewerList);
|
||||
m_ui->reviewersLineEdit->setValidator(noSpaceValidator);
|
||||
m_ui->topicLineEdit->setValidator(noSpaceValidator);
|
||||
m_ui->wipCheckBox->setCheckState(Qt::PartiallyChecked);
|
||||
m_reviewersLineEdit->setText(reviewerList);
|
||||
m_reviewersLineEdit->setValidator(noSpaceValidator);
|
||||
m_topicLineEdit->setValidator(noSpaceValidator);
|
||||
m_wipCheckBox->setCheckState(Qt::PartiallyChecked);
|
||||
|
||||
connect(m_ui->remoteComboBox, &GerritRemoteChooser::remoteChanged,
|
||||
connect(m_remoteComboBox, &GerritRemoteChooser::remoteChanged,
|
||||
this, [this] { onRemoteChanged(); });
|
||||
}
|
||||
|
||||
GerritPushDialog::~GerritPushDialog()
|
||||
{
|
||||
delete m_ui;
|
||||
resize(740, 410);
|
||||
}
|
||||
|
||||
QString GerritPushDialog::selectedCommit() const
|
||||
{
|
||||
return m_ui->commitView->commit();
|
||||
return m_commitView->commit();
|
||||
}
|
||||
|
||||
QString GerritPushDialog::calculateChangeRange(const QString &branch)
|
||||
@@ -176,20 +210,20 @@ QString GerritPushDialog::calculateChangeRange(const QString &branch)
|
||||
|
||||
void GerritPushDialog::setChangeRange()
|
||||
{
|
||||
if (m_ui->targetBranchComboBox->itemData(m_ui->targetBranchComboBox->currentIndex()) == 1) {
|
||||
if (m_targetBranchComboBox->itemData(m_targetBranchComboBox->currentIndex()) == 1) {
|
||||
setRemoteBranches(true);
|
||||
return;
|
||||
}
|
||||
const QString remoteBranchName = selectedRemoteBranchName();
|
||||
if (remoteBranchName.isEmpty())
|
||||
return;
|
||||
const QString branch = m_ui->localBranchComboBox->currentText();
|
||||
const QString branch = m_localBranchComboBox->currentText();
|
||||
const QString range = calculateChangeRange(branch);
|
||||
if (range.isEmpty()) {
|
||||
m_ui->infoLabel->hide();
|
||||
m_infoLabel->hide();
|
||||
return;
|
||||
}
|
||||
m_ui->infoLabel->show();
|
||||
m_infoLabel->show();
|
||||
const QString remote = selectedRemoteName() + '/' + remoteBranchName;
|
||||
QString labelText = Git::Tr::tr("Number of commits between %1 and %2: %3").arg(branch, remote, range);
|
||||
const int currentRange = range.toInt();
|
||||
@@ -200,9 +234,9 @@ void GerritPushDialog::setChangeRange()
|
||||
palette.setColor(QPalette::ButtonText, errorColor);
|
||||
labelText.append("\n" + Git::Tr::tr("Are you sure you selected the right target branch?"));
|
||||
}
|
||||
m_ui->infoLabel->setPalette(palette);
|
||||
m_ui->targetBranchComboBox->setPalette(palette);
|
||||
m_ui->infoLabel->setText(labelText);
|
||||
m_infoLabel->setPalette(palette);
|
||||
m_targetBranchComboBox->setPalette(palette);
|
||||
m_infoLabel->setText(labelText);
|
||||
}
|
||||
|
||||
static bool versionSupportsWip(const QString &version)
|
||||
@@ -213,36 +247,36 @@ static bool versionSupportsWip(const QString &version)
|
||||
void GerritPushDialog::onRemoteChanged(bool force)
|
||||
{
|
||||
setRemoteBranches();
|
||||
const QString version = m_ui->remoteComboBox->currentServer().version;
|
||||
const QString remote = m_ui->remoteComboBox->currentRemoteName();
|
||||
const QString version = m_remoteComboBox->currentServer().version;
|
||||
const QString remote = m_remoteComboBox->currentRemoteName();
|
||||
|
||||
m_ui->commitView->setExcludedRemote(remote);
|
||||
const QString branch = m_ui->localBranchComboBox->itemText(m_ui->localBranchComboBox->currentIndex());
|
||||
m_hasLocalCommits = m_ui->commitView->init(m_workingDir, branch, LogChangeWidget::Silent);
|
||||
m_commitView->setExcludedRemote(remote);
|
||||
const QString branch = m_localBranchComboBox->itemText(m_localBranchComboBox->currentIndex());
|
||||
m_hasLocalCommits = m_commitView->init(m_workingDir, branch, LogChangeWidget::Silent);
|
||||
validate();
|
||||
|
||||
const bool supportsWip = versionSupportsWip(version);
|
||||
if (!force && supportsWip == m_currentSupportsWip)
|
||||
return;
|
||||
m_currentSupportsWip = supportsWip;
|
||||
m_ui->wipCheckBox->setEnabled(supportsWip);
|
||||
m_wipCheckBox->setEnabled(supportsWip);
|
||||
if (supportsWip) {
|
||||
m_ui->wipCheckBox->setToolTip(Git::Tr::tr("Checked - Mark change as WIP.\n"
|
||||
"Unchecked - Mark change as ready for review.\n"
|
||||
"Partially checked - Do not change current state."));
|
||||
m_ui->draftCheckBox->setTristate(true);
|
||||
if (m_ui->draftCheckBox->checkState() != Qt::Checked)
|
||||
m_ui->draftCheckBox->setCheckState(Qt::PartiallyChecked);
|
||||
m_ui->draftCheckBox->setToolTip(Git::Tr::tr("Checked - Mark change as private.\n"
|
||||
"Unchecked - Remove mark.\n"
|
||||
"Partially checked - Do not change current state."));
|
||||
m_wipCheckBox->setToolTip(Git::Tr::tr("Checked - Mark change as WIP.\n"
|
||||
"Unchecked - Mark change as ready for review.\n"
|
||||
"Partially checked - Do not change current state."));
|
||||
m_draftCheckBox->setTristate(true);
|
||||
if (m_draftCheckBox->checkState() != Qt::Checked)
|
||||
m_draftCheckBox->setCheckState(Qt::PartiallyChecked);
|
||||
m_draftCheckBox->setToolTip(Git::Tr::tr("Checked - Mark change as private.\n"
|
||||
"Unchecked - Remove mark.\n"
|
||||
"Partially checked - Do not change current state."));
|
||||
} else {
|
||||
m_ui->wipCheckBox->setToolTip(Git::Tr::tr("Supported on Gerrit 2.15 and later."));
|
||||
m_ui->draftCheckBox->setTristate(false);
|
||||
if (m_ui->draftCheckBox->checkState() != Qt::Checked)
|
||||
m_ui->draftCheckBox->setCheckState(Qt::Unchecked);
|
||||
m_ui->draftCheckBox->setToolTip(Git::Tr::tr("Checked - The change is a draft.\n"
|
||||
"Unchecked - The change is not a draft."));
|
||||
m_wipCheckBox->setToolTip(Git::Tr::tr("Supported on Gerrit 2.15 and later."));
|
||||
m_draftCheckBox->setTristate(false);
|
||||
if (m_draftCheckBox->checkState() != Qt::Checked)
|
||||
m_draftCheckBox->setCheckState(Qt::Unchecked);
|
||||
m_draftCheckBox->setToolTip(Git::Tr::tr("Checked - The change is a draft.\n"
|
||||
"Unchecked - The change is not a draft."));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -258,10 +292,10 @@ QString GerritPushDialog::pushTarget() const
|
||||
if (target.isEmpty())
|
||||
target = "HEAD";
|
||||
target += ":refs/";
|
||||
if (versionSupportsWip(m_ui->remoteComboBox->currentServer().version)) {
|
||||
if (versionSupportsWip(m_remoteComboBox->currentServer().version)) {
|
||||
target += "for";
|
||||
const Qt::CheckState draftState = m_ui->draftCheckBox->checkState();
|
||||
const Qt::CheckState wipState = m_ui->wipCheckBox->checkState();
|
||||
const Qt::CheckState draftState = m_draftCheckBox->checkState();
|
||||
const Qt::CheckState wipState = m_wipCheckBox->checkState();
|
||||
if (draftState == Qt::Checked)
|
||||
options << "private";
|
||||
else if (draftState == Qt::Unchecked)
|
||||
@@ -272,7 +306,7 @@ QString GerritPushDialog::pushTarget() const
|
||||
else if (wipState == Qt::Unchecked)
|
||||
options << "ready";
|
||||
} else {
|
||||
target += QLatin1String(m_ui->draftCheckBox->isChecked() ? "drafts" : "for");
|
||||
target += QLatin1String(m_draftCheckBox->isChecked() ? "drafts" : "for");
|
||||
}
|
||||
target += '/' + selectedRemoteBranchName();
|
||||
const QString topic = selectedTopic();
|
||||
@@ -290,7 +324,7 @@ QString GerritPushDialog::pushTarget() const
|
||||
|
||||
void GerritPushDialog::storeTopic()
|
||||
{
|
||||
const QString branch = m_ui->localBranchComboBox->currentText();
|
||||
const QString branch = m_localBranchComboBox->currentText();
|
||||
GitClient::instance()->setConfigValue(
|
||||
m_workingDir, QString("branch.%1.topic").arg(branch), selectedTopic());
|
||||
}
|
||||
@@ -298,8 +332,8 @@ void GerritPushDialog::storeTopic()
|
||||
void GerritPushDialog::setRemoteBranches(bool includeOld)
|
||||
{
|
||||
{
|
||||
QSignalBlocker blocker(m_ui->targetBranchComboBox);
|
||||
m_ui->targetBranchComboBox->clear();
|
||||
QSignalBlocker blocker(m_targetBranchComboBox);
|
||||
m_targetBranchComboBox->clear();
|
||||
|
||||
const QString remoteName = selectedRemoteName();
|
||||
if (!m_remoteBranches.contains(remoteName)) {
|
||||
@@ -308,10 +342,10 @@ void GerritPushDialog::setRemoteBranches(bool includeOld)
|
||||
for (const QString &branch : remoteBranches)
|
||||
m_remoteBranches.insertMulti(remoteName, {branch, {}});
|
||||
if (remoteBranches.isEmpty()) {
|
||||
m_ui->targetBranchComboBox->setEditable(true);
|
||||
m_ui->targetBranchComboBox->setToolTip(
|
||||
Git::Tr::tr("No remote branches found. This is probably the initial commit."));
|
||||
if (QLineEdit *lineEdit = m_ui->targetBranchComboBox->lineEdit())
|
||||
m_targetBranchComboBox->setEditable(true);
|
||||
m_targetBranchComboBox->setToolTip(
|
||||
Git::Tr::tr("No remote branches found. This is probably the initial commit."));
|
||||
if (QLineEdit *lineEdit = m_targetBranchComboBox->lineEdit())
|
||||
lineEdit->setPlaceholderText(Git::Tr::tr("Branch name"));
|
||||
}
|
||||
}
|
||||
@@ -323,16 +357,16 @@ void GerritPushDialog::setRemoteBranches(bool includeOld)
|
||||
const bool isSuggested = bd.first == m_suggestedRemoteBranch;
|
||||
if (includeOld || isSuggested || !bd.second.isValid()
|
||||
|| bd.second.daysTo(QDate::currentDate()) <= Git::Constants::OBSOLETE_COMMIT_AGE_IN_DAYS) {
|
||||
m_ui->targetBranchComboBox->addItem(bd.first);
|
||||
m_targetBranchComboBox->addItem(bd.first);
|
||||
if (isSuggested)
|
||||
m_ui->targetBranchComboBox->setCurrentIndex(i);
|
||||
m_targetBranchComboBox->setCurrentIndex(i);
|
||||
++i;
|
||||
} else {
|
||||
excluded = true;
|
||||
}
|
||||
}
|
||||
if (excluded)
|
||||
m_ui->targetBranchComboBox->addItem(Git::Tr::tr("... Include older branches ..."), 1);
|
||||
m_targetBranchComboBox->addItem(Git::Tr::tr("... Include older branches ..."), 1);
|
||||
setChangeRange();
|
||||
}
|
||||
validate();
|
||||
@@ -340,12 +374,12 @@ void GerritPushDialog::setRemoteBranches(bool includeOld)
|
||||
|
||||
void GerritPushDialog::updateCommits(int index)
|
||||
{
|
||||
const QString branch = m_ui->localBranchComboBox->itemText(index);
|
||||
m_hasLocalCommits = m_ui->commitView->init(m_workingDir, branch, LogChangeWidget::Silent);
|
||||
const QString branch = m_localBranchComboBox->itemText(index);
|
||||
m_hasLocalCommits = m_commitView->init(m_workingDir, branch, LogChangeWidget::Silent);
|
||||
QString topic = GitClient::instance()->readConfigValue(
|
||||
m_workingDir, QString("branch.%1.topic").arg(branch));
|
||||
if (!topic.isEmpty())
|
||||
m_ui->topicLineEdit->setText(topic);
|
||||
m_topicLineEdit->setText(topic);
|
||||
|
||||
const QString remoteBranch = determineRemoteBranch(branch);
|
||||
if (!remoteBranch.isEmpty()) {
|
||||
@@ -354,7 +388,7 @@ void GerritPushDialog::updateCommits(int index)
|
||||
m_suggestedRemoteBranch = remoteBranch.mid(slash + 1);
|
||||
const QString remote = remoteBranch.left(slash);
|
||||
|
||||
if (!m_ui->remoteComboBox->setCurrentRemote(remote))
|
||||
if (!m_remoteComboBox->setCurrentRemote(remote))
|
||||
onRemoteChanged();
|
||||
}
|
||||
validate();
|
||||
@@ -363,27 +397,27 @@ void GerritPushDialog::updateCommits(int index)
|
||||
void GerritPushDialog::validate()
|
||||
{
|
||||
const bool valid = m_hasLocalCommits && !selectedRemoteBranchName().isEmpty();
|
||||
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(valid);
|
||||
m_buttonBox->button(QDialogButtonBox::Ok)->setEnabled(valid);
|
||||
}
|
||||
|
||||
QString GerritPushDialog::selectedRemoteName() const
|
||||
{
|
||||
return m_ui->remoteComboBox->currentRemoteName();
|
||||
return m_remoteComboBox->currentRemoteName();
|
||||
}
|
||||
|
||||
QString GerritPushDialog::selectedRemoteBranchName() const
|
||||
{
|
||||
return m_ui->targetBranchComboBox->currentText();
|
||||
return m_targetBranchComboBox->currentText();
|
||||
}
|
||||
|
||||
QString GerritPushDialog::selectedTopic() const
|
||||
{
|
||||
return m_ui->topicLineEdit->text().trimmed();
|
||||
return m_topicLineEdit->text().trimmed();
|
||||
}
|
||||
|
||||
QString GerritPushDialog::reviewers() const
|
||||
{
|
||||
return m_ui->reviewersLineEdit->text();
|
||||
return m_reviewersLineEdit->text();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -10,16 +10,22 @@
|
||||
#include <QDate>
|
||||
#include <QSharedPointer>
|
||||
|
||||
namespace Git {
|
||||
namespace Internal { class GitClient; }
|
||||
}
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QCheckBox;
|
||||
class QComboBox;
|
||||
class QDialogButtonBox;
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace Git::Internal { class LogChangeWidget; }
|
||||
|
||||
namespace Gerrit {
|
||||
namespace Internal {
|
||||
|
||||
class BranchComboBox;
|
||||
class GerritParameters;
|
||||
|
||||
namespace Ui { class GerritPushDialog; }
|
||||
class GerritRemoteChooser;
|
||||
|
||||
class GerritPushDialog : public QDialog
|
||||
{
|
||||
@@ -28,7 +34,6 @@ class GerritPushDialog : public QDialog
|
||||
public:
|
||||
GerritPushDialog(const Utils::FilePath &workingDir, const QString &reviewerList,
|
||||
QSharedPointer<GerritParameters> parameters, QWidget *parent);
|
||||
~GerritPushDialog() override;
|
||||
|
||||
QString selectedCommit() const;
|
||||
QString selectedRemoteName() const;
|
||||
@@ -52,10 +57,21 @@ private:
|
||||
QString determineRemoteBranch(const QString &localBranch);
|
||||
void initRemoteBranches();
|
||||
QString calculateChangeRange(const QString &branch);
|
||||
|
||||
BranchComboBox *m_localBranchComboBox;
|
||||
Gerrit::Internal::GerritRemoteChooser *m_remoteComboBox;
|
||||
QComboBox *m_targetBranchComboBox;
|
||||
Git::Internal::LogChangeWidget *m_commitView;
|
||||
QLabel *m_infoLabel;
|
||||
QLineEdit *m_topicLineEdit;
|
||||
QCheckBox *m_draftCheckBox;
|
||||
QCheckBox *m_wipCheckBox;
|
||||
QLineEdit *m_reviewersLineEdit;
|
||||
QDialogButtonBox *m_buttonBox;
|
||||
|
||||
Utils::FilePath m_workingDir;
|
||||
QString m_suggestedRemoteBranch;
|
||||
QString m_initErrorMessage;
|
||||
Ui::GerritPushDialog *m_ui;
|
||||
RemoteBranchesMap m_remoteBranches;
|
||||
bool m_hasLocalCommits = false;
|
||||
bool m_currentSupportsWip = false;
|
||||
|
@@ -1,272 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Gerrit::Internal::GerritPushDialog</class>
|
||||
<widget class="QDialog" name="Gerrit::Internal::GerritPushDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>740</width>
|
||||
<height>410</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Push to Gerrit</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout" columnstretch="0,10,10">
|
||||
<item row="2" column="2">
|
||||
<widget class="QComboBox" name="targetBranchComboBox"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>6</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="9" column="0">
|
||||
<widget class="QLabel" name="reviewersLabel">
|
||||
<property name="text">
|
||||
<string>&Reviewers:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>reviewersLineEdit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="10" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>6</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="11" column="0" colspan="3">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="8" column="1" colspan="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="topicLineEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="draftCheckBox">
|
||||
<property name="toolTip">
|
||||
<string>Checked - Mark change as private.
|
||||
Unchecked - Remove mark.
|
||||
Partially checked - Do not change current state.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Draft/private</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="wipCheckBox">
|
||||
<property name="text">
|
||||
<string>&Work-in-progress</string>
|
||||
</property>
|
||||
<property name="tristate">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="3">
|
||||
<widget class="Git::Internal::LogChangeWidget" name="commitView">
|
||||
<property name="toolTip">
|
||||
<string>Pushes the selected commit and all dependent commits.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0">
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>6</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="8" column="0">
|
||||
<widget class="QLabel" name="topicLabel">
|
||||
<property name="text">
|
||||
<string>&Topic:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>topicLineEdit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<spacer name="verticalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>6</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="localBranchLabel">
|
||||
<property name="text">
|
||||
<string>Push:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>localBranchComboBox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="3">
|
||||
<widget class="QLabel" name="commitHeadingLabel">
|
||||
<property name="text">
|
||||
<string>Commits:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="repositoryLabel">
|
||||
<property name="text">
|
||||
<string>Local repository</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="BranchComboBox" name="localBranchComboBox"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="remoteLabel">
|
||||
<property name="text">
|
||||
<string>To:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>remoteComboBox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="Gerrit::Internal::GerritRemoteChooser" name="remoteComboBox" native="true"/>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="3">
|
||||
<widget class="QLabel" name="infoLabel">
|
||||
<property name="text">
|
||||
<string>Number of commits</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="9" column="1" colspan="2">
|
||||
<widget class="QLineEdit" name="reviewersLineEdit">
|
||||
<property name="toolTip">
|
||||
<string>Comma-separated list of reviewers.
|
||||
|
||||
Reviewers can be specified by nickname or email address. Spaces not allowed.
|
||||
|
||||
Partial names can be used if they are unambiguous.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>Git::Internal::LogChangeWidget</class>
|
||||
<extends>QTreeView</extends>
|
||||
<header location="global">git/logchangedialog.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>BranchComboBox</class>
|
||||
<extends>QComboBox</extends>
|
||||
<header location="global">git/gerrit/branchcombobox.h</header>
|
||||
</customwidget>
|
||||
<customwidget>
|
||||
<class>Gerrit::Internal::GerritRemoteChooser</class>
|
||||
<extends>QWidget</extends>
|
||||
<header location="global">git/gerrit/gerritremotechooser.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>localBranchComboBox</tabstop>
|
||||
<tabstop>remoteComboBox</tabstop>
|
||||
<tabstop>targetBranchComboBox</tabstop>
|
||||
<tabstop>commitView</tabstop>
|
||||
<tabstop>topicLineEdit</tabstop>
|
||||
<tabstop>draftCheckBox</tabstop>
|
||||
<tabstop>reviewersLineEdit</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>Gerrit::Internal::GerritPushDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>227</x>
|
||||
<y>330</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>Gerrit::Internal::GerritPushDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>295</x>
|
||||
<y>336</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
@@ -85,7 +85,6 @@ QtcPlugin {
|
||||
"gerritserver.h",
|
||||
"gerritpushdialog.cpp",
|
||||
"gerritpushdialog.h",
|
||||
"gerritpushdialog.ui",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user