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

65 lines
1.3 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"
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,
};
class EditPeerTypeBox : public BoxContent {
2019-03-16 16:58:32 +00:00
public:
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,
std::optional<LangKey> usernameError = std::nullopt);
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;
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-16 16:58:32 +00:00
rpl::event_stream<> _focusRequests;
};