Untitled
unknown
plain_text
2 years ago
1.3 kB
9
Indexable
QMap<QString, QAction *> toolActions;
auto configureToolElement = [this, &toolActions](PopcornAction * action, QString const & condition, QString const & statisticsEvent, QString const & integrationTag = {}, std::function<void()> callback = {}) {
if (!Configuration::menuActionsIds.contains(condition))
return;
Statistics::setEventKey(action, statisticsEvent, "EDIT_PANEL");
Util::setCondition(action, condition);
if (!integrationTag.isEmpty())
Util::setIntegrationTag(action, integrationTag);
if (callback)
connect(action, &QAction::triggered, this, callback);
toolActions[condition] = action;
};
configureToolElement(m_ui->recordAudioAction, "recordAudio", "AUDIO_RECORD_CLICKED", {}, [this] { emit voiceOverRequested(); });
configureToolElement(m_ui->screencaptureAction, "screencapture", "SCREEN_CAPTURE_CLICKED", "screencapture");
configureToolElement(m_ui->videocaptureAction, "videocapture", "VIDEO_CAPTURE_CLICKED", "videocapture");
Workaround::Ui::apply(m_popup);
m_popup->addActions(actions);
if (!toolActions.empty())
{
m_popup->addSeparator();
}
for (auto const & condition : Configuration::menuActionsIds)
{
if (toolActions.contains(condition))
m_popup->addAction(toolActions.value(condition));
else
assert("Unknown tool in EditPanel menu");
}
Editor is loading...