-
Notifications
You must be signed in to change notification settings - Fork 2
/
mainwindow.h
142 lines (113 loc) · 3.52 KB
/
mainwindow.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include "types.h"
#include <QMainWindow>
#include <QMimeData>
#include <QGraphicsScene>
#include <QGraphicsView>
enum class ProgramState
{
Closed,
NewFile,
KnowsPath
};
struct NDSBanner
{
u16 version;
u16 crc[4];
u8 reserved[0x16];
u8 iconNCG[0x200];
u16 iconNCL[0x10];
QChar title[16][0x100 / sizeof(QChar)];
u8 iconExtraNCG[8][0x200];
u16 iconExtraNCL[8][0x10];
struct AnimSeq
{
u16 frameDuration : 8;
u16 ncgID : 3;
u16 nclID : 3;
u16 flipH : 1;
u16 flipV : 1;
};
AnimSeq animData[0x80 / sizeof(AnimSeq)];
};
QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow(QWidget *parent = nullptr);
~MainWindow();
bool importImage(const QString &fileName);
QImage exportImage();
int getSelectedBitmapID();
int getSelectedPaletteID();
private slots:
void on_actionOpen_triggered();
void on_gameTitle_pte_textChanged();
void on_gameTitle_cb_currentIndexChanged(int index);
void on_gameTitle_pb_clicked();
void on_bannerVersion_cb_currentIndexChanged(int index);
void on_actionSave_triggered();
void on_actionSave_As_triggered();
void on_actionCredits_triggered();
void on_actionQt_triggered();
void on_gfxBmp_sb_valueChanged(int arg1);
void on_gfxPal_sb_valueChanged(int arg1);
void on_actionClose_triggered();
void on_animFrame_cb_currentIndexChanged(int index);
void on_animFrameAdd_pb_clicked();
void on_animFrameRem_pb_clicked();
void on_animDur_sb_valueChanged(int arg1);
void on_animBmp_sb_valueChanged(int arg1);
void on_animPal_sb_valueChanged(int arg1);
void on_animFlipX_cb_stateChanged(int arg1);
void on_animFlipY_cb_stateChanged(int arg1);
void on_actionNew_triggered();
void on_actionAnimation_Player_triggered();
void on_gfxImport_pb_clicked();
void on_gfxExport_pb_clicked();
void on_actionEnglish_triggered();
void on_actionJapanese_triggered();
void on_actionPortugu_s_triggered();
private:
Ui::MainWindow *ui;
NDSBanner bannerBin;
QString lastDirPath;
QString openedFileName;
QGraphicsScene gfx_scene;
QImage getCurrentImage(int bmpID, int palID);
QPixmap getCurrentPixmap(int bmpID, int palID);
int gfxBmp_lastValue = 0;
int animFrame_lastSize = 0;
void setProgramState(ProgramState mode);
void changeLanguage(int language);
void getBinaryIconPtr(u8*& ncg, u16*& ncl, int bmpID, int palID);
void updateIconView(int bmpID, int ncgID);
bool checkIfAllowClose();
void closeEvent(QCloseEvent *event);
void dragEnterEvent(QDragEnterEvent *event);
void dropEvent(QDropEvent *event);
void changeEvent(QEvent *event);
bool loadFile(const QString& path, bool isNew);
void saveFile(const QString& path);
void setAnimGroupBlockSignals(bool flag);
void setAnimGroupEnabled(bool flag);
};
class IconGraphicsView : public QGraphicsView
{
public:
IconGraphicsView(QWidget *parent = nullptr) : QGraphicsView(parent) {}
IconGraphicsView(QGraphicsScene *scene, QWidget *parent = nullptr) : QGraphicsView(scene, parent) {}
protected:
void dragMoveEvent(QDragMoveEvent *event);
void dropEvent(QDropEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
private:
bool clicked = false;
};
#endif // MAINWINDOW_H