mirror of
https://github.com/YACReader/yacreader
synced 2026-04-12 15:49:53 -04:00
Add support for loading image plugins through the settings folder of the apps.
This commit is contained in:
@ -1,5 +1,7 @@
|
||||
#include "global_info_provider.h"
|
||||
|
||||
#include "yacreader_global.h"
|
||||
|
||||
#include <QImageReader>
|
||||
#include <QPaintDevice>
|
||||
#include <QtCore>
|
||||
@ -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"));
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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();
|
||||
|
||||
Reference in New Issue
Block a user