Diffstat (limited to 'noncore/multimedia/tonleiter/editinst.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/tonleiter/editinst.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/noncore/multimedia/tonleiter/editinst.cpp b/noncore/multimedia/tonleiter/editinst.cpp index 120c3ac..f172ef8 100644 --- a/noncore/multimedia/tonleiter/editinst.cpp +++ b/noncore/multimedia/tonleiter/editinst.cpp | |||
@@ -17,91 +17,93 @@ Menu::InstEditDialog::InstEditDialog(TonleiterData* data,QWidget* parent,const c | |||
17 | boxInst=new QComboBox(this,"boxInst"); | 17 | boxInst=new QComboBox(this,"boxInst"); |
18 | boxInst->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); | 18 | boxInst->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); |
19 | connect(boxInst,SIGNAL(activated(int)),this,SLOT(setCurrentInstrumetID(int))); | 19 | connect(boxInst,SIGNAL(activated(int)),this,SLOT(setCurrentInstrumetID(int))); |
20 | for(int i=0;i<data->noOfInstruments();i++) | 20 | for(int i=0;i<data->noOfInstruments();i++) |
21 | { | 21 | { |
22 | Instrument inst=data->getInstrument(i); | 22 | Instrument inst=data->getInstrument(i); |
23 | QString name=inst.instName(); | 23 | QString name=inst.instName(); |
24 | if(name.isNull()) continue; | 24 | if(name.isNull()) continue; |
25 | boxInst->insertItem(name,i); | 25 | boxInst->insertItem(name,i); |
26 | } | 26 | } |
27 | boxInst->setCurrentItem(instid); | 27 | boxInst->setCurrentItem(instid); |
28 | toplayout->addWidget(boxInst); | 28 | toplayout->addWidget(boxInst); |
29 | 29 | ||
30 | QPushButton* addButton=new QPushButton(tr("Add"),this,"addButton"); | 30 | QPushButton* addButton=new QPushButton(tr("Add"),this,"addButton"); |
31 | connect(addButton,SIGNAL(pressed()),this,SLOT(addInstrument())); | 31 | connect(addButton,SIGNAL(pressed()),this,SLOT(addInstrument())); |
32 | toplayout->addWidget(addButton); | 32 | toplayout->addWidget(addButton); |
33 | 33 | ||
34 | QPushButton* delButton=new QPushButton(tr("Delete"),this,"delButton"); | 34 | QPushButton* delButton=new QPushButton(tr("Delete"),this,"delButton"); |
35 | connect(delButton,SIGNAL(pressed()),this,SLOT(deleteInstrument())); | 35 | connect(delButton,SIGNAL(pressed()),this,SLOT(deleteInstrument())); |
36 | toplayout->addWidget(delButton); | 36 | toplayout->addWidget(delButton); |
37 | 37 | ||
38 | QPushButton* addhighButton=new QPushButton(tr("Add High String"),this,"addhighButton"); | 38 | QPushButton* addhighButton=new QPushButton(tr("Add High String"),this,"addhighButton"); |
39 | masterlayout->addWidget(addhighButton); | 39 | masterlayout->addWidget(addhighButton); |
40 | 40 | ||
41 | QScrollView* scrollview=new QScrollView(this); | 41 | scrollview=new QScrollView(this); |
42 | scrollview->setVScrollBarMode(QScrollView::AlwaysOn); | 42 | scrollview->setVScrollBarMode(QScrollView::AlwaysOn); |
43 | scrollview->setHScrollBarMode(QScrollView::AlwaysOff); | 43 | scrollview->setHScrollBarMode(QScrollView::AlwaysOff); |
44 | stringwidget=new QVBox(scrollview->viewport()); | 44 | stringwidget=new QVBox(scrollview->viewport()); |
45 | stringwidget->setSizePolicy(QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum)); | 45 | stringwidget->setSizePolicy(QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum)); |
46 | stringwidget->setSpacing(10); | 46 | stringwidget->setSpacing(10); |
47 | scrollview->addChild(stringwidget); | 47 | scrollview->addChild(stringwidget); |
48 | scrollview->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); | 48 | scrollview->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); |
49 | //scrollview->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::MinimumExpanding)); | ||
50 | masterlayout->addWidget(scrollview); | 49 | masterlayout->addWidget(scrollview); |
51 | 50 | ||
52 | loadInstrument(); | 51 | loadInstrument(); |
53 | 52 | ||
54 | QPushButton* addlowButton=new QPushButton(tr("Add Low String"),this,"addlowButton"); | 53 | QPushButton* addlowButton=new QPushButton(tr("Add Low String"),this,"addlowButton"); |
55 | masterlayout->addWidget(addlowButton); | 54 | masterlayout->addWidget(addlowButton); |
56 | 55 | ||
57 | //make dialog fit the screen | 56 | //make dialog fit the screen |
58 | showMaximized(); | 57 | showMaximized(); |
59 | } | 58 | } |
60 | //**************************************************************************** | 59 | //**************************************************************************** |
61 | Menu::InstEditDialog::~InstEditDialog() | 60 | Menu::InstEditDialog::~InstEditDialog() |
62 | { | 61 | { |
63 | } | 62 | } |
64 | //**************************************************************************** | 63 | //**************************************************************************** |
65 | void Menu::InstEditDialog::setCurrentInstrumetID(int id) | 64 | void Menu::InstEditDialog::setCurrentInstrumetID(int id) |
66 | { | 65 | { |
67 | saveInstrument(); | 66 | saveInstrument(); |
68 | instid=id; | 67 | instid=id; |
69 | data->setCurrentInstrumetID(id); | 68 | data->setCurrentInstrumetID(id); |
70 | loadInstrument(); | 69 | loadInstrument(); |
71 | } | 70 | } |
72 | //**************************************************************************** | 71 | //**************************************************************************** |
73 | void Menu::InstEditDialog::addInstrument() | 72 | void Menu::InstEditDialog::addInstrument() |
74 | { | 73 | { |
75 | } | 74 | } |
76 | //**************************************************************************** | 75 | //**************************************************************************** |
77 | void Menu::InstEditDialog::deleteInstrument() | 76 | void Menu::InstEditDialog::deleteInstrument() |
78 | { | 77 | { |
79 | } | 78 | } |
80 | //**************************************************************************** | 79 | //**************************************************************************** |
81 | void Menu::InstEditDialog::addLowString() | 80 | void Menu::InstEditDialog::addLowString() |
82 | { | 81 | { |
83 | } | 82 | } |
84 | //**************************************************************************** | 83 | //**************************************************************************** |
85 | void Menu::InstEditDialog::addHighString() | 84 | void Menu::InstEditDialog::addHighString() |
86 | { | 85 | { |
87 | } | 86 | } |
88 | //**************************************************************************** | 87 | //**************************************************************************** |
89 | void Menu::InstEditDialog::deleteString(int id) | 88 | void Menu::InstEditDialog::deleteString(int id) |
90 | { | 89 | { |
91 | } | 90 | } |
92 | //**************************************************************************** | 91 | //**************************************************************************** |
93 | void Menu::InstEditDialog::saveInstrument() | 92 | void Menu::InstEditDialog::saveInstrument() |
94 | { | 93 | { |
94 | //auto delete is set to true so widgets _should_ be deleted | ||
95 | stringlist.clear(); | 95 | stringlist.clear(); |
96 | } | 96 | } |
97 | //**************************************************************************** | 97 | //**************************************************************************** |
98 | void Menu::InstEditDialog::loadInstrument() | 98 | void Menu::InstEditDialog::loadInstrument() |
99 | { | 99 | { |
100 | stringlist.clear(); | ||
100 | Instrument inst=data->getInstrument(instid); | 101 | Instrument inst=data->getInstrument(instid); |
102 | qDebug("load Instrument : %d strings",inst.noOfStrings()); | ||
101 | for(uint s=0;s<inst.noOfStrings();s++) | 103 | for(uint s=0;s<inst.noOfStrings();s++) |
102 | { | 104 | { |
103 | stringlist.append(new EditStringWidget(inst.string(s),stringwidget)); | 105 | stringlist.append(new EditStringWidget(inst.string(s),stringwidget)); |
104 | } | 106 | } |
105 | } | 107 | } |
106 | //**************************************************************************** | 108 | //**************************************************************************** |
107 | //**************************************************************************** | 109 | //**************************************************************************** |