refs #345 First wave of value classes using the CValueObjectStdTuple CRTP class template.

This commit is contained in:
Mathew Sutcliffe
2014-10-30 22:08:22 +00:00
parent ecf8e6aafb
commit 4c8148acf1
68 changed files with 34 additions and 4499 deletions

View File

@@ -23,102 +23,11 @@ namespace BlackMisc
m_key(key), m_hotkeyFunction(function)
{}
void CSettingKeyboardHotkey::registerMetadata()
{
qRegisterMetaType<CSettingKeyboardHotkey>();
qDBusRegisterMetaType<CSettingKeyboardHotkey>();
}
/*
* To JSON
*/
QJsonObject CSettingKeyboardHotkey::toJson() const
{
return BlackMisc::serializeJson(TupleConverter<CSettingKeyboardHotkey>::toMetaTuple(*this));
}
/*
* From Json
*/
void CSettingKeyboardHotkey::convertFromJson(const QJsonObject &json)
{
BlackMisc::deserializeJson(json, TupleConverter<CSettingKeyboardHotkey>::toMetaTuple(*this));
}
QString CSettingKeyboardHotkey::convertToQString(bool /* i18n */) const
{
return m_key.toQString();
}
int CSettingKeyboardHotkey::getMetaTypeId() const
{
return qMetaTypeId<CSettingKeyboardHotkey>();
}
bool CSettingKeyboardHotkey::isA(int metaTypeId) const
{
return (metaTypeId == qMetaTypeId<CSettingKeyboardHotkey>());
}
/*
* Compare
*/
int CSettingKeyboardHotkey::compareImpl(const CValueObject &otherBase) const
{
const auto &other = static_cast<const CSettingKeyboardHotkey &>(otherBase);
return compare(TupleConverter<CSettingKeyboardHotkey>::toMetaTuple(*this), TupleConverter<CSettingKeyboardHotkey>::toMetaTuple(other));
}
/*
* Marshall to DBus
*/
void CSettingKeyboardHotkey::marshallToDbus(QDBusArgument &argument) const
{
argument << TupleConverter<CSettingKeyboardHotkey>::toMetaTuple(*this);
}
/*
* Unmarshall from DBus
*/
void CSettingKeyboardHotkey::unmarshallFromDbus(const QDBusArgument &argument)
{
argument >> TupleConverter<CSettingKeyboardHotkey>::toMetaTuple(*this);
}
/*
* Hash
*/
uint CSettingKeyboardHotkey::getValueHash() const
{
return qHash(TupleConverter<CSettingKeyboardHotkey>::toMetaTuple(*this));
}
/*
* Equal?
*/
bool CSettingKeyboardHotkey::operator ==(const CSettingKeyboardHotkey &other) const
{
if (this == &other) return true;
return TupleConverter<CSettingKeyboardHotkey>::toMetaTuple(*this) == TupleConverter<CSettingKeyboardHotkey>::toMetaTuple(other);
}
/*
* Unequal?
*/
bool CSettingKeyboardHotkey::operator !=(const CSettingKeyboardHotkey &other) const
{
return !((*this) == other);
}
bool CSettingKeyboardHotkey::operator< (CSettingKeyboardHotkey const &other) const
{
if (this->getKey() < other.getKey())
return true;
else
return false;
}
void CSettingKeyboardHotkey::setKey(const Hardware::CKeyboardKey &key)
{
m_key = key;