1 /***************************************************************************
2 * Copyright (C) 2005-2013 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 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 ***************************************************************************/
21 #include "coreapplication.h"
26 CoreApplicationInternal::CoreApplicationInternal()
32 CoreApplicationInternal::~CoreApplicationInternal()
41 bool CoreApplicationInternal::init()
44 This is an initial check if logfile is writable since the warning would spam stdout if done
45 in current Logger implementation. Can be dropped whenever the logfile is only opened once.
48 if (!Quassel::optionValue("logfile").isEmpty()) {
49 logFile.setFileName(Quassel::optionValue("logfile"));
50 if (!logFile.open(QIODevice::Append | QIODevice::Text))
51 qWarning("Warning: Couldn't open logfile '%s' - will log to stdout instead", qPrintable(logFile.fileName()));
55 Core::instance(); // create and init the core
58 if (!Quassel::isOptionSet("norestore"))
65 /*****************************************************************************/
67 CoreApplication::CoreApplication(int &argc, char **argv)
68 : QCoreApplication(argc, argv), Quassel()
71 disableCrashhandler();
74 setRunMode(Quassel::CoreOnly);
75 _internal = new CoreApplicationInternal();
79 CoreApplication::~CoreApplication()
85 bool CoreApplication::init()
87 if (Quassel::init() && _internal->init()) {
88 qInstallMsgHandler(Logger::logMessage);