Showing the changes to interface/src/scripting/SelectionScriptingInterface.cpp (1 of 2 files). Show all
Unified · Split
| @@ -72,12 +72,14 @@ bool SelectionScriptingInterface::removeFromSelectedItemsList(const QString& lis · 71 unmodified lines | ||
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | bool SelectionScriptingInterface::clearSelectedItemsList(const QString& listName) { |
| 75 | + // QWriteLocker lock(&_selectionListsLock); | |
| 75 | 76 | _selectedItemsListMap.insert(listName, GameplayObjects()); |
| 76 | 77 | onSelectedItemsListChanged(listName); |
| 77 | 78 | return true; |
| 78 | 79 | } |
| 79 | 80 | |
| 80 | 81 | bool SelectionScriptingInterface::enableListHighlight(const QString& listName, const QVariantMap& highlightStyleValues) { |
| 82 | + // QWriteLocker lock(&_selectionListsLock); | |
| 81 | 83 | |
| 82 | 84 | auto highlightStyle = _highlightedListMap.find(listName); |
| 83 | 85 | if (highlightStyle == _highlightedListMap.end()) { |
| @@ -111,6 +113,7 @@ bool SelectionScriptingInterface::enableListHighlight(const QString& listName, c · 27 unmodified lines | ||
| 111 | 113 | } |
| 112 | 114 | |
| 113 | 115 | bool SelectionScriptingInterface::disableListHighlight(const QString& listName) { |
| 116 | + // QWriteLocker lock(&_selectionListsLock); | |
| 114 | 117 | auto highlightStyle = _highlightedListMap.find(listName); |
| 115 | 118 | if (highlightStyle != _highlightedListMap.end()) { |
| 116 | 119 | // if ((*highlightStyle).isBoundToList()) { |
| @@ -134,6 +137,7 @@ bool SelectionScriptingInterface::disableListHighlight(const QString& listName) · 17 unmodified lines | ||
| 134 | 137 | } |
| 135 | 138 | |
| 136 | 139 | QVariantMap SelectionScriptingInterface::getListHighlightStyle(const QString& listName) const { |
| 140 | + // QReadLocker lock(&_selectionListsLock); | |
| 137 | 141 | auto highlightStyle = _highlightedListMap.find(listName); |
| 138 | 142 | if (highlightStyle == _highlightedListMap.end()) { |
| 139 | 143 | return QVariantMap(); |
| @@ -143,6 +147,7 @@ QVariantMap SelectionScriptingInterface::getListHighlightStyle(const QString& li · 3 unmodified lines | ||
| 143 | 147 | } |
| 144 | 148 | |
| 145 | 149 | render::HighlightStyle SelectionScriptingInterface::getHighlightStyle(const QString& listName) const { |
| 150 | + // QReadLocker lock(&_selectionListsLock); | |
| 146 | 151 | auto highlightStyle = _highlightedListMap.find(listName); |
| 147 | 152 | if (highlightStyle == _highlightedListMap.end()) { |
| 148 | 153 | return render::HighlightStyle(); |
| @@ -152,6 +157,8 @@ render::HighlightStyle SelectionScriptingInterface::getHighlightStyle(const QStr · 3 unmodified lines | ||
| 152 | 157 | } |
| 153 | 158 | |
| 154 | 159 | template <class T> bool SelectionScriptingInterface::addToGameplayObjects(const QString& listName, T idToAdd) { |
| 160 | + // QWriteLocker lock(&_selectionListsLock); | |
| 161 | + | |
| 155 | 162 | GameplayObjects currentList = _selectedItemsListMap.value(listName); |
| 156 | 163 | currentList.addToGameplayObjects(idToAdd); |
| 157 | 164 | _selectedItemsListMap.insert(listName, currentList); |
| @@ -160,6 +167,7 @@ template <class T> bool SelectionScriptingInterface::addToGameplayObjects(const · 2 unmodified lines | ||
| 160 | 167 | return true; |
| 161 | 168 | } |
| 162 | 169 | template <class T> bool SelectionScriptingInterface::removeFromGameplayObjects(const QString& listName, T idToRemove) { |
| 170 | + // QWriteLocker lock(&_selectionListsLock); | |
| 163 | 171 | GameplayObjects currentList = _selectedItemsListMap.value(listName); |
| 164 | 172 | if (currentList.getContainsData()) { |
| 165 | 173 | currentList.removeFromGameplayObjects(idToRemove); |
| @@ -176,10 +184,12 @@ template <class T> bool SelectionScriptingInterface::removeFromGameplayObjects(c · 10 unmodified lines | ||
| 176 | 184 | // |
| 177 | 185 | |
| 178 | 186 | GameplayObjects SelectionScriptingInterface::getList(const QString& listName) { |
| 187 | + // QReadLocker lock(&_selectionListsLock); | |
| 179 | 188 | return _selectedItemsListMap.value(listName); |
| 180 | 189 | } |
| 181 | 190 | |
| 182 | 191 | void SelectionScriptingInterface::printList(const QString& listName) { |
| 192 | + // QReadLocker lock(&_selectionListsLock); | |
| 183 | 193 | auto currentList = _selectedItemsListMap.find(listName); |
| 184 | 194 | if (currentList != _selectedItemsListMap.end()) { |
| 185 | 195 | if ((*currentList).getContainsData()) { |
| @@ -212,6 +222,7 @@ void SelectionScriptingInterface::printList(const QString& listName) { · 26 unmodified lines | ||
| 212 | 222 | } |
| 213 | 223 | |
| 214 | 224 | bool SelectionScriptingInterface::removeListFromMap(const QString& listName) { |
| 225 | + // QWriteLocker lock(&_selectionListsLock); | |
| 215 | 226 | if (_selectedItemsListMap.remove(listName)) { |
| 216 | 227 | onSelectedItemsListChanged(listName); |
| 217 | 228 | return true; |
| @@ -221,6 +232,7 @@ bool SelectionScriptingInterface::removeListFromMap(const QString& listName) { · 3 unmodified lines | ||
| 221 | 232 | } |
| 222 | 233 | |
| 223 | 234 | void SelectionScriptingInterface::setupHandler(const QString& selectionName) { |
| 235 | + // QWriteLocker lock(&_selectionListsLock); | |
| 224 | 236 | auto handler = _handlerMap.find(selectionName); |
| 225 | 237 | if (handler == _handlerMap.end()) { |
| 226 | 238 | handler = _handlerMap.insert(selectionName, new SelectionToSceneHandler()); |
| @@ -233,6 +245,7 @@ void SelectionScriptingInterface::setupHandler(const QString& selectionName) { · 6 unmodified lines | ||
| 233 | 245 | } |
| 234 | 246 | |
| 235 | 247 | void SelectionScriptingInterface::onSelectedItemsListChanged(const QString& listName) { |
| 248 | + // QWriteLocker lock(&_selectionListsLock); | |
| 236 | 249 | auto handler = _handlerMap.find(listName); |
| 237 | 250 | if (handler != _handlerMap.end()) { |
| 238 | 251 | (*handler)->updateSceneFromSelectedList(); |
| @@ -245,8 +258,6 @@ SelectionToSceneHandler::SelectionToSceneHandler() { · 6 unmodified lines | ||
| 245 | 258 | |
| 246 | 259 | void SelectionToSceneHandler::initialize(const QString& listName) { |
| 247 | 260 | _listName = listName; |
| 248 | − | |
| 249 | − | |
| 250 | 261 | updateSceneFromSelectedList(); |
| 251 | 262 | } |
| 252 | 263 | |