2018-09-05 19:05:49 +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
|
|
|
|
*/
|
|
|
|
#include "settings/settings_information.h"
|
|
|
|
|
2021-02-22 02:10:27 +00:00
|
|
|
#include "editor/photo_editor_layer_widget.h"
|
2018-09-05 19:05:49 +00:00
|
|
|
#include "settings/settings_common.h"
|
|
|
|
#include "ui/wrap/vertical_layout.h"
|
2018-09-09 17:38:08 +00:00
|
|
|
#include "ui/wrap/padding_wrap.h"
|
|
|
|
#include "ui/widgets/labels.h"
|
|
|
|
#include "ui/widgets/buttons.h"
|
|
|
|
#include "ui/widgets/input_fields.h"
|
2018-09-13 20:09:26 +00:00
|
|
|
#include "ui/widgets/popup_menu.h"
|
2019-09-18 11:19:05 +00:00
|
|
|
#include "ui/widgets/box_content_divider.h"
|
2018-09-13 20:09:26 +00:00
|
|
|
#include "ui/special_buttons.h"
|
2020-06-18 18:04:16 +00:00
|
|
|
#include "core/application.h"
|
|
|
|
#include "core/core_settings.h"
|
2018-11-21 10:09:46 +00:00
|
|
|
#include "chat_helpers/emoji_suggestions_widget.h"
|
2018-09-09 17:38:08 +00:00
|
|
|
#include "boxes/add_contact_box.h"
|
2018-09-13 20:09:26 +00:00
|
|
|
#include "boxes/confirm_box.h"
|
2018-09-09 17:38:08 +00:00
|
|
|
#include "boxes/change_phone_box.h"
|
|
|
|
#include "boxes/username_box.h"
|
2019-01-04 11:09:48 +00:00
|
|
|
#include "data/data_user.h"
|
2018-09-09 17:38:08 +00:00
|
|
|
#include "info/profile/info_profile_values.h"
|
2018-09-05 19:05:49 +00:00
|
|
|
#include "lang/lang_keys.h"
|
2019-07-24 11:45:24 +00:00
|
|
|
#include "main/main_session.h"
|
2019-07-24 14:00:30 +00:00
|
|
|
#include "window/window_session_controller.h"
|
2018-09-09 17:38:08 +00:00
|
|
|
#include "apiwrap.h"
|
2018-09-13 20:09:26 +00:00
|
|
|
#include "core/file_utilities.h"
|
2019-09-26 10:55:35 +00:00
|
|
|
#include "base/call_delayed.h"
|
2019-09-18 11:19:05 +00:00
|
|
|
#include "styles/style_layers.h"
|
2018-09-05 19:05:49 +00:00
|
|
|
#include "styles/style_settings.h"
|
|
|
|
|
2019-09-04 07:19:15 +00:00
|
|
|
#include <QtGui/QGuiApplication>
|
|
|
|
#include <QtGui/QClipboard>
|
|
|
|
|
2018-09-05 19:05:49 +00:00
|
|
|
namespace Settings {
|
2018-09-09 17:38:08 +00:00
|
|
|
namespace {
|
|
|
|
|
2018-09-18 16:32:07 +00:00
|
|
|
constexpr auto kSaveBioTimeout = 1000;
|
|
|
|
|
2018-09-13 20:09:26 +00:00
|
|
|
void SetupPhoto(
|
|
|
|
not_null<Ui::VerticalLayout*> container,
|
2019-06-06 10:21:40 +00:00
|
|
|
not_null<Window::SessionController*> controller,
|
2018-09-13 20:09:26 +00:00
|
|
|
not_null<UserData*> self) {
|
2019-09-18 11:19:05 +00:00
|
|
|
const auto wrap = container->add(object_ptr<Ui::BoxContentDivider>(
|
2018-09-13 20:09:26 +00:00
|
|
|
container,
|
|
|
|
st::settingsInfoPhotoHeight));
|
|
|
|
const auto photo = Ui::CreateChild<Ui::UserpicButton>(
|
|
|
|
wrap,
|
|
|
|
controller,
|
|
|
|
self,
|
|
|
|
Ui::UserpicButton::Role::OpenPhoto,
|
|
|
|
st::settingsInfoPhoto);
|
|
|
|
const auto upload = Ui::CreateChild<Ui::RoundButton>(
|
|
|
|
wrap,
|
2019-06-18 16:53:27 +00:00
|
|
|
tr::lng_settings_upload(),
|
2018-09-13 20:09:26 +00:00
|
|
|
st::settingsInfoPhotoSet);
|
|
|
|
upload->setFullRadius(true);
|
|
|
|
upload->addClickHandler([=] {
|
2021-02-22 02:10:27 +00:00
|
|
|
auto callback = [=](QImage &&image) {
|
|
|
|
self->session().api().uploadPeerPhoto(self, std::move(image));
|
2018-09-13 20:09:26 +00:00
|
|
|
};
|
2021-02-22 02:10:27 +00:00
|
|
|
Editor::PrepareProfilePhoto(
|
2018-09-13 20:09:26 +00:00
|
|
|
upload,
|
2021-02-22 02:10:27 +00:00
|
|
|
&controller->window(),
|
|
|
|
std::move(callback));
|
2018-09-13 20:09:26 +00:00
|
|
|
});
|
|
|
|
rpl::combine(
|
|
|
|
wrap->widthValue(),
|
|
|
|
photo->widthValue(),
|
|
|
|
upload->widthValue()
|
|
|
|
) | rpl::start_with_next([=](int max, int photoWidth, int uploadWidth) {
|
|
|
|
photo->moveToLeft(
|
|
|
|
(max - photoWidth) / 2,
|
|
|
|
st::settingsInfoPhotoTop);
|
|
|
|
upload->moveToLeft(
|
|
|
|
(max - uploadWidth) / 2,
|
|
|
|
(st::settingsInfoPhotoTop
|
|
|
|
+ photo->height()
|
|
|
|
+ st::settingsInfoPhotoSkip));
|
|
|
|
}, photo->lifetime());
|
|
|
|
}
|
|
|
|
|
|
|
|
void ShowMenu(
|
|
|
|
QWidget *parent,
|
|
|
|
const QString ©Button,
|
|
|
|
const QString &text) {
|
|
|
|
const auto menu = new Ui::PopupMenu(parent);
|
|
|
|
|
|
|
|
menu->addAction(copyButton, [=] {
|
2019-09-04 07:19:15 +00:00
|
|
|
QGuiApplication::clipboard()->setText(text);
|
2018-09-13 20:09:26 +00:00
|
|
|
});
|
|
|
|
menu->popup(QCursor::pos());
|
|
|
|
}
|
|
|
|
|
2018-09-09 17:38:08 +00:00
|
|
|
void AddRow(
|
|
|
|
not_null<Ui::VerticalLayout*> container,
|
|
|
|
rpl::producer<QString> label,
|
|
|
|
rpl::producer<TextWithEntities> value,
|
2018-09-13 20:09:26 +00:00
|
|
|
const QString ©Button,
|
2018-09-09 17:38:08 +00:00
|
|
|
Fn<void()> edit,
|
|
|
|
const style::icon &icon) {
|
2018-09-13 20:09:26 +00:00
|
|
|
const auto wrap = AddButton(
|
2018-09-09 17:38:08 +00:00
|
|
|
container,
|
2018-09-13 20:09:26 +00:00
|
|
|
rpl::single(QString()),
|
|
|
|
st::settingsInfoRow,
|
|
|
|
&icon);
|
2018-11-21 10:09:46 +00:00
|
|
|
const auto forcopy = Ui::CreateChild<QString>(wrap.get());
|
2018-09-13 20:09:26 +00:00
|
|
|
wrap->setAcceptBoth();
|
|
|
|
wrap->clicks(
|
|
|
|
) | rpl::filter([=] {
|
|
|
|
return !wrap->isDisabled();
|
|
|
|
}) | rpl::start_with_next([=](Qt::MouseButton button) {
|
|
|
|
if (button == Qt::LeftButton) {
|
|
|
|
edit();
|
|
|
|
} else if (!forcopy->isEmpty()) {
|
|
|
|
ShowMenu(wrap, copyButton, *forcopy);
|
|
|
|
}
|
2018-09-09 17:38:08 +00:00
|
|
|
}, wrap->lifetime());
|
|
|
|
|
|
|
|
auto existing = base::duplicate(
|
|
|
|
value
|
|
|
|
) | rpl::map([](const TextWithEntities &text) {
|
|
|
|
return text.entities.isEmpty();
|
|
|
|
});
|
2018-09-13 20:09:26 +00:00
|
|
|
base::duplicate(
|
|
|
|
value
|
|
|
|
) | rpl::filter([](const TextWithEntities &text) {
|
|
|
|
return text.entities.isEmpty();
|
|
|
|
}) | rpl::start_with_next([=](const TextWithEntities &text) {
|
|
|
|
*forcopy = text.text;
|
|
|
|
}, wrap->lifetime());
|
2018-09-09 17:38:08 +00:00
|
|
|
const auto text = Ui::CreateChild<Ui::FlatLabel>(
|
2018-09-13 20:09:26 +00:00
|
|
|
wrap.get(),
|
2018-09-09 17:38:08 +00:00
|
|
|
std::move(value),
|
|
|
|
st::settingsInfoValue);
|
|
|
|
text->setClickHandlerFilter([=](auto&&...) {
|
|
|
|
edit();
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
base::duplicate(
|
|
|
|
existing
|
|
|
|
) | rpl::start_with_next([=](bool existing) {
|
2018-09-13 20:09:26 +00:00
|
|
|
wrap->setDisabled(!existing);
|
|
|
|
text->setAttribute(Qt::WA_TransparentForMouseEvents, existing);
|
2018-09-09 17:38:08 +00:00
|
|
|
text->setSelectable(existing);
|
|
|
|
text->setDoubleClickSelectsParagraph(existing);
|
|
|
|
}, text->lifetime());
|
|
|
|
|
|
|
|
const auto about = Ui::CreateChild<Ui::FlatLabel>(
|
2018-09-13 20:09:26 +00:00
|
|
|
wrap.get(),
|
2018-09-09 17:38:08 +00:00
|
|
|
std::move(label),
|
|
|
|
st::settingsInfoAbout);
|
2018-09-13 20:09:26 +00:00
|
|
|
about->setAttribute(Qt::WA_TransparentForMouseEvents);
|
|
|
|
|
|
|
|
const auto button = Ui::CreateChild<Ui::RpWidget>(wrap.get());
|
|
|
|
button->resize(st::settingsInfoEditIconOver.size());
|
|
|
|
button->setAttribute(Qt::WA_TransparentForMouseEvents);
|
|
|
|
button->paintRequest(
|
|
|
|
) | rpl::filter([=] {
|
|
|
|
return (wrap->isOver() || wrap->isDown()) && !wrap->isDisabled();
|
|
|
|
}) | rpl::start_with_next([=](QRect clip) {
|
|
|
|
Painter p(button);
|
|
|
|
st::settingsInfoEditIconOver.paint(p, QPoint(), button->width());
|
|
|
|
}, button->lifetime());
|
|
|
|
|
|
|
|
wrap->sizeValue(
|
|
|
|
) | rpl::start_with_next([=](QSize size) {
|
|
|
|
const auto width = size.width();
|
2018-09-09 17:38:08 +00:00
|
|
|
text->resizeToWidth(width
|
|
|
|
- st::settingsInfoValuePosition.x()
|
|
|
|
- st::settingsInfoRightSkip);
|
|
|
|
text->moveToLeft(
|
|
|
|
st::settingsInfoValuePosition.x(),
|
|
|
|
st::settingsInfoValuePosition.y(),
|
|
|
|
width);
|
|
|
|
about->resizeToWidth(width
|
|
|
|
- st::settingsInfoAboutPosition.x()
|
|
|
|
- st::settingsInfoRightSkip);
|
|
|
|
about->moveToLeft(
|
|
|
|
st::settingsInfoAboutPosition.x(),
|
|
|
|
st::settingsInfoAboutPosition.y(),
|
|
|
|
width);
|
|
|
|
button->moveToRight(
|
2018-09-13 20:09:26 +00:00
|
|
|
st::settingsInfoEditRight,
|
|
|
|
(size.height() - button->height()) / 2,
|
2018-09-09 17:38:08 +00:00
|
|
|
width);
|
|
|
|
}, wrap->lifetime());
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetupRows(
|
|
|
|
not_null<Ui::VerticalLayout*> container,
|
2021-06-13 07:37:52 +00:00
|
|
|
not_null<Window::SessionController*> controller,
|
2018-09-09 17:38:08 +00:00
|
|
|
not_null<UserData*> self) {
|
2019-08-06 16:40:08 +00:00
|
|
|
const auto session = &self->session();
|
|
|
|
|
2018-09-09 17:38:08 +00:00
|
|
|
AddSkip(container);
|
|
|
|
|
|
|
|
AddRow(
|
|
|
|
container,
|
2019-06-18 12:16:43 +00:00
|
|
|
tr::lng_settings_name_label(),
|
2018-09-09 17:38:08 +00:00
|
|
|
Info::Profile::NameValue(self),
|
2019-06-18 12:16:43 +00:00
|
|
|
tr::lng_profile_copy_fullname(tr::now),
|
2021-06-13 07:37:52 +00:00
|
|
|
[=] { controller->show(Box<EditNameBox>(self)); },
|
2018-09-10 12:18:39 +00:00
|
|
|
st::settingsInfoName);
|
2018-09-09 17:38:08 +00:00
|
|
|
|
|
|
|
AddRow(
|
|
|
|
container,
|
2019-06-18 12:16:43 +00:00
|
|
|
tr::lng_settings_phone_label(),
|
2018-09-09 17:38:08 +00:00
|
|
|
Info::Profile::PhoneValue(self),
|
2019-06-18 12:16:43 +00:00
|
|
|
tr::lng_profile_copy_phone(tr::now),
|
2021-06-13 07:37:52 +00:00
|
|
|
[=] { controller->show(Box<ChangePhoneBox>(session)); },
|
2018-09-10 12:18:39 +00:00
|
|
|
st::settingsInfoPhone);
|
2018-09-09 17:38:08 +00:00
|
|
|
|
|
|
|
auto username = Info::Profile::UsernameValue(self);
|
|
|
|
auto empty = base::duplicate(
|
|
|
|
username
|
|
|
|
) | rpl::map([](const TextWithEntities &username) {
|
|
|
|
return username.text.isEmpty();
|
|
|
|
});
|
|
|
|
auto label = rpl::combine(
|
2019-06-18 12:16:43 +00:00
|
|
|
tr::lng_settings_username_label(),
|
2018-09-09 17:38:08 +00:00
|
|
|
std::move(empty)
|
|
|
|
) | rpl::map([](const QString &label, bool empty) {
|
|
|
|
return empty ? "t.me/username" : label;
|
|
|
|
});
|
|
|
|
auto value = rpl::combine(
|
|
|
|
std::move(username),
|
2019-06-18 12:16:43 +00:00
|
|
|
tr::lng_settings_username_add()
|
2018-09-09 17:38:08 +00:00
|
|
|
) | rpl::map([](const TextWithEntities &username, const QString &add) {
|
|
|
|
if (!username.text.isEmpty()) {
|
|
|
|
return username;
|
|
|
|
}
|
|
|
|
auto result = TextWithEntities{ add };
|
2019-04-08 15:10:06 +00:00
|
|
|
result.entities.push_back({
|
|
|
|
EntityType::CustomUrl,
|
2018-09-09 17:38:08 +00:00
|
|
|
0,
|
|
|
|
add.size(),
|
2019-04-08 15:10:06 +00:00
|
|
|
"internal:edit_username" });
|
2018-09-09 17:38:08 +00:00
|
|
|
return result;
|
|
|
|
});
|
|
|
|
AddRow(
|
|
|
|
container,
|
|
|
|
std::move(label),
|
|
|
|
std::move(value),
|
2019-06-18 12:16:43 +00:00
|
|
|
tr::lng_context_copy_mention(tr::now),
|
2021-06-13 07:37:52 +00:00
|
|
|
[=] { controller->show(Box<UsernameBox>(session)); },
|
2018-09-10 12:18:39 +00:00
|
|
|
st::settingsInfoUsername);
|
2018-09-09 17:38:08 +00:00
|
|
|
|
2018-09-10 12:18:39 +00:00
|
|
|
AddSkip(container, st::settingsInfoAfterSkip);
|
2018-09-09 17:38:08 +00:00
|
|
|
}
|
|
|
|
|
2021-10-18 13:05:43 +00:00
|
|
|
void SetupBio(
|
2018-09-09 17:38:08 +00:00
|
|
|
not_null<Ui::VerticalLayout*> container,
|
|
|
|
not_null<UserData*> self) {
|
|
|
|
AddDivider(container);
|
|
|
|
AddSkip(container);
|
|
|
|
|
|
|
|
const auto bioStyle = [] {
|
2018-09-10 12:18:39 +00:00
|
|
|
auto result = st::settingsBio;
|
2021-10-18 13:05:43 +00:00
|
|
|
result.textMargins.setRight(st::boxTextFont->spacew
|
2018-09-10 12:18:39 +00:00
|
|
|
+ st::boxTextFont->width(QString::number(kMaxBioLength)));
|
2018-09-09 17:38:08 +00:00
|
|
|
return result;
|
|
|
|
};
|
|
|
|
const auto style = Ui::AttachAsChild(container, bioStyle());
|
|
|
|
const auto current = Ui::AttachAsChild(container, self->about());
|
2018-11-21 10:09:46 +00:00
|
|
|
const auto changed = Ui::CreateChild<rpl::event_stream<bool>>(
|
|
|
|
container.get());
|
2018-09-09 17:38:08 +00:00
|
|
|
const auto bio = container->add(
|
|
|
|
object_ptr<Ui::InputField>(
|
|
|
|
container,
|
|
|
|
*style,
|
|
|
|
Ui::InputField::Mode::MultiLine,
|
2019-06-18 14:07:45 +00:00
|
|
|
tr::lng_bio_placeholder(),
|
2018-09-09 17:38:08 +00:00
|
|
|
*current),
|
|
|
|
st::settingsBioMargins);
|
|
|
|
|
|
|
|
const auto countdown = Ui::CreateChild<Ui::FlatLabel>(
|
|
|
|
container.get(),
|
|
|
|
QString(),
|
|
|
|
st::settingsBioCountdown);
|
|
|
|
|
|
|
|
rpl::combine(
|
|
|
|
bio->geometryValue(),
|
|
|
|
countdown->widthValue()
|
|
|
|
) | rpl::start_with_next([=](QRect geometry, int width) {
|
|
|
|
countdown->move(
|
|
|
|
geometry.x() + geometry.width() - width,
|
|
|
|
geometry.y() + style->textMargins.top());
|
|
|
|
}, countdown->lifetime());
|
|
|
|
|
2018-09-11 12:50:40 +00:00
|
|
|
const auto assign = [=](QString text) {
|
|
|
|
auto position = bio->textCursor().position();
|
|
|
|
bio->setText(text.replace('\n', ' '));
|
|
|
|
auto cursor = bio->textCursor();
|
|
|
|
cursor.setPosition(position);
|
|
|
|
bio->setTextCursor(cursor);
|
|
|
|
};
|
2018-09-09 17:38:08 +00:00
|
|
|
const auto updated = [=] {
|
|
|
|
auto text = bio->getLastText();
|
|
|
|
if (text.indexOf('\n') >= 0) {
|
2018-09-11 12:50:40 +00:00
|
|
|
assign(text);
|
|
|
|
text = bio->getLastText();
|
2018-09-09 17:38:08 +00:00
|
|
|
}
|
|
|
|
changed->fire(*current != text);
|
|
|
|
const auto countLeft = qMax(kMaxBioLength - text.size(), 0);
|
|
|
|
countdown->setText(QString::number(countLeft));
|
|
|
|
};
|
2021-10-18 13:05:43 +00:00
|
|
|
const auto save = [=] {
|
2019-07-24 14:00:30 +00:00
|
|
|
self->session().api().saveSelfBio(
|
2021-10-18 13:05:43 +00:00
|
|
|
TextUtilities::PrepareForSending(bio->getLastText()));
|
2018-09-09 17:38:08 +00:00
|
|
|
};
|
|
|
|
|
2020-10-29 16:53:07 +00:00
|
|
|
Info::Profile::AboutValue(
|
2018-09-09 17:38:08 +00:00
|
|
|
self
|
|
|
|
) | rpl::start_with_next([=](const TextWithEntities &text) {
|
2018-09-11 12:50:40 +00:00
|
|
|
const auto wasChanged = (*current != bio->getLastText());
|
2018-09-09 17:38:08 +00:00
|
|
|
*current = text.text;
|
2018-09-11 12:50:40 +00:00
|
|
|
if (wasChanged) {
|
|
|
|
changed->fire(*current != bio->getLastText());
|
|
|
|
} else {
|
|
|
|
assign(text.text);
|
|
|
|
*current = bio->getLastText();
|
|
|
|
}
|
2018-09-09 17:38:08 +00:00
|
|
|
}, bio->lifetime());
|
|
|
|
|
2018-11-21 10:09:46 +00:00
|
|
|
const auto generation = Ui::CreateChild<int>(bio);
|
2018-09-18 16:32:07 +00:00
|
|
|
changed->events(
|
|
|
|
) | rpl::start_with_next([=](bool changed) {
|
|
|
|
if (changed) {
|
|
|
|
const auto saved = *generation = std::abs(*generation) + 1;
|
2019-09-26 10:55:35 +00:00
|
|
|
base::call_delayed(kSaveBioTimeout, bio, [=] {
|
2018-09-18 16:32:07 +00:00
|
|
|
if (*generation == saved) {
|
2021-10-18 13:05:43 +00:00
|
|
|
save();
|
2018-09-18 16:32:07 +00:00
|
|
|
*generation = 0;
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} else if (*generation > 0) {
|
|
|
|
*generation = -*generation;
|
|
|
|
}
|
|
|
|
}, bio->lifetime());
|
|
|
|
|
|
|
|
// We need 'bio' to still exist here as InputField, so we add this
|
|
|
|
// to 'container' lifetime, not to the 'bio' lifetime.
|
|
|
|
container->lifetime().add([=] {
|
|
|
|
if (*generation > 0) {
|
2021-10-18 13:05:43 +00:00
|
|
|
save();
|
2018-09-18 16:32:07 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2018-09-09 17:38:08 +00:00
|
|
|
bio->setMaxLength(kMaxBioLength);
|
|
|
|
bio->setSubmitSettings(Ui::InputField::SubmitSettings::Both);
|
|
|
|
auto cursor = bio->textCursor();
|
|
|
|
cursor.setPosition(bio->getLastText().size());
|
|
|
|
bio->setTextCursor(cursor);
|
|
|
|
QObject::connect(bio, &Ui::InputField::submitted, [=] {
|
2021-10-18 13:05:43 +00:00
|
|
|
save();
|
2018-09-09 17:38:08 +00:00
|
|
|
});
|
|
|
|
QObject::connect(bio, &Ui::InputField::changed, updated);
|
|
|
|
bio->setInstantReplaces(Ui::InstantReplaces::Default());
|
2019-08-02 10:40:35 +00:00
|
|
|
bio->setInstantReplacesEnabled(
|
2020-06-18 18:04:16 +00:00
|
|
|
Core::App().settings().replaceEmojiValue());
|
2019-08-02 10:40:35 +00:00
|
|
|
Ui::Emoji::SuggestionsController::Init(
|
|
|
|
container->window(),
|
|
|
|
bio,
|
|
|
|
&self->session());
|
2018-09-09 17:38:08 +00:00
|
|
|
updated();
|
|
|
|
|
2018-09-13 20:09:26 +00:00
|
|
|
container->add(
|
|
|
|
object_ptr<Ui::FlatLabel>(
|
|
|
|
container,
|
2019-06-18 12:16:43 +00:00
|
|
|
tr::lng_settings_about_bio(),
|
2018-09-13 20:09:26 +00:00
|
|
|
st::boxDividerLabel),
|
|
|
|
st::settingsBioLabelPadding);
|
|
|
|
|
2018-09-09 17:38:08 +00:00
|
|
|
AddSkip(container);
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace
|
2018-09-05 19:05:49 +00:00
|
|
|
|
2018-09-13 20:09:26 +00:00
|
|
|
Information::Information(
|
|
|
|
QWidget *parent,
|
2019-07-24 14:00:30 +00:00
|
|
|
not_null<Window::SessionController*> controller)
|
|
|
|
: Section(parent) {
|
2018-09-13 20:09:26 +00:00
|
|
|
setupContent(controller);
|
2018-09-05 19:05:49 +00:00
|
|
|
}
|
|
|
|
|
2019-07-24 14:00:30 +00:00
|
|
|
void Information::setupContent(
|
|
|
|
not_null<Window::SessionController*> controller) {
|
2018-09-05 19:05:49 +00:00
|
|
|
const auto content = Ui::CreateChild<Ui::VerticalLayout>(this);
|
|
|
|
|
2019-07-24 14:00:30 +00:00
|
|
|
const auto self = controller->session().user();
|
|
|
|
SetupPhoto(content, controller, self);
|
2021-06-13 07:37:52 +00:00
|
|
|
SetupRows(content, controller, self);
|
2019-07-24 14:00:30 +00:00
|
|
|
SetupBio(content, self);
|
2018-09-05 19:05:49 +00:00
|
|
|
|
|
|
|
Ui::ResizeFitChild(this, content);
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace Settings
|