Moved structures of compose controls to separated header.

This commit is contained in:
23rd 2020-10-03 19:43:03 +03:00 committed by John Preston
parent f7c6876e1b
commit 6d775d6f45
4 changed files with 51 additions and 23 deletions

View File

@ -474,6 +474,7 @@ PRIVATE
history/admin_log/history_admin_log_section.h
# history/feed/history_feed_section.cpp
# history/feed/history_feed_section.h
history/view/controls/compose_controls_common.h
history/view/controls/history_view_compose_controls.cpp
history/view/controls/history_view_compose_controls.h
history/view/media/history_view_call.h

View File

@ -0,0 +1,42 @@
/*
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 Api {
enum class SendProgressType;
struct SendOptions;
} // namespace Api
class History;
namespace HistoryView::Controls {
struct MessageToEdit {
FullMsgId fullId;
Api::SendOptions options;
TextWithTags textWithTags;
};
struct VoiceToSend {
QByteArray bytes;
VoiceWaveform waveform;
int duration = 0;
};
struct SendActionUpdate {
Api::SendProgressType type = Api::SendProgressType();
int progress = 0;
};
struct SetHistoryArgs {
required<History*> history;
Fn<bool()> showSlowmodeError;
rpl::producer<int> slowmodeSecondsLeft;
rpl::producer<bool> sendDisabledBySlowmode;
rpl::producer<std::optional<QString>> writeRestriction;
};
} // namespace HistoryView::Controls

View File

@ -56,6 +56,7 @@ using PhotoChosen = ComposeControls::PhotoChosen;
using MessageToEdit = ComposeControls::MessageToEdit;
using VoiceToSend = ComposeControls::VoiceToSend;
using SendActionUpdate = ComposeControls::SendActionUpdate;
using SetHistoryArgs = ComposeControls::SetHistoryArgs;
[[nodiscard]] auto ShowWebPagePreview(WebPageData *page) {
return page && (page->pendingTill >= 0);

View File

@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "base/required.h"
#include "api/api_common.h"
#include "base/unique_qptr.h"
#include "history/view/controls/compose_controls_common.h"
#include "ui/rp_widget.h"
#include "ui/effects/animations.h"
#include "ui/widgets/input_fields.h"
@ -61,26 +62,17 @@ class ComposeControls final {
public:
using FileChosen = ChatHelpers::TabbedSelector::FileChosen;
using PhotoChosen = ChatHelpers::TabbedSelector::PhotoChosen;
using MessageToEdit = Controls::MessageToEdit;
using VoiceToSend = Controls::VoiceToSend;
using SendActionUpdate = Controls::SendActionUpdate;
using SetHistoryArgs = Controls::SetHistoryArgs;
enum class Mode {
Normal,
Scheduled,
};
struct MessageToEdit {
FullMsgId fullId;
Api::SendOptions options;
TextWithTags textWithTags;
};
struct VoiceToSend {
QByteArray bytes;
VoiceWaveform waveform;
int duration = 0;
};
struct SendActionUpdate {
Api::SendProgressType type = Api::SendProgressType();
int progress = 0;
};
ComposeControls(
not_null<QWidget*> parent,
not_null<Window::SessionController*> window,
@ -88,14 +80,6 @@ public:
~ComposeControls();
[[nodiscard]] Main::Session &session() const;
struct SetHistoryArgs {
required<History*> history;
Fn<bool()> showSlowmodeError;
rpl::producer<int> slowmodeSecondsLeft;
rpl::producer<bool> sendDisabledBySlowmode;
rpl::producer<std::optional<QString>> writeRestriction;
};
void setHistory(SetHistoryArgs &&args);
void finishAnimating();