Skip to content

Commit 0841424

Browse files
committed
Support getting previous and next item
1 parent 330d850 commit 0841424

30 files changed

+349
-20
lines changed

src/libs/application/dspxmodel/src/AnchorNode.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,22 @@ namespace dspx {
1919
}
2020
}
2121

22+
void AnchorNodePrivate::setPreviousItem(AnchorNode *item, AnchorNode *previousItem) {
23+
auto d = item->d_func();
24+
if (d->previousItem != previousItem) {
25+
d->previousItem = previousItem;
26+
Q_EMIT item->previousItemChanged();
27+
}
28+
}
29+
30+
void AnchorNodePrivate::setNextItem(AnchorNode *item, AnchorNode *nextItem) {
31+
auto d = item->d_func();
32+
if (d->nextItem != nextItem) {
33+
d->nextItem = nextItem;
34+
Q_EMIT item->nextItemChanged();
35+
}
36+
}
37+
2238
AnchorNode::AnchorNode(Handle handle, Model *model)
2339
: EntityObject(handle, model), d_ptr(new AnchorNodePrivate) {
2440
Q_D(AnchorNode);
@@ -84,6 +100,16 @@ namespace dspx {
84100
return d->anchorNodeSequence;
85101
}
86102

103+
AnchorNode *AnchorNode::previousItem() const {
104+
Q_D(const AnchorNode);
105+
return d->previousItem;
106+
}
107+
108+
AnchorNode *AnchorNode::nextItem() const {
109+
Q_D(const AnchorNode);
110+
return d->nextItem;
111+
}
112+
87113
void AnchorNode::handleSetEntityProperty(int property, const QVariant &value) {
88114
Q_D(AnchorNode);
89115
switch (property) {

src/libs/application/dspxmodel/src/AnchorNode.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ namespace dspx {
2626
Q_PROPERTY(int x READ x WRITE setX NOTIFY xChanged)
2727
Q_PROPERTY(int y READ y WRITE setY NOTIFY yChanged)
2828
Q_PROPERTY(AnchorNodeSequence *anchorNodeSequence READ anchorNodeSequence NOTIFY anchorNodeSequenceChanged)
29+
Q_PROPERTY(AnchorNode *previousItem READ previousItem NOTIFY previousItemChanged)
30+
Q_PROPERTY(AnchorNode *nextItem READ nextItem NOTIFY nextItemChanged)
2931

3032
public:
3133
enum InterpolationMode {
@@ -50,12 +52,16 @@ namespace dspx {
5052
void fromQDspx(const QDspx::AnchorNode &node);
5153

5254
AnchorNodeSequence *anchorNodeSequence() const;
55+
AnchorNode *previousItem() const;
56+
AnchorNode *nextItem() const;
5357

5458
Q_SIGNALS:
5559
void interpChanged(InterpolationMode interp);
5660
void xChanged(int x);
5761
void yChanged(int y);
5862
void anchorNodeSequenceChanged();
63+
void previousItemChanged();
64+
void nextItemChanged();
5965

6066
protected:
6167
void handleSetEntityProperty(int property, const QVariant &value) override;

src/libs/application/dspxmodel/src/AnchorNodeSequence_p.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,14 @@
88

99
namespace dspx {
1010

11-
class AnchorNodeSequencePrivate : public PointSequenceData<AnchorNodeSequence, AnchorNode, &AnchorNode::x, &AnchorNode::xChanged, &AnchorNodePrivate::setAnchorNodeSequence> {
11+
class AnchorNodeSequencePrivate : public PointSequenceData<
12+
AnchorNodeSequence,
13+
AnchorNode,
14+
&AnchorNode::x,
15+
&AnchorNode::xChanged,
16+
&AnchorNodePrivate::setAnchorNodeSequence,
17+
&AnchorNodePrivate::setPreviousItem,
18+
&AnchorNodePrivate::setNextItem> {
1219
Q_DECLARE_PUBLIC(AnchorNodeSequence)
1320
public:
1421
ParamCurveAnchor *paramCurveAnchor{};

src/libs/application/dspxmodel/src/AnchorNode_p.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@ namespace dspx {
1313
int x;
1414
int y;
1515
AnchorNodeSequence *anchorNodeSequence{};
16-
17-
16+
AnchorNode *previousItem{};
17+
AnchorNode *nextItem{};
1818

1919
static void setAnchorNodeSequence(AnchorNode *item, AnchorNodeSequence *anchorNodeSequence);
20+
static void setPreviousItem(AnchorNode *item, AnchorNode *previousItem);
21+
static void setNextItem(AnchorNode *item, AnchorNode *nextItem);
2022
};
2123

2224
}

src/libs/application/dspxmodel/src/Clip.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,22 @@ namespace dspx {
3232
}
3333
}
3434

35+
void ClipPrivate::setPreviousItem(Clip *item, Clip *previousItem) {
36+
auto d = item->d_func();
37+
if (d->previousItem != previousItem) {
38+
d->previousItem = previousItem;
39+
Q_EMIT item->previousItemChanged();
40+
}
41+
}
42+
43+
void ClipPrivate::setNextItem(Clip *item, Clip *nextItem) {
44+
auto d = item->d_func();
45+
if (d->nextItem != nextItem) {
46+
d->nextItem = nextItem;
47+
Q_EMIT item->nextItemChanged();
48+
}
49+
}
50+
3551
Clip::Clip(ClipType type, Handle handle, Model *model) : EntityObject(handle, model), d_ptr(new ClipPrivate) {
3652
Q_D(Clip);
3753
d->q_ptr = this;
@@ -115,6 +131,16 @@ namespace dspx {
115131
return d->clipSequence;
116132
}
117133

134+
Clip *Clip::previousItem() const {
135+
Q_D(const Clip);
136+
return d->previousItem;
137+
}
138+
139+
Clip *Clip::nextItem() const {
140+
Q_D(const Clip);
141+
return d->nextItem;
142+
}
143+
118144
int Clip::position() const {
119145
Q_D(const Clip);
120146
return d->time->start() + d->time->clipStart();

src/libs/application/dspxmodel/src/Clip.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ namespace dspx {
3030
Q_PROPERTY(ClipType type READ type CONSTANT)
3131
Q_PROPERTY(Workspace *workspace READ workspace CONSTANT)
3232
Q_PROPERTY(ClipSequence *clipSequence READ clipSequence NOTIFY clipSequenceChanged)
33+
Q_PROPERTY(Clip *previousItem READ previousItem NOTIFY previousItemChanged)
34+
Q_PROPERTY(Clip *nextItem READ nextItem NOTIFY nextItemChanged)
3335
Q_PROPERTY(bool overlapped READ isOverlapped NOTIFY overlappedChanged)
3436
public:
3537
enum ClipType {
@@ -56,6 +58,9 @@ namespace dspx {
5658

5759
ClipSequence *clipSequence() const;
5860

61+
Clip *previousItem() const;
62+
Clip *nextItem() const;
63+
5964
int position() const;
6065

6166
int length() const;
@@ -65,6 +70,8 @@ namespace dspx {
6570
Q_SIGNALS:
6671
void nameChanged(const QString &name);
6772
void clipSequenceChanged();
73+
void previousItemChanged();
74+
void nextItemChanged();
6875
void positionChanged(int position);
6976
void lengthChanged(int length);
7077
void overlappedChanged(bool overlapped);

src/libs/application/dspxmodel/src/ClipSequence_p.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace dspx {
1010

11-
class ClipSequencePrivate : public RangeSequenceData<ClipSequence, Clip, &Clip::position, &Clip::positionChanged, &Clip::length, &Clip::lengthChanged, &ClipPrivate::setOverlapped, &ClipPrivate::setClipSequence> {
11+
class ClipSequencePrivate : public RangeSequenceData<ClipSequence, Clip, &Clip::position, &Clip::positionChanged, &Clip::length, &Clip::lengthChanged, &ClipPrivate::setOverlapped, &ClipPrivate::setClipSequence, &ClipPrivate::setPreviousItem, &ClipPrivate::setNextItem> {
1212
Q_DECLARE_PUBLIC(ClipSequence)
1313
public:
1414
Track *track{};

src/libs/application/dspxmodel/src/Clip_p.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,15 @@ namespace dspx {
1515
ClipTime *time;
1616
Clip::ClipType type;
1717
ClipSequence *clipSequence{};
18+
Clip *previousItem{};
19+
Clip *nextItem{};
1820
Workspace *workspace;
1921
bool overlapped{};
2022

2123
static void setOverlapped(Clip *item, bool overlapped);
2224
static void setClipSequence(Clip *item, ClipSequence *clipSequence);
25+
static void setPreviousItem(Clip *item, Clip *previousItem);
26+
static void setNextItem(Clip *item, Clip *nextItem);
2327
};
2428

2529
}

src/libs/application/dspxmodel/src/Label.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,22 @@ namespace dspx {
2020
}
2121
}
2222

23+
void LabelPrivate::setPreviousItem(Label *item, Label *previousItem) {
24+
auto d = item->d_func();
25+
if (d->previousItem != previousItem) {
26+
d->previousItem = previousItem;
27+
Q_EMIT item->previousItemChanged();
28+
}
29+
}
30+
31+
void LabelPrivate::setNextItem(Label *item, Label *nextItem) {
32+
auto d = item->d_func();
33+
if (d->nextItem != nextItem) {
34+
d->nextItem = nextItem;
35+
Q_EMIT item->nextItemChanged();
36+
}
37+
}
38+
2339
Label::Label(Handle handle, Model *model) : EntityObject(handle, model), d_ptr(new LabelPrivate) {
2440
Q_D(Label);
2541
Q_ASSERT(model->strategy()->getEntityType(handle) == ModelStrategy::EI_Label);
@@ -56,6 +72,16 @@ namespace dspx {
5672
return d->labelSequence;
5773
}
5874

75+
Label *Label::previousItem() const {
76+
Q_D(const Label);
77+
return d->previousItem;
78+
}
79+
80+
Label *Label::nextItem() const {
81+
Q_D(const Label);
82+
return d->nextItem;
83+
}
84+
5985
QDspx::Label Label::toQDspx() const {
6086
return {
6187
.pos = pos(),

src/libs/application/dspxmodel/src/Label.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ namespace dspx {
2222
Q_PROPERTY(int pos READ pos WRITE setPos NOTIFY posChanged)
2323
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
2424
Q_PROPERTY(LabelSequence *labelSequence READ labelSequence NOTIFY labelSequenceChanged)
25+
Q_PROPERTY(Label *previousItem READ previousItem NOTIFY previousItemChanged)
26+
Q_PROPERTY(Label *nextItem READ nextItem NOTIFY nextItemChanged)
2527
public:
2628
~Label() override;
2729

@@ -33,13 +35,18 @@ namespace dspx {
3335

3436
LabelSequence *labelSequence() const;
3537

38+
Label *previousItem() const;
39+
Label *nextItem() const;
40+
3641
QDspx::Label toQDspx() const;
3742
void fromQDspx(const QDspx::Label &label);
3843

3944
Q_SIGNALS:
4045
void posChanged(int pos);
4146
void textChanged(const QString &text);
4247
void labelSequenceChanged();
48+
void previousItemChanged();
49+
void nextItemChanged();
4350

4451
protected:
4552
void handleSetEntityProperty(int property, const QVariant &value) override;

0 commit comments

Comments
 (0)