#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)
{
if (isExpiring) {
QString expiringNotice = "<html><head/><body><p><span style=\""
"font-weight:600;\">%1</span> days of "
"your Synergy Pro trial remain. <a href="
"\"http://symless.com/pricing?src=gui\">"
"<span style=\"text-decoration: underline;"
" color:#0000ff;\">Buy now!</span></a>"
"</p></body></html>";
QString expiringNotice ("<html><head/><body><p><span style=\""
"font-weight:600;\">%1</span> days of "
"your %2 trial remain. <a href="
"\"http://symless.com/synergy/trial/thanks?id=%3\">"
"<span style=\"text-decoration: underline;"
" color:#0000ff;\">Buy now!</span></a>"
"</p></body></html>");
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_trialWidget->show();
}

View File

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