mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-20 20:40:29 +08:00
xbus modifies library search path in order for QtDBus to find libdbus
refs #615
This commit is contained in:
@@ -11,6 +11,8 @@
|
|||||||
#include "service.h"
|
#include "service.h"
|
||||||
#include "traffic.h"
|
#include "traffic.h"
|
||||||
#include "weather.h"
|
#include "weather.h"
|
||||||
|
#include "utils.h"
|
||||||
|
#include "blackmisc/librarypath.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
inline QString xbusServiceName() {
|
inline QString xbusServiceName() {
|
||||||
@@ -34,7 +36,15 @@ namespace XBus
|
|||||||
Q_ASSERT(! m_server);
|
Q_ASSERT(! m_server);
|
||||||
for (auto &item : m_startServerMenuItems) { item.setEnabled(false); }
|
for (auto &item : m_startServerMenuItems) { item.setEnabled(false); }
|
||||||
|
|
||||||
|
auto previousLibraryPath = BlackMisc::getCustomLibraryPath();
|
||||||
|
auto libraryPath = g_xplanePath + "Resources" + g_sep + "plugins" + g_sep + "xbus";
|
||||||
|
#if !defined (Q_OS_MAC) && defined(WORD_SIZE_64)
|
||||||
|
libraryPath = libraryPath + g_sep + "64";
|
||||||
|
#endif
|
||||||
|
BlackMisc::setCustomLibraryPath(libraryPath);
|
||||||
m_server = new BlackMisc::CDBusServer(xbusServiceName(), address, this);
|
m_server = new BlackMisc::CDBusServer(xbusServiceName(), address, this);
|
||||||
|
BlackMisc::setCustomLibraryPath(previousLibraryPath);
|
||||||
|
|
||||||
m_service = new CService(this);
|
m_service = new CService(this);
|
||||||
m_traffic = new CTraffic(this);
|
m_traffic = new CTraffic(this);
|
||||||
m_weather = new CWeather(this);
|
m_weather = new CWeather(this);
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#define NOMINMAX
|
#define NOMINMAX
|
||||||
#endif
|
#endif
|
||||||
#include "traffic.h"
|
#include "traffic.h"
|
||||||
|
#include "utils.h"
|
||||||
#include "XPMPMultiplayer.h"
|
#include "XPMPMultiplayer.h"
|
||||||
#include "XPMPMultiplayerCSL.h"
|
#include "XPMPMultiplayerCSL.h"
|
||||||
#include <XPLM/XPLMProcessing.h>
|
#include <XPLM/XPLMProcessing.h>
|
||||||
@@ -40,24 +41,6 @@ namespace XBus
|
|||||||
surfaces.lights.timeOffset = static_cast<quint16>(qrand() % 0xffff);
|
surfaces.lights.timeOffset = static_cast<quint16>(qrand() % 0xffff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
QString g_xplanePath;
|
|
||||||
QString g_sep;
|
|
||||||
|
|
||||||
//! Init global xplane path
|
|
||||||
void initXPlanePath()
|
|
||||||
{
|
|
||||||
char xplanePath[512];
|
|
||||||
XPLMGetSystemPath(xplanePath);
|
|
||||||
#ifdef Q_OS_MAC
|
|
||||||
HFS2PosixPath(xplanePath, xplanePath, sizeof(xplanePath));
|
|
||||||
g_sep = "/";
|
|
||||||
#else
|
|
||||||
g_sep = XPLMGetDirectorySeparator();
|
|
||||||
#endif
|
|
||||||
g_xplanePath = xplanePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
CTraffic::CTraffic(QObject *parent) : QObject(parent)
|
CTraffic::CTraffic(QObject *parent) : QObject(parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
45
src/xbus/utils.cpp
Normal file
45
src/xbus/utils.cpp
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
/* Copyright (C) 2016
|
||||||
|
* swift Project Community / Contributors
|
||||||
|
*
|
||||||
|
* This file is part of swift project. It is subject to the license terms in the LICENSE file found in the top-level
|
||||||
|
* directory of this distribution and at http://www.swift-project.org/license.html. No part of swift project,
|
||||||
|
* including this file, may be copied, modified, propagated, or distributed except according to the terms
|
||||||
|
* contained in the LICENSE file.
|
||||||
|
*/
|
||||||
|
|
||||||
|
//! \cond PRIVATE
|
||||||
|
|
||||||
|
#ifndef NOMINMAX
|
||||||
|
#define NOMINMAX
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "utils.h"
|
||||||
|
#include <XPMPMultiplayerCSL.h>
|
||||||
|
#include <QString>
|
||||||
|
#include <QtGlobal>
|
||||||
|
|
||||||
|
namespace XBus
|
||||||
|
{
|
||||||
|
|
||||||
|
QString g_xplanePath;
|
||||||
|
QString g_sep;
|
||||||
|
|
||||||
|
//! Init global xplane path
|
||||||
|
void initXPlanePath()
|
||||||
|
{
|
||||||
|
if (!g_xplanePath.isEmpty() && !g_sep.isEmpty()) {}
|
||||||
|
|
||||||
|
char xplanePath[512];
|
||||||
|
XPLMGetSystemPath(xplanePath);
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
HFS2PosixPath(xplanePath, xplanePath, sizeof(xplanePath));
|
||||||
|
g_sep = "/";
|
||||||
|
#else
|
||||||
|
g_sep = XPLMGetDirectorySeparator();
|
||||||
|
#endif
|
||||||
|
g_xplanePath = xplanePath;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//! \endcond
|
||||||
@@ -167,4 +167,16 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
namespace XBus
|
||||||
|
{
|
||||||
|
//! Absolute xplane path
|
||||||
|
extern QString g_xplanePath;
|
||||||
|
|
||||||
|
//! Platform specific dir separator
|
||||||
|
extern QString g_sep;
|
||||||
|
|
||||||
|
//! Init global xplane path
|
||||||
|
void initXPlanePath();
|
||||||
|
}
|
||||||
|
|
||||||
#endif // guard
|
#endif // guard
|
||||||
|
|||||||
@@ -74,8 +74,13 @@ macx {
|
|||||||
XBUS_DIR = xbus
|
XBUS_DIR = xbus
|
||||||
XBUS_DESTDIR = $$DestRoot/$$XBUS_DIR
|
XBUS_DESTDIR = $$DestRoot/$$XBUS_DIR
|
||||||
} else {
|
} else {
|
||||||
equals(WORD_SIZE,64): XBUS_DIR = xbus/64
|
equals(WORD_SIZE,64) {
|
||||||
equals(WORD_SIZE,32): XBUS_DIR = xbus
|
XBUS_DIR = xbus/64
|
||||||
|
DEFINES += WORD_SIZE_64
|
||||||
|
}
|
||||||
|
equals(WORD_SIZE,32) {
|
||||||
|
XBUS_DIR = xbus
|
||||||
|
}
|
||||||
XBUS_DESTDIR = $$DestRoot/$$XBUS_DIR
|
XBUS_DESTDIR = $$DestRoot/$$XBUS_DIR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user