Implement auction info box (active/ended).
This commit is contained in:
@@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#pragma once
|
||||
|
||||
#include "ui/text/text_entity.h"
|
||||
#include "ui/text/text_utilities.h"
|
||||
|
||||
namespace Lang {
|
||||
|
||||
@@ -32,3 +33,148 @@ struct ReplaceTag<TextWithEntities> {
|
||||
};
|
||||
|
||||
} // namespace Lang
|
||||
|
||||
namespace tr {
|
||||
namespace details {
|
||||
|
||||
struct MarkedProjection {
|
||||
[[nodiscard]] TextWithEntities operator()(const QString &value) const {
|
||||
return TextWithEntities{ value };
|
||||
}
|
||||
[[nodiscard]] TextWithEntities operator()(QString &&value) const {
|
||||
return TextWithEntities{ std::move(value) };
|
||||
}
|
||||
};
|
||||
|
||||
struct RichProjection {
|
||||
[[nodiscard]] TextWithEntities operator()(const QString &value) const {
|
||||
return Ui::Text::RichLangValue(value);
|
||||
}
|
||||
};
|
||||
|
||||
struct BoldProjection {
|
||||
[[nodiscard]] TextWithEntities operator()(const QString &value) const {
|
||||
return Ui::Text::Bold(value);
|
||||
}
|
||||
[[nodiscard]] TextWithEntities operator()(
|
||||
const TextWithEntities &value) const {
|
||||
return Ui::Text::Wrapped(value, EntityType::Bold);
|
||||
}
|
||||
[[nodiscard]] TextWithEntities operator()(
|
||||
TextWithEntities &&value) const {
|
||||
return Ui::Text::Wrapped(std::move(value), EntityType::Bold);
|
||||
}
|
||||
};
|
||||
|
||||
struct SemiboldProjection {
|
||||
[[nodiscard]] TextWithEntities operator()(const QString &value) const {
|
||||
return Ui::Text::Semibold(value);
|
||||
}
|
||||
[[nodiscard]] TextWithEntities operator()(
|
||||
const TextWithEntities &value) const {
|
||||
return Ui::Text::Wrapped(value, EntityType::Semibold);
|
||||
}
|
||||
[[nodiscard]] TextWithEntities operator()(
|
||||
TextWithEntities &&value) const {
|
||||
return Ui::Text::Wrapped(std::move(value), EntityType::Semibold);
|
||||
}
|
||||
};
|
||||
|
||||
struct ItalicProjection {
|
||||
[[nodiscard]] TextWithEntities operator()(const QString &value) const {
|
||||
return Ui::Text::Italic(value);
|
||||
}
|
||||
[[nodiscard]] TextWithEntities operator()(
|
||||
const TextWithEntities &value) const {
|
||||
return Ui::Text::Wrapped(value, EntityType::Italic);
|
||||
}
|
||||
[[nodiscard]] TextWithEntities operator()(
|
||||
TextWithEntities &&value) const {
|
||||
return Ui::Text::Wrapped(std::move(value), EntityType::Italic);
|
||||
}
|
||||
};
|
||||
|
||||
struct UnderlineProjection {
|
||||
[[nodiscard]] TextWithEntities operator()(const QString &value) const {
|
||||
return Ui::Text::Underline(value);
|
||||
}
|
||||
[[nodiscard]] TextWithEntities operator()(
|
||||
const TextWithEntities &value) const {
|
||||
return Ui::Text::Wrapped(value, EntityType::Underline);
|
||||
}
|
||||
[[nodiscard]] TextWithEntities operator()(
|
||||
TextWithEntities &&value) const {
|
||||
return Ui::Text::Wrapped(std::move(value), EntityType::Underline);
|
||||
}
|
||||
};
|
||||
|
||||
struct StrikeOutProjection {
|
||||
[[nodiscard]] TextWithEntities operator()(const QString &value) const {
|
||||
return Ui::Text::StrikeOut(value);
|
||||
}
|
||||
[[nodiscard]] TextWithEntities operator()(
|
||||
const TextWithEntities &value) const {
|
||||
return Ui::Text::Wrapped(value, EntityType::StrikeOut);
|
||||
}
|
||||
[[nodiscard]] TextWithEntities operator()(
|
||||
TextWithEntities &&value) const {
|
||||
return Ui::Text::Wrapped(std::move(value), EntityType::StrikeOut);
|
||||
}
|
||||
};
|
||||
|
||||
struct LinkProjection {
|
||||
[[nodiscard]] TextWithEntities operator()(const QString &value) const {
|
||||
return Ui::Text::Link(value);
|
||||
}
|
||||
[[nodiscard]] TextWithEntities operator()(
|
||||
const QString &value,
|
||||
const QString &url) const {
|
||||
return Ui::Text::Link(value, url);
|
||||
}
|
||||
[[nodiscard]] TextWithEntities operator()(
|
||||
const QString &value,
|
||||
int index) const {
|
||||
return Ui::Text::Link(value, index);
|
||||
}
|
||||
[[nodiscard]] TextWithEntities operator()(
|
||||
const TextWithEntities &value) const {
|
||||
return Ui::Text::Link(value);
|
||||
}
|
||||
[[nodiscard]] TextWithEntities operator()(
|
||||
const TextWithEntities &value,
|
||||
const QString &url) const {
|
||||
return Ui::Text::Link(value, url);
|
||||
}
|
||||
[[nodiscard]] TextWithEntities operator()(
|
||||
const TextWithEntities &value,
|
||||
int index) const {
|
||||
return Ui::Text::Link(value, index);
|
||||
}
|
||||
[[nodiscard]] TextWithEntities operator()(
|
||||
TextWithEntities &&value) const {
|
||||
return Ui::Text::Link(std::move(value));
|
||||
}
|
||||
[[nodiscard]] TextWithEntities operator()(
|
||||
TextWithEntities &&value,
|
||||
const QString &url) const {
|
||||
return Ui::Text::Link(std::move(value), url);
|
||||
}
|
||||
[[nodiscard]] TextWithEntities operator()(
|
||||
TextWithEntities &&value,
|
||||
int index) const {
|
||||
return Ui::Text::Link(std::move(value), index);
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace details
|
||||
|
||||
inline constexpr details::MarkedProjection marked{};
|
||||
inline constexpr details::RichProjection rich{};
|
||||
inline constexpr details::BoldProjection bold{};
|
||||
inline constexpr details::SemiboldProjection semibold{};
|
||||
inline constexpr details::ItalicProjection italic{};
|
||||
inline constexpr details::UnderlineProjection underline{};
|
||||
inline constexpr details::StrikeOutProjection strikeout{};
|
||||
inline constexpr details::LinkProjection link{};
|
||||
|
||||
} // namespace tr
|
||||
|
||||
Reference in New Issue
Block a user