2024-01-11 09:38:28 +00:00
|
|
|
// SPDX-FileCopyrightText: 2002-2024 PCSX2 Dev Team
|
2024-07-30 11:42:36 +00:00
|
|
|
// SPDX-License-Identifier: GPL-3.0+
|
2024-01-11 09:38:28 +00:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "common/Console.h"
|
|
|
|
|
|
|
|
#include <QtWidgets/QMainWindow>
|
|
|
|
#include <QtWidgets/QPlainTextEdit>
|
|
|
|
|
|
|
|
class LogWindow : public QMainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
LogWindow(bool attach_to_main);
|
|
|
|
~LogWindow();
|
|
|
|
|
|
|
|
static void updateSettings();
|
|
|
|
static void destroy();
|
|
|
|
|
|
|
|
__fi bool isAttachedToMainWindow() const { return m_attached_to_main_window; }
|
|
|
|
void reattachToMainWindow();
|
|
|
|
|
|
|
|
void updateWindowTitle();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void createUi();
|
|
|
|
|
|
|
|
static void logCallback(LOGLEVEL level, ConsoleColors color, std::string_view message);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void closeEvent(QCloseEvent* event);
|
|
|
|
|
|
|
|
private Q_SLOTS:
|
|
|
|
void onClearTriggered();
|
|
|
|
void onSaveTriggered();
|
|
|
|
void appendMessage(quint32 level, quint32 color, const QString& message);
|
|
|
|
|
|
|
|
private:
|
|
|
|
static constexpr int DEFAULT_WIDTH = 750;
|
|
|
|
static constexpr int DEFAULT_HEIGHT = 400;
|
|
|
|
|
|
|
|
void saveSize();
|
|
|
|
void restoreSize();
|
|
|
|
|
|
|
|
QPlainTextEdit* m_text;
|
|
|
|
QMenu* m_level_menu;
|
|
|
|
|
|
|
|
bool m_attached_to_main_window = true;
|
2024-03-20 16:36:52 +00:00
|
|
|
bool m_destroying = false;
|
2024-01-11 09:38:28 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern LogWindow* g_log_window;
|