Mercurial > hg > svgui
comparison widgets/PropertyBox.cpp @ 1189:7609580fb05a levelpanwidget
Make play params area of property box look a bit better on OSX
author | Chris Cannam |
---|---|
date | Thu, 15 Dec 2016 11:54:12 +0000 |
parents | 306c24eeab10 |
children | 2513f660c183 |
comparison
equal
deleted
inserted
replaced
1188:9907be1c4f89 | 1189:7609580fb05a |
---|---|
32 #include "WidgetScale.h" | 32 #include "WidgetScale.h" |
33 | 33 |
34 #include "NotifyingCheckBox.h" | 34 #include "NotifyingCheckBox.h" |
35 #include "NotifyingComboBox.h" | 35 #include "NotifyingComboBox.h" |
36 #include "NotifyingPushButton.h" | 36 #include "NotifyingPushButton.h" |
37 #include "NotifyingToolButton.h" | |
37 #include "ColourNameDialog.h" | 38 #include "ColourNameDialog.h" |
38 | 39 |
39 #include <QGridLayout> | 40 #include <QGridLayout> |
40 #include <QHBoxLayout> | 41 #include <QHBoxLayout> |
41 #include <QVBoxLayout> | 42 #include <QVBoxLayout> |
42 #include <QPushButton> | 43 #include <QPushButton> |
44 #include <QToolButton> | |
43 #include <QLabel> | 45 #include <QLabel> |
44 #include <QFrame> | 46 #include <QFrame> |
45 #include <QApplication> | 47 #include <QApplication> |
46 #include <QColorDialog> | 48 #include <QColorDialog> |
47 #include <QInputDialog> | 49 #include <QInputDialog> |
148 | 150 |
149 m_viewPlayFrame = new QFrame; | 151 m_viewPlayFrame = new QFrame; |
150 m_viewPlayFrame->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); | 152 m_viewPlayFrame->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken); |
151 m_mainBox->addWidget(m_viewPlayFrame); | 153 m_mainBox->addWidget(m_viewPlayFrame); |
152 | 154 |
153 QHBoxLayout *layout = new QHBoxLayout; | 155 QGridLayout *layout = new QGridLayout; |
154 m_viewPlayFrame->setLayout(layout); | 156 m_viewPlayFrame->setLayout(layout); |
155 | 157 |
156 layout->setMargin(layout->margin() / 2); | 158 layout->setMargin(layout->margin() / 2); |
157 | 159 |
158 #ifdef DEBUG_PROPERTY_BOX | 160 #ifdef DEBUG_PROPERTY_BOX |
159 SVDEBUG << "PropertyBox::populateViewPlayFrame: container " << m_container << " (name " << m_container->getPropertyContainerName() << ") params " << params << endl; | 161 SVDEBUG << "PropertyBox::populateViewPlayFrame: container " << m_container << " (name " << m_container->getPropertyContainerName() << ") params " << params << endl; |
160 #endif | 162 #endif |
161 | 163 |
164 QSize buttonSize = WidgetScale::scaleQSize(QSize(26, 26)); | |
165 int col = 0; | |
166 | |
162 if (params) { | 167 if (params) { |
163 | 168 |
164 m_playButton = new NotifyingPushButton; | 169 m_playButton = new NotifyingToolButton; |
165 m_playButton->setCheckable(true); | 170 m_playButton->setCheckable(true); |
166 m_playButton->setIcon(IconLoader().load("speaker")); | 171 m_playButton->setIcon(IconLoader().load("speaker")); |
167 m_playButton->setChecked(!params->isPlayMuted()); | 172 m_playButton->setChecked(!params->isPlayMuted()); |
168 layout->addWidget(m_playButton); | 173 m_playButton->setFixedSize(buttonSize); |
169 connect(m_playButton, SIGNAL(toggled(bool)), | 174 connect(m_playButton, SIGNAL(toggled(bool)), |
170 this, SLOT(playAudibleButtonChanged(bool))); | 175 this, SLOT(playAudibleButtonChanged(bool))); |
171 connect(m_playButton, SIGNAL(mouseEntered()), | 176 connect(m_playButton, SIGNAL(mouseEntered()), |
172 this, SLOT(mouseEnteredWidget())); | 177 this, SLOT(mouseEnteredWidget())); |
173 connect(m_playButton, SIGNAL(mouseLeft()), | 178 connect(m_playButton, SIGNAL(mouseLeft()), |
174 this, SLOT(mouseLeftWidget())); | 179 this, SLOT(mouseLeftWidget())); |
175 connect(params, SIGNAL(playAudibleChanged(bool)), | 180 connect(params, SIGNAL(playAudibleChanged(bool)), |
176 this, SLOT(playAudibleChanged(bool))); | 181 this, SLOT(playAudibleChanged(bool))); |
177 layout->setAlignment(m_playButton, Qt::AlignVCenter); | |
178 | 182 |
179 LevelPanToolButton *levelPan = new LevelPanToolButton; | 183 LevelPanToolButton *levelPan = new LevelPanToolButton; |
180 layout->addWidget(levelPan); | 184 levelPan->setFixedSize(buttonSize); |
185 levelPan->setImageSize((buttonSize.height() * 3) / 4); | |
186 layout->addWidget(levelPan, 0, col++, Qt::AlignCenter); | |
181 connect(levelPan, SIGNAL(levelChanged(float)), | 187 connect(levelPan, SIGNAL(levelChanged(float)), |
182 this, SLOT(playGainControlChanged(float))); | 188 this, SLOT(playGainControlChanged(float))); |
183 connect(levelPan, SIGNAL(panChanged(float)), | 189 connect(levelPan, SIGNAL(panChanged(float)), |
184 this, SLOT(playPanControlChanged(float))); | 190 this, SLOT(playPanControlChanged(float))); |
185 connect(params, SIGNAL(playGainChanged(float)), | 191 connect(params, SIGNAL(playGainChanged(float)), |
189 connect(levelPan, SIGNAL(mouseEntered()), | 195 connect(levelPan, SIGNAL(mouseEntered()), |
190 this, SLOT(mouseEnteredWidget())); | 196 this, SLOT(mouseEnteredWidget())); |
191 connect(levelPan, SIGNAL(mouseLeft()), | 197 connect(levelPan, SIGNAL(mouseLeft()), |
192 this, SLOT(mouseLeftWidget())); | 198 this, SLOT(mouseLeftWidget())); |
193 | 199 |
200 layout->addWidget(m_playButton, 0, col++, Qt::AlignCenter); | |
201 | |
194 if (params->getPlayClipId() != "") { | 202 if (params->getPlayClipId() != "") { |
195 NotifyingPushButton *playParamButton = new NotifyingPushButton; | 203 QToolButton *playParamButton = new QToolButton; |
196 playParamButton->setObjectName("playParamButton"); | 204 playParamButton->setObjectName("playParamButton"); |
197 playParamButton->setIcon(IconLoader().load("faders")); | 205 playParamButton->setIcon(IconLoader().load("faders")); |
198 playParamButton->setFixedWidth(WidgetScale::scalePixelSize(24)); | 206 playParamButton->setFixedSize(buttonSize); |
199 playParamButton->setFixedHeight(WidgetScale::scalePixelSize(24)); | 207 layout->addWidget(playParamButton, 0, col++, Qt::AlignCenter); |
200 layout->addWidget(playParamButton); | |
201 connect(playParamButton, SIGNAL(clicked()), | 208 connect(playParamButton, SIGNAL(clicked()), |
202 this, SLOT(editPlayParameters())); | 209 this, SLOT(editPlayParameters())); |
203 connect(playParamButton, SIGNAL(mouseEntered()), | 210 connect(playParamButton, SIGNAL(mouseEntered()), |
204 this, SLOT(mouseEnteredWidget())); | 211 this, SLOT(mouseEnteredWidget())); |
205 connect(playParamButton, SIGNAL(mouseLeft()), | 212 connect(playParamButton, SIGNAL(mouseLeft()), |
206 this, SLOT(mouseLeftWidget())); | 213 this, SLOT(mouseLeftWidget())); |
207 } | 214 } |
208 } | 215 } |
209 | 216 |
210 layout->insertStretch(-1, 10); | 217 layout->setColumnStretch(col++, 10); |
211 | 218 |
212 if (layer) { | 219 if (layer) { |
213 | 220 |
214 QLabel *showLabel = new QLabel(tr("Show")); | 221 QLabel *showLabel = new QLabel(tr("Show")); |
215 layout->addWidget(showLabel); | 222 layout->addWidget(showLabel, 0, col++, Qt::AlignVCenter | Qt::AlignRight); |
216 layout->setAlignment(showLabel, Qt::AlignVCenter); | |
217 | 223 |
218 m_showButton = new LEDButton(Qt::blue); | 224 m_showButton = new LEDButton(Qt::blue); |
219 layout->addWidget(m_showButton); | 225 layout->addWidget(m_showButton, 0, col++, Qt::AlignVCenter | Qt::AlignLeft); |
220 connect(m_showButton, SIGNAL(stateChanged(bool)), | 226 connect(m_showButton, SIGNAL(stateChanged(bool)), |
221 this, SIGNAL(showLayer(bool))); | 227 this, SIGNAL(showLayer(bool))); |
222 connect(m_showButton, SIGNAL(mouseEntered()), | 228 connect(m_showButton, SIGNAL(mouseEntered()), |
223 this, SLOT(mouseEnteredWidget())); | 229 this, SLOT(mouseEnteredWidget())); |
224 connect(m_showButton, SIGNAL(mouseLeft()), | 230 connect(m_showButton, SIGNAL(mouseLeft()), |
225 this, SLOT(mouseLeftWidget())); | 231 this, SLOT(mouseLeftWidget())); |
226 layout->setAlignment(m_showButton, Qt::AlignVCenter); | |
227 } | 232 } |
228 } | 233 } |
229 | 234 |
230 void | 235 void |
231 PropertyBox::updatePropertyEditor(PropertyContainer::PropertyName name, | 236 PropertyBox::updatePropertyEditor(PropertyContainer::PropertyName name, |