diff --git a/CHANGELOG.md b/CHANGELOG.md index 968ce1bec..d1cb487f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,9 @@ Version counting is based on semantic versioning (Major.Feature.Patch) * Add a theme editor and support for custom themes. * Add an application language setting with a system default option in YACReader and YACReaderLibrary. +### All apps +* Add support for user-installed Qt image format plugins via the shared `plugins/imageformats` folder in the YACReader settings directory. + ## 9.16.4 ### YACReaderLibrary diff --git a/YACReader/main.cpp b/YACReader/main.cpp index 4a554d85a..c4485b6c6 100644 --- a/YACReader/main.cpp +++ b/YACReader/main.cpp @@ -114,6 +114,7 @@ int main(int argc, char *argv[]) app.setApplicationName("YACReader"); app.setOrganizationName("YACReader"); + YACReader::initializeSharedPluginPaths(); auto *appearanceConfig = new AppearanceConfiguration( YACReader::getSettingsPath() + "/YACReader.ini", qApp); diff --git a/YACReaderLibrary/main.cpp b/YACReaderLibrary/main.cpp index b14bd4636..2494fc6d9 100644 --- a/YACReaderLibrary/main.cpp +++ b/YACReaderLibrary/main.cpp @@ -140,6 +140,7 @@ int main(int argc, char **argv) app.setApplicationName("YACReaderLibrary"); app.setOrganizationName("YACReader"); app.setApplicationVersion(VERSION); + YACReader::initializeSharedPluginPaths(); // Theme initialization auto *appearanceConfig = new AppearanceConfiguration( diff --git a/YACReaderLibraryServer/main.cpp b/YACReaderLibraryServer/main.cpp index a774e4268..fc988ec7e 100644 --- a/YACReaderLibraryServer/main.cpp +++ b/YACReaderLibraryServer/main.cpp @@ -48,6 +48,7 @@ int main(int argc, char **argv) app.setApplicationName("YACReaderLibrary"); app.setOrganizationName("YACReader"); + YACReader::initializeSharedPluginPaths(); QString buildNumber = ".0"; diff --git a/common/global_info_provider.cpp b/common/global_info_provider.cpp index 22828992c..b3ca5a93d 100644 --- a/common/global_info_provider.cpp +++ b/common/global_info_provider.cpp @@ -1,5 +1,7 @@ #include "global_info_provider.h" +#include "yacreader_global.h" + #include #include #include @@ -24,6 +26,7 @@ QString YACReader::getGlobalInfo() text.append("\nAPP INFORMATION\n"); QString supportedImageFormats = QImageReader::supportedImageFormats().join(", "); text.append(QString("Image formats supported: %1\n").arg(supportedImageFormats)); + text.append(QString("User image plugin folder: %1\n").arg(YACReader::getImageFormatsPluginsPath())); // append if sqlite driver is available #ifdef YACREADER_LIBRARY text.append(QString("SQLite driver available: %1\n").arg(QSqlDatabase::isDriverAvailable("QSQLITE") ? "yes" : "no")); diff --git a/common/yacreader_global.cpp b/common/yacreader_global.cpp index 1054070f1..5d89304ba 100644 --- a/common/yacreader_global.cpp +++ b/common/yacreader_global.cpp @@ -12,6 +12,40 @@ QString YACReader::getSettingsPath() return QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation); } +QString YACReader::getCommonSettingsPath() +{ + const auto organizationName = QCoreApplication::organizationName().trimmed(); + const auto basePath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation); + + if (organizationName.isEmpty()) + return basePath; + + return QDir(basePath).filePath(organizationName); +} + +QString YACReader::getCommonSettingsFilePath() +{ + return QDir(getCommonSettingsPath()).filePath("YACReaderCommon.ini"); +} + +QString YACReader::getPluginsPath() +{ + return QDir(getCommonSettingsPath()).filePath("plugins"); +} + +QString YACReader::getImageFormatsPluginsPath() +{ + return QDir(getPluginsPath()).filePath("imageformats"); +} + +void YACReader::initializeSharedPluginPaths() +{ + QDir().mkpath(getImageFormatsPluginsPath()); + + const QString pluginsPath = QDir(getPluginsPath()).absolutePath(); + QCoreApplication::addLibraryPath(pluginsPath); +} + QString YACReader::colorToName(LabelColors colors) { switch (colors) { diff --git a/common/yacreader_global.h b/common/yacreader_global.h index b2a44e91d..750e6c9a2 100644 --- a/common/yacreader_global.h +++ b/common/yacreader_global.h @@ -103,6 +103,11 @@ QDataStream &operator<<(QDataStream &stream, const OpenComicSource &source); QDataStream &operator>>(QDataStream &stream, OpenComicSource &source); QString getSettingsPath(); +QString getCommonSettingsPath(); +QString getCommonSettingsFilePath(); +QString getPluginsPath(); +QString getImageFormatsPluginsPath(); +void initializeSharedPluginPaths(); QString colorToName(LabelColors colors); QString labelColorToRGBString(LabelColors color); QLibrary *load7zLibrary(); diff --git a/custom_widgets/whats_new_controller.cpp b/custom_widgets/whats_new_controller.cpp index 8e4b38048..c5c696a05 100644 --- a/custom_widgets/whats_new_controller.cpp +++ b/custom_widgets/whats_new_controller.cpp @@ -7,9 +7,7 @@ YACReader::WhatsNewController::WhatsNewController() { } void YACReader::WhatsNewController::showWhatsNewIfNeeded(QWidget *fromParent) { - QSettings commonSettings(QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + - "/YACReader/YACReaderCommon.ini", - QSettings::IniFormat); + QSettings commonSettings(YACReader::getCommonSettingsFilePath(), QSettings::IniFormat); if (commonSettings.value("LAST_VERSION_INSTALLED").toString() != VERSION) { showWhatsNew(fromParent); diff --git a/custom_widgets/whats_new_dialog.cpp b/custom_widgets/whats_new_dialog.cpp index 0378bab58..7fd3be6b1 100644 --- a/custom_widgets/whats_new_dialog.cpp +++ b/custom_widgets/whats_new_dialog.cpp @@ -57,6 +57,9 @@ YACReader::WhatsNewDialog::WhatsNewDialog(QWidget *parent) " • Add a theme editor and support for custom themes
" " • Add an application language setting with a system default option in YACReader and YACReaderLibrary
" "
" + "All apps
" + " • Add support for user-installed Qt image format plugins via the shared plugins/imageformats folder in the YACReader settings directory
" + "
" "I hope you enjoy the new update. Please, if you like YACReader consider to become a patron in Patreon " "or donate some money using Pay-Pal and help keeping the project alive. " "Remember that there is an iOS version available in the Apple App Store, "