clean-up plugin files
C++ / fmt (pull_request) Successful in 4s
JS/TS / fmt (pull_request) Successful in 9s
JS/TS / lint (pull_request) Successful in 22s
Rust / fmt (pull_request) Successful in 56s
Python / static (pull_request) Successful in 1m0s
C++ / build (pull_request) Successful in 2m9s
Rust / build (pull_request) Successful in 2m8s
Rust / clippy (pull_request) Successful in 1m9s
Python / verify (pull_request) Successful in 2m57s
C++ / clang-tidy (pull_request) Successful in 3m58s

This commit is contained in:
2026-08-16 18:14:04 +02:00
parent 4037a1dd0f
commit 654632128f
2 changed files with 16 additions and 100 deletions
+10 -23
View File
@@ -47,8 +47,6 @@ class CarouselView : public QQuickItem {
QEasingCurve::Type glideEasingType READ glideEasingType WRITE
setGlideEasingType NOTIFY glideEasingTypeChanged)
// Extra properties (e.g. { visibilities: root.visibilities }) forwarded
// verbatim onto every delegate instance as a property of the same name.
Q_PROPERTY(
QVariantMap delegateProperties READ delegateProperties WRITE
setDelegateProperties NOTIFY delegatePropertiesChanged)
@@ -79,7 +77,7 @@ class CarouselView : public QQuickItem {
void setMaxWidth(qreal v);
int currentIndex() const { return m_currentRealIndex; }
void setCurrentIndex(int idx); // jumps (animated glide) to a real index
void setCurrentIndex(int idx);
int glideDuration() const { return m_glideDuration; }
void setGlideDuration(int v);
@@ -90,13 +88,10 @@ class CarouselView : public QQuickItem {
QVariantMap delegateProperties() const { return m_delegateProperties; }
void setDelegateProperties(const QVariantMap& v);
// Animated (glides).
Q_INVOKABLE void goToIndex(int realIndex);
Q_INVOKABLE void incrementCurrentIndex();
Q_INVOKABLE void decrementCurrentIndex();
// Instant, no animation -- use for initial placement (e.g. restoring the
// saved wallpaper on Component.onCompleted) where a glide would be wrong.
Q_INVOKABLE void jumpToIndex(int realIndex);
signals:
@@ -112,11 +107,7 @@ class CarouselView : public QQuickItem {
void glideEasingTypeChanged();
void delegatePropertiesChanged();
// Emitted when the currently-centred delegate is clicked while already
// centred (i.e. "activate/select this one").
void activated(int realIndex, QVariant modelData);
// Emitted continuously as the centred item changes, for preview-on-scroll
// behaviour (used to drive Wallpapers.preview() from QML).
void previewIndexChanged(int realIndex, QVariant modelData);
protected:
@@ -134,22 +125,20 @@ class CarouselView : public QQuickItem {
struct Arrangement {
int n = 0;
qreal width = 0;
QVector<qreal> sizes; // sizes[0] = focal, sizes[i] = i-th side item
QVector<qreal>
centers; // centers[0] = 0, centers[i] = i-th side centre offset
QVector<qreal> sizes;
QVector<qreal> centers;
qreal effectiveExtraWidth = 0;
};
struct Slot {
QQuickItem* item = nullptr;
int virtualIndex =
0; // which "virtual" (unbounded) index this slot currently renders
int realIndex = -1; // resolved model index, -1 if none / hidden
int virtualIndex = 0;
int realIndex = -1;
bool active = false;
};
void rebuildArrangement();
void relayout(); // recomputes window + positions every slot (one pass)
void relayout();
void updateSlotContent(Slot& slot, int virtualIndex);
void positionSlot(const Slot& slot) const;
void applyPropertiesToItem(QQuickItem* item, int realIndex) const;
@@ -170,7 +159,7 @@ class CarouselView : public QQuickItem {
int realIndexOf(int virtualIndex) const;
void updateCurrentIndexFromContentX(bool emitPreview);
void wrapContentIfNeeded();
void centerInstantlyOnReal(int realIndex); // no animation, no glide
void centerInstantlyOnReal(int realIndex);
QQuickItem* acquireItem();
void releaseAllItems();
@@ -195,22 +184,20 @@ class CarouselView : public QQuickItem {
static constexpr int kLoopMultiplier = 401;
int m_centerBlockStart = 0;
QList<Slot>
m_slots; // pooled delegate slots, unordered; window recomputed each relayout
QList<Slot> m_slots;
int m_glideDuration = 250;
QEasingCurve::Type m_glideEasingType = QEasingCurve::OutCubic;
QVariantAnimation* m_glideAnim = nullptr;
// Drag / flick state
bool m_dragging = false;
bool m_dragActive = false; // exceeded the drag threshold
bool m_dragActive = false;
QPointF m_pressPos;
qreal m_pressContentX = 0;
QElapsedTimer m_dragTimer;
qreal m_lastMoveX = 0;
qint64 m_lastMoveT = 0;
qreal m_velocity = 0; // px/sec
qreal m_velocity = 0;
QVariantAnimation* m_flickAnim = nullptr;
bool m_initializedLayout = false;