mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-30 03:32:36 +00:00
Add and register SettingValue stream operators
This commit is contained in:
parent
47ef2d018f
commit
bb3c22e4a5
@ -24,6 +24,11 @@ namespace
|
|||||||
Config::GameSettings::GameSettings(const Files::ConfigurationManager& cfg)
|
Config::GameSettings::GameSettings(const Files::ConfigurationManager& cfg)
|
||||||
: mCfgMgr(cfg)
|
: mCfgMgr(cfg)
|
||||||
{
|
{
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
|
// this needs calling once so Qt can see its stream operators, which it needs when dragging and dropping
|
||||||
|
// it's automatic with Qt 6
|
||||||
|
qRegisterMetaTypeStreamOperators<SettingValue>("Config::SettingValue");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void Config::GameSettings::validatePaths()
|
void Config::GameSettings::validatePaths()
|
||||||
@ -591,3 +596,19 @@ void Config::GameSettings::clear()
|
|||||||
mDataDirs.clear();
|
mDataDirs.clear();
|
||||||
mDataLocal.clear();
|
mDataLocal.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QDataStream& Config::operator<<(QDataStream& out, const SettingValue& settingValue)
|
||||||
|
{
|
||||||
|
out << settingValue.value;
|
||||||
|
out << settingValue.originalRepresentation;
|
||||||
|
out << settingValue.context;
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDataStream& Config::operator>>(QDataStream& in, SettingValue& settingValue)
|
||||||
|
{
|
||||||
|
in >> settingValue.value;
|
||||||
|
in >> settingValue.originalRepresentation;
|
||||||
|
in >> settingValue.context;
|
||||||
|
return in;
|
||||||
|
}
|
||||||
|
@ -132,6 +132,9 @@ namespace Config
|
|||||||
|
|
||||||
static bool isOrderedLine(const QString& line);
|
static bool isOrderedLine(const QString& line);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
QDataStream& operator<<(QDataStream& out, const SettingValue& settingValue);
|
||||||
|
QDataStream& operator>>(QDataStream& in, SettingValue& settingValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
Q_DECLARE_METATYPE(Config::SettingValue)
|
Q_DECLARE_METATYPE(Config::SettingValue)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user