1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-22 10:42:29 +01: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" state: "inactive"
property bool hasPreviewGif: false property bool hasPreviewGif: false
onContentFolderNameChanged: { onContentFolderNameChanged: {
txtHeadline.text = App.installedListModel.get(root.contentFolderName).m_title; const item = App.installedListModel.get(root.contentFolderName);
const previewGiFilePath = Qt.resolvedUrl(App.globalVariables.localStoragePath + "/" + root.contentFolderName + "/" + App.installedListModel.get(root.contentFolderName).m_previewGIF); txtHeadline.text = item.m_title;
const previewImageFilePath = Qt.resolvedUrl(App.globalVariables.localStoragePath + "/" + root.contentFolderName + "/" + App.installedListModel.get(root.contentFolderName).m_preview); 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); root.hasPreviewGif = App.util.fileExists(previewGiFilePath);
if (hasPreviewGif) { if (hasPreviewGif) {
animatedImagePreview.source = previewGiFilePath; animatedImagePreview.source = previewGiFilePath;

View File

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