-
Notifications
You must be signed in to change notification settings - Fork 3
/
interface.h
153 lines (124 loc) · 3.97 KB
/
interface.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
143
144
145
146
147
148
149
150
151
152
153
/*--License:
Sprite Decomposer
Copyright Nicolas Smeets (Creacore Software) 2010-2011
http://www.creacore.be/blog/2011/06/sprite-decomposer-2/
www.sourceforge.net/projects/spritedecompose
Sprite Decomposer is provided under the Creative Commons License.
-- Creative Commons License
http://creativecommons.org/licenses/by-nc-sa/3.0/
You are free:
to Share — to copy, distribute and transmit the work
to Remix — to adapt the work
Under the following conditions:
Attribution — You must attribute the work in the manner specified by the author
or licensor (but not in any way that suggests that they endorse you or your use of the work).
Noncommercial — You may not use this work for commercial purposes.
Share Alike — If you alter, transform, or build upon this work, you may distribute the
resulting work only under the same or similar license to this one.
*/
#ifndef INTERFACE_H
#define INTERFACE_H
#include <QMainWindow>
#include <QDesktopWidget>
#include <QFileDialog>
#include <QColorDialog>
#include <QMessageBox>
#include <QInputDialog>
#include <QtXml>
#include <QCloseEvent>
#include "aboutdialog.h"
#include "animation.h"
#include "workarea.h"
#include "cut.h"
#include "mark.h"
#include "saveable_widget.h"
#include <QDebug>
namespace Ui
{
class Interface;
}
class Interface : public QMainWindow, utility::SaveableWidget<Interface>
{
Q_OBJECT
public:
// Constructor / Destructor
explicit Interface(QWidget *parent = nullptr);
~Interface() override;
protected:
void closeEvent(QCloseEvent *event) override;
void changeEvent(QEvent* event) override;
void recurseWrite(QSettings& settings, QObject* object) override;
void recurseRead(QSettings& settings, QObject* object) override;
public slots:
// Tools
void tool_normal();
void tool_zoomIn();
void tool_zoomOut();
void tool_cutRect();
void tool_cutGrid();
void tool_mark();
void tool_picker();
void tool_cutAuto();
// Menu
void menu_open();
void menu_save();
void menu_saveAs();
void menu_quit();
void menu_about();
// configurePanel
void configurePanelChanged(int index);
// configureCut
void addCutRect();
void addCutGrid();
void cut_GeometryChange();
// configureMark
void addMark();
void mark_OrientationChange(int index);
void mark_PositionChange();
// configurePicker
void picker_OpenColorPicker();
void picker_SetMaskColor();
// Viewer
void viewer_zoomIn();
void viewer_zoomOut();
// Animation
void animation_add();
void animation_remove();
void animation_changeTitle(const QString& title);
// Workarea
void pickerColor(const QRgb &color);
void itemSelected(Cut* selection);
void multipleSelection();
// Animation
void frameCountUpdated(int frameCount);
private:
Ui::Interface *ui; // Interface
QList<QPointer<Animation>> m_animations; // Animations List
WorkArea* m_workarea; // WorkArea
QAction *m_currentToolSelected; // Tool selected
qreal m_zoomRatio; // Zoom Scene ratio
qreal m_zoomViewRatio; // Zoom View ratio
QString m_imageFilename; // Background image (sprite sheet) filename
QString m_xmlFilename; // Current XML file
bool m_workModified;
bool m_selectAnimation;
AboutDialog *m_aboutDialog;
QString lastImagePath{};
private:
int saveModification();
void saveAll(const QString &filename);
void openXMl(const QString &filename);
void openImage(const QString &filename, bool createDefaultAnimation = true);
Animation* addAnimation(const QString &title);
void removeAnimation(int index);
void showCutRectInfo(Cut* cut);
void showCutGridInfo(Cut* cut);
void closeAll();
// Translation
void fillLanguages();
void retranslate();
QMenu* m_languages;
private slots:
void selectAnimation(int index);
};
#endif // INTERFACE_H