mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-30 22:25:12 +00:00
Update API scheme on layer 148: Topic icons.
This commit is contained in:
25
Telegram/SourceFiles/ui/color_int_conversion.cpp
Normal file
25
Telegram/SourceFiles/ui/color_int_conversion.cpp
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop application for the Telegram messaging service.
|
||||
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "ui/color_int_conversion.h"
|
||||
|
||||
namespace Ui {
|
||||
|
||||
QColor ColorFromSerialized(quint32 serialized) {
|
||||
return QColor(
|
||||
int((serialized >> 16) & 0xFFU),
|
||||
int((serialized >> 8) & 0xFFU),
|
||||
int(serialized & 0xFFU));
|
||||
}
|
||||
|
||||
std::optional<QColor> MaybeColorFromSerialized(quint32 serialized) {
|
||||
return (serialized == quint32(-1))
|
||||
? std::nullopt
|
||||
: std::make_optional(ColorFromSerialized(serialized));
|
||||
}
|
||||
|
||||
} // namespace Ui
|
16
Telegram/SourceFiles/ui/color_int_conversion.h
Normal file
16
Telegram/SourceFiles/ui/color_int_conversion.h
Normal file
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop application for the Telegram messaging service.
|
||||
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
namespace Ui {
|
||||
|
||||
[[nodiscard]] QColor ColorFromSerialized(quint32 serialized);
|
||||
[[nodiscard]] std::optional<QColor> MaybeColorFromSerialized(
|
||||
quint32 serialized);
|
||||
|
||||
} // namespace Ui
|
Reference in New Issue
Block a user