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"
|
|
|
|
|
2019-03-18 17:17:00 +00:00
|
|
|
enum LangKey : int;
|
|
|
|
|
2019-03-16 16:58:32 +00:00
|
|
|
namespace style {
|
|
|
|
struct InfoProfileCountButton;
|
|
|
|
} // namespace style
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class VerticalLayout;
|
|
|
|
} // namespace Ui
|
|
|
|
|
|
|
|
namespace Info {
|
|
|
|
namespace Profile {
|
|
|
|
class Button;
|
|
|
|
} // namespace Profile
|
|
|
|
} // namespace Info
|
|
|
|
|
|
|
|
enum class Privacy {
|
|
|
|
Public,
|
|
|
|
Private,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class UsernameState {
|
|
|
|
Normal,
|
|
|
|
TooMany,
|
|
|
|
NotAvailable,
|
|
|
|
};
|
|
|
|
|
2019-03-17 10:06:00 +00:00
|
|
|
class EditPeerTypeBox : public BoxContent {
|
2019-03-16 16:58:32 +00:00
|
|
|
public:
|
2019-03-17 10:06:00 +00:00
|
|
|
EditPeerTypeBox(
|
2019-03-16 16:58:32 +00:00
|
|
|
QWidget*,
|
|
|
|
not_null<PeerData*> p,
|
|
|
|
FnMut<void(Privacy, QString)> savedCallback,
|
|
|
|
std::optional<Privacy> privacySaved = std::nullopt,
|
2019-03-18 17:17:00 +00:00
|
|
|
std::optional<QString> usernameSaved = std::nullopt,
|
|
|
|
std::optional<LangKey> usernameError = std::nullopt);
|
2019-03-16 16:58:32 +00:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void prepare() override;
|
2019-03-19 12:25:44 +00:00
|
|
|
void setInnerFocus() override;
|
2019-03-16 16:58:32 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
not_null<PeerData*> _peer;
|
|
|
|
FnMut<void(Privacy, QString)> _savedCallback;
|
|
|
|
|
2019-03-19 15:45:46 +00:00
|
|
|
std::optional<Privacy> _privacySavedValue;
|
|
|
|
std::optional<QString> _usernameSavedValue;
|
|
|
|
std::optional<LangKey> _usernameError;
|
2019-03-17 17:42:33 +00:00
|
|
|
|
2019-03-16 16:58:32 +00:00
|
|
|
rpl::event_stream<> _focusRequests;
|
|
|
|
|
|
|
|
};
|