mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-03 21:54:05 +02:00
Added ability to disable context menu for RTMP labels.
This commit is contained in:
parent
069a2814fc
commit
6d46590312
3 changed files with 12 additions and 0 deletions
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "calls/group/calls_group_rtmp.h"
|
||||
|
||||
#include "apiwrap.h"
|
||||
#include "base/event_filter.h"
|
||||
#include "calls/group/calls_group_common.h"
|
||||
#include "data/data_peer.h"
|
||||
#include "lang/lang_keys.h"
|
||||
|
@ -50,6 +51,7 @@ void StartWithBox(
|
|||
StartRtmpProcess::FillRtmpRows(
|
||||
box->verticalLayout(),
|
||||
true,
|
||||
false,
|
||||
std::move(showBox),
|
||||
std::move(showToast),
|
||||
std::move(data),
|
||||
|
@ -199,6 +201,7 @@ void StartRtmpProcess::createBox() {
|
|||
void StartRtmpProcess::FillRtmpRows(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
bool divider,
|
||||
bool disabledMenuForLabels,
|
||||
Fn<void(object_ptr<Ui::BoxContent>)> showBox,
|
||||
Fn<void(QString)> showToast,
|
||||
rpl::producer<StartRtmpProcess::Data> &&data,
|
||||
|
@ -261,6 +264,13 @@ void StartRtmpProcess::FillRtmpRows(
|
|||
st::boxRowPadding);
|
||||
label->setSelectable(true);
|
||||
label->setBreakEverywhere(true);
|
||||
if (disabledMenuForLabels) {
|
||||
base::install_event_filter(label, [=](not_null<QEvent*> e) {
|
||||
return (e->type() == QEvent::ContextMenu)
|
||||
? base::EventFilterResult::Cancel
|
||||
: base::EventFilterResult::Continue;
|
||||
});
|
||||
}
|
||||
return label;
|
||||
};
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ public:
|
|||
static void FillRtmpRows(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
bool divider,
|
||||
bool disabledMenuForLabels,
|
||||
Fn<void(object_ptr<Ui::BoxContent>)> showBox,
|
||||
Fn<void(QString)> showToast,
|
||||
rpl::producer<StartRtmpProcess::Data> &&data,
|
||||
|
|
|
@ -702,6 +702,7 @@ void SettingsBox(
|
|||
StartRtmpProcess::FillRtmpRows(
|
||||
box->verticalLayout(),
|
||||
false,
|
||||
true,
|
||||
[=](object_ptr<Ui::BoxContent> &&object) {
|
||||
box->getDelegate()->show(std::move(object));
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue