1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-10-06 09:17:07 +02:00

Fix and simplify sidebar path handling

This commit is contained in:
Elias Steurer 2023-08-04 09:29:33 +02:00
parent aebda377fc
commit 1d3847e9b7
2 changed files with 5 additions and 10 deletions

View File

@ -40,9 +40,10 @@ Item {
state: "inactive"
property bool hasPreviewGif: false
onContentFolderNameChanged: {
txtHeadline.text = App.installedListModel.get(root.contentFolderName).m_title;
const previewGiFilePath = Qt.resolvedUrl(App.globalVariables.localStoragePath + "/" + root.contentFolderName + "/" + App.installedListModel.get(root.contentFolderName).m_previewGIF);
const previewImageFilePath = Qt.resolvedUrl(App.globalVariables.localStoragePath + "/" + root.contentFolderName + "/" + App.installedListModel.get(root.contentFolderName).m_preview);
const item = App.installedListModel.get(root.contentFolderName);
txtHeadline.text = item.m_title;
const previewGiFilePath = Qt.resolvedUrl(item.m_absoluteStoragePath + "/" + item.m_previewGIF);
const previewImageFilePath = Qt.resolvedUrl( item.m_absoluteStoragePath + "/" + item.m_preview);
root.hasPreviewGif = App.util.fileExists(previewGiFilePath);
if (hasPreviewGif) {
animatedImagePreview.source = previewGiFilePath;

View File

@ -262,12 +262,6 @@ QVariantMap InstalledListModel::get(const QString& folderName) const
if (m_screenPlayFiles.count() == 0)
return {};
const QString localInstalledPath = ScreenPlayUtil::toLocal(m_globalVariables->localStoragePath().toString());
if (!QDir(localInstalledPath + "/" + folderName).exists()) {
return {};
}
for (const auto& item : m_screenPlayFiles) {
if (item.folderName == folderName) {
QVariantMap map;
@ -276,7 +270,7 @@ QVariantMap InstalledListModel::get(const QString& folderName) const
map.insert("m_previewGIF", item.previewGIF);
map.insert("m_file", item.file);
map.insert("m_type", QVariant::fromValue(item.type));
map.insert("m_absoluteStoragePath", QUrl::fromLocalFile(item.projectJsonFilePath.dir().path()));
map.insert("m_absoluteStoragePath", QUrl::fromLocalFile(item.projectJsonFilePath.dir().path()).toString());
map.insert("m_publishedFileID", item.publishedFileID);
map.insert("m_isNew", item.isNew);
map.insert("m_containsAudio", item.containsAudio);