Diffstat (limited to 'noncore/multimedia/tonleiter/menuwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/tonleiter/menuwidget.cpp | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/noncore/multimedia/tonleiter/menuwidget.cpp b/noncore/multimedia/tonleiter/menuwidget.cpp index 3dfa09d..1e3742c 100644 --- a/noncore/multimedia/tonleiter/menuwidget.cpp +++ b/noncore/multimedia/tonleiter/menuwidget.cpp | |||
@@ -1,72 +1,89 @@ | |||
1 | #include "menuwidget.h" | 1 | #include "menuwidget.h" |
2 | 2 | ||
3 | #include <qlabel.h> | 3 | #include <qlabel.h> |
4 | #include <qlayout.h> | 4 | #include <qlayout.h> |
5 | 5 | ||
6 | MenuWidget::MenuWidget(TonleiterData* data,QWidget* parent,const char* name,WFlags f) | 6 | #include "editinst.h" |
7 | #include "editscale.h" | ||
8 | |||
9 | Menu::MenuWidget::MenuWidget(TonleiterData* data,QWidget* parent,const char* name,WFlags f) | ||
7 | :QWidget(parent,name,f),data(data) | 10 | :QWidget(parent,name,f),data(data) |
8 | { | 11 | { |
9 | QGridLayout* layout=new QGridLayout(this,3,3,10,-1,"menulayout"); | 12 | QGridLayout* layout=new QGridLayout(this,3,3,10,-1,"menulayout"); |
10 | 13 | ||
11 | QLabel* instLabel=new QLabel(tr("Instr."),this,"instLabel"); | 14 | QLabel* instLabel=new QLabel(tr("Instr."),this,"instLabel"); |
12 | layout->addWidget(instLabel,0,0); | 15 | layout->addWidget(instLabel,0,0); |
13 | boxInst=new QComboBox(this,"boxInst"); | 16 | boxInst=new QComboBox(this,"boxInst"); |
14 | connect(boxInst,SIGNAL(activated(int)),data,SLOT(setCurrentInstrumetID(int))); | 17 | connect(boxInst,SIGNAL(activated(int)),data,SLOT(setCurrentInstrumetID(int))); |
15 | layout->addWidget(boxInst,0,1); | 18 | layout->addWidget(boxInst,0,1); |
16 | editInst=new QPushButton(tr("Edit"),this,"editInst"); | 19 | editInst=new QPushButton(tr("Edit"),this,"editInst"); |
20 | connect(editInst,SIGNAL(pressed()),this,SLOT(editInstPressed())); | ||
17 | layout->addWidget(editInst,0,2); | 21 | layout->addWidget(editInst,0,2); |
18 | 22 | ||
19 | QLabel* noteLabel=new QLabel(tr("Note"),this,"noteLabel"); | 23 | QLabel* noteLabel=new QLabel(tr("Note"),this,"noteLabel"); |
20 | layout->addWidget(noteLabel,1,0); | 24 | layout->addWidget(noteLabel,1,0); |
21 | boxNote=new QComboBox(this,"boxNote"); | 25 | boxNote=new QComboBox(this,"boxNote"); |
22 | connect(boxNote,SIGNAL(activated(int)),data,SLOT(setCurrentNote(int))); | 26 | connect(boxNote,SIGNAL(activated(int)),data,SLOT(setCurrentNote(int))); |
23 | layout->addWidget(boxNote,1,1); | 27 | layout->addWidget(boxNote,1,1); |
24 | for(int a=0;a<12;a++) | 28 | for(int a=0;a<12;a++) |
25 | boxNote->insertItem(Note::notenames[a],a); | 29 | boxNote->insertItem(Note::notenames[a],a); |
26 | boxNote->setCurrentItem(data->getCurrentBaseNote()); | 30 | boxNote->setCurrentItem(data->getCurrentBaseNote()); |
27 | noteCheck=new QCheckBox(tr("show"),this,"noteCheck"); | 31 | noteCheck=new QCheckBox(tr("show"),this,"noteCheck"); |
28 | noteCheck->setChecked(data->isDrawNames()); | 32 | noteCheck->setChecked(data->isDrawNames()); |
29 | connect(noteCheck,SIGNAL(toggled(bool)),data,SLOT(setDrawNames(bool))); | 33 | connect(noteCheck,SIGNAL(toggled(bool)),data,SLOT(setDrawNames(bool))); |
30 | layout->addWidget(noteCheck,1,2); | 34 | layout->addWidget(noteCheck,1,2); |
31 | 35 | ||
32 | QLabel* scaleLabel=new QLabel(tr("Scale"),this,"scaleLabel"); | 36 | QLabel* scaleLabel=new QLabel(tr("Scale"),this,"scaleLabel"); |
33 | layout->addWidget(scaleLabel,2,0); | 37 | layout->addWidget(scaleLabel,2,0); |
34 | boxScale=new QComboBox(this,"boxScale"); | 38 | boxScale=new QComboBox(this,"boxScale"); |
35 | connect(boxScale,SIGNAL(activated(int)),data,SLOT(setCurrentScaleID(int))); | 39 | connect(boxScale,SIGNAL(activated(int)),data,SLOT(setCurrentScaleID(int))); |
36 | layout->addWidget(boxScale,2,1); | 40 | layout->addWidget(boxScale,2,1); |
37 | editScale=new QPushButton(tr("Edit"),this,"editScale"); | 41 | editScale=new QPushButton(tr("Edit"),this,"editScale"); |
42 | connect(editScale,SIGNAL(pressed()),this,SLOT(editScalePressed())); | ||
38 | layout->addWidget(editScale,2,2); | 43 | layout->addWidget(editScale,2,2); |
39 | 44 | ||
40 | updateBoxes(); | 45 | updateBoxes(); |
41 | 46 | ||
42 | } | 47 | } |
43 | //**************************************************************************** | 48 | //**************************************************************************** |
44 | MenuWidget::~MenuWidget() | 49 | Menu::MenuWidget::~MenuWidget() |
50 | { | ||
51 | } | ||
52 | //**************************************************************************** | ||
53 | void Menu::MenuWidget::editInstPressed() | ||
54 | { | ||
55 | InstEditDialog* instdialog=new InstEditDialog(data,this); | ||
56 | instdialog->exec(); | ||
57 | } | ||
58 | //**************************************************************************** | ||
59 | void Menu::MenuWidget::editScalePressed() | ||
45 | { | 60 | { |
61 | ScaleEditDialog* scaledialog=new ScaleEditDialog(data,this); | ||
62 | scaledialog->exec(); | ||
46 | } | 63 | } |
47 | //**************************************************************************** | 64 | //**************************************************************************** |
48 | void MenuWidget::updateBoxes() | 65 | void Menu::MenuWidget::updateBoxes() |
49 | { | 66 | { |
50 | boxInst->clear(); | 67 | boxInst->clear(); |
51 | 68 | ||
52 | for(int i=0;i<data->noOfInstruments();i++) | 69 | for(int i=0;i<data->noOfInstruments();i++) |
53 | { | 70 | { |
54 | Instrument inst=data->getInstrument(i); | 71 | Instrument inst=data->getInstrument(i); |
55 | QString name=inst.instName(); | 72 | QString name=inst.instName(); |
56 | if(name.isNull()) continue; | 73 | if(name.isNull()) continue; |
57 | boxInst->insertItem(name,i); | 74 | boxInst->insertItem(name,i); |
58 | } | 75 | } |
59 | boxInst->setCurrentItem(data->getCurrentInstrumentID()); | 76 | boxInst->setCurrentItem(data->getCurrentInstrumentID()); |
60 | 77 | ||
61 | boxScale->clear(); | 78 | boxScale->clear(); |
62 | for(int s=0;s<data->noOfScales();s++) | 79 | for(int s=0;s<data->noOfScales();s++) |
63 | { | 80 | { |
64 | Scale scale=data->getScale(s); | 81 | Scale scale=data->getScale(s); |
65 | QString name=scale.scaleName(); | 82 | QString name=scale.scaleName(); |
66 | if(name.isNull()) continue; | 83 | if(name.isNull()) continue; |
67 | boxScale->insertItem(name,s); | 84 | boxScale->insertItem(name,s); |
68 | } | 85 | } |
69 | boxScale->setCurrentItem(data->getCurrentScaleID()); | 86 | boxScale->setCurrentItem(data->getCurrentScaleID()); |
70 | } | 87 | } |
71 | //**************************************************************************** | 88 | //**************************************************************************** |
72 | //**************************************************************************** | 89 | //**************************************************************************** |