-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcombo_actionnum.cpp
49 lines (41 loc) · 1.34 KB
/
combo_actionnum.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
46
47
48
#include "combo_actionnum.h"
ActionNumComboBox::ActionNumComboBox(QWidget *parent) : QComboBox(parent)
{
// Connect to my custom signal
connect(this, SIGNAL(editTextChanged(QString)), this, SLOT(ActionNumChangedSlot(QString)));
connect(this, SIGNAL(currentIndexChanged(QString)), this, SLOT(ActionNumChangedSlot(QString)));
}
void ActionNumComboBox::setActionNums(switch_function sf)
{
// First clear all prior items
this->clear();
// Different actions are available for different switch functions
switch (sf)
{
case SF_USER:
for (int i=0; i<MAX_NUM_USER_SOUNDS; i++)
{
this->insertItem(i+1, QString::number(i+1),i+1);
}
break;
case SF_SOUNDBANK:
this->insertItem(1,"A",1);
this->insertItem(2,"B",2);
break;
case SF_MG: // Same as number of lights
case SF_CANNON_FIRE: // Same as number of lights
case SF_LIGHT:
for (int i=0; i<NUM_LIGHTS; i++)
{
this->insertItem(i+1, QString::number(i+1),i+1);
}
break;
default:
return;
}
}
void ActionNumComboBox::ActionNumChangedSlot(const QString &)
{
// Send out custom signal with a pointer to this box
emit ActionNumChanged(this);
}