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

View File

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

View File

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