ff7tk  1.0.0.16
Work with Final Fantasy 7 game data
CharEditor.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 <ff7tkwidgets_export.h>
8 #include <Type_FF7CHAR>
9 
10 class QCheckBox;
11 class QComboBox;
12 class QLCDNumber;
13 class QLineEdit;
14 class QProgressBar;
15 class QToolBox;
16 class QSpinBox;
17 class QLabel;
18 class QHFrame;
19 class QHBoxLayout;
20 class QVBoxLayout;
21 class QGroupBox;
22 class QListWidget;
23 class QFrame;
24 class QSlider;
25 class QPushButton;
26 
27 class MateriaEditor;
28 
32 class FF7TKWIDGETS_EXPORT CharEditor : public QWidget
33 {
34  Q_OBJECT
35 public:
36  explicit CharEditor(QWidget *parent = nullptr);
37  void setChar(const FF7CHAR &Chardata, const QString &Processed_Name = "");
38 
39  bool AutoLevel();
40  bool AutoStatCalc();
41  bool Editable();
42  bool showPlaceholderMateria();
43  bool AdvancedMode();
44  void MaxStats();
45  void MaxEquip();
46  quint8 id();
47  quint8 level();
48  quint8 str();
49  quint8 vit();
50  quint8 mag();
51  quint8 spi();
52  quint8 dex();
53  quint8 lck();
54  quint8 strBonus();
55  quint8 vitBonus();
56  quint8 magBonus();
57  quint8 spiBonus();
58  quint8 dexBonus();
59  quint8 lckBonus();
60  qint8 limitLevel();
61  quint8 limitBar();
62  QString name();
63  quint8 weapon();
64  quint8 armor();
65  quint8 accessory();
66  quint16 curHp();
67  quint16 maxHp();
68  quint16 curMp();
69  quint16 maxMp();
70  quint16 kills();
71  quint8 row();
72  quint8 levelProgress();
73  quint8 sadnessfury();
74  quint16 limits();
75  quint16 timesused1();
76  quint16 timesused2();
77  quint16 timesused3();
78  quint16 baseHp();
79  quint16 baseMp();
80  quint32 exp();
81  quint32 expNext();
82  materia char_materia(int mat);
83 
84 protected:
85  void changeEvent(QEvent *e) override;
86 
87 signals:
88  void id_changed(qint8);
89  void level_changed(qint8);
90  void str_changed(quint8);
91  void vit_changed(quint8);
92  void mag_changed(quint8);
93  void spi_changed(quint8);
94  void dex_changed(quint8);
95  void lck_changed(quint8);
96  void strBonus_changed(quint8);
97  void vitBonus_changed(quint8);
98  void magBonus_changed(quint8);
99  void spiBonus_changed(quint8);
100  void dexBonus_changed(quint8);
101  void lckBonus_changed(quint8);
102  void limitLevel_changed(qint8);
103  void limitBar_changed(quint8);
104  void name_changed(QString);
105  void weapon_changed(quint8);
106  void armor_changed(quint8);
107  void accessory_changed(quint8);
108  void curHp_changed(quint16);
109  void maxHp_changed(quint16);
110  void curMp_changed(quint16);
111  void maxMp_changed(quint16);
112  void kills_changed(quint16);
113  void row_changed(quint8);
114  void levelProgress_changed(quint8);
115  void sadnessfury_changed(quint8);
116  void limits_changed(quint16);
117  void timesused1_changed(quint16);
118  void timesused2_changed(quint16);
119  void timesused3_changed(quint16);
120  void baseHp_changed(quint16);
121  void baseMp_changed(quint16);
122  void exp_changed(quint32);
123  void mslotChanged(int);
124  void Materias_changed(materia);
125  void expNext_changed(quint32);
126 
127 public slots:
128  void setAutoLevel(bool);
129  void setAutoStatCalc(bool);
130  void setEditable(bool);
131  void setShowPlaceholderMateria(bool);
132  void setAdvancedMode(bool);
133  void setToolBoxStyle(const QString &styleSheet);
134  void setSliderStyle(const QString &style);
135  void setEditableComboBoxes(bool);
136 
137 private:
138  void setId(int);
139  void setLevel(int);
140  void setStr(int);
141  void setVit(int);
142  void setMag(int);
143  void setSpi(int);
144  void setDex(int);
145  void setLck(int);
146  void setStrBonus(int);
147  void setVitBonus(int);
148  void setMagBonus(int);
149  void setSpiBonus(int);
150  void setDexBonus(int);
151  void setLckBonus(int);
152  void setLimitLevel(int);
153  void setLimitBar(int);
154  void setName(const QString &name);
155  void setWeapon(int);
156  void setArmor(int);
157  void setAccessory(int);
158  void setRow(bool front_row);
159  void setLevelProgress(int);
160  void setSadnessFury(int);
161  void setLimits(int);
162  void setTimesused1(int);
163  void setTimesused2(int);
164  void setTimesused3(int);
165  void setBaseHp(int);
166  void setBaseMp(int);
167  void setExp(int);
168  void setExpNext(int);
169  void setCurMp(int);
170  void setCurHp(int);
171  void setMaxMp(int);
172  void setMaxHp(int);
173  void setKills(int);
174  void cb_fury_toggled(bool);
175  void cb_sadness_toggled(bool);
176  void cb_idChanger_toggled(bool);
177  void calc_limit_value(QModelIndex);
178  void Level_Changed(int);// used for tracking growth of char
179  void Exp_Changed(int);// used for tracking growth of char
180  void materiaSlotClicked(int slotClicked);
181  void matAp_changed(qint32);
182  void matId_changed(qint8);
183  void init_display();
184  void init_connections();
185  void disconnectAll();
186  void calc_stats();//calc stat changes if autostatcalc == true;
187  void level_up(int);
188  void update_tnl_bar();
189  void elemental_info();
190  void status_info();
191  void update_materia_slots();
192  void updateMateriaToolTips();
193  void setSlotFrame();
198  void updateText();
199 
209  QWidget* makeStatWidget(QSpinBox* statBaseSpinBox = nullptr, QSpinBox* statSourceSpinBox = nullptr
210  , QLabel* statLabel = nullptr, QLabel* statMateriaBonusLabel = nullptr, QLabel* statTotalLabel = nullptr);
211 
216  QFrame* makeStatFrame();
217 
227  QHBoxLayout * makeMateriaSlotPair(QPushButton* button1 = nullptr, QPushButton* button2 = nullptr, QFrame *frame1 = nullptr, QFrame *frame2 = nullptr, QLabel* linkLabel = nullptr);
228 
233  QWidget * makeLimitLayout();
234 //Data
235  bool load{false};
236  bool autolevel{true};
237  bool autostatcalc{true};
238  bool editable{true};
239  bool showplaceholderMateria{false};
240  bool advancedMode{false};
241  int mslotsel{-1};
242  qint32 ap{0};
243  FF7CHAR data;
244  QString _name;
245 //GUI PARTS
246  QLabel *lblAvatar = nullptr;
247  QLineEdit *lineName = nullptr;
248  QSpinBox *sbLevel = nullptr;
249  QSpinBox *sbCurrentMp = nullptr;
250  QSpinBox *sbCurrentHp = nullptr;
251 
252  QLabel *lblBaseHp = nullptr;
253  QSpinBox *sbBaseHp = nullptr;
254  QLabel *lblBaseHpBonus = nullptr;
255 
256  QLabel *lblBaseMp = nullptr;
257  QSpinBox *sbBaseMp = nullptr;
258  QLabel *lblBaseMpBonus = nullptr;
259 
260  QSpinBox *sbKills = nullptr;
261  QLabel *lblCurrentHp = nullptr;
262  QLabel *lblMaxHp = nullptr;
263  QLabel *lblCurrentMp = nullptr;
264  QLabel *lblMaxMp = nullptr;
265  QCheckBox *cbFury = nullptr;
266  QCheckBox *cbSadness = nullptr;
267  QCheckBox *cbFrontRow = nullptr;
268  QComboBox *comboId = nullptr;
269 
270  QSpinBox *sbTotalExp = nullptr;
271  QLabel *lbl_level_next = nullptr;
272  QProgressBar *bar_tnl = nullptr;
273  QLabel *lbl_limit_bar = nullptr;
274  QSlider *slider_limit = nullptr;
275  QLCDNumber *lcdLimitValue = nullptr;
276 
277  QLabel *lblStr = nullptr;
278  QSpinBox *sbStr = nullptr;
279  QSpinBox *sbStrSourceUse = nullptr;
280  QLabel *lblStrMateriaBonus = nullptr;
281  QLabel *lblStrTotal = nullptr;
282 
283  QLabel *lblVit = nullptr;
284  QSpinBox *sbVit = nullptr;
285  QSpinBox *sbVitSourceUse = nullptr;
286  QLabel *lblVitMateriaBonus = nullptr;
287  QLabel *lblVitTotal = nullptr;
288 
289  QLabel *lblMag = nullptr;
290  QSpinBox *sbMag = nullptr;
291  QSpinBox *sbMagSourceUse = nullptr;
292  QLabel *lblMagMateriaBonus = nullptr;
293  QLabel *lblMagTotal = nullptr;
294 
295  QLabel *lblSpi = nullptr;
296  QSpinBox *sbSpi = nullptr;
297  QSpinBox *sbSpiSourceUse = nullptr;
298  QLabel *lblSpiMateriaBonus = nullptr;
299  QLabel *lblSpiTotal = nullptr;
300 
301  QLabel *lblDex = nullptr;
302  QSpinBox *sbDex = nullptr;
303  QSpinBox *sbDexSourceUse = nullptr;
304  QLabel *lblDexMateriaBonus = nullptr;
305  QLabel *lblDexTotal = nullptr;
306 
307  QLabel *lblLck = nullptr;
308  QSpinBox *sbLck = nullptr;
309  QSpinBox *sbLckSourceUse = nullptr;
310  QLabel *lblLckMateriaBonus = nullptr;
311  QLabel *lblLckTotal = nullptr;
312 
313  QSpinBox *sbLimitLevel = nullptr;
314  QSpinBox *sb_uses_limit_1_1 = nullptr;
315  QSpinBox *sb_uses_limit_2_1 = nullptr;
316  QSpinBox *sb_uses_limit_3_1 = nullptr;
317  QListWidget *list_limits = nullptr;
318  QLabel *lbl_uses = nullptr;
319  QLabel *lbl_1_1 = nullptr;
320  QLabel *lbl_2_1 = nullptr;
321  QLabel *lbl_3_1 = nullptr;
322  QLabel *lbl_0x34 = nullptr;
323  QLabel *lbl_0x35 = nullptr;
324  QLabel *lbl_0x36 = nullptr;
325  QLabel *lbl_0x37 = nullptr;
326  QLabel *lblWeaponStats = nullptr;
327  QLabel *lblArmorStats = nullptr;
328  QComboBox *weapon_selection = nullptr;
329  QComboBox *armor_selection = nullptr;
330  QComboBox *accessory_selection = nullptr;
331  MateriaEditor *materia_edit = nullptr;
332  QGroupBox *elemental_box = nullptr;
333  QGroupBox *status_box = nullptr;
334  QListWidget *elemental_effects = nullptr;
335  QListWidget *status_effects = nullptr;
336  QFrame *weapon_materia_box = nullptr;
337  QFrame *armor_materia_box = nullptr;
338  QGroupBox *weapon_box = nullptr;
339  QGroupBox *armor_box = nullptr;
340  QGroupBox *accessory_box = nullptr;
341  QList<QFrame *> materiaSlotFrames;
342  QList<QPushButton *> materiaSlots;
343  QLabel *weapon_m_link_1 = nullptr;
344  QLabel *weapon_m_link_2 = nullptr;
345  QLabel *weapon_m_link_3 = nullptr;
346  QLabel *weapon_m_link_4 = nullptr;
347  QLabel *armor_m_link_1 = nullptr;
348  QLabel *armor_m_link_2 = nullptr;
349  QLabel *armor_m_link_3 = nullptr;
350  QLabel *armor_m_link_4 = nullptr;
351  QToolBox *toolbox = nullptr;
352  QFrame *unknown_box = nullptr;
353  QLCDNumber *lcd_0x34 = nullptr;
354  QLCDNumber *lcd_0x35 = nullptr;
355  QLCDNumber *lcd_0x36 = nullptr;
356  QLCDNumber *lcd_0x37 = nullptr;
357  QCheckBox *cb_idChanger = nullptr;
358  const int charWidth;
359  const int lineHeight;
360  const QSizePolicy sbSizePolicy;
361  //Static Limits
362  inline static const int quint8Max = 255;
363  inline static const int qint16Max = 32767;
364  inline static const int quint16Max = 65535;
365  inline static const int expMax = 2147483647;
366  inline static const QString comboStyle = QStringLiteral("QComboBox { combobox-popup: 0}");
367  inline static const QString transparentBackgroundStyle = QStringLiteral("QFrame{background-color:rgba(0,0,0,0);}");
368 };
MateriaEditor
The MateriaEditor class MateriaEditor is a Widget that can be used to edit materia in the player's i...
Definition: MateriaEditor.h:24
materia
materia format saved in materia list or on a character
FF7CHAR
Character Info in the save game.
CharEditor
Widget to allow editing of a character using FF7Char for data.
Definition: CharEditor.h:32