X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fcore%2Fcoreapplication.cpp;fp=src%2Fcore%2Fcoreapplication.cpp;h=cacd671cbd78f27ef1f2d99821b618b3eb09eb40;hp=b31d937b22ea366ce3281f7db6c23bd983616636;hb=fbb06e36ee772862c0d70ab43c9000225e9f8c42;hpb=4e3b9ea041c45aba5eaea14e4aafd46ee3ed044a diff --git a/src/core/coreapplication.cpp b/src/core/coreapplication.cpp index b31d937b..cacd671c 100644 --- a/src/core/coreapplication.cpp +++ b/src/core/coreapplication.cpp @@ -21,40 +21,6 @@ #include "core.h" #include "coreapplication.h" -CoreApplicationInternal::CoreApplicationInternal() - : _coreCreated(false) -{ -} - - -CoreApplicationInternal::~CoreApplicationInternal() -{ - if (_coreCreated) { - Core::saveState(); - Core::destroy(); - } -} - - -bool CoreApplicationInternal::init() -{ - Core::instance(); // create and init the core - _coreCreated = true; - - Quassel::registerReloadHandler([]() { - // Currently, only reloading SSL certificates and the sysident cache is supported - Core::cacheSysIdent(); - return Core::reloadCerts(); - }); - - if (!Quassel::isOptionSet("norestore")) - Core::restoreState(); - - return true; -} - - -/*****************************************************************************/ CoreApplication::CoreApplication(int &argc, char **argv) : QCoreApplication(argc, argv) @@ -64,18 +30,21 @@ CoreApplication::CoreApplication(int &argc, char **argv) #endif /* Q_OS_MAC */ Quassel::setRunMode(Quassel::CoreOnly); - _internal = new CoreApplicationInternal(); } CoreApplication::~CoreApplication() { - delete _internal; + _core.reset(); Quassel::destroy(); } bool CoreApplication::init() { - return Quassel::init() && _internal->init(); + if (Quassel::init()) { + _core.reset(new Core{}); // FIXME C++14: std::make_unique + return _core->init(); + } + return false; }