ui, logic: design for license ui and forcing the user to enter a key on first open

This change integrates the license key ui into the application and makes it necessary for the user to enter a correct
key. The check for a correct key is done on startup and whenever a project is loaded. The check for the key also
includes a check whether the location of the application has changed.
This commit is contained in:
Eberhard Graether
2016-01-18 11:42:31 +01:00
parent 23257a3071
commit 75b102a528
25 changed files with 397 additions and 145 deletions
+5
View File
@@ -111,6 +111,11 @@ void Application::saveProject(const FilePath& projectSettingsFilePath)
}
}
void Application::showLicenseScreen()
{
m_mainView->showLicenseScreen();
}
void Application::setAppSettingsPath(const std::string& appSettingsPath)
{
m_appSettingsPath = appSettingsPath;
+1
View File
@@ -35,6 +35,7 @@ public:
void loadProject(const FilePath& projectSettingsFilePath, bool forceRefresh);
void refreshProject();
void saveProject(const FilePath& projectSettingsFilePath);
void showLicenseScreen();
static void setAppSettingsPath(const std::string& appSettingsPath);
+1
View File
@@ -16,6 +16,7 @@ public:
virtual void setTitle(const std::string& title) = 0;
virtual void activateWindow() = 0;
virtual void updateRecentProjectMenu() = 0;
virtual void showLicenseScreen() = 0;
};
#endif // MAIN_VIEW_H
+4 -4
View File
@@ -163,20 +163,20 @@ int ApplicationSettings::getControlsMouseForwardButton() const
std::string ApplicationSettings::getLicenseString() const
{
return getValue<std::string>("application/license/license:", "");
return getValue<std::string>("user/license/license", "");
}
std::string ApplicationSettings::getLicenseCheck() const
{
return getValue<std::string>("application/license/check", "");
return getValue<std::string>("user/license/check", "");
}
void ApplicationSettings::setLicenseString(const std::string& licenseString)
{
setValue<std::string>("application/license/license", licenseString);
setValue<std::string>("user/license/license", licenseString);
}
void ApplicationSettings::setLicenseCheck(const std::string& hash)
{
setValue<std::string>("application/license/check", hash);
setValue<std::string>("user/license/check", hash);
}
+12
View File
@@ -19,6 +19,7 @@ public:
: undoRedoType(UNDOTYPE_NORMAL)
, m_sendAsTask(true)
, m_keepContent(false)
, m_cancelled(false)
{
}
@@ -59,6 +60,16 @@ public:
return m_keepContent;
}
void cancel()
{
m_cancelled = true;
}
bool cancelled()
{
return m_cancelled;
}
virtual void print(std::ostream& os) const = 0;
std::string str() const
@@ -74,6 +85,7 @@ public:
private:
bool m_sendAsTask;
bool m_keepContent;
bool m_cancelled;
};
#endif // MESSAGE_BASE_H
+6 -1
View File
@@ -241,6 +241,11 @@ void MessageQueue::sendMessage(std::shared_ptr<MessageBase> message)
listener->handleMessageBase(message.get());
m_listenersMutex.lock();
}
if (message->cancelled())
{
break;
}
}
}
@@ -260,7 +265,7 @@ void MessageQueue::sendMessageAsTask(std::shared_ptr<MessageBase> message, bool
[listenerId, message]()
{
MessageListenerBase* listener = MessageQueue::getInstance()->getListenerById(listenerId);
if (listener)
if (listener && !message->cancelled())
{
listener->handleMessageBase(message.get());
}