author | waspe <waspe> | 2003-12-02 19:03:50 (UTC) |
---|---|---|
committer | waspe <waspe> | 2003-12-02 19:03:50 (UTC) |
commit | 64304e555fc3e06aa69fa2f4a514ee55b7aa98bc (patch) (unidiff) | |
tree | 3ce47189f43f18cccd42d326cf52977b339c744d | |
parent | 7b74f202db22d458c43b2063ae128bf79b0e9777 (diff) | |
download | opie-64304e555fc3e06aa69fa2f4a514ee55b7aa98bc.zip opie-64304e555fc3e06aa69fa2f4a514ee55b7aa98bc.tar.gz opie-64304e555fc3e06aa69fa2f4a514ee55b7aa98bc.tar.bz2 |
*** empty log message ***
-rw-r--r-- | noncore/multimedia/tonleiter/editinst.cpp | 93 | ||||
-rw-r--r-- | noncore/multimedia/tonleiter/editinst.h | 31 | ||||
-rw-r--r-- | noncore/multimedia/tonleiter/editscale.cpp | 32 | ||||
-rw-r--r-- | noncore/multimedia/tonleiter/editscale.h | 4 | ||||
-rw-r--r-- | noncore/multimedia/tonleiter/editstringwidget.cpp | 32 | ||||
-rw-r--r-- | noncore/multimedia/tonleiter/editstringwidget.h | 24 | ||||
-rw-r--r-- | noncore/multimedia/tonleiter/menuwidget.cpp | 20 | ||||
-rw-r--r-- | noncore/multimedia/tonleiter/pianoscale.cpp | 96 | ||||
-rw-r--r-- | noncore/multimedia/tonleiter/pianoscale.h | 28 | ||||
-rw-r--r-- | noncore/multimedia/tonleiter/tonleiter.pro | 4 | ||||
-rw-r--r-- | noncore/multimedia/tonleiter/tonleiterdata.cpp | 2 | ||||
-rw-r--r-- | noncore/multimedia/tonleiter/tonleiterdatahelper.cpp | 4 | ||||
-rw-r--r-- | noncore/multimedia/tonleiter/tonleiterdatahelper.h | 2 |
13 files changed, 365 insertions, 7 deletions
diff --git a/noncore/multimedia/tonleiter/editinst.cpp b/noncore/multimedia/tonleiter/editinst.cpp index 1eba4dc..120c3ac 100644 --- a/noncore/multimedia/tonleiter/editinst.cpp +++ b/noncore/multimedia/tonleiter/editinst.cpp | |||
@@ -2,2 +2,5 @@ | |||
2 | 2 | ||
3 | #include <qlabel.h> | ||
4 | #include <qpushbutton.h> | ||
5 | |||
3 | Menu::InstEditDialog::InstEditDialog(TonleiterData* data,QWidget* parent,const char* name) | 6 | Menu::InstEditDialog::InstEditDialog(TonleiterData* data,QWidget* parent,const char* name) |
@@ -6,2 +9,50 @@ Menu::InstEditDialog::InstEditDialog(TonleiterData* data,QWidget* parent,const c | |||
6 | setCaption("Tonleiter::"+tr("Instrument")); | 9 | setCaption("Tonleiter::"+tr("Instrument")); |
10 | QBoxLayout* masterlayout=new QBoxLayout(this,QBoxLayout::TopToBottom); | ||
11 | instid=data->getCurrentInstrumentID(); | ||
12 | stringlist.setAutoDelete(true); | ||
13 | |||
14 | QBoxLayout* toplayout=new QBoxLayout(masterlayout,QBoxLayout::LeftToRight); | ||
15 | |||
16 | //Name combo + Add + Delete | ||
17 | boxInst=new QComboBox(this,"boxInst"); | ||
18 | boxInst->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); | ||
19 | connect(boxInst,SIGNAL(activated(int)),this,SLOT(setCurrentInstrumetID(int))); | ||
20 | for(int i=0;i<data->noOfInstruments();i++) | ||
21 | { | ||
22 | Instrument inst=data->getInstrument(i); | ||
23 | QString name=inst.instName(); | ||
24 | if(name.isNull()) continue; | ||
25 | boxInst->insertItem(name,i); | ||
26 | } | ||
27 | boxInst->setCurrentItem(instid); | ||
28 | toplayout->addWidget(boxInst); | ||
29 | |||
30 | QPushButton* addButton=new QPushButton(tr("Add"),this,"addButton"); | ||
31 | connect(addButton,SIGNAL(pressed()),this,SLOT(addInstrument())); | ||
32 | toplayout->addWidget(addButton); | ||
33 | |||
34 | QPushButton* delButton=new QPushButton(tr("Delete"),this,"delButton"); | ||
35 | connect(delButton,SIGNAL(pressed()),this,SLOT(deleteInstrument())); | ||
36 | toplayout->addWidget(delButton); | ||
37 | |||
38 | QPushButton* addhighButton=new QPushButton(tr("Add High String"),this,"addhighButton"); | ||
39 | masterlayout->addWidget(addhighButton); | ||
40 | |||
41 | QScrollView* scrollview=new QScrollView(this); | ||
42 | scrollview->setVScrollBarMode(QScrollView::AlwaysOn); | ||
43 | scrollview->setHScrollBarMode(QScrollView::AlwaysOff); | ||
44 | stringwidget=new QVBox(scrollview->viewport()); | ||
45 | stringwidget->setSizePolicy(QSizePolicy(QSizePolicy::Minimum,QSizePolicy::Minimum)); | ||
46 | stringwidget->setSpacing(10); | ||
47 | scrollview->addChild(stringwidget); | ||
48 | scrollview->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); | ||
49 | //scrollview->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::MinimumExpanding)); | ||
50 | masterlayout->addWidget(scrollview); | ||
51 | |||
52 | loadInstrument(); | ||
53 | |||
54 | QPushButton* addlowButton=new QPushButton(tr("Add Low String"),this,"addlowButton"); | ||
55 | masterlayout->addWidget(addlowButton); | ||
56 | |||
57 | //make dialog fit the screen | ||
7 | showMaximized(); | 58 | showMaximized(); |
@@ -13,2 +64,44 @@ Menu::InstEditDialog::~InstEditDialog() | |||
13 | //**************************************************************************** | 64 | //**************************************************************************** |
65 | void Menu::InstEditDialog::setCurrentInstrumetID(int id) | ||
66 | { | ||
67 | saveInstrument(); | ||
68 | instid=id; | ||
69 | data->setCurrentInstrumetID(id); | ||
70 | loadInstrument(); | ||
71 | } | ||
72 | //**************************************************************************** | ||
73 | void Menu::InstEditDialog::addInstrument() | ||
74 | { | ||
75 | } | ||
76 | //**************************************************************************** | ||
77 | void Menu::InstEditDialog::deleteInstrument() | ||
78 | { | ||
79 | } | ||
80 | //**************************************************************************** | ||
81 | void Menu::InstEditDialog::addLowString() | ||
82 | { | ||
83 | } | ||
84 | //**************************************************************************** | ||
85 | void Menu::InstEditDialog::addHighString() | ||
86 | { | ||
87 | } | ||
88 | //**************************************************************************** | ||
89 | void Menu::InstEditDialog::deleteString(int id) | ||
90 | { | ||
91 | } | ||
92 | //**************************************************************************** | ||
93 | void Menu::InstEditDialog::saveInstrument() | ||
94 | { | ||
95 | stringlist.clear(); | ||
96 | } | ||
97 | //**************************************************************************** | ||
98 | void Menu::InstEditDialog::loadInstrument() | ||
99 | { | ||
100 | Instrument inst=data->getInstrument(instid); | ||
101 | for(uint s=0;s<inst.noOfStrings();s++) | ||
102 | { | ||
103 | stringlist.append(new EditStringWidget(inst.string(s),stringwidget)); | ||
104 | } | ||
105 | } | ||
106 | //**************************************************************************** | ||
14 | //**************************************************************************** | 107 | //**************************************************************************** |
diff --git a/noncore/multimedia/tonleiter/editinst.h b/noncore/multimedia/tonleiter/editinst.h index e7eba15..948a2de 100644 --- a/noncore/multimedia/tonleiter/editinst.h +++ b/noncore/multimedia/tonleiter/editinst.h | |||
@@ -4,4 +4,11 @@ | |||
4 | #include <qdialog.h> | 4 | #include <qdialog.h> |
5 | #include <qcombobox.h> | ||
6 | #include <qscrollview.h> | ||
7 | #include <qspinbox.h> | ||
8 | #include <qlayout.h> | ||
9 | #include <qlist.h> | ||
10 | #include <qvbox.h> | ||
5 | 11 | ||
6 | #include "tonleiterdata.h" | 12 | |
13 | #include "editstringwidget.h" | ||
7 | 14 | ||
@@ -9,2 +16,3 @@ using namespace Data; | |||
9 | 16 | ||
17 | |||
10 | namespace Menu | 18 | namespace Menu |
@@ -16,2 +24,12 @@ namespace Menu | |||
16 | TonleiterData* data; | 24 | TonleiterData* data; |
25 | int instid; | ||
26 | |||
27 | QComboBox* boxInst; | ||
28 | QSpinBox* stringBox; | ||
29 | |||
30 | QVBox* stringwidget; | ||
31 | |||
32 | //this is a QPtrList !! | ||
33 | typedef QList<EditStringWidget> StringWidgetList; | ||
34 | StringWidgetList stringlist; | ||
17 | public: | 35 | public: |
@@ -19,2 +37,13 @@ namespace Menu | |||
19 | ~InstEditDialog(); | 37 | ~InstEditDialog(); |
38 | private slots: | ||
39 | void setCurrentInstrumetID(int id); | ||
40 | void addInstrument(); | ||
41 | void deleteInstrument(); | ||
42 | |||
43 | void addLowString(); | ||
44 | void addHighString(); | ||
45 | void deleteString(int id); | ||
46 | private: | ||
47 | void saveInstrument(); | ||
48 | void loadInstrument(); | ||
20 | }; | 49 | }; |
diff --git a/noncore/multimedia/tonleiter/editscale.cpp b/noncore/multimedia/tonleiter/editscale.cpp index 593a150..0be0058 100644 --- a/noncore/multimedia/tonleiter/editscale.cpp +++ b/noncore/multimedia/tonleiter/editscale.cpp | |||
@@ -2,2 +2,5 @@ | |||
2 | 2 | ||
3 | #include <qlayout.h> | ||
4 | #include <qpushbutton.h> | ||
5 | |||
3 | Menu::ScaleEditDialog::ScaleEditDialog(TonleiterData* data,QWidget* parent,const char* name) | 6 | Menu::ScaleEditDialog::ScaleEditDialog(TonleiterData* data,QWidget* parent,const char* name) |
@@ -6,2 +9,31 @@ Menu::ScaleEditDialog::ScaleEditDialog(TonleiterData* data,QWidget* parent,const | |||
6 | setCaption("Tonleiter::"+tr("Scale")); | 9 | setCaption("Tonleiter::"+tr("Scale")); |
10 | QBoxLayout* masterlayout=new QBoxLayout(this,QBoxLayout::TopToBottom); | ||
11 | |||
12 | QBoxLayout* toplayout=new QBoxLayout(masterlayout,QBoxLayout::LeftToRight); | ||
13 | |||
14 | boxScale=new QComboBox(this,"boxScale"); | ||
15 | for(int s=0;s<data->noOfScales();s++) | ||
16 | { | ||
17 | Scale scale=data->getScale(s); | ||
18 | QString name=scale.scaleName(); | ||
19 | if(name.isNull()) continue; | ||
20 | //boxScale->insertItem(name,s); | ||
21 | } | ||
22 | boxScale->setCurrentItem(data->getCurrentScaleID()); | ||
23 | boxScale->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); | ||
24 | connect(boxScale,SIGNAL(activated(int)),data,SLOT(setCurrentScaleID(int))); | ||
25 | toplayout->addWidget(boxScale); | ||
26 | |||
27 | QPushButton* addButton=new QPushButton(tr("Add"),this,"addButton"); | ||
28 | connect(addButton,SIGNAL(pressed()),this,SLOT(addInstrument())); | ||
29 | toplayout->addWidget(addButton); | ||
30 | |||
31 | QPushButton* delButton=new QPushButton(tr("Delete"),this,"delButton"); | ||
32 | connect(delButton,SIGNAL(pressed()),this,SLOT(deleteInstrument())); | ||
33 | toplayout->addWidget(delButton); | ||
34 | |||
35 | pianoscale=new PianoScale(this); | ||
36 | masterlayout->addWidget(pianoscale); | ||
37 | |||
38 | //make dialog fit the screen | ||
7 | showMaximized(); | 39 | showMaximized(); |
diff --git a/noncore/multimedia/tonleiter/editscale.h b/noncore/multimedia/tonleiter/editscale.h index 0e5eb1c..1121c1f 100644 --- a/noncore/multimedia/tonleiter/editscale.h +++ b/noncore/multimedia/tonleiter/editscale.h | |||
@@ -4,4 +4,6 @@ | |||
4 | #include <qdialog.h> | 4 | #include <qdialog.h> |
5 | #include <qcombobox.h> | ||
5 | 6 | ||
6 | #include "tonleiterdata.h" | 7 | #include "tonleiterdata.h" |
8 | #include "pianoscale.h" | ||
7 | 9 | ||
@@ -16,2 +18,4 @@ namespace Menu | |||
16 | TonleiterData* data; | 18 | TonleiterData* data; |
19 | QComboBox* boxScale; | ||
20 | PianoScale* pianoscale; | ||
17 | public: | 21 | public: |
diff --git a/noncore/multimedia/tonleiter/editstringwidget.cpp b/noncore/multimedia/tonleiter/editstringwidget.cpp new file mode 100644 index 0000000..d22bbc5 --- a/dev/null +++ b/noncore/multimedia/tonleiter/editstringwidget.cpp | |||
@@ -0,0 +1,32 @@ | |||
1 | #include "editstringwidget.h" | ||
2 | |||
3 | #include <qlabel.h> | ||
4 | #include <qlayout.h> | ||
5 | |||
6 | using namespace Data; | ||
7 | |||
8 | Menu::EditStringWidget::EditStringWidget(int note,QWidget* parent,const char* name,WFlags f) | ||
9 | :QFrame(parent,name,f) | ||
10 | { | ||
11 | QBoxLayout* layout=new QBoxLayout(this,QBoxLayout::LeftToRight,10); | ||
12 | |||
13 | boxNote=new QComboBox(this,"boxNote"); | ||
14 | boxNote->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); | ||
15 | //connect(boxNote,SIGNAL(activated(int)),data,SLOT(setCurrentNote(int))); | ||
16 | layout->addWidget(boxNote,1,1); | ||
17 | for(int a=0;a<12;a++) | ||
18 | boxNote->insertItem(Note::notenames[a],a); | ||
19 | boxNote->setCurrentItem(note-12*Note::getOctaveOfNote(note)); | ||
20 | layout->addWidget(boxNote); | ||
21 | |||
22 | setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); | ||
23 | setFrameShape(QFrame::Panel); | ||
24 | setFrameShadow(QFrame::Sunken); | ||
25 | |||
26 | } | ||
27 | //**************************************************************************** | ||
28 | Menu::EditStringWidget::~EditStringWidget() | ||
29 | { | ||
30 | } | ||
31 | //**************************************************************************** | ||
32 | //**************************************************************************** | ||
diff --git a/noncore/multimedia/tonleiter/editstringwidget.h b/noncore/multimedia/tonleiter/editstringwidget.h new file mode 100644 index 0000000..ba105a9 --- a/dev/null +++ b/noncore/multimedia/tonleiter/editstringwidget.h | |||
@@ -0,0 +1,24 @@ | |||
1 | #ifndef TONLEITER_EDIT_STRING_WIDGT_H | ||
2 | #define TONLEITER_EDIT_STRING_WIDGT_H | ||
3 | |||
4 | #include <qframe.h> | ||
5 | #include <qcombobox.h> | ||
6 | #include <qspinbox.h> | ||
7 | |||
8 | #include "tonleiterdata.h" | ||
9 | |||
10 | namespace Menu | ||
11 | { | ||
12 | class EditStringWidget : public QFrame | ||
13 | { | ||
14 | Q_OBJECT | ||
15 | private: | ||
16 | QComboBox* boxNote; | ||
17 | public: | ||
18 | EditStringWidget(int note,QWidget* parent,const char* name=0,WFlags f=0); | ||
19 | ~EditStringWidget(); | ||
20 | }; | ||
21 | }; | ||
22 | |||
23 | #endif //TONLEITER_EDIT_STRING_WIDGT_H | ||
24 | |||
diff --git a/noncore/multimedia/tonleiter/menuwidget.cpp b/noncore/multimedia/tonleiter/menuwidget.cpp index 1e3742c..56a2f8a 100644 --- a/noncore/multimedia/tonleiter/menuwidget.cpp +++ b/noncore/multimedia/tonleiter/menuwidget.cpp | |||
@@ -13,8 +13,14 @@ Menu::MenuWidget::MenuWidget(TonleiterData* data,QWidget* parent,const char* nam | |||
13 | 13 | ||
14 | //Instrument | ||
14 | QLabel* instLabel=new QLabel(tr("Instr."),this,"instLabel"); | 15 | QLabel* instLabel=new QLabel(tr("Instr."),this,"instLabel"); |
16 | instLabel->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); | ||
15 | layout->addWidget(instLabel,0,0); | 17 | layout->addWidget(instLabel,0,0); |
18 | |||
16 | boxInst=new QComboBox(this,"boxInst"); | 19 | boxInst=new QComboBox(this,"boxInst"); |
20 | boxInst->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); | ||
17 | connect(boxInst,SIGNAL(activated(int)),data,SLOT(setCurrentInstrumetID(int))); | 21 | connect(boxInst,SIGNAL(activated(int)),data,SLOT(setCurrentInstrumetID(int))); |
18 | layout->addWidget(boxInst,0,1); | 22 | layout->addWidget(boxInst,0,1); |
23 | |||
19 | editInst=new QPushButton(tr("Edit"),this,"editInst"); | 24 | editInst=new QPushButton(tr("Edit"),this,"editInst"); |
25 | editInst->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); | ||
20 | connect(editInst,SIGNAL(pressed()),this,SLOT(editInstPressed())); | 26 | connect(editInst,SIGNAL(pressed()),this,SLOT(editInstPressed())); |
@@ -22,5 +28,9 @@ Menu::MenuWidget::MenuWidget(TonleiterData* data,QWidget* parent,const char* nam | |||
22 | 28 | ||
29 | //Note | ||
23 | QLabel* noteLabel=new QLabel(tr("Note"),this,"noteLabel"); | 30 | QLabel* noteLabel=new QLabel(tr("Note"),this,"noteLabel"); |
31 | noteLabel->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); | ||
24 | layout->addWidget(noteLabel,1,0); | 32 | layout->addWidget(noteLabel,1,0); |
33 | |||
25 | boxNote=new QComboBox(this,"boxNote"); | 34 | boxNote=new QComboBox(this,"boxNote"); |
35 | boxNote->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); | ||
26 | connect(boxNote,SIGNAL(activated(int)),data,SLOT(setCurrentNote(int))); | 36 | connect(boxNote,SIGNAL(activated(int)),data,SLOT(setCurrentNote(int))); |
@@ -30,3 +40,5 @@ Menu::MenuWidget::MenuWidget(TonleiterData* data,QWidget* parent,const char* nam | |||
30 | boxNote->setCurrentItem(data->getCurrentBaseNote()); | 40 | boxNote->setCurrentItem(data->getCurrentBaseNote()); |
41 | |||
31 | noteCheck=new QCheckBox(tr("show"),this,"noteCheck"); | 42 | noteCheck=new QCheckBox(tr("show"),this,"noteCheck"); |
43 | noteCheck->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); | ||
32 | noteCheck->setChecked(data->isDrawNames()); | 44 | noteCheck->setChecked(data->isDrawNames()); |
@@ -35,8 +47,14 @@ Menu::MenuWidget::MenuWidget(TonleiterData* data,QWidget* parent,const char* nam | |||
35 | 47 | ||
48 | //Scale | ||
36 | QLabel* scaleLabel=new QLabel(tr("Scale"),this,"scaleLabel"); | 49 | QLabel* scaleLabel=new QLabel(tr("Scale"),this,"scaleLabel"); |
50 | scaleLabel->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); | ||
37 | layout->addWidget(scaleLabel,2,0); | 51 | layout->addWidget(scaleLabel,2,0); |
52 | |||
38 | boxScale=new QComboBox(this,"boxScale"); | 53 | boxScale=new QComboBox(this,"boxScale"); |
54 | boxScale->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); | ||
39 | connect(boxScale,SIGNAL(activated(int)),data,SLOT(setCurrentScaleID(int))); | 55 | connect(boxScale,SIGNAL(activated(int)),data,SLOT(setCurrentScaleID(int))); |
40 | layout->addWidget(boxScale,2,1); | 56 | layout->addWidget(boxScale,2,1); |
57 | |||
41 | editScale=new QPushButton(tr("Edit"),this,"editScale"); | 58 | editScale=new QPushButton(tr("Edit"),this,"editScale"); |
59 | editScale->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); | ||
42 | connect(editScale,SIGNAL(pressed()),this,SLOT(editScalePressed())); | 60 | connect(editScale,SIGNAL(pressed()),this,SLOT(editScalePressed())); |
@@ -45,3 +63,3 @@ Menu::MenuWidget::MenuWidget(TonleiterData* data,QWidget* parent,const char* nam | |||
45 | updateBoxes(); | 63 | updateBoxes(); |
46 | 64 | setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::Maximum)); | |
47 | } | 65 | } |
diff --git a/noncore/multimedia/tonleiter/pianoscale.cpp b/noncore/multimedia/tonleiter/pianoscale.cpp new file mode 100644 index 0000000..3d5add2 --- a/dev/null +++ b/noncore/multimedia/tonleiter/pianoscale.cpp | |||
@@ -0,0 +1,96 @@ | |||
1 | #include "pianoscale.h" | ||
2 | |||
3 | #include <qpainter.h> | ||
4 | |||
5 | |||
6 | Menu::PianoScale::PianoScale(QWidget* parent,const char* name,WFlags f) | ||
7 | :QWidget(parent,name,f) | ||
8 | { | ||
9 | QColor black(0,0,0); | ||
10 | QColor white(255,255,255); | ||
11 | QColor mark(255,0,0); | ||
12 | blackBrush=QBrush(black); | ||
13 | whiteBrush=QBrush(white); | ||
14 | markBrush=QBrush(mark); | ||
15 | blackPen=QPen(black); | ||
16 | whitePen=QPen(white); | ||
17 | setBackgroundColor(QColor(0,0,255)); | ||
18 | } | ||
19 | //**************************************************************************** | ||
20 | Menu::PianoScale::~ PianoScale() | ||
21 | { | ||
22 | } | ||
23 | //**************************************************************************** | ||
24 | void Menu::PianoScale::paintEvent(QPaintEvent* pe) | ||
25 | { | ||
26 | QPainter p(this); | ||
27 | QRect mysize=rect(); | ||
28 | |||
29 | int pad=10; | ||
30 | int x0=pad; | ||
31 | int y0=pad; | ||
32 | int w0=mysize.width()-2*pad; | ||
33 | int h0=mysize.height()-2*pad; | ||
34 | |||
35 | int keypad=2; | ||
36 | if(mysize.width()>mysize.height()) | ||
37 | { | ||
38 | int div=(int)(w0/14.0); | ||
39 | int halftonewidth=(int)(div/3.0); | ||
40 | int halftoneheight=(int)((h0-2*keypad)*0.66); | ||
41 | for(int a=0;a<14;a++) | ||
42 | { | ||
43 | int x=x0+a*div; | ||
44 | |||
45 | p.setPen(blackPen); | ||
46 | p.setBrush(blackBrush); | ||
47 | p.drawRect(x,y0,div,h0); | ||
48 | |||
49 | p.setPen(whitePen); | ||
50 | p.setBrush(whiteBrush); | ||
51 | p.drawRect(x+keypad,y0+keypad,div-2*keypad,h0-2*keypad); | ||
52 | |||
53 | if(a==1 || a==2 || a==4 || a==5 || a==6 || a==8 || a==9 || a==11 || a==12 || a==13) | ||
54 | { | ||
55 | p.setPen(blackPen); | ||
56 | p.setBrush(blackBrush); | ||
57 | p.drawRect(x-halftonewidth,y0+keypad,2*halftonewidth,halftoneheight); | ||
58 | } | ||
59 | } | ||
60 | } | ||
61 | else | ||
62 | { | ||
63 | int div=(int)(w0/7.0); | ||
64 | int halfheight=(int)(h0/2.0); | ||
65 | int halftonewidth=(int)(div/3.0); | ||
66 | int halftoneheight=(int)((halfheight-2*keypad)*0.66); | ||
67 | for(int a=0;a<7;a++) | ||
68 | { | ||
69 | int x=x0+a*div; | ||
70 | |||
71 | p.setPen(blackPen); | ||
72 | p.setBrush(blackBrush); | ||
73 | p.drawRect(x,y0,div,h0); | ||
74 | |||
75 | p.setPen(whitePen); | ||
76 | p.setBrush(whiteBrush); | ||
77 | p.drawRect(x+keypad,y0+keypad,div-2*keypad,halfheight-2*keypad); | ||
78 | p.drawRect(x+keypad,y0+keypad+halfheight,div-2*keypad,halfheight-2*keypad); | ||
79 | |||
80 | if(a==1 || a==2 || a==4 || a==5 || a==6) | ||
81 | { | ||
82 | p.setPen(blackPen); | ||
83 | p.setBrush(blackBrush); | ||
84 | p.drawRect(x-halftonewidth,y0+keypad,2*halftonewidth,halftoneheight); | ||
85 | p.drawRect(x-halftonewidth,y0+keypad+halfheight,2*halftonewidth,halftoneheight); | ||
86 | } | ||
87 | } | ||
88 | } | ||
89 | } | ||
90 | //**************************************************************************** | ||
91 | void Menu::PianoScale::mousePressEvent(QMouseEvent* me) | ||
92 | { | ||
93 | } | ||
94 | //**************************************************************************** | ||
95 | //**************************************************************************** | ||
96 | |||
diff --git a/noncore/multimedia/tonleiter/pianoscale.h b/noncore/multimedia/tonleiter/pianoscale.h new file mode 100644 index 0000000..63995b0 --- a/dev/null +++ b/noncore/multimedia/tonleiter/pianoscale.h | |||
@@ -0,0 +1,28 @@ | |||
1 | #ifndef TONLEITER_PIANO_SCALE_H | ||
2 | #define TONLEITER_PIANO_SCALE_H | ||
3 | |||
4 | #include <qwidget.h> | ||
5 | #include <qpen.h> | ||
6 | #include <qbrush.h> | ||
7 | |||
8 | namespace Menu | ||
9 | { | ||
10 | class PianoScale : public QWidget | ||
11 | { | ||
12 | Q_OBJECT | ||
13 | private: | ||
14 | QBrush blackBrush; | ||
15 | QBrush whiteBrush; | ||
16 | QBrush markBrush; | ||
17 | QPen blackPen; | ||
18 | QPen whitePen; | ||
19 | public: | ||
20 | PianoScale(QWidget* parent,const char* name="PianoScale",WFlags f=0); | ||
21 | ~PianoScale(); | ||
22 | private: | ||
23 | void paintEvent(QPaintEvent* pe); | ||
24 | void mousePressEvent(QMouseEvent* me); | ||
25 | }; | ||
26 | }; | ||
27 | |||
28 | #endif //TONLEITER_PIANO_SCALE_H | ||
diff --git a/noncore/multimedia/tonleiter/tonleiter.pro b/noncore/multimedia/tonleiter/tonleiter.pro index 2b0a798..c52ca19 100644 --- a/noncore/multimedia/tonleiter/tonleiter.pro +++ b/noncore/multimedia/tonleiter/tonleiter.pro | |||
@@ -3,4 +3,4 @@ TEMPLATE = app | |||
3 | CONFIG = qt warn_on release | 3 | CONFIG = qt warn_on release |
4 | HEADERS = mainwidget.h tonleiterdata.h tonleiterdatahelper.h fretboard.h menuwidget.h editinst.h editscale.h | 4 | HEADERS = mainwidget.h tonleiterdata.h tonleiterdatahelper.h fretboard.h menuwidget.h editinst.h editstringwidget.h editscale.h pianoscale.h |
5 | SOURCES = mainwidget.cpp tonleiterdata.cpp tonleiterdatahelper.cpp fretboard.cpp menuwidget.cpp main.cpp editinst.cpp editscale.cpp | 5 | SOURCES = mainwidget.cpp tonleiterdata.cpp tonleiterdatahelper.cpp fretboard.cpp menuwidget.cpp main.cpp editinst.cpp editstringwidget.cpp editscale.cpp pianoscale.cpp |
6 | INCLUDEPATH += $(OPIEDIR)/include | 6 | INCLUDEPATH += $(OPIEDIR)/include |
diff --git a/noncore/multimedia/tonleiter/tonleiterdata.cpp b/noncore/multimedia/tonleiter/tonleiterdata.cpp index 946d4e3..bf7b32c 100644 --- a/noncore/multimedia/tonleiter/tonleiterdata.cpp +++ b/noncore/multimedia/tonleiter/tonleiterdata.cpp | |||
@@ -73,3 +73,3 @@ void TonleiterData::loadData() | |||
73 | load.writeEntry("Scale4","lydian;0;2;4;6;7;9;11;"); | 73 | load.writeEntry("Scale4","lydian;0;2;4;6;7;9;11;"); |
74 | load.writeEntry("Scale5","mixolyd.;0;2;4;5;7;9;10;"); | 74 | load.writeEntry("Scale5","mixolydian;0;2;4;5;7;9;10;"); |
75 | load.writeEntry("noOfScales",6); | 75 | load.writeEntry("noOfScales",6); |
diff --git a/noncore/multimedia/tonleiter/tonleiterdatahelper.cpp b/noncore/multimedia/tonleiter/tonleiterdatahelper.cpp index 5714cea..156dba5 100644 --- a/noncore/multimedia/tonleiter/tonleiterdatahelper.cpp +++ b/noncore/multimedia/tonleiter/tonleiterdatahelper.cpp | |||
@@ -2,2 +2,4 @@ | |||
2 | 2 | ||
3 | #include <math.h> | ||
4 | |||
3 | using namespace Data; | 5 | using namespace Data; |
@@ -78,3 +80,3 @@ int Instrument::noOfOctaves() | |||
78 | int highest=strings[strings.count()-1]+frets; | 80 | int highest=strings[strings.count()-1]+frets; |
79 | return (int)((highest-lowest)/12.0); | 81 | return (int) ceil((highest-lowest)/12.0); |
80 | } | 82 | } |
diff --git a/noncore/multimedia/tonleiter/tonleiterdatahelper.h b/noncore/multimedia/tonleiter/tonleiterdatahelper.h index b79162a..e4153d7 100644 --- a/noncore/multimedia/tonleiter/tonleiterdatahelper.h +++ b/noncore/multimedia/tonleiter/tonleiterdatahelper.h | |||
@@ -10,3 +10,3 @@ namespace Data | |||
10 | { | 10 | { |
11 | const QString notenames[]={"C","C#","D","D#","E","F","F#","G","G#","A","A#","B"}; | 11 | const QString notenames[]={"A","Bb","B","C","C#","D","D#","E","F","F#","G","G#"}; |
12 | 12 | ||