diff options
author | Tomi Korpipaa <tomi.korpipaa@qt.io> | 2018-06-07 07:53:05 +0300 |
---|---|---|
committer | Tomi Korpipää <tomi.korpipaa@qt.io> | 2018-06-07 09:44:36 +0000 |
commit | 103309d9c7ab10fc1b48723c2a2f4721ef91c973 (patch) | |
tree | 0ed8b94851e661942cfaa70c0ff005ed1e9d503d | |
parent | 00ff23e48760833a82255d310f4a1feb7cc2bf94 (diff) |
Open the correct uia file for sub-presentation and data input parsing
Task-number: QT3DS-1890
Change-Id: Ie12ce196ea283299c830fc938eb5e6840e0647b7
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
-rw-r--r-- | src/Authoring/Client/Code/Core/Doc/Doc.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/Authoring/Client/Code/Core/Doc/Doc.cpp b/src/Authoring/Client/Code/Core/Doc/Doc.cpp index c32dab35..aca3ff23 100644 --- a/src/Authoring/Client/Code/Core/Doc/Doc.cpp +++ b/src/Authoring/Client/Code/Core/Doc/Doc.cpp @@ -2837,19 +2837,27 @@ QString CDoc::GetDocumentUIAFile(bool master) = Q3DStudio::CFilePath(GetDocumentPath().GetName()).GetFileStem(); QString file; + QString masterFile; std::vector<Q3DStudio::CFilePath> dirFiles; Q3DStudio::CFilePath thePath(docDir); thePath.ListFilesAndDirectories(dirFiles); for (size_t idx = 0, end = dirFiles.size(); idx < end; ++idx) { - if (dirFiles[idx].IsFile()) { - Q3DStudio::CString ext = dirFiles[idx].GetExtension(); - if (ext.CompareNoCase("uia") && (master || dirFiles[idx].GetFileStem() == docName)) { - file = dirFiles[idx].toQString(); + Q3DStudio::CFilePath dirEntry = dirFiles[idx]; + if (dirEntry.IsFile() && dirEntry.GetExtension().CompareNoCase("uia")) { + // First check if there is an *.uia file with the same name as the *.uip + // If there is, that's what we want + // If not, then check if we are looking for the master *.uia, and take that instead + if (dirEntry.GetFileStem() == docName) { + file = dirEntry.toQString(); + // We found what we're looking for, so stop looking break; + } else if (master) { + masterFile = dirEntry.toQString(); + // Keep looking, as we may still find another *.uia with the correct name } } } - return file; + return file.isEmpty() ? masterFile : file; } void CDoc::UpdateDatainputMap( |