diff options
author | Tobias Hunger <tobias.hunger@nokia.com> | 2011-05-30 12:14:49 +0000 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@nokia.com> | 2011-06-22 10:46:48 +0200 |
commit | 5f6a91e0095989b6f978cd2b347890110a101d33 (patch) | |
tree | d4bca1310157ceb58ee0b7ccaa3b8c9598affa41 /src/plugins/git/branchadddialog.cpp | |
parent | 9197596000763f1d6eed9c2a25b1605a6fbf8347 (diff) | |
download | qt-creator-5f6a91e0095989b6f978cd2b347890110a101d33.tar.gz |
Git: Rework branch dialog
* Make adding new branches more discoverable
* Make adding tracking branches more discoverable
* Update UI
Task-number: QTCREATORBUG-4943
Task-number: QTCREATORBUG-4944
Change-Id: Idcbf5f8321a3bd04c925e33d094bb479788a7d9b
Reviewed-on: http://codereview.qt.nokia.com/588
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
Diffstat (limited to 'src/plugins/git/branchadddialog.cpp')
-rw-r--r-- | src/plugins/git/branchadddialog.cpp | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/plugins/git/branchadddialog.cpp b/src/plugins/git/branchadddialog.cpp new file mode 100644 index 0000000000..64e2d32b2e --- /dev/null +++ b/src/plugins/git/branchadddialog.cpp @@ -0,0 +1,47 @@ +#include "branchadddialog.h" +#include "ui_branchadddialog.h" + +namespace Git { +namespace Internal { + +BranchAddDialog::BranchAddDialog(QWidget *parent) : + QDialog(parent), + m_ui(new Ui::BranchAddDialog) +{ + m_ui->setupUi(this); +} + +BranchAddDialog::~BranchAddDialog() +{ + delete m_ui; +} + +void BranchAddDialog::setBranchName(const QString &n) +{ + m_ui->branchNameEdit->setText(n); + m_ui->branchNameEdit->selectAll(); +} + +QString BranchAddDialog::branchName() const +{ + return m_ui->branchNameEdit->text(); +} + +void BranchAddDialog::setTrackedBranchName(const QString &name, bool remote) +{ + m_ui->trackingCheckBox->setVisible(true); + if (!name.isEmpty()) + m_ui->trackingCheckBox->setText(remote ? tr("Track remote branch \'%1\'").arg(name) : + tr("Track local branch \'%1\'").arg(name)); + else + m_ui->trackingCheckBox->setVisible(false); + m_ui->trackingCheckBox->setChecked(remote); +} + +bool BranchAddDialog::track() +{ + return m_ui->trackingCheckBox->isVisible() && m_ui->trackingCheckBox->isChecked(); +} + +} // namespace Internal +} // namespace Git |