tdesktop/Telegram/SourceFiles/boxes/peers/edit_peer_type_box.h

67 lines
1.5 KiB
C
Raw Normal View History

2019-03-16 16:58:32 +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 "boxes/abstract_box.h"
#include "base/timer.h"
namespace style {
struct SettingsCountButton;
2019-03-16 16:58:32 +00:00
} // namespace style
namespace Ui {
class VerticalLayout;
class SettingsButton;
2019-03-16 16:58:32 +00:00
} // namespace Ui
enum class Privacy {
2019-06-21 12:27:46 +00:00
HasUsername,
NoUsername,
2019-03-16 16:58:32 +00:00
};
enum class UsernameState {
Normal,
TooMany,
NotAvailable,
};
2019-09-18 11:19:05 +00:00
class EditPeerTypeBox : public Ui::BoxContent {
2019-03-16 16:58:32 +00:00
public:
EditPeerTypeBox(
2019-03-16 16:58:32 +00:00
QWidget*,
2019-06-21 12:27:46 +00:00
not_null<PeerData*> peer,
bool useLocationPhrases,
std::optional<FnMut<void(Privacy, QString, bool)>> savedCallback,
2021-02-01 15:10:59 +00:00
std::optional<Privacy> privacySaved,
2019-06-21 12:27:46 +00:00
std::optional<QString> usernameSaved,
std::optional<bool> noForwardsSaved,
2019-06-18 12:16:43 +00:00
std::optional<rpl::producer<QString>> usernameError = {});
2019-03-16 16:58:32 +00:00
2021-02-01 15:10:59 +00:00
// For invite link only.
EditPeerTypeBox(
QWidget*,
not_null<PeerData*> peer);
2019-03-16 16:58:32 +00:00
protected:
void prepare() override;
void setInnerFocus() override;
2019-03-16 16:58:32 +00:00
private:
not_null<PeerData*> _peer;
2019-06-21 12:27:46 +00:00
bool _useLocationPhrases = false;
std::optional<FnMut<void(Privacy, QString, bool)>> _savedCallback;
2019-03-16 16:58:32 +00:00
2021-02-01 15:10:59 +00:00
std::optional<Privacy> _privacySavedValue;
2019-03-19 15:45:46 +00:00
std::optional<QString> _usernameSavedValue;
std::optional<bool> _noForwardsValue;
2019-06-18 12:16:43 +00:00
std::optional<rpl::producer<QString>> _usernameError;
2019-03-16 16:58:32 +00:00
rpl::event_stream<> _focusRequests;
};