-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheventeditor.cpp
45 lines (40 loc) · 922 Bytes
/
eventeditor.cpp
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
#include "eventeditor.h"
#include "ui_eventeditor.h"
EventEditor::EventEditor(QWidget *parent) :
QWidget(parent),
ui(new Ui::EventEditor)
{
ui->setupUi(this);
ui->saLayout->setAlignment(Qt::AlignTop);
}
void EventEditor::on_addEntry_pb_clicked()
{
if(eventEntries.size() < 256)
append(0, 0);
}
void EventEditor::append(int eventID, int sample)
{
EventEntry* eventEntry = new EventEntry(this, &eventEntries);
eventEntry->setEventID(eventID);
eventEntry->setSample(sample);
ui->saLayout->addWidget(eventEntry);
}
void EventEditor::clear()
{
//Delete all entries
int entryCount = eventEntries.size();
if(entryCount)
{
for(int i = 0; i < entryCount; i++)
{
eventEntries[0]->close();
delete eventEntries[0];
eventEntries.remove(0);
}
}
}
EventEditor::~EventEditor()
{
clear();
delete ui;
}