forked from qt-creator/qt-creator
Gerrit: Polish push to gerrit dialog
Make the UI a bit nicer and simplify the code to find remotes. Task-number: QTCREATORBUG-13718 Change-Id: I3b973fee30061232188c9aed3ad95abc8f8f095d Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
98ccd012af
commit
4caee9fcbf
@@ -121,15 +121,7 @@ void GerritPushDialog::initRemoteBranches()
|
||||
QStringList remotes = m_remoteBranches.keys();
|
||||
remotes.removeDuplicates();
|
||||
m_ui->remoteComboBox->addItems(remotes);
|
||||
const int remoteCount = m_ui->remoteComboBox->count();
|
||||
if (remoteCount < 1) {
|
||||
return;
|
||||
} else if (remoteCount == 1) {
|
||||
m_ui->remoteLabel->hide();
|
||||
m_ui->remoteComboBox->hide();
|
||||
} else {
|
||||
connect(m_ui->remoteComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setRemoteBranches()));
|
||||
}
|
||||
m_ui->remoteComboBox->setEnabled(remotes.count() > 1);
|
||||
}
|
||||
|
||||
GerritPushDialog::GerritPushDialog(const QString &workingDir, const QString &reviewerList, QWidget *parent) :
|
||||
@@ -141,8 +133,7 @@ GerritPushDialog::GerritPushDialog(const QString &workingDir, const QString &rev
|
||||
m_client = GitPlugin::instance()->gitClient();
|
||||
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
|
||||
m_ui->setupUi(this);
|
||||
m_ui->repositoryLabel->setText(tr("<b>Local repository:</b> %1").arg(
|
||||
QDir::toNativeSeparators(workingDir)));
|
||||
m_ui->repositoryLabel->setText(QDir::toNativeSeparators(workingDir));
|
||||
|
||||
PushItemDelegate *delegate = new PushItemDelegate(m_ui->commitView);
|
||||
delegate->setParent(this);
|
||||
@@ -153,10 +144,11 @@ GerritPushDialog::GerritPushDialog(const QString &workingDir, const QString &rev
|
||||
return;
|
||||
|
||||
m_ui->localBranchComboBox->init(workingDir);
|
||||
connect(m_ui->localBranchComboBox, SIGNAL(currentIndexChanged(int)),
|
||||
this, SLOT(updateCommits(int)));
|
||||
connect(m_ui->localBranchComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
this, &GerritPushDialog::updateCommits);
|
||||
|
||||
connect(m_ui->targetBranchComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setChangeRange()));
|
||||
connect(m_ui->targetBranchComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
this, &GerritPushDialog::setChangeRange);
|
||||
|
||||
updateCommits(m_ui->localBranchComboBox->currentIndex());
|
||||
setRemoteBranches();
|
||||
@@ -166,6 +158,9 @@ GerritPushDialog::GerritPushDialog(const QString &workingDir, const QString &rev
|
||||
m_ui->reviewersLineEdit->setValidator(noSpaceValidator);
|
||||
m_ui->topicLineEdit->setValidator(noSpaceValidator);
|
||||
|
||||
connect(m_ui->remoteComboBox, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
|
||||
this, &GerritPushDialog::setRemoteBranches);
|
||||
|
||||
m_isValid = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,162 +7,43 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>600</width>
|
||||
<height>520</height>
|
||||
<height>410</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Push to Gerrit</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>3</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="repositoryLabel">
|
||||
<property name="text">
|
||||
<string><b>Local repository:</b></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<layout class="QGridLayout" name="gridLayout" columnstretch="0,10,10">
|
||||
<item row="2" column="2">
|
||||
<widget class="QComboBox" name="targetBranchComboBox"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="destinationGroupBox">
|
||||
<property name="title">
|
||||
<string>Destination:</string>
|
||||
<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>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="localBranchLabel">
|
||||
<property name="text">
|
||||
<string>&Local branch:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>localBranchComboBox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="BranchComboBox" name="localBranchComboBox"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="remoteLabel">
|
||||
<property name="text">
|
||||
<string>R&emote:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>remoteComboBox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="remoteComboBox"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="targetBranchLabel">
|
||||
<property name="text">
|
||||
<string>Target &branch:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>targetBranchComboBox</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QComboBox" name="targetBranchComboBox"/>
|
||||
</item>
|
||||
<item row="4" 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="4" column="1">
|
||||
<widget class="QLineEdit" name="topicLineEdit"/>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QCheckBox" name="draftCheckBox">
|
||||
<property name="text">
|
||||
<string>&Draft</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0" colspan="2">
|
||||
<widget class="QLabel" name="infoLabel">
|
||||
<property name="text">
|
||||
<string>Number of commits</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="commitGroupBox">
|
||||
<property name="title">
|
||||
<string>&Push up to commit:</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="commitLayout">
|
||||
<item>
|
||||
<widget class="Git::Internal::LogChangeWidget" name="commitView">
|
||||
<property name="toolTip">
|
||||
<string>Pushes the selected commit and all dependent commits.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="reveiwersLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="reviewersLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Reviewers:</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>reviewersLineEdit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<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>
|
||||
</item>
|
||||
<item>
|
||||
<item row="10" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
@@ -175,7 +56,7 @@ Partial names can be used if they are unambiguous.</string>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<item row="11" column="0" colspan="3">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
@@ -185,6 +66,127 @@ Partial names can be used if they are unambiguous.</string>
|
||||
</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="text">
|
||||
<string>&Draft</string>
|
||||
</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="QComboBox" name="remoteComboBox"/>
|
||||
</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>
|
||||
|
||||
Reference in New Issue
Block a user