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 {
|
2019-11-02 17:06:47 +00:00
|
|
|
struct SettingsCountButton;
|
2019-03-16 16:58:32 +00:00
|
|
|
} // namespace style
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class VerticalLayout;
|
2019-11-02 17:06:47 +00:00
|
|
|
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:
|
2019-06-21 12:27:46 +00:00
|
|
|
// Edit just the invite link.
|
|
|
|
EditPeerTypeBox(QWidget*, not_null<PeerData*> peer);
|
|
|
|
|
2019-03-17 10:06:00 +00:00
|
|
|
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)>> savedCallback,
|
|
|
|
std::optional<Privacy> privacySaved,
|
|
|
|
std::optional<QString> usernameSaved,
|
2019-06-18 12:16:43 +00:00
|
|
|
std::optional<rpl::producer<QString>> usernameError = {});
|
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;
|
2019-06-21 12:27:46 +00:00
|
|
|
bool _useLocationPhrases = false;
|
2019-03-20 16:45:21 +00:00
|
|
|
std::optional<FnMut<void(Privacy, QString)>> _savedCallback;
|
2019-03-16 16:58:32 +00:00
|
|
|
|
2019-03-19 15:45:46 +00:00
|
|
|
std::optional<Privacy> _privacySavedValue;
|
|
|
|
std::optional<QString> _usernameSavedValue;
|
2019-06-18 12:16:43 +00:00
|
|
|
std::optional<rpl::producer<QString>> _usernameError;
|
2019-03-17 17:42:33 +00:00
|
|
|
|
2019-03-16 16:58:32 +00:00
|
|
|
rpl::event_stream<> _focusRequests;
|
|
|
|
|
|
|
|
};
|