Skip to content

Commit 1d94144

Browse files
committed
all: fix lints
1 parent f78078d commit 1d94144

File tree

15 files changed

+61
-57
lines changed

15 files changed

+61
-57
lines changed

src/core/colorquantizer.cpp

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,28 @@ ColorQuantizerOperation::ColorQuantizerOperation(QUrl* source, qreal depth, qrea
2828
: source(source)
2929
, maxDepth(depth)
3030
, rescaleSize(rescaleSize) {
31-
setAutoDelete(false);
31+
this->setAutoDelete(false);
3232
}
3333

3434
void ColorQuantizerOperation::quantizeImage(const QAtomicInteger<bool>& shouldCancel) {
35-
if (shouldCancel.loadAcquire() || source->isEmpty()) return;
35+
if (shouldCancel.loadAcquire() || this->source->isEmpty()) return;
3636

37-
colors.clear();
37+
this->colors.clear();
3838

39-
auto image = QImage(source->toLocalFile());
40-
if ((image.width() > rescaleSize || image.height() > rescaleSize) && rescaleSize > 0) {
39+
auto image = QImage(this->source->toLocalFile());
40+
if ((image.width() > this->rescaleSize || image.height() > this->rescaleSize)
41+
&& this->rescaleSize > 0)
42+
{
4143
image = image.scaled(
42-
static_cast<int>(rescaleSize),
43-
static_cast<int>(rescaleSize),
44+
static_cast<int>(this->rescaleSize),
45+
static_cast<int>(this->rescaleSize),
4446
Qt::KeepAspectRatio,
4547
Qt::SmoothTransformation
4648
);
4749
}
4850

4951
if (image.isNull()) {
50-
qCWarning(logColorQuantizer) << "Failed to load image from" << source->toString();
52+
qCWarning(logColorQuantizer) << "Failed to load image from" << this->source->toString();
5153
return;
5254
}
5355

@@ -63,7 +65,7 @@ void ColorQuantizerOperation::quantizeImage(const QAtomicInteger<bool>& shouldCa
6365

6466
auto startTime = QDateTime::currentDateTime();
6567

66-
colors = quantization(pixels, 0);
68+
this->colors = this->quantization(pixels, 0);
6769

6870
auto endTime = QDateTime::currentDateTime();
6971
auto milliseconds = startTime.msecsTo(endTime);
@@ -77,7 +79,7 @@ QList<QColor> ColorQuantizerOperation::quantization(
7779
) {
7880
if (shouldCancel.loadAcquire()) return QList<QColor>();
7981

80-
if (depth >= maxDepth || rgbValues.isEmpty()) {
82+
if (depth >= this->maxDepth || rgbValues.isEmpty()) {
8183
if (rgbValues.isEmpty()) return QList<QColor>();
8284

8385
auto totalR = 0;
@@ -114,8 +116,8 @@ QList<QColor> ColorQuantizerOperation::quantization(
114116
auto rightHalf = rgbValues.mid(mid);
115117

116118
QList<QColor> result;
117-
result.append(quantization(leftHalf, depth + 1));
118-
result.append(quantization(rightHalf, depth + 1));
119+
result.append(this->quantization(leftHalf, depth + 1));
120+
result.append(this->quantization(rightHalf, depth + 1));
119121

120122
return result;
121123
}
@@ -159,7 +161,7 @@ void ColorQuantizerOperation::finishRun() {
159161
}
160162

161163
void ColorQuantizerOperation::finished() {
162-
emit this->done(colors);
164+
emit this->done(this->colors);
163165
delete this;
164166
}
165167

@@ -178,39 +180,39 @@ void ColorQuantizerOperation::run() {
178180
void ColorQuantizerOperation::tryCancel() { this->shouldCancel.storeRelease(true); }
179181

180182
void ColorQuantizer::componentComplete() {
181-
componentCompleted = true;
182-
if (!mSource.isEmpty()) quantizeAsync();
183+
this->componentCompleted = true;
184+
if (!this->mSource.isEmpty()) this->quantizeAsync();
183185
}
184186

185187
void ColorQuantizer::setSource(const QUrl& source) {
186-
if (mSource != source) {
187-
mSource = source;
188+
if (this->mSource != source) {
189+
this->mSource = source;
188190
emit this->sourceChanged();
189191

190-
if (this->componentCompleted && !mSource.isEmpty()) quantizeAsync();
192+
if (this->componentCompleted && !this->mSource.isEmpty()) this->quantizeAsync();
191193
}
192194
}
193195

194196
void ColorQuantizer::setDepth(qreal depth) {
195-
if (mDepth != depth) {
196-
mDepth = depth;
197+
if (this->mDepth != depth) {
198+
this->mDepth = depth;
197199
emit this->depthChanged();
198200

199-
if (this->componentCompleted) quantizeAsync();
201+
if (this->componentCompleted) this->quantizeAsync();
200202
}
201203
}
202204

203205
void ColorQuantizer::setRescaleSize(int rescaleSize) {
204-
if (mRescaleSize != rescaleSize) {
205-
mRescaleSize = rescaleSize;
206+
if (this->mRescaleSize != rescaleSize) {
207+
this->mRescaleSize = rescaleSize;
206208
emit this->rescaleSizeChanged();
207209

208-
if (this->componentCompleted) quantizeAsync();
210+
if (this->componentCompleted) this->quantizeAsync();
209211
}
210212
}
211213

212214
void ColorQuantizer::operationFinished(const QList<QColor>& result) {
213-
bColors = result;
215+
this->bColors = result;
214216
this->liveOperation = nullptr;
215217
emit this->colorsChanged();
216218
}
@@ -219,7 +221,8 @@ void ColorQuantizer::quantizeAsync() {
219221
if (this->liveOperation) this->cancelAsync();
220222

221223
qCDebug(logColorQuantizer) << "Starting color quantization asynchronously";
222-
this->liveOperation = new ColorQuantizerOperation(&mSource, mDepth, mRescaleSize);
224+
this->liveOperation =
225+
new ColorQuantizerOperation(&this->mSource, this->mDepth, this->mRescaleSize);
223226

224227
QObject::connect(
225228
this->liveOperation,

src/core/colorquantizer.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,13 @@ class ColorQuantizer
9191

9292
[[nodiscard]] QBindable<QList<QColor>> bindableColors() { return &this->bColors; }
9393

94-
[[nodiscard]] QUrl source() const { return mSource; }
94+
[[nodiscard]] QUrl source() const { return this->mSource; }
9595
void setSource(const QUrl& source);
9696

97-
[[nodiscard]] qreal depth() const { return mDepth; }
97+
[[nodiscard]] qreal depth() const { return this->mDepth; }
9898
void setDepth(qreal depth);
9999

100-
[[nodiscard]] qreal rescaleSize() const { return mRescaleSize; }
100+
[[nodiscard]] qreal rescaleSize() const { return this->mRescaleSize; }
101101
void setRescaleSize(int rescaleSize);
102102

103103
signals:

src/core/scriptmodel.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ void ScriptModel::updateValuesUnique(const QVariantList& newValues) {
1919
auto newIter = newValues.begin();
2020

2121
// TODO: cache this
22-
auto getCmpKey = [&](const QVariant& v) {
22+
auto getCmpKey = [this](const QVariant& v) {
2323
if (v.canConvert<QVariantMap>()) {
2424
auto vMap = v.value<QVariantMap>();
2525
if (vMap.contains(this->cmpKey)) {
@@ -30,7 +30,7 @@ void ScriptModel::updateValuesUnique(const QVariantList& newValues) {
3030
return v;
3131
};
3232

33-
auto variantCmp = [&](const QVariant& a, const QVariant& b) {
33+
auto variantCmp = [&, this](const QVariant& a, const QVariant& b) {
3434
if (!this->cmpKey.isEmpty()) return getCmpKey(a) == getCmpKey(b);
3535
else return a == b;
3636
};

src/dbus/dbusmenu/dbusmenu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ void DBusMenuItem::updateProperties(const QVariantMap& properties, const QString
183183
}
184184
} else if (removed.isEmpty() || removed.contains("icon-data")) {
185185
imageChanged = this->image.hasData();
186-
image.data.clear();
186+
this->image.data.clear();
187187
}
188188

189189
auto type = properties.value("type");

src/dbus/dbusmenu/dbusmenu.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class DBusMenuPngImage: public QsIndexedImageHandle {
3636
public:
3737
explicit DBusMenuPngImage(): QsIndexedImageHandle(QQuickImageProvider::Image) {}
3838

39-
[[nodiscard]] bool hasData() const { return !data.isEmpty(); }
39+
[[nodiscard]] bool hasData() const { return !this->data.isEmpty(); }
4040
QImage requestImage(const QString& id, QSize* size, const QSize& requestedSize) override;
4141

4242
QByteArray data;

src/io/fileview.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ void FileViewReader::run() {
9393
FileViewReader::read(this->owner, this->state, this->doStringConversion, this->shouldCancel);
9494

9595
if (this->shouldCancel.loadAcquire()) {
96-
qCDebug(logFileView) << "Read" << this << "of" << state.path << "canceled for" << this->owner;
96+
qCDebug(logFileView) << "Read" << this << "of" << this->state.path << "canceled for"
97+
<< this->owner;
9798
}
9899
}
99100

@@ -206,7 +207,7 @@ void FileViewWriter::run() {
206207
FileViewWriter::write(this->owner, this->state, this->doAtomicWrite, this->shouldCancel);
207208

208209
if (this->shouldCancel.loadAcquire()) {
209-
qCDebug(logFileView) << "Write" << this << "of" << state.path << "canceled for"
210+
qCDebug(logFileView) << "Write" << this << "of" << this->state.path << "canceled for"
210211
<< this->owner;
211212
}
212213
}

src/io/jsonadapter.cpp

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ void JsonAdapter::deserializeAdapter(const QByteArray& data) {
4444

4545
this->deserializeRec(json.object(), this, &JsonAdapter::staticMetaObject);
4646

47-
for (auto* object: oldCreatedObjects) {
47+
for (auto* object: this->oldCreatedObjects) {
4848
delete object; // FIXME: QMetaType::destroy?
4949
}
5050

@@ -56,7 +56,7 @@ void JsonAdapter::deserializeAdapter(const QByteArray& data) {
5656

5757
void JsonAdapter::connectNotifiers() {
5858
auto notifySlot = JsonAdapter::staticMetaObject.indexOfSlot("onPropertyChanged()");
59-
connectNotifiersRec(notifySlot, this, &JsonAdapter::staticMetaObject);
59+
this->connectNotifiersRec(notifySlot, this, &JsonAdapter::staticMetaObject);
6060
}
6161

6262
void JsonAdapter::connectNotifiersRec(int notifySlot, QObject* obj, const QMetaObject* base) {
@@ -71,15 +71,15 @@ void JsonAdapter::connectNotifiersRec(int notifySlot, QObject* obj, const QMetaO
7171
auto val = prop.read(obj);
7272
if (val.canView<JsonObject*>()) {
7373
auto* pobj = prop.read(obj).view<JsonObject*>();
74-
if (pobj) connectNotifiersRec(notifySlot, pobj, &JsonObject::staticMetaObject);
74+
if (pobj) this->connectNotifiersRec(notifySlot, pobj, &JsonObject::staticMetaObject);
7575
} else if (val.canConvert<QQmlListProperty<JsonObject>>()) {
7676
auto listVal = val.value<QQmlListProperty<JsonObject>>();
7777

7878
auto len = listVal.count(&listVal);
7979
for (auto i = 0; i != len; i++) {
8080
auto* pobj = listVal.at(&listVal, i);
8181

82-
if (pobj) connectNotifiersRec(notifySlot, pobj, &JsonObject::staticMetaObject);
82+
if (pobj) this->connectNotifiersRec(notifySlot, pobj, &JsonObject::staticMetaObject);
8383
}
8484
}
8585
}
@@ -111,7 +111,7 @@ QJsonObject JsonAdapter::serializeRec(const QObject* obj, const QMetaObject* bas
111111
auto* pobj = val.view<JsonObject*>();
112112

113113
if (pobj) {
114-
json.insert(prop.name(), serializeRec(pobj, &JsonObject::staticMetaObject));
114+
json.insert(prop.name(), this->serializeRec(pobj, &JsonObject::staticMetaObject));
115115
} else {
116116
json.insert(prop.name(), QJsonValue::Null);
117117
}
@@ -124,7 +124,7 @@ QJsonObject JsonAdapter::serializeRec(const QObject* obj, const QMetaObject* bas
124124
auto* pobj = listVal.at(&listVal, i);
125125

126126
if (pobj) {
127-
array.push_back(serializeRec(pobj, &JsonObject::staticMetaObject));
127+
array.push_back(this->serializeRec(pobj, &JsonObject::staticMetaObject));
128128
} else {
129129
array.push_back(QJsonValue::Null);
130130
}
@@ -178,8 +178,8 @@ void JsonAdapter::deserializeRec(const QJsonObject& json, QObject* obj, const QM
178178

179179
currentValue->setParent(this);
180180
this->createdObjects.push_back(currentValue);
181-
} else if (oldCreatedObjects.removeOne(currentValue)) {
182-
createdObjects.push_back(currentValue);
181+
} else if (this->oldCreatedObjects.removeOne(currentValue)) {
182+
this->createdObjects.push_back(currentValue);
183183
}
184184

185185
this->deserializeRec(jval.toObject(), currentValue, &JsonObject::staticMetaObject);
@@ -212,8 +212,8 @@ void JsonAdapter::deserializeRec(const QJsonObject& json, QObject* obj, const QM
212212
if (jsonValue.isObject()) {
213213
if (isNew) {
214214
currentValue = lp.at(&lp, i);
215-
if (oldCreatedObjects.removeOne(currentValue)) {
216-
createdObjects.push_back(currentValue);
215+
if (this->oldCreatedObjects.removeOne(currentValue)) {
216+
this->createdObjects.push_back(currentValue);
217217
}
218218
} else {
219219
// FIXME: should be the type inside the QQmlListProperty but how can we get that?

src/services/mpris/player.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ void MprisPlayer::onPlaybackStatusUpdated() {
378378

379379
// For exceptionally bad players that update playback timestamps at an indeterminate time AFTER
380380
// updating playback state. (Youtube)
381-
QTimer::singleShot(100, this, [&]() { this->pPosition.requestUpdate(); });
381+
QTimer::singleShot(100, this, [this]() { this->pPosition.requestUpdate(); });
382382

383383
// For exceptionally bad players that don't update length (or other metadata) until a new track actually
384384
// starts playing, and then don't trigger a metadata update when they do. (Jellyfin)

src/services/pipewire/device.cpp

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

src/services/upower/device.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ QString UPowerDevice::address() const { return this->device ? this->device->serv
101101
QString UPowerDevice::path() const { return this->device ? this->device->path() : QString(); }
102102

103103
void UPowerDevice::onGetAllFinished() {
104-
qCDebug(logUPowerDevice) << "UPowerDevice" << device->path() << "ready.";
104+
qCDebug(logUPowerDevice) << "UPowerDevice" << this->device->path() << "ready.";
105105
this->bReady = true;
106106
}
107107

0 commit comments

Comments
 (0)