forked from quickshell/quickshell
all: fix new lints
This commit is contained in:
parent
26d443aa50
commit
2c411fce5a
43 changed files with 351 additions and 316 deletions
|
@ -18,7 +18,9 @@
|
|||
|
||||
#include "model.hpp"
|
||||
|
||||
namespace {
|
||||
Q_LOGGING_CATEGORY(logDesktopEntry, "quickshell.desktopentry", QtWarningMsg);
|
||||
}
|
||||
|
||||
struct Locale {
|
||||
explicit Locale() = default;
|
||||
|
@ -78,6 +80,7 @@ struct Locale {
|
|||
QString modifier;
|
||||
};
|
||||
|
||||
// NOLINTNEXTLINE(misc-use-internal-linkage)
|
||||
QDebug operator<<(QDebug debug, const Locale& locale) {
|
||||
auto saver = QDebugStateSaver(debug);
|
||||
debug.nospace() << "Locale(language=" << locale.language << ", territory=" << locale.territory
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "iconimageprovider.hpp"
|
||||
#include <algorithm>
|
||||
|
||||
#include <qcolor.h>
|
||||
#include <qicon.h>
|
||||
|
@ -49,8 +50,8 @@ IconImageProvider::requestPixmap(const QString& id, QSize* size, const QSize& re
|
|||
QPixmap IconImageProvider::missingPixmap(const QSize& size) {
|
||||
auto width = size.width() % 2 == 0 ? size.width() : size.width() + 1;
|
||||
auto height = size.height() % 2 == 0 ? size.height() : size.height() + 1;
|
||||
if (width < 2) width = 2;
|
||||
if (height < 2) height = 2;
|
||||
width = std::max(width, 2);
|
||||
height = std::max(height, 2);
|
||||
|
||||
auto pixmap = QPixmap(width, height);
|
||||
pixmap.fill(QColorConstants::Black);
|
||||
|
|
|
@ -8,7 +8,21 @@
|
|||
#include <qpixmap.h>
|
||||
#include <qqmlengine.h>
|
||||
|
||||
static QMap<QString, QsImageHandle*> liveImages; // NOLINT
|
||||
namespace {
|
||||
|
||||
QMap<QString, QsImageHandle*> liveImages; // NOLINT
|
||||
|
||||
void parseReq(const QString& req, QString& target, QString& param) {
|
||||
auto splitIdx = req.indexOf('/');
|
||||
if (splitIdx != -1) {
|
||||
target = req.sliced(0, splitIdx);
|
||||
param = req.sliced(splitIdx + 1);
|
||||
} else {
|
||||
target = req;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
QsImageHandle::QsImageHandle(QQmlImageProviderBase::ImageType type, QObject* parent)
|
||||
: QObject(parent)
|
||||
|
@ -43,16 +57,6 @@ QPixmap QsImageHandle::
|
|||
return QPixmap();
|
||||
}
|
||||
|
||||
void parseReq(const QString& req, QString& target, QString& param) {
|
||||
auto splitIdx = req.indexOf('/');
|
||||
if (splitIdx != -1) {
|
||||
target = req.sliced(0, splitIdx);
|
||||
param = req.sliced(splitIdx + 1);
|
||||
} else {
|
||||
target = req;
|
||||
}
|
||||
}
|
||||
|
||||
QImage QsImageProvider::requestImage(const QString& id, QSize* size, const QSize& requestedSize) {
|
||||
QString target;
|
||||
QString param;
|
||||
|
|
|
@ -28,5 +28,6 @@ headers = [
|
|||
"types.hpp",
|
||||
"qsmenuanchor.hpp",
|
||||
"clock.hpp",
|
||||
"scriptmodel.hpp",
|
||||
]
|
||||
-----
|
||||
|
|
|
@ -15,7 +15,9 @@
|
|||
|
||||
#include "instanceinfo.hpp"
|
||||
|
||||
namespace {
|
||||
Q_LOGGING_CATEGORY(logPaths, "quickshell.paths", QtWarningMsg);
|
||||
}
|
||||
|
||||
QsPaths* QsPaths::instance() {
|
||||
static auto* instance = new QsPaths(); // NOLINT
|
||||
|
|
|
@ -10,16 +10,9 @@ static QVector<QsEnginePlugin*> plugins; // NOLINT
|
|||
void QsEnginePlugin::registerPlugin(QsEnginePlugin& plugin) { plugins.push_back(&plugin); }
|
||||
|
||||
void QsEnginePlugin::initPlugins() {
|
||||
plugins.erase(
|
||||
std::remove_if(
|
||||
plugins.begin(),
|
||||
plugins.end(),
|
||||
[](QsEnginePlugin* plugin) { return !plugin->applies(); }
|
||||
),
|
||||
plugins.end()
|
||||
);
|
||||
plugins.removeIf([](QsEnginePlugin* plugin) { return !plugin->applies(); });
|
||||
|
||||
std::sort(plugins.begin(), plugins.end(), [](QsEnginePlugin* a, QsEnginePlugin* b) {
|
||||
std::ranges::sort(plugins, [](QsEnginePlugin* a, QsEnginePlugin* b) {
|
||||
return b->dependencies().contains(a->name());
|
||||
});
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "popupanchor.hpp"
|
||||
#include <algorithm>
|
||||
|
||||
#include <qcontainerfwd.h>
|
||||
#include <qlogging.h>
|
||||
|
@ -276,9 +277,7 @@ void PopupPositioner::reposition(PopupAnchor* anchor, QWindow* window, bool only
|
|||
effectiveX = screenGeometry.right() - windowGeometry.width() + 1;
|
||||
}
|
||||
|
||||
if (effectiveX < screenGeometry.left()) {
|
||||
effectiveX = screenGeometry.left();
|
||||
}
|
||||
effectiveX = std::max(effectiveX, screenGeometry.left());
|
||||
}
|
||||
|
||||
if (adjustment.testFlag(PopupAdjustment::SlideY)) {
|
||||
|
@ -286,9 +285,7 @@ void PopupPositioner::reposition(PopupAnchor* anchor, QWindow* window, bool only
|
|||
effectiveY = screenGeometry.bottom() - windowGeometry.height() + 1;
|
||||
}
|
||||
|
||||
if (effectiveY < screenGeometry.top()) {
|
||||
effectiveY = screenGeometry.top();
|
||||
}
|
||||
effectiveY = std::max(effectiveY, screenGeometry.top());
|
||||
}
|
||||
|
||||
if (adjustment.testFlag(PopupAdjustment::ResizeX)) {
|
||||
|
|
|
@ -22,6 +22,7 @@ bool ModelOperation::operator==(const ModelOperation& other) const {
|
|||
&& other.length == this->length && other.destIndex == this->destIndex;
|
||||
}
|
||||
|
||||
// NOLINTNEXTLINE(misc-use-internal-linkage)
|
||||
QDebug& operator<<(QDebug& debug, const ModelOperation& op) {
|
||||
auto saver = QDebugStateSaver(debug);
|
||||
debug.nospace();
|
||||
|
@ -43,6 +44,7 @@ QDebug& operator<<(QDebug& debug, const ModelOperation& op) {
|
|||
return debug;
|
||||
}
|
||||
|
||||
// NOLINTNEXTLINE(misc-use-internal-linkage)
|
||||
QDebug& operator<<(QDebug& debug, const QVariantList& list) {
|
||||
auto str = QString();
|
||||
|
||||
|
|
|
@ -196,7 +196,7 @@ V* AwfulMap<K, V>::get(const K& key) {
|
|||
}
|
||||
|
||||
template <typename K, typename V>
|
||||
void AwfulMap<K, V>::insert(K key, V value) {
|
||||
void AwfulMap<K, V>::insert(const K& key, V value) {
|
||||
this->values.push_back(QPair<K, V>(key, value));
|
||||
}
|
||||
|
||||
|
|
|
@ -20,8 +20,8 @@ class AwfulMap {
|
|||
public:
|
||||
[[nodiscard]] bool contains(const K& key) const;
|
||||
[[nodiscard]] V* get(const K& key);
|
||||
void insert(K key, V value); // assumes no duplicates
|
||||
bool remove(const K& key); // returns true if anything was removed
|
||||
void insert(const K& key, V value); // assumes no duplicates
|
||||
bool remove(const K& key); // returns true if anything was removed
|
||||
QList<QPair<K, V>> values;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue