diff --git a/YUViewLib/src/common/EnumMapper.h b/YUViewLib/src/common/EnumMapper.h index c58c3f4ce..4992a0081 100644 --- a/YUViewLib/src/common/EnumMapper.h +++ b/YUViewLib/src/common/EnumMapper.h @@ -36,6 +36,7 @@ #include #include #include +#include /* This class implement mapping of "enum class" values to and from names (string). */ diff --git a/YUViewLib/src/playlistitem/playlistItemCompressedVideo.cpp b/YUViewLib/src/playlistitem/playlistItemCompressedVideo.cpp index 8f0648d2f..63c31c076 100644 --- a/YUViewLib/src/playlistitem/playlistItemCompressedVideo.cpp +++ b/YUViewLib/src/playlistitem/playlistItemCompressedVideo.cpp @@ -360,19 +360,14 @@ void playlistItemCompressedVideo::savePlaylist(QDomElement &root, const QDir &pl { auto filename = this->properties().name; - // Determine the relative path to the HEVC file. We save both in the playlist. - QUrl fileURL(filename); - fileURL.setScheme("file"); - QString relativePath = playlistDir.relativeFilePath(filename); - YUViewDomElement d = root.ownerDocument().createElement("playlistItemCompressedVideo"); // Append the properties of the playlistItem playlistItem::appendPropertiesToPlaylist(d); // Append all the properties of the HEVC file (the path to the file. Relative and absolute) - d.appendProperiteChild("absolutePath", fileURL.toString()); - d.appendProperiteChild("relativePath", relativePath); + d.appendProperiteChild("absolutePath", playlistDir.absoluteFilePath(filename)); + d.appendProperiteChild("relativePath", playlistDir.relativeFilePath(filename)); d.appendProperiteChild("displayComponent", QString::number(loadingDecoder ? loadingDecoder->getDecodeSignal() : -1)); diff --git a/YUViewLib/src/playlistitem/playlistItemImageFile.cpp b/YUViewLib/src/playlistitem/playlistItemImageFile.cpp index 6fd6476d8..a898d4610 100644 --- a/YUViewLib/src/playlistitem/playlistItemImageFile.cpp +++ b/YUViewLib/src/playlistitem/playlistItemImageFile.cpp @@ -35,7 +35,6 @@ #include #include #include -#include #include "common/functionsGui.h" #include "filesource/FileSource.h" @@ -85,19 +84,14 @@ void playlistItemImageFile::savePlaylist(QDomElement &root, const QDir &playlist { const auto filename = this->properties().name; - // Determine the relative path to the raw file. We save both in the playlist. - QUrl fileURL(filename); - fileURL.setScheme("file"); - QString relativePath = playlistDir.relativeFilePath(filename); - YUViewDomElement d = root.ownerDocument().createElement("playlistItemImageFile"); // Append the properties of the playlistItem playlistItem::appendPropertiesToPlaylist(d); // Append all the properties of the raw file (the path to the file. Relative and absolute) - d.appendProperiteChild("absolutePath", fileURL.toString()); - d.appendProperiteChild("relativePath", relativePath); + d.appendProperiteChild("absolutePath", playlistDir.absoluteFilePath(filename)); + d.appendProperiteChild("relativePath", playlistDir.relativeFilePath(filename)); root.appendChild(d); } @@ -109,11 +103,11 @@ playlistItemImageFile::newplaylistItemImageFile(const YUViewDomElement &root, const QString & playlistFilePath) { // Parse the DOM element. It should have all values of a playlistItemImageFile - QString absolutePath = root.findChildValue("absolutePath"); - QString relativePath = root.findChildValue("relativePath"); + auto absolutePath = root.findChildValue("absolutePath"); + auto relativePath = root.findChildValue("relativePath"); // check if file with absolute path exists, otherwise check relative path - QString filePath = + auto filePath = FileSource::getAbsPathFromAbsAndRel(playlistFilePath, absolutePath, relativePath); if (filePath.isEmpty()) return nullptr; diff --git a/YUViewLib/src/playlistitem/playlistItemImageFileSequence.cpp b/YUViewLib/src/playlistitem/playlistItemImageFileSequence.cpp index ae1f5d56a..3d337de45 100644 --- a/YUViewLib/src/playlistitem/playlistItemImageFileSequence.cpp +++ b/YUViewLib/src/playlistitem/playlistItemImageFileSequence.cpp @@ -34,7 +34,6 @@ #include #include -#include #include "common/functionsGui.h" #include "filesource/FileSource.h" @@ -199,14 +198,9 @@ void playlistItemImageFileSequence::savePlaylist(QDomElement &root, const QDir & // Put a list of all input files into the playlist for (int i = 0; i < imageFiles.length(); i++) { - // Determine the relative path to the file. We save both in the playlist. - QUrl fileURL(imageFiles[i]); - fileURL.setScheme("file"); - QString relativePath = playlistDir.relativeFilePath(imageFiles[i]); - // Append the relative and absolute path to the file - d.appendProperiteChild(QString("file%1_absolutePath").arg(i), fileURL.toString()); - d.appendProperiteChild(QString("file%1_relativePath").arg(i), relativePath); + d.appendProperiteChild(QString("file%1_absolutePath").arg(i), playlistDir.absoluteFilePath(imageFiles[i])); + d.appendProperiteChild(QString("file%1_relativePath").arg(i), playlistDir.relativeFilePath(imageFiles[i])); } root.appendChild(d); diff --git a/YUViewLib/src/playlistitem/playlistItemRawFile.cpp b/YUViewLib/src/playlistitem/playlistItemRawFile.cpp index b48adf277..b90e49539 100644 --- a/YUViewLib/src/playlistitem/playlistItemRawFile.cpp +++ b/YUViewLib/src/playlistitem/playlistItemRawFile.cpp @@ -33,7 +33,6 @@ #include "playlistItemRawFile.h" #include -#include #include #include "common/functions.h" @@ -443,10 +442,7 @@ void playlistItemRawFile::createPropertiesWidget() void playlistItemRawFile::savePlaylist(QDomElement &root, const QDir &playlistDir) const { - // Determine the relative path to the raw file. We save both in the playlist. - QUrl fileURL(dataSource.getAbsoluteFilePath()); - fileURL.setScheme("file"); - auto relativePath = playlistDir.relativeFilePath(dataSource.getAbsoluteFilePath()); + auto filename = dataSource.getAbsoluteFilePath(); auto d = YUViewDomElement(root.ownerDocument().createElement("playlistItemRawFile")); @@ -454,8 +450,8 @@ void playlistItemRawFile::savePlaylist(QDomElement &root, const QDir &playlistDi playlistItem::appendPropertiesToPlaylist(d); // Append all the properties of the raw file (the path to the file. Relative and absolute) - d.appendProperiteChild("absolutePath", fileURL.toString()); - d.appendProperiteChild("relativePath", relativePath); + d.appendProperiteChild("absolutePath", playlistDir.absoluteFilePath(filename)); + d.appendProperiteChild("relativePath", playlistDir.relativeFilePath(filename)); d.appendProperiteChild(std::string("type"), (rawFormat == raw_YUV) ? "YUV" : "RGB"); this->video->savePlaylist(d); @@ -480,7 +476,7 @@ playlistItemRawFile *playlistItemRawFile::newplaylistItemRawFile(const YUViewDom // We can still not be sure that the file really exists, but we gave our best to try to find it. auto newFile = new playlistItemRawFile(filePath, {}, {}, type); - + newFile->video->loadPlaylist(root); playlistItem::loadPropertiesFromPlaylist(root, newFile); diff --git a/YUViewLib/src/playlistitem/playlistItemStatisticsFile.cpp b/YUViewLib/src/playlistitem/playlistItemStatisticsFile.cpp index 78a95a669..2ad75fd14 100644 --- a/YUViewLib/src/playlistitem/playlistItemStatisticsFile.cpp +++ b/YUViewLib/src/playlistitem/playlistItemStatisticsFile.cpp @@ -34,7 +34,6 @@ #include #include -#include #include #include #include @@ -104,8 +103,8 @@ playlistItemStatisticsFile *playlistItemStatisticsFile::newplaylistItemStatistic const YUViewDomElement &root, const QString &playlistFilePath, OpenMode openMode) { // Parse the DOM element. It should have all values of a playlistItemStatisticsFile - auto absolutePath = root.findChildValue("absolutePath"); - auto relativePath = root.findChildValue("relativePath"); + auto absolutePath = root.findChildValue("absolutePath"); + auto relativePath = root.findChildValue("relativePath"); // check if file with absolute path exists, otherwise check relative path auto filePath = FileSource::getAbsPathFromAbsAndRel(playlistFilePath, absolutePath, relativePath); @@ -152,11 +151,7 @@ void playlistItemStatisticsFile::drawItem(QPainter *painter, int frameIdx, doubl void playlistItemStatisticsFile::savePlaylist(QDomElement &root, const QDir &playlistDir) const { - // Determine the relative path to the YUV file-> We save both in the playlist. - auto absolutePath = QFileInfo(this->prop.name).absoluteFilePath(); - QUrl fileURL(absolutePath); - fileURL.setScheme("file"); - auto relativePath = playlistDir.relativeFilePath(absolutePath); + auto filename = this->properties().name; YUViewDomElement d = root.ownerDocument().createElement("playlistItemStatisticsFile"); @@ -164,8 +159,8 @@ void playlistItemStatisticsFile::savePlaylist(QDomElement &root, const QDir &pla playlistItem::appendPropertiesToPlaylist(d); // Append all the properties of the YUV file (the path to the file-> Relative and absolute) - d.appendProperiteChild("absolutePath", fileURL.toString()); - d.appendProperiteChild("relativePath", relativePath); + d.appendProperiteChild("absolutePath", playlistDir.absoluteFilePath(filename)); + d.appendProperiteChild("relativePath", playlistDir.relativeFilePath(filename)); // Save the status of the statistics (which are shown, transparency ...) this->statisticsData.savePlaylist(d); diff --git a/YUViewLib/src/ui/widgets/PlaylistTreeWidget.cpp b/YUViewLib/src/ui/widgets/PlaylistTreeWidget.cpp index 384b56efa..000c0da48 100644 --- a/YUViewLib/src/ui/widgets/PlaylistTreeWidget.cpp +++ b/YUViewLib/src/ui/widgets/PlaylistTreeWidget.cpp @@ -217,10 +217,10 @@ void PlaylistTreeWidget::dropEvent(QDropEvent *event) if (event->mimeData()->hasUrls()) { QStringList fileList; - const QList urls = event->mimeData()->urls(); + const auto urls = event->mimeData()->urls(); for (auto &url : urls) { - QString fileName = url.toLocalFile(); + auto fileName = url.toLocalFile(); fileList.append(fileName); } event->acceptProposedAction(); @@ -233,7 +233,7 @@ void PlaylistTreeWidget::dropEvent(QDropEvent *event) else { // get the list of the items that are about to be dragged - QList dragItems = selectedItems(); + auto dragItems = selectedItems(); // Actually move all the items QTreeWidget::dropEvent(event);