all: fix lints

This commit is contained in:
outfoxxed 2025-09-28 23:51:06 -07:00
parent 6cc1b6f36a
commit 344ca340ba
No known key found for this signature in database
GPG key ID: 4C88A185FB89301E
14 changed files with 60 additions and 56 deletions

View file

@ -28,26 +28,28 @@ ColorQuantizerOperation::ColorQuantizerOperation(QUrl* source, qreal depth, qrea
: source(source) : source(source)
, maxDepth(depth) , maxDepth(depth)
, rescaleSize(rescaleSize) { , rescaleSize(rescaleSize) {
setAutoDelete(false); this->setAutoDelete(false);
} }
void ColorQuantizerOperation::quantizeImage(const QAtomicInteger<bool>& shouldCancel) { void ColorQuantizerOperation::quantizeImage(const QAtomicInteger<bool>& shouldCancel) {
if (shouldCancel.loadAcquire() || source->isEmpty()) return; if (shouldCancel.loadAcquire() || this->source->isEmpty()) return;
colors.clear(); this->colors.clear();
auto image = QImage(source->toLocalFile()); auto image = QImage(this->source->toLocalFile());
if ((image.width() > rescaleSize || image.height() > rescaleSize) && rescaleSize > 0) { if ((image.width() > this->rescaleSize || image.height() > this->rescaleSize)
&& this->rescaleSize > 0)
{
image = image.scaled( image = image.scaled(
static_cast<int>(rescaleSize), static_cast<int>(this->rescaleSize),
static_cast<int>(rescaleSize), static_cast<int>(this->rescaleSize),
Qt::KeepAspectRatio, Qt::KeepAspectRatio,
Qt::SmoothTransformation Qt::SmoothTransformation
); );
} }
if (image.isNull()) { if (image.isNull()) {
qCWarning(logColorQuantizer) << "Failed to load image from" << source->toString(); qCWarning(logColorQuantizer) << "Failed to load image from" << this->source->toString();
return; return;
} }
@ -63,7 +65,7 @@ void ColorQuantizerOperation::quantizeImage(const QAtomicInteger<bool>& shouldCa
auto startTime = QDateTime::currentDateTime(); auto startTime = QDateTime::currentDateTime();
colors = quantization(pixels, 0); this->colors = this->quantization(pixels, 0);
auto endTime = QDateTime::currentDateTime(); auto endTime = QDateTime::currentDateTime();
auto milliseconds = startTime.msecsTo(endTime); auto milliseconds = startTime.msecsTo(endTime);
@ -77,7 +79,7 @@ QList<QColor> ColorQuantizerOperation::quantization(
) { ) {
if (shouldCancel.loadAcquire()) return QList<QColor>(); if (shouldCancel.loadAcquire()) return QList<QColor>();
if (depth >= maxDepth || rgbValues.isEmpty()) { if (depth >= this->maxDepth || rgbValues.isEmpty()) {
if (rgbValues.isEmpty()) return QList<QColor>(); if (rgbValues.isEmpty()) return QList<QColor>();
auto totalR = 0; auto totalR = 0;
@ -114,8 +116,8 @@ QList<QColor> ColorQuantizerOperation::quantization(
auto rightHalf = rgbValues.mid(mid); auto rightHalf = rgbValues.mid(mid);
QList<QColor> result; QList<QColor> result;
result.append(quantization(leftHalf, depth + 1)); result.append(this->quantization(leftHalf, depth + 1));
result.append(quantization(rightHalf, depth + 1)); result.append(this->quantization(rightHalf, depth + 1));
return result; return result;
} }
@ -159,7 +161,7 @@ void ColorQuantizerOperation::finishRun() {
} }
void ColorQuantizerOperation::finished() { void ColorQuantizerOperation::finished() {
emit this->done(colors); emit this->done(this->colors);
delete this; delete this;
} }
@ -178,39 +180,39 @@ void ColorQuantizerOperation::run() {
void ColorQuantizerOperation::tryCancel() { this->shouldCancel.storeRelease(true); } void ColorQuantizerOperation::tryCancel() { this->shouldCancel.storeRelease(true); }
void ColorQuantizer::componentComplete() { void ColorQuantizer::componentComplete() {
componentCompleted = true; this->componentCompleted = true;
if (!mSource.isEmpty()) quantizeAsync(); if (!this->mSource.isEmpty()) this->quantizeAsync();
} }
void ColorQuantizer::setSource(const QUrl& source) { void ColorQuantizer::setSource(const QUrl& source) {
if (mSource != source) { if (this->mSource != source) {
mSource = source; this->mSource = source;
emit this->sourceChanged(); emit this->sourceChanged();
if (this->componentCompleted && !mSource.isEmpty()) quantizeAsync(); if (this->componentCompleted && !this->mSource.isEmpty()) this->quantizeAsync();
} }
} }
void ColorQuantizer::setDepth(qreal depth) { void ColorQuantizer::setDepth(qreal depth) {
if (mDepth != depth) { if (this->mDepth != depth) {
mDepth = depth; this->mDepth = depth;
emit this->depthChanged(); emit this->depthChanged();
if (this->componentCompleted) quantizeAsync(); if (this->componentCompleted) this->quantizeAsync();
} }
} }
void ColorQuantizer::setRescaleSize(int rescaleSize) { void ColorQuantizer::setRescaleSize(int rescaleSize) {
if (mRescaleSize != rescaleSize) { if (this->mRescaleSize != rescaleSize) {
mRescaleSize = rescaleSize; this->mRescaleSize = rescaleSize;
emit this->rescaleSizeChanged(); emit this->rescaleSizeChanged();
if (this->componentCompleted) quantizeAsync(); if (this->componentCompleted) this->quantizeAsync();
} }
} }
void ColorQuantizer::operationFinished(const QList<QColor>& result) { void ColorQuantizer::operationFinished(const QList<QColor>& result) {
bColors = result; this->bColors = result;
this->liveOperation = nullptr; this->liveOperation = nullptr;
emit this->colorsChanged(); emit this->colorsChanged();
} }
@ -219,7 +221,8 @@ void ColorQuantizer::quantizeAsync() {
if (this->liveOperation) this->cancelAsync(); if (this->liveOperation) this->cancelAsync();
qCDebug(logColorQuantizer) << "Starting color quantization asynchronously"; qCDebug(logColorQuantizer) << "Starting color quantization asynchronously";
this->liveOperation = new ColorQuantizerOperation(&mSource, mDepth, mRescaleSize); this->liveOperation =
new ColorQuantizerOperation(&this->mSource, this->mDepth, this->mRescaleSize);
QObject::connect( QObject::connect(
this->liveOperation, this->liveOperation,

View file

@ -91,13 +91,13 @@ public:
[[nodiscard]] QBindable<QList<QColor>> bindableColors() { return &this->bColors; } [[nodiscard]] QBindable<QList<QColor>> bindableColors() { return &this->bColors; }
[[nodiscard]] QUrl source() const { return mSource; } [[nodiscard]] QUrl source() const { return this->mSource; }
void setSource(const QUrl& source); void setSource(const QUrl& source);
[[nodiscard]] qreal depth() const { return mDepth; } [[nodiscard]] qreal depth() const { return this->mDepth; }
void setDepth(qreal depth); void setDepth(qreal depth);
[[nodiscard]] qreal rescaleSize() const { return mRescaleSize; } [[nodiscard]] qreal rescaleSize() const { return this->mRescaleSize; }
void setRescaleSize(int rescaleSize); void setRescaleSize(int rescaleSize);
signals: signals:

View file

@ -19,7 +19,7 @@ void ScriptModel::updateValuesUnique(const QVariantList& newValues) {
auto newIter = newValues.begin(); auto newIter = newValues.begin();
// TODO: cache this // TODO: cache this
auto getCmpKey = [&](const QVariant& v) { auto getCmpKey = [this](const QVariant& v) {
if (v.canConvert<QVariantMap>()) { if (v.canConvert<QVariantMap>()) {
auto vMap = v.value<QVariantMap>(); auto vMap = v.value<QVariantMap>();
if (vMap.contains(this->cmpKey)) { if (vMap.contains(this->cmpKey)) {
@ -30,7 +30,7 @@ void ScriptModel::updateValuesUnique(const QVariantList& newValues) {
return v; return v;
}; };
auto variantCmp = [&](const QVariant& a, const QVariant& b) { auto variantCmp = [&, this](const QVariant& a, const QVariant& b) {
if (!this->cmpKey.isEmpty()) return getCmpKey(a) == getCmpKey(b); if (!this->cmpKey.isEmpty()) return getCmpKey(a) == getCmpKey(b);
else return a == b; else return a == b;
}; };

View file

@ -183,7 +183,7 @@ void DBusMenuItem::updateProperties(const QVariantMap& properties, const QString
} }
} else if (removed.isEmpty() || removed.contains("icon-data")) { } else if (removed.isEmpty() || removed.contains("icon-data")) {
imageChanged = this->image.hasData(); imageChanged = this->image.hasData();
image.data.clear(); this->image.data.clear();
} }
auto type = properties.value("type"); auto type = properties.value("type");

View file

@ -36,7 +36,7 @@ class DBusMenuPngImage: public QsIndexedImageHandle {
public: public:
explicit DBusMenuPngImage(): QsIndexedImageHandle(QQuickImageProvider::Image) {} explicit DBusMenuPngImage(): QsIndexedImageHandle(QQuickImageProvider::Image) {}
[[nodiscard]] bool hasData() const { return !data.isEmpty(); } [[nodiscard]] bool hasData() const { return !this->data.isEmpty(); }
QImage requestImage(const QString& id, QSize* size, const QSize& requestedSize) override; QImage requestImage(const QString& id, QSize* size, const QSize& requestedSize) override;
QByteArray data; QByteArray data;

View file

@ -93,7 +93,8 @@ void FileViewReader::run() {
FileViewReader::read(this->owner, this->state, this->doStringConversion, this->shouldCancel); FileViewReader::read(this->owner, this->state, this->doStringConversion, this->shouldCancel);
if (this->shouldCancel.loadAcquire()) { if (this->shouldCancel.loadAcquire()) {
qCDebug(logFileView) << "Read" << this << "of" << state.path << "canceled for" << this->owner; qCDebug(logFileView) << "Read" << this << "of" << this->state.path << "canceled for"
<< this->owner;
} }
} }
@ -206,7 +207,7 @@ void FileViewWriter::run() {
FileViewWriter::write(this->owner, this->state, this->doAtomicWrite, this->shouldCancel); FileViewWriter::write(this->owner, this->state, this->doAtomicWrite, this->shouldCancel);
if (this->shouldCancel.loadAcquire()) { if (this->shouldCancel.loadAcquire()) {
qCDebug(logFileView) << "Write" << this << "of" << state.path << "canceled for" qCDebug(logFileView) << "Write" << this << "of" << this->state.path << "canceled for"
<< this->owner; << this->owner;
} }
} }

View file

@ -44,7 +44,7 @@ void JsonAdapter::deserializeAdapter(const QByteArray& data) {
this->deserializeRec(json.object(), this, &JsonAdapter::staticMetaObject); this->deserializeRec(json.object(), this, &JsonAdapter::staticMetaObject);
for (auto* object: oldCreatedObjects) { for (auto* object: this->oldCreatedObjects) {
delete object; // FIXME: QMetaType::destroy? delete object; // FIXME: QMetaType::destroy?
} }
@ -56,7 +56,7 @@ void JsonAdapter::deserializeAdapter(const QByteArray& data) {
void JsonAdapter::connectNotifiers() { void JsonAdapter::connectNotifiers() {
auto notifySlot = JsonAdapter::staticMetaObject.indexOfSlot("onPropertyChanged()"); auto notifySlot = JsonAdapter::staticMetaObject.indexOfSlot("onPropertyChanged()");
connectNotifiersRec(notifySlot, this, &JsonAdapter::staticMetaObject); this->connectNotifiersRec(notifySlot, this, &JsonAdapter::staticMetaObject);
} }
void JsonAdapter::connectNotifiersRec(int notifySlot, QObject* obj, const QMetaObject* base) { void JsonAdapter::connectNotifiersRec(int notifySlot, QObject* obj, const QMetaObject* base) {
@ -71,7 +71,7 @@ void JsonAdapter::connectNotifiersRec(int notifySlot, QObject* obj, const QMetaO
auto val = prop.read(obj); auto val = prop.read(obj);
if (val.canView<JsonObject*>()) { if (val.canView<JsonObject*>()) {
auto* pobj = prop.read(obj).view<JsonObject*>(); auto* pobj = prop.read(obj).view<JsonObject*>();
if (pobj) connectNotifiersRec(notifySlot, pobj, &JsonObject::staticMetaObject); if (pobj) this->connectNotifiersRec(notifySlot, pobj, &JsonObject::staticMetaObject);
} else if (val.canConvert<QQmlListProperty<JsonObject>>()) { } else if (val.canConvert<QQmlListProperty<JsonObject>>()) {
auto listVal = val.value<QQmlListProperty<JsonObject>>(); auto listVal = val.value<QQmlListProperty<JsonObject>>();
@ -79,7 +79,7 @@ void JsonAdapter::connectNotifiersRec(int notifySlot, QObject* obj, const QMetaO
for (auto i = 0; i != len; i++) { for (auto i = 0; i != len; i++) {
auto* pobj = listVal.at(&listVal, i); auto* pobj = listVal.at(&listVal, i);
if (pobj) connectNotifiersRec(notifySlot, pobj, &JsonObject::staticMetaObject); if (pobj) this->connectNotifiersRec(notifySlot, pobj, &JsonObject::staticMetaObject);
} }
} }
} }
@ -111,7 +111,7 @@ QJsonObject JsonAdapter::serializeRec(const QObject* obj, const QMetaObject* bas
auto* pobj = val.view<JsonObject*>(); auto* pobj = val.view<JsonObject*>();
if (pobj) { if (pobj) {
json.insert(prop.name(), serializeRec(pobj, &JsonObject::staticMetaObject)); json.insert(prop.name(), this->serializeRec(pobj, &JsonObject::staticMetaObject));
} else { } else {
json.insert(prop.name(), QJsonValue::Null); json.insert(prop.name(), QJsonValue::Null);
} }
@ -124,7 +124,7 @@ QJsonObject JsonAdapter::serializeRec(const QObject* obj, const QMetaObject* bas
auto* pobj = listVal.at(&listVal, i); auto* pobj = listVal.at(&listVal, i);
if (pobj) { if (pobj) {
array.push_back(serializeRec(pobj, &JsonObject::staticMetaObject)); array.push_back(this->serializeRec(pobj, &JsonObject::staticMetaObject));
} else { } else {
array.push_back(QJsonValue::Null); array.push_back(QJsonValue::Null);
} }
@ -178,8 +178,8 @@ void JsonAdapter::deserializeRec(const QJsonObject& json, QObject* obj, const QM
currentValue->setParent(this); currentValue->setParent(this);
this->createdObjects.push_back(currentValue); this->createdObjects.push_back(currentValue);
} else if (oldCreatedObjects.removeOne(currentValue)) { } else if (this->oldCreatedObjects.removeOne(currentValue)) {
createdObjects.push_back(currentValue); this->createdObjects.push_back(currentValue);
} }
this->deserializeRec(jval.toObject(), currentValue, &JsonObject::staticMetaObject); this->deserializeRec(jval.toObject(), currentValue, &JsonObject::staticMetaObject);
@ -212,8 +212,8 @@ void JsonAdapter::deserializeRec(const QJsonObject& json, QObject* obj, const QM
if (jsonValue.isObject()) { if (jsonValue.isObject()) {
if (isNew) { if (isNew) {
currentValue = lp.at(&lp, i); currentValue = lp.at(&lp, i);
if (oldCreatedObjects.removeOne(currentValue)) { if (this->oldCreatedObjects.removeOne(currentValue)) {
createdObjects.push_back(currentValue); this->createdObjects.push_back(currentValue);
} }
} else { } else {
// FIXME: should be the type inside the QQmlListProperty but how can we get that? // FIXME: should be the type inside the QQmlListProperty but how can we get that?

View file

@ -378,7 +378,7 @@ void MprisPlayer::onPlaybackStatusUpdated() {
// For exceptionally bad players that update playback timestamps at an indeterminate time AFTER // For exceptionally bad players that update playback timestamps at an indeterminate time AFTER
// updating playback state. (Youtube) // updating playback state. (Youtube)
QTimer::singleShot(100, this, [&]() { this->pPosition.requestUpdate(); }); QTimer::singleShot(100, this, [this]() { this->pPosition.requestUpdate(); });
// For exceptionally bad players that don't update length (or other metadata) until a new track actually // For exceptionally bad players that don't update length (or other metadata) until a new track actually
// starts playing, and then don't trigger a metadata update when they do. (Jellyfin) // starts playing, and then don't trigger a metadata update when they do. (Jellyfin)

View file

@ -135,8 +135,8 @@ void PwDevice::polled() {
// It is far more likely that the list content has not come in yet than it having no entries, // It is far more likely that the list content has not come in yet than it having no entries,
// and there isn't a way to check in the case that there *aren't* actually any entries. // and there isn't a way to check in the case that there *aren't* actually any entries.
if (!this->stagingIndexes.isEmpty()) { if (!this->stagingIndexes.isEmpty()) {
this->routeDeviceIndexes.removeIf([&](const std::pair<qint32, qint32>& entry) { this->routeDeviceIndexes.removeIf([&, this](const std::pair<qint32, qint32>& entry) {
if (!stagingIndexes.contains(entry.first)) { if (!this->stagingIndexes.contains(entry.first)) {
qCDebug(logDevice).nospace() << "Removed device/index pair [device: " << entry.first qCDebug(logDevice).nospace() << "Removed device/index pair [device: " << entry.first
<< ", index: " << entry.second << "] for" << this; << ", index: " << entry.second << "] for" << this;
return true; return true;

View file

@ -101,7 +101,7 @@ QString UPowerDevice::address() const { return this->device ? this->device->serv
QString UPowerDevice::path() const { return this->device ? this->device->path() : QString(); } QString UPowerDevice::path() const { return this->device ? this->device->path() : QString(); }
void UPowerDevice::onGetAllFinished() { void UPowerDevice::onGetAllFinished() {
qCDebug(logUPowerDevice) << "UPowerDevice" << device->path() << "ready."; qCDebug(logUPowerDevice) << "UPowerDevice" << this->device->path() << "ready.";
this->bReady = true; this->bReady = true;
} }

View file

@ -25,7 +25,7 @@ ReloadPopup::ReloadPopup(QString instanceId, bool failed, QString errorString)
this->popup = component.createWithInitialProperties({{"reloadInfo", QVariant::fromValue(this)}}); this->popup = component.createWithInitialProperties({{"reloadInfo", QVariant::fromValue(this)}});
if (!popup) { if (!this->popup) {
qCritical() << "Failed to open reload popup:" << component.errorString(); qCritical() << "Failed to open reload popup:" << component.errorString();
} }

View file

@ -77,7 +77,7 @@ QDebug& operator<<(QDebug& debug, const WlDmaBuffer* buffer) {
} }
GbmDeviceHandle::~GbmDeviceHandle() { GbmDeviceHandle::~GbmDeviceHandle() {
if (device) { if (this->device) {
MANAGER->unrefGbmDevice(this->device); MANAGER->unrefGbmDevice(this->device);
} }
} }
@ -522,7 +522,7 @@ WlDmaBuffer::~WlDmaBuffer() {
bool WlDmaBuffer::isCompatible(const WlBufferRequest& request) const { bool WlDmaBuffer::isCompatible(const WlBufferRequest& request) const {
if (request.width != this->width || request.height != this->height) return false; if (request.width != this->width || request.height != this->height) return false;
auto matchingFormat = std::ranges::find_if(request.dmabuf.formats, [&](const auto& format) { auto matchingFormat = std::ranges::find_if(request.dmabuf.formats, [this](const auto& format) {
return format.format == this->format return format.format == this->format
&& (format.modifiers.isEmpty() && (format.modifiers.isEmpty()
|| std::ranges::find(format.modifiers, this->modifier) != format.modifiers.end()); || std::ranges::find(format.modifiers, this->modifier) != format.modifiers.end());

View file

@ -40,7 +40,7 @@ public:
'\0'} '\0'}
) { ) {
for (auto i = 3; i != 0; i--) { for (auto i = 3; i != 0; i--) {
if (chars[i] == ' ') chars[i] = '\0'; if (this->chars[i] == ' ') this->chars[i] = '\0';
else break; else break;
} }
} }

View file

@ -68,11 +68,11 @@ void WlrScreencopyContext::captureFrame() {
this->request.reset(); this->request.reset();
if (this->region.isEmpty()) { if (this->region.isEmpty()) {
this->init(manager->capture_output(this->paintCursors ? 1 : 0, screen->output())); this->init(this->manager->capture_output(this->paintCursors ? 1 : 0, this->screen->output()));
} else { } else {
this->init(manager->capture_output_region( this->init(this->manager->capture_output_region(
this->paintCursors ? 1 : 0, this->paintCursors ? 1 : 0,
screen->output(), this->screen->output(),
this->region.x(), this->region.x(),
this->region.y(), this->region.y(),
this->region.width(), this->region.width(),