Added debug definition to the build system.
[tagua/yd.git] / src / main.cpp
blob687b463a565d9c77976928b643b0fa90a55f598a
1 /*
2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@sns.it>
3 (c) 2006 Maurizio Monge <maurizio.monge@kdemail.net>
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 2 of the License, or
8 (at your option) any later version.
9 */
11 #include <kapplication.h>
12 #include <kaboutdata.h>
13 #include <kcmdlineargs.h>
14 #include <kglobal.h>
15 #include <klocale.h>
16 #include <kstandarddirs.h>
17 #include <kiconloader.h>
18 #include <klocale.h>
20 #include "mainwindow.h"
21 #include "crash.h"
22 #include "common.h"
24 static const char description[] = "A generic board game interface";
26 static const char version[] = "0.9.1";
28 void trap() {
29 printf("Press enter to quit.\n");
31 char dummy[4096];
32 fgets(dummy, 4096, stdin);
35 int main(int argc, char **argv) {
36 KAboutData about( "tagua", 0, ki18n("Tagua"),
37 version, ki18n(description), KAboutData::License_GPL,
38 ki18n("(C) 2006 Paolo Capriotti, Maurizio Monge") );
39 about.addAuthor(ki18n("Paolo Capriotti"), KLocalizedString(), "p.capriotti@gmail.com");
40 about.addAuthor(ki18n("Maurizio Monge"), KLocalizedString(), "p.capriotti@gmail.com");
41 about.addCredit(ki18n("Jani Huhtanen"), KLocalizedString(), I18N_NOOP("Gaussian blur code") );
42 about.addCredit(ki18n("Rici Lake"), KLocalizedString(), I18N_NOOP("funclib lua library") );
44 KCmdLineOptions options;
45 KCmdLineArgs::init(argc, argv, &about);
46 KCmdLineArgs::addCmdLineOptions(options);
47 KApplication app;
49 #ifdef TAGUA_DEBUG
50 // So you can attach the debugger in case of segfault.
51 installCrashHander();
52 atexit(trap);
54 // If we are debugging, it is handy to have a local data
55 // directory which is accessed by Tagua, so we don't need
56 // to reconfigure / reinstall whenever a change is made in
57 // a theme.
58 QString data_dir = qgetenv("TAGUA_DATA");
59 if (data_dir.isEmpty()) data_dir = "data";
61 KGlobal::dirs()->addResourceDir("appdata", data_dir, true);
62 KGlobal::dirs()->addResourceDir("icon", data_dir + "/pics", true);
63 KIconLoader::global()->reconfigure(about.appName(), KGlobal::dirs());
64 #endif // KBOARD_DEBUG
66 MainWindow* widget = new MainWindow;
67 widget->show();
69 return app.exec();