mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-20 23:27:23 +00:00
Added HistoryVisibilityBox.
This commit is contained in:
parent
0f3ec47074
commit
d06337dddc
@ -806,6 +806,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
"lng_manage_peer_group_type" = "Group type";
|
||||
"lng_manage_private_group_title" = "Private";
|
||||
"lng_manage_public_group_title" = "Public";
|
||||
|
||||
"lng_manage_history_visibility_title" = "Chat history for new members";
|
||||
"lng_manage_history_visibility_shown" = "Visible";
|
||||
|
@ -0,0 +1,130 @@
|
||||
/*
|
||||
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 "boxes/peers/edit_peer_history_visibility_box.h"
|
||||
|
||||
#include "boxes/peers/edit_peer_permissions_box.h"
|
||||
#include "boxes/peers/edit_participants_box.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_chat.h"
|
||||
#include "data/data_peer.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_info.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "ui/widgets/labels.h"
|
||||
#include "ui/wrap/padding_wrap.h"
|
||||
#include "ui/wrap/slide_wrap.h"
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
|
||||
namespace {
|
||||
|
||||
std::shared_ptr<Ui::RadioenumGroup<HistoryVisibility>> historyVisibility;
|
||||
Ui::SlideWrap<Ui::RpWidget> *historyVisibilityWrap = nullptr;
|
||||
|
||||
void AddRoundButton(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
HistoryVisibility value,
|
||||
LangKey groupTextKey,
|
||||
LangKey groupAboutKey) {
|
||||
container->add(object_ptr<Ui::FixedHeightWidget>(
|
||||
container,
|
||||
st::editPeerHistoryVisibilityTopSkip));
|
||||
container->add(object_ptr<Ui::Radioenum<HistoryVisibility>>(
|
||||
container,
|
||||
historyVisibility,
|
||||
value,
|
||||
lang(groupTextKey),
|
||||
st::defaultBoxCheckbox));
|
||||
container->add(object_ptr<Ui::PaddingWrap<Ui::FlatLabel>>(
|
||||
container,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
container,
|
||||
Lang::Viewer(groupAboutKey),
|
||||
st::editPeerPrivacyLabel),
|
||||
st::editPeerPrivacyLabelMargins));
|
||||
};
|
||||
|
||||
void FillContent(
|
||||
not_null<Ui::VerticalLayout*> parent,
|
||||
not_null<PeerData*> peer,
|
||||
std::optional<HistoryVisibility> savedValue = std::nullopt) {
|
||||
|
||||
const auto canEdit = [&] {
|
||||
if (const auto chat = peer->asChat()) {
|
||||
return chat->canEditPreHistoryHidden();
|
||||
} else if (const auto channel = peer->asChannel()) {
|
||||
return channel->canEditPreHistoryHidden();
|
||||
}
|
||||
Unexpected("User in HistoryVisibilityEdit.");
|
||||
}();
|
||||
if (!canEdit) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto channel = peer->asChannel();
|
||||
|
||||
const auto result = parent->add(object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
|
||||
parent,
|
||||
object_ptr<Ui::VerticalLayout>(parent),
|
||||
st::editPeerHistoryVisibilityMargins));
|
||||
historyVisibilityWrap = result;
|
||||
const auto container = result->entity();
|
||||
|
||||
const auto defaultValue = savedValue.value_or(
|
||||
(!channel || channel->hiddenPreHistory())
|
||||
? HistoryVisibility::Hidden
|
||||
: HistoryVisibility::Visible
|
||||
);
|
||||
|
||||
historyVisibility = std::make_shared<Ui::RadioenumGroup<HistoryVisibility>>(defaultValue);
|
||||
|
||||
AddRoundButton(
|
||||
container,
|
||||
HistoryVisibility::Visible,
|
||||
lng_manage_history_visibility_shown,
|
||||
lng_manage_history_visibility_shown_about);
|
||||
AddRoundButton(
|
||||
container,
|
||||
HistoryVisibility::Hidden,
|
||||
lng_manage_history_visibility_hidden,
|
||||
(peer->isChat()
|
||||
? lng_manage_history_visibility_hidden_legacy
|
||||
: lng_manage_history_visibility_hidden_about));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
EditPeerHistoryVisibilityBox::EditPeerHistoryVisibilityBox(
|
||||
QWidget*,
|
||||
not_null<PeerData*> peer,
|
||||
FnMut<void(HistoryVisibility)> savedCallback,
|
||||
std::optional<HistoryVisibility> historyVisibilitySavedValue)
|
||||
: _peer(peer)
|
||||
, _savedCallback(std::move(savedCallback))
|
||||
, _historyVisibilitySavedValue(historyVisibilitySavedValue) {
|
||||
}
|
||||
|
||||
void EditPeerHistoryVisibilityBox::prepare() {
|
||||
_peer->updateFull();
|
||||
|
||||
setTitle(langFactory(lng_manage_history_visibility_title));
|
||||
addButton(langFactory(lng_settings_save), [=] {
|
||||
auto local = std::move(_savedCallback);
|
||||
local(historyVisibility->value());
|
||||
closeBox();
|
||||
});
|
||||
addButton(langFactory(lng_cancel), [=] { closeBox(); });
|
||||
|
||||
setupContent();
|
||||
}
|
||||
|
||||
void EditPeerHistoryVisibilityBox::setupContent() {
|
||||
const auto content = Ui::CreateChild<Ui::VerticalLayout>(this);
|
||||
FillContent(content, _peer, _historyVisibilitySavedValue);
|
||||
setDimensionsToContent(st::boxWidth, content);
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
/*
|
||||
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"
|
||||
|
||||
namespace style {
|
||||
struct InfoProfileCountButton;
|
||||
} // namespace style
|
||||
|
||||
namespace Ui {
|
||||
class VerticalLayout;
|
||||
} // namespace Ui
|
||||
|
||||
namespace Info {
|
||||
namespace Profile {
|
||||
class Button;
|
||||
} // namespace Profile
|
||||
} // namespace Info
|
||||
|
||||
enum class HistoryVisibility {
|
||||
Visible,
|
||||
Hidden,
|
||||
};
|
||||
|
||||
class EditPeerHistoryVisibilityBox : public BoxContent {
|
||||
public:
|
||||
|
||||
EditPeerHistoryVisibilityBox(
|
||||
QWidget*,
|
||||
not_null<PeerData*> peer,
|
||||
FnMut<void(HistoryVisibility)> savedCallback,
|
||||
std::optional<HistoryVisibility> historyVisibilitySavedValue = std::nullopt);
|
||||
|
||||
protected:
|
||||
void prepare() override;
|
||||
|
||||
private:
|
||||
void setupContent();
|
||||
|
||||
not_null<PeerData*> _peer;
|
||||
FnMut<void(HistoryVisibility)> _savedCallback;
|
||||
|
||||
std::optional<HistoryVisibility> _historyVisibilitySavedValue;
|
||||
|
||||
};
|
@ -7,63 +7,42 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "boxes/peers/edit_peer_info_box.h"
|
||||
|
||||
#include <rpl/range.h>
|
||||
#include <rpl/flatten_latest.h>
|
||||
#include "info/profile/info_profile_button.h"
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
#include "ui/wrap/padding_wrap.h"
|
||||
#include "ui/wrap/slide_wrap.h"
|
||||
#include "ui/widgets/input_fields.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "ui/widgets/labels.h"
|
||||
#include "ui/toast/toast.h"
|
||||
#include "ui/special_buttons.h"
|
||||
#include "boxes/confirm_box.h"
|
||||
#include "boxes/photo_crop_box.h"
|
||||
#include "boxes/add_contact_box.h"
|
||||
#include "boxes/stickers_box.h"
|
||||
#include "boxes/peer_list_controllers.h"
|
||||
#include "boxes/peers/edit_participants_box.h"
|
||||
#include "data/data_peer.h"
|
||||
#include "data/data_chat.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "chat_helpers/emoji_suggestions_widget.h"
|
||||
#include "mtproto/sender.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "mainwidget.h"
|
||||
#include "core/application.h"
|
||||
#include "apiwrap.h"
|
||||
#include "auth_session.h"
|
||||
#include "boxes/add_contact_box.h"
|
||||
#include "boxes/confirm_box.h"
|
||||
#include "boxes/peer_list_controllers.h"
|
||||
#include "boxes/peers/edit_participants_box.h"
|
||||
#include "boxes/peers/edit_peer_group_type_box.h"
|
||||
#include "boxes/peers/edit_peer_history_visibility_box.h"
|
||||
#include "boxes/peers/edit_peer_permissions_box.h"
|
||||
#include "boxes/stickers_box.h"
|
||||
#include "chat_helpers/emoji_suggestions_widget.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_chat.h"
|
||||
#include "data/data_peer.h"
|
||||
#include "history/admin_log/history_admin_log_section.h"
|
||||
#include "info/profile/info_profile_button.h"
|
||||
#include "info/profile/info_profile_values.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "mainwidget.h"
|
||||
#include "mainwindow.h"
|
||||
#include "mtproto/sender.h"
|
||||
#include "observer_peer.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_info.h"
|
||||
|
||||
#include "ui/rp_widget.h"
|
||||
#include "boxes/peers/edit_peer_permissions_box.h"
|
||||
|
||||
#include "info/profile/info_profile_button.h"
|
||||
#include "info/profile/info_profile_icon.h"
|
||||
#include "info/profile/info_profile_values.h"
|
||||
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include "boxes/peers/edit_peer_info_box.h"
|
||||
#include "boxes/peers/edit_peer_permissions_box.h"
|
||||
#include "boxes/peers/edit_participants_box.h"
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
#include "ui/special_buttons.h"
|
||||
#include "ui/toast/toast.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "ui/widgets/input_fields.h"
|
||||
#include "ui/widgets/labels.h"
|
||||
#include "history/admin_log/history_admin_log_section.h"
|
||||
#include "ui/wrap/padding_wrap.h"
|
||||
#include "ui/wrap/slide_wrap.h"
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
#include "window/window_controller.h"
|
||||
#include "info/profile/info_profile_button.h"
|
||||
#include "info/profile/info_profile_icon.h"
|
||||
#include "info/profile/info_profile_values.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_chat.h"
|
||||
#include "mainwindow.h"
|
||||
#include "auth_session.h"
|
||||
#include "apiwrap.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_info.h"
|
||||
#include <rpl/flatten_latest.h>
|
||||
#include <rpl/range.h>
|
||||
|
||||
namespace {
|
||||
|
||||
@ -116,6 +95,20 @@ void AddButtonWithCount(
|
||||
&icon);
|
||||
}
|
||||
|
||||
void AddButtonWithText(
|
||||
not_null<Ui::VerticalLayout*> parent,
|
||||
rpl::producer<QString> &&text,
|
||||
rpl::producer<QString> &&label,
|
||||
Fn<void()> callback) {
|
||||
ManagePeerBox::CreateButton(
|
||||
parent,
|
||||
std::move(text),
|
||||
std::move(label),
|
||||
std::move(callback),
|
||||
st::manageGroupTopButtonWithText,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
bool HasRecentActions(not_null<ChannelData*> channel) {
|
||||
return channel->hasAdminRights() || channel->amCreator();
|
||||
}
|
||||
@ -292,10 +285,6 @@ private:
|
||||
Public,
|
||||
Private,
|
||||
};
|
||||
enum class HistoryVisibility {
|
||||
Visible,
|
||||
Hidden,
|
||||
};
|
||||
enum class UsernameState {
|
||||
Normal,
|
||||
TooMany,
|
||||
@ -317,10 +306,10 @@ private:
|
||||
Ui::SlideWrap<Ui::RpWidget> *editInviteLinkWrap = nullptr;
|
||||
Ui::FlatLabel *inviteLink = nullptr;
|
||||
|
||||
std::shared_ptr<Ui::RadioenumGroup<HistoryVisibility>> historyVisibility;
|
||||
Ui::SlideWrap<Ui::RpWidget> *historyVisibilityWrap = nullptr;
|
||||
|
||||
Ui::Checkbox *signatures = nullptr;
|
||||
|
||||
std::optional<HistoryVisibility> historyVisibilitySavedValue = std::nullopt;
|
||||
Ui::SlideWrap<Ui::RpWidget> *historyVisibilityWrap = nullptr;
|
||||
};
|
||||
struct Saving {
|
||||
std::optional<QString> username;
|
||||
@ -339,7 +328,6 @@ private:
|
||||
object_ptr<Ui::RpWidget> createUsernameEdit();
|
||||
object_ptr<Ui::RpWidget> createInviteLinkCreate();
|
||||
object_ptr<Ui::RpWidget> createInviteLinkEdit();
|
||||
object_ptr<Ui::RpWidget> createHistoryVisibilityEdit();
|
||||
object_ptr<Ui::RpWidget> createSignaturesEdit();
|
||||
object_ptr<Ui::RpWidget> createStickersEdit();
|
||||
object_ptr<Ui::RpWidget> createDeleteButton();
|
||||
@ -471,14 +459,12 @@ object_ptr<Ui::VerticalLayout> Controller::createContent() {
|
||||
addSkip(_wrap); // Divider.
|
||||
_wrap->add(createPrivaciesButtons());
|
||||
addSkip(_wrap); // Divider.
|
||||
|
||||
_wrap->add(createManageGroupButtons());
|
||||
addSkip(_wrap); // Divider.
|
||||
|
||||
_wrap->add(createPrivaciesEdit());
|
||||
_wrap->add(createInviteLinkCreate());
|
||||
_wrap->add(createInviteLinkEdit());
|
||||
_wrap->add(createHistoryVisibilityEdit());
|
||||
_wrap->add(createSignaturesEdit());
|
||||
_wrap->add(createStickersEdit());
|
||||
_wrap->add(createDeleteButton());
|
||||
@ -696,61 +682,62 @@ object_ptr<Ui::RpWidget> Controller::createPrivaciesButtons() {
|
||||
if (!canEditUsername) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const auto channel = _peer->asChannel();
|
||||
auto defaultValue = (!channel || channel->hiddenPreHistory())
|
||||
? HistoryVisibility::Hidden
|
||||
: HistoryVisibility::Visible;
|
||||
|
||||
const auto update = std::make_shared<rpl::event_stream<HistoryVisibility>>();
|
||||
|
||||
auto result = object_ptr<Ui::PaddingWrap<Ui::VerticalLayout>>(
|
||||
_wrap,
|
||||
object_ptr<Ui::VerticalLayout>(_wrap),
|
||||
st::editHehMargins);
|
||||
auto container = result->entity();
|
||||
st::editPeerTopButtonsLayoutMargins);
|
||||
auto resultContainer = result->entity();
|
||||
AddButtonWithText(
|
||||
resultContainer,
|
||||
std::move(Lang::Viewer(lng_manage_peer_group_type)),
|
||||
update->events(
|
||||
) | rpl::map([](HistoryVisibility count) {
|
||||
return HistoryVisibility::Visible == count ? QString("A") : QString("B");
|
||||
}),
|
||||
[] {LOG(("BUTTON")); });
|
||||
|
||||
const auto addPrivaciesButton = [=, &container](LangKey privacyTextKey) {
|
||||
const auto button = container->add(object_ptr<Info::Profile::Button>(
|
||||
const auto addPrivaciesButton = [=](LangKey privacyTextKey, Ui::VerticalLayout* container) {
|
||||
const auto boxCallback = [=](HistoryVisibility checked) {
|
||||
update->fire(std::move(checked));
|
||||
_controls.historyVisibilitySavedValue = checked;
|
||||
};
|
||||
const auto buttonCallback = [=]{
|
||||
Ui::show(Box<EditPeerHistoryVisibilityBox>(
|
||||
_peer,
|
||||
boxCallback,
|
||||
_controls.historyVisibilitySavedValue
|
||||
), LayerOption::KeepOther);
|
||||
};
|
||||
AddButtonWithText(
|
||||
container,
|
||||
std::move(Lang::Viewer(privacyTextKey)),
|
||||
st::heeehButton
|
||||
));
|
||||
update->events(
|
||||
) | rpl::map([](HistoryVisibility flag) {
|
||||
return lang(HistoryVisibility::Visible == flag
|
||||
? lng_manage_history_visibility_shown
|
||||
: lng_manage_history_visibility_hidden);
|
||||
}),
|
||||
buttonCallback);
|
||||
};
|
||||
|
||||
addPrivaciesButton(lng_manage_peer_group_type);
|
||||
addPrivaciesButton(lng_manage_history_visibility_title);
|
||||
auto wrapLayout = resultContainer->add(object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
|
||||
resultContainer,
|
||||
object_ptr<Ui::VerticalLayout>(resultContainer),
|
||||
st::boxOptionListPadding)); // Empty margins.
|
||||
_controls.historyVisibilityWrap = wrapLayout;
|
||||
|
||||
// style::InfoProfileCountButton a = st::heehPermissionsButton;
|
||||
// const auto name = Ui::CreateChild<Ui::FlatLabel>(
|
||||
// button,
|
||||
// std::move(rpl::single(QString("Heh"))),
|
||||
// a.label);
|
||||
// rpl::combine(
|
||||
// button->widthValue(),
|
||||
// std::move(rpl::single(QString("Heh"))),
|
||||
// std::move(rpl::single(QString("Heh")))
|
||||
// ) | rpl::start_with_next([=, &a](
|
||||
// int width,
|
||||
// const QString &button,
|
||||
// const QString &text) {
|
||||
// /*const auto available = width
|
||||
// - a.padding.left()
|
||||
// - a.padding.right()
|
||||
// - a.font->width(button)
|
||||
// - st::hehButtonRightSkip;
|
||||
// name->setText(text);
|
||||
// name->resizeToNaturalWidth(available);
|
||||
// name->moveToRight(st::hehButtonRightSkip, st.padding.top());*/
|
||||
// }, name->lifetime());
|
||||
// name->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
addPrivaciesButton(lng_manage_history_visibility_title, wrapLayout->entity());
|
||||
|
||||
|
||||
// style::InfoProfileCountButton a = st::managePeerButton;
|
||||
// const auto label = Ui::CreateChild<Ui::FlatLabel>(
|
||||
// button,
|
||||
// std::move(rpl::single(QString("5"))),
|
||||
// a.label);
|
||||
// label->setAttribute(Qt::WA_TransparentForMouseEvents);
|
||||
// rpl::combine(
|
||||
// button->widthValue(),
|
||||
// label->widthValue()
|
||||
// ) | rpl::start_with_next([=, &a](int outerWidth, int width) {
|
||||
// LOG(("POSITION: %1 %2").arg(a.labelPosition.x()).arg(a.labelPosition.y()));
|
||||
// label->moveToRight(0, 0);
|
||||
// }, label->lifetime());
|
||||
update->fire(std::move(defaultValue));
|
||||
refreshHistoryVisibility();
|
||||
|
||||
return std::move(result);
|
||||
}
|
||||
@ -761,7 +748,7 @@ object_ptr<Ui::RpWidget> Controller::createManageGroupButtons() {
|
||||
auto result = object_ptr<Ui::PaddingWrap<Ui::VerticalLayout>>(
|
||||
_wrap,
|
||||
object_ptr<Ui::VerticalLayout>(_wrap),
|
||||
st::editHehMargins);
|
||||
st::editPeerBottomButtonsLayoutMargins);
|
||||
auto container = result->entity();
|
||||
|
||||
if (const auto chat = _peer->asChat()) {
|
||||
@ -1172,76 +1159,6 @@ void Controller::refreshCreateInviteLink() {
|
||||
anim::type::instant);
|
||||
}
|
||||
|
||||
object_ptr<Ui::RpWidget> Controller::createHistoryVisibilityEdit() {
|
||||
Expects(_wrap != nullptr);
|
||||
|
||||
const auto canEdit = [&] {
|
||||
if (const auto chat = _peer->asChat()) {
|
||||
return chat->canEditPreHistoryHidden();
|
||||
} else if (const auto channel = _peer->asChannel()) {
|
||||
return channel->canEditPreHistoryHidden();
|
||||
}
|
||||
Unexpected("User in Controller::createHistoryVisibilityEdit.");
|
||||
}();
|
||||
if (!canEdit) {
|
||||
return nullptr;
|
||||
}
|
||||
const auto channel = _peer->asChannel();
|
||||
|
||||
auto result = object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
|
||||
_wrap,
|
||||
object_ptr<Ui::VerticalLayout>(_wrap),
|
||||
st::editPeerInvitesMargins);
|
||||
_controls.historyVisibilityWrap = result.data();
|
||||
auto container = result->entity();
|
||||
|
||||
_controls.historyVisibility
|
||||
= std::make_shared<Ui::RadioenumGroup<HistoryVisibility>>(
|
||||
(!channel || channel->hiddenPreHistory())
|
||||
? HistoryVisibility::Hidden
|
||||
: HistoryVisibility::Visible);
|
||||
auto addButton = [&](
|
||||
HistoryVisibility value,
|
||||
LangKey groupTextKey,
|
||||
LangKey groupAboutKey) {
|
||||
container->add(object_ptr<Ui::FixedHeightWidget>(
|
||||
container,
|
||||
st::editPeerPrivacyTopSkip + st::editPeerPrivacyBottomSkip));
|
||||
container->add(object_ptr<Ui::Radioenum<HistoryVisibility>>(
|
||||
container,
|
||||
_controls.historyVisibility,
|
||||
value,
|
||||
lang(groupTextKey),
|
||||
st::defaultBoxCheckbox));
|
||||
container->add(object_ptr<Ui::PaddingWrap<Ui::FlatLabel>>(
|
||||
container,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
container,
|
||||
Lang::Viewer(groupAboutKey),
|
||||
st::editPeerPrivacyLabel),
|
||||
st::editPeerPrivacyLabelMargins));
|
||||
};
|
||||
|
||||
container->add(object_ptr<Ui::FlatLabel>(
|
||||
container,
|
||||
Lang::Viewer(lng_manage_history_visibility_title),
|
||||
st::editPeerSectionLabel));
|
||||
addButton(
|
||||
HistoryVisibility::Visible,
|
||||
lng_manage_history_visibility_shown,
|
||||
lng_manage_history_visibility_shown_about);
|
||||
addButton(
|
||||
HistoryVisibility::Hidden,
|
||||
lng_manage_history_visibility_hidden,
|
||||
(_peer->isChat()
|
||||
? lng_manage_history_visibility_hidden_legacy
|
||||
: lng_manage_history_visibility_hidden_about));
|
||||
|
||||
refreshHistoryVisibility();
|
||||
|
||||
return std::move(result);
|
||||
}
|
||||
|
||||
void Controller::refreshHistoryVisibility() {
|
||||
if (!_controls.historyVisibilityWrap) {
|
||||
return;
|
||||
@ -1250,7 +1167,7 @@ void Controller::refreshHistoryVisibility() {
|
||||
|| (_controls.privacy->value() == Privacy::Private);
|
||||
_controls.historyVisibilityWrap->toggle(
|
||||
historyVisibilityShown,
|
||||
anim::type::instant);
|
||||
anim::type::normal);
|
||||
}
|
||||
|
||||
object_ptr<Ui::RpWidget> Controller::createSignaturesEdit() {
|
||||
@ -1422,12 +1339,12 @@ bool Controller::validateDescription(Saving &to) const {
|
||||
}
|
||||
|
||||
bool Controller::validateHistoryVisibility(Saving &to) const {
|
||||
if (!_controls.historyVisibility
|
||||
if (!_controls.historyVisibilityWrap->toggled()
|
||||
|| (_controls.privacy && _controls.privacy->value() == Privacy::Public)) {
|
||||
return true;
|
||||
}
|
||||
to.hiddenPreHistory
|
||||
= (_controls.historyVisibility->value() == HistoryVisibility::Hidden);
|
||||
= (_controls.historyVisibilitySavedValue == HistoryVisibility::Hidden);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -359,8 +359,8 @@ infoIconMediaLink: icon {{ "info_media_link", infoIconFg }};
|
||||
infoIconMediaGroup: icon {{ "info_common_groups", infoIconFg }};
|
||||
infoIconMediaVoice: icon {{ "info_media_voice", infoIconFg }};
|
||||
infoIconMediaRound: icon {{ "info_media_round", infoIconFg }};
|
||||
infoIconRecentActions: icon {{ "info_recent_actions", infoIconFg }};
|
||||
infoIconAdministrators: icon {{ "info_administrators", infoIconFg }};
|
||||
infoIconRecentActions: icon {{ "info_recent_actions", infoIconFg, point(-2px, 0px) }};
|
||||
infoIconAdministrators: icon {{ "info_administrators", infoIconFg, point(-2px, -1px) }};
|
||||
infoIconBlacklist: icon {{ "info_blacklist", infoIconFg }};
|
||||
infoIconPermissions: icon {{ "info_permissions", infoIconFg }};
|
||||
infoInformationIconPosition: point(25px, 12px);
|
||||
@ -590,6 +590,7 @@ managePeerButton: InfoProfileCountButton {
|
||||
}
|
||||
labelPosition: point(25px, 12px);
|
||||
}
|
||||
|
||||
peerPermissionsButton: InfoProfileCountButton(managePeerButton) {
|
||||
button: InfoProfileButton(infoProfileButton) {
|
||||
padding: margins(24px, 12px, 24px, 10px);
|
||||
@ -600,22 +601,23 @@ peerPermissionsButton: InfoProfileCountButton(managePeerButton) {
|
||||
|
||||
manageGroupButton: InfoProfileCountButton(managePeerButton) {
|
||||
button: InfoProfileButton(infoProfileButton) {
|
||||
padding: margins(72px, 12px, 24px, 10px);
|
||||
padding: margins(72px, 10px, 24px, 8px);
|
||||
font: font(14px);
|
||||
}
|
||||
labelPosition: point(22px, 12px);
|
||||
iconPosition: point(20px, 5px);
|
||||
}
|
||||
|
||||
heeehButton: InfoProfileButton(infoProfileButton) {
|
||||
font: boxTextFont;
|
||||
padding: margins(23px, 10px, 22px, 11px);
|
||||
manageGroupTopButtonWithText: InfoProfileCountButton(manageGroupButton) {
|
||||
button: InfoProfileButton(infoProfileButton) {
|
||||
padding: margins(22px, 10px, 24px, 8px);
|
||||
font: font(14px);
|
||||
}
|
||||
labelPosition: point(22px, 11px);
|
||||
iconPosition: point(0px, 0px);
|
||||
}
|
||||
|
||||
hehButtonRightSkip: 28px;
|
||||
hehButtonRight: FlatLabel(defaultFlatLabel) {
|
||||
textFg: windowActiveTextFg;
|
||||
style: boxTextStyle;
|
||||
maxHeight: 20px;
|
||||
}
|
||||
editPeerHistoryVisibilityMargins: margins(15px, 0px, 20px, 16px);
|
||||
|
||||
terminateSessionsButton: InfoProfileButton(infoBlockButton) {
|
||||
padding: margins(23px, 12px, 23px, 10px);
|
||||
@ -636,7 +638,10 @@ infoEmptyLabel: FlatLabel(defaultFlatLabel) {
|
||||
textFg: windowSubTextFg;
|
||||
}
|
||||
|
||||
editHehMargins: margins(0px, 10px, 0px, 0px);
|
||||
editPeerBottomButtonsLayoutMargins: margins(0px, 11px, 0px, 7px);
|
||||
editPeerTopButtonsLayoutMargins: margins(0px, 12px, 0px, 6px);
|
||||
|
||||
editPeerHistoryVisibilityTopSkip: 8px;
|
||||
|
||||
editPeerDeleteButtonMargins: margins(23px, 16px, 23px, 16px);
|
||||
editPeerDeleteButton: sessionTerminateAllButton;
|
||||
@ -649,10 +654,10 @@ editPeerPrivaciesMargins: margins(23px, 10px, 23px, 0px);
|
||||
editPeerPrivacyTopSkip: 10px;
|
||||
editPeerPrivacyBottomSkip: 16px;
|
||||
editPeerPrivacyLabel: FlatLabel(defaultFlatLabel) {
|
||||
minWidth: 263px;
|
||||
minWidth: 220px;
|
||||
textFg: windowSubTextFg;
|
||||
}
|
||||
editPeerPrivacyLabelMargins: margins(34px, 0px, 0px, 0px);
|
||||
editPeerPrivacyLabelMargins: margins(34px, 0px, 48px, 0px);
|
||||
editPeerSectionLabel: FlatLabel(boxTitle) {
|
||||
style: TextStyle(defaultTextStyle) {
|
||||
font: font(15px semibold);
|
||||
|
@ -8,6 +8,8 @@
|
||||
<(src_loc)/boxes/peers/edit_peer_info_box.h
|
||||
<(src_loc)/boxes/peers/edit_peer_permissions_box.cpp
|
||||
<(src_loc)/boxes/peers/edit_peer_permissions_box.h
|
||||
<(src_loc)/boxes/peers/edit_peer_history_visibility_box.cpp
|
||||
<(src_loc)/boxes/peers/edit_peer_history_visibility_box.h
|
||||
<(src_loc)/boxes/peers/manage_peer_box.cpp
|
||||
<(src_loc)/boxes/peers/manage_peer_box.h
|
||||
<(src_loc)/boxes/about_box.cpp
|
||||
|
Loading…
Reference in New Issue
Block a user