logic: initially parse source on message thread and add more StatusBar messages
This change puts the initial project loading into a MessageLoadProject so that the UI thread is still responding. Also the StatusBar is now responding to more Messages and it's MessageListeners get added to the MessageQueue in front of other listeners so that the StatusBar UI can announce actions.
This commit is contained in:
@@ -11,6 +11,11 @@ template<typename MessageType>
|
||||
class MessageListener: public MessageListenerBase
|
||||
{
|
||||
public:
|
||||
MessageListener(bool toFront = false)
|
||||
: MessageListenerBase(toFront)
|
||||
{
|
||||
}
|
||||
|
||||
virtual std::string getType() const
|
||||
{
|
||||
return MessageType::getStaticType();
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
class MessageListenerBase
|
||||
{
|
||||
public:
|
||||
MessageListenerBase()
|
||||
MessageListenerBase(bool toFront)
|
||||
{
|
||||
MessageQueue::getInstance()->registerListener(this);
|
||||
MessageQueue::getInstance()->registerListener(this, toFront);
|
||||
}
|
||||
|
||||
virtual ~MessageListenerBase()
|
||||
|
||||
@@ -16,10 +16,20 @@ std::shared_ptr<MessageQueue> MessageQueue::getInstance()
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
void MessageQueue::registerListener(MessageListenerBase* listener)
|
||||
void MessageQueue::registerListener(MessageListenerBase* listener, bool toFront)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(m_listenersMutex);
|
||||
m_listeners.push_back(listener);
|
||||
|
||||
if (toFront)
|
||||
{
|
||||
m_listeners.insert(m_listeners.begin(), listener);
|
||||
m_listenersLength++;
|
||||
m_currentListenerIndex++;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_listeners.push_back(listener);
|
||||
}
|
||||
}
|
||||
|
||||
void MessageQueue::unregisterListener(MessageListenerBase* listener)
|
||||
|
||||
@@ -13,7 +13,7 @@ class MessageQueue
|
||||
public:
|
||||
static std::shared_ptr<MessageQueue> getInstance();
|
||||
|
||||
void registerListener(MessageListenerBase* listener);
|
||||
void registerListener(MessageListenerBase* listener, bool toFront = false);
|
||||
void unregisterListener(MessageListenerBase* listener);
|
||||
|
||||
void pushMessage(std::shared_ptr<MessageBase> message);
|
||||
|
||||
Reference in New Issue
Block a user