mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 22:54:01 +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 "calls/group/calls_group_rtmp.h"
|
||||||
|
|
||||||
#include "apiwrap.h"
|
#include "apiwrap.h"
|
||||||
|
#include "base/event_filter.h"
|
||||||
#include "calls/group/calls_group_common.h"
|
#include "calls/group/calls_group_common.h"
|
||||||
#include "data/data_peer.h"
|
#include "data/data_peer.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
|
@ -50,6 +51,7 @@ void StartWithBox(
|
||||||
StartRtmpProcess::FillRtmpRows(
|
StartRtmpProcess::FillRtmpRows(
|
||||||
box->verticalLayout(),
|
box->verticalLayout(),
|
||||||
true,
|
true,
|
||||||
|
false,
|
||||||
std::move(showBox),
|
std::move(showBox),
|
||||||
std::move(showToast),
|
std::move(showToast),
|
||||||
std::move(data),
|
std::move(data),
|
||||||
|
@ -199,6 +201,7 @@ void StartRtmpProcess::createBox() {
|
||||||
void StartRtmpProcess::FillRtmpRows(
|
void StartRtmpProcess::FillRtmpRows(
|
||||||
not_null<Ui::VerticalLayout*> container,
|
not_null<Ui::VerticalLayout*> container,
|
||||||
bool divider,
|
bool divider,
|
||||||
|
bool disabledMenuForLabels,
|
||||||
Fn<void(object_ptr<Ui::BoxContent>)> showBox,
|
Fn<void(object_ptr<Ui::BoxContent>)> showBox,
|
||||||
Fn<void(QString)> showToast,
|
Fn<void(QString)> showToast,
|
||||||
rpl::producer<StartRtmpProcess::Data> &&data,
|
rpl::producer<StartRtmpProcess::Data> &&data,
|
||||||
|
@ -261,6 +264,13 @@ void StartRtmpProcess::FillRtmpRows(
|
||||||
st::boxRowPadding);
|
st::boxRowPadding);
|
||||||
label->setSelectable(true);
|
label->setSelectable(true);
|
||||||
label->setBreakEverywhere(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;
|
return label;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,7 @@ public:
|
||||||
static void FillRtmpRows(
|
static void FillRtmpRows(
|
||||||
not_null<Ui::VerticalLayout*> container,
|
not_null<Ui::VerticalLayout*> container,
|
||||||
bool divider,
|
bool divider,
|
||||||
|
bool disabledMenuForLabels,
|
||||||
Fn<void(object_ptr<Ui::BoxContent>)> showBox,
|
Fn<void(object_ptr<Ui::BoxContent>)> showBox,
|
||||||
Fn<void(QString)> showToast,
|
Fn<void(QString)> showToast,
|
||||||
rpl::producer<StartRtmpProcess::Data> &&data,
|
rpl::producer<StartRtmpProcess::Data> &&data,
|
||||||
|
|
|
@ -702,6 +702,7 @@ void SettingsBox(
|
||||||
StartRtmpProcess::FillRtmpRows(
|
StartRtmpProcess::FillRtmpRows(
|
||||||
box->verticalLayout(),
|
box->verticalLayout(),
|
||||||
false,
|
false,
|
||||||
|
true,
|
||||||
[=](object_ptr<Ui::BoxContent> &&object) {
|
[=](object_ptr<Ui::BoxContent> &&object) {
|
||||||
box->getDelegate()->show(std::move(object));
|
box->getDelegate()->show(std::move(object));
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue