Showing the changes to interface/src/Application.cpp (1 of 24 files). Show all
Unified · Split
| @@ -4844,6 +4844,8 @@ const DisplayPlugin * Application::getActiveDisplayPlugin() const { · 4843 unmodified lines | ||
| 4844 | 4844 | return ((Application*)this)->getActiveDisplayPlugin(); |
| 4845 | 4845 | } |
| 4846 | 4846 | |
| 4847 | +static QVector<QPair<QString, QString>> _currentDisplayPluginActions; | |
| 4848 | + | |
| 4847 | 4849 | void Application::updateDisplayMode() { |
| 4848 | 4850 | auto menu = Menu::getInstance(); |
| 4849 | 4851 | auto displayPlugins = getDisplayPlugins(); |
| @@ -4867,6 +4869,14 @@ void Application::updateDisplayMode() { · 17 unmodified lines | ||
| 4867 | 4869 | oldDisplayPlugin->removeEventFilter(qApp); |
| 4868 | 4870 | } |
| 4869 | 4871 | |
| 4872 | + if (!_currentDisplayPluginActions.isEmpty()) { | |
| 4873 | + auto menu = Menu::getInstance(); | |
| 4874 | + foreach(auto itemInfo, _currentDisplayPluginActions) { | |
| 4875 | + menu->removeMenuItem(itemInfo.first, itemInfo.second); | |
| 4876 | + } | |
| 4877 | + _currentDisplayPluginActions.clear(); | |
| 4878 | + } | |
| 4879 | + | |
| 4870 | 4880 | if (newDisplayPlugin) { |
| 4871 | 4881 | _offscreenContext->makeCurrent(); |
| 4872 | 4882 | newDisplayPlugin->activate(this); |
| @@ -4895,8 +4905,14 @@ void Application::updateDisplayMode() { · 22 unmodified lines | ||
| 4895 | 4905 | Q_ASSERT_X(_displayPlugin, "Application::updateDisplayMode", "could not find an activated display plugin"); |
| 4896 | 4906 | } |
| 4897 | 4907 | |
| 4898 | −void Application::addMenuItem(const QString& path, std::function<void()> onClicked, bool checkable, bool checked, const QString& groupName) { | |
| 4899 | − | |
| 4908 | +void Application::addMenuItem(const QString& path, const QString& name, std::function<void()> onClicked, bool checkable, bool checked, const QString& groupName) { | |
| 4909 | + auto menu = Menu::getInstance(); | |
| 4910 | + MenuWrapper* parentItem = menu->getMenu(path); | |
| 4911 | + QAction* action = parentItem->addAction(name); | |
| 4912 | + connect(action, &QAction::triggered, [=] { | |
| 4913 | + onClicked(); | |
| 4914 | + }); | |
| 4915 | + _currentDisplayPluginActions.push_back({ path, name }); | |
| 4900 | 4916 | } |
| 4901 | 4917 | |
| 4902 | 4918 | GlWindow* Application::getVisibleWindow() { |