mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-08-08 20:53:54 +00:00
61 lines
1.3 KiB
C++
61 lines
1.3 KiB
C++
/*
|
|
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
|
|
|
|
#include "spellcheck/platform/platform_language.h"
|
|
#include "ui/widgets/buttons.h"
|
|
#include "ui/rp_widget.h"
|
|
|
|
namespace Ui::Text {
|
|
struct MarkedContext;
|
|
} // namespace Ui::Text
|
|
|
|
namespace Ui {
|
|
|
|
enum class TranslateBoxContentError {
|
|
None = 0,
|
|
Unknown,
|
|
LocalLanguagePackMissing,
|
|
};
|
|
|
|
struct TranslateBoxContentResult {
|
|
std::optional<TextWithEntities> text;
|
|
TranslateBoxContentError error = TranslateBoxContentError::None;
|
|
};
|
|
|
|
class GenericBox;
|
|
|
|
class TranslateShowButton final : public RpWidget {
|
|
public:
|
|
TranslateShowButton(not_null<RpWidget*> parent);
|
|
|
|
[[nodiscard]] rpl::producer<Qt::MouseButton> clicks() const;
|
|
|
|
protected:
|
|
void paintEvent(QPaintEvent *e) override;
|
|
|
|
private:
|
|
LinkButton _button;
|
|
|
|
};
|
|
|
|
struct TranslateBoxContentArgs {
|
|
TextWithEntities text;
|
|
bool hasCopyRestriction = false;
|
|
Text::MarkedContext textContext;
|
|
rpl::producer<LanguageId> to;
|
|
Fn<void()> chooseTo;
|
|
Fn<void(LanguageId, Fn<void(TranslateBoxContentResult)>)> request;
|
|
};
|
|
|
|
void TranslateBoxContent(
|
|
not_null<GenericBox*> box,
|
|
TranslateBoxContentArgs &&args);
|
|
|
|
} // namespace Ui
|