* 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
67 lines
1.5 KiB
C++
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);
|
|
}
|
|
}
|