ff7tk  1.2.0.13
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 
93  void idChanged(qint8 id);
94  [[ deprecated ("will be removed in ff7tk 2.0, Use CharEditor::idChanged") ]]void id_changed(qint8);
95 
100  void levelChanged(qint8 level);
101  [[ deprecated ("will be removed in ff7tk 2.0, Use CharEditor::levelChanged") ]]void level_changed(qint8);
102 
107  void strengthChanged(quint8 strength);
108  [[ deprecated ("will be removed in ff7tk 2.0, Use CharEditor::strengthChanged") ]]void str_changed(quint8);
109 
114  void vitalityChanged(quint8 vitality);
115  [[ deprecated ("will be removed in ff7tk 2.0, Use CharEditor::vitalityChanged") ]]void vit_changed(quint8);
116 
121  void magicChanged(quint8 magic);
122  [[ deprecated ("will be removed in ff7tk 2.0, Use CharEditor::magicChanged") ]]void mag_changed(quint8);
123 
128  void spiritChanged(quint8 spirit);
129  [[ deprecated ("will be removed in ff7tk 2.0, Use CharEditor::spiritChanged") ]]void spi_changed(quint8);
130 
135  void dexterityChanged(quint8 dexterity);
136  [[ deprecated ("will be removed in ff7tk 2.0, Use CharEditor::dexterityChanged") ]]void dex_changed(quint8);
141  void luckChanged(quint8 luck);
142  [[ deprecated ("will be removed in ff7tk 2.0, Use CharEditor::luckChanged") ]]void lck_changed(quint8);
143 
148  void strengthBonusChanged(quint8 strengthBonus);
149  [[ deprecated ("will be removed in ff7tk 2.0, Use CharEditor::strengthBonusChanged") ]]void strBonus_changed(quint8);
150 
155  void vitalityBonusChanged(quint8 vitalityBonus);
156  [[ deprecated ("will be removed in ff7tk 2.0, Use CharEditor::vitalityBonusChanged") ]]void vitBonus_changed(quint8);
157 
162  void magicBonusChanged(quint8 magicBonus);
163  [[ deprecated ("will be removed in ff7tk 2.0, Use CharEditor::magicBonusChanged") ]]void magBonus_changed(quint8);
164 
169  void spiritBonusChanged(quint8 spiritBonus);
170  [[ deprecated ("will be removed in ff7tk 2.0, Use CharEditor::spiritBonusChanged") ]]void spiBonus_changed(quint8);
171 
176  void dexterityBonusChanged(quint8 dexterityBonus);
177  [[ deprecated ("will be removed in ff7tk 2.0, Use CharEditor::dexterityBonusChanged") ]]void dexBonus_changed(quint8);
178 
183  void luckBonusChanged(quint8 luckBonus);
184  [[ deprecated ("will be removed in ff7tk 2.0, Use CharEditor::luckBonusChanged") ]]void lckBonus_changed(quint8);
185 
186 
191  void limitLevelChanged(qint8 limitLevel);
192  [[ deprecated ("will be removed in ff7tk 2.0, Use CharEditor::limitLevelChanged") ]]void limitLevel_changed(qint8);
193 
198  void limitBarChanged(qint8 limitBar);
199  [[ deprecated ("will be removed in ff7tk 2.0, Use CharEditor::limitBarChanged") ]]void limitBar_changed(quint8);
200 
205  void nameChanged(QString name);
206  [[ deprecated ("will be removed in ff7tk 2.0, Use CharEditor::nameChanged") ]]void name_changed(QString);
207 
212  void weaponChanged(quint8 weapon);
213  [[ deprecated ("will be removed in ff7tk 2.0, Use CharEditor::weaponChanged") ]]void weapon_changed(quint8);
214 
219  void armorChanged(quint8 armor);
220  [[ deprecated ("will be removed in ff7tk 2.0, Use CharEditor::armorChanged") ]]void armor_changed(quint8);
221 
226  void accessoryChanged(quint8 accessory);
227 
228  [[ deprecated ("will be removed in ff7tk 2.0, Use CharEditor::accessoryChanged") ]]void accessory_changed(quint8);
229 
234  void curHpChanged(quint16 curHp);
235  [[ deprecated ("will be removed in ff7tk 2.0, Use CharEditor::curHpChanged") ]]void curHp_changed(quint16);
236 
241  void maxHpChanged(quint16 maxHp);
242  [[ deprecated ("will be removed in ff7tk 2.0, Use CharEditor::maxHpChanged") ]]void maxHp_changed(quint16);
243 
248  void curMpChanged(quint16 curMp);
249  [[ deprecated ("will be removed in ff7tk 2.0, Use CharEditor::curMpChanged") ]]void curMp_changed(quint16);
250 
255  void maxMpChanged(quint16 maxMp);
256  [[ deprecated ("will be removed in ff7tk 2.0, Use CharEditor::maxMpChanged") ]]void maxMp_changed(quint16);
257 
262  void killsChanged(quint16 kills);
263  [[ deprecated ("will be removed in ff7tk 2.0, Use CharEditor::killsChanged") ]]void kills_changed(quint16);
264 
269  void rowChanged(quint8 row);
270  [[ deprecated ("will be removed in ff7tk 2.0, Use CharEditor::rowChanged") ]]void row_changed(quint8);
271 
276  void levelProgressChanged(quint8 levelProgress);
277  [[ deprecated ("will be removed in ff7tk 2.0, Use CharEditor::levelProgressChanged") ]]void levelProgress_changed(quint8);
278 
283  void stateChanged(quint8 state);
284  [[ deprecated ("will be removed in ff7tk 2.0, Use CharEditor::stateChanged") ]]void sadnessfury_changed(quint8);
285 
290  void limitsChanged(quint16 limits);
291  [[ deprecated ("will be removed in ff7tk 2.0, Use CharEditor::limitsChanged") ]]void limits_changed(quint16);
292 
297  void times1UsedChanged(quint16 times);
298  [[ deprecated ("will be removed in ff7tk 2.0, Use CharEditor::times1UsedChanged") ]]void timesused1_changed(quint16);
299 
304  void times2UsedChanged(quint16 times);
305  [[ deprecated ("will be removed in ff7tk 2.0, Use CharEditor::times2UsedChanged") ]]void timesused2_changed(quint16);
306 
311  void times3UsedChanged(quint16 times);
312  [[ deprecated ("will be removed in ff7tk 2.0, Use CharEditor::times3UsedChanged") ]]void timesused3_changed(quint16);
313 
318  void baseHpChanged(quint16 baseHp);
319  [[ deprecated ("will be removed in ff7tk 2.0, Use CharEditor::baseHpChanged") ]]void baseHp_changed(quint16);
320 
325  void baseMpChanged(quint16 baseMp);
326  [[ deprecated ("will be removed in ff7tk 2.0, Use CharEditor::baseMpChanged") ]]void baseMp_changed(quint16);
327 
332  void expChanged(quint32 exp);
333  [[ deprecated ("will be removed in ff7tk 2.0, Use CharEditor::expChanged") ]]void exp_changed(quint32);
334 
339  void mslotChanged(int mslot);
340 
345  void materiaChanged(materia mat);
346  [[ deprecated ("will be removed in ff7tk 2.0, Use CharEditor::materiaChanged") ]]void Materias_changed(materia);
347 
352  void expNextChanged(quint32 expNext);
353  [[ deprecated ("will be removed in ff7tk 2.0, Use CharEditor::expNextChanged") ]]void expNext_changed(quint32);
354 
355 public slots:
356  void setAutoLevel(bool);
357  void setAutoStatCalc(bool);
358  void setEditable(bool);
359  void setShowPlaceholderMateria(bool);
360  void setAdvancedMode(bool);
361  void setToolBoxStyle(const QString &styleSheet);
362  void setSliderStyle(const QString &style);
363  void setEditableComboBoxes(bool);
364 
365 private:
366  void setId(int);
367  void setLevel(int);
368  void setStr(int);
369  void setVit(int);
370  void setMag(int);
371  void setSpi(int);
372  void setDex(int);
373  void setLck(int);
374  void setStrBonus(int);
375  void setVitBonus(int);
376  void setMagBonus(int);
377  void setSpiBonus(int);
378  void setDexBonus(int);
379  void setLckBonus(int);
380  void setLimitLevel(int);
381  void setLimitBar(int);
382  void setName(const QString &name);
383  void setWeapon(int);
384  void setArmor(int);
385  void setAccessory(int);
386  void setRow(bool front_row);
387  void setLevelProgress(int);
388  void setSadnessFury(int);
389  void setLimits(int);
390  void setTimesused1(int);
391  void setTimesused2(int);
392  void setTimesused3(int);
393  void setBaseHp(int);
394  void setBaseMp(int);
395  void setExp(int);
396  void setExpNext(int);
397  void setCurMp(int);
398  void setCurHp(int);
399  void setMaxMp(int);
400  void setMaxHp(int);
401  void setKills(int);
402  void cb_fury_toggled(bool);
403  void cb_sadness_toggled(bool);
404  void cb_idChanger_toggled(bool);
405  void calc_limit_value(QModelIndex);
406  void Level_Changed(int);// used for tracking growth of char
407  void Exp_Changed(int);// used for tracking growth of char
408  void materiaSlotClicked(int slotClicked);
409  void matAp_changed(qint32);
410  void matId_changed(qint8);
411  void init_display();
412  void init_connections();
413  void disconnectAll();
414  void calc_stats();//calc stat changes if autostatcalc == true;
415  void level_up(int);
416  void update_tnl_bar();
417  void elemental_info();
418  void status_info();
419  void update_materia_slots();
420  void updateMateriaToolTips();
421  void setSlotFrame();
426  void updateText();
427 
437  QWidget* makeStatWidget(QSpinBox* statBaseSpinBox = nullptr, QSpinBox* statSourceSpinBox = nullptr
438  , QLabel* statLabel = nullptr, QLabel* statMateriaBonusLabel = nullptr, QLabel* statTotalLabel = nullptr);
439 
444  QFrame* makeStatFrame();
445 
455  QHBoxLayout * makeMateriaSlotPair(QPushButton* button1 = nullptr, QPushButton* button2 = nullptr, QFrame *frame1 = nullptr, QFrame *frame2 = nullptr, QLabel* linkLabel = nullptr);
456 
461  QWidget * makeLimitLayout();
462 //Data
463  bool load{false};
464  bool autolevel{true};
465  bool autostatcalc{true};
466  bool editable{true};
467  bool showplaceholderMateria{false};
468  bool advancedMode{false};
469  int mslotsel{-1};
470  qint32 ap{0};
471  FF7CHAR data;
472  QString _name;
473 //GUI PARTS
474  QLabel *lblAvatar = nullptr;
475  QLineEdit *lineName = nullptr;
476  QSpinBox *sbLevel = nullptr;
477  QSpinBox *sbCurrentMp = nullptr;
478  QSpinBox *sbCurrentHp = nullptr;
479 
480  QLabel *lblBaseHp = nullptr;
481  QSpinBox *sbBaseHp = nullptr;
482  QLabel *lblBaseHpBonus = nullptr;
483 
484  QLabel *lblBaseMp = nullptr;
485  QSpinBox *sbBaseMp = nullptr;
486  QLabel *lblBaseMpBonus = nullptr;
487 
488  QSpinBox *sbKills = nullptr;
489  QLabel *lblCurrentHp = nullptr;
490  QLabel *lblMaxHp = nullptr;
491  QLabel *lblCurrentMp = nullptr;
492  QLabel *lblMaxMp = nullptr;
493  QCheckBox *cbFury = nullptr;
494  QCheckBox *cbSadness = nullptr;
495  QCheckBox *cbFrontRow = nullptr;
496  QComboBox *comboId = nullptr;
497 
498  QSpinBox *sbTotalExp = nullptr;
499  QLabel *lbl_level_next = nullptr;
500  QProgressBar *bar_tnl = nullptr;
501  QLabel *lbl_limit_bar = nullptr;
502  QSlider *slider_limit = nullptr;
503  QLCDNumber *lcdLimitValue = nullptr;
504 
505  QLabel *lblStr = nullptr;
506  QSpinBox *sbStr = nullptr;
507  QSpinBox *sbStrSourceUse = nullptr;
508  QLabel *lblStrMateriaBonus = nullptr;
509  QLabel *lblStrTotal = nullptr;
510 
511  QLabel *lblVit = nullptr;
512  QSpinBox *sbVit = nullptr;
513  QSpinBox *sbVitSourceUse = nullptr;
514  QLabel *lblVitMateriaBonus = nullptr;
515  QLabel *lblVitTotal = nullptr;
516 
517  QLabel *lblMag = nullptr;
518  QSpinBox *sbMag = nullptr;
519  QSpinBox *sbMagSourceUse = nullptr;
520  QLabel *lblMagMateriaBonus = nullptr;
521  QLabel *lblMagTotal = nullptr;
522 
523  QLabel *lblSpi = nullptr;
524  QSpinBox *sbSpi = nullptr;
525  QSpinBox *sbSpiSourceUse = nullptr;
526  QLabel *lblSpiMateriaBonus = nullptr;
527  QLabel *lblSpiTotal = nullptr;
528 
529  QLabel *lblDex = nullptr;
530  QSpinBox *sbDex = nullptr;
531  QSpinBox *sbDexSourceUse = nullptr;
532  QLabel *lblDexMateriaBonus = nullptr;
533  QLabel *lblDexTotal = nullptr;
534 
535  QLabel *lblLck = nullptr;
536  QSpinBox *sbLck = nullptr;
537  QSpinBox *sbLckSourceUse = nullptr;
538  QLabel *lblLckMateriaBonus = nullptr;
539  QLabel *lblLckTotal = nullptr;
540 
541  QSpinBox *sbLimitLevel = nullptr;
542  QSpinBox *sb_uses_limit_1_1 = nullptr;
543  QSpinBox *sb_uses_limit_2_1 = nullptr;
544  QSpinBox *sb_uses_limit_3_1 = nullptr;
545  QListWidget *list_limits = nullptr;
546  QLabel *lbl_uses = nullptr;
547  QLabel *lbl_1_1 = nullptr;
548  QLabel *lbl_2_1 = nullptr;
549  QLabel *lbl_3_1 = nullptr;
550  QLabel *lbl_0x34 = nullptr;
551  QLabel *lbl_0x35 = nullptr;
552  QLabel *lbl_0x36 = nullptr;
553  QLabel *lbl_0x37 = nullptr;
554  QLabel *lblWeaponStats = nullptr;
555  QLabel *lblArmorStats = nullptr;
556  QComboBox *weapon_selection = nullptr;
557  QComboBox *armor_selection = nullptr;
558  QComboBox *accessory_selection = nullptr;
559  MateriaEditor *materia_edit = nullptr;
560  QGroupBox *elemental_box = nullptr;
561  QGroupBox *status_box = nullptr;
562  QListWidget *elemental_effects = nullptr;
563  QListWidget *status_effects = nullptr;
564  QFrame *weapon_materia_box = nullptr;
565  QFrame *armor_materia_box = nullptr;
566  QGroupBox *weapon_box = nullptr;
567  QGroupBox *armor_box = nullptr;
568  QGroupBox *accessory_box = nullptr;
569  QList<QFrame *> materiaSlotFrames;
570  QList<QPushButton *> materiaSlots;
571  QLabel *weapon_m_link_1 = nullptr;
572  QLabel *weapon_m_link_2 = nullptr;
573  QLabel *weapon_m_link_3 = nullptr;
574  QLabel *weapon_m_link_4 = nullptr;
575  QLabel *armor_m_link_1 = nullptr;
576  QLabel *armor_m_link_2 = nullptr;
577  QLabel *armor_m_link_3 = nullptr;
578  QLabel *armor_m_link_4 = nullptr;
579  QToolBox *toolbox = nullptr;
580  QFrame *unknown_box = nullptr;
581  QLCDNumber *lcd_0x34 = nullptr;
582  QLCDNumber *lcd_0x35 = nullptr;
583  QLCDNumber *lcd_0x36 = nullptr;
584  QLCDNumber *lcd_0x37 = nullptr;
585  QCheckBox *cb_idChanger = nullptr;
586  const int charWidth;
587  const int lineHeight;
588  const QSizePolicy sbSizePolicy;
589  //Static Limits
590  inline static const int quint8Max = 255;
591  inline static const int qint16Max = 32767;
592  inline static const int quint16Max = 65535;
593  inline static const int expMax = 2147483647;
594  inline static const QString comboStyle = QStringLiteral("QComboBox { combobox-popup: 0}");
595  inline static const QString transparentBackgroundStyle = QStringLiteral("QFrame{background-color:rgba(0,0,0,0);}");
596 };
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