void Plugin::fillMenu () { auto menu = Proxy_->GetMWProxy ()->GetMainMenu (); QMenu *lcMenu = 0; QList<QAction*> firstLevelActions; Q_FOREACH (auto action, menu->actions ()) if (action->menu ()) { MenuBar_->addAction (action); if (!lcMenu) lcMenu = action->menu (); } else { if (action->menuRole () == QAction::TextHeuristicRole) action->setMenuRole (QAction::ApplicationSpecificRole); firstLevelActions << action; } Q_FOREACH (auto act, firstLevelActions) lcMenu->addAction (act); if (!lcMenu->actions ().isEmpty ()) MenuBar_->addMenu (lcMenu); const auto& actors = Proxy_->GetPluginsManager ()-> GetAllCastableRoots<IActionsExporter*> (); Q_FOREACH (auto actor, actors) connect (actor, SIGNAL (gotActions (QList<QAction*>, LeechCraft::ActionsEmbedPlace)), this, SLOT (handleGotActions (QList<QAction*>, LeechCraft::ActionsEmbedPlace))); }
void TrayComponent::handlePluginsAvailable () { const auto places = { ActionsEmbedPlace::QuickLaunch, ActionsEmbedPlace::LCTray }; const auto& hasActions = Proxy_->GetPluginsManager ()-> GetAllCastableTo<IActionsExporter*> (); for (auto place : places) for (auto exp : hasActions) handleGotActions (exp->GetActions (place), place); }
TrayComponent::TrayComponent (ICoreProxy_ptr proxy, SBView *view, QObject *parent) : BaseActionComponent ({ "SB2_TrayActionImage", "TrayComponent.qml", "SB2_trayModel" }, proxy, view, parent) { const auto& hasActions = Proxy_->GetPluginsManager ()-> GetAllCastableRoots<IActionsExporter*> (); for (QObject *actObj : hasActions) connect (actObj, SIGNAL (gotActions (QList<QAction*>, LeechCraft::ActionsEmbedPlace)), this, SLOT (handleGotActions (QList<QAction*>, LeechCraft::ActionsEmbedPlace))); }
void Plugin::fillMenu () { if (!UnityDetected_) return; auto menu = Proxy_->GetRootWindowsManager ()->GetMWProxy (0)->GetMainMenu (); QMenu *lcMenu = 0; QList<QAction*> firstLevelActions; for (auto action : menu->actions ()) if (action->menu ()) { MenuBar_->addAction (action); if (!lcMenu) lcMenu = action->menu (); } else { if (action->menuRole () == QAction::TextHeuristicRole) action->setMenuRole (QAction::ApplicationSpecificRole); firstLevelActions << action; } if (!lcMenu) { qWarning () << Q_FUNC_INFO << "LeechCraft menu not found"; return; } for (auto act : irstLevelActions) lcMenu->addAction (act); if (!lcMenu->actions ().isEmpty ()) MenuBar_->addMenu (lcMenu); for (auto actor : Proxy_->GetPluginsManager ()->GetAllCastableRoots<IActionsExporter*> ()) connect (actor, SIGNAL (gotActions (QList<QAction*>, LeechCraft::ActionsEmbedPlace)), this, SLOT (handleGotActions (QList<QAction*>, LeechCraft::ActionsEmbedPlace))); }