-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwc3editor.cpp
120 lines (99 loc) · 4.12 KB
/
wc3editor.cpp
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
/***************************************************************************
* Copyright (C) 2010 by Tamino Dauth *
* tamino@cdauth.eu *
* *
* 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 2 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, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <QApplication>
#include "../../editor.hpp"
#ifdef USE_OGREBLP
#include "../modeleditor/modeleditor.hpp"
#endif
#include "../objecteditor/objecteditor.hpp"
#include "../textureeditor/textureeditor.hpp"
#include "../triggereditor/triggereditor.hpp"
#include "../mpqeditor/mpqeditor.hpp"
using namespace wc3lib::editor;
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
const QString organization = "wc3lib";
#if defined(USE_OGREBLP)
Root root;
if (root.configure())
{
Editor editor(&root, organization, "wc3editor");
#else
Editor editor(organization, "wc3editor");
#endif
/*
* Pops up the dialog for source directories if necessary and loads default shared files.
*/
if (editor.configure(0))
{
SplashScreen splash(&editor);
splash.show();
#if defined(MDLX) && defined(USE_OGREBLP)
splash.showMessage(QObject::tr("Loading Model Editor ..."), Qt::AlignCenter | Qt::AlignBottom, Qt::white);
ModelEditor *modelEditor = new ModelEditor(&root, &editor, organization, "wc3model");
if (modelEditor->configure())
{
editor.addModule(modelEditor);
}
#endif
splash.showMessage(QObject::tr("Loading Object Editor ..."), Qt::AlignCenter | Qt::AlignBottom, Qt::white);
ObjectEditor *objectEditor = new ObjectEditor(&editor, organization, "wc3object");
if (objectEditor->configure())
{
editor.addModule(objectEditor);
}
splash.showMessage(QObject::tr("Loading Texture Editor ..."), Qt::AlignCenter | Qt::AlignBottom, Qt::white);
TextureEditor *textureEditor = new TextureEditor(&editor, organization, "wc3texture");
if (textureEditor->configure())
{
editor.addModule(textureEditor);
}
splash.showMessage(QObject::tr("Loading Trigger Editor ..."), Qt::AlignCenter | Qt::AlignBottom, Qt::white);
TriggerEditor *triggerEditor = new TriggerEditor(&editor, organization, "wc3trigger");
if (triggerEditor->configure())
{
editor.addModule(triggerEditor);
}
splash.showMessage(QObject::tr("Loading MPQ Editor ..."), Qt::AlignCenter | Qt::AlignBottom, Qt::white);
MpqEditor *mpqEditor = new MpqEditor(&editor, organization, "wc3mpq");
if (mpqEditor->configure())
{
editor.addModule(mpqEditor);
mpqEditor->show();
}
splash.close();
//TerrainEditor *terrainEditor = new TerrainEditor(editor, editor);
//editor->addModule(terrainEditor);
//terrainEditor->show();
/*
/// @todo Allow parsing multiple files as arguments.
/// FIXME Crashes application when canceling file dialog.
KCmdLineArgs *args = KCmdLineArgs::parsedArgs("+[file]");
for (int i = 0; i < args->count(); ++i)
editor.openMap(args->url(i));
*/
return app.exec();
}
#if defined(USE_OGREBLP)
}
#endif
return 1;
}