Chris@58
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@0
|
2
|
Chris@0
|
3 /*
|
Chris@59
|
4 Sonic Visualiser
|
Chris@59
|
5 An audio file viewer and annotation editor.
|
Chris@59
|
6 Centre for Digital Music, Queen Mary, University of London.
|
Chris@182
|
7 This file copyright 2006 Chris Cannam and QMUL.
|
Chris@0
|
8
|
Chris@59
|
9 This program is free software; you can redistribute it and/or
|
Chris@59
|
10 modify it under the terms of the GNU General Public License as
|
Chris@59
|
11 published by the Free Software Foundation; either version 2 of the
|
Chris@59
|
12 License, or (at your option) any later version. See the file
|
Chris@59
|
13 COPYING included with this distribution for more information.
|
Chris@0
|
14 */
|
Chris@0
|
15
|
Chris@0
|
16 #include "PropertyBox.h"
|
Chris@63
|
17 #include "PluginParameterDialog.h"
|
Chris@0
|
18
|
Chris@0
|
19 #include "base/PropertyContainer.h"
|
Chris@33
|
20 #include "base/PlayParameters.h"
|
Chris@377
|
21 #include "base/PlayParameterRepository.h"
|
Chris@128
|
22 #include "layer/Layer.h"
|
Chris@376
|
23 #include "layer/ColourDatabase.h"
|
Chris@100
|
24 #include "base/UnitDatabase.h"
|
Chris@167
|
25 #include "base/RangeMapper.h"
|
Chris@0
|
26
|
Chris@0
|
27 #include "AudioDial.h"
|
Chris@33
|
28 #include "LEDButton.h"
|
Chris@335
|
29 #include "IconLoader.h"
|
Chris@1178
|
30 #include "LevelPanWidget.h"
|
Chris@1179
|
31 #include "LevelPanToolButton.h"
|
Chris@1174
|
32 #include "WidgetScale.h"
|
Chris@0
|
33
|
Chris@189
|
34 #include "NotifyingCheckBox.h"
|
Chris@189
|
35 #include "NotifyingComboBox.h"
|
Chris@335
|
36 #include "NotifyingPushButton.h"
|
Chris@1189
|
37 #include "NotifyingToolButton.h"
|
Chris@285
|
38 #include "ColourNameDialog.h"
|
Chris@189
|
39
|
Chris@0
|
40 #include <QGridLayout>
|
Chris@0
|
41 #include <QHBoxLayout>
|
Chris@33
|
42 #include <QVBoxLayout>
|
Chris@63
|
43 #include <QPushButton>
|
Chris@1189
|
44 #include <QToolButton>
|
Chris@0
|
45 #include <QLabel>
|
Chris@33
|
46 #include <QFrame>
|
Chris@218
|
47 #include <QApplication>
|
Chris@285
|
48 #include <QColorDialog>
|
Chris@285
|
49 #include <QInputDialog>
|
Chris@769
|
50 #include <QDir>
|
Chris@0
|
51
|
Chris@0
|
52 #include <cassert>
|
Chris@0
|
53 #include <iostream>
|
Martin@46
|
54 #include <cmath>
|
Chris@0
|
55
|
Chris@456
|
56 //#define DEBUG_PROPERTY_BOX 1
|
Chris@0
|
57
|
Chris@0
|
58 PropertyBox::PropertyBox(PropertyContainer *container) :
|
Chris@185
|
59 m_container(container),
|
Chris@189
|
60 m_showButton(0),
|
Chris@189
|
61 m_playButton(0)
|
Chris@0
|
62 {
|
Chris@0
|
63 #ifdef DEBUG_PROPERTY_BOX
|
Chris@682
|
64 cerr << "PropertyBox[" << this << "(\"" <<
|
Chris@682
|
65 container->getPropertyContainerName() << "\" at " << container << ")]::PropertyBox" << endl;
|
Chris@0
|
66 #endif
|
Chris@0
|
67
|
Chris@34
|
68 m_mainBox = new QVBoxLayout;
|
Chris@34
|
69 setLayout(m_mainBox);
|
Chris@33
|
70
|
Chris@980
|
71 #ifdef Q_OS_MAC
|
Chris@980
|
72 QMargins mm = m_mainBox->contentsMargins();
|
Chris@980
|
73 QMargins mmhalf(mm.left()/2, mm.top()/3, mm.right()/2, mm.bottom()/3);
|
Chris@980
|
74 m_mainBox->setContentsMargins(mmhalf);
|
Chris@980
|
75 #endif
|
Chris@980
|
76
|
Chris@107
|
77 // m_nameWidget = new QLabel;
|
Chris@107
|
78 // m_mainBox->addWidget(m_nameWidget);
|
Chris@107
|
79 // m_nameWidget->setText(container->objectName());
|
Chris@107
|
80
|
Chris@34
|
81 m_mainWidget = new QWidget;
|
Chris@34
|
82 m_mainBox->addWidget(m_mainWidget);
|
Chris@107
|
83 m_mainBox->insertStretch(2, 10);
|
Chris@33
|
84
|
Chris@34
|
85 m_viewPlayFrame = 0;
|
Chris@34
|
86 populateViewPlayFrame();
|
Chris@33
|
87
|
Chris@0
|
88 m_layout = new QGridLayout;
|
Chris@34
|
89 m_layout->setMargin(0);
|
Chris@833
|
90 m_layout->setHorizontalSpacing(2);
|
Chris@833
|
91 m_layout->setVerticalSpacing(1);
|
Chris@33
|
92 m_mainWidget->setLayout(m_layout);
|
Chris@0
|
93
|
Chris@34
|
94 PropertyContainer::PropertyList properties = m_container->getProperties();
|
Chris@0
|
95
|
Chris@0
|
96 blockSignals(true);
|
Chris@0
|
97
|
Chris@0
|
98 size_t i;
|
Chris@0
|
99
|
Chris@0
|
100 for (i = 0; i < properties.size(); ++i) {
|
Chris@0
|
101 updatePropertyEditor(properties[i]);
|
Chris@0
|
102 }
|
Chris@0
|
103
|
Chris@0
|
104 blockSignals(false);
|
Chris@0
|
105
|
Chris@0
|
106 m_layout->setRowStretch(m_layout->rowCount(), 10);
|
Chris@0
|
107
|
Chris@100
|
108 connect(UnitDatabase::getInstance(), SIGNAL(unitDatabaseChanged()),
|
Chris@100
|
109 this, SLOT(unitDatabaseChanged()));
|
Chris@100
|
110
|
Chris@285
|
111 connect(ColourDatabase::getInstance(), SIGNAL(colourDatabaseChanged()),
|
Chris@285
|
112 this, SLOT(colourDatabaseChanged()));
|
Chris@285
|
113
|
Chris@0
|
114 #ifdef DEBUG_PROPERTY_BOX
|
Chris@682
|
115 cerr << "PropertyBox[" << this << "]::PropertyBox returning" << endl;
|
Chris@0
|
116 #endif
|
Chris@0
|
117 }
|
Chris@0
|
118
|
Chris@0
|
119 PropertyBox::~PropertyBox()
|
Chris@0
|
120 {
|
Chris@0
|
121 #ifdef DEBUG_PROPERTY_BOX
|
Chris@682
|
122 cerr << "PropertyBox[" << this << "]::~PropertyBox" << endl;
|
Chris@0
|
123 #endif
|
Chris@0
|
124 }
|
Chris@0
|
125
|
Chris@0
|
126 void
|
Chris@34
|
127 PropertyBox::populateViewPlayFrame()
|
Chris@33
|
128 {
|
Chris@36
|
129 #ifdef DEBUG_PROPERTY_BOX
|
Chris@729
|
130 cerr << "PropertyBox[" << this << ":" << m_container << "]::populateViewPlayFrame" << endl;
|
Chris@36
|
131 #endif
|
Chris@34
|
132
|
Chris@34
|
133 if (m_viewPlayFrame) {
|
Chris@34
|
134 delete m_viewPlayFrame;
|
Chris@34
|
135 m_viewPlayFrame = 0;
|
Chris@34
|
136 }
|
Chris@34
|
137
|
Chris@34
|
138 if (!m_container) return;
|
Chris@34
|
139
|
Chris@34
|
140 Layer *layer = dynamic_cast<Layer *>(m_container);
|
Chris@34
|
141 if (layer) {
|
Chris@193
|
142 disconnect(layer, SIGNAL(modelReplaced()),
|
Chris@193
|
143 this, SLOT(populateViewPlayFrame()));
|
Chris@34
|
144 connect(layer, SIGNAL(modelReplaced()),
|
Chris@34
|
145 this, SLOT(populateViewPlayFrame()));
|
Chris@34
|
146 }
|
Chris@34
|
147
|
Chris@34
|
148 PlayParameters *params = m_container->getPlayParameters();
|
Chris@33
|
149 if (!params && !layer) return;
|
Chris@33
|
150
|
Chris@34
|
151 m_viewPlayFrame = new QFrame;
|
Chris@34
|
152 m_viewPlayFrame->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
|
Chris@34
|
153 m_mainBox->addWidget(m_viewPlayFrame);
|
Chris@34
|
154
|
Chris@1189
|
155 QGridLayout *layout = new QGridLayout;
|
Chris@34
|
156 m_viewPlayFrame->setLayout(layout);
|
Chris@34
|
157
|
Chris@34
|
158 layout->setMargin(layout->margin() / 2);
|
Chris@34
|
159
|
Chris@36
|
160 #ifdef DEBUG_PROPERTY_BOX
|
Chris@587
|
161 SVDEBUG << "PropertyBox::populateViewPlayFrame: container " << m_container << " (name " << m_container->getPropertyContainerName() << ") params " << params << endl;
|
Chris@36
|
162 #endif
|
Chris@1189
|
163
|
Chris@1189
|
164 QSize buttonSize = WidgetScale::scaleQSize(QSize(26, 26));
|
Chris@1189
|
165 int col = 0;
|
Chris@1189
|
166
|
Chris@33
|
167 if (params) {
|
Chris@1189
|
168
|
Chris@1189
|
169 m_playButton = new NotifyingToolButton;
|
Chris@1187
|
170 m_playButton->setCheckable(true);
|
Chris@1187
|
171 m_playButton->setIcon(IconLoader().load("speaker"));
|
Chris@1187
|
172 m_playButton->setChecked(!params->isPlayMuted());
|
Chris@1189
|
173 m_playButton->setFixedSize(buttonSize);
|
Chris@1187
|
174 connect(m_playButton, SIGNAL(toggled(bool)),
|
Chris@1187
|
175 this, SLOT(playAudibleButtonChanged(bool)));
|
Chris@1187
|
176 connect(m_playButton, SIGNAL(mouseEntered()),
|
Chris@1187
|
177 this, SLOT(mouseEnteredWidget()));
|
Chris@1187
|
178 connect(m_playButton, SIGNAL(mouseLeft()),
|
Chris@1187
|
179 this, SLOT(mouseLeftWidget()));
|
Chris@1187
|
180 connect(params, SIGNAL(playAudibleChanged(bool)),
|
Chris@1187
|
181 this, SLOT(playAudibleChanged(bool)));
|
Chris@63
|
182
|
Chris@1179
|
183 LevelPanToolButton *levelPan = new LevelPanToolButton;
|
Chris@1189
|
184 levelPan->setFixedSize(buttonSize);
|
Chris@1189
|
185 levelPan->setImageSize((buttonSize.height() * 3) / 4);
|
Chris@1189
|
186 layout->addWidget(levelPan, 0, col++, Qt::AlignCenter);
|
Chris@1178
|
187 connect(levelPan, SIGNAL(levelChanged(float)),
|
Chris@1178
|
188 this, SLOT(playGainControlChanged(float)));
|
Chris@1178
|
189 connect(levelPan, SIGNAL(panChanged(float)),
|
Chris@1178
|
190 this, SLOT(playPanControlChanged(float)));
|
Chris@1178
|
191 connect(params, SIGNAL(playGainChanged(float)),
|
Chris@1178
|
192 levelPan, SLOT(setLevel(float)));
|
Chris@1178
|
193 connect(params, SIGNAL(playPanChanged(float)),
|
Chris@1178
|
194 levelPan, SLOT(setPan(float)));
|
Chris@1180
|
195 connect(levelPan, SIGNAL(mouseEntered()),
|
Chris@1180
|
196 this, SLOT(mouseEnteredWidget()));
|
Chris@1180
|
197 connect(levelPan, SIGNAL(mouseLeft()),
|
Chris@1180
|
198 this, SLOT(mouseLeftWidget()));
|
Chris@1180
|
199
|
Chris@1189
|
200 layout->addWidget(m_playButton, 0, col++, Qt::AlignCenter);
|
Chris@1189
|
201
|
Chris@1187
|
202 if (params->getPlayClipId() != "") {
|
Chris@1189
|
203 QToolButton *playParamButton = new QToolButton;
|
Chris@1187
|
204 playParamButton->setObjectName("playParamButton");
|
Chris@1187
|
205 playParamButton->setIcon(IconLoader().load("faders"));
|
Chris@1189
|
206 playParamButton->setFixedSize(buttonSize);
|
Chris@1189
|
207 layout->addWidget(playParamButton, 0, col++, Qt::AlignCenter);
|
Chris@1187
|
208 connect(playParamButton, SIGNAL(clicked()),
|
Chris@1187
|
209 this, SLOT(editPlayParameters()));
|
Chris@1187
|
210 connect(playParamButton, SIGNAL(mouseEntered()),
|
Chris@1187
|
211 this, SLOT(mouseEnteredWidget()));
|
Chris@1187
|
212 connect(playParamButton, SIGNAL(mouseLeft()),
|
Chris@1187
|
213 this, SLOT(mouseLeftWidget()));
|
Chris@1187
|
214 }
|
Chris@1187
|
215 }
|
Chris@1187
|
216
|
Chris@1189
|
217 layout->setColumnStretch(col++, 10);
|
Chris@1187
|
218
|
Chris@1187
|
219 if (layer) {
|
Chris@1187
|
220
|
Chris@1187
|
221 QLabel *showLabel = new QLabel(tr("Show"));
|
Chris@1189
|
222 layout->addWidget(showLabel, 0, col++, Qt::AlignVCenter | Qt::AlignRight);
|
Chris@1187
|
223
|
Chris@1187
|
224 m_showButton = new LEDButton(Qt::blue);
|
Chris@1189
|
225 layout->addWidget(m_showButton, 0, col++, Qt::AlignVCenter | Qt::AlignLeft);
|
Chris@1187
|
226 connect(m_showButton, SIGNAL(stateChanged(bool)),
|
Chris@1187
|
227 this, SIGNAL(showLayer(bool)));
|
Chris@1187
|
228 connect(m_showButton, SIGNAL(mouseEntered()),
|
Chris@1180
|
229 this, SLOT(mouseEnteredWidget()));
|
Chris@1187
|
230 connect(m_showButton, SIGNAL(mouseLeft()),
|
Chris@1180
|
231 this, SLOT(mouseLeftWidget()));
|
Chris@33
|
232 }
|
Chris@33
|
233 }
|
Chris@33
|
234
|
Chris@33
|
235 void
|
Chris@197
|
236 PropertyBox::updatePropertyEditor(PropertyContainer::PropertyName name,
|
Chris@197
|
237 bool rangeChanged)
|
Chris@0
|
238 {
|
Chris@0
|
239 PropertyContainer::PropertyType type = m_container->getPropertyType(name);
|
Chris@0
|
240 int row = m_layout->rowCount();
|
Chris@0
|
241
|
Chris@216
|
242 int min = 0, max = 0, value = 0, deflt = 0;
|
Chris@216
|
243 value = m_container->getPropertyRangeAndValue(name, &min, &max, &deflt);
|
Chris@0
|
244
|
Chris@0
|
245 bool have = (m_propertyControllers.find(name) !=
|
Chris@0
|
246 m_propertyControllers.end());
|
Chris@0
|
247
|
Chris@0
|
248 QString groupName = m_container->getPropertyGroupName(name);
|
Chris@87
|
249 QString propertyLabel = m_container->getPropertyLabel(name);
|
Chris@335
|
250 QString iconName = m_container->getPropertyIconName(name);
|
Chris@0
|
251
|
Chris@0
|
252 #ifdef DEBUG_PROPERTY_BOX
|
Chris@682
|
253 cerr << "PropertyBox[" << this
|
Chris@683
|
254 << "(\"" << m_container->getPropertyContainerName()
|
Chris@0
|
255 << "\")]";
|
Chris@682
|
256 cerr << "::updatePropertyEditor(\"" << name << "\"):";
|
Chris@682
|
257 cerr << " value " << value << ", have " << have << ", group \""
|
Chris@682
|
258 << groupName << "\"" << endl;
|
Chris@0
|
259 #endif
|
Chris@0
|
260
|
Chris@0
|
261 bool inGroup = (groupName != QString());
|
Chris@0
|
262
|
Chris@0
|
263 if (!have) {
|
Chris@0
|
264 if (inGroup) {
|
Chris@0
|
265 if (m_groupLayouts.find(groupName) == m_groupLayouts.end()) {
|
Chris@0
|
266 #ifdef DEBUG_PROPERTY_BOX
|
Chris@682
|
267 cerr << "PropertyBox: adding label \"" << groupName << "\" and frame for group for \"" << name << "\"" << endl;
|
Chris@0
|
268 #endif
|
Chris@33
|
269 m_layout->addWidget(new QLabel(groupName, m_mainWidget), row, 0);
|
Chris@33
|
270 QFrame *frame = new QFrame(m_mainWidget);
|
Chris@0
|
271 m_layout->addWidget(frame, row, 1, 1, 2);
|
Chris@493
|
272 m_groupLayouts[groupName] = new QGridLayout;
|
Chris@0
|
273 m_groupLayouts[groupName]->setMargin(0);
|
Chris@0
|
274 frame->setLayout(m_groupLayouts[groupName]);
|
Chris@0
|
275 }
|
Chris@0
|
276 } else {
|
Chris@0
|
277 #ifdef DEBUG_PROPERTY_BOX
|
Chris@682
|
278 cerr << "PropertyBox: adding label \"" << propertyLabel << "\"" << endl;
|
Chris@0
|
279 #endif
|
Chris@87
|
280 m_layout->addWidget(new QLabel(propertyLabel, m_mainWidget), row, 0);
|
Chris@0
|
281 }
|
Chris@0
|
282 }
|
Chris@0
|
283
|
Chris@0
|
284 switch (type) {
|
Chris@0
|
285
|
Chris@0
|
286 case PropertyContainer::ToggleProperty:
|
Chris@0
|
287 {
|
Chris@335
|
288 QAbstractButton *button = 0;
|
Chris@0
|
289
|
Chris@0
|
290 if (have) {
|
Chris@335
|
291 button = dynamic_cast<QAbstractButton *>(m_propertyControllers[name]);
|
Chris@335
|
292 assert(button);
|
Chris@0
|
293 } else {
|
Chris@0
|
294 #ifdef DEBUG_PROPERTY_BOX
|
Chris@682
|
295 cerr << "PropertyBox: creating new checkbox" << endl;
|
Chris@0
|
296 #endif
|
Chris@335
|
297 if (iconName != "") {
|
Chris@335
|
298 button = new NotifyingPushButton();
|
Chris@335
|
299 button->setCheckable(true);
|
Chris@335
|
300 QIcon icon(IconLoader().load(iconName));
|
Chris@335
|
301 button->setIcon(icon);
|
Chris@335
|
302 button->setObjectName(name);
|
Chris@1174
|
303 button->setFixedSize(WidgetScale::scaleQSize(QSize(18, 18)));
|
Chris@335
|
304 } else {
|
Chris@335
|
305 button = new NotifyingCheckBox();
|
Chris@335
|
306 button->setObjectName(name);
|
Chris@335
|
307 }
|
Chris@335
|
308 connect(button, SIGNAL(toggled(bool)),
|
Chris@335
|
309 this, SLOT(propertyControllerChanged(bool)));
|
Chris@335
|
310 connect(button, SIGNAL(mouseEntered()),
|
Chris@189
|
311 this, SLOT(mouseEnteredWidget()));
|
Chris@335
|
312 connect(button, SIGNAL(mouseLeft()),
|
Chris@189
|
313 this, SLOT(mouseLeftWidget()));
|
Chris@0
|
314 if (inGroup) {
|
Chris@335
|
315 button->setToolTip(propertyLabel);
|
Chris@493
|
316 m_groupLayouts[groupName]->addWidget
|
Chris@493
|
317 (button, 0, m_groupLayouts[groupName]->columnCount());
|
Chris@0
|
318 } else {
|
Chris@335
|
319 m_layout->addWidget(button, row, 1, 1, 2);
|
Chris@0
|
320 }
|
Chris@335
|
321 m_propertyControllers[name] = button;
|
Chris@0
|
322 }
|
Chris@0
|
323
|
Chris@335
|
324 if (button->isChecked() != (value > 0)) {
|
Chris@335
|
325 button->blockSignals(true);
|
Chris@335
|
326 button->setChecked(value > 0);
|
Chris@335
|
327 button->blockSignals(false);
|
Chris@55
|
328 }
|
Chris@0
|
329 break;
|
Chris@0
|
330 }
|
Chris@0
|
331
|
Chris@0
|
332 case PropertyContainer::RangeProperty:
|
Chris@0
|
333 {
|
Chris@0
|
334 AudioDial *dial;
|
Chris@0
|
335
|
Chris@0
|
336 if (have) {
|
Chris@0
|
337 dial = dynamic_cast<AudioDial *>(m_propertyControllers[name]);
|
Chris@0
|
338 assert(dial);
|
Chris@197
|
339 if (rangeChanged) {
|
Chris@197
|
340 dial->blockSignals(true);
|
Chris@197
|
341 dial->setMinimum(min);
|
Chris@197
|
342 dial->setMaximum(max);
|
Chris@197
|
343 dial->setRangeMapper(m_container->getNewPropertyRangeMapper(name));
|
Chris@197
|
344 dial->blockSignals(false);
|
Chris@197
|
345 }
|
Chris@197
|
346
|
Chris@0
|
347 } else {
|
Chris@0
|
348 #ifdef DEBUG_PROPERTY_BOX
|
Chris@682
|
349 cerr << "PropertyBox: creating new dial" << endl;
|
Chris@0
|
350 #endif
|
Chris@0
|
351 dial = new AudioDial();
|
Chris@0
|
352 dial->setObjectName(name);
|
Chris@0
|
353 dial->setMinimum(min);
|
Chris@0
|
354 dial->setMaximum(max);
|
Chris@0
|
355 dial->setPageStep(1);
|
Chris@34
|
356 dial->setNotchesVisible((max - min) <= 12);
|
Chris@1126
|
357 // important to set the range mapper before the default,
|
Chris@1126
|
358 // because the range mapper is used to map the default
|
Chris@1126
|
359 dial->setRangeMapper(m_container->getNewPropertyRangeMapper(name));
|
Chris@216
|
360 dial->setDefaultValue(deflt);
|
Chris@168
|
361 dial->setShowToolTip(true);
|
Chris@0
|
362 connect(dial, SIGNAL(valueChanged(int)),
|
Chris@0
|
363 this, SLOT(propertyControllerChanged(int)));
|
Chris@189
|
364 connect(dial, SIGNAL(mouseEntered()),
|
Chris@189
|
365 this, SLOT(mouseEnteredWidget()));
|
Chris@189
|
366 connect(dial, SIGNAL(mouseLeft()),
|
Chris@189
|
367 this, SLOT(mouseLeftWidget()));
|
Chris@0
|
368
|
Chris@0
|
369 if (inGroup) {
|
Chris@1174
|
370 dial->setFixedWidth(WidgetScale::scalePixelSize(24));
|
Chris@1174
|
371 dial->setFixedHeight(WidgetScale::scalePixelSize(24));
|
Chris@493
|
372 m_groupLayouts[groupName]->addWidget
|
Chris@493
|
373 (dial, 0, m_groupLayouts[groupName]->columnCount());
|
Chris@0
|
374 } else {
|
Chris@1174
|
375 dial->setFixedWidth(WidgetScale::scalePixelSize(32));
|
Chris@1174
|
376 dial->setFixedHeight(WidgetScale::scalePixelSize(32));
|
Chris@0
|
377 m_layout->addWidget(dial, row, 1);
|
Chris@33
|
378 QLabel *label = new QLabel(m_mainWidget);
|
Chris@0
|
379 connect(dial, SIGNAL(valueChanged(int)),
|
Chris@0
|
380 label, SLOT(setNum(int)));
|
Chris@0
|
381 label->setNum(value);
|
Chris@0
|
382 m_layout->addWidget(label, row, 2);
|
Chris@0
|
383 }
|
Chris@0
|
384
|
Chris@0
|
385 m_propertyControllers[name] = dial;
|
Chris@0
|
386 }
|
Chris@0
|
387
|
Chris@55
|
388 if (dial->value() != value) {
|
Chris@55
|
389 dial->blockSignals(true);
|
Chris@55
|
390 dial->setValue(value);
|
Chris@55
|
391 dial->blockSignals(false);
|
Chris@55
|
392 }
|
Chris@0
|
393 break;
|
Chris@0
|
394 }
|
Chris@0
|
395
|
Chris@0
|
396 case PropertyContainer::ValueProperty:
|
Chris@100
|
397 case PropertyContainer::UnitsProperty:
|
Chris@285
|
398 case PropertyContainer::ColourProperty:
|
Chris@0
|
399 {
|
Chris@189
|
400 NotifyingComboBox *cb;
|
Chris@0
|
401
|
Chris@0
|
402 if (have) {
|
Chris@189
|
403 cb = dynamic_cast<NotifyingComboBox *>(m_propertyControllers[name]);
|
Chris@0
|
404 assert(cb);
|
Chris@0
|
405 } else {
|
Chris@0
|
406 #ifdef DEBUG_PROPERTY_BOX
|
Chris@682
|
407 cerr << "PropertyBox: creating new combobox" << endl;
|
Chris@0
|
408 #endif
|
Chris@0
|
409
|
Chris@189
|
410 cb = new NotifyingComboBox();
|
Chris@0
|
411 cb->setObjectName(name);
|
Chris@100
|
412 cb->setDuplicatesEnabled(false);
|
Chris@197
|
413 }
|
Chris@100
|
414
|
Chris@197
|
415 if (!have || rangeChanged) {
|
Chris@285
|
416
|
Chris@197
|
417 cb->blockSignals(true);
|
Chris@197
|
418 cb->clear();
|
Chris@285
|
419 cb->setEditable(false);
|
Chris@285
|
420
|
Chris@100
|
421 if (type == PropertyContainer::ValueProperty) {
|
Chris@285
|
422
|
Chris@100
|
423 for (int i = min; i <= max; ++i) {
|
Chris@862
|
424
|
Chris@862
|
425 QString label = m_container->getPropertyValueLabel(name, i);
|
Chris@862
|
426 QString iname = m_container->getPropertyValueIconName(name, i);
|
Chris@862
|
427
|
Chris@862
|
428 if (iname != "") {
|
Chris@862
|
429 QIcon icon(IconLoader().load(iname));
|
Chris@862
|
430 cb->addItem(icon, label);
|
Chris@862
|
431 } else {
|
Chris@862
|
432 cb->addItem(label);
|
Chris@862
|
433 }
|
Chris@100
|
434 }
|
Chris@285
|
435
|
Chris@285
|
436 } else if (type == PropertyContainer::UnitsProperty) {
|
Chris@285
|
437
|
Chris@100
|
438 QStringList units = UnitDatabase::getInstance()->getKnownUnits();
|
Chris@100
|
439 for (int i = 0; i < units.size(); ++i) {
|
Chris@100
|
440 cb->addItem(units[i]);
|
Chris@100
|
441 }
|
Chris@285
|
442
|
Chris@100
|
443 cb->setEditable(true);
|
Chris@285
|
444
|
Chris@285
|
445 } else { // ColourProperty
|
Chris@290
|
446
|
Chris@290
|
447 //!!! should be a proper colour combobox class that
|
Chris@290
|
448 // manages its own Add New Colour entry...
|
Chris@1173
|
449
|
Chris@1173
|
450 int size = (QFontMetrics(QFont()).height() * 2) / 3;
|
Chris@1173
|
451 if (size < 12) size = 12;
|
Chris@285
|
452
|
Chris@285
|
453 ColourDatabase *db = ColourDatabase::getInstance();
|
Chris@769
|
454 for (int i = 0; i < db->getColourCount(); ++i) {
|
Chris@285
|
455 QString name = db->getColourName(i);
|
Chris@1173
|
456 cb->addItem(db->getExamplePixmap(i, QSize(size, size)), name);
|
Chris@285
|
457 }
|
Chris@285
|
458 cb->addItem(tr("Add New Colour..."));
|
Chris@285
|
459 }
|
Chris@285
|
460
|
Chris@197
|
461 cb->blockSignals(false);
|
Chris@280
|
462 if (cb->count() < 20 && cb->count() > cb->maxVisibleItems()) {
|
Chris@280
|
463 cb->setMaxVisibleItems(cb->count());
|
Chris@280
|
464 }
|
Chris@197
|
465 }
|
Chris@100
|
466
|
Chris@197
|
467 if (!have) {
|
Chris@0
|
468 connect(cb, SIGNAL(activated(int)),
|
Chris@0
|
469 this, SLOT(propertyControllerChanged(int)));
|
Chris@189
|
470 connect(cb, SIGNAL(mouseEntered()),
|
Chris@189
|
471 this, SLOT(mouseEnteredWidget()));
|
Chris@189
|
472 connect(cb, SIGNAL(mouseLeft()),
|
Chris@189
|
473 this, SLOT(mouseLeftWidget()));
|
Chris@100
|
474
|
Chris@0
|
475 if (inGroup) {
|
Chris@108
|
476 cb->setToolTip(propertyLabel);
|
Chris@493
|
477 m_groupLayouts[groupName]->addWidget
|
Chris@493
|
478 (cb, 0, m_groupLayouts[groupName]->columnCount());
|
Chris@0
|
479 } else {
|
Chris@0
|
480 m_layout->addWidget(cb, row, 1, 1, 2);
|
Chris@0
|
481 }
|
Chris@0
|
482 m_propertyControllers[name] = cb;
|
Chris@0
|
483 }
|
Chris@0
|
484
|
Chris@100
|
485 cb->blockSignals(true);
|
Chris@285
|
486 if (type == PropertyContainer::ValueProperty ||
|
Chris@285
|
487 type == PropertyContainer::ColourProperty) {
|
Chris@100
|
488 if (cb->currentIndex() != value) {
|
Chris@100
|
489 cb->setCurrentIndex(value);
|
Chris@100
|
490 }
|
Chris@100
|
491 } else {
|
Chris@100
|
492 QString unit = UnitDatabase::getInstance()->getUnitById(value);
|
Chris@100
|
493 if (cb->currentText() != unit) {
|
Chris@100
|
494 for (int i = 0; i < cb->count(); ++i) {
|
Chris@100
|
495 if (cb->itemText(i) == unit) {
|
Chris@100
|
496 cb->setCurrentIndex(i);
|
Chris@100
|
497 break;
|
Chris@100
|
498 }
|
Chris@100
|
499 }
|
Chris@100
|
500 }
|
Chris@100
|
501 }
|
Chris@100
|
502 cb->blockSignals(false);
|
Chris@0
|
503
|
Chris@681
|
504 #ifdef Q_OS_MAC
|
Chris@982
|
505 // Crashes on startup without this, for some reason; also
|
Chris@982
|
506 // prevents combo boxes from getting weirdly squished
|
Chris@982
|
507 // vertically
|
Chris@982
|
508 cb->setMinimumSize(QSize(10, cb->font().pixelSize() * 2));
|
Chris@0
|
509 #endif
|
Chris@0
|
510
|
Chris@0
|
511 break;
|
Chris@0
|
512 }
|
Chris@0
|
513
|
Chris@807
|
514 case PropertyContainer::InvalidProperty:
|
Chris@0
|
515 default:
|
Chris@0
|
516 break;
|
Chris@0
|
517 }
|
Chris@0
|
518 }
|
Chris@0
|
519
|
Chris@0
|
520 void
|
Chris@0
|
521 PropertyBox::propertyContainerPropertyChanged(PropertyContainer *pc)
|
Chris@0
|
522 {
|
Chris@0
|
523 if (pc != m_container) return;
|
Chris@0
|
524
|
Chris@55
|
525 #ifdef DEBUG_PROPERTY_BOX
|
Chris@587
|
526 SVDEBUG << "PropertyBox::propertyContainerPropertyChanged" << endl;
|
Chris@55
|
527 #endif
|
Chris@55
|
528
|
Chris@0
|
529 PropertyContainer::PropertyList properties = m_container->getProperties();
|
Chris@0
|
530 size_t i;
|
Chris@0
|
531
|
Chris@0
|
532 blockSignals(true);
|
Chris@0
|
533
|
Chris@0
|
534 for (i = 0; i < properties.size(); ++i) {
|
Chris@0
|
535 updatePropertyEditor(properties[i]);
|
Chris@0
|
536 }
|
Chris@0
|
537
|
Chris@0
|
538 blockSignals(false);
|
Chris@0
|
539 }
|
Chris@0
|
540
|
Chris@0
|
541 void
|
Chris@249
|
542 PropertyBox::propertyContainerPropertyRangeChanged(PropertyContainer *)
|
Chris@197
|
543 {
|
Chris@197
|
544 blockSignals(true);
|
Chris@197
|
545
|
Chris@197
|
546 PropertyContainer::PropertyList properties = m_container->getProperties();
|
Chris@197
|
547 for (size_t i = 0; i < properties.size(); ++i) {
|
Chris@197
|
548 updatePropertyEditor(properties[i], true);
|
Chris@197
|
549 }
|
Chris@197
|
550
|
Chris@197
|
551 blockSignals(false);
|
Chris@197
|
552 }
|
Chris@197
|
553
|
Chris@197
|
554 void
|
Chris@100
|
555 PropertyBox::unitDatabaseChanged()
|
Chris@100
|
556 {
|
Chris@729
|
557 #ifdef DEBUG_PROPERTY_BOX
|
Chris@682
|
558 cerr << "PropertyBox[" << this << "]: unitDatabaseChanged" << endl;
|
Chris@729
|
559 #endif
|
Chris@100
|
560 blockSignals(true);
|
Chris@100
|
561
|
Chris@682
|
562 // cerr << "my container is " << m_container << endl;
|
Chris@682
|
563 // cerr << "my container's name is... " << endl;
|
Chris@682
|
564 // cerr << m_container->objectName() << endl;
|
Chris@456
|
565
|
Chris@100
|
566 PropertyContainer::PropertyList properties = m_container->getProperties();
|
Chris@100
|
567 for (size_t i = 0; i < properties.size(); ++i) {
|
Chris@285
|
568 if (m_container->getPropertyType(properties[i]) ==
|
Chris@285
|
569 PropertyContainer::UnitsProperty) {
|
Chris@285
|
570 updatePropertyEditor(properties[i]);
|
Chris@285
|
571 }
|
Chris@285
|
572 }
|
Chris@285
|
573
|
Chris@285
|
574 blockSignals(false);
|
Chris@285
|
575 }
|
Chris@285
|
576
|
Chris@285
|
577 void
|
Chris@285
|
578 PropertyBox::colourDatabaseChanged()
|
Chris@285
|
579 {
|
Chris@285
|
580 blockSignals(true);
|
Chris@285
|
581
|
Chris@285
|
582 PropertyContainer::PropertyList properties = m_container->getProperties();
|
Chris@285
|
583 for (size_t i = 0; i < properties.size(); ++i) {
|
Chris@285
|
584 if (m_container->getPropertyType(properties[i]) ==
|
Chris@285
|
585 PropertyContainer::ColourProperty) {
|
Chris@285
|
586 updatePropertyEditor(properties[i], true);
|
Chris@285
|
587 }
|
Chris@100
|
588 }
|
Chris@100
|
589
|
Chris@100
|
590 blockSignals(false);
|
Chris@100
|
591 }
|
Chris@100
|
592
|
Chris@100
|
593 void
|
Chris@335
|
594 PropertyBox::propertyControllerChanged(bool on)
|
Chris@335
|
595 {
|
Chris@335
|
596 propertyControllerChanged(on ? 1 : 0);
|
Chris@335
|
597 }
|
Chris@335
|
598
|
Chris@335
|
599 void
|
Chris@0
|
600 PropertyBox::propertyControllerChanged(int value)
|
Chris@0
|
601 {
|
Chris@0
|
602 QObject *obj = sender();
|
Chris@0
|
603 QString name = obj->objectName();
|
Chris@0
|
604
|
Chris@34
|
605 #ifdef DEBUG_PROPERTY_BOX
|
Chris@587
|
606 SVDEBUG << "PropertyBox::propertyControllerChanged(" << name << ", " << value << ")" << endl;
|
Chris@34
|
607 #endif
|
Chris@0
|
608
|
Chris@0
|
609 PropertyContainer::PropertyType type = m_container->getPropertyType(name);
|
Chris@100
|
610
|
Chris@376
|
611 Command *c = 0;
|
Chris@376
|
612
|
Chris@100
|
613 if (type == PropertyContainer::UnitsProperty) {
|
Chris@285
|
614
|
Chris@189
|
615 NotifyingComboBox *cb = dynamic_cast<NotifyingComboBox *>(obj);
|
Chris@100
|
616 if (cb) {
|
Chris@100
|
617 QString unit = cb->currentText();
|
Chris@376
|
618 c = m_container->getSetPropertyCommand
|
Chris@100
|
619 (name, UnitDatabase::getInstance()->getUnitId(unit));
|
Chris@100
|
620 }
|
Chris@285
|
621
|
Chris@285
|
622 } else if (type == PropertyContainer::ColourProperty) {
|
Chris@285
|
623
|
Chris@285
|
624 if (value == int(ColourDatabase::getInstance()->getColourCount())) {
|
Chris@285
|
625 addNewColour();
|
Chris@285
|
626 if (value == int(ColourDatabase::getInstance()->getColourCount())) {
|
Chris@285
|
627 propertyContainerPropertyChanged(m_container);
|
Chris@285
|
628 return;
|
Chris@285
|
629 }
|
Chris@285
|
630 }
|
Chris@376
|
631 c = m_container->getSetPropertyCommand(name, value);
|
Chris@285
|
632
|
Chris@100
|
633 } else if (type != PropertyContainer::InvalidProperty) {
|
Chris@285
|
634
|
Chris@376
|
635 c = m_container->getSetPropertyCommand(name, value);
|
Chris@0
|
636 }
|
Chris@376
|
637
|
Chris@376
|
638 if (c) CommandHistory::getInstance()->addCommand(c, true, true);
|
Chris@218
|
639
|
Chris@218
|
640 updateContextHelp(obj);
|
Chris@0
|
641 }
|
Chris@285
|
642
|
Chris@285
|
643 void
|
Chris@285
|
644 PropertyBox::addNewColour()
|
Chris@285
|
645 {
|
Chris@285
|
646 QColor newColour = QColorDialog::getColor();
|
Chris@285
|
647 if (!newColour.isValid()) return;
|
Chris@285
|
648
|
Chris@285
|
649 ColourNameDialog dialog(tr("Name New Colour"),
|
Chris@361
|
650 tr("Enter a name for the new colour:"),
|
Chris@361
|
651 newColour, newColour.name(), this);
|
Chris@285
|
652 dialog.showDarkBackgroundCheckbox(tr("Prefer black background for this colour"));
|
Chris@285
|
653 if (dialog.exec() == QDialog::Accepted) {
|
Chris@285
|
654 //!!! command
|
Chris@285
|
655 ColourDatabase *db = ColourDatabase::getInstance();
|
Chris@285
|
656 int index = db->addColour(newColour, dialog.getColourName());
|
Chris@285
|
657 db->setUseDarkBackground(index, dialog.isDarkBackgroundChecked());
|
Chris@285
|
658 }
|
Chris@285
|
659 }
|
Chris@377
|
660
|
Chris@377
|
661 void
|
Chris@377
|
662 PropertyBox::playAudibleChanged(bool audible)
|
Chris@377
|
663 {
|
Chris@1180
|
664 m_playButton->setChecked(audible);
|
Chris@377
|
665 }
|
Chris@377
|
666
|
Chris@377
|
667 void
|
Chris@377
|
668 PropertyBox::playAudibleButtonChanged(bool audible)
|
Chris@377
|
669 {
|
Chris@377
|
670 PlayParameters *params = m_container->getPlayParameters();
|
Chris@377
|
671 if (!params) return;
|
Chris@377
|
672
|
Chris@377
|
673 if (params->isPlayAudible() != audible) {
|
Chris@377
|
674 PlayParameterRepository::EditCommand *command =
|
Chris@377
|
675 new PlayParameterRepository::EditCommand(params);
|
Chris@377
|
676 command->setPlayAudible(audible);
|
Chris@377
|
677 CommandHistory::getInstance()->addCommand(command, true, true);
|
Chris@377
|
678 }
|
Chris@377
|
679 }
|
Chris@34
|
680
|
Chris@34
|
681 void
|
Chris@1178
|
682 PropertyBox::playGainControlChanged(float gain)
|
Chris@34
|
683 {
|
Chris@218
|
684 QObject *obj = sender();
|
Chris@377
|
685
|
Chris@377
|
686 PlayParameters *params = m_container->getPlayParameters();
|
Chris@377
|
687 if (!params) return;
|
Chris@377
|
688
|
Chris@377
|
689 if (params->getPlayGain() != gain) {
|
Chris@377
|
690 PlayParameterRepository::EditCommand *command =
|
Chris@377
|
691 new PlayParameterRepository::EditCommand(params);
|
Chris@377
|
692 command->setPlayGain(gain);
|
Chris@377
|
693 CommandHistory::getInstance()->addCommand(command, true, true);
|
Chris@377
|
694 }
|
Chris@377
|
695
|
Chris@218
|
696 updateContextHelp(obj);
|
Chris@34
|
697 }
|
Chris@34
|
698
|
Chris@34
|
699 void
|
Chris@1178
|
700 PropertyBox::playPanControlChanged(float pan)
|
Chris@34
|
701 {
|
Chris@218
|
702 QObject *obj = sender();
|
Chris@377
|
703
|
Chris@377
|
704 PlayParameters *params = m_container->getPlayParameters();
|
Chris@377
|
705 if (!params) return;
|
Chris@377
|
706
|
Chris@377
|
707 if (params->getPlayPan() != pan) {
|
Chris@377
|
708 PlayParameterRepository::EditCommand *command =
|
Chris@377
|
709 new PlayParameterRepository::EditCommand(params);
|
Chris@377
|
710 command->setPlayPan(pan);
|
Chris@377
|
711 CommandHistory::getInstance()->addCommand(command, true, true);
|
Chris@377
|
712 }
|
Chris@377
|
713
|
Chris@218
|
714 updateContextHelp(obj);
|
Chris@34
|
715 }
|
Chris@769
|
716
|
Chris@63
|
717 void
|
Chris@769
|
718 PropertyBox::editPlayParameters()
|
Chris@63
|
719 {
|
Chris@63
|
720 PlayParameters *params = m_container->getPlayParameters();
|
Chris@63
|
721 if (!params) return;
|
Chris@63
|
722
|
Chris@769
|
723 QString clip = params->getPlayClipId();
|
Chris@377
|
724
|
Chris@377
|
725 PlayParameterRepository::EditCommand *command =
|
Chris@377
|
726 new PlayParameterRepository::EditCommand(params);
|
Chris@63
|
727
|
Chris@769
|
728 QInputDialog *dialog = new QInputDialog(this);
|
Chris@63
|
729
|
Chris@769
|
730 QDir dir(":/samples");
|
Chris@769
|
731 QStringList clipFiles = dir.entryList(QStringList() << "*.wav", QDir::Files);
|
Chris@63
|
732
|
Chris@769
|
733 QStringList clips;
|
Chris@769
|
734 foreach (QString str, clipFiles) {
|
Chris@769
|
735 clips.push_back(str.replace(".wav", ""));
|
Chris@769
|
736 }
|
Chris@769
|
737 dialog->setComboBoxItems(clips);
|
Chris@63
|
738
|
Chris@769
|
739 dialog->setLabelText(tr("Set playback clip:"));
|
Chris@769
|
740
|
Chris@769
|
741 QComboBox *cb = dialog->findChild<QComboBox *>();
|
Chris@779
|
742 if (cb) {
|
Chris@779
|
743 for (int i = 0; i < cb->count(); ++i) {
|
Chris@779
|
744 if (cb->itemText(i) == clip) {
|
Chris@779
|
745 cb->setCurrentIndex(i);
|
Chris@779
|
746 }
|
Chris@779
|
747 }
|
Chris@779
|
748 }
|
Chris@769
|
749
|
Chris@769
|
750 connect(dialog, SIGNAL(textValueChanged(QString)),
|
Chris@769
|
751 this, SLOT(playClipChanged(QString)));
|
Chris@64
|
752
|
Chris@63
|
753 if (dialog->exec() == QDialog::Accepted) {
|
Chris@769
|
754 QString newClip = dialog->textValue();
|
Chris@769
|
755 command->setPlayClipId(newClip);
|
Chris@377
|
756 CommandHistory::getInstance()->addCommand(command, true);
|
Chris@64
|
757 } else {
|
Chris@377
|
758 delete command;
|
Chris@64
|
759 // restore in case we mucked about with the configuration
|
Chris@64
|
760 // as a consequence of signals from the dialog
|
Chris@769
|
761 params->setPlayClipId(clip);
|
Chris@63
|
762 }
|
Chris@63
|
763
|
Chris@63
|
764 delete dialog;
|
Chris@63
|
765 }
|
Chris@63
|
766
|
Chris@64
|
767 void
|
Chris@769
|
768 PropertyBox::playClipChanged(QString id)
|
Chris@64
|
769 {
|
Chris@64
|
770 PlayParameters *params = m_container->getPlayParameters();
|
Chris@64
|
771 if (!params) return;
|
Chris@64
|
772
|
Chris@769
|
773 params->setPlayClipId(id);
|
Chris@64
|
774 }
|
Chris@769
|
775
|
Chris@185
|
776 void
|
Chris@185
|
777 PropertyBox::layerVisibilityChanged(bool visible)
|
Chris@185
|
778 {
|
Chris@185
|
779 if (m_showButton) m_showButton->setState(visible);
|
Chris@185
|
780 }
|
Chris@189
|
781
|
Chris@189
|
782 void
|
Chris@189
|
783 PropertyBox::mouseEnteredWidget()
|
Chris@189
|
784 {
|
Chris@218
|
785 updateContextHelp(sender());
|
Chris@218
|
786 }
|
Chris@218
|
787
|
Chris@218
|
788 void
|
Chris@218
|
789 PropertyBox::updateContextHelp(QObject *o)
|
Chris@218
|
790 {
|
Chris@218
|
791 QWidget *w = dynamic_cast<QWidget *>(o);
|
Chris@189
|
792 if (!w) return;
|
Chris@218
|
793
|
Chris@189
|
794 if (!m_container) return;
|
Chris@190
|
795 QString cname = m_container->getPropertyContainerName();
|
Chris@189
|
796 if (cname == "") return;
|
Chris@189
|
797
|
Chris@1180
|
798 LevelPanToolButton *lp = qobject_cast<LevelPanToolButton *>(w);
|
Chris@1180
|
799 if (lp) {
|
Chris@1180
|
800 emit contextHelpChanged(tr("Adjust playback level and pan of %1").arg(cname));
|
Chris@1180
|
801 return;
|
Chris@1180
|
802 }
|
Chris@1180
|
803
|
Chris@189
|
804 QString wname = w->objectName();
|
Chris@189
|
805
|
Chris@1180
|
806 if (wname == "playParamButton") {
|
Chris@1180
|
807 PlayParameters *params = m_container->getPlayParameters();
|
Chris@1180
|
808 if (params) {
|
Chris@1180
|
809 emit contextHelpChanged
|
Chris@1180
|
810 (tr("Change sound used for playback (currently \"%1\")")
|
Chris@1180
|
811 .arg(params->getPlayClipId()));
|
Chris@1180
|
812 return;
|
Chris@1180
|
813 }
|
Chris@1180
|
814 }
|
Chris@1180
|
815
|
Chris@218
|
816 QString extraText;
|
Chris@1180
|
817
|
Chris@1180
|
818 AudioDial *dial = qobject_cast<AudioDial *>(w);
|
Chris@218
|
819 if (dial) {
|
Chris@908
|
820 double mv = dial->mappedValue();
|
Chris@218
|
821 QString unit = "";
|
Chris@218
|
822 if (dial->rangeMapper()) unit = dial->rangeMapper()->getUnit();
|
Chris@218
|
823 if (unit != "") {
|
Chris@218
|
824 extraText = tr(" (current value: %1%2)").arg(mv).arg(unit);
|
Chris@218
|
825 } else {
|
Chris@218
|
826 extraText = tr(" (current value: %1)").arg(mv);
|
Chris@218
|
827 }
|
Chris@218
|
828 }
|
Chris@218
|
829
|
Chris@189
|
830 if (w == m_showButton) {
|
Chris@190
|
831 emit contextHelpChanged(tr("Toggle Visibility of %1").arg(cname));
|
Chris@189
|
832 } else if (w == m_playButton) {
|
Chris@190
|
833 emit contextHelpChanged(tr("Toggle Playback of %1").arg(cname));
|
Chris@189
|
834 } else if (wname == "") {
|
Chris@189
|
835 return;
|
Chris@335
|
836 } else if (dynamic_cast<QAbstractButton *>(w)) {
|
Chris@190
|
837 emit contextHelpChanged(tr("Toggle %1 property of %2")
|
Chris@189
|
838 .arg(wname).arg(cname));
|
Chris@189
|
839 } else {
|
Chris@218
|
840 emit contextHelpChanged(tr("Adjust %1 property of %2%3")
|
Chris@218
|
841 .arg(wname).arg(cname).arg(extraText));
|
Chris@189
|
842 }
|
Chris@189
|
843 }
|
Chris@189
|
844
|
Chris@189
|
845 void
|
Chris@189
|
846 PropertyBox::mouseLeftWidget()
|
Chris@189
|
847 {
|
Chris@218
|
848 if (!(QApplication::mouseButtons() & Qt::LeftButton)) {
|
Chris@218
|
849 emit contextHelpChanged("");
|
Chris@218
|
850 }
|
Chris@189
|
851 }
|
Chris@189
|
852
|
Chris@64
|
853
|