Files
Sourcetrail/src/lib/component/controller/StatusBarController.cpp
T
Eberhard Graether 48ece50eca src: Added more status messages and some fixes
* Elide status bar messages to avoid window resize window
* Fixed status view clearing when switching projects
* Refactored app setting loading
* Replace newline characters with spaces in status view
2016-12-13 01:41:06 +01:00

67 lines
1.5 KiB
C++

#include "component/controller/StatusBarController.h"
#include "component/view/StatusBarView.h"
#include "data/access/StorageAccess.h"
#include "utility/logging/logging.h"
#include "utility/utilityString.h"
StatusBarController::StatusBarController(StorageAccess* storageAccess)
: m_storageAccess(storageAccess)
{
}
StatusBarController::~StatusBarController()
{
}
StatusBarView* StatusBarController::getView()
{
return Controller::getView<StatusBarView>();
}
void StatusBarController::clear()
{
getView()->setErrorCount(ErrorCountInfo());
}
void StatusBarController::handleMessage(MessageClearErrorCount* message)
{
getView()->setErrorCount(ErrorCountInfo());
}
void StatusBarController::handleMessage(MessageFinishedParsing* message)
{
ErrorCountInfo errorCount = m_storageAccess->getErrorCount();
getView()->setErrorCount(errorCount);
}
void StatusBarController::handleMessage(MessageRefresh* message)
{
getView()->setErrorCount(m_storageAccess->getErrorCount());
}
void StatusBarController::handleMessage(MessageShowErrors* message)
{
if (message->errorId || message->isReplayed())
{
return;
}
getView()->setErrorCount(message->errorCount);
}
void StatusBarController::handleMessage(MessageStatus* message)
{
setStatus(message->status, message->isError, message->showLoader);
}
void StatusBarController::setStatus(const std::string& status, bool isError, bool showLoader)
{
if (!status.empty())
{
LOG_INFO_STREAM(<< "STATUS " << status);
getView()->showMessage(status, isError, showLoader);
}
}