Showing the changes to interface/src/Application.cpp (1 of 3 files). Show all
Unified · Split
| @@ -4799,6 +4799,8 @@ const DisplayPlugin * Application::getActiveDisplayPlugin() const { · 4798 unmodified lines | ||
| 4799 | 4799 | return ((Application*)this)->getActiveDisplayPlugin(); |
| 4800 | 4800 | } |
| 4801 | 4801 | |
| 4802 | +static QVector<QPair<QString, QString>> _currentDisplayPluginActions; | |
| 4803 | + | |
| 4802 | 4804 | void Application::updateDisplayMode() { |
| 4803 | 4805 | auto menu = Menu::getInstance(); |
| 4804 | 4806 | auto displayPlugins = getDisplayPlugins(); |
| @@ -4822,6 +4824,14 @@ void Application::updateDisplayMode() { · 17 unmodified lines | ||
| 4822 | 4824 | oldDisplayPlugin->removeEventFilter(qApp); |
| 4823 | 4825 | } |
| 4824 | 4826 | |
| 4827 | + if (!_currentDisplayPluginActions.isEmpty()) { | |
| 4828 | + auto menu = Menu::getInstance(); | |
| 4829 | + foreach(auto itemInfo, _currentDisplayPluginActions) { | |
| 4830 | + menu->removeMenuItem(itemInfo.first, itemInfo.second); | |
| 4831 | + } | |
| 4832 | + _currentDisplayPluginActions.clear(); | |
| 4833 | + } | |
| 4834 | + | |
| 4825 | 4835 | if (newDisplayPlugin) { |
| 4826 | 4836 | _offscreenContext->makeCurrent(); |
| 4827 | 4837 | newDisplayPlugin->activate(this); |
| @@ -4850,8 +4860,14 @@ void Application::updateDisplayMode() { · 22 unmodified lines | ||
| 4850 | 4860 | Q_ASSERT_X(_displayPlugin, "Application::updateDisplayMode", "could not find an activated display plugin"); |
| 4851 | 4861 | } |
| 4852 | 4862 | |
| 4853 | −void Application::addMenuItem(const QString& path, std::function<void()> onClicked, bool checkable, bool checked, const QString& groupName) { | |
| 4854 | − | |
| 4863 | +void Application::addMenuItem(const QString& path, const QString& name, std::function<void()> onClicked, bool checkable, bool checked, const QString& groupName) { | |
| 4864 | + auto menu = Menu::getInstance(); | |
| 4865 | + MenuWrapper* parentItem = menu->getMenu(path); | |
| 4866 | + QAction* action = parentItem->addAction(name); | |
| 4867 | + connect(action, &QAction::triggered, [=] { | |
| 4868 | + onClicked(); | |
| 4869 | + }); | |
| 4870 | + _currentDisplayPluginActions.push_back({ path, name }); | |
| 4855 | 4871 | } |
| 4856 | 4872 | |
| 4857 | 4873 | GlWindow* Application::getVisibleWindow() { |