This commit is contained in:
luisangelsm
2026-03-05 10:54:41 +01:00
parent d8678bcf95
commit a876f33902
14 changed files with 92 additions and 92 deletions

View File

@ -231,11 +231,11 @@ Theme makeTheme(const QJsonObject &json)
if (json.contains("toolbar")) {
const auto t = json["toolbar"].toObject();
auto &tp = p.toolbarParams;
tp.iconColor = colorFromJson(t, "iconColor", tp.iconColor);
tp.iconDisabledColor = colorFromJson(t, "iconDisabledColor", tp.iconDisabledColor);
tp.iconCheckedColor = colorFromJson(t, "iconCheckedColor", tp.iconCheckedColor);
tp.backgroundColor = colorFromJson(t, "backgroundColor", tp.backgroundColor);
tp.separatorColor = colorFromJson(t, "separatorColor", tp.separatorColor);
tp.iconColor = colorFromJson(t, "iconColor", tp.iconColor);
tp.iconDisabledColor = colorFromJson(t, "iconDisabledColor", tp.iconDisabledColor);
tp.iconCheckedColor = colorFromJson(t, "iconCheckedColor", tp.iconCheckedColor);
tp.backgroundColor = colorFromJson(t, "backgroundColor", tp.backgroundColor);
tp.separatorColor = colorFromJson(t, "separatorColor", tp.separatorColor);
tp.checkedButtonColor = colorFromJson(t, "checkedButtonColor", tp.checkedButtonColor);
tp.menuIndicatorColor = colorFromJson(t, "menuIndicatorColor", tp.menuIndicatorColor);
}
@ -244,43 +244,43 @@ Theme makeTheme(const QJsonObject &json)
const auto v = json["viewer"].toObject();
auto &vp = p.viewerParams;
vp.defaultBackgroundColor = colorFromJson(v, "defaultBackgroundColor", vp.defaultBackgroundColor);
vp.defaultTextColor = colorFromJson(v, "defaultTextColor", vp.defaultTextColor);
vp.infoBackgroundColor = colorFromJson(v, "infoBackgroundColor", vp.infoBackgroundColor);
vp.infoTextColor = colorFromJson(v, "infoTextColor", vp.infoTextColor);
vp.defaultTextColor = colorFromJson(v, "defaultTextColor", vp.defaultTextColor);
vp.infoBackgroundColor = colorFromJson(v, "infoBackgroundColor", vp.infoBackgroundColor);
vp.infoTextColor = colorFromJson(v, "infoTextColor", vp.infoTextColor);
}
if (json.contains("goToFlowWidget")) {
const auto g = json["goToFlowWidget"].toObject();
auto &gp = p.goToFlowWidgetParams;
gp.flowBackgroundColor = colorFromJson(g, "flowBackgroundColor", gp.flowBackgroundColor);
gp.flowTextColor = colorFromJson(g, "flowTextColor", gp.flowTextColor);
gp.flowBackgroundColor = colorFromJson(g, "flowBackgroundColor", gp.flowBackgroundColor);
gp.flowTextColor = colorFromJson(g, "flowTextColor", gp.flowTextColor);
gp.toolbarBackgroundColor = colorFromJson(g, "toolbarBackgroundColor", gp.toolbarBackgroundColor);
gp.sliderBorderColor = colorFromJson(g, "sliderBorderColor", gp.sliderBorderColor);
gp.sliderGrooveColor = colorFromJson(g, "sliderGrooveColor", gp.sliderGrooveColor);
gp.sliderHandleColor = colorFromJson(g, "sliderHandleColor", gp.sliderHandleColor);
gp.editBorderColor = colorFromJson(g, "editBorderColor", gp.editBorderColor);
gp.editBackgroundColor = colorFromJson(g, "editBackgroundColor", gp.editBackgroundColor);
gp.editTextColor = colorFromJson(g, "editTextColor", gp.editTextColor);
gp.labelTextColor = colorFromJson(g, "labelTextColor", gp.labelTextColor);
gp.iconColor = colorFromJson(g, "iconColor", gp.iconColor);
gp.sliderBorderColor = colorFromJson(g, "sliderBorderColor", gp.sliderBorderColor);
gp.sliderGrooveColor = colorFromJson(g, "sliderGrooveColor", gp.sliderGrooveColor);
gp.sliderHandleColor = colorFromJson(g, "sliderHandleColor", gp.sliderHandleColor);
gp.editBorderColor = colorFromJson(g, "editBorderColor", gp.editBorderColor);
gp.editBackgroundColor = colorFromJson(g, "editBackgroundColor", gp.editBackgroundColor);
gp.editTextColor = colorFromJson(g, "editTextColor", gp.editTextColor);
gp.labelTextColor = colorFromJson(g, "labelTextColor", gp.labelTextColor);
gp.iconColor = colorFromJson(g, "iconColor", gp.iconColor);
}
if (json.contains("helpAboutDialog")) {
const auto h = json["helpAboutDialog"].toObject();
p.helpAboutDialogParams.headingColor = colorFromJson(h, "headingColor", p.helpAboutDialogParams.headingColor);
p.helpAboutDialogParams.linkColor = colorFromJson(h, "linkColor", p.helpAboutDialogParams.linkColor);
p.helpAboutDialogParams.linkColor = colorFromJson(h, "linkColor", p.helpAboutDialogParams.linkColor);
}
if (json.contains("whatsNewDialog")) {
const auto w = json["whatsNewDialog"].toObject();
auto &wn = p.whatsNewDialogParams;
wn.backgroundColor = colorFromJson(w, "backgroundColor", wn.backgroundColor);
wn.headerTextColor = colorFromJson(w, "headerTextColor", wn.headerTextColor);
wn.versionTextColor = colorFromJson(w, "versionTextColor", wn.versionTextColor);
wn.contentTextColor = colorFromJson(w, "contentTextColor", wn.contentTextColor);
wn.linkColor = colorFromJson(w, "linkColor", wn.linkColor);
wn.closeButtonColor = colorFromJson(w, "closeButtonColor", wn.closeButtonColor);
wn.headerDecorationColor = colorFromJson(w, "headerDecorationColor",wn.headerDecorationColor);
wn.backgroundColor = colorFromJson(w, "backgroundColor", wn.backgroundColor);
wn.headerTextColor = colorFromJson(w, "headerTextColor", wn.headerTextColor);
wn.versionTextColor = colorFromJson(w, "versionTextColor", wn.versionTextColor);
wn.contentTextColor = colorFromJson(w, "contentTextColor", wn.contentTextColor);
wn.linkColor = colorFromJson(w, "linkColor", wn.linkColor);
wn.closeButtonColor = colorFromJson(w, "closeButtonColor", wn.closeButtonColor);
wn.headerDecorationColor = colorFromJson(w, "headerDecorationColor", wn.headerDecorationColor);
}
if (json.contains("shortcutsIcons")) {

View File

@ -378,7 +378,7 @@ QVariant ComicModel::data(const QModelIndex &index, int role) const
Qt::ItemFlags ComicModel::flags(const QModelIndex &index) const
{
if (!index.isValid())
return {};
return { };
if (index.column() == ComicModel::Rating)
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable;
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled;

View File

@ -434,7 +434,7 @@ QVariant FolderModel::data(const QModelIndex &index, int role) const
Qt::ItemFlags FolderModel::flags(const QModelIndex &index) const
{
if (!index.isValid())
return {};
return { };
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDropEnabled | Qt::ItemIsDragEnabled;
}

View File

@ -36,8 +36,8 @@ public:
}
private:
Type _type {};
std::string _lexeme {};
Type _type { };
std::string _lexeme { };
};
class QueryLexer

View File

@ -316,9 +316,9 @@ QueryParser::TreeNode QueryParser::expression()
}
auto right = token(true);
return TreeNode("expression", { TreeNode(toLower(left), {}), TreeNode(right, {}) }, expOperator);
return TreeNode("expression", { TreeNode(toLower(left), { }), TreeNode(right, { }) }, expOperator);
} else {
return TreeNode("expression", { TreeNode("all", {}), TreeNode(left, {}) });
return TreeNode("expression", { TreeNode("all", { }), TreeNode(left, { }) });
}
}
@ -328,12 +328,12 @@ QueryParser::TreeNode QueryParser::expression()
QueryParser::TreeNode QueryParser::baseToken()
{
if (tokenType() == Token::Type::quotedWord) {
return TreeNode("expression", { TreeNode("all", {}), TreeNode(token(true), {}) });
return TreeNode("expression", { TreeNode("all", { }), TreeNode(token(true), { }) });
}
if (tokenType() == Token::Type::word) {
return TreeNode("expression", { TreeNode("all", {}), TreeNode(token(true), {}) });
return TreeNode("expression", { TreeNode("all", { }), TreeNode(token(true), { }) });
}
return TreeNode("expression", { TreeNode("all", {}), TreeNode(token(true), {}) });
return TreeNode("expression", { TreeNode("all", { }), TreeNode(token(true), { }) });
}

View File

@ -101,11 +101,11 @@ QVariant ReadingListModel::data(const QModelIndex &index, int role) const
Qt::ItemFlags ReadingListModel::flags(const QModelIndex &index) const
{
if (!index.isValid())
return {};
return { };
auto item = static_cast<ListItem *>(index.internalPointer());
if (typeid(*item) == typeid(ReadingListSeparatorItem))
return {};
return { };
if (typeid(*item) == typeid(ReadingListItem) && static_cast<ReadingListItem *>(item)->parent->getId() != 0)
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDropEnabled | Qt::ItemIsDragEnabled; // only sublists are dragable

View File

@ -359,20 +359,20 @@ Theme makeTheme(const ThemeParams &params)
theme.metadataScraperDialog.scraperScrollLabelScrollAreaQSS = t.scraperScrollLabelScrollAreaQSS.arg(msd.contentBackgroundColor.name(), msd.tableScrollHandleColor.name(), msd.tableScrollBackgroundColor.name());
theme.metadataScraperDialog.scraperTableViewQSS = t.scraperTableViewQSS
.arg(msd.tableHeaderTextColor.name(),
msd.tableAltBackgroundColor.name(),
msd.tableBackgroundColor.name(),
msd.tableSelectedColor.name(),
msd.tableHeaderBackgroundColor.name(),
msd.tableHeaderBorderColor.name(),
msd.tableHeaderTextColor.name(),
msd.tableSectionBorderDark.name(),
msd.tableSectionBorderLight.name(),
msd.tableScrollHandleColor.name(),
msd.tableScrollBackgroundColor.name(),
recolor(":/images/comic_vine/downArrow.svg", msd.downArrowColor),
recolor(":/images/comic_vine/upArrow.svg", msd.upArrowColor),
msd.tableHeaderGradientColor.name());
.arg(msd.tableHeaderTextColor.name(),
msd.tableAltBackgroundColor.name(),
msd.tableBackgroundColor.name(),
msd.tableSelectedColor.name(),
msd.tableHeaderBackgroundColor.name(),
msd.tableHeaderBorderColor.name(),
msd.tableHeaderTextColor.name(),
msd.tableSectionBorderDark.name(),
msd.tableSectionBorderLight.name(),
msd.tableScrollHandleColor.name(),
msd.tableScrollBackgroundColor.name(),
recolor(":/images/comic_vine/downArrow.svg", msd.downArrowColor),
recolor(":/images/comic_vine/upArrow.svg", msd.upArrowColor),
msd.tableHeaderGradientColor.name());
theme.metadataScraperDialog.dialogQSS = t.dialogQSS.arg(msd.dialogBackgroundColor.name());
theme.metadataScraperDialog.dialogButtonsQSS = t.dialogButtonsQSS.arg(msd.buttonBorderColor.name(), msd.buttonBackgroundColor.name(), msd.buttonTextColor.name());
@ -470,19 +470,19 @@ Theme makeTheme(const ThemeParams &params)
// ComicsViewTable
const auto &cvta = params.comicsViewTableParams;
theme.comicsViewTable.tableViewQSS = cvta.t.tableViewQSS
.arg(cvta.alternateBackgroundColor.name(),
cvta.backgroundColor.name(),
cvta.headerBackgroundColor.name(),
cvta.headerBorderColor.name(),
cvta.headerGradientColor.name(),
cvta.itemBorderBottomColor.name(),
cvta.itemBorderTopColor.name(),
cvta.itemTextColor.name(),
cvta.selectedColor.name(),
cvta.selectedTextColor.name(),
cvta.headerTextColor.name(),
QString::number(cvta.itemBorderBottomWidth),
QString::number(cvta.itemBorderTopWidth));
.arg(cvta.alternateBackgroundColor.name(),
cvta.backgroundColor.name(),
cvta.headerBackgroundColor.name(),
cvta.headerBorderColor.name(),
cvta.headerGradientColor.name(),
cvta.itemBorderBottomColor.name(),
cvta.itemBorderTopColor.name(),
cvta.itemTextColor.name(),
cvta.selectedColor.name(),
cvta.selectedTextColor.name(),
cvta.headerTextColor.name(),
QString::number(cvta.itemBorderBottomWidth),
QString::number(cvta.itemBorderTopWidth));
theme.comicsViewTable.starRatingColor = cvta.starRatingColor;
theme.comicsViewTable.starRatingSelectedColor = cvta.starRatingSelectedColor;
// end ComicsViewTable
@ -648,15 +648,15 @@ Theme makeTheme(const ThemeParams &params)
theme.navigationTree.branchOpenIconSelectedPath = recoloredSvgToThemeFile(":/images/sidebar/branch-open.svg", nt.branchIndicatorSelectedColor, params.meta.id, { .suffix = "_selected" });
theme.navigationTree.navigationTreeQSS = nt.t.navigationTreeQSS
.arg(nt.textColor.name(),
nt.selectionBackgroundColor.name(),
nt.scrollBackgroundColor.name(),
nt.scrollHandleColor.name(),
nt.selectedTextColor.name(),
theme.navigationTree.branchClosedIconPath,
theme.navigationTree.branchOpenIconPath,
theme.navigationTree.branchClosedIconSelectedPath,
theme.navigationTree.branchOpenIconSelectedPath);
.arg(nt.textColor.name(),
nt.selectionBackgroundColor.name(),
nt.scrollBackgroundColor.name(),
nt.scrollHandleColor.name(),
nt.selectedTextColor.name(),
theme.navigationTree.branchClosedIconPath,
theme.navigationTree.branchOpenIconPath,
theme.navigationTree.branchClosedIconSelectedPath,
theme.navigationTree.branchOpenIconSelectedPath);
theme.navigationTree.folderIndicatorColor = nt.folderIndicatorColor;
// Folder icon — normal and selected states with independent colors

View File

@ -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());

View File

@ -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

View File

@ -133,7 +133,7 @@ ThemeEditorDialog::ThemeEditorDialog(const QJsonObject &params, 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);
}

View File

@ -59,7 +59,7 @@ Theme ThemeManager::themeFromId(const QString &id, ThemeVariant fallbackVariant)
return makeTheme(json);
}
return {};
return { };
}
void ThemeManager::resolveTheme()

View File

@ -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();
}

View File

@ -34,7 +34,7 @@ QModelIndex ActionsShortcutsModel::index(int row, int column, const QModelIndex
Qt::ItemFlags ActionsShortcutsModel::flags(const QModelIndex &index) const
{
if (!index.isValid())
return {};
return { };
if (index.column() == KEYS)
return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable;
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;

View File

@ -461,8 +461,8 @@ void ConcurrentQueueTest::singleUserThread_data()
using ms = chrono::milliseconds;
QTest::newRow("-") << 0 << JobDataSet {};
QTest::newRow("0") << 7 << JobDataSet {};
QTest::newRow("-") << 0 << JobDataSet { };
QTest::newRow("0") << 7 << JobDataSet { };
QTest::newRow("A") << 1 << JobDataSet { { 5, ms(0) } };
QTest::newRow("B") << 5 << JobDataSet { { 12, ms(1) } };
QTest::newRow("C") << 1 << JobDataSet { { 1, ms(0) }, { 5, ms(2) }, { 3, ms(1) } };
@ -559,9 +559,9 @@ void ConcurrentQueueTest::cancelPending1UserThread_data()
const auto ms = [](int count) -> Clock::duration { return chrono::milliseconds(count); };
const auto us = [](int count) -> Clock::duration { return chrono::microseconds(count); };
QTest::newRow("-") << 0 << JobDataSet {} << ms(0);
QTest::newRow("01") << 2 << JobDataSet {} << ms(0);
QTest::newRow("02") << 3 << JobDataSet {} << ms(1);
QTest::newRow("-") << 0 << JobDataSet { } << ms(0);
QTest::newRow("01") << 2 << JobDataSet { } << ms(0);
QTest::newRow("02") << 3 << JobDataSet { } << ms(1);
QTest::newRow("A") << 1 << JobDataSet { { 5, ms(3) } } << ms(1);
QTest::newRow("B") << 5 << JobDataSet { { 12, ms(1) } } << ms(1);