Fix issues in AndroidDeployQtWidget

- Use PathChooser
- Fix setting of CheckBox
- Fix button labels

Change-Id: I7acde4161370ff4c3d9a91b1175f3a3681fdea55
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
This commit is contained in:
Robert Loehning
2014-02-18 15:59:18 +01:00
committed by Daniel Teske
parent 7c7d26da8b
commit 321a5614d8
3 changed files with 26 additions and 28 deletions

View File

@@ -41,6 +41,8 @@
#include <qmakeprojectmanager/qmakebuildconfiguration.h> #include <qmakeprojectmanager/qmakebuildconfiguration.h>
#include <qmakeprojectmanager/qmakeproject.h> #include <qmakeprojectmanager/qmakeproject.h>
#include <qmakeprojectmanager/qmakenodes.h> #include <qmakeprojectmanager/qmakenodes.h>
#include <utils/fancylineedit.h>
#include <utils/pathchooser.h>
#include <QFileDialog> #include <QFileDialog>
@@ -83,7 +85,12 @@ AndroidDeployQtWidget::AndroidDeployQtWidget(AndroidDeployQtStep *step)
// signing // signing
m_ui->signPackageCheckBox->setChecked(m_step->signPackage()); m_ui->signPackageCheckBox->setChecked(m_step->signPackage());
m_ui->KeystoreLocationLineEdit->setText(m_step->keystorePath().toUserOutput()); m_ui->KeystoreLocationPathChooser->setExpectedKind(Utils::PathChooser::File);
m_ui->KeystoreLocationPathChooser->lineEdit()->setReadOnly(true);
m_ui->KeystoreLocationPathChooser->setPath(m_step->keystorePath().toUserOutput());
m_ui->KeystoreLocationPathChooser->setInitialBrowsePathBackup(QDir::homePath());
m_ui->KeystoreLocationPathChooser->setPromptDialogFilter(tr("Keystore files (*.keystore *.jks)"));
m_ui->KeystoreLocationPathChooser->setPromptDialogTitle(tr("Select keystore file"));
m_ui->signingDebugWarningIcon->hide(); m_ui->signingDebugWarningIcon->hide();
m_ui->signingDebugWarningLabel->hide(); m_ui->signingDebugWarningLabel->hide();
signPackageCheckBoxToggled(m_step->signPackage()); signPackageCheckBoxToggled(m_step->signPackage());
@@ -116,8 +123,8 @@ AndroidDeployQtWidget::AndroidDeployQtWidget(AndroidDeployQtStep *step)
this, SLOT(signPackageCheckBoxToggled(bool))); this, SLOT(signPackageCheckBoxToggled(bool)));
connect(m_ui->KeystoreCreatePushButton, SIGNAL(clicked()), connect(m_ui->KeystoreCreatePushButton, SIGNAL(clicked()),
this, SLOT(createKeyStore())); this, SLOT(createKeyStore()));
connect(m_ui->KeystoreLocationPushButton, SIGNAL(clicked()), connect(m_ui->KeystoreLocationPathChooser, SIGNAL(pathChanged(QString)),
this, SLOT(browseKeyStore())); SLOT(updateKeyStorePath(QString)));
connect(m_ui->certificatesAliasComboBox, SIGNAL(activated(QString)), connect(m_ui->certificatesAliasComboBox, SIGNAL(activated(QString)),
this, SLOT(certificatesAliasComboBoxActivated(QString))); this, SLOT(certificatesAliasComboBoxActivated(QString)));
connect(m_ui->certificatesAliasComboBox, SIGNAL(currentIndexChanged(QString)), connect(m_ui->certificatesAliasComboBox, SIGNAL(currentIndexChanged(QString)),
@@ -269,7 +276,7 @@ void AndroidDeployQtWidget::createKeyStore()
AndroidCreateKeystoreCertificate d; AndroidCreateKeystoreCertificate d;
if (d.exec() != QDialog::Accepted) if (d.exec() != QDialog::Accepted)
return; return;
m_ui->KeystoreLocationLineEdit->setText(d.keystoreFilePath().toUserOutput()); m_ui->KeystoreLocationPathChooser->setPath(d.keystoreFilePath().toUserOutput());
m_step->setKeystorePath(d.keystoreFilePath()); m_step->setKeystorePath(d.keystoreFilePath());
m_step->setKeystorePassword(d.keystorePassword()); m_step->setKeystorePassword(d.keystorePassword());
m_step->setCertificateAlias(d.certificateAlias()); m_step->setCertificateAlias(d.certificateAlias());
@@ -284,17 +291,11 @@ void AndroidDeployQtWidget::setCertificates()
m_ui->certificatesAliasComboBox->setModel(certificates); m_ui->certificatesAliasComboBox->setModel(certificates);
} }
void AndroidDeployQtWidget::browseKeyStore() void AndroidDeployQtWidget::updateKeyStorePath(const QString &path)
{ {
Utils::FileName keystorePath = m_step->keystorePath(); Utils::FileName file = Utils::FileName::fromString(path);
if (keystorePath.isEmpty())
keystorePath = Utils::FileName::fromString(QDir::homePath());
Utils::FileName file = Utils::FileName::fromString(QFileDialog::getOpenFileName(this, tr("Select keystore file"), keystorePath.toString(), tr("Keystore files (*.keystore *.jks)")));
if (file.isEmpty())
return;
m_ui->KeystoreLocationLineEdit->setText(file.toUserOutput());
m_step->setKeystorePath(file); m_step->setKeystorePath(file);
m_ui->signPackageCheckBox->setChecked(false); m_ui->signPackageCheckBox->setChecked(!file.isEmpty());
} }
void AndroidDeployQtWidget::certificatesAliasComboBoxActivated(const QString &alias) void AndroidDeployQtWidget::certificatesAliasComboBoxActivated(const QString &alias)

View File

@@ -67,7 +67,7 @@ private slots:
void updateSigningWarning(); void updateSigningWarning();
void openPackageLocationCheckBoxToggled(bool checked); void openPackageLocationCheckBoxToggled(bool checked);
void verboseOutputCheckBoxToggled(bool checked); void verboseOutputCheckBoxToggled(bool checked);
void browseKeyStore(); void updateKeyStorePath(const QString &path);
void signPackageCheckBoxToggled(bool checked); void signPackageCheckBoxToggled(bool checked);
void updateInputFileUi(); void updateInputFileUi();
void inputFileComboBoxIndexChanged(); void inputFileComboBoxIndexChanged();

View File

@@ -33,23 +33,12 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLineEdit" name="KeystoreLocationLineEdit"> <widget class="Utils::PathChooser" name="KeystoreLocationPathChooser" native="true"/>
<property name="readOnly">
<bool>true</bool>
</property>
</widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="KeystoreCreatePushButton"> <widget class="QPushButton" name="KeystoreCreatePushButton">
<property name="text"> <property name="text">
<string>Create</string> <string>Create...</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="KeystoreLocationPushButton">
<property name="text">
<string>Browse</string>
</property> </property>
</widget> </widget>
</item> </item>
@@ -338,7 +327,7 @@ The APK will not be usable on any other device.</string>
<string>Select library to include in package.</string> <string>Select library to include in package.</string>
</property> </property>
<property name="text"> <property name="text">
<string>Add</string> <string>Add...</string>
</property> </property>
<property name="toolButtonStyle"> <property name="toolButtonStyle">
<enum>Qt::ToolButtonTextOnly</enum> <enum>Qt::ToolButtonTextOnly</enum>
@@ -377,6 +366,14 @@ The APK will not be usable on any other device.</string>
</item> </item>
</layout> </layout>
</widget> </widget>
<customwidgets>
<customwidget>
<class>Utils::PathChooser</class>
<extends>QWidget</extends>
<header location="global">utils/pathchooser.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources> <resources>
<include location="../projectexplorer/projectexplorer.qrc"/> <include location="../projectexplorer/projectexplorer.qrc"/>
</resources> </resources>