#5471 Redesigned serial key input

This commit is contained in:
Jerry (Xinyu Hou) 2016-07-15 14:58:30 +01:00
parent fd39c73bcd
commit 62c9ca0a7f
2 changed files with 11 additions and 44 deletions

View File

@ -229,45 +229,12 @@
<item> <item>
<widget class="QRadioButton" name="m_pRadioButtonSubscription"> <widget class="QRadioButton" name="m_pRadioButtonSubscription">
<property name="text"> <property name="text">
<string>Subscription</string> <string>Serial key</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<layout class="QFormLayout" name="formLayout_2"> <widget class="QTextEdit" name="m_pTextEditSerialKey"/>
<property name="formAlignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="horizontalSpacing">
<number>20</number>
</property>
<property name="verticalSpacing">
<number>10</number>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Serial Key:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="m_pLineEditSerialKey">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
</size>
</property>
</widget>
</item>
</layout>
</item> </item>
<item> <item>
<spacer name="verticalSpacer_5"> <spacer name="verticalSpacer_5">

View File

@ -62,9 +62,9 @@ SetupWizard::SetupWizard(MainWindow& mainWindow, bool startMain) :
AppConfig& appConfig = m_MainWindow.appConfig(); AppConfig& appConfig = m_MainWindow.appConfig();
m_pLineEditEmail->setText(appConfig.activateEmail()); m_pLineEditEmail->setText(appConfig.activateEmail());
m_pLineEditSerialKey->setText(appConfig.serialKey()); m_pTextEditSerialKey->setText(appConfig.serialKey());
m_pLineEditSerialKey->setEnabled(false); m_pTextEditSerialKey->setEnabled(false);
} }
@ -120,7 +120,7 @@ bool SetupWizard::validateCurrentPage()
} }
} }
else if (m_pRadioButtonSubscription->isChecked()) { else if (m_pRadioButtonSubscription->isChecked()) {
if (m_pLineEditSerialKey->text().isEmpty()) { if (m_pTextEditSerialKey->toPlainText().isEmpty()) {
message.setText(tr("Please enter your subscription serial key.")); message.setText(tr("Please enter your subscription serial key."));
message.exec(); message.exec();
return false; return false;
@ -128,7 +128,7 @@ bool SetupWizard::validateCurrentPage()
else { else {
// create subscription file in profile directory // create subscription file in profile directory
SubscriptionManager subscriptionManager(this, m_MainWindow.appConfig(), m_Edition); SubscriptionManager subscriptionManager(this, m_MainWindow.appConfig(), m_Edition);
if (!subscriptionManager.activateSerial(m_pLineEditSerialKey->text())) { if (!subscriptionManager.activateSerial(m_pTextEditSerialKey->toPlainText())) {
return false; return false;
} }
@ -206,9 +206,9 @@ void SetupWizard::accept()
if (m_pRadioButtonSubscription->isChecked()) if (m_pRadioButtonSubscription->isChecked())
{ {
appConfig.setSerialKey(m_pLineEditSerialKey->text()); appConfig.setSerialKey(m_pTextEditSerialKey->toPlainText());
notifyActivation("serial:" + m_pLineEditSerialKey->text()); notifyActivation("serial:" + m_pTextEditSerialKey->toPlainText());
} }
if (m_pRadioButtonSkip->isChecked()) if (m_pRadioButtonSkip->isChecked())
@ -274,7 +274,7 @@ void SetupWizard::on_m_pRadioButtonSkip_toggled(bool checked)
if (checked) { if (checked) {
m_pLineEditEmail->setEnabled(false); m_pLineEditEmail->setEnabled(false);
m_pLineEditPassword->setEnabled(false); m_pLineEditPassword->setEnabled(false);
m_pLineEditSerialKey->setEnabled(false); m_pTextEditSerialKey->setEnabled(false);
} }
} }
@ -283,7 +283,7 @@ void SetupWizard::on_m_pRadioButtonActivate_toggled(bool checked)
if (checked) { if (checked) {
m_pLineEditEmail->setEnabled(true); m_pLineEditEmail->setEnabled(true);
m_pLineEditPassword->setEnabled(true); m_pLineEditPassword->setEnabled(true);
m_pLineEditSerialKey->setEnabled(false); m_pTextEditSerialKey->setEnabled(false);
} }
} }
@ -292,6 +292,6 @@ void SetupWizard::on_m_pRadioButtonSubscription_toggled(bool checked)
if (checked) { if (checked) {
m_pLineEditEmail->setEnabled(false); m_pLineEditEmail->setEnabled(false);
m_pLineEditPassword->setEnabled(false); m_pLineEditPassword->setEnabled(false);
m_pLineEditSerialKey->setEnabled(true); m_pTextEditSerialKey->setEnabled(true);
} }
} }