diff --git a/.github/workflows/build-libfp-windows.yml b/.github/workflows/build-libfp-windows.yml index 9667e4e..4348598 100644 --- a/.github/workflows/build-libfp-windows.yml +++ b/.github/workflows/build-libfp-windows.yml @@ -37,7 +37,7 @@ jobs: - name: Install Qt (custom build) uses: oblivioncth/actions/general/install-and-cache-qt-from-ffynnon@dev with: - version: 6.4.2 + version: 6.5.1 os: windows compiler: msvc2022 linkage: ${{ matrix.lib_linkage }} diff --git a/CMakeLists.txt b/CMakeLists.txt index 526f53c..dbb6bea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ cmake_minimum_required(VERSION 3.23.0...3.25.0) # Project # NOTE: DON'T USE TRAILING ZEROS IN VERSIONS project(libfp - VERSION 0.4 + VERSION 0.4.1 LANGUAGES CXX DESCRIPTION "C++ support library for Flashpoint Archive" ) diff --git a/lib/include/fp/fp-install.h b/lib/include/fp/fp-install.h index 089030c..aed678d 100644 --- a/lib/include/fp/fp-install.h +++ b/lib/include/fp/fp-install.h @@ -86,8 +86,9 @@ enum class Edition {Ultimate, Infinity, Core}; // Files and directories QDir mRootDirectory; - QDir mLogosDirectory; - QDir mScreenshotsDirectory; + QDir mPlatformLogosDirectory; + QDir mEntryLogosDirectory; + QDir mEntryScreenshotsDirectory; QDir mExtrasDirectory; QDir mPlaylistsDirectory; std::unique_ptr mLauncherFile; @@ -158,11 +159,12 @@ enum class Edition {Ultimate, Infinity, Core}; // Data access QString fullPath() const; - QDir logosDirectory() const; - QDir screenshotsDirectory() const; + QDir entryLogosDirectory() const; + QDir entryScreenshotsDirectory() const; QDir extrasDirectory() const; - QString imageLocalPath(ImageType imageType, const QUuid& gameId) const; - QUrl imageRemoteUrl(ImageType imageType, const QUuid& gameId) const; + QString platformLogoPath(const QString& platform); + QString entryImageLocalPath(ImageType imageType, const QUuid& gameId) const; + QUrl entryImageRemoteUrl(ImageType imageType, const QUuid& gameId) const; const MacroResolver* macroResolver() const; // Helper diff --git a/lib/include/fp/settings/fp-preferences.h b/lib/include/fp/settings/fp-preferences.h index 0300a00..50f0dfb 100644 --- a/lib/include/fp/settings/fp-preferences.h +++ b/lib/include/fp/settings/fp-preferences.h @@ -45,6 +45,7 @@ struct FP_FP_EXPORT Preferences : public Settings QHash gameDataSources; QHash gameMetadataSources; QString imageFolderPath; + QString logoFolderPath; QString playlistFolderPath; QString jsonFolderPath; QString htdocsFolderPath; diff --git a/lib/src/fp-install.cpp b/lib/src/fp-install.cpp index e6b4381..255df29 100644 --- a/lib/src/fp-install.cpp +++ b/lib/src/fp-install.cpp @@ -62,8 +62,9 @@ Install::Install(QString installPath, bool preloadPlaylists) : mServicesJsonFile = std::make_shared(installPath + u"/"_s + mPreferences.jsonFolderPath + u"/"_s + SERVICES_JSON_NAME); mExecsJsonFile = std::make_shared(installPath + u"/"_s + mPreferences.jsonFolderPath + u"/"_s + EXECS_JSON_NAME); - mLogosDirectory = QDir(installPath + u"/"_s + mPreferences.imageFolderPath + '/' + LOGOS_FOLDER_NAME); - mScreenshotsDirectory = QDir(installPath + u"/"_s + mPreferences.imageFolderPath + '/' + SCREENSHOTS_FOLDER_NAME); + mPlatformLogosDirectory = QDir(installPath + u"/"_s + mPreferences.logoFolderPath); + mEntryLogosDirectory = QDir(installPath + u"/"_s + mPreferences.imageFolderPath + '/' + LOGOS_FOLDER_NAME); + mEntryScreenshotsDirectory = QDir(installPath + u"/"_s + mPreferences.imageFolderPath + '/' + SCREENSHOTS_FOLDER_NAME); mPlaylistsDirectory = QDir(installPath + u"/"_s + mPreferences.playlistFolderPath); ServicesReader servicesReader(&mServices, mServicesJsonFile, mMacroResolver); @@ -153,8 +154,9 @@ void Install::nullify() { // Files and directories mRootDirectory = QDir(); - mLogosDirectory = QDir(); - mScreenshotsDirectory = QDir(); + mPlatformLogosDirectory = QDir(); + mEntryLogosDirectory = QDir(); + mEntryScreenshotsDirectory = QDir(); mExtrasDirectory = QDir(); mPlaylistsDirectory = QDir(); mLauncherFile.reset(); @@ -232,20 +234,26 @@ const Services& Install::services() const { return mServices; } const Execs& Install::execs() const { return mExecs; } QString Install::fullPath() const { return mRootDirectory.absolutePath(); } -QDir Install::logosDirectory() const { return mLogosDirectory; } -QDir Install::screenshotsDirectory() const { return mScreenshotsDirectory; } +QDir Install::entryLogosDirectory() const { return mEntryLogosDirectory; } +QDir Install::entryScreenshotsDirectory() const { return mEntryScreenshotsDirectory; } QDir Install::extrasDirectory() const { return mExtrasDirectory; } -QString Install::imageLocalPath(ImageType imageType, const QUuid& gameId) const +QString Install::platformLogoPath(const QString& platform) { - const QDir& sourceDir = imageType == ImageType::Logo ? mLogosDirectory : mScreenshotsDirectory; + QString path = mPlatformLogosDirectory.absoluteFilePath(platform + IMAGE_UC_EXT); + return QFile::exists(path) ? path : QString(); +} + +QString Install::entryImageLocalPath(ImageType imageType, const QUuid& gameId) const +{ + const QDir& sourceDir = imageType == ImageType::Logo ? mEntryLogosDirectory : mEntryScreenshotsDirectory; bool compressed = mPreferences.onDemandImagesCompressed; QString localSubPath = standardImageSubPath(gameId) + (compressed ? IMAGE_C_EXT : IMAGE_UC_EXT); return sourceDir.absolutePath() + '/' + localSubPath; } -QUrl Install::imageRemoteUrl(ImageType imageType, const QUuid& gameId) const +QUrl Install::entryImageRemoteUrl(ImageType imageType, const QUuid& gameId) const { const QString typeFolder = (imageType == ImageType::Logo ? LOGOS_FOLDER_NAME : SCREENSHOTS_FOLDER_NAME); bool compressed = mPreferences.onDemandImagesCompressed; diff --git a/lib/src/settings/fp-preferences.cpp b/lib/src/settings/fp-preferences.cpp index aa66ca3..c1428ba 100644 --- a/lib/src/settings/fp-preferences.cpp +++ b/lib/src/settings/fp-preferences.cpp @@ -45,6 +45,7 @@ QX_JSON_STRUCT_OUTSIDE(Fp::Preferences, gameDataSources, gameMetadataSources, imageFolderPath, + logoFolderPath, playlistFolderPath, jsonFolderPath, htdocsFolderPath,