logic: Added Non-Commercial Use option and removed trial mode

* Added non-commercial use option to enter license window
* Show enter license window on first start and force license selection
* Added ApplicationSettings migration that removed private/academic license and switches user to non-commercial mode
* Added commandline option to choose non-commercial use and provide better hints to license selection
* Removed trial mode

fortune cookie message = A secret admirer will soon send you a sign of affection.
This commit is contained in:
Eberhard Graether
2017-10-19 16:58:47 +02:00
parent c3a5405cc4
commit 8e908c2a78
30 changed files with 602 additions and 495 deletions
+20 -9
View File
@@ -7,6 +7,7 @@
#include "utility/messaging/filter_types/MessageFilterNewErrors.h"
#include "utility/messaging/filter_types/MessageFilterSearchAutocomplete.h"
#include "utility/messaging/MessageQueue.h"
#include "utility/messaging/type/MessageForceEnterLicense.h"
#include "utility/messaging/type/MessageQuitApplication.h"
#include "utility/messaging/type/MessageStatus.h"
#include "utility/scheduling/TaskScheduler.h"
@@ -112,6 +113,7 @@ void Application::loadStyle(const FilePath& colorSchemePath)
Application::Application(bool withGUI)
: m_hasGUI(withGUI)
, m_licenseType(MessageEnteredLicense::LICENSE_NONE)
, m_lastLicenseCheck(TimeStamp::now())
{
LicenseChecker::createInstance();
}
@@ -159,11 +161,6 @@ std::shared_ptr<DialogView> Application::getDialogView()
return std::make_shared<DialogView>(nullptr);
}
bool Application::isInTrial() const
{
return m_licenseType == MessageEnteredLicense::LICENSE_NONE;
}
void Application::updateHistory(const std::vector<SearchMatch>& history)
{
m_mainView->updateHistoryMenu(history);
@@ -323,10 +320,26 @@ void Application::handleMessage(MessageSwitchColorScheme* message)
void Application::handleMessage(MessageWindowFocus* message)
{
if (message->focusIn && m_project && ApplicationSettings::getInstance()->getAutomaticUpdateCheck())
if (!message->focusIn)
{
return;
}
if (m_project && ApplicationSettings::getInstance()->getAutomaticUpdateCheck())
{
m_updateChecker->checkUpdate();
}
if (!ApplicationSettings::getInstance()->getNonCommercialUse() && TimeStamp::now().deltaHours(m_lastLicenseCheck) > 1)
{
m_lastLicenseCheck = TimeStamp::now();
LicenseChecker::LicenseState state = LicenseChecker::getInstance()->checkCurrentLicense();
if (state != LicenseChecker::LICENSE_VALID && state != LicenseChecker::LICENSE_MOVED)
{
MessageForceEnterLicense(state).dispatch();
}
}
}
void Application::startMessagingAndScheduling()
@@ -406,12 +419,10 @@ void Application::updateTitle()
switch (m_licenseType)
{
case MessageEnteredLicense::LICENSE_NONE:
title += " [trial]";
break;
case MessageEnteredLicense::LICENSE_TEST:
title += " [test]";
break;
case MessageEnteredLicense::LICENSE_NONE:
case MessageEnteredLicense::LICENSE_NON_COMMERCIAL:
title += " [non-commercial]";
break;