Polish the checkout wizard (base and git)

* Polish the base checkout wizard
    * Make UI easier to grasp
    * Add tooltips explaining things

Task-number: QTCREATORBUG-2540
Reviewed-by: Robert Loehning
This commit is contained in:
Tobias Hunger
2010-10-01 11:29:11 +02:00
parent e77a7b6657
commit 6b85c2d520
4 changed files with 160 additions and 71 deletions

View File

@@ -63,7 +63,8 @@ CloneWizardPage::CloneWizardPage(QWidget *parent) :
setSubTitle(tr("Specify repository URL, checkout directory and path.")); setSubTitle(tr("Specify repository URL, checkout directory and path."));
setRepositoryLabel(tr("Clone URL:")); setRepositoryLabel(tr("Clone URL:"));
d->deleteMasterCheckBox = new QCheckBox(tr("Delete master branch")); d->deleteMasterCheckBox = new QCheckBox(tr("Delete master branch"));
addControl(d->deleteMasterCheckBox); d->deleteMasterCheckBox->setToolTip(tr("Delete the master branch after checking out the repository."));
addLocalControl(d->deleteMasterCheckBox);
setDeleteMasterBranch(true); setDeleteMasterBranch(true);
} }

View File

@@ -53,6 +53,8 @@ BaseCheckoutWizardPage::BaseCheckoutWizardPage(QWidget *parent) :
connect(d->ui.checkoutDirectoryLineEdit, SIGNAL(validChanged()), connect(d->ui.checkoutDirectoryLineEdit, SIGNAL(validChanged()),
this, SLOT(slotChanged())); this, SLOT(slotChanged()));
connect(d->ui.checkoutDirectoryLineEdit, SIGNAL(textEdited(QString)), this, SLOT(slotDirectoryEdited())); connect(d->ui.checkoutDirectoryLineEdit, SIGNAL(textEdited(QString)), this, SLOT(slotDirectoryEdited()));
connect(d->ui.branchComboBox, SIGNAL(currentIndexChanged(int)),
this, SLOT(slotChanged()));
d->ui.pathChooser->setExpectedKind(Utils::PathChooser::Directory); d->ui.pathChooser->setExpectedKind(Utils::PathChooser::Directory);
connect(d->ui.pathChooser, SIGNAL(validChanged()), this, SLOT(slotChanged())); connect(d->ui.pathChooser, SIGNAL(validChanged()), this, SLOT(slotChanged()));
@@ -67,14 +69,31 @@ BaseCheckoutWizardPage::~BaseCheckoutWizardPage()
delete d; delete d;
} }
void BaseCheckoutWizardPage::addControl(QWidget *w) void BaseCheckoutWizardPage::addLocalControl(QWidget *w)
{ {
d->ui.formLayout->addRow(w); d->ui.localLayout->addRow(w);
} }
void BaseCheckoutWizardPage::addControl(QString &description, QWidget *w) void BaseCheckoutWizardPage::addLocalControl(QString &description, QWidget *w)
{ {
d->ui.formLayout->addRow(description, w); d->ui.localLayout->addRow(description, w);
}
void BaseCheckoutWizardPage::addRepositoryControl(QWidget *w)
{
d->ui.repositoryLayout->addRow(w);
}
bool BaseCheckoutWizardPage::checkIsValid() const
{
return d->ui.pathChooser->isValid()
&& d->ui.checkoutDirectoryLineEdit->isValid()
&& !d->ui.repositoryLineEdit->text().isEmpty();
}
void BaseCheckoutWizardPage::addRepositoryControl(QString &description, QWidget *w)
{
d->ui.repositoryLayout->addRow(description, w);
} }
bool BaseCheckoutWizardPage::isBranchSelectorVisible() const bool BaseCheckoutWizardPage::isBranchSelectorVisible() const
@@ -167,6 +186,7 @@ void BaseCheckoutWizardPage::slotRefreshBranches()
if (current >= 0 && current < branchList.size()) if (current >= 0 && current < branchList.size())
d->ui.branchComboBox->setCurrentIndex(current); d->ui.branchComboBox->setCurrentIndex(current);
} }
slotChanged();
} }
void BaseCheckoutWizardPage::slotRepositoryChanged(const QString &repo) void BaseCheckoutWizardPage::slotRepositoryChanged(const QString &repo)
@@ -212,9 +232,7 @@ bool BaseCheckoutWizardPage::isComplete() const
void BaseCheckoutWizardPage::slotChanged() void BaseCheckoutWizardPage::slotChanged()
{ {
const bool valid = d->ui.pathChooser->isValid() const bool valid = checkIsValid();
&& d->ui.checkoutDirectoryLineEdit->isValid()
&& !d->ui.repositoryLineEdit->text().isEmpty();
if (valid != d->m_valid) { if (valid != d->m_valid) {
d->m_valid = valid; d->m_valid = valid;

View File

@@ -71,7 +71,7 @@ public:
virtual bool isComplete() const; virtual bool isComplete() const;
bool isBranchSelectorVisible() const ; bool isBranchSelectorVisible() const;
protected: protected:
void changeEvent(QEvent *e); void changeEvent(QEvent *e);
@@ -88,8 +88,14 @@ protected:
virtual QStringList branches(const QString &repository, int *current); virtual QStringList branches(const QString &repository, int *current);
/* Add additional controls */ /* Add additional controls */
void addControl(QWidget *w); void addLocalControl(QWidget *w);
void addControl(QString &description, QWidget *w); void addLocalControl(QString &description, QWidget *w);
void addRepositoryControl(QWidget *w);
void addRepositoryControl(QString &description, QWidget *w);
/* Override validity information */
virtual bool checkIsValid() const;
private slots: private slots:
void slotRepositoryChanged(const QString &url); void slotRepositoryChanged(const QString &url);

View File

@@ -13,43 +13,40 @@
<property name="windowTitle"> <property name="windowTitle">
<string>WizardPage</string> <string>WizardPage</string>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<layout class="QFormLayout" name="formLayout"> <widget class="QGroupBox" name="repositoryGroupBox">
<property name="title">
<string>Repository</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<property name="checkable">
<bool>false</bool>
</property>
<layout class="QFormLayout" name="repositoryLayout">
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="repositoryLabel"/> <widget class="QLabel" name="repositoryLabel"/>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QLineEdit" name="repositoryLineEdit"/> <widget class="QLineEdit" name="repositoryLineEdit">
<property name="toolTip">
<string>The remote repository to check out.</string>
</property>
<property name="whatsThis">
<string/>
</property>
</widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="checkoutDirectoryLabel">
<property name="text">
<string>Checkout Directory:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="Utils::ProjectNameValidatingLineEdit" name="checkoutDirectoryLineEdit"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="pathLabel">
<property name="text">
<string>Path:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="Utils::PathChooser" name="pathChooser" native="true"/>
</item>
<item row="3" column="0">
<widget class="QLabel" name="branchLabel"> <widget class="QLabel" name="branchLabel">
<property name="text"> <property name="text">
<string>Branch:</string> <string>Branch:</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="1"> <item row="1" column="1">
<layout class="QHBoxLayout" name="branchHorizontalLayout"> <layout class="QHBoxLayout" name="branchHorizontalLayout">
<item> <item>
<widget class="QComboBox" name="branchComboBox"> <widget class="QComboBox" name="branchComboBox">
@@ -59,10 +56,19 @@
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="toolTip">
<string>The development branch in the remote repository to check out.</string>
</property>
<property name="whatsThis">
<string/>
</property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QToolButton" name="branchRefreshToolButton"> <widget class="QToolButton" name="branchRefreshToolButton">
<property name="toolTip">
<string>Retrieve list of branches in repository.</string>
</property>
<property name="text"> <property name="text">
<string>...</string> <string>...</string>
</property> </property>
@@ -71,6 +77,65 @@
</layout> </layout>
</item> </item>
</layout> </layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="localGroupBox">
<property name="title">
<string>Working Copy</string>
</property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QFormLayout" name="localLayout">
<item row="0" column="0">
<widget class="QLabel" name="pathLabel">
<property name="toolTip">
<string>The path in which the directory containing the checkout will be created.</string>
</property>
<property name="text">
<string>Checkout Path:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Utils::PathChooser" name="pathChooser"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="checkoutDirectoryLabel">
<property name="toolTip">
<string>The local directory that will contain the code after the checkout.</string>
</property>
<property name="text">
<string>Checkout Directory:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="Utils::ProjectNameValidatingLineEdit" name="checkoutDirectoryLineEdit">
<property name="toolTip">
<string>The local directory that will contain the code after the checkout.</string>
</property>
<property name="whatsThis">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
</item> </item>
</layout> </layout>
</widget> </widget>
@@ -82,9 +147,8 @@
</customwidget> </customwidget>
<customwidget> <customwidget>
<class>Utils::PathChooser</class> <class>Utils::PathChooser</class>
<extends>QWidget</extends> <extends>QLineEdit</extends>
<header location="global">utils/pathchooser.h</header> <header>utils/pathchooser.h</header>
<container>1</container>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources/> <resources/>