Skip to content

Commit

Permalink
Merge pull request #21 from oblivioncth/dev
Browse files Browse the repository at this point in the history
Merge to master for v0.4.1
  • Loading branch information
oblivioncth authored Jul 25, 2023
2 parents fc10585 + 75ccd99 commit 31911e4
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-libfp-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down
14 changes: 8 additions & 6 deletions lib/include/fp/fp-install.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<QFile> mLauncherFile;
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions lib/include/fp/settings/fp-preferences.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ struct FP_FP_EXPORT Preferences : public Settings
QHash<QString, GameDataSource> gameDataSources;
QHash<QString, GameMetadataSource> gameMetadataSources;
QString imageFolderPath;
QString logoFolderPath;
QString playlistFolderPath;
QString jsonFolderPath;
QString htdocsFolderPath;
Expand Down
26 changes: 17 additions & 9 deletions lib/src/fp-install.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ Install::Install(QString installPath, bool preloadPlaylists) :

mServicesJsonFile = std::make_shared<QFile>(installPath + u"/"_s + mPreferences.jsonFolderPath + u"/"_s + SERVICES_JSON_NAME);
mExecsJsonFile = std::make_shared<QFile>(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);
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions lib/src/settings/fp-preferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ QX_JSON_STRUCT_OUTSIDE(Fp::Preferences,
gameDataSources,
gameMetadataSources,
imageFolderPath,
logoFolderPath,
playlistFolderPath,
jsonFolderPath,
htdocsFolderPath,
Expand Down

0 comments on commit 31911e4

Please sign in to comment.