License notise has been corrected.

This commit is contained in:
Serhii Hadzhilov 2020-09-25 21:26:54 +03:00
parent 2a8e696d53
commit 1d43ab0f7c
6 changed files with 297 additions and 285 deletions

View file

@ -33,13 +33,7 @@ void ActivationDialog::refreshSerialKey()
ui->m_pTextEditSerialKey->setText(m_appConfig->serialKey());
ui->m_pTextEditSerialKey->setFocus();
ui->m_pTextEditSerialKey->moveCursor(QTextCursor::End);
ui->m_trialLabel->setText(tr("<html><head/><body><p>Your trial has "
"expired. <a href=\"https://symless.com/"
"synergy/trial/thanks?id=%1\"><span "
"style=\"text-decoration: underline; "
"color:#0000ff;\">Buy now!</span></a>"
"</p></body></html>")
.arg (m_appConfig->serialKey()));
ui->m_trialLabel->setText(tr(m_LicenseManager->getLicenseNotice().toStdString().c_str()));
}
ActivationDialog::~ActivationDialog()

View file

@ -101,7 +101,8 @@ LicenseManager::serialKey() const
return m_serialKey;
}
void LicenseManager::refresh()
void
LicenseManager::refresh()
{
if (!m_AppConfig->serialKey().isEmpty()) {
try {
@ -116,7 +117,8 @@ void LicenseManager::refresh()
}
}
void LicenseManager::skipActivation()
void
LicenseManager::skipActivation()
{
notifyActivation ("skip:unknown");
}
@ -141,7 +143,8 @@ LicenseManager::getEditionName(Edition const edition, bool trial)
return QString::fromUtf8 (name.c_str(), static_cast<int>(name.size()));
}
void LicenseManager::notifyActivation(QString identity)
void
LicenseManager::notifyActivation(QString identity)
{
ActivationNotifier* notifier = new ActivationNotifier();
notifier->setIdentity(identity);
@ -157,7 +160,8 @@ void LicenseManager::notifyActivation(QString identity)
QMetaObject::invokeMethod(notifier, "notify", Qt::QueuedConnection);
}
QString LicenseManager::getLicenseNotice() const
QString
LicenseManager::getLicenseNotice() const
{
QString Notice;
@ -173,67 +177,60 @@ QString LicenseManager::getLicenseNotice() const
return Notice;
}
QString LicenseManager::getTrialNotice() const
QString
LicenseManager::getTrialNotice() const
{
QString Notice;
if (m_serialKey.isExpired(::time(0))){
Notice = "<html><head/><body><p>Your %1 trial has expired. <a href="
"\"https://symless.com/synergy/trial/thanks?id=%2\">"
"\"https://members.symless.com/purchase\">"
"<span style=\"text-decoration: underline;color:#0000ff;\">"
"Buy now!</span></a></p></body></html>";
Notice = Notice
.arg(LicenseManager::getEditionName(activeEdition()))
.arg(QString::fromStdString(m_serialKey.toString()));
Notice = Notice.arg(LicenseManager::getEditionName(activeEdition()));
}
else{
time_t daysLeft = m_serialKey.daysLeft(::time(0));
Notice = "<html><head/><body><p><span style=\""
"font-weight:600;\">%1</span> day%3 of "
"your %2 trial remain%5. <a href="
"\"https://symless.com/synergy/trial/thanks?id=%4\">"
"\"https://members.symless.com/purchase\">"
"<span style=\"text-decoration: underline;"
" color:#0000ff;\">Buy now!</span></a>"
"</p></body></html>";
time_t daysLeft = m_serialKey.daysLeft(::time(0));
Notice = Notice
.arg (daysLeft)
.arg (LicenseManager::getEditionName(activeEdition()))
.arg ((daysLeft == 1) ? "" : "s")
.arg (QString::fromStdString(m_serialKey.toString()))
.arg ((daysLeft == 1) ? "s" : "");
}
return Notice;
}
QString LicenseManager::getTemporaryNotice() const
QString
LicenseManager::getTemporaryNotice() const
{
QString Notice;
if (m_serialKey.isExpired(::time(0))){
Notice = "<html><head/><body><p>Your %1 has expired. <a href="
"\"https://symless.com/synergy/trial/thanks?id=%2\">"
if (m_serialKey.isExpired(::time(0))) {
Notice = "<html><head/><body><p>Your license has expired. <a href="
"\"https://members.symless.com/purchase\">"
"<span style=\"text-decoration: underline;color:#0000ff;\">"
"Buy now!</span></a></p></body></html>";
Notice = Notice
.arg(LicenseManager::getEditionName(activeEdition()))
.arg(QString::fromStdString(m_serialKey.toString()));
"Renew now!</span></a></p></body></html>";
}
else if (m_serialKey.isExpiring(::time(0))){
time_t daysLeft = m_serialKey.daysLeft(::time(0));
else if (m_serialKey.isExpiring(::time(0))) {
Notice = "<html><head/><body><p><span style=\""
"font-weight:600;\">%1</span> day%3 of "
"your %2 remain%5. <a href="
"\"https://symless.com/synergy/trial/thanks?id=%4\">"
"font-weight:600;\">%1</span> day%2 / "
"before your license expires.<a href="
"\"https://members.symless.com/purchase\">"
"<span style=\"text-decoration: underline;"
" color:#0000ff;\">Buy now!</span></a>"
" color:#0000ff;\">Renew now!</span></a>"
"</p></body></html>";
Notice = Notice
.arg (daysLeft)
.arg (LicenseManager::getEditionName(activeEdition()))
.arg ((daysLeft == 1) ? "" : "s")
.arg (QString::fromStdString(m_serialKey.toString()))
.arg ((daysLeft == 1) ? "s" : "");
time_t daysLeft = m_serialKey.daysLeft(::time(0));
Notice = Notice.arg (daysLeft).arg ((daysLeft == 1) ? "" : "s");
}
return Notice;

View file

@ -27,6 +27,7 @@
#include <stdexcept>
using namespace std;
static std::string hexEncode (std::string const& str);
SerialKey::SerialKey(Edition edition):
m_userLimit(1),

View file

@ -1,3 +1,20 @@
/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2015 Synergy Seamless Inc.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "SerialKeyType.h"
const std::string SerialKeyType::TRIAL = "trial";
@ -10,7 +27,8 @@ SerialKeyType::SerialKeyType() :
}
void SerialKeyType::setKeyType(const std::string& Type)
void
SerialKeyType::setKeyType(const std::string& Type)
{
m_isTrial = false;
m_isTemporary = false;
@ -24,17 +42,21 @@ void SerialKeyType::setKeyType(const std::string& Type)
}
}
bool SerialKeyType::isTrial() const
bool
SerialKeyType::isTrial() const
{
return m_isTrial;
}
bool SerialKeyType::isTemporary() const
bool
SerialKeyType::isTemporary() const
{
return m_isTemporary;
}
bool SerialKeyType::isPermanent() const
bool
SerialKeyType::isPermanent() const
{
return (!m_isTemporary);
}

View file

@ -14,8 +14,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SERIALKEYTYPE_H
#define SERIALKEYTYPE_H
#pragma once
#include <string>
@ -50,4 +49,3 @@ operator!= (SerialKeyType const& lhs, SerialKeyType const& rhs) {
return !(lhs == rhs);
}
#endif // SERIALKEYTYPE_H