mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
Issue #77 All classes propertyindex methods use CPropertyIndexRef and QVariant
This commit is contained in:
@@ -74,36 +74,36 @@ namespace BlackMisc
|
||||
return CAudioDeviceInfo(InputDevice, QAudioDeviceInfo::defaultInputDevice().deviceName());
|
||||
}
|
||||
|
||||
CVariant CAudioDeviceInfo::propertyByIndex(const CPropertyIndex &index) const
|
||||
QVariant CAudioDeviceInfo::propertyByIndex(CPropertyIndexRef index) const
|
||||
{
|
||||
if (index.isMyself()) { return CVariant::fromValue(*this); }
|
||||
if (index.isMyself()) { return QVariant::fromValue(*this); }
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexDeviceType: return CVariant::fromValue(this->getType());
|
||||
case IndexDeviceTypeAsString: return CVariant::fromValue(this->getTypeAsString());
|
||||
case IndexName: return CVariant::fromValue(this->getName());
|
||||
case IndexDeviceType: return QVariant::fromValue(this->getType());
|
||||
case IndexDeviceTypeAsString: return QVariant::fromValue(this->getTypeAsString());
|
||||
case IndexName: return QVariant::fromValue(this->getName());
|
||||
case IndexIdentifier: return m_identifier.propertyByIndex(index.copyFrontRemoved());
|
||||
default: break;
|
||||
}
|
||||
return CValueObject::propertyByIndex(index);
|
||||
}
|
||||
|
||||
void CAudioDeviceInfo::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
|
||||
void CAudioDeviceInfo::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
|
||||
{
|
||||
if (index.isMyself()) { (*this) = variant.to<CAudioDeviceInfo>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CAudioDeviceInfo>(); return; }
|
||||
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 IndexName: m_deviceName = variant.toString(); return;
|
||||
case IndexIdentifier: m_identifier.setPropertyByIndex(index.copyFrontRemoved(), variant); return;
|
||||
default: break;
|
||||
}
|
||||
CValueObject::setPropertyByIndex(index, variant);
|
||||
}
|
||||
|
||||
int CAudioDeviceInfo::comparePropertyByIndex(const CPropertyIndex &index, const CAudioDeviceInfo &compareValue) const
|
||||
int CAudioDeviceInfo::comparePropertyByIndex(CPropertyIndexRef index, const CAudioDeviceInfo &compareValue) const
|
||||
{
|
||||
if (index.isMyself()) { return m_deviceName.compare(compareValue.m_deviceName, Qt::CaseInsensitive); }
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
|
||||
@@ -98,16 +98,16 @@ namespace BlackMisc
|
||||
static CAudioDeviceInfo getDefaultInputDevice();
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
||||
CVariant propertyByIndex(const BlackMisc::CPropertyIndex &index) const;
|
||||
QVariant propertyByIndex(BlackMisc::CPropertyIndexRef index) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
||||
void setPropertyByIndex(const BlackMisc::CPropertyIndex &index, const CVariant &variant);
|
||||
void setPropertyByIndex(BlackMisc::CPropertyIndexRef index, const QVariant &variant);
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::String::toQString
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex
|
||||
int comparePropertyByIndex(const CPropertyIndex &index, const CAudioDeviceInfo &compareValue) const;
|
||||
int comparePropertyByIndex(CPropertyIndexRef index, const CAudioDeviceInfo &compareValue) const;
|
||||
|
||||
//! Device type as string
|
||||
static const QString &deviceTypeToString(DeviceType t);
|
||||
|
||||
@@ -45,33 +45,33 @@ namespace BlackMisc
|
||||
m_afvVoiceServerUrl(afvVoiceServerUrl), m_afvMapUrl(afvMapUrl)
|
||||
{ }
|
||||
|
||||
CVariant CVoiceSetup::propertyByIndex(const BlackMisc::CPropertyIndex &index) const
|
||||
QVariant CVoiceSetup::propertyByIndex(BlackMisc::CPropertyIndexRef index) const
|
||||
{
|
||||
if (index.isMyself()) { return CVariant::from(*this); }
|
||||
if (index.isMyself()) { return QVariant::fromValue(*this); }
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexAfvVoiceServerUrl: return CVariant::fromValue(m_afvVoiceServerUrl);
|
||||
case IndexAfvMapUrl: return CVariant::fromValue(m_afvMapUrl);
|
||||
case IndexAfvVoiceServerUrl: return QVariant::fromValue(m_afvVoiceServerUrl);
|
||||
case IndexAfvMapUrl: return QVariant::fromValue(m_afvMapUrl);
|
||||
default: return CValueObject::propertyByIndex(index);
|
||||
}
|
||||
}
|
||||
|
||||
void CVoiceSetup::setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant)
|
||||
void CVoiceSetup::setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant)
|
||||
{
|
||||
if (index.isMyself()) { (*this) = variant.to<CVoiceSetup>(); return; }
|
||||
if (index.isMyself()) { (*this) = variant.value<CVoiceSetup>(); return; }
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
switch (i)
|
||||
{
|
||||
case IndexAfvVoiceServerUrl: m_afvVoiceServerUrl = variant.toQString(); break;
|
||||
case IndexAfvMapUrl: m_afvMapUrl = variant.toQString(); break;
|
||||
case IndexAfvVoiceServerUrl: m_afvVoiceServerUrl = variant.toString(); break;
|
||||
case IndexAfvMapUrl: m_afvMapUrl = variant.toString(); break;
|
||||
default:
|
||||
CValueObject::setPropertyByIndex(index, variant);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int CVoiceSetup::comparePropertyByIndex(const CPropertyIndex &index, const CVoiceSetup &compareValue) const
|
||||
int CVoiceSetup::comparePropertyByIndex(CPropertyIndexRef index, const CVoiceSetup &compareValue) const
|
||||
{
|
||||
if (index.isMyself()) { return this->convertToQString(true).compare(compareValue.convertToQString()); }
|
||||
const ColumnIndex i = index.frontCasted<ColumnIndex>();
|
||||
|
||||
@@ -56,13 +56,13 @@ namespace BlackMisc
|
||||
const QString &getAfvMapUrl() const { return m_afvMapUrl; }
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::propertyByIndex
|
||||
CVariant propertyByIndex(const CPropertyIndex &index) const;
|
||||
QVariant propertyByIndex(CPropertyIndexRef index) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::setPropertyByIndex
|
||||
void setPropertyByIndex(const CPropertyIndex &index, const CVariant &variant);
|
||||
void setPropertyByIndex(CPropertyIndexRef index, const QVariant &variant);
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::Index::comparePropertyByIndex
|
||||
int comparePropertyByIndex(const CPropertyIndex &index, const CVoiceSetup &compareValue) const;
|
||||
int comparePropertyByIndex(CPropertyIndexRef index, const CVoiceSetup &compareValue) const;
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::String::toQString()
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
Reference in New Issue
Block a user