mirror of
https://github.com/YACReader/yacreader
synced 2026-04-12 15:49:53 -04:00
Format
This commit is contained in:
@ -28,7 +28,7 @@ QString readSvg(const QString &resourcePath)
|
||||
QFile in(resourcePath);
|
||||
if (!in.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
qWarning() << "Failed to open SVG resource:" << resourcePath;
|
||||
return {};
|
||||
return { };
|
||||
}
|
||||
|
||||
QString svg = QString::fromUtf8(in.readAll());
|
||||
@ -53,7 +53,7 @@ QString writeSvg(const QString &svg, const QString &resourcePath, const QString
|
||||
QFile out(outPath);
|
||||
if (!out.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) {
|
||||
qWarning() << "Failed to write SVG:" << outPath;
|
||||
return {};
|
||||
return { };
|
||||
}
|
||||
|
||||
out.write(svg.toUtf8());
|
||||
|
||||
@ -14,23 +14,23 @@ struct RecolorOptions {
|
||||
};
|
||||
|
||||
QString readSvg(const QString &resourcePath);
|
||||
QString writeSvg(const QString &svg, const QString &resourcePath, const QString &themeName, const RecolorOptions &options = {});
|
||||
QString writeSvg(const QString &svg, const QString &resourcePath, const QString &themeName, const RecolorOptions &options = { });
|
||||
|
||||
QString recolorSvgXML(QString &svg, const QString &placeHolder, const QColor &color);
|
||||
QString recoloredSvgToThemeFile(const QString &resourcePath,
|
||||
const QColor &color, // #f0f (magenta)
|
||||
const QString &themeName,
|
||||
const RecolorOptions &options = {});
|
||||
const RecolorOptions &options = { });
|
||||
QString recoloredSvgToThemeFile(const QString &resourcePath,
|
||||
const QColor &color1, // #f0f (magenta)
|
||||
const QColor &color2, // #0ff (cyan)
|
||||
const QString &themeName,
|
||||
const RecolorOptions &options = {});
|
||||
const RecolorOptions &options = { });
|
||||
QString recoloredSvgToThemeFile(const QString &resourcePath,
|
||||
const QColor &color1, // #f0f (magenta)
|
||||
const QColor &color2, // #0ff (cyan)
|
||||
const QColor &color3, // #ff0 (yellow)
|
||||
const QString &themeName,
|
||||
const RecolorOptions &options = {});
|
||||
const RecolorOptions &options = { });
|
||||
|
||||
#endif // ICON_UTILS_H
|
||||
|
||||
@ -133,7 +133,7 @@ ThemeEditorDialog::ThemeEditorDialog(const QJsonObject ¶ms, QWidget *parent)
|
||||
tree->setUniformRowHeights(true);
|
||||
tree->setAlternatingRowColors(true);
|
||||
|
||||
populate(nullptr, params, {});
|
||||
populate(nullptr, params, { });
|
||||
tree->expandAll();
|
||||
|
||||
connect(expandBtn, &QPushButton::clicked, tree, &QTreeWidget::expandAll);
|
||||
@ -425,7 +425,7 @@ void ThemeEditorDialog::loadFromFile()
|
||||
params = doc.object();
|
||||
syncMetaFromParams();
|
||||
tree->clear();
|
||||
populate(nullptr, params, {});
|
||||
populate(nullptr, params, { });
|
||||
tree->expandAll();
|
||||
emit themeJsonChanged(params);
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ Theme ThemeManager::themeFromId(const QString &id, ThemeVariant fallbackVariant)
|
||||
return makeTheme(json);
|
||||
}
|
||||
|
||||
return {};
|
||||
return { };
|
||||
}
|
||||
|
||||
void ThemeManager::resolveTheme()
|
||||
|
||||
@ -50,7 +50,7 @@ QJsonObject ThemeRepository::loadThemeJson(const QString &themeId) const
|
||||
if (u.id == themeId)
|
||||
return readJsonFile(u.filePath);
|
||||
|
||||
return {};
|
||||
return { };
|
||||
}
|
||||
|
||||
QString ThemeRepository::saveUserTheme(QJsonObject themeJson)
|
||||
@ -104,7 +104,7 @@ QString ThemeRepository::importThemeFromFile(const QString &filePath)
|
||||
{
|
||||
QJsonObject json = readJsonFile(filePath);
|
||||
if (json.isEmpty())
|
||||
return {};
|
||||
return { };
|
||||
|
||||
// Force a new user id regardless of what the file contains
|
||||
auto metaObj = json["meta"].toObject();
|
||||
@ -189,13 +189,13 @@ QJsonObject ThemeRepository::readJsonFile(const QString &path)
|
||||
{
|
||||
QFile file(path);
|
||||
if (!file.open(QIODevice::ReadOnly))
|
||||
return {};
|
||||
return { };
|
||||
|
||||
const QByteArray data = file.readAll();
|
||||
QJsonParseError error;
|
||||
const QJsonDocument doc = QJsonDocument::fromJson(data, &error);
|
||||
if (error.error != QJsonParseError::NoError)
|
||||
return {};
|
||||
return { };
|
||||
|
||||
return doc.object();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user