forked from qt-creator/qt-creator
Git: Allow direct checkout in add branch dialog
Avoid one modal message box by adding a checkbox in the dialog. In case the user misses to check the box, the branch can still be checked out later with the context menu action "checkout". Change-Id: I51262e694aad9f55511beefa0d8d23ea66429664 Reviewed-by: Orgad Shaneh <orgads@gmail.com> Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
This commit is contained in:
committed by
André Hartmann
parent
f4db8e9c6a
commit
e77729a05a
@@ -110,6 +110,7 @@ BranchAddDialog::BranchAddDialog(const QStringList &localBranches, bool addBranc
|
||||
m_ui(new Ui::BranchAddDialog)
|
||||
{
|
||||
m_ui->setupUi(this);
|
||||
setCheckoutVisible(false);
|
||||
setWindowTitle(addBranch ? tr("Add Branch") : tr("Rename Branch"));
|
||||
m_ui->branchNameEdit->setValidator(new BranchNameValidator(localBranches, this));
|
||||
connect(m_ui->branchNameEdit, &QLineEdit::textChanged, this, &BranchAddDialog::updateButtonStatus);
|
||||
@@ -149,6 +150,17 @@ bool BranchAddDialog::track() const
|
||||
return m_ui->trackingCheckBox->isChecked();
|
||||
}
|
||||
|
||||
void BranchAddDialog::setCheckoutVisible(bool visible)
|
||||
{
|
||||
m_ui->checkoutCheckBox->setVisible(visible);
|
||||
m_ui->checkoutCheckBox->setChecked(visible);
|
||||
}
|
||||
|
||||
bool BranchAddDialog::checkout() const
|
||||
{
|
||||
return m_ui->checkoutCheckBox->isChecked();
|
||||
}
|
||||
|
||||
/*! Updates the ok button enabled state of the dialog according to the validity of the branch name. */
|
||||
void BranchAddDialog::updateButtonStatus()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user