refs #246 refactored construction of all remaining contexts into factory methods

This commit is contained in:
Mathew Sutcliffe
2014-06-14 15:52:42 +01:00
parent 9e0909666e
commit 9b27b93de0
21 changed files with 157 additions and 66 deletions

View File

@@ -0,0 +1,28 @@
/* Copyright (C) 2013 VATSIM Community / contributors
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "context_settings.h"
#include "context_settings_impl.h"
#include "context_settings_proxy.h"
namespace BlackCore
{
IContextSettings *IContextSettings::create(CRuntime *parent, CRuntimeConfig::ContextMode mode, CDBusServer *server, QDBusConnection &conn)
{
switch (mode)
{
case CRuntimeConfig::Local:
case CRuntimeConfig::LocalInDbusServer:
return (new CContextSettings(mode, parent))->registerWithDBus(server);
case CRuntimeConfig::Remote:
return new BlackCore::CContextSettingsProxy(BlackCore::CDBusServer::ServiceName, conn, mode, parent);
default:
qFatal("Always initialize a settings context");
return nullptr;
}
}
}