~sithlord48/hyne/master

2 by myst6re
First commit
1
/****************************************************************************
2
 ** Hyne Final Fantasy VIII Save Editor
124 by myst6re
Merging Qt5 branch in trunk:
3
 ** Copyright (C) 2009-2013 Arzel Jérôme <myst6re@gmail.com>
2 by myst6re
First commit
4
 **
5
 ** This program is free software: you can redistribute it and/or modify
6
 ** it under the terms of the GNU General Public License as published by
7
 ** the Free Software Foundation, either version 3 of the License, or
8
 ** (at your option) any later version.
9
 **
10
 ** This program is distributed in the hope that it will be useful,
11
 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 ** GNU General Public License for more details.
14
 **
15
 ** You should have received a copy of the GNU General Public License
16
 ** along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
 ****************************************************************************/
18
19
#include <QApplication>
20
#include "Window.h"
21
22
// Only for static compilation
23
//Q_IMPORT_PLUGIN(qjpcodecs) // jp encoding
24
25
int main(int argc, char *argv[])
26
{
134 by myst6re
Re-enabling compatibility with Qt4, but without QTaskbarButton, because it uses winextras now (available since Qt 5.2).
27
	QApplication app(argc, argv);
22 by myst6re
translation fix: myst6r -> myst6re
28
	app.setWindowIcon(QIcon(":/images/hyne.png"));
134 by myst6re
Re-enabling compatibility with Qt4, but without QTaskbarButton, because it uses winextras now (available since Qt 5.2).
29
#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
30
	QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
31
#endif
22 by myst6re
translation fix: myst6r -> myst6re
32
2 by myst6re
First commit
33
	Config::set();
34
35
	QTranslator translator;
85 by myst6re
Using /usr/share directory to store translation files on UNIX.
36
	QString lang = QLocale::system().name().toLower(),
37
			translationPath = Config::translationDir();
38
102 by myst6re
Using an enumeration to list all config keys.
39
	lang = Config::value(Config::Lang, lang.left(lang.indexOf("_")));
85 by myst6re
Using /usr/share directory to store translation files on UNIX.
40
	if(translator.load("hyne_" + lang, translationPath)) {
2 by myst6re
First commit
41
		app.installTranslator(&translator);
5 by myst6re
Useless references in function signatures.
42
	} else if(lang != "fr") {
43
		lang = Window::chooseLangDialog();
85 by myst6re
Using /usr/share directory to store translation files on UNIX.
44
		if(translator.load("hyne_" + lang, translationPath)) {
5 by myst6re
Useless references in function signatures.
45
			app.installTranslator(&translator);
102 by myst6re
Using an enumeration to list all config keys.
46
			Config::setValue(Config::Lang, lang);
5 by myst6re
Useless references in function signatures.
47
		} else {
102 by myst6re
Using an enumeration to list all config keys.
48
			Config::setValue(Config::Lang, "fr");
5 by myst6re
Useless references in function signatures.
49
		}
2 by myst6re
First commit
50
	} else {
102 by myst6re
Using an enumeration to list all config keys.
51
		Config::setValue(Config::Lang, "fr");
2 by myst6re
First commit
52
	}
53
	Config::translator = &translator;
54
55
	Config::loadRecentFiles();
56
38 by myst6re
Defer loading of the editor widget, data and the font pixmap. Little cleaning of Editor.
57
	Window window;
58
	window.show();
2 by myst6re
First commit
59
38 by myst6re
Defer loading of the editor widget, data and the font pixmap. Little cleaning of Editor.
60
	if(argc > 1) {
61
		window.openFile(argv[1]);
2 by myst6re
First commit
62
	}
63
134 by myst6re
Re-enabling compatibility with Qt4, but without QTaskbarButton, because it uses winextras now (available since Qt 5.2).
64
	return app.exec();
2 by myst6re
First commit
65
}