1 /***************************************************************************
2 * Copyright (C) 2005-07 by the Quassel IRC Team *
3 * devel@quassel-irc.org *
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) version 3. *
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. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
24 #include <QTranslator>
26 #if defined BUILD_CORE
27 #include <QCoreApplication>
32 #elif defined BUILD_QTUI
33 #include <QApplication>
37 #elif defined BUILD_MONO
38 #include <QApplication>
41 #include "coresession.h"
45 #error "Something is wrong - you need to #define a build mode!"
50 //! Signal handler for graceful shutdown.
51 void handle_signal(int sig) {
52 qWarning(QString("Caught signal %1 - exiting.").arg(sig).toAscii());
53 QCoreApplication::quit();
56 int main(int argc, char **argv) {
57 // We catch SIGTERM and SIGINT (caused by Ctrl+C) to graceful shutdown Quassel.
58 signal(SIGTERM, handle_signal);
59 signal(SIGINT, handle_signal);
61 qRegisterMetaType<QVariant>("QVariant");
62 qRegisterMetaType<Message>("Message");
63 qRegisterMetaType<BufferInfo>("BufferInfo");
64 qRegisterMetaTypeStreamOperators<QVariant>("QVariant");
65 qRegisterMetaTypeStreamOperators<Message>("Message");
66 qRegisterMetaTypeStreamOperators<BufferInfo>("BufferInfo");
68 #if defined BUILD_CORE
69 Global::runMode = Global::CoreOnly;
70 QCoreApplication app(argc, argv);
71 #elif defined BUILD_QTUI
72 Global::runMode = Global::ClientOnly;
73 QApplication app(argc, argv);
75 Global::runMode = Global::Monolithic;
76 QApplication app(argc, argv);
80 //QTranslator translator;
81 //translator.load(":i18n/quassel_de");
82 //app.installTranslator(&translator);
85 QCoreApplication::setOrganizationDomain("quassel-irc.org");
86 QCoreApplication::setApplicationName("Quassel IRC");
87 QCoreApplication::setOrganizationName("Quassel IRC Development Team");
90 Core::instance(); // create and init the core
96 QtUi *gui = new QtUi();
101 int exitCode = app.exec();
104 // the mainWin has to be deleted before the Core
105 // if not Quassel will crash on exit under certain conditions since the gui
106 // still wants to access clientdata