#5657 Rename edition to activeLicense. WSFs
This commit is contained in:
parent
3b98a7b785
commit
4ad7c7fe39
|
@ -39,7 +39,7 @@ ActivationDialog::~ActivationDialog()
|
||||||
|
|
||||||
void ActivationDialog::reject()
|
void ActivationDialog::reject()
|
||||||
{
|
{
|
||||||
if (m_subscriptionManager->edition() == Edition::kUnregistered) {
|
if (m_subscriptionManager->activeLicense() == Edition::kUnregistered) {
|
||||||
CancelActivationDialog cancelActivationDialog(this);
|
CancelActivationDialog cancelActivationDialog(this);
|
||||||
if (QDialog::Accepted == cancelActivationDialog.exec()) {
|
if (QDialog::Accepted == cancelActivationDialog.exec()) {
|
||||||
m_subscriptionManager->skipActivation();
|
m_subscriptionManager->skipActivation();
|
||||||
|
@ -71,10 +71,10 @@ void ActivationDialog::accept()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_subscriptionManager->edition() != Edition::kUnregistered) {
|
if (m_subscriptionManager->activeLicense() != Edition::kUnregistered) {
|
||||||
message.information(this, "Activated!",
|
message.information(this, "Activated!",
|
||||||
tr("Thanks for activating %1!").arg
|
tr("Thanks for activating %1!").arg
|
||||||
(getEditionName(m_subscriptionManager->edition())));
|
(getEditionName(m_subscriptionManager->activeLicense())));
|
||||||
}
|
}
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,12 +137,7 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig,
|
||||||
|
|
||||||
m_pComboServerList->hide();
|
m_pComboServerList->hide();
|
||||||
m_pLabelPadlock->hide();
|
m_pLabelPadlock->hide();
|
||||||
setEdition (m_SubscriptionManager->edition());
|
m_trialWidget->hide();
|
||||||
|
|
||||||
this->m_trialWidget->hide();
|
|
||||||
if (m_SubscriptionManager->isTrial()) {
|
|
||||||
beginTrial();
|
|
||||||
}
|
|
||||||
|
|
||||||
connect (this, SIGNAL(windowShown()),
|
connect (this, SIGNAL(windowShown()),
|
||||||
this, SLOT(on_windowShown()), Qt::QueuedConnection);
|
this, SLOT(on_windowShown()), Qt::QueuedConnection);
|
||||||
|
@ -150,14 +145,16 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig,
|
||||||
connect (m_SubscriptionManager, SIGNAL(editionChanged(Edition)),
|
connect (m_SubscriptionManager, SIGNAL(editionChanged(Edition)),
|
||||||
this, SLOT(setEdition(Edition)), Qt::QueuedConnection);
|
this, SLOT(setEdition(Edition)), Qt::QueuedConnection);
|
||||||
|
|
||||||
connect (m_SubscriptionManager, SIGNAL(beginTrial()),
|
connect (m_SubscriptionManager, SIGNAL(beginTrial(bool)),
|
||||||
this, SLOT(beginTrial()), Qt::QueuedConnection);
|
this, SLOT(beginTrial(bool)), Qt::QueuedConnection);
|
||||||
|
|
||||||
connect (m_SubscriptionManager, SIGNAL(endTrial()),
|
connect (m_SubscriptionManager, SIGNAL(endTrial(bool)),
|
||||||
this, SLOT(endTrial()), Qt::QueuedConnection);
|
this, SLOT(endTrial(bool)), Qt::QueuedConnection);
|
||||||
|
|
||||||
connect (m_AppConfig, SIGNAL(sslToggled(bool)),
|
connect (m_AppConfig, SIGNAL(sslToggled(bool)),
|
||||||
this, SLOT(sslToggled(bool)), Qt::QueuedConnection);
|
this, SLOT(sslToggled(bool)), Qt::QueuedConnection);
|
||||||
|
|
||||||
|
m_SubscriptionManager->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
|
@ -1050,14 +1047,18 @@ void MainWindow::setEdition(Edition edition)
|
||||||
saveSettings();
|
saveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::beginTrial()
|
void MainWindow::beginTrial(bool isExpiring)
|
||||||
{
|
{
|
||||||
|
if (isExpiring) {
|
||||||
this->m_trialWidget->show();
|
this->m_trialWidget->show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::endTrial()
|
void MainWindow::endTrial(bool isExpired)
|
||||||
{
|
{
|
||||||
|
if (!isExpired) {
|
||||||
this->m_trialWidget->hide();
|
this->m_trialWidget->hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updateLocalFingerprint()
|
void MainWindow::updateLocalFingerprint()
|
||||||
|
|
|
@ -122,8 +122,8 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setEdition(Edition edition);
|
void setEdition(Edition edition);
|
||||||
void beginTrial();
|
void beginTrial(bool isExpiring);
|
||||||
void endTrial();
|
void endTrial(bool isExpired);
|
||||||
void appendLogRaw(const QString& text);
|
void appendLogRaw(const QString& text);
|
||||||
void appendLogInfo(const QString& text);
|
void appendLogInfo(const QString& text);
|
||||||
void appendLogDebug(const QString& text);
|
void appendLogDebug(const QString& text);
|
||||||
|
|
|
@ -28,6 +28,7 @@ SubscriptionManager::SubscriptionManager(AppConfig* appConfig) :
|
||||||
setSerialKey(m_AppConfig->serialKey());
|
setSerialKey(m_AppConfig->serialKey());
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
m_AppConfig->setSerialKey("");
|
m_AppConfig->setSerialKey("");
|
||||||
|
m_AppConfig->saveSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,26 +53,32 @@ SubscriptionManager::setSerialKey(QString serialKeyString)
|
||||||
emit editionChanged (m_serialKey.edition());
|
emit editionChanged (m_serialKey.edition());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_serialKey.isTrial() != serialKey.isTrial()) {
|
if (serialKey.isTrial()) {
|
||||||
|
emit endTrial(false);
|
||||||
|
}
|
||||||
|
|
||||||
if (m_serialKey.isTrial()) {
|
if (m_serialKey.isTrial()) {
|
||||||
emit beginTrial();
|
emit beginTrial(m_serialKey.isExpiring(::time(0)));
|
||||||
} else {
|
|
||||||
emit endTrial();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_AppConfig->saveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
return serialKey;
|
return serialKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
Edition SubscriptionManager::edition() const
|
Edition SubscriptionManager::activeLicense() const
|
||||||
{
|
{
|
||||||
return m_serialKey.edition();
|
return m_serialKey.edition();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SubscriptionManager::isTrial() const
|
void SubscriptionManager::update() const
|
||||||
{
|
{
|
||||||
return m_serialKey.isTrial();
|
emit serialKeyChanged (m_serialKey);
|
||||||
|
emit editionChanged (m_serialKey.edition());
|
||||||
|
if (m_serialKey.isTrial()) {
|
||||||
|
emit beginTrial(m_serialKey.isExpiring(::time(0)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SubscriptionManager::skipActivation()
|
void SubscriptionManager::skipActivation()
|
||||||
|
|
|
@ -30,8 +30,8 @@ class SubscriptionManager: public QObject
|
||||||
public:
|
public:
|
||||||
SubscriptionManager(AppConfig* appConfig);
|
SubscriptionManager(AppConfig* appConfig);
|
||||||
SerialKey setSerialKey(QString serialKey);
|
SerialKey setSerialKey(QString serialKey);
|
||||||
Edition edition() const;
|
void update() const;
|
||||||
bool isTrial() const;
|
Edition activeLicense() const;
|
||||||
void skipActivation();
|
void skipActivation();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -42,8 +42,8 @@ private:
|
||||||
SerialKey m_serialKey;
|
SerialKey m_serialKey;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void serialKeyChanged (SerialKey);
|
void serialKeyChanged (SerialKey) const;
|
||||||
void editionChanged (Edition);
|
void editionChanged (Edition) const;
|
||||||
void beginTrial ();
|
void beginTrial (bool expiring) const;
|
||||||
void endTrial ();
|
void endTrial (bool expired) const;
|
||||||
};
|
};
|
||||||
|
|
|
@ -181,7 +181,7 @@ SerialKey::parse(std::string plainSerial)
|
||||||
if ((parts.size() == 8)
|
if ((parts.size() == 8)
|
||||||
&& (parts.at(0).find("v1") != string::npos)) {
|
&& (parts.at(0).find("v1") != string::npos)) {
|
||||||
// e.g.: {v1;basic;Bob;1;email;company name;1398297600;1398384000}
|
// e.g.: {v1;basic;Bob;1;email;company name;1398297600;1398384000}
|
||||||
m_edition = getEdition(parts.at(1));
|
m_edition = parseEdition(parts.at(1));
|
||||||
m_name = parts.at(2);
|
m_name = parts.at(2);
|
||||||
m_trial = false;
|
m_trial = false;
|
||||||
sscanf(parts.at(3).c_str(), "%d", &m_userLimit);
|
sscanf(parts.at(3).c_str(), "%d", &m_userLimit);
|
||||||
|
@ -195,7 +195,7 @@ SerialKey::parse(std::string plainSerial)
|
||||||
&& (parts.at(0).find("v2") != string::npos)) {
|
&& (parts.at(0).find("v2") != string::npos)) {
|
||||||
// e.g.: {v2;trial;basic;Bob;1;email;company name;1398297600;1398384000}
|
// e.g.: {v2;trial;basic;Bob;1;email;company name;1398297600;1398384000}
|
||||||
m_trial = parts.at(1) == "trial" ? true : false;
|
m_trial = parts.at(1) == "trial" ? true : false;
|
||||||
m_edition = getEdition(parts.at(2));
|
m_edition = parseEdition(parts.at(2));
|
||||||
m_name = parts.at(3);
|
m_name = parts.at(3);
|
||||||
sscanf(parts.at(4).c_str(), "%d", &m_userLimit);
|
sscanf(parts.at(4).c_str(), "%d", &m_userLimit);
|
||||||
m_email = parts.at(5);
|
m_email = parts.at(5);
|
||||||
|
@ -208,7 +208,7 @@ SerialKey::parse(std::string plainSerial)
|
||||||
}
|
}
|
||||||
|
|
||||||
Edition
|
Edition
|
||||||
SerialKey::getEdition(std::string editionStr)
|
SerialKey::parseEdition(std::string editionStr)
|
||||||
{
|
{
|
||||||
Edition e = Edition::kBasic;
|
Edition e = Edition::kBasic;
|
||||||
if (editionStr == "pro") {
|
if (editionStr == "pro") {
|
||||||
|
|
|
@ -41,7 +41,7 @@ public:
|
||||||
private:
|
private:
|
||||||
std::string decode(const std::string& serial) const;
|
std::string decode(const std::string& serial) const;
|
||||||
void parse(std::string plainSerial);
|
void parse(std::string plainSerial);
|
||||||
Edition getEdition(std::string editionStr);
|
Edition parseEdition(std::string editionStr);
|
||||||
|
|
||||||
#ifdef TEST_ENV
|
#ifdef TEST_ENV
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in New Issue