mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
[DBus] DBus related fixes
* use INT in CAudioDeviceInfo (minimum trouble) * register metatype * removed getSimulatorStatusEnum from DBus slots
This commit is contained in:
committed by
Mat Sutcliffe
parent
991681a1ea
commit
d8ec308a3b
@@ -47,13 +47,13 @@ namespace BlackCore
|
||||
void CContextAudioProxy::registerDevices(const CAudioDeviceInfoList &devices)
|
||||
{
|
||||
if (devices.isEmpty()) { return; }
|
||||
m_dBusInterface->callDBus(QLatin1String("registerDevices"));
|
||||
m_dBusInterface->callDBus(QLatin1String("registerDevices"), devices);
|
||||
}
|
||||
|
||||
void CContextAudioProxy::unRegisterDevices(const CAudioDeviceInfoList &devices)
|
||||
{
|
||||
if (devices.isEmpty()) { return; }
|
||||
m_dBusInterface->callDBus(QLatin1String("unRegisterDevices"));
|
||||
m_dBusInterface->callDBus(QLatin1String("unRegisterDevices"), devices);
|
||||
}
|
||||
|
||||
void CContextAudioProxy::unRegisterDevicesFor(const CIdentifier &identifier)
|
||||
|
||||
@@ -87,6 +87,10 @@ namespace BlackCore
|
||||
//! Destructor
|
||||
virtual ~IContextSimulator() override {}
|
||||
|
||||
//! Get simulator status as enum
|
||||
//! \fixme To be removed with Qt 5.5 when getSimualtorStatus directly provides the enum
|
||||
BlackCore::ISimulator::SimulatorStatus getSimulatorStatusEnum() const;
|
||||
|
||||
signals:
|
||||
//! Simulator combined status
|
||||
//! \sa ISimulator::SimulatorStatus
|
||||
@@ -171,10 +175,6 @@ namespace BlackCore
|
||||
//! Simulator combined status
|
||||
virtual int getSimulatorStatus() const = 0;
|
||||
|
||||
//! Get simulator status as enum
|
||||
//! \fixme To be removed with Qt 5.5 when getSimualtorStatus directly provides the enum
|
||||
BlackCore::ISimulator::SimulatorStatus getSimulatorStatusEnum() const;
|
||||
|
||||
//! Simulator setup
|
||||
virtual BlackMisc::Simulation::CSimulatorInternals getSimulatorInternals() const = 0;
|
||||
|
||||
|
||||
@@ -14,11 +14,12 @@
|
||||
#include "blackcore/db/databasereader.h"
|
||||
#include "blackcore/vatsim/vatsimsettings.h"
|
||||
#include "blackcore/fsd/fsdclient.h"
|
||||
#include "blackcore/afv/clients/afvclient.h"
|
||||
#include "blackcore/simulator.h"
|
||||
#include "blackcore/webreaderflags.h"
|
||||
#include "blackcore/aircraftmatcher.h"
|
||||
#include "blackcore/afv/clients/afvclient.h"
|
||||
#include "blackmisc/dbus.h"
|
||||
#include "blackmisc/network/network.h"
|
||||
#include "blackmisc/dbus.h"
|
||||
#include "blackmisc/valueobject.h"
|
||||
|
||||
#include <QDBusMetaType>
|
||||
@@ -43,6 +44,8 @@ namespace BlackCore
|
||||
qDBusRegisterMetaType<Context::CLogSubscriptionPair>();
|
||||
qDBusRegisterMetaType<Context::CSettingsDictionary>();
|
||||
qDBusRegisterMetaType<BlackMisc::Network::CLoginMode>();
|
||||
qDBusRegisterMetaType<BlackCore::ISimulator::SimulatorStatusFlag>();
|
||||
qDBusRegisterMetaType<BlackCore::ISimulator::SimulatorStatus>();
|
||||
|
||||
qRegisterMetaTypeStreamOperators<Context::CLogSubscriptionHash>();
|
||||
qRegisterMetaTypeStreamOperators<Context::CLogSubscriptionPair>();
|
||||
|
||||
@@ -736,6 +736,8 @@ namespace BlackCore
|
||||
};
|
||||
} // namespace
|
||||
|
||||
Q_DECLARE_METATYPE(BlackCore::ISimulator::SimulatorStatusFlag)
|
||||
Q_DECLARE_METATYPE(BlackCore::ISimulator::SimulatorStatus)
|
||||
Q_DECLARE_INTERFACE(BlackCore::ISimulator, "org.swift-project.blackcore.simulator")
|
||||
Q_DECLARE_INTERFACE(BlackCore::ISimulatorFactory, "org.swift-project.blackcore.simulatorfactory")
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(BlackCore::ISimulator::SimulatorStatus)
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace BlackMisc
|
||||
{ }
|
||||
|
||||
CAudioDeviceInfo::CAudioDeviceInfo(DeviceType type, const QString &name) :
|
||||
m_type(type),
|
||||
m_type(static_cast<int>(type)),
|
||||
m_deviceName(name)
|
||||
{ }
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace BlackMisc
|
||||
case IndexDeviceType: return CVariant::fromValue(this->getType());
|
||||
case IndexDeviceTypeAsString: return CVariant::fromValue(this->getTypeAsString());
|
||||
case IndexName: return CVariant::fromValue(this->getName());
|
||||
case IndexIdentifier: return m_identifier.propertyByIndex(index.copyFrontRemoved());
|
||||
case IndexIdentifier: return m_identifier.propertyByIndex(index.copyFrontRemoved());
|
||||
default: break;
|
||||
}
|
||||
return CValueObject::propertyByIndex(index);
|
||||
@@ -95,8 +95,8 @@ namespace BlackMisc
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexDeviceType: m_type = static_cast<DeviceType>(variant.toInt()); return;
|
||||
case IndexName: m_deviceName = variant.toQString(); return;
|
||||
case IndexDeviceType: m_type = static_cast<DeviceType>(variant.toInt()); return;
|
||||
case IndexName: m_deviceName = variant.toQString(); return;
|
||||
case IndexIdentifier: m_identifier.setPropertyByIndex(index.copyFrontRemoved(), variant); return;
|
||||
default: break;
|
||||
}
|
||||
@@ -110,8 +110,8 @@ namespace BlackMisc
|
||||
switch (i)
|
||||
{
|
||||
case IndexDeviceTypeAsString:
|
||||
case IndexDeviceType: return Compare::compare(m_type, compareValue.m_type);
|
||||
case IndexName: return m_deviceName.compare(compareValue.m_deviceName, Qt::CaseInsensitive);
|
||||
case IndexDeviceType: return Compare::compare(m_type, compareValue.m_type);
|
||||
case IndexName: return m_deviceName.compare(compareValue.m_deviceName, Qt::CaseInsensitive);
|
||||
case IndexIdentifier: return m_identifier.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getIdentifier());
|
||||
default: break;
|
||||
}
|
||||
@@ -127,7 +127,7 @@ namespace BlackMisc
|
||||
|
||||
switch (t)
|
||||
{
|
||||
case InputDevice: return i;
|
||||
case InputDevice: return i;
|
||||
case OutputDevice: return o;
|
||||
default: break;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace BlackMisc
|
||||
const CIdentifier &getIdentifier() const { return m_identifier; }
|
||||
|
||||
//! Type
|
||||
DeviceType getType() const { return m_type; }
|
||||
DeviceType getType() const { return static_cast<DeviceType>(m_type); }
|
||||
|
||||
//! Type as string
|
||||
const QString &getTypeAsString() const { return deviceTypeToString(this->getType()); }
|
||||
@@ -113,9 +113,9 @@ namespace BlackMisc
|
||||
static const QString &deviceTypeToString(DeviceType t);
|
||||
|
||||
private:
|
||||
DeviceType m_type = Unknown; //!< Device type, @see CAudioDeviceInfo::DeviceType
|
||||
QString m_deviceName; //!< Device name
|
||||
CIdentifier m_identifier; //!< We use a DBus based system. Hence an audio device can reside on a different computers, this here is its name
|
||||
int m_type = static_cast<int>(Unknown); //!< Device type, @see CAudioDeviceInfo::DeviceType
|
||||
QString m_deviceName; //!< Device name
|
||||
CIdentifier m_identifier; //!< We use a DBus based system. Hence an audio device can reside on a different computers, this here is its name
|
||||
|
||||
BLACK_METACLASS(
|
||||
CAudioDeviceInfo,
|
||||
|
||||
Reference in New Issue
Block a user