ui: Update error count while parsing

This commit is contained in:
Eberhard Graether
2016-01-28 13:19:38 +01:00
parent 38f943e8a0
commit 635f6058c6
6 changed files with 19 additions and 9 deletions
@@ -17,9 +17,12 @@ StatusBarView* StatusBarController::getView()
return Controller::getView<StatusBarView>();
}
void StatusBarController::handleMessage(MessageFinishedParsing* message)
void StatusBarController::handleMessage(MessageShowErrors* message)
{
getView()->setErrorCount(message->errorCount);
if (message->errorCount >= 0)
{
getView()->setErrorCount(message->errorCount);
}
}
void StatusBarController::handleMessage(MessageStatus* message)
@@ -6,14 +6,14 @@
#include "component/controller/Controller.h"
#include "utility/messaging/MessageListener.h"
#include "utility/messaging/type/MessageFinishedParsing.h"
#include "utility/messaging/type/MessageShowErrors.h"
#include "utility/messaging/type/MessageStatus.h"
class StatusBarView;
class StatusBarController
: public Controller
, public MessageListener<MessageFinishedParsing>
, public MessageListener<MessageShowErrors>
, public MessageListener<MessageStatus>
{
public:
@@ -23,7 +23,7 @@ public:
StatusBarView* getView();
private:
virtual void handleMessage(MessageFinishedParsing* message);
virtual void handleMessage(MessageShowErrors* message);
virtual void handleMessage(MessageStatus* message);
void setStatus(const std::string& status, bool isError, bool showLoader);
@@ -134,7 +134,7 @@ std::shared_ptr<MessageActivateTokens> ActivationTranslator::translateMessage(co
else if (match.searchType == SearchMatch::SEARCH_COMMAND &&
match.getFullName() == SearchMatch::getCommandName(SearchMatch::COMMAND_ERROR))
{
MessageShowErrors msg;
MessageShowErrors msg(-1);
msg.undoRedoType = message->undoRedoType;
msg.dispatchImmediately();
return nullptr;
+5 -1
View File
@@ -165,6 +165,10 @@ void Storage::logStats() const
void Storage::startParsing()
{
MessageShowErrors msg(getErrorCount());
msg.setSendAsTask(false);
msg.dispatch();
m_sqliteStorage.setVersion(Version::getApplicationVersion());
}
@@ -199,7 +203,7 @@ void Storage::onError(const ParseLocation& location, const std::string& message)
if (errorCount != getErrorCount())
{
MessageShowErrors msg;
MessageShowErrors msg(getErrorCount());
msg.setSendAsTask(false);
msg.dispatch();
}
@@ -7,7 +7,8 @@ class MessageShowErrors
: public Message<MessageShowErrors>
{
public:
MessageShowErrors()
MessageShowErrors(int errorCount)
: errorCount(errorCount)
{
}
@@ -15,6 +16,8 @@ public:
{
return "MessageShowErrors";
}
int errorCount;
};
#endif // MESSAGE_SHOW_ERRORS_H
+1 -1
View File
@@ -78,5 +78,5 @@ void QtStatusBar::setErrorCount(size_t count)
void QtStatusBar::showErrors()
{
MessageShowErrors().dispatch();
MessageShowErrors(-1).dispatch();
}