drafting the interface

This commit is contained in:
Sam Gateau 2017-11-14 00:40:37 -08:00
parent 02c60c425e
commit fc53c26190
2 changed files with 41 additions and 2 deletions

View file

@ -77,11 +77,36 @@ bool SelectionScriptingInterface::clearSelectedItemsList(const QString& listName
return true;
}
bool SelectionScriptingInterface::enableListHighlight(const QString& listName, const QVariantMap& highlightStyle) {
bool SelectionScriptingInterface::enableListHighlight(const QString& listName, const QVariantMap& highlightStyleValues) {
auto highlightStyle = _highlightedListMap.value(listName);
if (!highlightStyle.isBoundToList()) {
GameplayObjects currentList = _selectedItemsListMap.value(listName);
if (!currentList.getContainsData()) {
_selectedItemsListMap.insert(listName, currentList);
}
}
highlightStyle.fromVariantMap(highlightStyleValues);
highlightStyle.setBoundToList(true);
_highlightedListMap.insert(listName, highlightStyle);
emit selectedItemsListChanged(listName);
return true;
}
bool SelectionScriptingInterface::disableListHighlight(const QString& listName) {
auto highlightStyle = _highlightedListMap.find(listName);
if (highlightStyle != _highlightedListMap.end()) {
if ((*highlightStyle).isBoundToList()) {
GameplayObjects currentList = _selectedItemsListMap.value(listName);
if (currentList.getContainsData()) {
}
_highlightedListMap.erase(highlightStyle);
}
}
return true;
}
@ -211,3 +236,11 @@ void SelectionToSceneHandler::updateSceneFromSelectedList() {
qWarning() << "SelectionToSceneHandler::updateRendererSelectedList(), Unexpected null scene, possibly during application shutdown";
}
}
bool SelectionHighlightStyle::fromVariantMap(const QVariantMap& properties) {
return true;
}
QVariantMap SelectionHighlightStyle::toVariantMap() const {
return QVariantMap();
}

View file

@ -52,10 +52,14 @@ class SelectionHighlightStyle {
public:
SelectionHighlightStyle() {}
void setBoundToList(bool bound) { _isBoundToList = bound; }
bool isBoundToList() const { return _isBoundToList; }
bool fromVariantMap(const QVariantMap& properties);
QVariantMap toVariantMap() const;
protected:
bool _isBoundToList{ false };
};
@ -117,6 +121,8 @@ signals:
private:
QMap<QString, GameplayObjects> _selectedItemsListMap;
QMap<QString, SelectionHighlightStyle> _highlightedListMap;
template <class T> bool addToGameplayObjects(const QString& listName, T idToAdd);
template <class T> bool removeFromGameplayObjects(const QString& listName, T idToRemove);
};