Mercurial > hg > easaier-soundaccess
comparison widgets/LayerViewerWidget.cpp @ 56:81921835ddf1
first layer list pre-version
author | benoitrigolleau |
---|---|
date | Wed, 23 May 2007 13:09:19 +0000 |
parents | |
children | 57c85a9d9b4a |
comparison
equal
deleted
inserted
replaced
55:41f1491c841b | 56:81921835ddf1 |
---|---|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ | |
2 | |
3 /* | |
4 Sound Access | |
5 EASAIER client application. | |
6 Silogic 2007. Benoit Rigolleau. | |
7 | |
8 This program is free software; you can redistribute it and/or | |
9 modify it under the terms of the GNU General Public License as | |
10 published by the Free Software Foundation; either version 2 of the | |
11 License, or (at your option) any later version. See the file | |
12 COPYING included with this distribution for more information. | |
13 */ | |
14 | |
15 //#include "data/model/LayerItemModel.h" | |
16 #include "LayerViewerWidget.h" | |
17 #include <iostream> | |
18 | |
19 LayerViewerWidget::LayerViewerWidget(QWidget *parent) : QFrame(parent){ | |
20 /* Init all variables*/ | |
21 m_pushButtonCONFIG = new QPushButton; | |
22 m_pushButtonUP = new QPushButton; | |
23 m_pushButtonDOWN = new QPushButton; | |
24 m_pushButtonREMOVE = new QPushButton; | |
25 m_pushButtonNEW = new QPushButton; | |
26 | |
27 m_layoutOPACITY = new QHBoxLayout; | |
28 m_layoutACTION = new QHBoxLayout; | |
29 m_layoutMAIN = new QVBoxLayout; | |
30 | |
31 m_labelOPACITY = new QLabel(tr("Opacity : ")); | |
32 m_widgetLIST = new ItemContainer(); | |
33 | |
34 m_sliderOPACITY = new QSlider; | |
35 m_spinBoxOPACITY = new QSpinBox; | |
36 | |
37 /* set the correct widget parameters*/ | |
38 m_pushButtonCONFIG->setMaximumSize(20,20); | |
39 m_pushButtonCONFIG->setIcon(QIcon(":icons/layerViewer_btn_config.png")); | |
40 m_pushButtonUP->setMaximumSize(20,20); | |
41 m_pushButtonUP->setIcon(QIcon(":icons/layerViewer_btn_up.png")); | |
42 m_pushButtonDOWN->setMaximumSize(20,20); | |
43 m_pushButtonDOWN->setIcon(QIcon(":icons/layerViewer_btn_down.png")); | |
44 m_pushButtonREMOVE->setMaximumSize(20,20); | |
45 m_pushButtonREMOVE->setIcon(QIcon(":icons/layerViewer_btn_remove.png")); | |
46 m_pushButtonNEW->setMaximumSize(20,20); | |
47 m_pushButtonNEW->setIcon(QIcon(":icons/layerViewer_btn_new.png")); | |
48 | |
49 m_sliderOPACITY->setRange(0,100); | |
50 m_sliderOPACITY->setMaximumWidth(100); | |
51 m_sliderOPACITY->setMinimumWidth(50); | |
52 m_sliderOPACITY->setOrientation(Qt::Horizontal); | |
53 m_sliderOPACITY->setTickInterval(10); | |
54 m_sliderOPACITY->setTickPosition(QSlider::TicksBelow); | |
55 | |
56 m_spinBoxOPACITY->setMaximumWidth(50); | |
57 m_spinBoxOPACITY->setRange(0,100); | |
58 | |
59 | |
60 | |
61 /*LayerItemModel layerItemModel1(QString("title1"), QString("icon1"), QColor() ,true, false); | |
62 LayerItemModel layerItemModel2(QString("title2"), QString("icon2"), QColor() ,true, false); | |
63 | |
64 QVariant var1,var2; | |
65 var1.setValue(layerItemModel1); | |
66 var2.setValue(layerItemModel2); | |
67 | |
68 m_widgetLIST->setItemDelegate(new LayerDelegate()); | |
69 QListWidgetItem *item1 = new QListWidgetItem("1",m_widgetLIST); | |
70 item1->setData(Qt::UserRole, var1); | |
71 | |
72 QListWidgetItem *item2 = new QListWidgetItem("2",m_widgetLIST); | |
73 item2->setData(Qt::UserRole, var2); | |
74 | |
75 m_widgetLIST->openPersistentEditor(item1); | |
76 m_widgetLIST->openPersistentEditor(item2);*/ | |
77 | |
78 /* build the interface*/ | |
79 | |
80 //the opasity one: | |
81 m_layoutOPACITY->addStretch(); | |
82 m_layoutOPACITY->addWidget(m_labelOPACITY); | |
83 m_layoutOPACITY->addWidget(m_spinBoxOPACITY); | |
84 m_layoutOPACITY->addWidget(m_sliderOPACITY); | |
85 | |
86 //the action one: | |
87 m_layoutACTION->addWidget(m_pushButtonCONFIG); | |
88 m_layoutACTION->addStretch(); | |
89 m_layoutACTION->addWidget(m_pushButtonUP); | |
90 m_layoutACTION->addWidget(m_pushButtonDOWN); | |
91 m_layoutACTION->addWidget(m_pushButtonNEW); | |
92 m_layoutACTION->addSpacing(10); | |
93 m_layoutACTION->addWidget(m_pushButtonREMOVE); | |
94 | |
95 //the main one: | |
96 m_layoutMAIN->addLayout(m_layoutOPACITY); | |
97 m_layoutMAIN->addWidget(m_widgetLIST); | |
98 m_layoutMAIN->addLayout(m_layoutACTION); | |
99 | |
100 /* connect sliderOPACITY and spinBoxOPACITY*/ | |
101 QObject::connect(m_sliderOPACITY,SIGNAL(valueChanged(int)),m_spinBoxOPACITY,SLOT(setValue(int))); | |
102 QObject::connect(m_spinBoxOPACITY,SIGNAL(valueChanged(int)),m_sliderOPACITY,SLOT(setValue(int))); | |
103 | |
104 /* connect pushButtons*/ | |
105 connect(m_pushButtonUP,SIGNAL(clicked()),m_widgetLIST,SLOT(upCurrentItem())); | |
106 connect(m_pushButtonDOWN,SIGNAL(clicked()),m_widgetLIST,SLOT(downCurrentItem())); | |
107 connect(m_pushButtonCONFIG,SIGNAL(clicked()),m_widgetLIST,SLOT(openConfigBoxForCurrentItem())); | |
108 connect(m_pushButtonREMOVE,SIGNAL(clicked()),this,SLOT(removeSelectedItemRequested())); | |
109 | |
110 /*connect the list of items */ | |
111 connect(m_widgetLIST,SIGNAL(currentChanged(int)),this,SLOT(newItemSelected(int))); | |
112 | |
113 | |
114 /*add the main layout in this widget*/ | |
115 this->setLayout(m_layoutMAIN); | |
116 this->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); | |
117 this->setLineWidth(2); | |
118 } | |
119 | |
120 void LayerViewerWidget::addItem(ItemLayerList *item){ | |
121 m_widgetLIST->addItem(item); | |
122 } | |
123 | |
124 void LayerViewerWidget::removeAllItems(){ | |
125 m_widgetLIST->removeAllItems(); | |
126 } | |
127 | |
128 void LayerViewerWidget::setCurrentIndex(int i){ | |
129 | |
130 } | |
131 | |
132 /************** SLOTS ********/ | |
133 void LayerViewerWidget::newItemSelected(int i){ | |
134 emit currentChanged(i); | |
135 } | |
136 | |
137 void LayerViewerWidget::removeSelectedItemRequested(){ | |
138 std::cerr << "removeSelectedItemRequested" << std::endl; | |
139 } |