forked from qt-creator/qt-creator
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>
This commit is contained in:
47
src/plugins/git/branchadddialog.cpp
Normal file
47
src/plugins/git/branchadddialog.cpp
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user