mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-02-01 11:52:48 +00:00
Qt: allow to disable logging to the log frame while it is hidden
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (/rpcs3/.ci/build-linux-aarch64.sh, gcc, rpcs3/rpcs3-ci-jammy-aarch64:1.7, ubuntu-24.04-arm) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (/rpcs3/.ci/build-linux.sh, gcc, rpcs3/rpcs3-ci-jammy:1.7, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (a1d35836e8d45bfc6f63c26f0a3e5d46ef622fe1, rpcs3/rpcs3-binaries-linux-arm64, /rpcs3/.ci/build-linux-aarch64.sh, clang, rpcs3/rpcs3-ci-jammy-aarch64:1.7, ubuntu-24.04-arm) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (d812f1254a1157c80fd402f94446310560f54e5f, rpcs3/rpcs3-binaries-linux, /rpcs3/.ci/build-linux.sh, clang, rpcs3/rpcs3-ci-jammy:1.7, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / RPCS3 Mac ${{ matrix.name }} (0, 51ae32f468089a8169aaf1567de355ff4a3e0842, rpcs3/rpcs3-binaries-mac, Intel) (push) Waiting to run
Build RPCS3 / RPCS3 Mac ${{ matrix.name }} (1, 8e21bdbc40711a3fccd18fbf17b742348b0f4281, rpcs3/rpcs3-binaries-mac-arm64, Apple Silicon) (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Build RPCS3 / RPCS3 Windows Clang ${{ matrix.arch }} (aarch64, clang, clangarm64, ARM64, windows-11-arm) (push) Waiting to run
Build RPCS3 / RPCS3 Windows Clang ${{ matrix.arch }} (x86_64, clang, clang64, X64, windows-2025) (push) Waiting to run
Build RPCS3 / RPCS3 FreeBSD (push) Waiting to run
Some checks are pending
Generate Translation Template / Generate Translation Template (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (/rpcs3/.ci/build-linux-aarch64.sh, gcc, rpcs3/rpcs3-ci-jammy-aarch64:1.7, ubuntu-24.04-arm) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (/rpcs3/.ci/build-linux.sh, gcc, rpcs3/rpcs3-ci-jammy:1.7, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (a1d35836e8d45bfc6f63c26f0a3e5d46ef622fe1, rpcs3/rpcs3-binaries-linux-arm64, /rpcs3/.ci/build-linux-aarch64.sh, clang, rpcs3/rpcs3-ci-jammy-aarch64:1.7, ubuntu-24.04-arm) (push) Waiting to run
Build RPCS3 / RPCS3 Linux ${{ matrix.os }} ${{ matrix.compiler }} (d812f1254a1157c80fd402f94446310560f54e5f, rpcs3/rpcs3-binaries-linux, /rpcs3/.ci/build-linux.sh, clang, rpcs3/rpcs3-ci-jammy:1.7, ubuntu-24.04) (push) Waiting to run
Build RPCS3 / RPCS3 Mac ${{ matrix.name }} (0, 51ae32f468089a8169aaf1567de355ff4a3e0842, rpcs3/rpcs3-binaries-mac, Intel) (push) Waiting to run
Build RPCS3 / RPCS3 Mac ${{ matrix.name }} (1, 8e21bdbc40711a3fccd18fbf17b742348b0f4281, rpcs3/rpcs3-binaries-mac-arm64, Apple Silicon) (push) Waiting to run
Build RPCS3 / RPCS3 Windows (push) Waiting to run
Build RPCS3 / RPCS3 Windows Clang ${{ matrix.arch }} (aarch64, clang, clangarm64, ARM64, windows-11-arm) (push) Waiting to run
Build RPCS3 / RPCS3 Windows Clang ${{ matrix.arch }} (x86_64, clang, clang64, X64, windows-2025) (push) Waiting to run
Build RPCS3 / RPCS3 FreeBSD (push) Waiting to run
This commit is contained in:
parent
f883718b23
commit
d854ff03fe
@ -599,7 +599,7 @@ void usb_device_mic::control_transfer(u8 bmRequestType, u8 bRequest, u16 wValue,
|
||||
case GET_MIN:
|
||||
{
|
||||
ensure(buf_size >= 2);
|
||||
constexpr s16 minVol = 0xff00;
|
||||
constexpr s16 minVol = -256;
|
||||
buf[0] = (minVol ) & 0xff;
|
||||
buf[1] = (minVol >> 8) & 0xff;
|
||||
usb_mic_log.notice("Get Min Volume: 0x%04x (%d dB)", minVol, minVol / 256);
|
||||
@ -608,7 +608,7 @@ void usb_device_mic::control_transfer(u8 bmRequestType, u8 bRequest, u16 wValue,
|
||||
case GET_MAX:
|
||||
{
|
||||
ensure(buf_size >= 2);
|
||||
constexpr s16 maxVol = 0x0100;
|
||||
constexpr s16 maxVol = 256;
|
||||
buf[0] = (maxVol ) & 0xff;
|
||||
buf[1] = (maxVol >> 8) & 0xff;
|
||||
usb_mic_log.notice("Get Max Volume: 0x%04x (%d dB)", maxVol, maxVol / 256);
|
||||
|
||||
@ -237,6 +237,7 @@ namespace gui
|
||||
const gui_save l_ansi_code = gui_save(logger, "ANSI_code", true);
|
||||
const gui_save l_limit = gui_save(logger, "limit", 1000);
|
||||
const gui_save l_limit_tty = gui_save(logger, "TTY_limit", 1000);
|
||||
const gui_save l_log_hide = gui_save(logger, "Log hide", false);
|
||||
|
||||
const gui_save d_splitterState = gui_save(debugger, "splitterState", QByteArray());
|
||||
|
||||
|
||||
@ -39,6 +39,7 @@ struct gui_listener : logs::listener
|
||||
lf_queue<packet_t> queue;
|
||||
|
||||
atomic_t<bool> show_prefix{false};
|
||||
atomic_t<bool> logging_enabled{true};
|
||||
|
||||
gui_listener()
|
||||
: logs::listener()
|
||||
@ -55,7 +56,7 @@ struct gui_listener : logs::listener
|
||||
{
|
||||
Q_UNUSED(stamp)
|
||||
|
||||
if (msg <= enabled)
|
||||
if (msg <= enabled && (logging_enabled || msg <= logs::level::fatal))
|
||||
{
|
||||
packet_t p,* _new = &p;
|
||||
_new->sev = msg;
|
||||
@ -237,7 +238,7 @@ void log_frame::CreateAndConnectActions()
|
||||
};
|
||||
|
||||
m_clear_act = new QAction(tr("Clear"), this);
|
||||
connect(m_clear_act, &QAction::triggered, [this]()
|
||||
connect(m_clear_act, &QAction::triggered, this, [this]()
|
||||
{
|
||||
m_old_log_text.clear();
|
||||
m_log->clear();
|
||||
@ -245,14 +246,14 @@ void log_frame::CreateAndConnectActions()
|
||||
});
|
||||
|
||||
m_clear_tty_act = new QAction(tr("Clear"), this);
|
||||
connect(m_clear_tty_act, &QAction::triggered, [this]()
|
||||
connect(m_clear_tty_act, &QAction::triggered, this, [this]()
|
||||
{
|
||||
m_old_tty_text.clear();
|
||||
m_tty->clear();
|
||||
});
|
||||
|
||||
m_perform_goto_on_debugger = new QAction(tr("Go-To on Debugger"), this);
|
||||
connect(m_perform_goto_on_debugger, &QAction::triggered, [this]()
|
||||
connect(m_perform_goto_on_debugger, &QAction::triggered, this, [this]()
|
||||
{
|
||||
QPlainTextEdit* pte = (m_tabWidget->currentIndex() == 1 ? m_tty : m_log);
|
||||
Q_EMIT PerformGoToOnDebugger(pte->textCursor().selectedText(), true);
|
||||
@ -274,7 +275,7 @@ void log_frame::CreateAndConnectActions()
|
||||
});
|
||||
|
||||
m_perform_goto_thread_on_debugger = new QAction(tr("Show Thread on Debugger"), this);
|
||||
connect(m_perform_goto_thread_on_debugger, &QAction::triggered, [this]()
|
||||
connect(m_perform_goto_thread_on_debugger, &QAction::triggered, this, [this]()
|
||||
{
|
||||
QPlainTextEdit* pte = (m_tabWidget->currentIndex() == 1 ? m_tty : m_log);
|
||||
Q_EMIT PerformGoToOnDebugger(pte->textCursor().selectedText(), false);
|
||||
@ -282,7 +283,7 @@ void log_frame::CreateAndConnectActions()
|
||||
|
||||
m_stack_act_tty = new QAction(tr("Stack Mode (TTY)"), this);
|
||||
m_stack_act_tty->setCheckable(true);
|
||||
connect(m_stack_act_tty, &QAction::toggled, [this](bool checked)
|
||||
connect(m_stack_act_tty, &QAction::toggled, this, [this](bool checked)
|
||||
{
|
||||
m_gui_settings->SetValue(gui::l_stack_tty, checked);
|
||||
m_stack_tty = checked;
|
||||
@ -290,7 +291,7 @@ void log_frame::CreateAndConnectActions()
|
||||
|
||||
m_ansi_act_tty = new QAction(tr("ANSI Code (TTY)"), this);
|
||||
m_ansi_act_tty->setCheckable(true);
|
||||
connect(m_ansi_act_tty, &QAction::toggled, [this](bool checked)
|
||||
connect(m_ansi_act_tty, &QAction::toggled, this, [this](bool checked)
|
||||
{
|
||||
m_gui_settings->SetValue(gui::l_ansi_code, checked);
|
||||
m_ansi_tty = checked;
|
||||
@ -311,7 +312,7 @@ void log_frame::CreateAndConnectActions()
|
||||
QAction* all_channels_act = new QAction(tr("All user channels"), m_tty_channel_acts);
|
||||
all_channels_act->setCheckable(true);
|
||||
all_channels_act->setChecked(m_tty_channel == -1);
|
||||
connect(all_channels_act, &QAction::triggered, [this]()
|
||||
connect(all_channels_act, &QAction::triggered, this, [this]()
|
||||
{
|
||||
m_tty_channel = -1;
|
||||
m_tty_input->setPlaceholderText(tr("All user channels"));
|
||||
@ -322,7 +323,7 @@ void log_frame::CreateAndConnectActions()
|
||||
QAction* act = new QAction(tr("Channel %0").arg(i), m_tty_channel_acts);
|
||||
act->setCheckable(true);
|
||||
act->setChecked(i == m_tty_channel);
|
||||
connect(act, &QAction::triggered, [this, i]()
|
||||
connect(act, &QAction::triggered, this, [this, i]()
|
||||
{
|
||||
m_tty_channel = i;
|
||||
m_tty_input->setPlaceholderText(tr("Channel %0").arg(m_tty_channel));
|
||||
@ -343,7 +344,7 @@ void log_frame::CreateAndConnectActions()
|
||||
|
||||
m_stack_act_log = new QAction(tr("Stack Mode (Log)"), this);
|
||||
m_stack_act_log->setCheckable(true);
|
||||
connect(m_stack_act_log, &QAction::toggled, [this](bool checked)
|
||||
connect(m_stack_act_log, &QAction::toggled, this, [this](bool checked)
|
||||
{
|
||||
m_gui_settings->SetValue(gui::l_stack, checked);
|
||||
m_stack_log = checked;
|
||||
@ -351,7 +352,7 @@ void log_frame::CreateAndConnectActions()
|
||||
|
||||
m_stack_act_err = new QAction(tr("Stack Cell Errors"), this);
|
||||
m_stack_act_err->setCheckable(true);
|
||||
connect(m_stack_act_err, &QAction::toggled, [this](bool checked)
|
||||
connect(m_stack_act_err, &QAction::toggled, this, [this](bool checked)
|
||||
{
|
||||
m_gui_settings->SetValue(gui::l_stack_err, checked);
|
||||
g_log_all_errors = !checked;
|
||||
@ -359,15 +360,27 @@ void log_frame::CreateAndConnectActions()
|
||||
|
||||
m_show_prefix_act = new QAction(tr("Show Thread Prefix"), this);
|
||||
m_show_prefix_act->setCheckable(true);
|
||||
connect(m_show_prefix_act, &QAction::toggled, [this](bool checked)
|
||||
connect(m_show_prefix_act, &QAction::toggled, this, [this](bool checked)
|
||||
{
|
||||
m_gui_settings->SetValue(gui::l_prefix, checked);
|
||||
s_gui_listener.show_prefix = checked;
|
||||
});
|
||||
|
||||
m_log_while_hidden_act = new QAction(tr("Print Log/TTY while hidden"), this);
|
||||
m_log_while_hidden_act->setCheckable(true);
|
||||
connect(m_log_while_hidden_act, &QAction::toggled, this, [this](bool checked)
|
||||
{
|
||||
m_gui_settings->SetValue(gui::l_log_hide, checked);
|
||||
s_gui_listener.logging_enabled = checked || isVisible();
|
||||
});
|
||||
connect(this, &log_frame::visibilityChanged, this, [this](bool visible)
|
||||
{
|
||||
s_gui_listener.logging_enabled = m_log_while_hidden_act->isChecked() || visible;
|
||||
});
|
||||
|
||||
m_tty_act = new QAction(tr("Enable TTY"), this);
|
||||
m_tty_act->setCheckable(true);
|
||||
connect(m_tty_act, &QAction::triggered, [this](bool checked)
|
||||
connect(m_tty_act, &QAction::triggered, this, [this](bool checked)
|
||||
{
|
||||
m_gui_settings->SetValue(gui::l_tty, checked);
|
||||
});
|
||||
@ -381,7 +394,7 @@ void log_frame::CreateAndConnectActions()
|
||||
l_initAct(m_notice_act, logs::level::notice);
|
||||
l_initAct(m_trace_act, logs::level::trace);
|
||||
|
||||
connect(m_log, &QWidget::customContextMenuRequested, [this](const QPoint& pos)
|
||||
connect(m_log, &QWidget::customContextMenuRequested, this, [this](const QPoint& pos)
|
||||
{
|
||||
QMenu* menu = m_log->createStandardContextMenu();
|
||||
menu->addAction(m_clear_act);
|
||||
@ -403,13 +416,14 @@ void log_frame::CreateAndConnectActions()
|
||||
menu->addAction(m_stack_act_log);
|
||||
menu->addAction(m_stack_act_err);
|
||||
menu->addAction(m_show_prefix_act);
|
||||
menu->addAction(m_log_while_hidden_act);
|
||||
menu->addSeparator();
|
||||
menu->addActions(m_log_level_acts->actions());
|
||||
|
||||
menu->exec(m_log->viewport()->mapToGlobal(pos));
|
||||
});
|
||||
|
||||
connect(m_tty, &QWidget::customContextMenuRequested, [this](const QPoint& pos)
|
||||
connect(m_tty, &QWidget::customContextMenuRequested, this, [this](const QPoint& pos)
|
||||
{
|
||||
QMenu* menu = m_tty->createStandardContextMenu();
|
||||
menu->addAction(m_clear_tty_act);
|
||||
@ -432,13 +446,13 @@ void log_frame::CreateAndConnectActions()
|
||||
menu->exec(m_tty->viewport()->mapToGlobal(pos));
|
||||
});
|
||||
|
||||
connect(m_tabWidget, &QTabWidget::currentChanged, [this](int/* index*/)
|
||||
connect(m_tabWidget, &QTabWidget::currentChanged, this, [this](int/* index*/)
|
||||
{
|
||||
if (m_find_dialog)
|
||||
m_find_dialog->close();
|
||||
});
|
||||
|
||||
connect(m_tty_input, &QLineEdit::returnPressed, [this]()
|
||||
connect(m_tty_input, &QLineEdit::returnPressed, this, [this]()
|
||||
{
|
||||
std::string text = m_tty_input->text().toStdString();
|
||||
|
||||
@ -492,6 +506,9 @@ void log_frame::LoadSettings()
|
||||
m_ansi_act_tty->setChecked(m_ansi_tty);
|
||||
m_stack_act_err->setChecked(!g_log_all_errors);
|
||||
|
||||
m_log_while_hidden_act->setChecked(m_gui_settings->GetValue(gui::l_log_hide).toBool());
|
||||
s_gui_listener.logging_enabled = m_log_while_hidden_act->isChecked() || isVisible();
|
||||
|
||||
s_gui_listener.show_prefix = m_gui_settings->GetValue(gui::l_prefix).toBool();
|
||||
m_show_prefix_act->setChecked(s_gui_listener.show_prefix);
|
||||
|
||||
@ -599,9 +616,9 @@ void log_frame::UpdateUI()
|
||||
const std::chrono::time_point log_timeout = start + 7ms;
|
||||
|
||||
// Check TTY logs
|
||||
if (u64 size = std::max<s64>(0, m_tty_file ? (g_tty_size.load() - m_tty_file.pos()) : 0))
|
||||
if (const u64 size = std::max<s64>(0, m_tty_file ? (g_tty_size.load() - m_tty_file.pos()) : 0))
|
||||
{
|
||||
if (m_tty_act->isChecked())
|
||||
if (m_tty_act->isChecked() && s_gui_listener.logging_enabled)
|
||||
{
|
||||
m_tty_buf.resize(std::min<u64>(size, m_tty_limited_read ? m_tty_limited_read : usz{umax}));
|
||||
m_tty_buf.resize(m_tty_file.read(&m_tty_buf.front(), m_tty_buf.size()));
|
||||
@ -781,7 +798,7 @@ void log_frame::UpdateUI()
|
||||
usz first_rep_counter = m_log_counter;
|
||||
|
||||
// Batch output of multiple lines if possible (optimization)
|
||||
auto flush = [&]()
|
||||
const auto flush = [&]()
|
||||
{
|
||||
if (m_log_text.isEmpty() && !is_first_rep)
|
||||
{
|
||||
|
||||
@ -95,6 +95,7 @@ private:
|
||||
QAction* m_stack_act_err = nullptr;
|
||||
|
||||
QAction* m_show_prefix_act = nullptr;
|
||||
QAction* m_log_while_hidden_act = nullptr;
|
||||
|
||||
QAction* m_tty_act = nullptr;
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user