mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Add spoiler toggle to three dot menu in SendFilesBox.
This commit is contained in:
parent
ca0b34dcf0
commit
2ce8094932
11 changed files with 173 additions and 44 deletions
BIN
Telegram/Resources/icons/menu/spoiler.png
Normal file
BIN
Telegram/Resources/icons/menu/spoiler.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 572 B |
BIN
Telegram/Resources/icons/menu/spoiler@2x.png
Normal file
BIN
Telegram/Resources/icons/menu/spoiler@2x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 988 B |
BIN
Telegram/Resources/icons/menu/spoiler@3x.png
Normal file
BIN
Telegram/Resources/icons/menu/spoiler@3x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
|
@ -2344,17 +2344,15 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_send_image_empty" = "Could not send an empty file: {name}";
|
"lng_send_image_empty" = "Could not send an empty file: {name}";
|
||||||
"lng_send_images_selected#one" = "{count} image selected";
|
"lng_send_images_selected#one" = "{count} image selected";
|
||||||
"lng_send_images_selected#other" = "{count} images selected";
|
"lng_send_images_selected#other" = "{count} images selected";
|
||||||
"lng_send_photos#one" = "Send {count} photo";
|
|
||||||
"lng_send_photos#other" = "Send {count} photos";
|
|
||||||
"lng_send_separate_photos" = "Send as separate photos";
|
|
||||||
"lng_send_separate_photos_videos" = "Send as separate media";
|
|
||||||
"lng_send_files_selected#one" = "{count} file selected";
|
"lng_send_files_selected#one" = "{count} file selected";
|
||||||
"lng_send_files_selected#other" = "{count} files selected";
|
"lng_send_files_selected#other" = "{count} files selected";
|
||||||
"lng_send_files#one" = "Send {count} file";
|
|
||||||
"lng_send_files#other" = "Send {count} files";
|
|
||||||
"lng_send_grouped" = "Group items";
|
"lng_send_grouped" = "Group items";
|
||||||
|
"lng_send_compressed_one" = "Compress the image";
|
||||||
"lng_send_compressed" = "Compress images";
|
"lng_send_compressed" = "Compress images";
|
||||||
"lng_send_media_invalid_files" = "Sorry, no valid files found.";
|
"lng_send_media_invalid_files" = "Sorry, no valid files found.";
|
||||||
|
"lng_send_image" = "Send an image";
|
||||||
|
"lng_send_file" = "Send a file";
|
||||||
|
"lng_send_video" = "Send a video file";
|
||||||
|
|
||||||
"lng_forward_choose" = "Choose recipient...";
|
"lng_forward_choose" = "Choose recipient...";
|
||||||
"lng_forward_cant" = "Sorry, no way to forward here :(";
|
"lng_forward_cant" = "Sorry, no way to forward here :(";
|
||||||
|
|
|
@ -319,7 +319,7 @@ void EditCaptionBox::setupControls() {
|
||||||
this,
|
this,
|
||||||
object_ptr<Ui::Checkbox>(
|
object_ptr<Ui::Checkbox>(
|
||||||
this,
|
this,
|
||||||
tr::lng_send_compressed(tr::now),
|
tr::lng_send_compressed_one(tr::now),
|
||||||
true,
|
true,
|
||||||
st::defaultBoxCheckbox),
|
st::defaultBoxCheckbox),
|
||||||
st::editMediaCheckboxMargins)
|
st::editMediaCheckboxMargins)
|
||||||
|
|
|
@ -35,6 +35,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
#include "ui/widgets/input_fields.h"
|
#include "ui/widgets/input_fields.h"
|
||||||
#include "ui/widgets/scroll_area.h"
|
#include "ui/widgets/scroll_area.h"
|
||||||
|
#include "ui/widgets/popup_menu.h"
|
||||||
#include "ui/wrap/vertical_layout.h"
|
#include "ui/wrap/vertical_layout.h"
|
||||||
#include "ui/chat/attach/attach_prepare.h"
|
#include "ui/chat/attach/attach_prepare.h"
|
||||||
#include "ui/chat/attach/attach_send_files_way.h"
|
#include "ui/chat/attach/attach_send_files_way.h"
|
||||||
|
@ -62,6 +63,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "styles/style_layers.h"
|
#include "styles/style_layers.h"
|
||||||
#include "styles/style_boxes.h"
|
#include "styles/style_boxes.h"
|
||||||
#include "styles/style_chat_helpers.h"
|
#include "styles/style_chat_helpers.h"
|
||||||
|
#include "styles/style_info.h"
|
||||||
|
#include "styles/style_menu_icons.h"
|
||||||
|
|
||||||
#include <QtCore/QMimeData>
|
#include <QtCore/QMimeData>
|
||||||
|
|
||||||
|
@ -227,6 +230,17 @@ void SendFilesBox::Block::setSendWay(Ui::SendFilesWay way) {
|
||||||
album->setSendWay(way);
|
album->setSendWay(way);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SendFilesBox::Block::toggleSpoilers(bool enabled) {
|
||||||
|
if (_isAlbum) {
|
||||||
|
const auto album = static_cast<Ui::AlbumPreview*>(_preview.get());
|
||||||
|
album->toggleSpoilers(enabled);
|
||||||
|
} else if (_isSingleMedia) {
|
||||||
|
const auto media = static_cast<Ui::SingleMediaPreview*>(
|
||||||
|
_preview.get());
|
||||||
|
media->setSpoiler(enabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void SendFilesBox::Block::applyChanges() {
|
void SendFilesBox::Block::applyChanges() {
|
||||||
if (!_isAlbum) {
|
if (!_isAlbum) {
|
||||||
if (_isSingleMedia) {
|
if (_isSingleMedia) {
|
||||||
|
@ -297,7 +311,7 @@ SendFilesBox::SendFilesBox(
|
||||||
void SendFilesBox::initPreview() {
|
void SendFilesBox::initPreview() {
|
||||||
using namespace rpl::mappers;
|
using namespace rpl::mappers;
|
||||||
|
|
||||||
refreshControls();
|
refreshControls(true);
|
||||||
|
|
||||||
updateBoxSize();
|
updateBoxSize();
|
||||||
|
|
||||||
|
@ -345,19 +359,6 @@ void SendFilesBox::enqueueNextPrepare() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendFilesBox::prepare() {
|
void SendFilesBox::prepare() {
|
||||||
_send = addButton(
|
|
||||||
(_sendType == Api::SendType::Normal
|
|
||||||
? tr::lng_send_button()
|
|
||||||
: tr::lng_create_group_next()),
|
|
||||||
[=] { send({}); });
|
|
||||||
if (_sendType == Api::SendType::Normal) {
|
|
||||||
SendMenu::SetupMenuAndShortcuts(
|
|
||||||
_send,
|
|
||||||
[=] { return _sendMenuType; },
|
|
||||||
[=] { sendSilent(); },
|
|
||||||
[=] { sendScheduled(); });
|
|
||||||
}
|
|
||||||
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
|
||||||
initSendWay();
|
initSendWay();
|
||||||
setupCaption();
|
setupCaption();
|
||||||
setupSendWayControls();
|
setupSendWayControls();
|
||||||
|
@ -371,11 +372,6 @@ void SendFilesBox::prepare() {
|
||||||
}
|
}
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
||||||
_addFile = addLeftButton(
|
|
||||||
tr::lng_stickers_featured_add(),
|
|
||||||
base::fn_delayed(st::historyAttach.ripple.hideDuration, this, [=] {
|
|
||||||
openDialogToAddFileToAlbum();
|
|
||||||
}));
|
|
||||||
setupDragArea();
|
setupDragArea();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -457,6 +453,103 @@ void SendFilesBox::openDialogToAddFileToAlbum() {
|
||||||
crl::guard(this, callback));
|
crl::guard(this, callback));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SendFilesBox::refreshButtons() {
|
||||||
|
clearButtons();
|
||||||
|
|
||||||
|
_send = addButton(
|
||||||
|
(_sendType == Api::SendType::Normal
|
||||||
|
? tr::lng_send_button()
|
||||||
|
: tr::lng_create_group_next()),
|
||||||
|
[=] { send({}); });
|
||||||
|
if (_sendType == Api::SendType::Normal) {
|
||||||
|
SendMenu::SetupMenuAndShortcuts(
|
||||||
|
_send,
|
||||||
|
[=] { return _sendMenuType; },
|
||||||
|
[=] { sendSilent(); },
|
||||||
|
[=] { sendScheduled(); });
|
||||||
|
}
|
||||||
|
addButton(tr::lng_cancel(), [=] { closeBox(); });
|
||||||
|
_addFile = addLeftButton(
|
||||||
|
tr::lng_stickers_featured_add(),
|
||||||
|
base::fn_delayed(st::historyAttach.ripple.hideDuration, this, [=] {
|
||||||
|
openDialogToAddFileToAlbum();
|
||||||
|
}));
|
||||||
|
|
||||||
|
addMenuButton();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SendFilesBox::hasSendMenu() const {
|
||||||
|
return (_sendMenuType != SendMenu::Type::Disabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SendFilesBox::hasSpoilerMenu() const {
|
||||||
|
const auto allAreVideo = !ranges::any_of(_list.files, [](const auto &f) {
|
||||||
|
using Type = Ui::PreparedFile::Type;
|
||||||
|
return (f.type != Type::Video);
|
||||||
|
});
|
||||||
|
const auto allAreMedia = !ranges::any_of(_list.files, [](const auto &f) {
|
||||||
|
using Type = Ui::PreparedFile::Type;
|
||||||
|
return (f.type != Type::Photo) && (f.type != Type::Video);
|
||||||
|
});
|
||||||
|
return allAreVideo
|
||||||
|
|| (allAreMedia && _sendWay.current().sendImagesAsPhotos());
|
||||||
|
}
|
||||||
|
|
||||||
|
void SendFilesBox::applyBlockChanges() {
|
||||||
|
for (auto &block : _blocks) {
|
||||||
|
block.applyChanges();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SendFilesBox::allWithSpoilers() {
|
||||||
|
applyBlockChanges();
|
||||||
|
return ranges::all_of(_list.files, &Ui::PreparedFile::spoiler);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SendFilesBox::toggleSpoilers(bool enabled) {
|
||||||
|
for (auto &file : _list.files) {
|
||||||
|
file.spoiler = enabled;
|
||||||
|
}
|
||||||
|
for (auto &block : _blocks) {
|
||||||
|
block.toggleSpoilers(enabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SendFilesBox::addMenuButton() {
|
||||||
|
if (!hasSendMenu() && !hasSpoilerMenu()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto top = addTopButton(st::infoTopBarMenu);
|
||||||
|
top->setClickedCallback([=] {
|
||||||
|
_menu = base::make_unique_q<Ui::PopupMenu>(
|
||||||
|
top,
|
||||||
|
st::popupMenuExpandedSeparator);
|
||||||
|
if (hasSpoilerMenu()) {
|
||||||
|
const auto spoilered = allWithSpoilers();
|
||||||
|
_menu->addAction(
|
||||||
|
(spoilered
|
||||||
|
? tr::lng_context_disable_spoiler(tr::now)
|
||||||
|
: tr::lng_context_spoiler_effect(tr::now)),
|
||||||
|
[=] { toggleSpoilers(!spoilered); },
|
||||||
|
(spoilered ? &st::menuIconDisable : &st::menuIconSpoiler));
|
||||||
|
if (hasSendMenu()) {
|
||||||
|
_menu->addSeparator();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (hasSendMenu()) {
|
||||||
|
SendMenu::FillSendMenu(
|
||||||
|
_menu.get(),
|
||||||
|
_sendMenuType,
|
||||||
|
[=] { sendSilent(); },
|
||||||
|
[=] { sendScheduled(); });
|
||||||
|
}
|
||||||
|
_menu->popup(QCursor::pos());
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void SendFilesBox::initSendWay() {
|
void SendFilesBox::initSendWay() {
|
||||||
_sendWay = [&] {
|
_sendWay = [&] {
|
||||||
auto result = Core::App().settings().sendFilesWay();
|
auto result = Core::App().settings().sendFilesWay();
|
||||||
|
@ -480,6 +573,9 @@ void SendFilesBox::initSendWay() {
|
||||||
for (auto &block : _blocks) {
|
for (auto &block : _blocks) {
|
||||||
block.setSendWay(value);
|
block.setSendWay(value);
|
||||||
}
|
}
|
||||||
|
if (!hasSendMenu()) {
|
||||||
|
refreshButtons();
|
||||||
|
}
|
||||||
setInnerFocus();
|
setInnerFocus();
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
}
|
}
|
||||||
|
@ -650,9 +746,12 @@ void SendFilesBox::pushBlock(int from, int till) {
|
||||||
}, widget->lifetime());
|
}, widget->lifetime());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendFilesBox::refreshControls() {
|
void SendFilesBox::refreshControls(bool initial) {
|
||||||
|
if (initial || !hasSendMenu()) {
|
||||||
|
refreshButtons();
|
||||||
|
}
|
||||||
refreshTitleText();
|
refreshTitleText();
|
||||||
updateSendWayControlsVisibility();
|
updateSendWayControls();
|
||||||
updateCaptionPlaceholder();
|
updateCaptionPlaceholder();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -711,11 +810,14 @@ void SendFilesBox::setupSendWayControls() {
|
||||||
st::editMediaHintLabel);
|
st::editMediaHintLabel);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendFilesBox::updateSendWayControlsVisibility() {
|
void SendFilesBox::updateSendWayControls() {
|
||||||
const auto onlyOne = (_sendLimit == SendLimit::One);
|
const auto onlyOne = (_sendLimit == SendLimit::One);
|
||||||
_groupFiles->setVisible(_list.hasGroupOption(onlyOne));
|
_groupFiles->setVisible(_list.hasGroupOption(onlyOne));
|
||||||
_sendImagesAsPhotos->setVisible(
|
_sendImagesAsPhotos->setVisible(
|
||||||
_list.hasSendImagesAsPhotosOption(onlyOne));
|
_list.hasSendImagesAsPhotosOption(onlyOne));
|
||||||
|
_sendImagesAsPhotos->setText((_list.files.size() > 1)
|
||||||
|
? tr::lng_send_compressed(tr::now)
|
||||||
|
: tr::lng_send_compressed_one(tr::now));
|
||||||
|
|
||||||
_hintLabel->setVisible(
|
_hintLabel->setVisible(
|
||||||
_controller->session().settings().photoEditorHintShown()
|
_controller->session().settings().photoEditorHintShown()
|
||||||
|
@ -933,20 +1035,27 @@ void SendFilesBox::addFile(Ui::PreparedFile &&file) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendFilesBox::refreshTitleText() {
|
void SendFilesBox::refreshTitleText() {
|
||||||
|
using Type = Ui::PreparedFile::Type;
|
||||||
const auto count = int(_list.files.size());
|
const auto count = int(_list.files.size());
|
||||||
if (count > 1) {
|
if (count > 1) {
|
||||||
const auto imagesCount = ranges::count(
|
const auto imagesCount = ranges::count(
|
||||||
_list.files,
|
_list.files,
|
||||||
Ui::PreparedFile::Type::Photo,
|
Type::Photo,
|
||||||
&Ui::PreparedFile::type);
|
&Ui::PreparedFile::type);
|
||||||
_titleText = (imagesCount == count)
|
_titleText = (imagesCount == count)
|
||||||
? tr::lng_send_images_selected(tr::now, lt_count, count)
|
? tr::lng_send_images_selected(tr::now, lt_count, count)
|
||||||
: tr::lng_send_files_selected(tr::now, lt_count, count);
|
: tr::lng_send_files_selected(tr::now, lt_count, count);
|
||||||
_titleHeight = st::boxTitleHeight;
|
|
||||||
} else {
|
} else {
|
||||||
_titleText = QString();
|
const auto type = _list.files.empty()
|
||||||
_titleHeight = count ? st::boxPhotoPadding.top() : 0;
|
? Type::None
|
||||||
|
: _list.files.front().type;
|
||||||
|
_titleText = (type == Type::Photo)
|
||||||
|
? tr::lng_send_image(tr::now)
|
||||||
|
: (type == Type::Video)
|
||||||
|
? tr::lng_send_video(tr::now)
|
||||||
|
: tr::lng_send_file(tr::now);
|
||||||
}
|
}
|
||||||
|
_titleHeight = st::boxTitleHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendFilesBox::updateBoxSize() {
|
void SendFilesBox::updateBoxSize() {
|
||||||
|
@ -1102,9 +1211,7 @@ void SendFilesBox::send(
|
||||||
for (auto &item : _list.files) {
|
for (auto &item : _list.files) {
|
||||||
item.spoiler = false;
|
item.spoiler = false;
|
||||||
}
|
}
|
||||||
for (auto &block : _blocks) {
|
applyBlockChanges();
|
||||||
block.applyChanges();
|
|
||||||
}
|
|
||||||
|
|
||||||
Storage::ApplyModifications(_list);
|
Storage::ApplyModifications(_list);
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "boxes/abstract_box.h"
|
#include "boxes/abstract_box.h"
|
||||||
#include "ui/chat/attach/attach_prepare.h"
|
#include "ui/chat/attach/attach_prepare.h"
|
||||||
#include "ui/chat/attach/attach_send_files_way.h"
|
#include "ui/chat/attach/attach_send_files_way.h"
|
||||||
|
#include "ui/widgets/popup_menu.h"
|
||||||
#include "storage/localimageloader.h"
|
#include "storage/localimageloader.h"
|
||||||
#include "storage/storage_media_prepare.h"
|
#include "storage/storage_media_prepare.h"
|
||||||
|
|
||||||
|
@ -36,6 +37,7 @@ class EmojiButton;
|
||||||
class AlbumPreview;
|
class AlbumPreview;
|
||||||
class VerticalLayout;
|
class VerticalLayout;
|
||||||
class FlatLabel;
|
class FlatLabel;
|
||||||
|
class PopupMenu;
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
||||||
namespace Window {
|
namespace Window {
|
||||||
|
@ -106,6 +108,7 @@ private:
|
||||||
[[nodiscard]] rpl::producer<int> itemModifyRequest() const;
|
[[nodiscard]] rpl::producer<int> itemModifyRequest() const;
|
||||||
|
|
||||||
void setSendWay(Ui::SendFilesWay way);
|
void setSendWay(Ui::SendFilesWay way);
|
||||||
|
void toggleSpoilers(bool enabled);
|
||||||
void applyChanges();
|
void applyChanges();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -117,16 +120,24 @@ private:
|
||||||
bool _isSingleMedia = false;
|
bool _isSingleMedia = false;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void initSendWay();
|
void initSendWay();
|
||||||
void initPreview();
|
void initPreview();
|
||||||
|
[[nodiscard]] bool hasSendMenu() const;
|
||||||
|
[[nodiscard]] bool hasSpoilerMenu() const;
|
||||||
|
[[nodiscard]] bool allWithSpoilers();
|
||||||
|
void addMenuButton();
|
||||||
|
void applyBlockChanges();
|
||||||
|
void toggleSpoilers(bool enabled);
|
||||||
|
|
||||||
bool validateLength(const QString &text) const;
|
bool validateLength(const QString &text) const;
|
||||||
void refreshControls();
|
void refreshButtons();
|
||||||
|
void refreshControls(bool initial = false);
|
||||||
void setupSendWayControls();
|
void setupSendWayControls();
|
||||||
void setupCaption();
|
void setupCaption();
|
||||||
|
|
||||||
void setupEmojiPanel();
|
void setupEmojiPanel();
|
||||||
void updateSendWayControlsVisibility();
|
void updateSendWayControls();
|
||||||
void updateEmojiPanelGeometry();
|
void updateEmojiPanelGeometry();
|
||||||
void emojiFilterForGeometry(not_null<QEvent*> event);
|
void emojiFilterForGeometry(not_null<QEvent*> event);
|
||||||
|
|
||||||
|
@ -200,6 +211,8 @@ private:
|
||||||
Fn<void()> _whenReadySend;
|
Fn<void()> _whenReadySend;
|
||||||
bool _preparing = false;
|
bool _preparing = false;
|
||||||
|
|
||||||
|
base::unique_qptr<Ui::PopupMenu> _menu;
|
||||||
|
|
||||||
QPointer<Ui::RoundButton> _send;
|
QPointer<Ui::RoundButton> _send;
|
||||||
QPointer<Ui::RoundButton> _addFile;
|
QPointer<Ui::RoundButton> _addFile;
|
||||||
|
|
||||||
|
|
|
@ -264,11 +264,12 @@ void AbstractSingleMediaPreview::showContextMenu(QPoint position) {
|
||||||
this,
|
this,
|
||||||
st::popupMenuWithIcons);
|
st::popupMenuWithIcons);
|
||||||
|
|
||||||
_menu->addAction(hasSpoiler()
|
const auto spoilered = hasSpoiler();
|
||||||
|
_menu->addAction(spoilered
|
||||||
? tr::lng_context_disable_spoiler(tr::now)
|
? tr::lng_context_disable_spoiler(tr::now)
|
||||||
: tr::lng_context_spoiler_effect(tr::now), [=] {
|
: tr::lng_context_spoiler_effect(tr::now), [=] {
|
||||||
setSpoiler(!hasSpoiler());
|
setSpoiler(!spoilered);
|
||||||
}, &st::menuIconCopy);
|
}, spoilered ? &st::menuIconDisable : &st::menuIconSpoiler);
|
||||||
|
|
||||||
if (_menu->empty()) {
|
if (_menu->empty()) {
|
||||||
_menu = nullptr;
|
_menu = nullptr;
|
||||||
|
|
|
@ -81,6 +81,12 @@ bool AlbumPreview::canHaveSpoiler(int index) const {
|
||||||
return _sendWay.sendImagesAsPhotos();
|
return _sendWay.sendImagesAsPhotos();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AlbumPreview::toggleSpoilers(bool enabled) {
|
||||||
|
for (auto &thumb : _thumbs) {
|
||||||
|
thumb->setSpoiler(enabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<int> AlbumPreview::takeOrder() {
|
std::vector<int> AlbumPreview::takeOrder() {
|
||||||
//Expects(_thumbs.size() == _order.size());
|
//Expects(_thumbs.size() == _order.size());
|
||||||
//Expects(_itemsShownDimensions.size() == _order.size());
|
//Expects(_itemsShownDimensions.size() == _order.size());
|
||||||
|
@ -582,11 +588,12 @@ void AlbumPreview::showContextMenu(
|
||||||
this,
|
this,
|
||||||
st::popupMenuWithIcons);
|
st::popupMenuWithIcons);
|
||||||
|
|
||||||
_menu->addAction(thumb->hasSpoiler()
|
const auto spoilered = thumb->hasSpoiler();
|
||||||
|
_menu->addAction(spoilered
|
||||||
? tr::lng_context_disable_spoiler(tr::now)
|
? tr::lng_context_disable_spoiler(tr::now)
|
||||||
: tr::lng_context_spoiler_effect(tr::now), [=] {
|
: tr::lng_context_spoiler_effect(tr::now), [=] {
|
||||||
thumb->setSpoiler(!thumb->hasSpoiler());
|
thumb->setSpoiler(!spoilered);
|
||||||
}, &st::menuIconCopy);
|
}, spoilered ? &st::menuIconDisable : &st::menuIconSpoiler);
|
||||||
|
|
||||||
if (_menu->empty()) {
|
if (_menu->empty()) {
|
||||||
_menu = nullptr;
|
_menu = nullptr;
|
||||||
|
|
|
@ -30,6 +30,7 @@ public:
|
||||||
|
|
||||||
[[nodiscard]] base::flat_set<int> collectSpoileredIndices();
|
[[nodiscard]] base::flat_set<int> collectSpoileredIndices();
|
||||||
[[nodiscard]] bool canHaveSpoiler(int index) const;
|
[[nodiscard]] bool canHaveSpoiler(int index) const;
|
||||||
|
void toggleSpoilers(bool enabled);
|
||||||
[[nodiscard]] std::vector<int> takeOrder();
|
[[nodiscard]] std::vector<int> takeOrder();
|
||||||
|
|
||||||
[[nodiscard]] rpl::producer<int> thumbDeleted() const {
|
[[nodiscard]] rpl::producer<int> thumbDeleted() const {
|
||||||
|
|
|
@ -94,6 +94,8 @@ menuIconStartStreamWith: icon {{ "menu/start_stream_with", menuIconColor }};
|
||||||
menuIconVideoChat: icon {{ "menu/video_chat", menuIconColor }};
|
menuIconVideoChat: icon {{ "menu/video_chat", menuIconColor }};
|
||||||
menuIconTranslate: icon {{ "menu/translate", menuIconColor }};
|
menuIconTranslate: icon {{ "menu/translate", menuIconColor }};
|
||||||
menuIconReportAntiSpam: icon {{ "menu/false_positive", menuIconColor }};
|
menuIconReportAntiSpam: icon {{ "menu/false_positive", menuIconColor }};
|
||||||
|
menuIconSpoiler: icon {{ "menu/spoiler", menuIconColor }};
|
||||||
|
menuIconDisable: icon {{ "menu/disable", menuIconColor }};
|
||||||
|
|
||||||
menuIconTTLAny: icon {{ "menu/auto_delete_plain", menuIconColor }};
|
menuIconTTLAny: icon {{ "menu/auto_delete_plain", menuIconColor }};
|
||||||
menuIconTTLAnyTextPosition: point(11px, 22px);
|
menuIconTTLAnyTextPosition: point(11px, 22px);
|
||||||
|
|
Loading…
Add table
Reference in a new issue