Android: Use Utils::InfoLabel in AndroidBuildApk*

Task-number: QTCREATORBUG-23346
Change-Id: Ie923d9e8f774613c1e9d0bb7dc1255acfce39cef
Reviewed-by: Vikas Pachdha <vikas.pachdha@qt.io>
This commit is contained in:
Alessandro Portale
2019-12-13 00:06:34 +01:00
parent f5b92c865b
commit b250c879af
3 changed files with 12 additions and 26 deletions

View File

@@ -50,9 +50,9 @@
#include <qtsupport/qtkitinformation.h> #include <qtsupport/qtkitinformation.h>
#include <utils/algorithm.h> #include <utils/algorithm.h>
#include <utils/infolabel.h>
#include <utils/qtcprocess.h> #include <utils/qtcprocess.h>
#include <utils/synchronousprocess.h> #include <utils/synchronousprocess.h>
#include <utils/utilsicons.h>
#include <QDateTime> #include <QDateTime>
#include <QDialogButtonBox> #include <QDialogButtonBox>
@@ -118,8 +118,8 @@ private:
std::function<bool (const QString &)> verifyCallback = [](const QString &) { return true; }; std::function<bool (const QString &)> verifyCallback = [](const QString &) { return true; };
QLabel *inputContextlabel = new QLabel(this); QLabel *inputContextlabel = new QLabel(this);
QLineEdit *inputEdit = new QLineEdit(this); QLineEdit *inputEdit = new QLineEdit(this);
QLabel *warningIcon = new QLabel(this); Utils::InfoLabel *warningLabel = new Utils::InfoLabel(tr("Incorrect password."),
QLabel *warningLabel = new QLabel(this); Utils::InfoLabel::Warning, this);
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel,
this); this);
}; };
@@ -633,20 +633,12 @@ PasswordInputDialog::PasswordInputDialog(PasswordInputDialog::Context context,
{ {
inputEdit->setEchoMode(QLineEdit::Password); inputEdit->setEchoMode(QLineEdit::Password);
warningIcon->setPixmap(Utils::Icons::WARNING.pixmap());
warningIcon->setSizePolicy(QSizePolicy(QSizePolicy::Maximum, QSizePolicy::Maximum));
warningIcon->hide();
warningLabel->hide(); warningLabel->hide();
auto warningLayout = new QHBoxLayout;
warningLayout->addWidget(warningIcon);
warningLayout->addWidget(warningLabel);
auto mainLayout = new QVBoxLayout(this); auto mainLayout = new QVBoxLayout(this);
mainLayout->addWidget(inputContextlabel); mainLayout->addWidget(inputContextlabel);
mainLayout->addWidget(inputEdit); mainLayout->addWidget(inputEdit);
mainLayout->addLayout(warningLayout); mainLayout->addWidget(warningLabel);
mainLayout->addWidget(buttonBox); mainLayout->addWidget(buttonBox);
connect(inputEdit, &QLineEdit::textChanged,[this](const QString &text) { connect(inputEdit, &QLineEdit::textChanged,[this](const QString &text) {
@@ -657,9 +649,7 @@ PasswordInputDialog::PasswordInputDialog(PasswordInputDialog::Context context,
if (verifyCallback(inputEdit->text())) { if (verifyCallback(inputEdit->text())) {
accept(); // Dialog accepted. accept(); // Dialog accepted.
} else { } else {
warningIcon->show();
warningLabel->show(); warningLabel->show();
warningLabel->setText(tr("Incorrect password."));
inputEdit->clear(); inputEdit->clear();
adjustSize(); adjustSize();
} }

View File

@@ -42,9 +42,9 @@
#include <qtsupport/qtkitinformation.h> #include <qtsupport/qtkitinformation.h>
#include <utils/infolabel.h>
#include <utils/fancylineedit.h> #include <utils/fancylineedit.h>
#include <utils/pathchooser.h> #include <utils/pathchooser.h>
#include <utils/utilsicons.h>
#include <QCheckBox> #include <QCheckBox>
#include <QComboBox> #include <QComboBox>
@@ -156,13 +156,8 @@ QWidget *AndroidBuildApkWidget::createSignPackageGroup()
m_signPackageCheckBox = new QCheckBox(tr("Sign package"), group); m_signPackageCheckBox = new QCheckBox(tr("Sign package"), group);
m_signPackageCheckBox->setChecked(m_step->signPackage()); m_signPackageCheckBox->setChecked(m_step->signPackage());
m_signingDebugWarningIcon = new QLabel(group); m_signingDebugWarningLabel = new Utils::InfoLabel(tr("Signing a debug package"),
m_signingDebugWarningIcon->setSizePolicy(sizePolicy); Utils::InfoLabel::Warning, group);
m_signingDebugWarningIcon->setPixmap(Icons::WARNING.pixmap());
m_signingDebugWarningIcon->hide();
m_signingDebugWarningLabel = new QLabel(tr("Signing a debug package"), group);
m_signingDebugWarningLabel->setSizePolicy(sizePolicy);
m_signingDebugWarningLabel->hide(); m_signingDebugWarningLabel->hide();
auto certificateAliasLabel = new QLabel(tr("Certificate alias:"), group); auto certificateAliasLabel = new QLabel(tr("Certificate alias:"), group);
@@ -182,7 +177,6 @@ QWidget *AndroidBuildApkWidget::createSignPackageGroup()
horizontalLayout_2->addWidget(keystoreCreateButton); horizontalLayout_2->addWidget(keystoreCreateButton);
auto horizontalLayout_3 = new QHBoxLayout; auto horizontalLayout_3 = new QHBoxLayout;
horizontalLayout_3->addWidget(m_signingDebugWarningIcon);
horizontalLayout_3->addWidget(m_signingDebugWarningLabel); horizontalLayout_3->addWidget(m_signingDebugWarningLabel);
horizontalLayout_3->addWidget(certificateAliasLabel); horizontalLayout_3->addWidget(certificateAliasLabel);
horizontalLayout_3->addWidget(m_certificatesAliasComboBox); horizontalLayout_3->addWidget(m_certificatesAliasComboBox);
@@ -356,7 +350,6 @@ void AndroidBuildApkWidget::updateSigningWarning()
{ {
bool nonRelease = m_step->buildConfiguration()->buildType() != BuildConfiguration::Release; bool nonRelease = m_step->buildConfiguration()->buildType() != BuildConfiguration::Release;
bool visible = m_step->signPackage() && nonRelease; bool visible = m_step->signPackage() && nonRelease;
m_signingDebugWarningIcon->setVisible(visible);
m_signingDebugWarningLabel->setVisible(visible); m_signingDebugWarningLabel->setVisible(visible);
} }

View File

@@ -38,6 +38,10 @@ class QComboBox;
class QLabel; class QLabel;
QT_END_NAMESPACE QT_END_NAMESPACE
namespace Utils {
class InfoLabel;
}
namespace Android { namespace Android {
namespace Internal { namespace Internal {
@@ -62,8 +66,7 @@ private:
private: private:
AndroidBuildApkStep *m_step = nullptr; AndroidBuildApkStep *m_step = nullptr;
QCheckBox *m_signPackageCheckBox = nullptr; QCheckBox *m_signPackageCheckBox = nullptr;
QLabel *m_signingDebugWarningIcon = nullptr; Utils::InfoLabel *m_signingDebugWarningLabel = nullptr;
QLabel *m_signingDebugWarningLabel = nullptr;
QComboBox *m_certificatesAliasComboBox = nullptr; QComboBox *m_certificatesAliasComboBox = nullptr;
QCheckBox *m_addDebuggerCheckBox = nullptr; QCheckBox *m_addDebuggerCheckBox = nullptr;
}; };