BranchAddDialog: Simplify a bit

* Remove redundant "Checkbox" translatable string.
* Hide "Track remote" checkbox by default.

Change-Id: Iec72d035e7b5493b320f8c21dd2f1b90eed0b5e6
Reviewed-by: André Hartmann <aha_1980@gmx.de>
This commit is contained in:
Orgad Shaneh
2019-04-02 14:33:32 +03:00
committed by Orgad Shaneh
parent 9d5e38dbbb
commit acbd1d006c
2 changed files with 8 additions and 11 deletions

View File

@@ -110,6 +110,7 @@ BranchAddDialog::BranchAddDialog(const QStringList &localBranches, bool addBranc
m_ui(new Ui::BranchAddDialog) m_ui(new Ui::BranchAddDialog)
{ {
m_ui->setupUi(this); m_ui->setupUi(this);
m_ui->trackingCheckBox->setVisible(false);
setCheckoutVisible(false); setCheckoutVisible(false);
setWindowTitle(addBranch ? tr("Add Branch") : tr("Rename Branch")); setWindowTitle(addBranch ? tr("Add Branch") : tr("Rename Branch"));
m_ui->branchNameEdit->setValidator(new BranchNameValidator(localBranches, this)); m_ui->branchNameEdit->setValidator(new BranchNameValidator(localBranches, this));
@@ -134,14 +135,14 @@ QString BranchAddDialog::branchName() const
void BranchAddDialog::setTrackedBranchName(const QString &name, bool remote) void BranchAddDialog::setTrackedBranchName(const QString &name, bool remote)
{ {
m_ui->trackingCheckBox->setVisible(true); if (name.isEmpty()) {
if (!name.isEmpty()) {
m_ui->trackingCheckBox->setText(remote ? tr("Track remote branch \'%1\'").arg(name) :
tr("Track local branch \'%1\'").arg(name));
m_ui->trackingCheckBox->setChecked(remote);
} else {
m_ui->trackingCheckBox->setVisible(false); m_ui->trackingCheckBox->setVisible(false);
m_ui->trackingCheckBox->setChecked(false); m_ui->trackingCheckBox->setChecked(false);
} else {
m_ui->trackingCheckBox->setText(remote ? tr("Track remote branch \"%1\"").arg(name) :
tr("Track local branch \"%1\"").arg(name));
m_ui->trackingCheckBox->setVisible(true);
m_ui->trackingCheckBox->setChecked(remote);
} }
} }

View File

@@ -32,11 +32,7 @@
</widget> </widget>
</item> </item>
<item row="2" column="0" colspan="2"> <item row="2" column="0" colspan="2">
<widget class="QCheckBox" name="trackingCheckBox"> <widget class="QCheckBox" name="trackingCheckBox"/>
<property name="text">
<string>CheckBox</string>
</property>
</widget>
</item> </item>
<item row="4" column="0" colspan="2"> <item row="4" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBox"> <widget class="QDialogButtonBox" name="buttonBox">