nodiscard

This commit is contained in:
2026-06-04 22:57:45 +02:00
parent d8f047dbc9
commit b4716d25c0
29 changed files with 332 additions and 329 deletions
+4 -4
View File
@@ -18,13 +18,13 @@ public:
explicit BlobGroup(QObject* parent = nullptr);
~BlobGroup() override;
qreal smoothing() const {
[[nodiscard]] qreal smoothing() const {
return m_smoothing;
}
void setSmoothing(qreal s);
QColor color() const {
[[nodiscard]] QColor color() const {
return m_color;
}
@@ -36,11 +36,11 @@ void removeShape(BlobShape* shape);
void setInvertedRect(BlobInvertedRect* rect);
void clearInvertedRect(BlobInvertedRect* rect);
const QList<BlobShape*>& shapes() const {
[[nodiscard]] const QList<BlobShape*>& shapes() const {
return m_shapes;
}
BlobInvertedRect* invertedRect() const {
[[nodiscard]] BlobInvertedRect* invertedRect() const {
return m_invertedRect;
}
+5 -5
View File
@@ -16,25 +16,25 @@ public:
explicit BlobInvertedRect(QQuickItem* parent = nullptr);
~BlobInvertedRect() override;
qreal borderLeft() const {
[[nodiscard]] qreal borderLeft() const {
return m_borderLeft;
}
void setBorderLeft(qreal v);
qreal borderRight() const {
[[nodiscard]] qreal borderRight() const {
return m_borderRight;
}
void setBorderRight(qreal v);
qreal borderTop() const {
[[nodiscard]] qreal borderTop() const {
return m_borderTop;
}
void setBorderTop(qreal v);
qreal borderBottom() const {
[[nodiscard]] qreal borderBottom() const {
return m_borderBottom;
}
@@ -47,7 +47,7 @@ void borderTopChanged();
void borderBottomChanged();
protected:
bool isInvertedRect() const override {
[[nodiscard]] bool isInvertedRect() const override {
return true;
}
+2 -2
View File
@@ -21,8 +21,8 @@ struct BlobRectData {
class BlobMaterial : public QSGMaterial {
public:
QSGMaterialType* type() const override;
QSGMaterialShader* createShader(QSGRendererInterface::RenderMode) const override;
[[nodiscard]] QSGMaterialType* type() const override;
[[nodiscard]] QSGMaterialShader* createShader(QSGRendererInterface::RenderMode) const override;
int compare(const QSGMaterial* other) const override;
float m_paddedX = 0;
+7 -7
View File
@@ -24,7 +24,7 @@ public:
explicit BlobRect(QQuickItem* parent = nullptr);
~BlobRect() override;
qreal stiffness() const {
[[nodiscard]] qreal stiffness() const {
return m_stiffness;
}
@@ -35,7 +35,7 @@ void setStiffness(qreal s) {
}
}
qreal damping() const {
[[nodiscard]] qreal damping() const {
return m_damping;
}
@@ -46,7 +46,7 @@ void setDamping(qreal d) {
}
}
qreal deformScale() const {
[[nodiscard]] qreal deformScale() const {
return m_deformScale;
}
@@ -62,25 +62,25 @@ QQmlListProperty<BlobRect> exclude();
bool isExcluded(const BlobShape* other) const override;
void cornerRadii(float out[4]) const override;
qreal topLeftRadius() const {
[[nodiscard]] qreal topLeftRadius() const {
return m_topLeftRadius;
}
void setTopLeftRadius(qreal r);
qreal topRightRadius() const {
[[nodiscard]] qreal topRightRadius() const {
return m_topRightRadius;
}
void setTopRightRadius(qreal r);
qreal bottomLeftRadius() const {
[[nodiscard]] qreal bottomLeftRadius() const {
return m_bottomLeftRadius;
}
void setBottomLeftRadius(qreal r);
qreal bottomRightRadius() const {
[[nodiscard]] qreal bottomRightRadius() const {
return m_bottomRightRadius;
}
+6 -7
View File
@@ -21,23 +21,23 @@ public:
explicit BlobShape(QQuickItem* parent = nullptr);
~BlobShape() override = default;
BlobGroup* group() const {
[[nodiscard]] BlobGroup* group() const {
return m_group;
}
void setGroup(BlobGroup* g);
qreal radius() const {
[[nodiscard]] qreal radius() const {
return m_radius;
}
void setRadius(qreal r);
QMatrix4x4 deformMatrix() const {
[[nodiscard]] QMatrix4x4 deformMatrix() const {
return m_centeredDeformMatrix;
}
QMatrix4x4 rawDeformMatrix() const {
[[nodiscard]] QMatrix4x4 rawDeformMatrix() const {
return m_deformMatrix;
}
@@ -53,7 +53,7 @@ void geometryChange(const QRectF& newGeometry, const QRectF& oldGeometry) overri
void updatePolish() override;
QSGNode* updatePaintNode(QSGNode* oldNode, UpdatePaintNodeData*) override;
virtual bool isInvertedRect() const {
[[nodiscard]] virtual bool isInvertedRect() const {
return false;
}
@@ -72,10 +72,9 @@ void updateCenteredDeformMatrix();
BlobGroup* m_group = nullptr;
qreal m_radius = 0;
QMatrix4x4 m_deformMatrix; // identity by default
QMatrix4x4 m_deformMatrix;
QMatrix4x4 m_centeredDeformMatrix;
// Cached data from updatePolish
float m_cachedPaddedX = 0;
float m_cachedPaddedY = 0;
float m_cachedPaddedW = 0;
+1 -1
View File
@@ -9,7 +9,7 @@
#include <qrect.h>
#include <qvector.h>
namespace ZShell::components {
namespace ZShell::Components {
class LazyListViewAttached : public QObject {
Q_OBJECT
+2 -2
View File
@@ -5,7 +5,7 @@
#include <qqmlintegration.h>
#include <qquickpainteditem.h>
namespace ZShell::internal {
namespace ZShell::Internal {
class ArcGauge : public QQuickPaintedItem {
Q_OBJECT
@@ -58,4 +58,4 @@ qreal m_sweepAngle = 1.5 * M_PI;
qreal m_lineWidth = 10.0;
};
} // namespace ZShell::internal
} // namespace ZShell::Internal
@@ -4,7 +4,7 @@
#include <qobject.h>
#include <qqmlintegration.h>
namespace ZShell::internal {
namespace ZShell::Internal {
class CachingImageManager : public QObject {
Q_OBJECT
@@ -19,7 +19,8 @@ class CachingImageManager : public QObject {
public:
explicit CachingImageManager(QObject* parent = nullptr)
: QObject(parent)
, m_item(nullptr) {}
, m_item(nullptr) {
}
[[nodiscard]] QQuickItem* item() const;
void setItem(QQuickItem* item);
+1 -1
View File
@@ -4,7 +4,7 @@
#include <qqmlintegration.h>
#include <qvector.h>
namespace ZShell::internal {
namespace ZShell::Internal {
class CircularBuffer : public QObject {
Q_OBJECT
@@ -1,10 +1,11 @@
#pragma once
#include <cstdint>
#include <qeasingcurve.h>
#include <qobject.h>
#include <qqmlintegration.h>
namespace ZShell::internal {
namespace ZShell::Internal {
class CircularIndicatorManager : public QObject {
Q_OBJECT
@@ -24,7 +25,7 @@ Q_PROPERTY(IndeterminateAnimationType indeterminateAnimationType READ indetermin
public:
explicit CircularIndicatorManager(QObject* parent = nullptr);
enum IndeterminateAnimationType {
enum IndeterminateAnimationType: std::uint8_t {
Advance = 0,
Retreat
};
+1 -1
View File
@@ -5,7 +5,7 @@
#include <qqmlintegration.h>
#include <qqmllist.h>
namespace ZShell::internal::hypr {
namespace ZShell::Internal::Hypr {
class HyprKeyboard : public QObject {
Q_OBJECT
+1 -1
View File
@@ -10,7 +10,7 @@
#include <qstringlist.h>
#include <qvariant.h>
namespace ZShell::internal::hypr {
namespace ZShell::Internal::Hypr {
class HyprDevices;
+1 -1
View File
@@ -3,7 +3,7 @@
#include <qobject.h>
#include <qqmlintegration.h>
namespace ZShell::internal {
namespace ZShell::Internal {
class LidWatcher : public QObject {
Q_OBJECT
+1 -1
View File
@@ -7,7 +7,7 @@
#include "circularbuffer.hpp"
namespace ZShell::internal {
namespace ZShell::Internal {
class SparklineItem : public QQuickPaintedItem {
Q_OBJECT
+1 -1
View File
@@ -7,7 +7,7 @@
#include <QFutureWatcher>
#include <QtQml/qqml.h>
namespace ZShell::internal {
namespace ZShell::Internal {
class WallpaperImage : public QQuickItem {
Q_OBJECT
+6 -5
View File
@@ -1,5 +1,6 @@
#pragma once
#include <cstdint>
#include <qabstractitemmodel.h>
#include <qdir.h>
#include <qfilesystemwatcher.h>
@@ -10,7 +11,7 @@
#include <qqmlintegration.h>
#include <qqmllist.h>
namespace ZShell::models {
namespace ZShell::Models {
class FileSystemEntry : public QObject {
Q_OBJECT
@@ -75,7 +76,7 @@ class FileSystemModel : public QAbstractListModel {
Q_PROPERTY(QQmlListProperty<ZShell::models::FileSystemEntry> entries READ entries NOTIFY entriesChanged)
public:
enum Filter {
enum Filter: std::uint8_t {
NoFilter,
Images,
Files,
@@ -85,9 +86,9 @@ public:
explicit FileSystemModel(QObject* parent = nullptr);
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
QHash<int, QByteArray> roleNames() const override;
[[nodiscard]] int rowCount(const QModelIndex& parent = QModelIndex()) const override;
[[nodiscard]] QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
[[nodiscard]] QHash<int, QByteArray> roleNames() const override;
[[nodiscard]] QString path() const;
void setPath(const QString& path);
+2 -2
View File
@@ -10,7 +10,7 @@
#include <thread>
#include <vector>
namespace ZShell::services {
namespace ZShell::Services {
namespace ac {
@@ -59,7 +59,7 @@ quint32 readChunk(double* out, quint32 count = 0);
private:
explicit AudioCollector(QObject* parent = nullptr);
~AudioCollector();
~AudioCollector() override;
std::jthread m_thread;
std::vector<float> m_buffer1;
+3 -4
View File
@@ -4,18 +4,17 @@
#include <qqmlintegration.h>
#include <qtimer.h>
namespace ZShell::services {
namespace ZShell::Services {
class AudioProcessor : public QObject {
Q_OBJECT
public:
explicit AudioProcessor(QObject* parent = nullptr);
~AudioProcessor();
~AudioProcessor() override;
void init();
public slots:
void start();
void stop();
@@ -31,7 +30,7 @@ Q_OBJECT
public:
explicit AudioProvider(QObject* parent = nullptr);
~AudioProvider();
~AudioProvider() override;
protected:
AudioProcessor* m_processor;
+1 -1
View File
@@ -11,7 +11,7 @@ Q_OBJECT
public:
explicit BeatProcessor(QObject* parent = nullptr);
~BeatProcessor();
~BeatProcessor() override;
signals:
void beat(smpl_t bpm);
+1 -1
View File
@@ -11,7 +11,7 @@ Q_OBJECT
public:
explicit CavaProcessor(QObject* parent = nullptr);
~CavaProcessor();
~CavaProcessor() override;
void setBars(int bars);
+7 -6
View File
@@ -4,8 +4,9 @@
#include <QList>
#include <QString>
#include <QQmlEngine>
#include <cstdint>
namespace ZShell::services {
namespace ZShell::Services {
struct DesktopItem {
QString fileName;
@@ -20,7 +21,7 @@ Q_OBJECT
QML_ELEMENT
public:
enum DesktopRoles {
enum DesktopRoles: std::uint16_t {
FileNameRole = Qt::UserRole + 1,
FilePathRole,
IsDirRole,
@@ -30,9 +31,9 @@ enum DesktopRoles {
explicit DesktopModel(QObject *parent = nullptr);
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
QHash<int, QByteArray> roleNames() const override;
[[nodiscard]] int rowCount(const QModelIndex &parent = QModelIndex()) const override;
[[nodiscard]] QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
[[nodiscard]] QHash<int, QByteArray> roleNames() const override;
Q_INVOKABLE void loadDirectory(const QString &path);
Q_INVOKABLE void moveIcon(int index, int newX, int newY);
@@ -43,4 +44,4 @@ QList<DesktopItem> m_items;
void saveCurrentLayout();
};
} // namespace ZShell::services
} // namespace ZShell::Services
@@ -4,7 +4,7 @@
#include <QVariantMap>
#include <QQmlEngine>
namespace ZShell::services {
namespace ZShell::Services {
class DesktopStateManager : public QObject {
Q_OBJECT
@@ -18,7 +18,7 @@ Q_INVOKABLE void saveLayout(const QVariantMap& layout);
Q_INVOKABLE QVariantMap getLayout();
private:
QString getConfigFilePath() const;
[[nodiscard]] QString getConfigFilePath() const;
};
} // namespace ZShell::services
@@ -7,7 +7,7 @@
#include <qqmlintegration.h>
#include <qtmetamacros.h>
namespace ZShell::services {
namespace ZShell::Services {
class HyprsunsetManager : public QObject {
Q_OBJECT
+1 -1
View File
@@ -3,7 +3,7 @@
#include <qobject.h>
#include <qset.h>
namespace ZShell::services {
namespace ZShell::Services {
class Service : public QObject {
Q_OBJECT
+1 -1
View File
@@ -13,7 +13,7 @@ QML_SINGLETON
public:
explicit Qalculator(QObject* parent = nullptr);
Q_INVOKABLE QString eval(const QString& expr, bool printExpr = true) const;
Q_INVOKABLE [[nodiscard]] QString eval(const QString& expr, bool printExpr = true) const;
};
} // namespace ZShell
+2 -1
View File
@@ -1,5 +1,6 @@
#pragma once
#include <cstdint>
#include <qobject.h>
#include <qqmlintegration.h>
#include <qqmllist.h>
@@ -20,7 +21,7 @@ Q_PROPERTY(int timeout READ timeout CONSTANT)
Q_PROPERTY(Type type READ type CONSTANT)
public:
enum class Type {
enum class Type: std::uint8_t {
Info = 0,
Success,
Warning,
+3 -3
View File
@@ -29,9 +29,9 @@ Q_INVOKABLE void cacheImage(const QUrl& source, const QString& cacheDir, QJSValu
Q_INVOKABLE void cacheImage(const QUrl& source, const QString& cacheDir, QJSValue onSaved, QJSValue onFailed);
// clang-format on
Q_INVOKABLE bool copyFile(const QUrl& source, const QUrl& target, bool overwrite = true) const;
Q_INVOKABLE bool deleteFile(const QUrl& path) const;
Q_INVOKABLE QString toLocalFile(const QUrl& url) const;
Q_INVOKABLE [[nodiscard]] bool copyFile(const QUrl& source, const QUrl& target, bool overwrite = true) const;
Q_INVOKABLE [[nodiscard]] bool deleteFile(const QUrl& path) const;
Q_INVOKABLE [[nodiscard]] QString toLocalFile(const QUrl& url) const;
private:
bool loadSourceImage(const QUrl& source, QImage& image) const;