src: Removed unused Log component and QtSplashScreen

This commit is contained in:
Eberhard Graether
2017-09-21 01:59:36 +02:00
parent 1e7d934cb8
commit 83c24c5cd0
17 changed files with 0 additions and 818 deletions
-4
View File
@@ -29,8 +29,6 @@ add_files(
component/controller/GraphController.h
component/controller/IDECommunicationController.cpp
component/controller/IDECommunicationController.h
component/controller/LogController.cpp
component/controller/LogController.h
component/controller/RefreshController.cpp
component/controller/RefreshController.h
component/controller/ScreenSearchController.cpp
@@ -63,8 +61,6 @@ add_files(
component/view/GraphViewStyle.cpp
component/view/GraphViewStyle.h
component/view/GraphViewStyleImpl.h
component/view/LogView.cpp
component/view/LogView.h
component/view/MainView.cpp
component/view/MainView.h
component/view/RefreshView.cpp
-14
View File
@@ -6,7 +6,6 @@
#include "component/controller/CodeController.h"
#include "component/controller/ErrorController.h"
#include "component/controller/GraphController.h"
#include "component/controller/LogController.h"
#include "component/controller/RefreshController.h"
#include "component/controller/ScreenSearchController.h"
#include "component/controller/SearchController.h"
@@ -17,7 +16,6 @@
#include "component/view/BookmarkView.h"
#include "component/view/CodeView.h"
#include "component/view/ErrorView.h"
#include "component/view/LogView.h"
#include "component/view/RefreshView.h"
#include "component/view/ScreenSearchView.h"
#include "component/view/SearchView.h"
@@ -27,8 +25,6 @@
#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());
@@ -92,16 +88,6 @@ std::shared_ptr<Component> ComponentFactory::createGraphComponent(ViewLayout* vi
return std::make_shared<Component>(view, controller);
}
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>();
LogManager::getInstance()->addLogger(controller);
return std::make_shared<Component>(view, controller);
}
std::shared_ptr<Component> ComponentFactory::createRefreshComponent(ViewLayout* viewLayout)
{
std::shared_ptr<View> view = m_viewFactory->createRefreshView(viewLayout);
-1
View File
@@ -24,7 +24,6 @@ public:
std::shared_ptr<Component> createCodeComponent(ViewLayout* viewLayout);
std::shared_ptr<Component> createErrorComponent(ViewLayout* viewLayout);
std::shared_ptr<Component> createGraphComponent(ViewLayout* viewLayout);
std::shared_ptr<Component> createLogComponent(ViewLayout* viewLayout);
std::shared_ptr<Component> createRefreshComponent(ViewLayout* viewLayout);
std::shared_ptr<Component> createScreenSearchComponent(ViewLayout* viewLayout);
std::shared_ptr<Component> createSearchComponent(ViewLayout* viewLayout);
@@ -1,132 +0,0 @@
#include "component/controller/LogController.h"
#include "settings/ApplicationSettings.h"
LogController::LogController()
: Logger("WindowLogger")
, m_enabled(false)
{
}
LogController::~LogController()
{
}
void LogController::setEnabled(bool enabled)
{
m_enabled = enabled;
}
bool LogController::getEnabled() const
{
return m_enabled;
}
LogView* LogController::getView() const
{
return Controller::getView<LogView>();
}
void LogController::clear()
{
std::lock_guard<std::mutex> lock(m_logsMutex);
m_logs.clear();
getView()->clear();
}
void LogController::logInfo(const LogMessage& message )
{
if (!m_enabled)
{
return;
}
if (m_logLevel & Logger::LOG_INFOS)
{
addLog(LOG_INFOS, message);
}
}
void LogController::logError(const LogMessage& message )
{
if (!m_enabled)
{
return;
}
if (m_logLevel & Logger::LOG_ERRORS)
{
addLog(LOG_ERRORS, message);
}
}
void LogController::logWarning(const LogMessage& message )
{
if (!m_enabled)
{
return;
}
if (m_logLevel & Logger::LOG_WARNINGS)
{
addLog(LOG_WARNINGS, message);
}
}
void LogController::handleMessage(MessageLogFilterChanged* message)
{
m_logLevel = message->logFilter;
ApplicationSettings* settings = ApplicationSettings::getInstance().get();
settings->setLogFilter(m_logLevel);
settings->save();
syncLogs();
}
void LogController::handleMessage(MessageClearLogView* message)
{
clear();
}
void LogController::addLog(Logger::LogLevel type, const LogMessage& message)
{
std::lock_guard<std::mutex> lock(m_logsMutex);
m_logs.push_back(
Log(
type,
(message.getFileName().empty() ? "" : message.getFileName() + ": ") + message.message,
message.getTimeString("%H:%M:%S")
)
);
if (!m_waiting)
{
m_waiting = true;
std::thread([&]()
{
std::this_thread::sleep_for(std::chrono::milliseconds(200));
syncLogs();
m_waiting = false;
}
).detach();
}
}
void LogController::syncLogs()
{
std::lock_guard<std::mutex> lock(m_logsMutex);
int logCount = m_logs.size();
if (logCount > getView()->LogLimit)
{
m_logs.erase(m_logs.begin(), m_logs.begin() + logCount - LogView::LogLimit);
}
std::vector<Log> logs;
for (const Log& log : m_logs)
{
if (log.type & m_logLevel)
{
logs.push_back(log);
}
}
getView()->addLogs(logs);
}
@@ -1,54 +0,0 @@
#ifndef LOG_CONTROLLER_H
#define LOG_CONTROLLER_H
#include <mutex>
#include "component/controller/Controller.h"
#include "component/view/LogView.h"
#include "utility/logging/Logger.h"
#include "utility/logging/LogMessage.h"
#include "utility/messaging/MessageListener.h"
#include "utility/messaging/type/MessageClearLogView.h"
#include "utility/messaging/type/MessageLogFilterChanged.h"
class StorageAccess;
class LogController
: public Controller
, public Logger
, public MessageListener<MessageClearLogView>
, public MessageListener<MessageLogFilterChanged>
{
public:
LogController();
~LogController();
void setEnabled(bool enabled);
bool getEnabled() const;
private:
bool m_enabled;
LogView* getView() const;
virtual void clear();
virtual void logInfo(const LogMessage& message);
virtual void logWarning(const LogMessage& message);
virtual void logError(const LogMessage& message);
virtual void handleMessage(MessageClearLogView* message);
virtual void handleMessage(MessageLogFilterChanged* message);
void addLog(Logger::LogLevel type, const LogMessage& message);
void syncLogs();
std::vector<Log> m_logs;
Logger::LogLevelMask m_logLevel;
std::mutex m_logsMutex;
bool m_waiting;
};
#endif // LOG_CONTROLLER_H
-22
View File
@@ -1,22 +0,0 @@
#include "component/view/LogView.h"
const int LogView::LogLimit = 500;
LogView::LogView(ViewLayout* viewLayout)
: View(viewLayout)
{
}
LogView::~LogView()
{
}
std::string LogView::getName() const
{
return "Logs";
}
bool LogView::hasLogLevel(const Logger::LogLevel type, const Logger::LogLevelMask mask) const
{
return mask & type;
}
-37
View File
@@ -1,37 +0,0 @@
#ifndef LOG_VIEW_H
#define LOG_VIEW_H
#include "component/view/View.h"
#include "utility/logging/LogMessage.h"
#include "utility/logging/Logger.h"
struct Log
{
Log(Logger::LogLevel type, std::string message, std::string timestamp)
: type(type)
, message(message)
, timestamp(timestamp){}
Logger::LogLevel type;
std::string message;
std::string timestamp;
};
class LogView
: public View
{
public:
LogView(ViewLayout* viewLayout);
virtual ~LogView();
virtual std::string getName() const;
virtual bool hasLogLevel(const Logger::LogLevel type, const Logger::LogLevelMask mask) const;
virtual void clear() = 0;
virtual void addLog(Logger::LogLevel type, const LogMessage& message) = 0;
virtual void addLogs(const std::vector<Log>& logs) = 0;
static const int LogLimit;
};
#endif // LOG_VIEW_H
-2
View File
@@ -11,7 +11,6 @@ class DialogView;
class ErrorView;
class GraphView;
class MainView;
class LogView;
class RefreshView;
class ScreenSearchView;
class SearchView;
@@ -38,7 +37,6 @@ public:
virtual std::shared_ptr<CodeView> createCodeView(ViewLayout* viewLayout) const = 0;
virtual std::shared_ptr<ErrorView> createErrorView(ViewLayout* viewLayout) const = 0;
virtual std::shared_ptr<GraphView> createGraphView(ViewLayout* viewLayout) const = 0;
virtual std::shared_ptr<LogView> createLogView(ViewLayout* viewLayout) const = 0;
virtual std::shared_ptr<RefreshView> createRefreshView(ViewLayout* viewLayout) const = 0;
virtual std::shared_ptr<ScreenSearchView> createScreenSearchView(ViewLayout* viewLayout) const = 0;
virtual std::shared_ptr<SearchView> createSearchView(ViewLayout* viewLayout) const = 0;