2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 22:46:10 +00:00

Add some icons to popup menus.

This commit is contained in:
John Preston
2021-12-09 21:56:24 +04:00
parent 535fd8d523
commit 2c36623cfb
212 changed files with 581 additions and 263 deletions

View File

@@ -33,6 +33,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "styles/style_info.h"
#include "styles/style_passport.h"
#include "styles/style_chat_helpers.h"
#include "styles/style_menu_icons.h"
#include <QtGui/QGuiApplication>
#include <QtGui/QClipboard>
@@ -437,7 +438,9 @@ void Rows::showMenu(int index) {
if (_menu || !hasMenu(row)) {
return;
}
_menu = base::make_unique_q<Ui::DropdownMenu>(window());
_menu = base::make_unique_q<Ui::DropdownMenu>(
window(),
st::dropdownMenuWithIcons);
const auto weak = _menu.get();
_menu->setHiddenCallback([=] {
weak->deleteLater();
@@ -460,21 +463,25 @@ void Rows::showMenu(int index) {
});
const auto addAction = [&](
const QString &text,
Fn<void()> callback) {
return _menu->addAction(text, std::move(callback));
Fn<void()> callback,
const style::icon *icon) {
return _menu->addAction(text, std::move(callback), icon);
};
if (canShare(row)) {
addAction(tr::lng_proxy_edit_share(tr::now), [=] { share(row); });
addAction(
tr::lng_proxy_edit_share(tr::now),
[=] { share(row); },
&st::menuIconShare);
}
if (canRemove(row)) {
if (row->removed) {
addAction(tr::lng_proxy_menu_restore(tr::now), [=] {
restore(row);
});
}, &st::menuIconDelete);
} else {
addAction(tr::lng_proxy_menu_delete(tr::now), [=] {
remove(row);
});
}, &st::menuIconDelete);
}
}
const auto toggle = menuToggleArea(row);