@@ -38,12 +38,12 @@ using namespace deskflow::gui;
3838using namespace synergy ::gui;
3939using namespace synergy ::license;
4040
41- ActivationDialog::ActivationDialog (
42- QWidget *parent, AppConfig &appConfig, LicenseHandler &licenseHandler)
41+ ActivationDialog::ActivationDialog (QWidget *parent, AppConfig &appConfig, LicenseHandler &licenseHandler)
4342 : QDialog(parent),
4443 m_ui(new Ui::ActivationDialog),
4544 m_pAppConfig(&appConfig),
46- m_licenseHandler(licenseHandler) {
45+ m_licenseHandler(licenseHandler)
46+ {
4747
4848 m_ui->setupUi (this );
4949
@@ -56,7 +56,8 @@ ActivationDialog::ActivationDialog(
5656 }
5757}
5858
59- void ActivationDialog::refreshSerialKey () {
59+ void ActivationDialog::refreshSerialKey ()
60+ {
6061
6162 const QString envSerialKey = qEnvironmentVariable (" SYNERGY_TEST_SERIAL_KEY" );
6263 if (!envSerialKey.isEmpty ()) {
@@ -77,9 +78,13 @@ void ActivationDialog::refreshSerialKey() {
7778 }
7879}
7980
80- ActivationDialog::~ActivationDialog () { delete m_ui; }
81+ ActivationDialog::~ActivationDialog ()
82+ {
83+ delete m_ui;
84+ }
8185
82- void ActivationDialog::reject () {
86+ void ActivationDialog::reject ()
87+ {
8388 // don't show the cancel confirmation dialog if they've already registered,
8489 // since it's not relevant to customers who are changing their serial key.
8590 const auto &license = m_licenseHandler.license ();
@@ -95,7 +100,8 @@ void ActivationDialog::reject() {
95100 }
96101}
97102
98- void ActivationDialog::accept () {
103+ void ActivationDialog::accept ()
104+ {
99105 using Result = LicenseHandler::SetSerialKeyResult;
100106 auto serialKey = m_ui->m_pTextEditSerialKey ->toPlainText ();
101107
@@ -114,84 +120,77 @@ void ActivationDialog::accept() {
114120 QDialog::accept ();
115121}
116122
117- void ActivationDialog::showResultDialog (
118- LicenseHandler::SetSerialKeyResult result) {
123+ void ActivationDialog::showResultDialog (LicenseHandler::SetSerialKeyResult result)
124+ {
119125 const QString title = " Activation" ;
120126
121127 switch (result) {
122128 using enum LicenseHandler::SetSerialKeyResult;
123129
124130 case kUnchanged :
125- QMessageBox::information (
126- this , title,
127- " Heads up, the serial key you entered was the same as last time." );
131+ QMessageBox::information (this , title, " Heads up, the serial key you entered was the same as last time." );
128132 QDialog::accept ();
129133 break ;
130134
131135 case kInvalid :
132136 QMessageBox::critical (
133137 this , title,
134- QString (
135- " Invalid serial key. "
136- R"( Please <a href="%1" style="color: %2">contact us</a> for help.)" )
138+ QString (" Invalid serial key. "
139+ R"( Please <a href="%1" style="color: %2">contact us</a> for help.)" )
137140 .arg (kUrlContact )
138- .arg (kColorSecondary ));
141+ .arg (kColorSecondary )
142+ );
139143 break ;
140144
141145 case kExpired :
142146 QMessageBox::warning (
143147 this , title,
144- QString (
145- " Sorry, that serial key has expired. "
146- R"( Please <a href="%1" style="color: %2">renew</a> your license.)" )
148+ QString (" Sorry, that serial key has expired. "
149+ R"( Please <a href="%1" style="color: %2">renew</a> your license.)" )
147150 .arg (kUrlPurchase )
148- .arg (kColorSecondary ));
151+ .arg (kColorSecondary )
152+ );
149153 break ;
150154
151155 default :
152156 qFatal (" unexpected change serial key result: %d" , static_cast <int >(result));
153157 }
154158}
155159
156- void ActivationDialog::showSuccessDialog () {
160+ void ActivationDialog::showSuccessDialog ()
161+ {
157162 const auto &license = m_licenseHandler.license ();
158163
159164 QString title = " Activation successful" ;
160- QString message = tr (" <p>Thanks for activating %1.</p>" )
161- .arg (m_licenseHandler.productName ());
165+ QString message = tr (" <p>Thanks for activating %1.</p>" ).arg (m_licenseHandler.productName ());
162166
163167 const auto tlsAvailable = m_licenseHandler.license ().isTlsAvailable ();
164168 if (tlsAvailable && m_pAppConfig->tlsEnabled ()) {
165- message +=
166- " <p>To ensure that TLS encryption works correctly, "
167- " please activate all of your computers with the same serial key.</p>" ;
169+ message += " <p>To ensure that TLS encryption works correctly, "
170+ " please activate all of your computers with the same serial key.</p>" ;
168171 }
169172
170173 if (license.isTimeLimited ()) {
171174 auto daysLeft = license.daysLeft ().count ();
172175 if (license.isTrial ()) {
173176 title = " Trial started" ;
174- message += QString (" Your trial will expire in %1 %2." )
175- .arg (daysLeft)
176- .arg ((daysLeft == 1 ) ? " day" : " days" );
177+ message += QString (" Your trial will expire in %1 %2." ).arg (daysLeft).arg ((daysLeft == 1 ) ? " day" : " days" );
177178 } else if (license.isSubscription ()) {
178- message += QString (" Your license will expire in %1 %2." )
179- .arg (daysLeft)
180- .arg ((daysLeft == 1 ) ? " day" : " days" );
179+ message += QString (" Your license will expire in %1 %2." ).arg (daysLeft).arg ((daysLeft == 1 ) ? " day" : " days" );
181180 }
182181 }
183182
184183 QMessageBox::information (this , title, message);
185184}
186185
187- void ActivationDialog::showErrorDialog (const QString &message) {
188- QString fullMessage =
189- QString (" <p>There was a problem activating Deskflow.</p>"
190- R"( <p>Please <a href="%1" style="color: %2">contact us</a> )"
191- " and provide the following information:</p>"
192- " %3" )
193- .arg (kUrlContact )
194- .arg (kColorSecondary )
195- .arg (message);
186+ void ActivationDialog::showErrorDialog (const QString &message)
187+ {
188+ QString fullMessage = QString (" <p>There was a problem activating Deskflow.</p>"
189+ R"( <p>Please <a href="%1" style="color: %2">contact us</a> )"
190+ " and provide the following information:</p>"
191+ " %3" )
192+ .arg (kUrlContact )
193+ .arg (kColorSecondary )
194+ .arg (message);
196195 QMessageBox::critical (this , " Activation failed" , fullMessage);
197196}
0 commit comments