JustAnotherDnDGame 0.1.0
Jeu de rôle tactique au d20, vue de dessus, en C++/Qt
Loading...
Searching...
No Matches
KeybindingsWidget.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 Valentin Eloy
2// SPDX-License-Identifier: GPL-3.0-or-later
3
4#pragma once
5
6#include <QWidget>
7#include <array>
8#include <filesystem>
9
11
17
18class QFormLayout;
19class QLabel;
20class QPushButton;
21
22namespace hmi {
23
24class Localization;
25
35class KeybindingsWidget : public QWidget {
36 Q_OBJECT
37
38public:
39 KeybindingsWidget(hmi::GameKeyBindings& bindings, std::filesystem::path savePath,
40 QWidget* parent = nullptr);
41
43 void retranslateUi(const Localization& loc);
44
45protected:
46 void keyPressEvent(QKeyEvent* event) override;
47
48private:
49 void refresh();
50
52 std::filesystem::path _savePath;
53 int _capturing = -1;
54 std::array<QPushButton*, hmi::GAME_ACTION_COUNT> _buttons{};
55 std::array<QLabel*, hmi::GAME_ACTION_COUNT> _actionLabels{};
56 QLabel* _help = nullptr;
57 const Localization* _loc = nullptr;
58};
59
60} // namespace hmi
Association remappable action de jeu -> touche clavier, avec persistance (EX-CTRL-012).
Association action de jeu -> touche, avec persistance JSON (EX-CTRL-012, LOT-29).
Definition GameKeyBindings.h:50
const Localization * _loc
Definition KeybindingsWidget.h:57
std::filesystem::path _savePath
Definition KeybindingsWidget.h:52
hmi::GameKeyBindings & _bindings
Definition KeybindingsWidget.h:51
int _capturing
Indice de l'action en cours de capture, ou -1.
Definition KeybindingsWidget.h:53
void retranslateUi(const Localization &loc)
Applique la langue active (libellés d'actions, invite de capture, aide).
Definition KeybindingsWidget.cpp:78
std::array< QLabel *, hmi::GAME_ACTION_COUNT > _actionLabels
Definition KeybindingsWidget.h:55
QLabel * _help
Definition KeybindingsWidget.h:56
void keyPressEvent(QKeyEvent *event) override
Definition KeybindingsWidget.cpp:88
std::array< QPushButton *, hmi::GAME_ACTION_COUNT > _buttons
Definition KeybindingsWidget.h:54
KeybindingsWidget(hmi::GameKeyBindings &bindings, std::filesystem::path savePath, QWidget *parent=nullptr)
Definition KeybindingsWidget.cpp:36
void refresh()
Definition KeybindingsWidget.cpp:71
Catalogue de traduction (i18n) : associe des clés stables à des chaînes selon la langue active,...
Definition Localization.h:29
Definition AudioEngine.cpp:15