2020-07-01 14:19:25 +00:00
|
|
|
/*
|
|
|
|
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 "ui/layers/box_content.h"
|
|
|
|
|
|
|
|
class UserData;
|
|
|
|
class ChannelData;
|
|
|
|
|
2023-09-01 16:45:44 +00:00
|
|
|
namespace Info::Profile {
|
|
|
|
class Badge;
|
|
|
|
enum class BadgeType;
|
|
|
|
} // namespace Info::Profile
|
|
|
|
|
2021-08-31 11:50:49 +00:00
|
|
|
namespace Main {
|
|
|
|
class Session;
|
|
|
|
} // namespace Main
|
|
|
|
|
2020-07-01 14:19:25 +00:00
|
|
|
namespace Window {
|
|
|
|
class SessionController;
|
|
|
|
} // namespace Window
|
|
|
|
|
|
|
|
namespace Data {
|
|
|
|
class PhotoMedia;
|
|
|
|
} // namespace Data
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class EmptyUserpic;
|
|
|
|
} // namespace Ui
|
|
|
|
|
|
|
|
namespace Api {
|
|
|
|
|
|
|
|
void CheckChatInvite(
|
|
|
|
not_null<Window::SessionController*> controller,
|
|
|
|
const QString &hash,
|
|
|
|
ChannelData *invitePeekChannel = nullptr);
|
|
|
|
|
|
|
|
} // namespace Api
|
|
|
|
|
|
|
|
class ConfirmInviteBox final : public Ui::BoxContent {
|
|
|
|
public:
|
|
|
|
ConfirmInviteBox(
|
|
|
|
QWidget*,
|
|
|
|
not_null<Main::Session*> session,
|
|
|
|
const MTPDchatInvite &data,
|
|
|
|
ChannelData *invitePeekChannel,
|
|
|
|
Fn<void()> submit);
|
|
|
|
~ConfirmInviteBox();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void prepare() override;
|
|
|
|
|
|
|
|
void resizeEvent(QResizeEvent *e) override;
|
|
|
|
void paintEvent(QPaintEvent *e) override;
|
|
|
|
|
|
|
|
private:
|
2022-12-05 12:18:10 +00:00
|
|
|
struct Participant;
|
2022-08-10 09:23:36 +00:00
|
|
|
struct ChatInvite {
|
|
|
|
QString title;
|
|
|
|
QString about;
|
|
|
|
PhotoData *photo = nullptr;
|
|
|
|
int participantsCount = 0;
|
|
|
|
std::vector<Participant> participants;
|
|
|
|
bool isPublic = false;
|
|
|
|
bool isChannel = false;
|
|
|
|
bool isMegagroup = false;
|
|
|
|
bool isBroadcast = false;
|
|
|
|
bool isRequestNeeded = false;
|
2023-09-01 16:45:44 +00:00
|
|
|
bool isFake = false;
|
|
|
|
bool isScam = false;
|
|
|
|
bool isVerified = false;
|
2022-08-10 09:23:36 +00:00
|
|
|
};
|
|
|
|
[[nodiscard]] static ChatInvite Parse(
|
2020-07-01 14:19:25 +00:00
|
|
|
not_null<Main::Session*> session,
|
|
|
|
const MTPDchatInvite &data);
|
2023-09-01 16:45:44 +00:00
|
|
|
[[nodiscard]] Info::Profile::BadgeType BadgeForInvite(
|
|
|
|
const ChatInvite &invite);
|
2020-07-01 14:19:25 +00:00
|
|
|
|
2022-08-10 09:23:36 +00:00
|
|
|
ConfirmInviteBox(
|
|
|
|
not_null<Main::Session*> session,
|
|
|
|
ChatInvite &&invite,
|
|
|
|
ChannelData *invitePeekChannel,
|
|
|
|
Fn<void()> submit);
|
|
|
|
|
2020-07-01 14:19:25 +00:00
|
|
|
const not_null<Main::Session*> _session;
|
|
|
|
|
|
|
|
Fn<void()> _submit;
|
|
|
|
object_ptr<Ui::FlatLabel> _title;
|
2023-09-01 16:45:44 +00:00
|
|
|
std::unique_ptr<Info::Profile::Badge> _badge;
|
2020-07-01 14:19:25 +00:00
|
|
|
object_ptr<Ui::FlatLabel> _status;
|
2021-10-14 13:45:13 +00:00
|
|
|
object_ptr<Ui::FlatLabel> _about;
|
|
|
|
object_ptr<Ui::FlatLabel> _aboutRequests;
|
2020-07-01 14:19:25 +00:00
|
|
|
std::shared_ptr<Data::PhotoMedia> _photo;
|
|
|
|
std::unique_ptr<Ui::EmptyUserpic> _photoEmpty;
|
|
|
|
std::vector<Participant> _participants;
|
2023-09-01 16:45:44 +00:00
|
|
|
|
2020-07-01 14:19:25 +00:00
|
|
|
bool _isChannel = false;
|
2021-10-12 12:50:18 +00:00
|
|
|
bool _requestApprove = false;
|
2020-07-01 14:19:25 +00:00
|
|
|
|
|
|
|
int _userWidth = 0;
|
|
|
|
|
|
|
|
};
|