-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcasterplayer_controller.cpp
More file actions
70 lines (59 loc) · 1.53 KB
/
casterplayer_controller.cpp
File metadata and controls
70 lines (59 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#include "casterplayer_controller.h"
CasterPlayerController::CasterPlayerController(QObject *parent) : QObject(parent)
{
// Add initial player
mItems.append({
false, // IsInPlayerMode
false, // IsLooped
1.0, // Volume
false, // IsPlayRegionEnabled
0, // PlayRegionBegin
0, // PlayRegionEnd
0 // Trigger Style
});
}
QVector<CasterPlayerItem> CasterPlayerController::items() const
{
return mItems;
}
bool CasterPlayerController::setItemAt(int index, const CasterPlayerItem &item)
{
//Check for out of range index
if (index < 0 || mItems.size() <= index)
return false;
// Set Item
mItems[index] = item;
return true;
}
void CasterPlayerController::appendItem()
{
// Adds player with default settings
emit preItemAppend();
CasterPlayerItem item;
item.isInPlayerMode = false;
item.isLooped = false;
item.volume = 1.0;
item.isPlayRegionEnabled = false;
item.playRegionBegin = 0;
item.playRegionEnd = 0;
item.triggerStyle = 0;
mItems.append(item);
emit postItemAppend();
}
void CasterPlayerController::removeItemAt(int index)
{
//Check if valid index
if (0 <= index && index < mItems.size()) {
emit preItemRemoved(index);
mItems.removeAt(index);
emit postItemRemoved();
}
}
void CasterPlayerController::removeAllItems()
{
for (int i = 0; i < mItems.size(); ) {
emit preItemRemoved(i);
mItems.removeAt(i);
emit postItemRemoved();
}
}