src: code cleanup
* removed unused code: ParseFunction, ParseVariable and ParseTypeUsage. All this is handled using NameHierarchies now. * Moved the getErrorCount method from ParserClient to the StorageAccess * MessageFinishedParsing doesn't know the error count anymore. * StatusBarController now has a StorageAccess to fetch the error count when needed.
This commit is contained in:
@@ -85,7 +85,7 @@ std::shared_ptr<Component> ComponentFactory::createUndoRedoComponent(ViewLayout*
|
||||
std::shared_ptr<Component> ComponentFactory::createStatusBarComponent(ViewLayout* viewLayout)
|
||||
{
|
||||
std::shared_ptr<StatusBarView> view = m_viewFactory->createStatusBarView(viewLayout);
|
||||
std::shared_ptr<StatusBarController> controller = std::make_shared<StatusBarController>();
|
||||
std::shared_ptr<StatusBarController> controller = std::make_shared<StatusBarController>(m_storageAccess);
|
||||
|
||||
return std::make_shared<Component>(view, controller);
|
||||
}
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#include "component/controller/StatusBarController.h"
|
||||
|
||||
#include "component/view/StatusBarView.h"
|
||||
#include "data/access/StorageAccess.h"
|
||||
#include "utility/logging/logging.h"
|
||||
|
||||
#include "component/view/StatusBarView.h"
|
||||
|
||||
StatusBarController::StatusBarController()
|
||||
StatusBarController::StatusBarController(StorageAccess* storageAccess)
|
||||
: m_storageAccess(storageAccess)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -24,7 +25,17 @@ void StatusBarController::handleMessage(MessageClearErrorCount* message)
|
||||
|
||||
void StatusBarController::handleMessage(MessageFinishedParsing* message)
|
||||
{
|
||||
getView()->setErrorCount(message->errorCount);
|
||||
ErrorCountInfo errorCount = m_storageAccess->getErrorCount();
|
||||
getView()->setErrorCount(errorCount);
|
||||
|
||||
std::string status = message->getStatusStr();
|
||||
status += " " + std::to_string(errorCount.total) + " error" + (errorCount.total > 1 ? "s" : "");
|
||||
if (errorCount.fatal > 0)
|
||||
{
|
||||
status += " (" + std::to_string(errorCount.fatal) + " fatal)";
|
||||
}
|
||||
|
||||
MessageStatus(status, errorCount.total > 0).dispatch();
|
||||
}
|
||||
|
||||
void StatusBarController::handleMessage(MessageShowErrors* message)
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
#include "utility/messaging/type/MessageStatus.h"
|
||||
|
||||
class StatusBarView;
|
||||
class StorageAccess;
|
||||
|
||||
class StatusBarController
|
||||
: public Controller
|
||||
@@ -21,7 +22,7 @@ class StatusBarController
|
||||
, public MessageListener<MessageStatus>
|
||||
{
|
||||
public:
|
||||
StatusBarController(void);
|
||||
StatusBarController(StorageAccess* storageAccess);
|
||||
virtual ~StatusBarController(void);
|
||||
|
||||
StatusBarView* getView();
|
||||
@@ -33,6 +34,8 @@ private:
|
||||
virtual void handleMessage(MessageStatus* message);
|
||||
|
||||
void setStatus(const std::string& status, bool isError, bool showLoader);
|
||||
|
||||
StorageAccess* m_storageAccess;
|
||||
};
|
||||
|
||||
#endif // STATUS_BAR_CONTROLLER_H
|
||||
|
||||
Reference in New Issue
Block a user