From 321a5614d81c86b66a2637ad9e8812e2a9ae2df3 Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Tue, 18 Feb 2014 15:59:18 +0100 Subject: [PATCH] Fix issues in AndroidDeployQtWidget - Use PathChooser - Fix setting of CheckBox - Fix button labels Change-Id: I7acde4161370ff4c3d9a91b1175f3a3681fdea55 Reviewed-by: Daniel Teske --- src/plugins/android/androiddeployqtwidget.cpp | 27 ++++++++++--------- src/plugins/android/androiddeployqtwidget.h | 2 +- src/plugins/android/androiddeployqtwidget.ui | 25 ++++++++--------- 3 files changed, 26 insertions(+), 28 deletions(-) diff --git a/src/plugins/android/androiddeployqtwidget.cpp b/src/plugins/android/androiddeployqtwidget.cpp index cddeb62d033..74dd1e521f5 100644 --- a/src/plugins/android/androiddeployqtwidget.cpp +++ b/src/plugins/android/androiddeployqtwidget.cpp @@ -41,6 +41,8 @@ #include #include #include +#include +#include #include @@ -83,7 +85,12 @@ AndroidDeployQtWidget::AndroidDeployQtWidget(AndroidDeployQtStep *step) // signing 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->signingDebugWarningLabel->hide(); signPackageCheckBoxToggled(m_step->signPackage()); @@ -116,8 +123,8 @@ AndroidDeployQtWidget::AndroidDeployQtWidget(AndroidDeployQtStep *step) this, SLOT(signPackageCheckBoxToggled(bool))); connect(m_ui->KeystoreCreatePushButton, SIGNAL(clicked()), this, SLOT(createKeyStore())); - connect(m_ui->KeystoreLocationPushButton, SIGNAL(clicked()), - this, SLOT(browseKeyStore())); + connect(m_ui->KeystoreLocationPathChooser, SIGNAL(pathChanged(QString)), + SLOT(updateKeyStorePath(QString))); connect(m_ui->certificatesAliasComboBox, SIGNAL(activated(QString)), this, SLOT(certificatesAliasComboBoxActivated(QString))); connect(m_ui->certificatesAliasComboBox, SIGNAL(currentIndexChanged(QString)), @@ -269,7 +276,7 @@ void AndroidDeployQtWidget::createKeyStore() AndroidCreateKeystoreCertificate d; if (d.exec() != QDialog::Accepted) return; - m_ui->KeystoreLocationLineEdit->setText(d.keystoreFilePath().toUserOutput()); + m_ui->KeystoreLocationPathChooser->setPath(d.keystoreFilePath().toUserOutput()); m_step->setKeystorePath(d.keystoreFilePath()); m_step->setKeystorePassword(d.keystorePassword()); m_step->setCertificateAlias(d.certificateAlias()); @@ -284,17 +291,11 @@ void AndroidDeployQtWidget::setCertificates() m_ui->certificatesAliasComboBox->setModel(certificates); } -void AndroidDeployQtWidget::browseKeyStore() +void AndroidDeployQtWidget::updateKeyStorePath(const QString &path) { - Utils::FileName keystorePath = m_step->keystorePath(); - 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()); + Utils::FileName file = Utils::FileName::fromString(path); m_step->setKeystorePath(file); - m_ui->signPackageCheckBox->setChecked(false); + m_ui->signPackageCheckBox->setChecked(!file.isEmpty()); } void AndroidDeployQtWidget::certificatesAliasComboBoxActivated(const QString &alias) diff --git a/src/plugins/android/androiddeployqtwidget.h b/src/plugins/android/androiddeployqtwidget.h index f4a28c0eeb3..f8b1edf66d0 100644 --- a/src/plugins/android/androiddeployqtwidget.h +++ b/src/plugins/android/androiddeployqtwidget.h @@ -67,7 +67,7 @@ private slots: void updateSigningWarning(); void openPackageLocationCheckBoxToggled(bool checked); void verboseOutputCheckBoxToggled(bool checked); - void browseKeyStore(); + void updateKeyStorePath(const QString &path); void signPackageCheckBoxToggled(bool checked); void updateInputFileUi(); void inputFileComboBoxIndexChanged(); diff --git a/src/plugins/android/androiddeployqtwidget.ui b/src/plugins/android/androiddeployqtwidget.ui index 180bccc3b77..d1fa06ddbf0 100644 --- a/src/plugins/android/androiddeployqtwidget.ui +++ b/src/plugins/android/androiddeployqtwidget.ui @@ -33,23 +33,12 @@ - - - true - - + - Create - - - - - - - Browse + Create... @@ -338,7 +327,7 @@ The APK will not be usable on any other device. Select library to include in package. - Add + Add... Qt::ToolButtonTextOnly @@ -377,6 +366,14 @@ The APK will not be usable on any other device. + + + Utils::PathChooser + QWidget +
utils/pathchooser.h
+ 1 +
+