mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-10 23:07:59 +00:00
Register stream operators for enum classes. Closes #3921.
This commit is contained in:
parent
4a271d358f
commit
a7ff38d389
@ -63,6 +63,8 @@ Preferences::Preferences()
|
|||||||
, dirty(false)
|
, dirty(false)
|
||||||
, lock(QReadWriteLock::Recursive)
|
, lock(QReadWriteLock::Recursive)
|
||||||
{
|
{
|
||||||
|
qRegisterMetaTypeStreamOperators<MaxRatioAction>("MaxRatioAction");
|
||||||
|
|
||||||
QIniSettings *settings = new QIniSettings;
|
QIniSettings *settings = new QIniSettings;
|
||||||
#ifndef Q_OS_MAC
|
#ifndef Q_OS_MAC
|
||||||
QIniSettings *settings_new = new QIniSettings("qBittorrent", "qBittorrent_new");
|
QIniSettings *settings_new = new QIniSettings("qBittorrent", "qBittorrent_new");
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#define TYPES_H
|
#define TYPES_H
|
||||||
|
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
#include <QDataStream>
|
||||||
|
|
||||||
const qlonglong MAX_ETA = 8640000;
|
const qlonglong MAX_ETA = 8640000;
|
||||||
|
|
||||||
@ -55,4 +56,19 @@ enum class ShutdownAction
|
|||||||
Hibernate
|
Hibernate
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
inline QDataStream &operator<<(QDataStream &out, const T &val)
|
||||||
|
{
|
||||||
|
return (out << static_cast<int>(val));
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
inline QDataStream &operator>>(QDataStream &in, T &val)
|
||||||
|
{
|
||||||
|
int tmp;
|
||||||
|
in >> tmp;
|
||||||
|
val = static_cast<T>(tmp);
|
||||||
|
return in;
|
||||||
|
}
|
||||||
|
|
||||||
#endif // TYPES_H
|
#endif // TYPES_H
|
||||||
|
Loading…
Reference in New Issue
Block a user