mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2024-11-15 05:47:56 -07:00
c792961000
Previously the logging was a in a little bit of a disarray. Some things were in namespaces, and other things were not. Given this code will feature a bit of restructuring during the transition over to fmt, this is a good time to unify it under a single namespace and also remove functions and types from the global namespace. Now, all functions and types are under the Common::Log namespace. The only outliers being, of course, the preprocessor macros.
58 lines
1.2 KiB
C++
58 lines
1.2 KiB
C++
// Copyright 2017 Dolphin Emulator Project
|
|
// Licensed under GPLv2+
|
|
// Refer to the license.txt file included.
|
|
|
|
#pragma once
|
|
|
|
#include <QDockWidget>
|
|
|
|
#include <mutex>
|
|
#include <string>
|
|
|
|
#include "Common/FixedSizeQueue.h"
|
|
#include "Common/Logging/LogManager.h"
|
|
|
|
class QCheckBox;
|
|
class QCloseEvent;
|
|
class QComboBox;
|
|
class QPlainTextEdit;
|
|
class QPushButton;
|
|
class QTimer;
|
|
|
|
class LogWidget final : public QDockWidget, Common::Log::LogListener
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit LogWidget(QWidget* parent = nullptr);
|
|
~LogWidget();
|
|
|
|
protected:
|
|
void closeEvent(QCloseEvent*) override;
|
|
|
|
private:
|
|
void UpdateLog();
|
|
void UpdateFont();
|
|
void CreateWidgets();
|
|
void ConnectWidgets();
|
|
void LoadSettings();
|
|
void SaveSettings();
|
|
|
|
void Log(Common::Log::LOG_LEVELS level, const char* text) override;
|
|
|
|
// Log
|
|
QCheckBox* m_log_wrap;
|
|
QComboBox* m_log_font;
|
|
QPushButton* m_log_clear;
|
|
QPlainTextEdit* m_log_text;
|
|
|
|
QTimer* m_timer;
|
|
|
|
using LogEntry = std::pair<std::string, Common::Log::LOG_LEVELS>;
|
|
|
|
// Maximum number of lines to show in log viewer
|
|
static constexpr int MAX_LOG_LINES = 5000;
|
|
|
|
std::mutex m_log_mutex;
|
|
FixedSizeQueue<LogEntry, MAX_LOG_LINES> m_log_ring_buffer;
|
|
};
|