2016-09-06 12:28:37 +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-09-06 12:28:37 +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-09-06 12:28:37 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
|
2017-04-06 14:38:10 +00:00
|
|
|
#include "boxes/abstract_box.h"
|
|
|
|
#include "base/observer.h"
|
2018-11-04 07:32:26 +00:00
|
|
|
#include "base/timer.h"
|
2019-04-02 09:13:30 +00:00
|
|
|
#include "ui/effects/animations.h"
|
2016-11-21 17:46:29 +00:00
|
|
|
#include "ui/effects/round_checkbox.h"
|
2020-06-11 16:09:46 +00:00
|
|
|
#include "mtproto/sender.h"
|
2016-09-06 12:28:37 +00:00
|
|
|
|
2020-08-10 12:22:54 +00:00
|
|
|
namespace SendMenu {
|
|
|
|
enum class Type;
|
|
|
|
} // namespace SendMenu
|
2019-08-28 16:46:47 +00:00
|
|
|
|
2019-07-25 18:55:11 +00:00
|
|
|
namespace Window {
|
|
|
|
class SessionNavigation;
|
|
|
|
} // namespace Window
|
|
|
|
|
2019-08-12 12:11:34 +00:00
|
|
|
namespace Api {
|
|
|
|
struct SendOptions;
|
|
|
|
} // namespace Api
|
|
|
|
|
2019-07-25 18:55:11 +00:00
|
|
|
namespace Main {
|
|
|
|
class Session;
|
|
|
|
} // namespace Main
|
|
|
|
|
2016-09-06 12:28:37 +00:00
|
|
|
namespace Dialogs {
|
|
|
|
class Row;
|
|
|
|
class IndexedList;
|
|
|
|
} // namespace Dialogs
|
|
|
|
|
2016-10-20 16:32:15 +00:00
|
|
|
namespace Ui {
|
2016-10-22 13:03:20 +00:00
|
|
|
class MultiSelect;
|
2018-11-04 07:32:26 +00:00
|
|
|
class InputField;
|
|
|
|
struct ScrollToRequest;
|
|
|
|
template <typename Widget>
|
|
|
|
class SlideWrap;
|
2016-10-20 16:32:15 +00:00
|
|
|
} // namespace Ui
|
|
|
|
|
2019-07-25 18:55:11 +00:00
|
|
|
QString AppendShareGameScoreUrl(
|
|
|
|
not_null<Main::Session*> session,
|
|
|
|
const QString &url,
|
|
|
|
const FullMsgId &fullId);
|
|
|
|
void ShareGameScoreByHash(
|
|
|
|
not_null<Main::Session*> session,
|
|
|
|
const QString &hash);
|
2016-09-07 09:04:57 +00:00
|
|
|
|
2020-06-11 16:09:46 +00:00
|
|
|
class ShareBox final : public Ui::BoxContent {
|
2016-09-06 12:28:37 +00:00
|
|
|
public:
|
2018-06-04 15:35:11 +00:00
|
|
|
using CopyCallback = Fn<void()>;
|
2019-07-26 16:06:22 +00:00
|
|
|
using SubmitCallback = Fn<void(
|
2019-09-13 06:06:02 +00:00
|
|
|
std::vector<not_null<PeerData*>>&&,
|
2019-07-26 16:06:22 +00:00
|
|
|
TextWithTags&&,
|
2019-08-12 12:11:34 +00:00
|
|
|
Api::SendOptions)>;
|
2018-06-04 15:35:11 +00:00
|
|
|
using FilterCallback = Fn<bool(PeerData*)>;
|
2019-07-25 18:55:11 +00:00
|
|
|
|
2018-11-04 07:32:26 +00:00
|
|
|
ShareBox(
|
|
|
|
QWidget*,
|
2019-07-25 18:55:11 +00:00
|
|
|
not_null<Window::SessionNavigation*> navigation,
|
2018-11-04 07:32:26 +00:00
|
|
|
CopyCallback &©Callback,
|
|
|
|
SubmitCallback &&submitCallback,
|
|
|
|
FilterCallback &&filterCallback);
|
2016-09-06 12:28:37 +00:00
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
protected:
|
|
|
|
void prepare() override;
|
|
|
|
void setInnerFocus() override;
|
2016-09-06 12:28:37 +00:00
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
|
|
|
void keyPressEvent(QKeyEvent *e) override;
|
|
|
|
|
2016-09-06 12:28:37 +00:00
|
|
|
private:
|
2018-11-04 07:32:26 +00:00
|
|
|
void prepareCommentField();
|
2016-12-07 13:32:25 +00:00
|
|
|
void scrollAnimationCallback();
|
|
|
|
|
2019-08-12 12:11:34 +00:00
|
|
|
void submit(Api::SendOptions options);
|
|
|
|
void submitSilent();
|
|
|
|
void submitScheduled();
|
2018-11-04 07:32:26 +00:00
|
|
|
void copyLink();
|
|
|
|
bool searchByUsername(bool useCache = false);
|
|
|
|
|
2020-08-10 12:22:54 +00:00
|
|
|
SendMenu::Type sendMenuType() const;
|
2019-08-28 16:46:47 +00:00
|
|
|
|
2018-11-04 07:32:26 +00:00
|
|
|
void scrollTo(Ui::ScrollToRequest request);
|
|
|
|
void needSearchByUsername();
|
2018-12-29 08:11:54 +00:00
|
|
|
void applyFilterUpdate(const QString &query);
|
2018-11-04 07:32:26 +00:00
|
|
|
void selectedChanged();
|
2016-12-13 17:07:56 +00:00
|
|
|
void createButtons();
|
2016-10-22 13:03:20 +00:00
|
|
|
int getTopScrollSkip() const;
|
2018-11-04 07:32:26 +00:00
|
|
|
int getBottomScrollSkip() const;
|
|
|
|
int contentHeight() const;
|
2016-10-22 13:03:20 +00:00
|
|
|
void updateScrollSkips();
|
|
|
|
|
|
|
|
void addPeerToMultiSelect(PeerData *peer, bool skipAnimation = false);
|
2018-11-04 07:32:26 +00:00
|
|
|
void innerSelectedChanged(PeerData *peer, bool checked);
|
2016-09-06 12:28:37 +00:00
|
|
|
|
2020-06-11 16:09:46 +00:00
|
|
|
void peopleDone(
|
2018-01-22 10:58:11 +00:00
|
|
|
const MTPcontacts_Found &result,
|
|
|
|
mtpRequestId requestId);
|
2020-06-11 16:09:46 +00:00
|
|
|
void peopleFail(const RPCError &error, mtpRequestId requestId);
|
2016-09-06 12:28:37 +00:00
|
|
|
|
2019-07-25 18:55:11 +00:00
|
|
|
const not_null<Window::SessionNavigation*> _navigation;
|
2020-06-11 16:09:46 +00:00
|
|
|
MTP::Sender _api;
|
2019-07-25 18:55:11 +00:00
|
|
|
|
2016-09-19 10:18:21 +00:00
|
|
|
CopyCallback _copyCallback;
|
|
|
|
SubmitCallback _submitCallback;
|
2016-12-13 17:07:56 +00:00
|
|
|
FilterCallback _filterCallback;
|
2016-09-06 12:28:37 +00:00
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
object_ptr<Ui::MultiSelect> _select;
|
2018-11-04 07:32:26 +00:00
|
|
|
object_ptr<Ui::SlideWrap<Ui::InputField>> _comment;
|
2016-09-06 12:28:37 +00:00
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
class Inner;
|
|
|
|
QPointer<Inner> _inner;
|
2016-09-06 12:28:37 +00:00
|
|
|
|
2016-12-13 17:07:56 +00:00
|
|
|
bool _hasSelected = false;
|
2016-09-06 12:28:37 +00:00
|
|
|
|
2018-11-04 07:32:26 +00:00
|
|
|
base::Timer _searchTimer;
|
2016-09-06 12:28:37 +00:00
|
|
|
QString _peopleQuery;
|
|
|
|
bool _peopleFull = false;
|
|
|
|
mtpRequestId _peopleRequest = 0;
|
|
|
|
|
|
|
|
using PeopleCache = QMap<QString, MTPcontacts_Found>;
|
|
|
|
PeopleCache _peopleCache;
|
|
|
|
|
|
|
|
using PeopleQueries = QMap<mtpRequestId, QString>;
|
|
|
|
PeopleQueries _peopleQueries;
|
|
|
|
|
2019-04-02 09:13:30 +00:00
|
|
|
Ui::Animations::Simple _scrollAnimation;
|
2016-09-06 14:45:10 +00:00
|
|
|
|
2016-09-06 12:28:37 +00:00
|
|
|
};
|