JustAnotherDnDGame 0.1.0
Jeu de rôle tactique au d20, vue de dessus, en C++/Qt
Loading...
Searching...
No Matches
LevelBrowserPanel.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 <QString>
7#include <QWidget>
8#include <filesystem>
9#include <memory>
10
15
16class QModelIndex;
17class QSortFilterProxyModel;
18class QStandardItemModel;
19
20namespace Ui {
21class LevelBrowserPanel;
22}
23
24namespace hmi {
25
26class Localization;
27
38class LevelBrowserPanel : public QWidget {
39 Q_OBJECT
40
41public:
42 explicit LevelBrowserPanel(std::filesystem::path levelsDir, QWidget* parent = nullptr);
44
46 void refresh();
47
49 void retranslateUi(const Localization& loc);
50
51signals:
53 void levelOpenRequested(const QString& path);
54
55private:
56 void onNew();
57 void onRename();
58 void onDuplicate();
59 void onDelete();
60 void onActivated(const QModelIndex& index);
61
63 [[nodiscard]] std::filesystem::path selectedPath() const;
64
65 std::unique_ptr<Ui::LevelBrowserPanel> _ui;
66 std::filesystem::path _dir;
67 QStandardItemModel* _model;
68 QSortFilterProxyModel* _proxy;
69 const Localization* _loc = nullptr;
70};
71
72} // namespace hmi
LevelBrowserPanel(std::filesystem::path levelsDir, QWidget *parent=nullptr)
Definition LevelBrowserPanel.cpp:44
void onDuplicate()
Definition LevelBrowserPanel.cpp:129
std::filesystem::path _dir
Definition LevelBrowserPanel.h:66
void refresh()
Recharge la liste depuis le dossier (après une opération ou un changement externe).
Definition LevelBrowserPanel.cpp:72
void onNew()
Definition LevelBrowserPanel.cpp:93
void onActivated(const QModelIndex &index)
Definition LevelBrowserPanel.cpp:166
const Localization * _loc
Catalogue courant (pour les dialogues localisés).
Definition LevelBrowserPanel.h:69
std::unique_ptr< Ui::LevelBrowserPanel > _ui
Mise en page (LevelBrowserPanel.ui).
Definition LevelBrowserPanel.h:65
std::filesystem::path selectedPath() const
Chemin du niveau sélectionné, ou chemin vide si aucune sélection.
Definition LevelBrowserPanel.cpp:84
void onDelete()
Definition LevelBrowserPanel.cpp:140
void retranslateUi(const Localization &loc)
Applique la langue active (boutons, champ de recherche).
Definition LevelBrowserPanel.cpp:157
void levelOpenRequested(const QString &path)
Émis quand l'utilisateur demande l'ouverture d'un niveau (chemin absolu du fichier).
QStandardItemModel * _model
Modèle source (données), rempli par refresh().
Definition LevelBrowserPanel.h:67
QSortFilterProxyModel * _proxy
Filtre de recherche au-dessus du modèle.
Definition LevelBrowserPanel.h:68
~LevelBrowserPanel() override
void onRename()
Definition LevelBrowserPanel.cpp:110
Catalogue de traduction (i18n) : associe des clés stables à des chaînes selon la langue active,...
Definition Localization.h:29
Definition AssetThumbnailView.h:26
Definition AudioEngine.cpp:15