2016-04-09 05:57:55 +00:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 10:23:14 +00:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2016-04-09 05:57:55 +00:00
|
|
|
|
2018-01-03 10:23:14 +00:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2016-04-09 05:57:55 +00:00
|
|
|
*/
|
2017-03-04 10:23:56 +00:00
|
|
|
#include "storage/serialize_common.h"
|
2016-04-09 05:57:55 +00:00
|
|
|
|
|
|
|
namespace Serialize {
|
2019-03-22 14:19:43 +00:00
|
|
|
|
2019-08-23 13:52:59 +00:00
|
|
|
void writeColor(QDataStream &stream, const QColor &color) {
|
|
|
|
stream << (quint32(uchar(color.red()))
|
|
|
|
| (quint32(uchar(color.green())) << 8)
|
|
|
|
| (quint32(uchar(color.blue())) << 16)
|
|
|
|
| (quint32(uchar(color.alpha())) << 24));
|
|
|
|
}
|
|
|
|
|
|
|
|
QColor readColor(QDataStream &stream) {
|
|
|
|
auto value = quint32();
|
|
|
|
stream >> value;
|
|
|
|
return QColor(
|
|
|
|
int(value & 0xFFU),
|
|
|
|
int((value >> 8) & 0xFFU),
|
|
|
|
int((value >> 16) & 0xFFU),
|
|
|
|
int((value >> 24) & 0xFFU));
|
|
|
|
}
|
|
|
|
|
2016-04-09 05:57:55 +00:00
|
|
|
} // namespace Serialize
|