-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathimage_editor.h
68 lines (54 loc) · 1.68 KB
/
image_editor.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
#ifndef IMAGE_EDITOR_H
#define IMAGE_EDITOR_H
#include <QObject>
#include <QWidget>
#include <QUndoGroup>
#include <QFile>
#include <QPushButton>
#include <QMap>
#include <QComboBox>
#include "tile_data.h"
class canvas;
class abstract_format;
class palette_manager;
class image_editor : public QWidget
{
Q_OBJECT
public:
explicit image_editor(QWidget *parent, QString file_name,
QUndoGroup *undo_group, palette_manager *controller, bool new_file = false);
~image_editor() override;
QString load_error();
void set_focus();
void update_window();
QString get_file_name();
bool can_save();
void save(QString path);
bool new_file();
void change_format(int a);
void context_menu(const QPoint& position);
void set_selected_tile(const tile_data tile);
signals:
void save_state_changed(bool save);
void update_status_text(QString text);
protected:
virtual void keyPressEvent(QKeyEvent *event) override;
virtual void wheelEvent(QWheelEvent *event) override;
virtual bool event(QEvent *event) override;
private:
canvas *draw_area = nullptr;
palette_manager *palette_controller = nullptr;
QUndoStack *undo_stack = nullptr;
QPushButton *page_up = new QPushButton(QChar(u'\u219F'), this);
QPushButton *tile_up = new QPushButton(QChar(u'\u2191'), this);
QPushButton *page_down = new QPushButton(QChar(u'\u21A1'), this);
QPushButton *tile_down = new QPushButton(QChar(u'\u2193'), this);
QFile image_file;
bool is_new;
int save_state = 0;
QByteArray buffer;
QMap<QString, abstract_format *> formats;
QComboBox *format_selection = new QComboBox(this);
void update_save_state(int direction);
};
#endif // IMAGE_EDITOR_H