ff7tk  1.0.0.16
Work with Final Fantasy 7 game data
MateriaEditor.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2012 - 2023 Chris Rizzitello <sithlord48@gmail.com>
2 // SPDX-License-Identifier: LGPL-3.0-or-later
3 
4 #pragma once
5 
6 #include <QWidget>
7 #include <QEvent>
8 #include <ff7tkwidgets_export.h>
9 #include <FF7Materia>
10 
11 class QComboBox;
12 class QFrame;
13 class QGroupBox;
14 class QHBoxLayout;
15 class QLabel;
16 class QListWidget;
17 class QPushButton;
18 class QSpacerItem;
19 class QSpinBox;
24 class FF7TKWIDGETS_EXPORT MateriaEditor : public QWidget
25 {
26  Q_OBJECT
27 public:
28  explicit MateriaEditor(QWidget *parent = nullptr, quint8 materia_id = FF7Materia::EmptyId, qint32 ap = FF7Materia::MaxMateriaAp);
29  void setMateria(quint8 materia_id = 0, qint32 materia_ap = 0);
30  void setAP(qint32 current_ap = 0);
31  void setStarsSize(int);
32  qint32 ap();
33  qint32 MaxAP();
34  qint8 id();
35  bool isEditable(void);
36  void setEditable(bool);
37 
42  void setShowPlaceHolderMateria(bool showPlaceHolders);
43 protected:
44  void changeEvent(QEvent *e);
45 public slots:
46  void setEditableMateriaCombo(bool enabled);
47 private:
48  //Private Functions
49  void init_display();
50  QHBoxLayout *makeNameLayout();
51  QWidget *makeStarWidget();
52  QWidget *makeSkillWidget();
53  QWidget *makeStatWidget();
54  void setStars();
55  void setName();
56  void setStats();
57  void setSkills();
58  void setLevel();
59  void updateESkillList();
60  void updatePalette();
61  //Private Gui Parts.
62  QLabel *lbl_max_ap = nullptr;
63  QHBoxLayout *Final = nullptr;
64  QComboBox *combo_type = nullptr;
65  QComboBox *combo_materia = nullptr;
66  QPushButton *btn_paste_materia = nullptr;
67  QPushButton *btn_rm_materia = nullptr;
68  QPushButton *btn_copy_materia = nullptr;
69  QPushButton *btn_eskill_master = nullptr;
70  QPushButton *btn_eskill_clear = nullptr;
71  QSpinBox *sb_ap = nullptr;
72  QFrame *frm_ap = nullptr;
73  QFrame *frm_skill_status = nullptr;
74  QList<QPushButton *> btn_stars = {nullptr, nullptr, nullptr, nullptr, nullptr};
75  QFrame *box_stars = nullptr;
76  QGroupBox *box_skills = nullptr;
77  QWidget *eskill_group = nullptr;
78  QListWidget *eskill_list = nullptr;
79  QWidget *eskillButtons = nullptr;
80  QListWidget *list_skills = nullptr;
81  QGroupBox *box_stats = nullptr;
82  QGroupBox *box_status_effects = nullptr;
83  QLabel *lbl_stats = nullptr;
84  QListWidget *list_status = nullptr;
85  QFrame *frm_ap_stars = nullptr;
86  QLabel *lbl_materiaIcon = nullptr;
87  QLabel *lbl_materiaName = nullptr;
88  //Private Data Members
89  quint8 _id;// current id
90  quint8 buffer_id;
91  qint32 buffer_ap;
92  qint8 _level;//current level
93  qint32 _current_ap;// current ap amount
94  QSize _iconSize;
95  bool _showPlaceHolders; // Show Materia Named "ID:0x\\d+"
96  bool _editable;
97  inline static const auto _comboStyle = QStringLiteral("QComboBox { combobox-popup: 0;}");
98  inline static const auto _buttonStyle = QStringLiteral("QPushButton:enabled{background-color: rgba(0,0,0,0);border:0px solid;} QPushButton:hover{background-color: palette(highlight);}");
99  inline static const auto _buttonHighlightStyle_addition = QStringLiteral(" QPushButton:hover{background-color: palette(highlight);}");
100  inline static const auto _itemStyle = QStringLiteral("::indicator:unchecked {image: url(:/materia/command_star_empty);}"
101  "::indicator:checked{image: url(:/materia/command_star_full);}"
102  "::item{border: 1px solid transparent;}"
103  );
104 
105 private slots:
106  void typeChanged(int new_type);
107  void materia_changed(const QString &new_name);
108  void editMode(void);
109  QPushButton *newStyledButton(const QIcon &icon = QIcon(), QKeySequence shortcut = QKeySequence(), const QString &toolip = QString(), QWidget *parent = nullptr);
110 signals:
111  void apChanged(qint32);
112  void idChanged(qint8);
113 };
FF7Materia::EmptyId
@ EmptyId
Definition: FF7Materia.h:62
MateriaEditor
The MateriaEditor class MateriaEditor is a Widget that can be used to edit materia in the player's i...
Definition: MateriaEditor.h:24
FF7Materia::MaxMateriaAp
static const int MaxMateriaAp
MaxMateriaAp - The Maximum Materia Ap Allowed, All materia has this Ap when "Mastered".
Definition: FF7Materia.h:37