#5657 Fix trial warning label and serial key serialisation

This commit is contained in:
Andrew Nelless 2016-10-18 15:32:59 +01:00
parent e5aae66ff7
commit 020b7974df
2 changed files with 20 additions and 12 deletions

View File

@ -1061,15 +1061,18 @@ void MainWindow::setEdition(Edition edition)
void MainWindow::beginTrial(bool isExpiring) void MainWindow::beginTrial(bool isExpiring)
{ {
if (isExpiring) { if (isExpiring) {
QString expiringNotice = "<html><head/><body><p><span style=\"" QString expiringNotice ("<html><head/><body><p><span style=\""
"font-weight:600;\">%1</span> days of " "font-weight:600;\">%1</span> days of "
"your Synergy Pro trial remain. <a href=" "your %2 trial remain. <a href="
"\"http://symless.com/pricing?src=gui\">" "\"http://symless.com/synergy/trial/thanks?id=%3\">"
"<span style=\"text-decoration: underline;" "<span style=\"text-decoration: underline;"
" color:#0000ff;\">Buy now!</span></a>" " color:#0000ff;\">Buy now!</span></a>"
"</p></body></html>"; "</p></body></html>");
expiringNotice = expiringNotice.arg expiringNotice = expiringNotice.arg
(m_LicenseManager->serialKey().daysLeft(::time(0))); (m_LicenseManager->serialKey().daysLeft(::time(0))).arg
(LicenseManager::getEditionName(m_LicenseManager->activeEdition())).arg
(QString::fromStdString(m_LicenseManager->serialKey().toString()));
this->m_trialLabel->setText(expiringNotice); this->m_trialLabel->setText(expiringNotice);
this->m_trialWidget->show(); this->m_trialWidget->show();
} }

View File

@ -126,15 +126,20 @@ std::string
SerialKey::toString() const SerialKey::toString() const
{ {
std::ostringstream oss; std::ostringstream oss;
oss << "v2;"; oss << "{";
oss << (isTrial() ? "trial" : "lifetime") << ";"; if (isTrial()) {
oss << "v2;trial;";
} else {
oss << "v1;";
}
oss << editionString() << ";"; oss << editionString() << ";";
oss << m_name << ";"; oss << m_name << ";";
oss << m_userLimit << ";"; oss << m_userLimit << ";";
oss << m_email << ";"; oss << m_email << ";";
oss << m_company << ";"; oss << m_company << ";";
oss << m_warnTime << ";"; oss << (isTrial() ? m_warnTime : 0) << ";";
oss << m_expireTime; oss << (isTrial() ? m_expireTime : 0);
oss << "}";
return hexEncode(oss.str()); return hexEncode(oss.str());
} }