all: fix lints

This commit is contained in:
outfoxxed 2025-09-28 23:51:06 -07:00
parent a781fe244c
commit e170d9111d
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
15 changed files with 61 additions and 57 deletions

View file

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

View file

@ -91,13 +91,13 @@ public:
[[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);
[[nodiscard]] qreal depth() const { return mDepth; }
[[nodiscard]] qreal depth() const { return this->mDepth; }
void setDepth(qreal depth);
[[nodiscard]] qreal rescaleSize() const { return mRescaleSize; }
[[nodiscard]] qreal rescaleSize() const { return this->mRescaleSize; }
void setRescaleSize(int rescaleSize);
signals:

View file

@ -19,7 +19,7 @@ void ScriptModel::updateValuesUnique(const QVariantList& newValues) {
auto newIter = newValues.begin();
// TODO: cache this
auto getCmpKey = [&](const QVariant& v) {
auto getCmpKey = [this](const QVariant& v) {
if (v.canConvert<QVariantMap>()) {
auto vMap = v.value<QVariantMap>();
if (vMap.contains(this->cmpKey)) {
@ -30,7 +30,7 @@ void ScriptModel::updateValuesUnique(const QVariantList& newValues) {
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);
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")) {
imageChanged = this->image.hasData();
image.data.clear();
this->image.data.clear();
}
auto type = properties.value("type");

View file

@ -36,7 +36,7 @@ class DBusMenuPngImage: public QsIndexedImageHandle {
public:
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;
QByteArray data;

View file

@ -93,7 +93,8 @@ void FileViewReader::run() {
FileViewReader::read(this->owner, this->state, this->doStringConversion, this->shouldCancel);
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);
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;
}
}

View file

@ -44,7 +44,7 @@ void JsonAdapter::deserializeAdapter(const QByteArray& data) {
this->deserializeRec(json.object(), this, &JsonAdapter::staticMetaObject);
for (auto* object: oldCreatedObjects) {
for (auto* object: this->oldCreatedObjects) {
delete object; // FIXME: QMetaType::destroy?
}
@ -56,7 +56,7 @@ void JsonAdapter::deserializeAdapter(const QByteArray& data) {
void JsonAdapter::connectNotifiers() {
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) {
@ -71,7 +71,7 @@ void JsonAdapter::connectNotifiersRec(int notifySlot, QObject* obj, const QMetaO
auto val = prop.read(obj);
if (val.canView<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>>()) {
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++) {
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*>();
if (pobj) {
json.insert(prop.name(), serializeRec(pobj, &JsonObject::staticMetaObject));
json.insert(prop.name(), this->serializeRec(pobj, &JsonObject::staticMetaObject));
} else {
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);
if (pobj) {
array.push_back(serializeRec(pobj, &JsonObject::staticMetaObject));
array.push_back(this->serializeRec(pobj, &JsonObject::staticMetaObject));
} else {
array.push_back(QJsonValue::Null);
}
@ -178,8 +178,8 @@ void JsonAdapter::deserializeRec(const QJsonObject& json, QObject* obj, const QM
currentValue->setParent(this);
this->createdObjects.push_back(currentValue);
} else if (oldCreatedObjects.removeOne(currentValue)) {
createdObjects.push_back(currentValue);
} else if (this->oldCreatedObjects.removeOne(currentValue)) {
this->createdObjects.push_back(currentValue);
}
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 (isNew) {
currentValue = lp.at(&lp, i);
if (oldCreatedObjects.removeOne(currentValue)) {
createdObjects.push_back(currentValue);
if (this->oldCreatedObjects.removeOne(currentValue)) {
this->createdObjects.push_back(currentValue);
}
} else {
// 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
// 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
// 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,
// and there isn't a way to check in the case that there *aren't* actually any entries.
if (!this->stagingIndexes.isEmpty()) {
this->routeDeviceIndexes.removeIf([&](const std::pair<qint32, qint32>& entry) {
if (!stagingIndexes.contains(entry.first)) {
this->routeDeviceIndexes.removeIf([&, this](const std::pair<qint32, qint32>& entry) {
if (!this->stagingIndexes.contains(entry.first)) {
qCDebug(logDevice).nospace() << "Removed device/index pair [device: " << entry.first
<< ", index: " << entry.second << "] for" << this;
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(); }
void UPowerDevice::onGetAllFinished() {
qCDebug(logUPowerDevice) << "UPowerDevice" << device->path() << "ready.";
qCDebug(logUPowerDevice) << "UPowerDevice" << this->device->path() << "ready.";
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)}});
if (!popup) {
if (!this->popup) {
qCritical() << "Failed to open reload popup:" << component.errorString();
}

View file

@ -77,7 +77,7 @@ QDebug& operator<<(QDebug& debug, const WlDmaBuffer* buffer) {
}
GbmDeviceHandle::~GbmDeviceHandle() {
if (device) {
if (this->device) {
MANAGER->unrefGbmDevice(this->device);
}
}
@ -522,7 +522,7 @@ WlDmaBuffer::~WlDmaBuffer() {
bool WlDmaBuffer::isCompatible(const WlBufferRequest& request) const {
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
&& (format.modifiers.isEmpty()
|| std::ranges::find(format.modifiers, this->modifier) != format.modifiers.end());

View file

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

View file

@ -31,7 +31,7 @@ void IdleMonitor::updateNotification() {
delete notification;
notification = nullptr;
auto guard = qScopeGuard([&] { this->bNotification = notification; });
auto guard = qScopeGuard([&, this] { this->bNotification = notification; });
auto params = this->bParams.value();

View file

@ -68,11 +68,11 @@ void WlrScreencopyContext::captureFrame() {
this->request.reset();
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 {
this->init(manager->capture_output_region(
this->init(this->manager->capture_output_region(
this->paintCursors ? 1 : 0,
screen->output(),
this->screen->output(),
this->region.x(),
this->region.y(),
this->region.width(),