1 /***************************************************************************
2 * Copyright (C) 2005-08 by the Quassel Project *
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 <KCmdLineArgs>
25 # include <KAboutData>
29 # include "coreapplication.h"
30 #elif defined BUILD_QTUI
31 # include "qtuiapplication.h"
32 #elif defined BUILD_MONO
33 # include "monoapplication.h"
36 #error "Something is wrong - you need to #define a build mode!"
41 int main(int argc, char **argv) {
42 Q_INIT_RESOURCE(i18n);
44 // Setup build information and version string
45 # include "version.gen"
46 buildinfo.append(QString(",%1,%2").arg(__DATE__, __TIME__));
47 Quassel::setupBuildInfo(buildinfo);
48 QCoreApplication::setApplicationName(Quassel::buildInfo().applicationName);
49 QCoreApplication::setOrganizationName(Quassel::buildInfo().organizationName);
50 QCoreApplication::setOrganizationDomain(Quassel::buildInfo().organizationDomain);
53 // We need to init KCmdLineArgs first
54 // TODO: build an AboutData compat class to replace our aboutDlg strings
55 KAboutData aboutData("quassel", 0, ki18n("Quassel IRC"), Quassel::buildInfo().plainVersionString.toUtf8(),
56 ki18n("A modern, distributed IRC client"));
57 aboutData.addLicense(KAboutData::License_GPL_V2);
58 aboutData.addLicense(KAboutData::License_GPL_V3);
59 aboutData.setOrganizationDomain(Quassel::buildInfo().organizationDomain.toUtf8());
60 KCmdLineArgs::init(argc, argv, &aboutData);
63 // Initialize CLI arguments
64 // NOTE: We can't use tr() at this point, since app is not yet created
65 CliParser *cliParser = Quassel::cliParser();
67 // put shared client&core arguments here
68 cliParser->addSwitch("debug",'d', "Enable debug output");
69 cliParser->addSwitch("help",'h', "Display this help and exit");
72 // put client-only arguments here
73 cliParser->addSwitch("debugbufferswitches", 0, "Enables debugging for bufferswitches");
74 cliParser->addSwitch("debugmodel", 0, "Enables debugging for models");
76 #ifndef BUILD_QTCLIENT
77 // put core-only arguments here
78 cliParser->addOption("port <port>",'p', "The port quasselcore will listen at", QString("4242"));
79 cliParser->addSwitch("norestore", 'n', "Don't restore last core's state");
80 cliParser->addOption("logfile <path>", 'l', "Path to logfile");
81 cliParser->addOption("loglevel <level>", 'L', "Loglevel Debug|Info|Warning|Error", "Info");
82 cliParser->addOption("datadir <path>", 0, "Specify the directory holding datafiles like the Sqlite DB and the SSL Cert");
86 // the KDE version needs this extra call to parse argc/argv before app is instantiated
87 if(!cliParser->init()) {
93 # if defined BUILD_CORE
94 CoreApplication app(argc, argv);
95 # elif defined BUILD_QTUI
96 QtUiApplication app(argc, argv);
97 # elif defined BUILD_MONO
98 MonolithicApplication app(argc, argv);
102 // the non-KDE version parses after app has been instantiated
103 if(!cliParser->init(app.arguments())) {
109 if(!app.init()) return EXIT_FAILURE;