From 1880495b000c3bc4eac819120c2dccfb03e4ce52 Mon Sep 17 00:00:00 2001 From: Janne Kangas Date: Wed, 22 Aug 2018 10:31:47 +0300 Subject: Parse datainput use from subpresentation files and check allowable types MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Search through controlledproperty tags in UIP files of subpresentations and store subpresentation id and datatypes controlled per datainput. Datainput that is in use in another presentation is indicated by highlight in datainput management dialog, similarly to ones in use in the current presentation. Task-id: QT3DS-2142 Change-Id: I7e40154e41863ff6123bb85348868f44ef0733cc Reviewed-by: Miikka Heikkinen Reviewed-by: Tomi Korpipää --- .../Studio/Application/DataInputListDlg.cpp | 32 ++++++++++++++++++++-- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'src/Authoring/Studio/Application/DataInputListDlg.cpp') diff --git a/src/Authoring/Studio/Application/DataInputListDlg.cpp b/src/Authoring/Studio/Application/DataInputListDlg.cpp index 238e3f3f..3b7cb0e2 100644 --- a/src/Authoring/Studio/Application/DataInputListDlg.cpp +++ b/src/Authoring/Studio/Application/DataInputListDlg.cpp @@ -187,7 +187,7 @@ void CDataInputListDlg::updateContents() dataInput.append(new QStandardItem(tr("Variant"))); } // highlight datainputs that are in use - if (it->controlledElems.size() != 0) + if (it->controlledElems.size() || it->externalPresBoundTypes.size()) dataInput.first()->setForeground(QBrush(CStudioPreferences::dataInputColor())); m_tableContents->appendRow(dataInput); } @@ -292,7 +292,10 @@ void CDataInputListDlg::onEditDataInput() // Only show types that are ok for _all_ currently controlled properties. // If datainput is not controlling any elements, all types are ok. + + // Datainput binding types QVector allowedTypes; + bool strictFound = false; if (di->controlledElems.size()) { for (auto type : qAsConst(di->boundTypes)) { // If we hit strict type requirement for a certain bound datatype, set allowed types @@ -309,13 +312,36 @@ void CDataInputListDlg::onEditDataInput() allowedTypes.append(t); } // if we just hit a strict type requirement we are finished + if (type.second) { + strictFound = true; + break; + } + } + } + + // Datainput bindings for all other presentations, unless we already have a + // strict type requirement + if (di->externalPresBoundTypes.size() && !strictFound) { + for (auto type : qAsConst(di->externalPresBoundTypes)) { + if (type.second) + allowedTypes.clear(); + + const auto acceptedTypes = CDataInputDlg::getAcceptedTypes(type.first, type.second); + + for (auto t : acceptedTypes) { + if (!allowedTypes.contains(t)) + allowedTypes.append(t); + } + // if we just hit a strict type requirement we are finished if (type.second) break; } - } else { - allowedTypes = allDataTypes; } + // no bindings in this or other presentations, all datatypes are ok + if (!allowedTypes.size()) + allowedTypes = allDataTypes; + CDataInputDlg datainputdialog(&di, m_tableContents, this, allowedTypes); datainputdialog.exec(); -- cgit v1.2.3