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 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,
|
|
|
|
std::optional<QString> usernameSaved = std::nullopt);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void prepare() override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void setupContent();
|
|
|
|
|
|
|
|
not_null<PeerData*> _peer;
|
|
|
|
FnMut<void(Privacy, QString)> _savedCallback;
|
|
|
|
|
2019-03-17 17:42:33 +00:00
|
|
|
std::optional<Privacy> _privacySavedValue = std::nullopt;
|
|
|
|
std::optional<QString> _usernameSavedValue = std::nullopt;
|
|
|
|
|
2019-03-16 16:58:32 +00:00
|
|
|
rpl::event_stream<> _focusRequests;
|
|
|
|
|
|
|
|
};
|