~sithlord48/hyne/master

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
/****************************************************************************
 ** Hyne Final Fantasy VIII Save Editor
 ** Copyright (C) 2009-2013 Arzel Jérôme <myst6re@gmail.com>
 **
 ** This program is free software: you can redistribute it and/or modify
 ** it under the terms of the GNU General Public License as published by
 ** the Free Software Foundation, either version 3 of the License, or
 ** (at your option) any later version.
 **
 ** This program is distributed in the hope that it will be useful,
 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 ** GNU General Public License for more details.
 **
 ** You should have received a copy of the GNU General Public License
 ** along with this program.  If not, see <http://www.gnu.org/licenses/>.
 ****************************************************************************/

#ifndef DEF_WINDOW
#define DEF_WINDOW

#include <QtGui>
#include "SavecardWidget.h"
#include "Editor.h"
#include "StartWidget.h"
#include "QTaskBarButton.h"

class Window : public QWidget
{
    Q_OBJECT
public:
	enum OpenType { File, Slot1, Slot2 };

	Window();
	virtual ~Window();

	void openFile(const QString &path, OpenType openType=File, const FF8Installation &installation=FF8Installation());
	static QString chooseLangDialog();
	static QStringList availableLanguages();
public slots:
	void editView(SaveData *saveData);
	void setModified(bool modified=true);
private slots:
	void saveView();
	void newFile();
	inline void slot1() { open(Slot1); }
	inline void slot2() { open(Slot2); }
	void open(OpenType=File);
	bool closeFile(bool quit=false);
	void reload();
	void openRecentFile(QAction *);
	void save();
	bool exportAs();
	void properties();
	void mode(bool);
	void changeFrame(QAction *);
	void font(bool);
	void changeLanguage(QAction *);
	void changeFF8Version(QAction *);
	void runFF8();
	void updateMetadata();
	void fullScreen();
	void about();
	static void newWindow();

private:
	void setIsOpen(bool open);
	bool exportAs(SavecardData::Type newType, const QString &path);
	QByteArray descGme(const QString &desc, bool *abort);
	void fillMenuRecent();
	void restartNow();

	void setTitle(const int currentSaveEdited=-1);
	QList<int> selectSavesDialog(bool multiSelection=false, bool onlyFF8=false);
	
	QTaskBarButton *taskBarButton; // Windows 7+
	QMenuBar *menuBar;
	QAction *actionReload, *actionSave, *actionSaveAs;
	QAction *actionProperties, *actionClose, *actionMode, *actionFont;
	QMenu *menuRecent, *menuFrame, *menuLang, *menuVersion;
	QStackedLayout *stackedLayout;
	SavecardData *saves;
	SavecardWidget *saveList;
	StartWidget *startWidget;
	Editor *editor;

protected:
	virtual void closeEvent(QCloseEvent *event);
	virtual void dragEnterEvent(QDragEnterEvent *event);
	virtual void dropEvent(QDropEvent *event);
//	virtual void changeEvent(QEvent *event);
};

#endif