ff7tk 0.80.25
Work with Final Fantasy 7 game data
MateriaEditor.h
Go to the documentation of this file.
1/****************************************************************************/
2// copyright 2012 - 2022 Chris Rizzitello <sithlord48@gmail.com> //
3// //
4// This file is part of FF7tk //
5// //
6// FF7tk is free software: you can redistribute it and/or modify //
7// it under the terms of the GNU General Public License as published by //
8// the Free Software Foundation, either version 3 of the License, or //
9// (at your option) any later version. //
10// //
11// FF7tk is distributed in the hope that it will be useful, //
12// but WITHOUT ANY WARRANTY; without even the implied warranty of //
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
14// GNU General Public License for more details. //
15/****************************************************************************/
16#pragma once
17
18#include <QWidget>
19#include <QEvent>
20
21#include <FF7Materia.h>
22
23#ifndef ff7tkwidgets_export_h
24 #include <ff7tkwidgets_export.h>
25#endif
26
27class QComboBox;
28class QFrame;
29class QGroupBox;
30class QHBoxLayout;
31class QLabel;
32class QListWidget;
33class QPushButton;
34class QSpacerItem;
35class QSpinBox;
36
37class FF7TKWIDGETS_EXPORT MateriaEditor : public QWidget
38{
39 Q_OBJECT
40public:
41 explicit MateriaEditor(QWidget *parent = nullptr, quint8 materia_id = FF7Materia::EmptyId, qint32 ap = FF7Materia::MaxMateriaAp);
42 void setMateria(quint8 materia_id = 0, qint32 materia_ap = 0);
43 void setAP(qint32 current_ap = 0);
44 void setStarsSize(int);
45 qint32 ap();
46 qint32 MaxAP();
47 qint8 id();
48 bool isEditable(void);
49 void setEditable(bool);
50// qint32 raw_data(void);
51protected:
52 void changeEvent(QEvent *e);
53public slots:
54 void setEditableMateriaCombo(bool enabled);
55private:
56 //Private Functions
57 void init_display();
58 QHBoxLayout *makeNameLayout();
59 QWidget *makeStarWidget();
60 QWidget *makeSkillWidget();
61 QWidget *makeStatWidget();
62 void setStars();
63 void setName();
64 void setStats();
65 void setSkills();
66 void setLevel();
67 void updateESkillList();
68 //Private Gui Parts.
69 QLabel *lbl_max_ap = nullptr;
70 QHBoxLayout *Final = nullptr;
71 QComboBox *combo_type = nullptr;
72 QComboBox *combo_materia = nullptr;
73 QPushButton *btn_paste_materia = nullptr;
74 QPushButton *btn_rm_materia = nullptr;
75 QPushButton *btn_copy_materia = nullptr;
76 QPushButton *btn_eskill_master = nullptr;
77 QPushButton *btn_eskill_clear = nullptr;
78 QSpinBox *sb_ap = nullptr;
79 QFrame *frm_ap = nullptr;
80 QFrame *frm_skill_status = nullptr;
81 QList<QPushButton *> btn_stars = {nullptr, nullptr, nullptr, nullptr, nullptr};
82 QFrame *box_stars = nullptr;
83 QGroupBox *box_skills = nullptr;
84 QWidget *eskill_group = nullptr;
85 QListWidget *eskill_list = nullptr;
86 QWidget *eskillButtons = nullptr;
87 QListWidget *list_skills = nullptr;
88 QGroupBox *box_stats = nullptr;
89 QGroupBox *box_status_effects = nullptr;
90 QLabel *lbl_stats = nullptr;
91 QListWidget *list_status = nullptr;
92 FF7Materia *data = nullptr;
93 QSpacerItem *v_spacer = nullptr;
94 QFrame *frm_ap_stars = nullptr;
95 QLabel *lbl_materiaIcon = nullptr;
96 QLabel *lbl_materiaName = nullptr;
97 //Private Data Members
98 quint8 _id;// current id
99 quint8 buffer_id;
100 qint32 buffer_ap;
101 qint8 _level;//current level
102 qint32 _current_ap;// current ap amount
103 QString _highlightColor;
104 QSize _iconSize;
105 bool _editable;
106 inline static const auto _buttonStyle = QStringLiteral("QPushButton:enabled{background-color: rgba(0,0,0,0);border:0px solid;} QPushButton:hover{background-color:rgba(%1);}");
107 inline static const auto _itemStyle = QStringLiteral("::item { padding-left: 0px; padding-top: 1px; padding-bottom: 1px;}"
108 "::indicator { width: %2px; height: %2px; }"
109 "::indicator:unchecked {image: url(:/materia/command_star_empty);}"
110 "::indicator:checked{image: url(:/materia/command_star_full);}"
111 "::item:hover { background-color: rgba(%1); }"
112 //Give unfocused items a transparent border to work around Qt6 bug where indicator is set only for listed states.
113 "::item:!focus { border: 1px solid transparent;}"
114 "::item:focus { background-color: rgba(%1); }");
115
116private slots:
117 void typeChanged(int new_type);
118 void materia_changed(const QString &new_name);
119 void editMode(void);
120 QPushButton *newStyledButton(const QIcon &icon = QIcon(), QKeySequence shortcut = QKeySequence(), const QString &toolip = QString(), QWidget *parent = nullptr);
121signals:
122 void apChanged(qint32);
123 void idChanged(qint8);
124};
Definition: FF7Materia.h:26
@ MaxMateriaAp
Definition: FF7Materia.h:47
@ EmptyId
Definition: FF7Materia.h:46
Definition: MateriaEditor.h:38
void apChanged(qint32)
void idChanged(qint8)