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
@@ -316,6 +316,7 @@ bool BranchView::add()
|
||||
BranchAddDialog branchAddDialog(localNames, true, this);
|
||||
branchAddDialog.setBranchName(suggestedName);
|
||||
branchAddDialog.setTrackedBranchName(isTracked ? trackedBranch : QString(), !isLocal);
|
||||
branchAddDialog.setCheckoutVisible(true);
|
||||
|
||||
if (branchAddDialog.exec() == QDialog::Accepted) {
|
||||
QModelIndex idx = m_model->addBranch(branchAddDialog.branchName(), branchAddDialog.track(),
|
||||
@@ -328,10 +329,8 @@ bool BranchView::add()
|
||||
| QItemSelectionModel::Select
|
||||
| QItemSelectionModel::Current);
|
||||
m_branchView->scrollTo(mappedIdx);
|
||||
if (QMessageBox::question(this, tr("Checkout"), tr("Checkout branch?"),
|
||||
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
|
||||
if (branchAddDialog.checkout())
|
||||
return checkout();
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user