Compare commits
22 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c37b08ac8b | ||
|
|
c52a5927e5 | ||
|
|
edcfac8da3 | ||
|
|
a994c9f017 | ||
|
|
66e6bf8217 | ||
|
|
4a4cc766c2 | ||
|
|
31cd841b75 | ||
|
|
1710890886 | ||
|
|
16f616c5e0 | ||
|
|
7600c9bb2f | ||
|
|
100a44daef | ||
|
|
54305fafde | ||
|
|
d172d3d7db | ||
|
|
cee593c423 | ||
|
|
43adbb1cb1 | ||
|
|
e96731be11 | ||
|
|
6ea062462f | ||
|
|
1bc8d6fb18 | ||
|
|
73d00a4caf | ||
|
|
a23561c380 | ||
|
|
bb75a6a31b | ||
|
|
ce79c1f0c4 |
@@ -188,8 +188,6 @@ PRIVATE
|
||||
boxes/peers/edit_peer_invite_link.h
|
||||
boxes/peers/edit_peer_invite_links.cpp
|
||||
boxes/peers/edit_peer_invite_links.h
|
||||
boxes/peers/edit_peer_history_visibility_box.cpp
|
||||
boxes/peers/edit_peer_history_visibility_box.h
|
||||
boxes/peers/edit_peer_permissions_box.cpp
|
||||
boxes/peers/edit_peer_permissions_box.h
|
||||
boxes/peers/edit_peer_reactions.cpp
|
||||
|
||||
BIN
Telegram/Resources/icons/info/edit/channel_manage_signature.png
Normal file
|
After Width: | Height: | Size: 503 B |
|
After Width: | Height: | Size: 901 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 477 B After Width: | Height: | Size: 432 B |
|
Before Width: | Height: | Size: 768 B After Width: | Height: | Size: 757 B |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 957 B After Width: | Height: | Size: 515 B |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 989 B |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 648 B After Width: | Height: | Size: 583 B |
|
Before Width: | Height: | Size: 1.2 KiB After Width: | Height: | Size: 1023 B |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 734 B |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 989 B After Width: | Height: | Size: 509 B |
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 891 B |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 1.3 KiB |
BIN
Telegram/Resources/icons/info/edit/group_manage_type.png
Normal file
|
After Width: | Height: | Size: 494 B |
BIN
Telegram/Resources/icons/info/edit/group_manage_type@2x.png
Normal file
|
After Width: | Height: | Size: 925 B |
BIN
Telegram/Resources/icons/info/edit/group_manage_type@3x.png
Normal file
|
After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 650 B |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
@@ -1976,7 +1976,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_try_other_contact" = "Try someone else";
|
||||
"lng_create_group_link" = "Link";
|
||||
"lng_create_group_invite_link" = "Invite link";
|
||||
"lng_create_group_description" = "Description (optional)";
|
||||
"lng_create_group_description" = "Add description...";
|
||||
|
||||
"lng_drag_images_here" = "Drop images here";
|
||||
"lng_drag_photos_here" = "Drop photos here";
|
||||
@@ -2661,7 +2661,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
"lng_admin_log_pinned_message" = "{from} pinned this message:";
|
||||
"lng_admin_log_unpinned_message" = "{from} unpinned this message";
|
||||
"lng_admin_log_edited_caption" = "{from} edited caption:";
|
||||
"lng_admin_log_removed_caption" = "{from} removed caption";
|
||||
"lng_admin_log_edited_media" = "{from} edited media:";
|
||||
"lng_admin_log_edited_media_and_caption" = "{from} edited media and caption:";
|
||||
"lng_admin_log_edited_media_and_removed_caption" = "{from} edited media and removed caption:";
|
||||
"lng_admin_log_removed_caption" = "{from} removed caption:";
|
||||
"lng_admin_log_previous_caption" = "Original caption";
|
||||
"lng_admin_log_edited_message" = "{from} edited this message:";
|
||||
"lng_admin_log_previous_message" = "Original message";
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<Identity Name="TelegramMessengerLLP.TelegramDesktop"
|
||||
ProcessorArchitecture="ARCHITECTURE"
|
||||
Publisher="CN=536BC709-8EE1-4478-AF22-F0F0F26FF64A"
|
||||
Version="3.7.1.0" />
|
||||
Version="3.7.2.0" />
|
||||
<Properties>
|
||||
<DisplayName>Telegram Desktop</DisplayName>
|
||||
<PublisherDisplayName>Telegram Messenger LLP</PublisherDisplayName>
|
||||
|
||||
@@ -44,8 +44,8 @@ IDI_ICON1 ICON "..\\art\\icon256.ico"
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 3,7,1,0
|
||||
PRODUCTVERSION 3,7,1,0
|
||||
FILEVERSION 3,7,2,0
|
||||
PRODUCTVERSION 3,7,2,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@@ -62,10 +62,10 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Telegram FZ-LLC"
|
||||
VALUE "FileDescription", "Telegram Desktop"
|
||||
VALUE "FileVersion", "3.7.1.0"
|
||||
VALUE "FileVersion", "3.7.2.0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2014-2022"
|
||||
VALUE "ProductName", "Telegram Desktop"
|
||||
VALUE "ProductVersion", "3.7.1.0"
|
||||
VALUE "ProductVersion", "3.7.2.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
@@ -35,8 +35,8 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 3,7,1,0
|
||||
PRODUCTVERSION 3,7,1,0
|
||||
FILEVERSION 3,7,2,0
|
||||
PRODUCTVERSION 3,7,2,0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@@ -53,10 +53,10 @@ BEGIN
|
||||
BEGIN
|
||||
VALUE "CompanyName", "Telegram FZ-LLC"
|
||||
VALUE "FileDescription", "Telegram Desktop Updater"
|
||||
VALUE "FileVersion", "3.7.1.0"
|
||||
VALUE "FileVersion", "3.7.2.0"
|
||||
VALUE "LegalCopyright", "Copyright (C) 2014-2022"
|
||||
VALUE "ProductName", "Telegram Desktop"
|
||||
VALUE "ProductVersion", "3.7.1.0"
|
||||
VALUE "ProductVersion", "3.7.2.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
|
||||
@@ -510,7 +510,8 @@ not_null<Ui::SlideWrap<Ui::RpWidget>*> EditAdminBox::setupTransferButton(
|
||||
: tr::lng_rights_transfer_channel)(),
|
||||
rpl::single(QString()),
|
||||
[=] { transferOwnership(); },
|
||||
st::peerPermissionsButton));
|
||||
st::peerPermissionsButton,
|
||||
{}));
|
||||
|
||||
return wrap;
|
||||
}
|
||||
|
||||
@@ -7,125 +7,56 @@ 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 "ui/layers/generic_box.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"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_info.h"
|
||||
|
||||
namespace {
|
||||
void EditPeerHistoryVisibilityBox(
|
||||
not_null<Ui::GenericBox*> box,
|
||||
bool isLegacy,
|
||||
Fn<void(HistoryVisibility)> savedCallback,
|
||||
HistoryVisibility historyVisibilitySavedValue) {
|
||||
const auto historyVisibility = std::make_shared<
|
||||
Ui::RadioenumGroup<HistoryVisibility>
|
||||
>(historyVisibilitySavedValue);
|
||||
|
||||
void AddRadioButton(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
HistoryVisibility value,
|
||||
const QString &groupText,
|
||||
rpl::producer<QString> groupAbout,
|
||||
std::shared_ptr<Ui::RadioenumGroup<HistoryVisibility>> historyVisibility) {
|
||||
container->add(object_ptr<Ui::FixedHeightWidget>(
|
||||
container,
|
||||
st::editPeerHistoryVisibilityTopSkip));
|
||||
container->add(object_ptr<Ui::Radioenum<HistoryVisibility>>(
|
||||
container,
|
||||
box->setTitle(tr::lng_manage_history_visibility_title());
|
||||
box->addButton(tr::lng_settings_save(), [=] {
|
||||
savedCallback(historyVisibility->value());
|
||||
box->closeBox();
|
||||
});
|
||||
box->addButton(tr::lng_cancel(), [=] { box->closeBox(); });
|
||||
|
||||
box->addSkip(st::editPeerHistoryVisibilityTopSkip);
|
||||
box->addRow(object_ptr<Ui::Radioenum<HistoryVisibility>>(
|
||||
box,
|
||||
historyVisibility,
|
||||
value,
|
||||
groupText,
|
||||
st::defaultBoxCheckbox));
|
||||
container->add(object_ptr<Ui::PaddingWrap<Ui::FlatLabel>>(
|
||||
container,
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
container,
|
||||
std::move(groupAbout),
|
||||
st::editPeerPrivacyLabel),
|
||||
st::editPeerPreHistoryLabelMargins));
|
||||
}
|
||||
|
||||
void FillContent(
|
||||
not_null<Ui::VerticalLayout*> parent,
|
||||
not_null<PeerData*> peer,
|
||||
std::shared_ptr<Ui::RadioenumGroup<HistoryVisibility>> historyVisibility,
|
||||
HistoryVisibility savedValue) {
|
||||
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;
|
||||
}
|
||||
|
||||
historyVisibility->setValue(savedValue);
|
||||
|
||||
const auto result = parent->add(
|
||||
object_ptr<Ui::SlideWrap<Ui::VerticalLayout>>(
|
||||
parent,
|
||||
object_ptr<Ui::VerticalLayout>(parent),
|
||||
st::editPeerHistoryVisibilityMargins));
|
||||
const auto container = result->entity();
|
||||
|
||||
Assert(historyVisibility != nullptr);
|
||||
|
||||
AddRadioButton(
|
||||
container,
|
||||
HistoryVisibility::Visible,
|
||||
tr::lng_manage_history_visibility_shown(tr::now),
|
||||
tr::lng_manage_history_visibility_shown_about(),
|
||||
historyVisibility);
|
||||
AddRadioButton(
|
||||
container,
|
||||
st::defaultBoxCheckbox));
|
||||
box->addRow(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
box,
|
||||
tr::lng_manage_history_visibility_shown_about(),
|
||||
st::editPeerPrivacyLabel),
|
||||
st::editPeerPreHistoryLabelMargins + st::boxRowPadding);
|
||||
|
||||
box->addSkip(st::editPeerHistoryVisibilityTopSkip);
|
||||
box->addRow(object_ptr<Ui::Radioenum<HistoryVisibility>>(
|
||||
box,
|
||||
historyVisibility,
|
||||
HistoryVisibility::Hidden,
|
||||
tr::lng_manage_history_visibility_hidden(tr::now),
|
||||
(peer->isChat()
|
||||
? tr::lng_manage_history_visibility_hidden_legacy
|
||||
: tr::lng_manage_history_visibility_hidden_about)(),
|
||||
historyVisibility);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
EditPeerHistoryVisibilityBox::EditPeerHistoryVisibilityBox(
|
||||
QWidget*,
|
||||
not_null<PeerData*> peer,
|
||||
FnMut<void(HistoryVisibility)> savedCallback,
|
||||
HistoryVisibility historyVisibilitySavedValue)
|
||||
: _peer(peer)
|
||||
, _savedCallback(std::move(savedCallback))
|
||||
, _historyVisibilitySavedValue(historyVisibilitySavedValue)
|
||||
, _historyVisibility(
|
||||
std::make_shared<Ui::RadioenumGroup<HistoryVisibility>>(
|
||||
_historyVisibilitySavedValue)) {
|
||||
}
|
||||
|
||||
void EditPeerHistoryVisibilityBox::prepare() {
|
||||
_peer->updateFull();
|
||||
|
||||
setTitle(tr::lng_manage_history_visibility_title());
|
||||
addButton(tr::lng_settings_save(), [=] {
|
||||
auto local = std::move(_savedCallback);
|
||||
local(_historyVisibility->value());
|
||||
closeBox();
|
||||
});
|
||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||
|
||||
setupContent();
|
||||
}
|
||||
|
||||
void EditPeerHistoryVisibilityBox::setupContent() {
|
||||
const auto content = Ui::CreateChild<Ui::VerticalLayout>(this);
|
||||
FillContent(
|
||||
content,
|
||||
_peer,
|
||||
_historyVisibility,
|
||||
_historyVisibilitySavedValue);
|
||||
setDimensionsToContent(st::boxWidth, content);
|
||||
st::defaultBoxCheckbox));
|
||||
box->addRow(
|
||||
object_ptr<Ui::FlatLabel>(
|
||||
box,
|
||||
(isLegacy
|
||||
? tr::lng_manage_history_visibility_hidden_legacy
|
||||
: tr::lng_manage_history_visibility_hidden_about)(),
|
||||
st::editPeerPrivacyLabel),
|
||||
st::editPeerPreHistoryLabelMargins + st::boxRowPadding);
|
||||
}
|
||||
|
||||
@@ -7,32 +7,17 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "boxes/abstract_box.h"
|
||||
#include "ui/widgets/checkbox.h"
|
||||
namespace Ui {
|
||||
class GenericBox;
|
||||
} // namespace Ui
|
||||
|
||||
enum class HistoryVisibility {
|
||||
Visible,
|
||||
Hidden,
|
||||
};
|
||||
|
||||
class EditPeerHistoryVisibilityBox : public Ui::BoxContent {
|
||||
public:
|
||||
EditPeerHistoryVisibilityBox(
|
||||
QWidget*,
|
||||
not_null<PeerData*> peer,
|
||||
FnMut<void(HistoryVisibility)> savedCallback,
|
||||
HistoryVisibility historyVisibilitySavedValue);
|
||||
|
||||
protected:
|
||||
void prepare() override;
|
||||
|
||||
private:
|
||||
void setupContent();
|
||||
|
||||
not_null<PeerData*> _peer;
|
||||
FnMut<void(HistoryVisibility)> _savedCallback;
|
||||
|
||||
HistoryVisibility _historyVisibilitySavedValue;
|
||||
std::shared_ptr<Ui::RadioenumGroup<HistoryVisibility>> _historyVisibility;
|
||||
|
||||
};
|
||||
void EditPeerHistoryVisibilityBox(
|
||||
not_null<Ui::GenericBox*> box,
|
||||
bool isLegacy,
|
||||
Fn<void(HistoryVisibility)> savedCallback,
|
||||
HistoryVisibility historyVisibilitySavedValue);
|
||||
|
||||
@@ -37,9 +37,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "history/admin_log/history_admin_log_section.h"
|
||||
#include "info/profile/info_profile_values.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "mainwidget.h"
|
||||
#include "mainwindow.h"
|
||||
#include "mtproto/sender.h"
|
||||
#include "settings/settings_common.h"
|
||||
#include "ui/rp_widget.h"
|
||||
#include "ui/special_buttons.h"
|
||||
#include "ui/toast/toast.h"
|
||||
@@ -53,22 +52,22 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include "info/profile/info_profile_icon.h"
|
||||
#include "apiwrap.h"
|
||||
#include "api/api_invite_links.h"
|
||||
#include "facades.h"
|
||||
#include "facades.h" // Ui::showChatsList
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_info.h"
|
||||
#include "styles/style_settings.h"
|
||||
|
||||
namespace {
|
||||
|
||||
auto ToPositiveNumberString() {
|
||||
[[nodiscard]] auto ToPositiveNumberString() {
|
||||
return rpl::map([](int count) {
|
||||
return count ? QString::number(count) : QString();
|
||||
});
|
||||
}
|
||||
|
||||
auto ToPositiveNumberStringRestrictions() {
|
||||
[[nodiscard]] auto ToPositiveNumberStringRestrictions() {
|
||||
return rpl::map([](int count) {
|
||||
return QString::number(count)
|
||||
+ QString("/")
|
||||
@@ -94,40 +93,29 @@ void AddButtonWithCount(
|
||||
rpl::producer<QString> &&text,
|
||||
rpl::producer<QString> &&count,
|
||||
Fn<void()> callback,
|
||||
const style::icon &icon) {
|
||||
Settings::IconDescriptor &&descriptor) {
|
||||
parent->add(EditPeerInfoBox::CreateButton(
|
||||
parent,
|
||||
std::move(text),
|
||||
std::move(count),
|
||||
std::move(callback),
|
||||
st::manageGroupButton,
|
||||
&icon));
|
||||
std::move(descriptor)));
|
||||
}
|
||||
|
||||
object_ptr<Ui::SettingsButton> CreateButtonWithText(
|
||||
not_null<QWidget*> parent,
|
||||
not_null<Ui::SettingsButton*> AddButtonWithText(
|
||||
not_null<Ui::VerticalLayout*> parent,
|
||||
rpl::producer<QString> &&text,
|
||||
rpl::producer<QString> &&label,
|
||||
Fn<void()> callback) {
|
||||
return EditPeerInfoBox::CreateButton(
|
||||
Fn<void()> callback,
|
||||
Settings::IconDescriptor &&descriptor) {
|
||||
return parent->add(EditPeerInfoBox::CreateButton(
|
||||
parent,
|
||||
std::move(text),
|
||||
std::move(label),
|
||||
std::move(callback),
|
||||
st::manageGroupTopButtonWithText,
|
||||
nullptr);
|
||||
}
|
||||
|
||||
Ui::SettingsButton *AddButtonWithText(
|
||||
not_null<Ui::VerticalLayout*> parent,
|
||||
rpl::producer<QString> &&text,
|
||||
rpl::producer<QString> &&label,
|
||||
Fn<void()> callback) {
|
||||
return parent->add(CreateButtonWithText(
|
||||
parent,
|
||||
std::move(text),
|
||||
std::move(label),
|
||||
std::move(callback)));
|
||||
std::move(descriptor)));
|
||||
}
|
||||
|
||||
void AddButtonDelete(
|
||||
@@ -140,7 +128,7 @@ void AddButtonDelete(
|
||||
rpl::single(QString()),
|
||||
std::move(callback),
|
||||
st::manageDeleteGroupButton,
|
||||
nullptr));
|
||||
{}));
|
||||
}
|
||||
|
||||
void SaveDefaultRestrictions(
|
||||
@@ -262,7 +250,7 @@ public:
|
||||
not_null<Ui::BoxContent*> box,
|
||||
not_null<PeerData*> peer);
|
||||
|
||||
object_ptr<Ui::VerticalLayout> createContent();
|
||||
[[nodiscard]] object_ptr<Ui::VerticalLayout> createContent();
|
||||
void setFocus();
|
||||
|
||||
private:
|
||||
@@ -284,12 +272,12 @@ private:
|
||||
std::optional<ChannelData*> linkedChat;
|
||||
};
|
||||
|
||||
object_ptr<Ui::RpWidget> createPhotoAndTitleEdit();
|
||||
object_ptr<Ui::RpWidget> createTitleEdit();
|
||||
object_ptr<Ui::RpWidget> createPhotoEdit();
|
||||
object_ptr<Ui::RpWidget> createDescriptionEdit();
|
||||
object_ptr<Ui::RpWidget> createManageGroupButtons();
|
||||
object_ptr<Ui::RpWidget> createStickersEdit();
|
||||
[[nodiscard]] object_ptr<Ui::RpWidget> createPhotoAndTitleEdit();
|
||||
[[nodiscard]] object_ptr<Ui::RpWidget> createTitleEdit();
|
||||
[[nodiscard]] object_ptr<Ui::RpWidget> createPhotoEdit();
|
||||
[[nodiscard]] object_ptr<Ui::RpWidget> createDescriptionEdit();
|
||||
[[nodiscard]] object_ptr<Ui::RpWidget> createManageGroupButtons();
|
||||
[[nodiscard]] object_ptr<Ui::RpWidget> createStickersEdit();
|
||||
|
||||
[[nodiscard]] bool canEditInformation() const;
|
||||
[[nodiscard]] bool canEditReactions() const;
|
||||
@@ -310,14 +298,14 @@ private:
|
||||
void deleteWithConfirmation();
|
||||
void deleteChannel();
|
||||
|
||||
std::optional<Saving> validate() const;
|
||||
bool validateUsername(Saving &to) const;
|
||||
bool validateLinkedChat(Saving &to) const;
|
||||
bool validateTitle(Saving &to) const;
|
||||
bool validateDescription(Saving &to) const;
|
||||
bool validateHistoryVisibility(Saving &to) const;
|
||||
bool validateSignatures(Saving &to) const;
|
||||
bool validateForwards(Saving &to) const;
|
||||
[[nodiscard]] std::optional<Saving> validate() const;
|
||||
[[nodiscard]] bool validateUsername(Saving &to) const;
|
||||
[[nodiscard]] bool validateLinkedChat(Saving &to) const;
|
||||
[[nodiscard]] bool validateTitle(Saving &to) const;
|
||||
[[nodiscard]] bool validateDescription(Saving &to) const;
|
||||
[[nodiscard]] bool validateHistoryVisibility(Saving &to) const;
|
||||
[[nodiscard]] bool validateSignatures(Saving &to) const;
|
||||
[[nodiscard]] bool validateForwards(Saving &to) const;
|
||||
|
||||
void save();
|
||||
void saveUsername();
|
||||
@@ -522,7 +510,8 @@ object_ptr<Ui::RpWidget> Controller::createDescriptionEdit() {
|
||||
result->entity()->setInstantReplaces(Ui::InstantReplaces::Default());
|
||||
result->entity()->setInstantReplacesEnabled(
|
||||
Core::App().settings().replaceEmojiValue());
|
||||
result->entity()->setSubmitSettings(Core::App().settings().sendSubmitWay());
|
||||
result->entity()->setSubmitSettings(
|
||||
Core::App().settings().sendSubmitWay());
|
||||
Ui::Emoji::SuggestionsController::Init(
|
||||
_wrap->window(),
|
||||
result->entity(),
|
||||
@@ -739,7 +728,8 @@ void Controller::fillPrivacyTypeButton() {
|
||||
? tr::lng_manage_private_group_title
|
||||
: tr::lng_manage_private_peer_title)();
|
||||
}) | rpl::flatten_latest(),
|
||||
[=] { showEditPeerTypeBox(); });
|
||||
[=] { showEditPeerTypeBox(); },
|
||||
{ &st::infoIconGroupType, Settings::kIconLightBlue });
|
||||
|
||||
_privacyTypeUpdates.fire_copy(*_privacySavedValue);
|
||||
}
|
||||
@@ -781,7 +771,8 @@ void Controller::fillLinkedChatButton() {
|
||||
_controls.buttonsLayout,
|
||||
std::move(text),
|
||||
std::move(label),
|
||||
[=] { showEditLinkedChatBox(); });
|
||||
[=] { showEditLinkedChatBox(); },
|
||||
{ &st::settingsIconChat, Settings::kIconGreen });
|
||||
_linkedChatUpdates.fire_copy(*_linkedChatSavedValue);
|
||||
}
|
||||
//
|
||||
@@ -803,13 +794,16 @@ void Controller::fillSignaturesButton() {
|
||||
Expects(_controls.buttonsLayout != nullptr);
|
||||
|
||||
const auto channel = _peer->asChannel();
|
||||
if (!channel) return;
|
||||
if (!channel) {
|
||||
return;
|
||||
}
|
||||
|
||||
AddButtonWithText(
|
||||
_controls.buttonsLayout,
|
||||
tr::lng_edit_sign_messages(),
|
||||
rpl::single(QString()),
|
||||
[=] {}
|
||||
[] {},
|
||||
{ &st::infoIconSignature, Settings::kIconLightBlue }
|
||||
)->toggleOn(rpl::single(channel->addsSignature())
|
||||
)->toggledValue(
|
||||
) | rpl::start_with_next([=](bool toggled) {
|
||||
@@ -843,12 +837,23 @@ void Controller::fillHistoryVisibilityButton() {
|
||||
_historyVisibilitySavedValue = checked;
|
||||
});
|
||||
const auto buttonCallback = [=] {
|
||||
_navigation->parentController()->show(
|
||||
Box<EditPeerHistoryVisibilityBox>(
|
||||
_peer,
|
||||
boxCallback,
|
||||
*_historyVisibilitySavedValue),
|
||||
Ui::LayerOption::KeepOther);
|
||||
_peer->updateFull();
|
||||
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;
|
||||
}
|
||||
_navigation->parentController()->show(Box(
|
||||
EditPeerHistoryVisibilityBox,
|
||||
_peer->isChat(),
|
||||
boxCallback,
|
||||
*_historyVisibilitySavedValue));
|
||||
};
|
||||
AddButtonWithText(
|
||||
container,
|
||||
@@ -859,7 +864,8 @@ void Controller::fillHistoryVisibilityButton() {
|
||||
? tr::lng_manage_history_visibility_shown
|
||||
: tr::lng_manage_history_visibility_hidden)();
|
||||
}) | rpl::flatten_latest(),
|
||||
buttonCallback);
|
||||
buttonCallback,
|
||||
{ &st::settingsIconChat, Settings::kIconGreen });
|
||||
|
||||
updateHistoryVisibility->fire_copy(*_historyVisibilitySavedValue);
|
||||
|
||||
@@ -970,6 +976,40 @@ void Controller::fillManageSection() {
|
||||
st::editPeerTopButtonsLayoutSkipCustomBottom);
|
||||
}
|
||||
|
||||
if (canEditReactions()) {
|
||||
const auto session = &_peer->session();
|
||||
auto reactionsCount = Info::Profile::MigratedOrMeValue(
|
||||
_peer
|
||||
) | rpl::map(
|
||||
Info::Profile::AllowedReactionsCountValue
|
||||
) | rpl::flatten_latest();
|
||||
auto fullCount = Info::Profile::FullReactionsCountValue(session);
|
||||
auto label = rpl::combine(
|
||||
std::move(reactionsCount),
|
||||
std::move(fullCount)
|
||||
) | rpl::map([=](int allowed, int total) {
|
||||
return allowed
|
||||
? QString::number(allowed) + " / " + QString::number(total)
|
||||
: tr::lng_manage_peer_reactions_off(tr::now);
|
||||
});
|
||||
const auto done = [=](const std::vector<QString> &chosen) {
|
||||
SaveAllowedReactions(_peer, chosen);
|
||||
};
|
||||
AddButtonWithCount(
|
||||
_controls.buttonsLayout,
|
||||
tr::lng_manage_peer_reactions(),
|
||||
std::move(label),
|
||||
[=] {
|
||||
_navigation->parentController()->show(Box(
|
||||
EditAllowedReactionsBox,
|
||||
!_peer->isBroadcast(),
|
||||
session->data().reactions().list(
|
||||
Data::Reactions::Type::Active),
|
||||
*Data::PeerAllowedReactions(_peer),
|
||||
done));
|
||||
},
|
||||
{ &st::infoIconReactions, Settings::kIconRed });
|
||||
}
|
||||
if (canEditPermissions) {
|
||||
AddButtonWithCount(
|
||||
_controls.buttonsLayout,
|
||||
@@ -981,7 +1021,7 @@ void Controller::fillManageSection() {
|
||||
) | rpl::flatten_latest(
|
||||
) | ToPositiveNumberStringRestrictions(),
|
||||
[=] { ShowEditPermissions(_navigation, _peer); },
|
||||
st::infoIconPermissions);
|
||||
{ &st::settingsIconKey, Settings::kIconGreen });
|
||||
}
|
||||
if (canEditInviteLinks) {
|
||||
auto count = Info::Profile::MigratedOrMeValue(
|
||||
@@ -1017,7 +1057,7 @@ void Controller::fillManageSection() {
|
||||
0),
|
||||
Ui::LayerOption::KeepOther);
|
||||
},
|
||||
st::infoIconInviteLinks);
|
||||
{ &st::infoIconInviteLinks, Settings::kIconLightOrange });
|
||||
|
||||
if (_privacySavedValue) {
|
||||
_privacyTypeUpdates.events_starting_with_copy(
|
||||
@@ -1029,40 +1069,6 @@ void Controller::fillManageSection() {
|
||||
}, wrap->lifetime());
|
||||
}
|
||||
}
|
||||
if (canEditReactions()) {
|
||||
const auto session = &_peer->session();
|
||||
auto reactionsCount = Info::Profile::MigratedOrMeValue(
|
||||
_peer
|
||||
) | rpl::map(
|
||||
Info::Profile::AllowedReactionsCountValue
|
||||
) | rpl::flatten_latest();
|
||||
auto fullCount = Info::Profile::FullReactionsCountValue(session);
|
||||
auto label = rpl::combine(
|
||||
std::move(reactionsCount),
|
||||
std::move(fullCount)
|
||||
) | rpl::map([=](int allowed, int total) {
|
||||
return allowed
|
||||
? QString::number(allowed) + " / " + QString::number(total)
|
||||
: tr::lng_manage_peer_reactions_off(tr::now);
|
||||
});
|
||||
const auto done = [=](const std::vector<QString> &chosen) {
|
||||
SaveAllowedReactions(_peer, chosen);
|
||||
};
|
||||
AddButtonWithCount(
|
||||
_controls.buttonsLayout,
|
||||
tr::lng_manage_peer_reactions(),
|
||||
std::move(label),
|
||||
[=] {
|
||||
_navigation->parentController()->show(Box(
|
||||
EditAllowedReactionsBox,
|
||||
!_peer->isBroadcast(),
|
||||
session->data().reactions().list(
|
||||
Data::Reactions::Type::Active),
|
||||
*Data::PeerAllowedReactions(_peer),
|
||||
done));
|
||||
},
|
||||
st::infoIconReactions);
|
||||
}
|
||||
if (canViewAdmins) {
|
||||
AddButtonWithCount(
|
||||
_controls.buttonsLayout,
|
||||
@@ -1079,12 +1085,14 @@ void Controller::fillManageSection() {
|
||||
_peer,
|
||||
ParticipantsBoxController::Role::Admins);
|
||||
},
|
||||
st::infoIconAdministrators);
|
||||
{ &st::infoIconAdministrators, Settings::kIconLightBlue });
|
||||
}
|
||||
if (canViewMembers) {
|
||||
AddButtonWithCount(
|
||||
_controls.buttonsLayout,
|
||||
(_isGroup ? tr::lng_manage_peer_members() : tr::lng_manage_peer_subscribers()),
|
||||
(_isGroup
|
||||
? tr::lng_manage_peer_members()
|
||||
: tr::lng_manage_peer_subscribers()),
|
||||
Info::Profile::MigratedOrMeValue(
|
||||
_peer
|
||||
) | rpl::map(
|
||||
@@ -1097,7 +1105,7 @@ void Controller::fillManageSection() {
|
||||
_peer,
|
||||
ParticipantsBoxController::Role::Members);
|
||||
},
|
||||
st::infoIconMembers);
|
||||
{ &st::settingsIconGroup, Settings::kIconDarkBlue });
|
||||
}
|
||||
|
||||
fillPendingRequestsButton();
|
||||
@@ -1114,7 +1122,7 @@ void Controller::fillManageSection() {
|
||||
_peer,
|
||||
ParticipantsBoxController::Role::Kicked);
|
||||
},
|
||||
st::infoIconBlacklist);
|
||||
{ &st::settingsIconMinus, Settings::kIconRed });
|
||||
}
|
||||
if (hasRecentActions) {
|
||||
auto callback = [=] {
|
||||
@@ -1126,7 +1134,7 @@ void Controller::fillManageSection() {
|
||||
tr::lng_manage_peer_recent_actions(),
|
||||
rpl::single(QString()), //Empty count.
|
||||
std::move(callback),
|
||||
st::infoIconRecentActions);
|
||||
{ &st::infoIconRecentActions, Settings::kIconPurple });
|
||||
}
|
||||
|
||||
if (canEditStickers || canDeleteChannel) {
|
||||
@@ -1168,7 +1176,7 @@ void Controller::fillPendingRequestsButton() {
|
||||
: tr::lng_manage_peer_requests_channel()),
|
||||
rpl::duplicate(pendingRequestsCount) | ToPositiveNumberString(),
|
||||
[=] { RequestsBoxController::Start(_navigation, _peer); },
|
||||
st::infoIconRequests);
|
||||
{ &st::infoIconRequests, Settings::kIconRed });
|
||||
std::move(
|
||||
pendingRequestsCount
|
||||
) | rpl::start_with_next([=](int count) {
|
||||
@@ -1670,18 +1678,18 @@ object_ptr<Ui::SettingsButton> EditPeerInfoBox::CreateButton(
|
||||
rpl::producer<QString> &&count,
|
||||
Fn<void()> callback,
|
||||
const style::SettingsCountButton &st,
|
||||
const style::icon *icon) {
|
||||
Settings::IconDescriptor &&descriptor) {
|
||||
auto result = object_ptr<Ui::SettingsButton>(
|
||||
parent,
|
||||
rpl::duplicate(text),
|
||||
st.button);
|
||||
const auto button = result.data();
|
||||
button->addClickHandler(callback);
|
||||
if (icon) {
|
||||
Ui::CreateChild<Info::Profile::FloatingIcon>(
|
||||
if (descriptor) {
|
||||
AddButtonIcon(
|
||||
button,
|
||||
*icon,
|
||||
st.iconPosition);
|
||||
st.button,
|
||||
std::move(descriptor));
|
||||
}
|
||||
|
||||
auto labelText = rpl::combine(
|
||||
|
||||
@@ -7,8 +7,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <rpl/event_stream.h>
|
||||
#include "boxes/abstract_box.h"
|
||||
#include "ui/layers/box_content.h"
|
||||
|
||||
namespace Settings {
|
||||
struct IconDescriptor;
|
||||
} // namespace Settings
|
||||
|
||||
namespace style {
|
||||
struct SettingsCountButton;
|
||||
@@ -42,7 +45,7 @@ public:
|
||||
rpl::producer<QString> &&count,
|
||||
Fn<void()> callback,
|
||||
const style::SettingsCountButton &st,
|
||||
const style::icon *icon = nullptr);
|
||||
Settings::IconDescriptor &&descriptor);
|
||||
|
||||
protected:
|
||||
void prepare() override;
|
||||
|
||||
@@ -28,6 +28,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "main/main_session.h"
|
||||
#include "mainwindow.h"
|
||||
#include "apiwrap.h"
|
||||
#include "settings/settings_common.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
#include "styles/style_info.h"
|
||||
@@ -612,7 +613,8 @@ void EditPeerPermissionsBox::addSuggestGigagroup(
|
||||
AboutGigagroupCallback(
|
||||
_peer->asChannel(),
|
||||
_navigation->parentController()),
|
||||
st::peerPermissionsButton));
|
||||
st::peerPermissionsButton,
|
||||
{}));
|
||||
|
||||
container->add(
|
||||
object_ptr<Ui::DividerLabel>(
|
||||
@@ -645,7 +647,8 @@ void EditPeerPermissionsBox::addBannedButtons(
|
||||
_peer,
|
||||
ParticipantsBoxController::Role::Restricted);
|
||||
},
|
||||
st::peerPermissionsButton));
|
||||
st::peerPermissionsButton,
|
||||
{}));
|
||||
if (channel) {
|
||||
container->add(EditPeerInfoBox::CreateButton(
|
||||
container,
|
||||
@@ -658,7 +661,8 @@ void EditPeerPermissionsBox::addBannedButtons(
|
||||
_peer,
|
||||
ParticipantsBoxController::Role::Kicked);
|
||||
},
|
||||
st::peerPermissionsButton));
|
||||
st::peerPermissionsButton,
|
||||
{}));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,8 +7,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "boxes/peers/edit_peer_type_box.h"
|
||||
|
||||
#include "apiwrap.h"
|
||||
#include "api/api_invite_links.h"
|
||||
#include "main/main_session.h"
|
||||
#include "boxes/add_contact_box.h"
|
||||
#include "ui/boxes/confirm_box.h"
|
||||
@@ -19,7 +17,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "boxes/peers/edit_peer_invite_link.h"
|
||||
#include "boxes/peers/edit_peer_invite_links.h"
|
||||
#include "chat_helpers/emoji_suggestions_widget.h"
|
||||
#include "core/application.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_chat.h"
|
||||
#include "data/data_peer.h"
|
||||
@@ -27,7 +24,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "data/data_changes.h"
|
||||
#include "info/profile/info_profile_values.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "mainwindow.h"
|
||||
#include "mtproto/sender.h"
|
||||
#include "ui/rp_widget.h"
|
||||
#include "ui/special_buttons.h"
|
||||
@@ -35,7 +31,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "ui/widgets/input_fields.h"
|
||||
#include "ui/widgets/labels.h"
|
||||
#include "ui/widgets/popup_menu.h"
|
||||
#include "ui/widgets/box_content_divider.h"
|
||||
#include "ui/wrap/padding_wrap.h"
|
||||
#include "ui/wrap/slide_wrap.h"
|
||||
@@ -48,11 +43,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "styles/style_info.h"
|
||||
#include "styles/style_settings.h"
|
||||
|
||||
#include <QtGui/QGuiApplication>
|
||||
#include <QtGui/QClipboard>
|
||||
|
||||
#include <rpl/flatten_latest.h>
|
||||
|
||||
namespace {
|
||||
|
||||
class Controller : public base::has_weak_ptr {
|
||||
@@ -209,21 +199,22 @@ void Controller::createContent() {
|
||||
Ui::LayerOption::KeepOther);
|
||||
},
|
||||
st::manageGroupButton,
|
||||
&st::infoIconInviteLinks));
|
||||
{ &st::infoIconInviteLinks, Settings::kIconLightOrange }));
|
||||
AddSkip(_wrap.get());
|
||||
AddDividerText(_wrap.get(), tr::lng_group_invite_manage_about());
|
||||
|
||||
if (!_linkOnly) {
|
||||
AddSkip(_wrap.get());
|
||||
AddSubsectionTitle(_wrap.get(), tr::lng_manage_peer_no_forwards_title());
|
||||
AddSubsectionTitle(
|
||||
_wrap.get(),
|
||||
tr::lng_manage_peer_no_forwards_title());
|
||||
_controls.noForwards = _wrap->add(EditPeerInfoBox::CreateButton(
|
||||
_wrap.get(),
|
||||
tr::lng_manage_peer_no_forwards(),
|
||||
rpl::single(QString()),
|
||||
[=] {},
|
||||
st::manageGroupTopButtonWithText,
|
||||
nullptr
|
||||
));
|
||||
[] {},
|
||||
st::peerPermissionsButton,
|
||||
{}));
|
||||
_controls.noForwards->toggleOn(
|
||||
rpl::single(_noForwardsSavedValue.value_or(false))
|
||||
)->toggledValue(
|
||||
|
||||
@@ -7,8 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "boxes/abstract_box.h"
|
||||
#include "base/timer.h"
|
||||
#include "ui/layers/box_content.h"
|
||||
|
||||
namespace style {
|
||||
struct SettingsCountButton;
|
||||
|
||||
@@ -1065,6 +1065,7 @@ void GroupCall::start(TimeId scheduleDate, bool rtmp) {
|
||||
MTPstring(), // title
|
||||
MTP_int(scheduleDate)
|
||||
)).done([=](const MTPUpdates &result) {
|
||||
_reloadedStaleCall = true;
|
||||
_acceptFields = true;
|
||||
_peer->session().api().applyUpdates(result);
|
||||
_acceptFields = false;
|
||||
@@ -1393,6 +1394,13 @@ void GroupCall::rejoin(not_null<PeerData*> as) {
|
||||
sendSelfUpdate(SendUpdateType::CameraPaused);
|
||||
}
|
||||
sendPendingSelfUpdates();
|
||||
if (!_reloadedStaleCall
|
||||
&& _state.current() != State::Joining) {
|
||||
if (const auto real = lookupReal()) {
|
||||
_reloadedStaleCall = true;
|
||||
real->reloadIfStale();
|
||||
}
|
||||
}
|
||||
}).fail([=](const MTP::Error &error) {
|
||||
_joinState.finish();
|
||||
|
||||
|
||||
@@ -674,6 +674,7 @@ private:
|
||||
bool _hadJoinedState = false;
|
||||
bool _listenersHidden = false;
|
||||
bool _rtmp = false;
|
||||
bool _reloadedStaleCall = false;
|
||||
int _rtmpVolume = 0;
|
||||
|
||||
std::unique_ptr<Webrtc::MediaDevices> _mediaDevices;
|
||||
|
||||
@@ -22,7 +22,7 @@ constexpr auto AppId = "{53F49750-6209-4FBF-9CA8-7A333C87D1ED}"_cs;
|
||||
constexpr auto AppNameOld = "Telegram Win (Unofficial)"_cs;
|
||||
constexpr auto AppName = "Telegram Desktop"_cs;
|
||||
constexpr auto AppFile = "Telegram"_cs;
|
||||
constexpr auto AppVersion = 3007001;
|
||||
constexpr auto AppVersionStr = "3.7.1";
|
||||
constexpr auto AppVersion = 3007002;
|
||||
constexpr auto AppVersionStr = "3.7.2";
|
||||
constexpr auto AppBetaVersion = false;
|
||||
constexpr auto AppAlphaVersion = TDESKTOP_ALPHA_VERSION;
|
||||
|
||||
@@ -208,4 +208,8 @@ UpdatedFileReferences GetFileReferences(
|
||||
return GetFileReferencesHelper(data);
|
||||
}
|
||||
|
||||
UpdatedFileReferences GetFileReferences(const MTPMessageMedia &data) {
|
||||
return GetFileReferencesHelper(data);
|
||||
}
|
||||
|
||||
} // namespace Data
|
||||
|
||||
@@ -179,4 +179,7 @@ UpdatedFileReferences GetFileReferences(const MTPTheme &data);
|
||||
UpdatedFileReferences GetFileReferences(
|
||||
const MTPaccount_SavedRingtones &data);
|
||||
|
||||
// Admin Log Event.
|
||||
UpdatedFileReferences GetFileReferences(const MTPMessageMedia &data);
|
||||
|
||||
} // namespace Data
|
||||
|
||||
@@ -26,6 +26,7 @@ constexpr auto kRequestPerPage = 50;
|
||||
constexpr auto kSpeakingAfterActive = crl::time(6000);
|
||||
constexpr auto kActiveAfterJoined = crl::time(1000);
|
||||
constexpr auto kWaitForUpdatesTimeout = 3 * crl::time(1000);
|
||||
constexpr auto kReloadStaleTimeout = 16 * crl::time(1000);
|
||||
|
||||
[[nodiscard]] QString ExtractNextOffset(const MTPphone_GroupCall &call) {
|
||||
return call.match([&](const MTPDphone_groupCall &data) {
|
||||
@@ -168,6 +169,7 @@ bool GroupCall::processSavedFullCall() {
|
||||
return false;
|
||||
}
|
||||
_reloadRequestId = 0;
|
||||
_reloadLastFinished = crl::now();
|
||||
processFullCallFields(*base::take(_savedFull));
|
||||
return true;
|
||||
}
|
||||
@@ -497,6 +499,15 @@ void GroupCall::computeParticipantsCount() {
|
||||
: std::max(int(_participants.size()), _serverParticipantsCount);
|
||||
}
|
||||
|
||||
void GroupCall::reloadIfStale() {
|
||||
if (!fullCount() && !participantsLoaded()) {
|
||||
reload();
|
||||
} else if (!_reloadLastFinished
|
||||
|| crl::now() > _reloadLastFinished + kReloadStaleTimeout) {
|
||||
reload();
|
||||
}
|
||||
}
|
||||
|
||||
void GroupCall::reload() {
|
||||
if (_reloadRequestId || _applyingQueuedUpdates) {
|
||||
return;
|
||||
@@ -528,9 +539,11 @@ void GroupCall::reload() {
|
||||
return;
|
||||
}
|
||||
_reloadRequestId = 0;
|
||||
_reloadLastFinished = crl::now();
|
||||
processFullCall(result);
|
||||
}).fail([=] {
|
||||
_reloadRequestId = 0;
|
||||
_reloadLastFinished = crl::now();
|
||||
}).send();
|
||||
}
|
||||
|
||||
|
||||
@@ -156,6 +156,7 @@ public:
|
||||
|
||||
void setInCall();
|
||||
void reload();
|
||||
void reloadIfStale();
|
||||
void processFullCall(const MTPphone_GroupCall &call);
|
||||
|
||||
void setJoinMutedLocally(bool muted);
|
||||
@@ -206,6 +207,7 @@ private:
|
||||
int _version = 0;
|
||||
mtpRequestId _participantsRequestId = 0;
|
||||
mtpRequestId _reloadRequestId = 0;
|
||||
crl::time _reloadLastFinished = 0;
|
||||
rpl::variable<QString> _title;
|
||||
|
||||
base::flat_multi_map<
|
||||
|
||||
@@ -16,6 +16,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "api/api_chat_participants.h"
|
||||
#include "api/api_text_entities.h"
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_file_origin.h"
|
||||
#include "data/data_user.h"
|
||||
#include "data/data_session.h"
|
||||
#include "lang/lang_keys.h"
|
||||
@@ -136,6 +137,18 @@ bool MediaCanHaveCaption(const MTPMessage &message) {
|
||||
|| (mediaType == mtpc_messageMediaPhoto);
|
||||
}
|
||||
|
||||
uint64 MediaId(const MTPMessage &message) {
|
||||
if (!MediaCanHaveCaption(message)) {
|
||||
return 0;
|
||||
}
|
||||
const auto &media = message.c_message().vmedia();
|
||||
return media
|
||||
? v::match(
|
||||
Data::GetFileReferences(*media).data.begin()->first,
|
||||
[](const auto &d) { return d.id; })
|
||||
: 0;
|
||||
}
|
||||
|
||||
TextWithEntities ExtractEditedText(
|
||||
not_null<Main::Session*> session,
|
||||
const MTPMessage &message) {
|
||||
@@ -868,22 +881,36 @@ void GenerateItems(
|
||||
const auto newValue = ExtractEditedText(
|
||||
session,
|
||||
action.vnew_message());
|
||||
auto oldValue = ExtractEditedText(
|
||||
session,
|
||||
action.vprev_message());
|
||||
|
||||
const auto canHaveCaption = MediaCanHaveCaption(
|
||||
action.vnew_message());
|
||||
const auto changedCaption = (newValue != oldValue);
|
||||
const auto changedMedia = MediaId(action.vnew_message())
|
||||
!= MediaId(action.vprev_message());
|
||||
const auto removedCaption = !oldValue.text.isEmpty()
|
||||
&& newValue.text.isEmpty();
|
||||
const auto text = (!canHaveCaption
|
||||
? tr::lng_admin_log_edited_message
|
||||
: newValue.text.isEmpty()
|
||||
: (changedMedia && removedCaption)
|
||||
? tr::lng_admin_log_edited_media_and_removed_caption
|
||||
: (changedMedia && changedCaption)
|
||||
? tr::lng_admin_log_edited_media_and_caption
|
||||
: changedMedia
|
||||
? tr::lng_admin_log_edited_media
|
||||
: removedCaption
|
||||
? tr::lng_admin_log_removed_caption
|
||||
: tr::lng_admin_log_edited_caption)(
|
||||
: changedCaption
|
||||
? tr::lng_admin_log_edited_caption
|
||||
: tr::lng_admin_log_edited_message)(
|
||||
tr::now,
|
||||
lt_from,
|
||||
fromLinkText,
|
||||
Ui::Text::WithEntities);
|
||||
addSimpleServiceMessage(text);
|
||||
|
||||
auto oldValue = ExtractEditedText(
|
||||
session,
|
||||
action.vprev_message());
|
||||
const auto detachExistingItem = false;
|
||||
const auto body = history->createItem(
|
||||
history->nextNonHistoryEntryId(),
|
||||
|
||||
@@ -6388,25 +6388,28 @@ void HistoryWidget::checkPinnedBarState() {
|
||||
auto barContent = HistoryView::PinnedBarContent(
|
||||
&session(),
|
||||
_pinnedTracker->shownMessageId());
|
||||
_pinnedBar = std::make_unique<Ui::PinnedBar>(
|
||||
this,
|
||||
std::move(barContent));
|
||||
Info::Profile::SharedMediaCountValue(
|
||||
_peer,
|
||||
nullptr,
|
||||
Storage::SharedMediaType::Pinned
|
||||
) | rpl::distinct_until_changed(
|
||||
) | rpl::map([=](int count) {
|
||||
if (_pinnedClickedId) {
|
||||
_pinnedClickedId = FullMsgId();
|
||||
_minPinnedId = std::nullopt;
|
||||
updatePinnedViewer();
|
||||
}
|
||||
return (count > 1);
|
||||
}) | rpl::distinct_until_changed(
|
||||
) | rpl::start_with_next([=](bool many) {
|
||||
refreshPinnedBarButton(many);
|
||||
_pinnedBar = std::make_unique<Ui::PinnedBar>(this);
|
||||
rpl::combine(
|
||||
Info::Profile::SharedMediaCountValue(
|
||||
_peer,
|
||||
nullptr,
|
||||
Storage::SharedMediaType::Pinned
|
||||
) | rpl::distinct_until_changed(
|
||||
) | rpl::map([=](int count) {
|
||||
if (_pinnedClickedId) {
|
||||
_pinnedClickedId = FullMsgId();
|
||||
_minPinnedId = std::nullopt;
|
||||
updatePinnedViewer();
|
||||
}
|
||||
return (count > 1);
|
||||
}) | rpl::distinct_until_changed(),
|
||||
HistoryView::PinnedBarItemWithReplyMarkup(
|
||||
&session(),
|
||||
_pinnedTracker->shownMessageId())
|
||||
) | rpl::start_with_next([=](bool many, HistoryItem *item) {
|
||||
refreshPinnedBarButton(many, item);
|
||||
}, _pinnedBar->lifetime());
|
||||
_pinnedBar->setContent(std::move(barContent));
|
||||
|
||||
controller()->adaptive().oneColumnValue(
|
||||
) | rpl::start_with_next([=](bool one) {
|
||||
@@ -6493,7 +6496,30 @@ void HistoryWidget::setChooseReportMessagesDetails(
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryWidget::refreshPinnedBarButton(bool many) {
|
||||
void HistoryWidget::refreshPinnedBarButton(bool many, HistoryItem *item) {
|
||||
if (const auto replyMarkup = item ? item->inlineReplyMarkup() : nullptr) {
|
||||
const auto &rows = replyMarkup->data.rows;
|
||||
if ((rows.size() == 1) && (rows.front().size() == 1)) {
|
||||
const auto text = rows.front().front().text;
|
||||
if (!text.isEmpty()) {
|
||||
auto button = object_ptr<Ui::RoundButton>(
|
||||
this,
|
||||
rpl::single(text),
|
||||
st::historyPinnedBotButton);
|
||||
button->setTextTransform(
|
||||
Ui::RoundButton::TextTransform::NoTransform);
|
||||
button->setFullRadius(true);
|
||||
button->setClickedCallback([=] {
|
||||
App::activateBotCommand(controller(), item, 0, 0);
|
||||
});
|
||||
if (button->width() > st::historyPinnedBotButtonMaxWidth) {
|
||||
button->setFullWidth(st::historyPinnedBotButtonMaxWidth);
|
||||
}
|
||||
_pinnedBar->setRightButton(std::move(button));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
const auto close = !many;
|
||||
auto button = object_ptr<Ui::IconButton>(
|
||||
this,
|
||||
|
||||
@@ -512,7 +512,7 @@ private:
|
||||
void updatePinnedViewer();
|
||||
void setupPinnedTracker();
|
||||
void checkPinnedBarState();
|
||||
void refreshPinnedBarButton(bool many);
|
||||
void refreshPinnedBarButton(bool many, HistoryItem *item);
|
||||
void checkLastPinnedClickedIdReset(
|
||||
int wasScrollTop,
|
||||
int nowScrollTop);
|
||||
|
||||
@@ -364,9 +364,8 @@ rpl::producer<Ui::GroupCallBarContent> GroupCallBarContentByPeer(
|
||||
-> rpl::producer<Ui::GroupCallBarContent> {
|
||||
if (!call) {
|
||||
return rpl::single(Ui::GroupCallBarContent{ .shown = false });
|
||||
} else if (!call->fullCount() && !call->participantsLoaded()) {
|
||||
call->reload();
|
||||
}
|
||||
call->reloadIfStale();
|
||||
return GroupCallBarContentByCall(call, userpicSize);
|
||||
}) | rpl::flatten_latest();
|
||||
}
|
||||
|
||||
@@ -154,4 +154,56 @@ rpl::producer<Ui::MessageBarContent> PinnedBarContent(
|
||||
}) | rpl::flatten_latest();
|
||||
}
|
||||
|
||||
rpl::producer<HistoryItem*> PinnedBarItemWithReplyMarkup(
|
||||
not_null<Main::Session*> session,
|
||||
rpl::producer<PinnedId> id) {
|
||||
return rpl::make_producer<HistoryItem*>([=,
|
||||
id = std::move(id)](auto consumer) {
|
||||
auto lifetime = rpl::lifetime();
|
||||
consumer.put_next(nullptr);
|
||||
|
||||
struct State {
|
||||
HistoryMessageReplyMarkup *previousReplyMarkup = nullptr;
|
||||
rpl::lifetime lifetime;
|
||||
};
|
||||
const auto state = lifetime.make_state<State>();
|
||||
|
||||
const auto pushUnique = [=](not_null<HistoryItem*> item) {
|
||||
const auto replyMarkup = item->inlineReplyMarkup();
|
||||
if (state->previousReplyMarkup == replyMarkup) {
|
||||
return;
|
||||
}
|
||||
consumer.put_next(item.get());
|
||||
state->previousReplyMarkup = replyMarkup;
|
||||
};
|
||||
|
||||
rpl::duplicate(
|
||||
id
|
||||
) | rpl::start_with_next([=](PinnedId current) {
|
||||
const auto fullId = current.message;
|
||||
if (!fullId) {
|
||||
return;
|
||||
}
|
||||
const auto messageFlag = [=](not_null<HistoryItem*> item) {
|
||||
using Update = Data::MessageUpdate;
|
||||
session->changes().messageFlagsValue(
|
||||
item,
|
||||
Update::Flag::ReplyMarkup
|
||||
) | rpl::start_with_next([=](const Update &update) {
|
||||
pushUnique(update.item);
|
||||
}, state->lifetime);
|
||||
};
|
||||
if (const auto item = session->data().message(fullId)) {
|
||||
messageFlag(item);
|
||||
} else {
|
||||
session->api().requestMessageData(
|
||||
session->data().peer(fullId.peer),
|
||||
fullId.msg,
|
||||
[=] { messageFlag(session->data().message(fullId)); });
|
||||
}
|
||||
}, lifetime);
|
||||
return lifetime;
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace HistoryView
|
||||
|
||||
@@ -49,4 +49,8 @@ struct PinnedId {
|
||||
not_null<Main::Session*> session,
|
||||
rpl::producer<PinnedId> id);
|
||||
|
||||
[[nodiscard]] rpl::producer<HistoryItem*> PinnedBarItemWithReplyMarkup(
|
||||
not_null<Main::Session*> session,
|
||||
rpl::producer<PinnedId> id);
|
||||
|
||||
} // namespace HistoryView
|
||||
|
||||
@@ -388,7 +388,8 @@ void RepliesWidget::setupRootView() {
|
||||
) | rpl::map([=](Ui::MessageBarContent &&content, bool shown) {
|
||||
return shown ? std::move(content) : Ui::MessageBarContent();
|
||||
});
|
||||
_rootView = std::make_unique<Ui::PinnedBar>(this, std::move(content));
|
||||
_rootView = std::make_unique<Ui::PinnedBar>(this);
|
||||
_rootView->setContent(std::move(content));
|
||||
|
||||
controller()->adaptive().oneColumnValue(
|
||||
) | rpl::start_with_next([=](bool one) {
|
||||
|
||||
@@ -327,12 +327,12 @@ infoIconMediaLink: icon {{ "info/info_media_link", infoIconFg }};
|
||||
infoIconMediaGroup: icon {{ "info/info_common_groups", infoIconFg }};
|
||||
infoIconMediaVoice: icon {{ "info/info_media_voice", infoIconFg }};
|
||||
infoIconMediaRound: icon {{ "info/info_media_round", infoIconFg }};
|
||||
infoIconRecentActions: icon {{ "info/edit/group_manage_actions", infoIconFg }};
|
||||
infoIconAdministrators: icon {{ "info/edit/group_manage_admins", infoIconFg }};
|
||||
infoIconBlacklist: icon {{ "info/info_blacklist", infoIconFg }};
|
||||
infoIconPermissions: icon {{ "info/edit/group_manage_permissions", infoIconFg }};
|
||||
infoIconInviteLinks: icon {{ "info/edit/group_manage_links", infoIconFg }};
|
||||
infoIconReactions: icon {{ "info/edit/group_manage_reactions", infoIconFg }};
|
||||
infoIconRecentActions: icon {{ "info/edit/group_manage_actions", settingsIconFg }};
|
||||
infoIconAdministrators: icon {{ "info/edit/group_manage_admins", settingsIconFg }};
|
||||
infoIconInviteLinks: icon {{ "info/edit/group_manage_links", settingsIconFg }};
|
||||
infoIconReactions: icon {{ "info/edit/group_manage_reactions", settingsIconFg }};
|
||||
infoIconGroupType: icon {{ "info/edit/group_manage_type", settingsIconFg }};
|
||||
infoIconSignature: icon {{ "info/edit/channel_manage_signature", settingsIconFg }};
|
||||
infoIconShare: icon {{ "info/info_share", infoIconFg }};
|
||||
infoIconEdit: icon {{ "info/info_edit", infoIconFg }};
|
||||
infoIconDelete: icon {{ "info/info_delete", infoIconFg }};
|
||||
@@ -544,23 +544,20 @@ managePeerButton: SettingsCountButton {
|
||||
|
||||
peerPermissionsButton: SettingsCountButton(managePeerButton) {
|
||||
button: SettingsButton(infoProfileButton) {
|
||||
padding: margins(24px, 12px, 24px, 10px);
|
||||
padding: margins(22px, 12px, 24px, 10px);
|
||||
}
|
||||
iconPosition: point(24px, 5px);
|
||||
}
|
||||
|
||||
manageGroupButton: SettingsCountButton(managePeerButton) {
|
||||
button: SettingsButton(infoProfileButton) {
|
||||
padding: margins(72px, 10px, 24px, 8px);
|
||||
padding: margins(60px, 10px, 24px, 8px);
|
||||
}
|
||||
labelPosition: point(22px, 12px);
|
||||
iconPosition: point(20px, 4px);
|
||||
}
|
||||
|
||||
manageGroupTopButtonWithText: SettingsCountButton(manageGroupButton) {
|
||||
button: SettingsButton(infoProfileButton) {
|
||||
padding: margins(22px, 10px, 24px, 8px);
|
||||
}
|
||||
labelPosition: point(22px, 10px);
|
||||
iconPosition: point(0px, 0px);
|
||||
}
|
||||
@@ -607,7 +604,9 @@ editPeerHistoryVisibilityTopSkip: 8px;
|
||||
editPeerPhotoMargins: margins(22px, 16px, 22px, 8px);
|
||||
editPeerTitle: defaultInputField;
|
||||
editPeerTitleMargins: margins(27px, 21px, 22px, 8px);
|
||||
editPeerDescription: newGroupDescription;
|
||||
editPeerDescription: InputField(newGroupDescription) {
|
||||
borderFg: transparent;
|
||||
}
|
||||
editPeerDescriptionMargins: margins(22px, 5px, 22px, 16px);
|
||||
editPeerPrivaciesMargins: margins(15px, 7px, 22px, 0px);
|
||||
editPeerPrivacyTopSkip: 10px;
|
||||
|
||||
@@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "data/data_channel.h"
|
||||
#include "data/data_changes.h"
|
||||
#include "data/data_user.h"
|
||||
#include "data/notify/data_notify_settings.h"
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
#include "ui/wrap/padding_wrap.h"
|
||||
#include "ui/wrap/slide_wrap.h"
|
||||
@@ -377,9 +378,21 @@ object_ptr<Ui::RpWidget> DetailsFiller::setupMuteToggle() {
|
||||
tr::lng_profile_enable_notifications(),
|
||||
st::infoNotificationsButton);
|
||||
result->toggleOn(NotificationsEnabledValue(peer), true);
|
||||
result->setAcceptBoth();
|
||||
MuteMenu::SetupMuteMenu(
|
||||
result.data(),
|
||||
result->clicks() | rpl::to_empty,
|
||||
result->clicks(
|
||||
) | rpl::filter([=](Qt::MouseButton button) {
|
||||
if (button == Qt::RightButton) {
|
||||
return true;
|
||||
}
|
||||
if (peer->owner().notifySettings().isMuted(peer)) {
|
||||
peer->owner().notifySettings().update(peer, 0);
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}) | rpl::to_empty,
|
||||
{ peer, std::make_shared<Window::Show>(_controller) });
|
||||
object_ptr<FloatingIcon>(
|
||||
result,
|
||||
|
||||
@@ -180,14 +180,14 @@ void PickMuteBox(not_null<Ui::GenericBox*> box, not_null<PeerData*> peer) {
|
||||
(3600 * 4),
|
||||
(3600 * 8),
|
||||
(3600 * 12),
|
||||
(84600 * 1),
|
||||
(84600 * 2),
|
||||
(84600 * 3),
|
||||
(84600 * 7 * 1),
|
||||
(84600 * 7 * 2),
|
||||
(84600 * 31 * 1),
|
||||
(84600 * 31 * 2),
|
||||
(84600 * 31 * 3),
|
||||
(86400 * 1),
|
||||
(86400 * 2),
|
||||
(86400 * 3),
|
||||
(86400 * 7 * 1),
|
||||
(86400 * 7 * 2),
|
||||
(86400 * 31 * 1),
|
||||
(86400 * 31 * 2),
|
||||
(86400 * 31 * 3),
|
||||
};
|
||||
const auto phrases = ranges::views::all(
|
||||
seconds
|
||||
|
||||
@@ -679,8 +679,12 @@ void NotificationData::setImage(const QString &imagePath) {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto image = QImage(imagePath)
|
||||
.convertToFormat(QImage::Format_RGBA8888);
|
||||
const auto image = [&] {
|
||||
const auto original = QImage(imagePath);
|
||||
return original.hasAlphaChannel()
|
||||
? original.convertToFormat(QImage::Format_RGBA8888)
|
||||
: original.convertToFormat(QImage::Format_RGB888);
|
||||
}();
|
||||
|
||||
if (image.isNull()) {
|
||||
return;
|
||||
@@ -690,9 +694,9 @@ void NotificationData::setImage(const QString &imagePath) {
|
||||
image.width(),
|
||||
image.height(),
|
||||
int(image.bytesPerLine()),
|
||||
true,
|
||||
image.hasAlphaChannel(),
|
||||
8,
|
||||
4,
|
||||
image.hasAlphaChannel() ? 4 : 3,
|
||||
std::vector<uchar>(
|
||||
image.constBits(),
|
||||
image.constBits() + image.sizeInBytes()),
|
||||
|
||||
@@ -382,12 +382,6 @@ QString GetIconName() {
|
||||
std::optional<bool> IsDarkMode() {
|
||||
#ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
|
||||
[[maybe_unused]] static const auto Inited = [] {
|
||||
static const auto Setter = [] {
|
||||
crl::on_main([] {
|
||||
Core::App().settings().setSystemDarkMode(IsDarkMode());
|
||||
});
|
||||
};
|
||||
|
||||
using XDPSettingWatcher = base::Platform::XDP::SettingWatcher;
|
||||
static const XDPSettingWatcher Watcher(
|
||||
[=](
|
||||
@@ -396,7 +390,14 @@ std::optional<bool> IsDarkMode() {
|
||||
const Glib::VariantBase &value) {
|
||||
if (group == "org.freedesktop.appearance"
|
||||
&& key == "color-scheme") {
|
||||
Setter();
|
||||
try {
|
||||
const auto ivalue = base::Platform::GlibVariantCast<uint>(value);
|
||||
|
||||
crl::on_main([=] {
|
||||
Core::App().settings().setSystemDarkMode(ivalue == 1);
|
||||
});
|
||||
} catch (...) {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -410,10 +411,7 @@ std::optional<bool> IsDarkMode() {
|
||||
|
||||
if (result.has_value()) {
|
||||
const auto value = base::Platform::GlibVariantCast<uint>(*result);
|
||||
if (value == 1) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return value == 1;
|
||||
}
|
||||
} catch (...) {
|
||||
}
|
||||
|
||||
@@ -630,7 +630,7 @@ void MainWindow::showFromTrayMenu() {
|
||||
// It will receive input events, but it will be rendered as inactive.
|
||||
using namespace rpl::mappers;
|
||||
_showFromTrayLifetime = trayIconMenu->shownValue(
|
||||
) | rpl::filter(_1) | rpl::take(1) | rpl::start_with_next([=] {
|
||||
) | rpl::filter(!_1) | rpl::take(1) | rpl::start_with_next([=] {
|
||||
showFromTray();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -322,7 +322,9 @@ Panel::Panel(
|
||||
_widget->closeEvents(
|
||||
) | rpl::start_with_next(_close, _widget->lifetime());
|
||||
|
||||
style::PaletteChanged(
|
||||
rpl::combine(
|
||||
style::PaletteChanged(),
|
||||
_themeUpdateForced.events()
|
||||
) | rpl::filter([=] {
|
||||
return !_themeUpdateScheduled;
|
||||
}) | rpl::start_with_next([=] {
|
||||
@@ -564,6 +566,8 @@ bool Panel::createWebview() {
|
||||
sendDataMessage(list.at(1));
|
||||
} else if (command == "web_app_setup_main_button") {
|
||||
processMainButtonMessage(list.at(1));
|
||||
} else if (command == "web_app_request_theme") {
|
||||
_themeUpdateForced.fire({});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -88,6 +88,7 @@ private:
|
||||
QPointer<QWidget> _webviewParent;
|
||||
std::unique_ptr<Button> _mainButton;
|
||||
std::unique_ptr<Progress> _progress;
|
||||
rpl::event_stream<> _themeUpdateForced;
|
||||
rpl::lifetime _fgLifetime;
|
||||
rpl::lifetime _bgLifetime;
|
||||
bool _webviewProgress = false;
|
||||
|
||||
@@ -477,6 +477,13 @@ historyPinnedShowAll: IconButton(historyReplyCancel) {
|
||||
icon: icon {{ "pinned_show_all", historyReplyCancelFg }};
|
||||
iconOver: icon {{ "pinned_show_all", historyReplyCancelFgOver }};
|
||||
}
|
||||
historyPinnedBotButton: RoundButton(defaultActiveButton) {
|
||||
width: -34px;
|
||||
height: 30px;
|
||||
textTop: 6px;
|
||||
padding: margins(2px, 10px, 10px, 9px);
|
||||
}
|
||||
historyPinnedBotButtonMaxWidth: 150px;
|
||||
|
||||
msgBotKbDuration: 200;
|
||||
msgBotKbFont: semiboldFont;
|
||||
|
||||
@@ -222,7 +222,7 @@ QRect MessageBar::bodyRect(bool withImage) const {
|
||||
const auto top = st::msgReplyPadding.top();
|
||||
const auto width = _widget.width() - left - st::msgReplyPadding.right();
|
||||
const auto height = st::msgReplyBarSize.height();
|
||||
return QRect(left, top, width, height);
|
||||
return QRect(left, top, width, height) - _content.margins;
|
||||
}
|
||||
|
||||
QRect MessageBar::bodyRect() const {
|
||||
|
||||
@@ -24,6 +24,7 @@ struct MessageBarContent {
|
||||
QString title;
|
||||
TextWithEntities text;
|
||||
QImage preview;
|
||||
style::margins margins;
|
||||
};
|
||||
|
||||
class MessageBar final {
|
||||
|
||||
@@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/chat/message_bar.h"
|
||||
#include "ui/widgets/shadow.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/wrap/fade_wrap.h"
|
||||
#include "styles/style_chat.h"
|
||||
#include "styles/palette.h"
|
||||
|
||||
@@ -17,9 +18,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
namespace Ui {
|
||||
|
||||
PinnedBar::PinnedBar(
|
||||
not_null<QWidget*> parent,
|
||||
rpl::producer<MessageBarContent> content)
|
||||
PinnedBar::PinnedBar(not_null<QWidget*> parent)
|
||||
: _wrap(parent, object_ptr<RpWidget>(parent))
|
||||
, _shadow(std::make_unique<PlainShadow>(_wrap.parentWidget())) {
|
||||
_wrap.hide(anim::type::instant);
|
||||
@@ -30,10 +29,18 @@ PinnedBar::PinnedBar(
|
||||
QPainter(_wrap.entity()).fillRect(clip, st::historyPinnedBg);
|
||||
}, lifetime());
|
||||
_wrap.setAttribute(Qt::WA_OpaquePaintEvent);
|
||||
}
|
||||
|
||||
PinnedBar::~PinnedBar() {
|
||||
_right.button.destroy();
|
||||
}
|
||||
|
||||
void PinnedBar::setContent(rpl::producer<Ui::MessageBarContent> content) {
|
||||
_contentLifetime.destroy();
|
||||
|
||||
auto copy = std::move(
|
||||
content
|
||||
) | rpl::start_spawning(_wrap.lifetime());
|
||||
) | rpl::start_spawning(_contentLifetime);
|
||||
|
||||
rpl::duplicate(
|
||||
copy
|
||||
@@ -44,11 +51,17 @@ PinnedBar::PinnedBar(
|
||||
if (creating) {
|
||||
createControls();
|
||||
}
|
||||
|
||||
// In most cases the new right button should arrive
|
||||
// before we want to get its width.
|
||||
const auto right = _right.button ? _right.button->width() : 0;
|
||||
content.margins = { 0, 0, right, 0 };
|
||||
|
||||
_bar->set(std::move(content));
|
||||
if (creating) {
|
||||
_bar->finishAnimating();
|
||||
}
|
||||
}, lifetime());
|
||||
}, _contentLifetime);
|
||||
|
||||
std::move(
|
||||
copy
|
||||
@@ -64,19 +77,24 @@ PinnedBar::PinnedBar(
|
||||
}, [=] {
|
||||
_forceHidden = true;
|
||||
_wrap.toggle(false, anim::type::normal);
|
||||
}, lifetime());
|
||||
}
|
||||
|
||||
PinnedBar::~PinnedBar() {
|
||||
_rightButton.destroy();
|
||||
}, _contentLifetime);
|
||||
}
|
||||
|
||||
void PinnedBar::setRightButton(object_ptr<Ui::RpWidget> button) {
|
||||
_rightButton.destroy();
|
||||
_rightButton = std::move(button);
|
||||
if (_rightButton) {
|
||||
_rightButton->setParent(_wrap.entity());
|
||||
_rightButton->show();
|
||||
if (auto previous = _right.button.release()) {
|
||||
_right.previousButtonLifetime.make_state<RightButton>(
|
||||
RightButton::fromRaw(std::move(previous)));
|
||||
_right.previousButtonLifetime = previous->toggledValue(
|
||||
) | rpl::filter(!rpl::mappers::_1) | rpl::start_with_next([=] {
|
||||
_right.previousButtonLifetime.destroy();
|
||||
});
|
||||
previous->hide(anim::type::normal);
|
||||
}
|
||||
_right.button.create(_wrap.entity(), std::move(button));
|
||||
if (_right.button) {
|
||||
_right.button->setParent(_wrap.entity());
|
||||
_right.button->setDuration(st::defaultMessageBar.duration);
|
||||
_right.button->show(anim::type::normal);
|
||||
}
|
||||
if (_bar) {
|
||||
updateControlsGeometry(_wrap.geometry());
|
||||
@@ -84,14 +102,13 @@ void PinnedBar::setRightButton(object_ptr<Ui::RpWidget> button) {
|
||||
}
|
||||
|
||||
void PinnedBar::updateControlsGeometry(QRect wrapGeometry) {
|
||||
_bar->widget()->resizeToWidth(
|
||||
wrapGeometry.width() - (_rightButton ? _rightButton->width() : 0));
|
||||
_bar->widget()->resizeToWidth(wrapGeometry.width());
|
||||
const auto hidden = _wrap.isHidden() || !wrapGeometry.height();
|
||||
if (_shadow->isHidden() != hidden) {
|
||||
_shadow->setVisible(!hidden);
|
||||
}
|
||||
if (_rightButton) {
|
||||
_rightButton->moveToRight(0, 0);
|
||||
if (_right.button) {
|
||||
_right.button->moveToRight(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -117,8 +134,8 @@ void PinnedBar::createControls() {
|
||||
_bar = std::make_unique<MessageBar>(
|
||||
_wrap.entity(),
|
||||
st::defaultMessageBar);
|
||||
if (_rightButton) {
|
||||
_rightButton->raise();
|
||||
if (_right.button) {
|
||||
_right.button->raise();
|
||||
}
|
||||
|
||||
// Clicks.
|
||||
|
||||
@@ -13,6 +13,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
namespace Ui {
|
||||
|
||||
struct MessageBarContent;
|
||||
template <typename Widget>
|
||||
class FadeWrapScaled;
|
||||
class MessageBar;
|
||||
class IconButton;
|
||||
class PlainShadow;
|
||||
@@ -20,9 +22,7 @@ class RpWidget;
|
||||
|
||||
class PinnedBar final {
|
||||
public:
|
||||
PinnedBar(
|
||||
not_null<QWidget*> parent,
|
||||
rpl::producer<Ui::MessageBarContent> content);
|
||||
PinnedBar(not_null<QWidget*> parent);
|
||||
~PinnedBar();
|
||||
|
||||
void show();
|
||||
@@ -32,6 +32,7 @@ public:
|
||||
|
||||
void setShadowGeometryPostprocess(Fn<QRect(QRect)> postprocess);
|
||||
|
||||
void setContent(rpl::producer<Ui::MessageBarContent> content);
|
||||
void setRightButton(object_ptr<Ui::RpWidget> button);
|
||||
|
||||
void move(int x, int y);
|
||||
@@ -45,19 +46,27 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
using RightButton = object_ptr<Ui::FadeWrapScaled<Ui::RpWidget>>;
|
||||
void createControls();
|
||||
void updateShadowGeometry(QRect wrapGeometry);
|
||||
void updateControlsGeometry(QRect wrapGeometry);
|
||||
|
||||
Ui::SlideWrap<> _wrap;
|
||||
std::unique_ptr<Ui::MessageBar> _bar;
|
||||
object_ptr<Ui::RpWidget> _rightButton = { nullptr };
|
||||
|
||||
struct {
|
||||
RightButton button = { nullptr };
|
||||
rpl::lifetime previousButtonLifetime;
|
||||
} _right;
|
||||
|
||||
std::unique_ptr<Ui::PlainShadow> _shadow;
|
||||
rpl::event_stream<> _barClicks;
|
||||
Fn<QRect(QRect)> _shadowGeometryPostprocess;
|
||||
bool _shouldBeShown = false;
|
||||
bool _forceHidden = false;
|
||||
|
||||
rpl::lifetime _contentLifetime;
|
||||
|
||||
};
|
||||
|
||||
} // namespace Ui
|
||||
|
||||
@@ -7,15 +7,17 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "ui/widgets/multi_select.h"
|
||||
|
||||
#include "styles/style_widgets.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/widgets/input_fields.h"
|
||||
#include "ui/widgets/scroll_area.h"
|
||||
#include "ui/effects/animations.h"
|
||||
#include "ui/effects/cross_animation.h"
|
||||
#include "ui/text/text_options.h"
|
||||
#include "ui/ui_utility.h"
|
||||
#include "lang/lang_keys.h"
|
||||
|
||||
#include <set>
|
||||
|
||||
namespace Ui {
|
||||
namespace {
|
||||
|
||||
|
||||
@@ -7,17 +7,15 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include "styles/style_widgets.h"
|
||||
#include "ui/rp_widget.h"
|
||||
#include "ui/effects/animations.h"
|
||||
#include "base/object_ptr.h"
|
||||
#include "ui/rp_widget.h"
|
||||
|
||||
#include <set>
|
||||
namespace style {
|
||||
struct MultiSelect;
|
||||
} // namespace style
|
||||
|
||||
namespace Ui {
|
||||
|
||||
class InputField;
|
||||
class CrossButton;
|
||||
class ScrollArea;
|
||||
|
||||
class MultiSelect : public RpWidget {
|
||||
|
||||
@@ -531,7 +531,7 @@ COPY --from=xkbcommon ${LibrariesPath}/xkbcommon-cache /
|
||||
ARG DEBUG
|
||||
RUN git clone -b ${QT_TAG} --depth=1 git://code.qt.io/qt/qt5.git qt_${QT} \
|
||||
&& cd qt_${QT} \
|
||||
&& perl init-repository --module-subset=qtbase,qtwayland,qtimageformats,qtsvg,qt5compat \
|
||||
&& git submodule update --init --recursive --depth=1 qtbase qtwayland qtimageformats qtsvg qt5compat \
|
||||
&& cd qtbase \
|
||||
&& find ../../patches/qtbase_${QT} -type f -print0 | sort -z | xargs -r0 git apply \
|
||||
&& cd .. \
|
||||
@@ -587,7 +587,7 @@ RUN git init tg_owt \
|
||||
&& git remote add origin $GIT/desktop-app/tg_owt.git \
|
||||
&& git fetch --depth=1 origin 63a934db1ed212ebf8aaaa20f0010dd7b0d7b396 \
|
||||
&& git reset --hard FETCH_HEAD \
|
||||
&& git submodule update --init --recursive \
|
||||
&& git submodule update --init --recursive --depth=1 \
|
||||
&& rm -rf .git \
|
||||
&& cd src/third_party/pipewire \
|
||||
&& meson build -Dspa-plugins=disabled \
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
AppVersion 3007001
|
||||
AppVersion 3007002
|
||||
AppVersionStrMajor 3.7
|
||||
AppVersionStrSmall 3.7.1
|
||||
AppVersionStr 3.7.1
|
||||
AppVersionStrSmall 3.7.2
|
||||
AppVersionStr 3.7.2
|
||||
BetaChannel 0
|
||||
AlphaVersion 0
|
||||
AppVersionOriginal 3.7.1
|
||||
AppVersionOriginal 3.7.2
|
||||
|
||||
@@ -48,6 +48,9 @@ nice_target_sources(td_ui ${src_loc}
|
||||
PRIVATE
|
||||
${style_files}
|
||||
|
||||
boxes/peers/edit_peer_history_visibility_box.cpp
|
||||
boxes/peers/edit_peer_history_visibility_box.h
|
||||
|
||||
calls/group/ui/calls_group_recording_box.cpp
|
||||
calls/group/ui/calls_group_recording_box.h
|
||||
calls/group/ui/calls_group_scheduled_labels.cpp
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
3.7.2 (25.04.22)
|
||||
|
||||
- Fix mute period selector values.
|
||||
- Fix a crash in repeated context menu item selection.
|
||||
- Fix context menu item selection of systems without a compositor.
|
||||
|
||||
3.7.1 (19.04.22)
|
||||
|
||||
- Hardware accelerated video decoding off by default.
|
||||
|
||||