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