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