mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-01 21:56:43 +08:00
refs #246 refactored construction of all remaining contexts into factory methods
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
#include "blackcore/context_application.h"
|
||||
#include "blackcore/context_application_impl.h"
|
||||
#include "blackcore/context_application_proxy.h"
|
||||
#include "blackcore/context_application_event.h"
|
||||
#include "blackmisc/statusmessage.h"
|
||||
#include <QCoreApplication>
|
||||
@@ -12,6 +14,21 @@ namespace BlackCore
|
||||
QList<IContextApplication *> IContextApplication::s_contexts;
|
||||
QtMessageHandler IContextApplication::s_oldHandler = nullptr;
|
||||
|
||||
IContextApplication *IContextApplication::create(CRuntime *parent, CRuntimeConfig::ContextMode mode, CDBusServer *server, QDBusConnection &conn)
|
||||
{
|
||||
switch (mode)
|
||||
{
|
||||
case CRuntimeConfig::Local:
|
||||
case CRuntimeConfig::LocalInDbusServer:
|
||||
return (new CContextApplication(mode, parent))->registerWithDBus(server);
|
||||
case CRuntimeConfig::Remote:
|
||||
return new BlackCore::CContextApplicationProxy(BlackCore::CDBusServer::ServiceName, conn, mode, parent);
|
||||
default:
|
||||
qFatal("Always initialize an application context");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Constructor
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user