logic: iterated on license checking
- moved LicenseChecker from App to Lib project - added MessageDispatchWhenLicenseValid. This message takes another message as an argument which is dispatched once the LicenseChecher confirms the current license key or (if the key is invalid) once the user entered a valid key. This message is used when messages are sent that should not be working when no license key has been entered (LoadProject or ActivateTokenLocation via the IDE communication). - added MessageShowStartScreen which makes the MainView display this screen. This message is also sent via the MessageDispatchWhenLicenseValid. - removed startup project from appsettings.
This commit is contained in:
@@ -15,10 +15,14 @@ std::shared_ptr<MessageQueue> MessageQueue::getInstance()
|
||||
{
|
||||
s_instance = std::shared_ptr<MessageQueue>(new MessageQueue());
|
||||
}
|
||||
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
MessageQueue::~MessageQueue()
|
||||
{
|
||||
// TODO: remove remaining listeners. And tell them that they shouldn't unregister anymore.
|
||||
}
|
||||
|
||||
void MessageQueue::registerListener(MessageListenerBase* listener)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_listenersMutex);
|
||||
|
||||
@@ -15,6 +15,8 @@ class MessageQueue
|
||||
public:
|
||||
static std::shared_ptr<MessageQueue> getInstance();
|
||||
|
||||
~MessageQueue();
|
||||
|
||||
void registerListener(MessageListenerBase* listener);
|
||||
void unregisterListener(MessageListenerBase* listener);
|
||||
|
||||
@@ -38,8 +40,8 @@ private:
|
||||
static std::shared_ptr<MessageQueue> s_instance;
|
||||
|
||||
MessageQueue();
|
||||
MessageQueue(const MessageQueue&);
|
||||
void operator=(const MessageQueue&);
|
||||
MessageQueue(const MessageQueue&) = delete;
|
||||
void operator=(const MessageQueue&) = delete;
|
||||
|
||||
void processMessages();
|
||||
void sendMessage(std::shared_ptr<MessageBase> message);
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
#ifndef MESSAGE_DISPATCH_WHEN_LICENSE_VALID_H
|
||||
#define MESSAGE_DISPATCH_WHEN_LICENSE_VALID_H
|
||||
|
||||
#include "utility/messaging/Message.h"
|
||||
|
||||
class MessageDispatchWhenLicenseValid
|
||||
: public Message<MessageDispatchWhenLicenseValid>
|
||||
{
|
||||
public:
|
||||
MessageDispatchWhenLicenseValid(std::shared_ptr<MessageBase> content)
|
||||
: content(content)
|
||||
{
|
||||
}
|
||||
|
||||
static const std::string getStaticType()
|
||||
{
|
||||
return "MessageDispatchWhenLicenseValid";
|
||||
}
|
||||
|
||||
std::shared_ptr<MessageBase> content;
|
||||
};
|
||||
|
||||
#endif // MESSAGE_DISPATCH_WHEN_LICENSE_VALID_H
|
||||
@@ -0,0 +1,20 @@
|
||||
#ifndef MESSAGE_SHOW_START_SCREEN_H
|
||||
#define MESSAGE_SHOW_START_SCREEN_H
|
||||
|
||||
#include "utility/messaging/Message.h"
|
||||
|
||||
class MessageShowStartScreen
|
||||
: public Message<MessageShowStartScreen>
|
||||
{
|
||||
public:
|
||||
MessageShowStartScreen()
|
||||
{
|
||||
}
|
||||
|
||||
static const std::string getStaticType()
|
||||
{
|
||||
return "MessageShowStartScreen";
|
||||
}
|
||||
};
|
||||
|
||||
#endif // MESSAGE_SHOW_START_SCREEN_H
|
||||
Reference in New Issue
Block a user