mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-21 04:45:31 +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)
|
void CContextAudioProxy::registerDevices(const CAudioDeviceInfoList &devices)
|
||||||
{
|
{
|
||||||
if (devices.isEmpty()) { return; }
|
if (devices.isEmpty()) { return; }
|
||||||
m_dBusInterface->callDBus(QLatin1String("registerDevices"));
|
m_dBusInterface->callDBus(QLatin1String("registerDevices"), devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CContextAudioProxy::unRegisterDevices(const CAudioDeviceInfoList &devices)
|
void CContextAudioProxy::unRegisterDevices(const CAudioDeviceInfoList &devices)
|
||||||
{
|
{
|
||||||
if (devices.isEmpty()) { return; }
|
if (devices.isEmpty()) { return; }
|
||||||
m_dBusInterface->callDBus(QLatin1String("unRegisterDevices"));
|
m_dBusInterface->callDBus(QLatin1String("unRegisterDevices"), devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CContextAudioProxy::unRegisterDevicesFor(const CIdentifier &identifier)
|
void CContextAudioProxy::unRegisterDevicesFor(const CIdentifier &identifier)
|
||||||
|
|||||||
@@ -87,6 +87,10 @@ namespace BlackCore
|
|||||||
//! Destructor
|
//! Destructor
|
||||||
virtual ~IContextSimulator() override {}
|
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:
|
signals:
|
||||||
//! Simulator combined status
|
//! Simulator combined status
|
||||||
//! \sa ISimulator::SimulatorStatus
|
//! \sa ISimulator::SimulatorStatus
|
||||||
@@ -171,10 +175,6 @@ namespace BlackCore
|
|||||||
//! Simulator combined status
|
//! Simulator combined status
|
||||||
virtual int getSimulatorStatus() const = 0;
|
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
|
//! Simulator setup
|
||||||
virtual BlackMisc::Simulation::CSimulatorInternals getSimulatorInternals() const = 0;
|
virtual BlackMisc::Simulation::CSimulatorInternals getSimulatorInternals() const = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -14,11 +14,12 @@
|
|||||||
#include "blackcore/db/databasereader.h"
|
#include "blackcore/db/databasereader.h"
|
||||||
#include "blackcore/vatsim/vatsimsettings.h"
|
#include "blackcore/vatsim/vatsimsettings.h"
|
||||||
#include "blackcore/fsd/fsdclient.h"
|
#include "blackcore/fsd/fsdclient.h"
|
||||||
|
#include "blackcore/afv/clients/afvclient.h"
|
||||||
|
#include "blackcore/simulator.h"
|
||||||
#include "blackcore/webreaderflags.h"
|
#include "blackcore/webreaderflags.h"
|
||||||
#include "blackcore/aircraftmatcher.h"
|
#include "blackcore/aircraftmatcher.h"
|
||||||
#include "blackcore/afv/clients/afvclient.h"
|
|
||||||
#include "blackmisc/dbus.h"
|
|
||||||
#include "blackmisc/network/network.h"
|
#include "blackmisc/network/network.h"
|
||||||
|
#include "blackmisc/dbus.h"
|
||||||
#include "blackmisc/valueobject.h"
|
#include "blackmisc/valueobject.h"
|
||||||
|
|
||||||
#include <QDBusMetaType>
|
#include <QDBusMetaType>
|
||||||
@@ -43,6 +44,8 @@ namespace BlackCore
|
|||||||
qDBusRegisterMetaType<Context::CLogSubscriptionPair>();
|
qDBusRegisterMetaType<Context::CLogSubscriptionPair>();
|
||||||
qDBusRegisterMetaType<Context::CSettingsDictionary>();
|
qDBusRegisterMetaType<Context::CSettingsDictionary>();
|
||||||
qDBusRegisterMetaType<BlackMisc::Network::CLoginMode>();
|
qDBusRegisterMetaType<BlackMisc::Network::CLoginMode>();
|
||||||
|
qDBusRegisterMetaType<BlackCore::ISimulator::SimulatorStatusFlag>();
|
||||||
|
qDBusRegisterMetaType<BlackCore::ISimulator::SimulatorStatus>();
|
||||||
|
|
||||||
qRegisterMetaTypeStreamOperators<Context::CLogSubscriptionHash>();
|
qRegisterMetaTypeStreamOperators<Context::CLogSubscriptionHash>();
|
||||||
qRegisterMetaTypeStreamOperators<Context::CLogSubscriptionPair>();
|
qRegisterMetaTypeStreamOperators<Context::CLogSubscriptionPair>();
|
||||||
|
|||||||
@@ -736,6 +736,8 @@ namespace BlackCore
|
|||||||
};
|
};
|
||||||
} // namespace
|
} // 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::ISimulator, "org.swift-project.blackcore.simulator")
|
||||||
Q_DECLARE_INTERFACE(BlackCore::ISimulatorFactory, "org.swift-project.blackcore.simulatorfactory")
|
Q_DECLARE_INTERFACE(BlackCore::ISimulatorFactory, "org.swift-project.blackcore.simulatorfactory")
|
||||||
Q_DECLARE_OPERATORS_FOR_FLAGS(BlackCore::ISimulator::SimulatorStatus)
|
Q_DECLARE_OPERATORS_FOR_FLAGS(BlackCore::ISimulator::SimulatorStatus)
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ namespace BlackMisc
|
|||||||
{ }
|
{ }
|
||||||
|
|
||||||
CAudioDeviceInfo::CAudioDeviceInfo(DeviceType type, const QString &name) :
|
CAudioDeviceInfo::CAudioDeviceInfo(DeviceType type, const QString &name) :
|
||||||
m_type(type),
|
m_type(static_cast<int>(type)),
|
||||||
m_deviceName(name)
|
m_deviceName(name)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ namespace BlackMisc
|
|||||||
case IndexDeviceType: return CVariant::fromValue(this->getType());
|
case IndexDeviceType: return CVariant::fromValue(this->getType());
|
||||||
case IndexDeviceTypeAsString: return CVariant::fromValue(this->getTypeAsString());
|
case IndexDeviceTypeAsString: return CVariant::fromValue(this->getTypeAsString());
|
||||||
case IndexName: return CVariant::fromValue(this->getName());
|
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;
|
default: break;
|
||||||
}
|
}
|
||||||
return CValueObject::propertyByIndex(index);
|
return CValueObject::propertyByIndex(index);
|
||||||
@@ -95,8 +95,8 @@ namespace BlackMisc
|
|||||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case IndexDeviceType: m_type = static_cast<DeviceType>(variant.toInt()); return;
|
case IndexDeviceType: m_type = static_cast<DeviceType>(variant.toInt()); return;
|
||||||
case IndexName: m_deviceName = variant.toQString(); return;
|
case IndexName: m_deviceName = variant.toQString(); return;
|
||||||
case IndexIdentifier: m_identifier.setPropertyByIndex(index.copyFrontRemoved(), variant); return;
|
case IndexIdentifier: m_identifier.setPropertyByIndex(index.copyFrontRemoved(), variant); return;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
@@ -110,8 +110,8 @@ namespace BlackMisc
|
|||||||
switch (i)
|
switch (i)
|
||||||
{
|
{
|
||||||
case IndexDeviceTypeAsString:
|
case IndexDeviceTypeAsString:
|
||||||
case IndexDeviceType: return Compare::compare(m_type, compareValue.m_type);
|
case IndexDeviceType: return Compare::compare(m_type, compareValue.m_type);
|
||||||
case IndexName: return m_deviceName.compare(compareValue.m_deviceName, Qt::CaseInsensitive);
|
case IndexName: return m_deviceName.compare(compareValue.m_deviceName, Qt::CaseInsensitive);
|
||||||
case IndexIdentifier: return m_identifier.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getIdentifier());
|
case IndexIdentifier: return m_identifier.comparePropertyByIndex(index.copyFrontRemoved(), compareValue.getIdentifier());
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
@@ -127,7 +127,7 @@ namespace BlackMisc
|
|||||||
|
|
||||||
switch (t)
|
switch (t)
|
||||||
{
|
{
|
||||||
case InputDevice: return i;
|
case InputDevice: return i;
|
||||||
case OutputDevice: return o;
|
case OutputDevice: return o;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ namespace BlackMisc
|
|||||||
const CIdentifier &getIdentifier() const { return m_identifier; }
|
const CIdentifier &getIdentifier() const { return m_identifier; }
|
||||||
|
|
||||||
//! Type
|
//! Type
|
||||||
DeviceType getType() const { return m_type; }
|
DeviceType getType() const { return static_cast<DeviceType>(m_type); }
|
||||||
|
|
||||||
//! Type as string
|
//! Type as string
|
||||||
const QString &getTypeAsString() const { return deviceTypeToString(this->getType()); }
|
const QString &getTypeAsString() const { return deviceTypeToString(this->getType()); }
|
||||||
@@ -113,9 +113,9 @@ namespace BlackMisc
|
|||||||
static const QString &deviceTypeToString(DeviceType t);
|
static const QString &deviceTypeToString(DeviceType t);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DeviceType m_type = Unknown; //!< Device type, @see CAudioDeviceInfo::DeviceType
|
int m_type = static_cast<int>(Unknown); //!< Device type, @see CAudioDeviceInfo::DeviceType
|
||||||
QString m_deviceName; //!< Device name
|
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
|
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(
|
BLACK_METACLASS(
|
||||||
CAudioDeviceInfo,
|
CAudioDeviceInfo,
|
||||||
|
|||||||
Reference in New Issue
Block a user