Showing the changes to interface/src/scripting/MenuScriptingInterface.cpp (1 of 6 files). Show all
Unified · Split
| @@ -11,8 +11,11 @@ · 10 unmodified lines | ||
| 11 | 11 | |
| 12 | 12 | #include "MenuScriptingInterface.h" |
| 13 | 13 | |
| 14 | −#include "Menu.h" | |
| 14 | +#include <QtCore/QCoreApplication> | |
| 15 | +#include <QtCore/QThread> | |
| 16 | + | |
| 15 | 17 | #include <MenuItemProperties.h> |
| 18 | +#include "Menu.h" | |
| 16 | 19 | |
| 17 | 20 | MenuScriptingInterface* MenuScriptingInterface::getInstance() { |
| 18 | 21 | static MenuScriptingInterface sharedInstance; |
| @@ -36,6 +39,9 @@ void MenuScriptingInterface::removeMenu(const QString& menu) { · 17 unmodified lines | ||
| 36 | 39 | } |
| 37 | 40 | |
| 38 | 41 | bool MenuScriptingInterface::menuExists(const QString& menu) { |
| 42 | + if (QThread::currentThread() == qApp->thread()) { | |
| 43 | + return Menu::getInstance()->menuExists(menu); | |
| 44 | + } | |
| 39 | 45 | bool result; |
| 40 | 46 | QMetaObject::invokeMethod(Menu::getInstance(), "menuExists", Qt::BlockingQueuedConnection, |
| 41 | 47 | Q_RETURN_ARG(bool, result), |
| @@ -76,11 +82,14 @@ void MenuScriptingInterface::removeMenuItem(const QString& menu, const QString& · 34 unmodified lines | ||
| 76 | 82 | }; |
| 77 | 83 | |
| 78 | 84 | bool MenuScriptingInterface::menuItemExists(const QString& menu, const QString& menuitem) { |
| 85 | + if (QThread::currentThread() == qApp->thread()) { | |
| 86 | + return Menu::getInstance()->menuItemExists(menu, menuitem); | |
| 87 | + } | |
| 79 | 88 | bool result; |
| 80 | 89 | QMetaObject::invokeMethod(Menu::getInstance(), "menuItemExists", Qt::BlockingQueuedConnection, |
| 81 | − Q_RETURN_ARG(bool, result), | |
| 82 | − Q_ARG(const QString&, menu), | |
| 83 | − Q_ARG(const QString&, menuitem)); | |
| 90 | + Q_RETURN_ARG(bool, result), | |
| 91 | + Q_ARG(const QString&, menu), | |
| 92 | + Q_ARG(const QString&, menuitem)); | |
| 84 | 93 | return result; |
| 85 | 94 | } |
| 86 | 95 | |
| @@ -101,6 +110,9 @@ void MenuScriptingInterface::removeActionGroup(const QString& groupName) { · 14 unmodified lines | ||
| 101 | 110 | } |
| 102 | 111 | |
| 103 | 112 | bool MenuScriptingInterface::isOptionChecked(const QString& menuOption) { |
| 113 | + if (QThread::currentThread() == qApp->thread()) { | |
| 114 | + return Menu::getInstance()->isOptionChecked(menuOption); | |
| 115 | + } | |
| 104 | 116 | bool result; |
| 105 | 117 | QMetaObject::invokeMethod(Menu::getInstance(), "isOptionChecked", Qt::BlockingQueuedConnection, |
| 106 | 118 | Q_RETURN_ARG(bool, result), |
| @@ -109,7 +121,7 @@ bool MenuScriptingInterface::isOptionChecked(const QString& menuOption) { · 2 unmodified lines | ||
| 109 | 121 | } |
| 110 | 122 | |
| 111 | 123 | void MenuScriptingInterface::setIsOptionChecked(const QString& menuOption, bool isChecked) { |
| 112 | − QMetaObject::invokeMethod(Menu::getInstance(), "setIsOptionChecked", Qt::BlockingQueuedConnection, | |
| 124 | + QMetaObject::invokeMethod(Menu::getInstance(), "setIsOptionChecked", | |
| 113 | 125 | Q_ARG(const QString&, menuOption), |
| 114 | 126 | Q_ARG(bool, isChecked)); |
| 115 | 127 | } |