Files
archived-shadPS4/src/qt_gui/log_presets_dialog.h
Valdis Bogdāns 5f0b13ac57 Log presets feature (#3509)
* Log presets feature
- Add “Load Presets…” button in Logger → Log Filter (settings_dialog.ui)
- Implement LogPresetsDialog (table: Comment, Filter)
- Support add (+), multi-remove (−), load via button or double-click
- Persist presets via QSettings at logger_presets/entries (qt_ui.ini)
- Wire button to open dialog and set logFilterLineEdit
- Update CMakeLists.txt to include new dialog sources

* CLang fix

* CLang fix again

* Log Presets: checkbox selection + tri-state header

- Added first column with per-row checkboxes
- Implemented header checkbox with tri-state; click toggles select-all/none
- Synced checkboxes and row selection in both directions
- Header toggle also updates row selection to match
- Remove operates on checked rows; falls back to selected rows if none checked
- Load uses first checked row; falls back to first selected row
- Double-click row triggers the same action as Load
- Load button visible only when exactly one row is selected
- Remove button visible only when at least one row is selected
- Dialog opens with no selected rows and no focused buttons; focus set to table
- New rows start editing in the Comment column
- Serialization updated for new column indices; checkbox state not persisted
- Cleanups: removed unused include and empty helper; pruned temporary comments

* Clang

* Fix: tri‑state header checkbox visible and aligned

- Overlay real QCheckBox in header section 0 (tri‑state)
- Align with row checkboxes using SE_ItemViewItemCheckIndicator
- Reposition on header resize and geometry changes
- Header click + checkbox click toggle select‑all/none
- Tri‑state reflects per‑row checkbox states

* CLang

---------

Co-authored-by: w1naenator <valdis.bogdans@hotmail.com>
2025-09-05 09:50:59 +03:00

55 lines
1.4 KiB
C++

// SPDX-FileCopyrightText: Copyright 2025 shadPS4 Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <QDialog>
#include <QPointer>
class QTableWidget;
class QPushButton;
class QTableWidgetItem;
class QCheckBox;
#include "gui_settings.h"
class LogPresetsDialog : public QDialog {
Q_OBJECT
public:
explicit LogPresetsDialog(std::shared_ptr<gui_settings> gui_settings,
QWidget* parent = nullptr);
~LogPresetsDialog() override = default;
signals:
void PresetChosen(const QString& filter);
protected:
void accept() override;
void reject() override;
private:
void LoadFromSettings();
void SaveToSettings();
void AddAfterSelection();
void RemoveSelected();
void LoadSelected();
void UpdateHeaderCheckState();
void SetAllCheckStates(Qt::CheckState state);
QList<int> GetCheckedRows() const;
void UpdateLoadButtonEnabled();
void PositionHeaderCheckbox();
QList<QString> SerializeTable() const;
void PopulateFromList(const QList<QString>& list);
private:
std::shared_ptr<gui_settings> m_gui_settings;
QTableWidget* m_table = nullptr;
QCheckBox* m_header_checkbox = nullptr;
QPushButton* m_add_btn = nullptr;
QPushButton* m_remove_btn = nullptr;
QPushButton* m_load_btn = nullptr;
QPushButton* m_close_btn = nullptr;
bool m_updating_checks = false;
};