mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-08-22 16:44:14 +02:00
e9ee8b600b
Replace the flat QTableWidget with a QTreeWidget that groups actions under one collapsible top-level node per category. Fix the search box so it also matches the current key sequence (exactly), accepts multi-keyword queries (AND, any word order) and is accent-insensitive, auto-expands matching groups and shows an "N actions" count. Add a quick filter (all / bound / unbound / conflicts) that combines with the text query. Conflict detection, per-row reset, reset-all and persistence are preserved. Co-Authored-By: Claude <noreply@anthropic.com>
87 lines
2.1 KiB
C++
87 lines
2.1 KiB
C++
/*
|
|
Copyright 2006-2026 The QElectroTech Team
|
|
This file is part of QElectroTech.
|
|
|
|
QElectroTech is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
(at your option) any later version.
|
|
|
|
QElectroTech is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
#ifndef SHORTCUTSCONFIGPAGE_H
|
|
#define SHORTCUTSCONFIGPAGE_H
|
|
|
|
#include "configpage.h"
|
|
|
|
#include <QKeySequence>
|
|
|
|
class QComboBox;
|
|
class QKeySequenceEdit;
|
|
class QLabel;
|
|
class QLineEdit;
|
|
class QTreeWidget;
|
|
class QTreeWidgetItem;
|
|
|
|
/**
|
|
@brief The ShortcutsConfigPage class
|
|
Configuration page listing every shortcut registered with ShortcutManager,
|
|
letting the user rebind, reset and search them. Bindings are only
|
|
persisted (via ShortcutManager::setSequence()) when applyConf() runs, i.e.
|
|
when the user validates the surrounding ConfigDialog.
|
|
*/
|
|
class ShortcutsConfigPage : public ConfigPage
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit ShortcutsConfigPage(QWidget *parent = nullptr);
|
|
~ShortcutsConfigPage() override;
|
|
|
|
void applyConf() override;
|
|
QString title() const override;
|
|
QIcon icon() const override;
|
|
|
|
private slots:
|
|
void filterRows(const QString &filter_text);
|
|
void quickFilterChanged(int index);
|
|
void checkConflicts();
|
|
void resetAllRows();
|
|
|
|
private:
|
|
enum QuickFilter {
|
|
ShowAll = 0,
|
|
BoundOnly,
|
|
UnboundOnly,
|
|
ConflictsOnly
|
|
};
|
|
|
|
struct Row {
|
|
QString id;
|
|
QString category;
|
|
QString description;
|
|
QKeySequence default_sequence;
|
|
QKeySequenceEdit *edit;
|
|
QTreeWidgetItem *item;
|
|
bool conflicted;
|
|
};
|
|
|
|
void populateTable();
|
|
void applyFilter();
|
|
void resetRow(int row_index);
|
|
|
|
QLineEdit *m_filter_edit;
|
|
QComboBox *m_quick_filter;
|
|
QLabel *m_count_label;
|
|
QTreeWidget *m_tree;
|
|
QList<Row> m_rows;
|
|
};
|
|
|
|
#endif // SHORTCUTSCONFIGPAGE_H
|