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

@ -280,7 +280,7 @@ Theme makeTheme(const QJsonObject &json)
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.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

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