mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 09:15:34 +08:00
refs #199 , refs #85 Moved specialized value method into right place (impl, not proxy - it is a receiver method)
This specialized method can be removed with refs #116
This commit is contained in:
@@ -96,4 +96,22 @@ namespace BlackCore
|
||||
}
|
||||
return msgs;
|
||||
}
|
||||
|
||||
/*
|
||||
* DBus version of value
|
||||
*/
|
||||
BlackMisc::CStatusMessageList CContextSettings::value(const QString &path, const QString &command, QDBusVariant value, int unifiedBlackMetaType)
|
||||
{
|
||||
QVariant qv = value.variant();
|
||||
if (qv.canConvert<QDBusArgument>())
|
||||
{
|
||||
// convert from QDBusArgument
|
||||
int type = BlackMisc::firstBlackMetaType() + unifiedBlackMetaType; // unify
|
||||
qv = BlackMisc::fixQVariantFromDbusArgument(qv, type);
|
||||
}
|
||||
// when called locally, this will call the virtual method
|
||||
// of the concrete implementation in context_settings
|
||||
return this->value(path, command, qv);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -44,6 +44,7 @@ namespace BlackCore
|
||||
const QString &getSettingsDirectory() const { return BlackMisc::Settings::CSettingUtilities::getSettingsDirectory(); }
|
||||
|
||||
//! \copydoc IContextSettings::value()
|
||||
virtual BlackMisc::CStatusMessageList value(const QString &path, const QString &command, const QVariant &value) override;
|
||||
|
||||
public slots:
|
||||
//! \copydoc IContextSettings::getNetworkSettings()
|
||||
@@ -52,8 +53,14 @@ namespace BlackCore
|
||||
//! \copydoc IContextSettings::getHotkeys()
|
||||
virtual BlackMisc::Hardware::CKeyboardKeyList getHotkeys() const override;
|
||||
|
||||
//! \copydoc IContextSettings::value()
|
||||
virtual BlackMisc::CStatusMessageList value(const QString &path, const QString &command, const QVariant &value) override;
|
||||
/*!
|
||||
* \brief DBus version of value method.
|
||||
* \remarks Basically an unwanted signature as this is different from the "local" signature and
|
||||
* contains explicit DBus types (a: QDbusArgument, b: type for conversion).
|
||||
* If this can be removed, fine. -> https://dev.vatsim-germany.org/issues/116
|
||||
*/
|
||||
virtual BlackMisc::CStatusMessageList value(const QString &path, const QString &command, QDBusVariant value, int unifiedBlackMetaType);
|
||||
|
||||
|
||||
private:
|
||||
friend class CRuntime;
|
||||
|
||||
@@ -65,20 +65,8 @@ namespace BlackCore
|
||||
}
|
||||
|
||||
/*
|
||||
* DBus version of value
|
||||
*/
|
||||
BlackMisc::CStatusMessageList CContextSettingsProxy::value(const QString &path, const QString &command, QDBusVariant value, int unifiedBlackMetaType)
|
||||
{
|
||||
QVariant qv = value.variant();
|
||||
if (qv.canConvert<QDBusArgument>())
|
||||
{
|
||||
// convert from QDBusArgument
|
||||
int type = BlackMisc::firstBlackMetaType() + unifiedBlackMetaType; // unify
|
||||
qv = BlackMisc::fixQVariantFromDbusArgument(qv, type);
|
||||
}
|
||||
// when called locally, this will call the virtual method
|
||||
// of the concrete implementation in context_settings
|
||||
return this->value(path, command, qv);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -31,19 +31,6 @@ namespace BlackCore
|
||||
//! \brief Destructor
|
||||
virtual ~CContextSettingsProxy() {}
|
||||
|
||||
|
||||
/*!
|
||||
* \brief Handle value
|
||||
* \param path where value belongs to
|
||||
* \param command what to do with value
|
||||
* \param value
|
||||
* \return messages generated during handling
|
||||
* \remarks Do not make this a slot, no DBus XML signature shall be created. The QVariant
|
||||
* will be send a tailored value method using QDBusVariant
|
||||
* @see value(const QString &, const QString &, QDBusVariant, int)
|
||||
*/
|
||||
virtual BlackMisc::CStatusMessageList value(const QString &path, const QString &command, const QVariant &value) override;
|
||||
|
||||
private:
|
||||
friend class CRuntime;
|
||||
BlackMisc::CGenericDBusInterface *m_dBusInterface;
|
||||
@@ -67,13 +54,9 @@ namespace BlackCore
|
||||
//! \copydoc IContextSettings::getHotkeys()
|
||||
virtual BlackMisc::Hardware::CKeyboardKeyList getHotkeys() const override;
|
||||
|
||||
/*!
|
||||
* \brief DBus version of value method.
|
||||
* \remarks Basically an unwanted signature as this is different from the "local" signature and
|
||||
* contains explicit DBus types (a: QDbusArgument, b: type for conversion).
|
||||
* If this can be removed, fine.
|
||||
*/
|
||||
BlackMisc::CStatusMessageList value(const QString &path, const QString &command, QDBusVariant value, int unifiedBlackMetaType);
|
||||
//! \copydoc IContextSettings::value
|
||||
virtual BlackMisc::CStatusMessageList value(const QString &path, const QString &command, const QVariant &value) override;
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user