X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcommon%2Fmain.cpp;h=102c9d44cbf8546ec718015a76f06a221998b50a;hp=f562dd47fff01dfed3c293ebef84aa98ac1ffb07;hb=cf28e7152c5d940aec586be1b29fbf8ddc99f087;hpb=99c92e21b3b9eb5ed661632cdfb69aabfc6b2deb diff --git a/src/common/main.cpp b/src/common/main.cpp index f562dd47..102c9d44 100644 --- a/src/common/main.cpp +++ b/src/common/main.cpp @@ -1,11 +1,11 @@ /*************************************************************************** - * Copyright (C) 2005-07 by The Quassel IRC Development Team * + * Copyright (C) 2005-07 by the Quassel IRC Team * * devel@quassel-irc.org * * * * 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. * + * (at your option) version 3. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * @@ -19,6 +19,7 @@ ***************************************************************************/ #include "global.h" +#include "identity.h" #include "settings.h" #include #include @@ -58,12 +59,7 @@ int main(int argc, char **argv) { signal(SIGTERM, handle_signal); signal(SIGINT, handle_signal); - qRegisterMetaType("QVariant"); - qRegisterMetaType("Message"); - qRegisterMetaType("BufferInfo"); - qRegisterMetaTypeStreamOperators("QVariant"); - qRegisterMetaTypeStreamOperators("Message"); - qRegisterMetaTypeStreamOperators("BufferInfo"); + Global::registerMetaTypes(); #if defined BUILD_CORE Global::runMode = Global::CoreOnly; @@ -76,15 +72,30 @@ int main(int argc, char **argv) { QApplication app(argc, argv); #endif - //Just for testing - //QTranslator translator; - //translator.load(":i18n/quassel_de"); - //app.installTranslator(&translator); + // Set up i18n support + QLocale locale = QLocale::system(); + + QTranslator qtTranslator; + qtTranslator.load(QString(":i18n/qt_%1").arg(locale.name())); + app.installTranslator(&qtTranslator); + + QTranslator quasselTranslator; + quasselTranslator.load(QString(":i18n/quassel_%1").arg(locale.name())); + app.installTranslator(&quasselTranslator); - QCoreApplication::setOrganizationDomain("quassel-irc.org"); QCoreApplication::setApplicationName("Quassel IRC"); - QCoreApplication::setOrganizationName("Quassel IRC Development Team"); + QCoreApplication::setOrganizationName("Quassel Project"); + + // Check if a non-standard core port is requested + QStringList args = QCoreApplication::arguments(); // TODO Build a CLI parser + + Global::defaultPort = 4242; + int idx; + if((idx = args.indexOf("-p")) > 0 && idx < args.count() - 1) { + int port = args[idx+1].toInt(); + if(port >= 1024 && port < 65536) Global::defaultPort = port; + } #ifndef BUILD_QTUI Core::instance(); // create and init the core @@ -98,8 +109,18 @@ int main(int argc, char **argv) { gui->init(); #endif +#ifndef BUILD_QTUI + if(args.contains("--norestore")) { + Core::restoreState(); + } +#endif + int exitCode = app.exec(); +#ifndef BUILD_QTUI + Core::saveState(); +#endif + #ifndef BUILD_CORE // the mainWin has to be deleted before the Core // if not Quassel will crash on exit under certain conditions since the gui