ui: log tab
This commit is contained in:
@@ -285,6 +285,7 @@ add_files(
|
||||
utility/messaging/type/MessageLoadProject.h
|
||||
utility/messaging/type/MessageMoveIDECursor.h
|
||||
utility/messaging/type/MessageNewErrors.h
|
||||
utility/messaging/type/MessageNewLog.h
|
||||
utility/messaging/type/MessagePluginPortChange.h
|
||||
utility/messaging/type/MessageProjectEdit.h
|
||||
utility/messaging/type/MessageProjectNew.h
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
#include "component/view/UndoRedoView.h"
|
||||
#include "component/view/ViewFactory.h"
|
||||
|
||||
#include "utility/logging/LogManager.h"
|
||||
|
||||
std::shared_ptr<ComponentFactory> ComponentFactory::create(ViewFactory* viewFactory, StorageAccess* storageAccess)
|
||||
{
|
||||
std::shared_ptr<ComponentFactory> ptr(new ComponentFactory());
|
||||
@@ -63,7 +65,9 @@ std::shared_ptr<Component> ComponentFactory::createErrorComponent(ViewLayout* vi
|
||||
std::shared_ptr<Component> ComponentFactory::createLogComponent(ViewLayout* viewLayout)
|
||||
{
|
||||
std::shared_ptr<LogView> view = m_viewFactory->createLogView(viewLayout);
|
||||
std::shared_ptr<LogController> controller = std::make_shared<LogController>(m_storageAccess);
|
||||
std::shared_ptr<LogController> controller = std::make_shared<LogController>();
|
||||
|
||||
LogManager::getInstance()->addLogger(controller);
|
||||
|
||||
return std::make_shared<Component>(view, controller);
|
||||
}
|
||||
|
||||
@@ -63,8 +63,8 @@ void ComponentManager::setup(ViewLayout* viewLayout)
|
||||
std::shared_ptr<Component> errorComponent = m_componentFactory->createErrorComponent(tabbedView.get());
|
||||
m_components.push_back(errorComponent);
|
||||
|
||||
//std::shared_ptr<Component> logComponent = m_componentFactory->createLogComponent(tabbedView.get());
|
||||
//m_components.push_back(logComponent);
|
||||
std::shared_ptr<Component> logComponent = m_componentFactory->createLogComponent(tabbedView.get());
|
||||
m_components.push_back(logComponent);
|
||||
}
|
||||
|
||||
void ComponentManager::clearComponents()
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
#include "component/controller/LogController.h"
|
||||
|
||||
#include "data/access/StorageAccess.h"
|
||||
#include "utility/logging/LogManager.h"
|
||||
|
||||
LogController::LogController(StorageAccess* storageAccess)
|
||||
: m_storageAccess(storageAccess)
|
||||
LogController::LogController()
|
||||
: Logger("WindowLogger")
|
||||
{
|
||||
}
|
||||
|
||||
@@ -20,3 +21,29 @@ void LogController::clear()
|
||||
{
|
||||
getView()->clear();
|
||||
}
|
||||
|
||||
void LogController::logInfo(const LogMessage& message )
|
||||
{
|
||||
addLog(LOG_INFOS, message);
|
||||
}
|
||||
|
||||
void LogController::logError(const LogMessage& message )
|
||||
{
|
||||
addLog(LOG_ERRORS, message);
|
||||
}
|
||||
|
||||
void LogController::logWarning(const LogMessage& message )
|
||||
{
|
||||
addLog(LOG_WARNINGS, message);
|
||||
}
|
||||
|
||||
void LogController::addLog(Logger::LogLevel type, const LogMessage& message)
|
||||
{
|
||||
MessageNewLog(type,message).dispatch();
|
||||
}
|
||||
|
||||
void LogController::handleMessage(MessageNewLog* message)
|
||||
{
|
||||
getView()->addLog(message->type, message->message);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,21 +4,33 @@
|
||||
#include "component/controller/Controller.h"
|
||||
#include "component/view/LogView.h"
|
||||
|
||||
#include "utility/logging/Logger.h"
|
||||
#include "utility/logging/LogMessage.h"
|
||||
#include "utility/messaging/type/MessageNewLog.h"
|
||||
#include "utility/messaging/MessageListener.h"
|
||||
|
||||
class StorageAccess;
|
||||
|
||||
class LogController
|
||||
: public Controller
|
||||
, public Logger
|
||||
, public MessageListener<MessageNewLog>
|
||||
{
|
||||
public:
|
||||
LogController(StorageAccess* storageAccess);
|
||||
LogController();
|
||||
~LogController();
|
||||
|
||||
private:
|
||||
LogView* getView() const;
|
||||
|
||||
virtual void handleMessage(MessageNewLog* message);
|
||||
virtual void clear();
|
||||
|
||||
StorageAccess* m_storageAccess;
|
||||
virtual void logInfo(const LogMessage& message);
|
||||
virtual void logWarning(const LogMessage& message);
|
||||
virtual void logError(const LogMessage& message);
|
||||
|
||||
void addLog(Logger::LogLevel type, const LogMessage& message);
|
||||
};
|
||||
|
||||
#endif // LOG_CONTROLLER_H
|
||||
|
||||
@@ -3,6 +3,9 @@
|
||||
|
||||
#include "component/view/View.h"
|
||||
|
||||
#include "utility/logging/LogMessage.h"
|
||||
#include "utility/logging/Logger.h"
|
||||
|
||||
class LogView
|
||||
: public View
|
||||
{
|
||||
@@ -13,6 +16,7 @@ public:
|
||||
virtual std::string getName() const;
|
||||
|
||||
virtual void clear() = 0;
|
||||
virtual void addLog(Logger::LogLevel type, const LogMessage& message) = 0;
|
||||
};
|
||||
|
||||
#endif // LOG_VIEW_H
|
||||
|
||||
@@ -18,7 +18,7 @@ ColorScheme::~ColorScheme()
|
||||
|
||||
std::string ColorScheme::getColor(const std::string& key) const
|
||||
{
|
||||
return getValue<std::string>(key, "");
|
||||
return getValue<std::string>(key, "#FF1493");
|
||||
}
|
||||
|
||||
std::string ColorScheme::getColor(const std::string& key, const std::string& defaultColor) const
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
#ifndef MESSAGE_NEW_LOG_H
|
||||
#define MESSAGE_NEW_LOG_H
|
||||
|
||||
#include "utility/messaging/Message.h"
|
||||
|
||||
#include "utility/logging/logging.h"
|
||||
|
||||
class MessageNewLog
|
||||
: public Message<MessageNewLog>
|
||||
{
|
||||
public:
|
||||
MessageNewLog(const Logger::LogLevel type, const LogMessage& message)
|
||||
: type(type)
|
||||
, message(message)
|
||||
{
|
||||
setSendAsTask(false);
|
||||
setIsLogged(false);
|
||||
}
|
||||
|
||||
static const std::string getStaticType()
|
||||
{
|
||||
return "MessageNewLog";
|
||||
}
|
||||
|
||||
virtual void print(std::ostream& os) const
|
||||
{
|
||||
os << "Log: " << message.message;
|
||||
}
|
||||
|
||||
const Logger::LogLevel type;
|
||||
const LogMessage message;
|
||||
};
|
||||
|
||||
#endif // MESSAGE_NEW_LOG_H
|
||||
@@ -46,6 +46,8 @@ namespace utility
|
||||
|
||||
template<typename T>
|
||||
std::vector<std::string> toStrings(const std::vector<T>& d);
|
||||
template<>
|
||||
std::vector<std::string> toStrings(const std::vector<FilePath>& d);
|
||||
|
||||
template<typename T>
|
||||
bool isPermutation(const std::vector<T>& a, const std::vector<T>& b)
|
||||
|
||||
Reference in New Issue
Block a user