annotate widgets/PropertyBox.cpp @ 71:72fa239a4880

* Modify to use Vamp SDK for proper feature extraction plugins. Requires that the vamp-plugin-sdk directory tree be present below plugin/ (it's separate in Subversion).
author Chris Cannam
date Fri, 31 Mar 2006 15:56:35 +0000
parents 6dad2724f3aa
children 4b98bda7e94d
rev   line source
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@59 7 This file copyright 2006 Chris Cannam.
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@33 21 #include "base/Layer.h"
Chris@0 22
Chris@63 23 #include "plugin/RealTimePluginFactory.h"
Chris@63 24 #include "plugin/RealTimePluginInstance.h"
Chris@71 25 #include "plugin/PluginXml.h"
Chris@63 26
Chris@0 27 #include "AudioDial.h"
Chris@33 28 #include "LEDButton.h"
Chris@0 29
Chris@0 30 #include <QGridLayout>
Chris@0 31 #include <QHBoxLayout>
Chris@33 32 #include <QVBoxLayout>
Chris@0 33 #include <QCheckBox>
Chris@0 34 #include <QComboBox>
Chris@63 35 #include <QPushButton>
Chris@0 36 #include <QLabel>
Chris@33 37 #include <QFrame>
Chris@0 38
Chris@0 39 #include <cassert>
Chris@0 40 #include <iostream>
Martin@46 41 #include <cmath>
Chris@0 42
Chris@0 43 //#define DEBUG_PROPERTY_BOX 1
Chris@0 44
Chris@0 45 PropertyBox::PropertyBox(PropertyContainer *container) :
Chris@0 46 m_container(container)
Chris@0 47 {
Chris@0 48 #ifdef DEBUG_PROPERTY_BOX
Chris@0 49 std::cerr << "PropertyBox[" << this << "(\"" <<
Chris@0 50 container->getPropertyContainerName().toStdString() << "\")]::PropertyBox" << std::endl;
Chris@0 51 #endif
Chris@0 52
Chris@34 53 m_mainBox = new QVBoxLayout;
Chris@34 54 setLayout(m_mainBox);
Chris@33 55
Chris@34 56 m_mainWidget = new QWidget;
Chris@34 57 m_mainBox->addWidget(m_mainWidget);
Chris@34 58 m_mainBox->insertStretch(1, 10);
Chris@33 59
Chris@34 60 m_viewPlayFrame = 0;
Chris@34 61 populateViewPlayFrame();
Chris@33 62
Chris@0 63 m_layout = new QGridLayout;
Chris@34 64 m_layout->setMargin(0);
Chris@33 65 m_mainWidget->setLayout(m_layout);
Chris@0 66
Chris@34 67 PropertyContainer::PropertyList properties = m_container->getProperties();
Chris@0 68
Chris@0 69 blockSignals(true);
Chris@0 70
Chris@0 71 size_t i;
Chris@0 72
Chris@0 73 for (i = 0; i < properties.size(); ++i) {
Chris@0 74 updatePropertyEditor(properties[i]);
Chris@0 75 }
Chris@0 76
Chris@0 77 blockSignals(false);
Chris@0 78
Chris@0 79 m_layout->setRowStretch(m_layout->rowCount(), 10);
Chris@0 80
Chris@0 81 #ifdef DEBUG_PROPERTY_BOX
Chris@0 82 std::cerr << "PropertyBox[" << this << "]::PropertyBox returning" << std::endl;
Chris@0 83 #endif
Chris@0 84 }
Chris@0 85
Chris@0 86 PropertyBox::~PropertyBox()
Chris@0 87 {
Chris@0 88 #ifdef DEBUG_PROPERTY_BOX
Chris@33 89 std::cerr << "PropertyBox[" << this << "]::~PropertyBox" << std::endl;
Chris@0 90 #endif
Chris@0 91 }
Chris@0 92
Chris@0 93 void
Chris@34 94 PropertyBox::populateViewPlayFrame()
Chris@33 95 {
Chris@36 96 #ifdef DEBUG_PROPERTY_BOX
Chris@34 97 std::cerr << "PropertyBox(" << m_container << ")::populateViewPlayFrame" << std::endl;
Chris@36 98 #endif
Chris@34 99
Chris@34 100 if (m_viewPlayFrame) {
Chris@34 101 delete m_viewPlayFrame;
Chris@34 102 m_viewPlayFrame = 0;
Chris@34 103 }
Chris@34 104
Chris@34 105 if (!m_container) return;
Chris@34 106
Chris@34 107 Layer *layer = dynamic_cast<Layer *>(m_container);
Chris@34 108 if (layer) {
Chris@34 109 connect(layer, SIGNAL(modelReplaced()),
Chris@34 110 this, SLOT(populateViewPlayFrame()));
Chris@34 111 }
Chris@34 112
Chris@34 113 PlayParameters *params = m_container->getPlayParameters();
Chris@33 114 if (!params && !layer) return;
Chris@33 115
Chris@34 116 m_viewPlayFrame = new QFrame;
Chris@34 117 m_viewPlayFrame->setFrameStyle(QFrame::StyledPanel | QFrame::Sunken);
Chris@34 118 m_mainBox->addWidget(m_viewPlayFrame);
Chris@34 119
Chris@34 120 QHBoxLayout *layout = new QHBoxLayout;
Chris@34 121 m_viewPlayFrame->setLayout(layout);
Chris@34 122
Chris@34 123 layout->setMargin(layout->margin() / 2);
Chris@34 124
Chris@36 125 #ifdef DEBUG_PROPERTY_BOX
Chris@34 126 std::cerr << "PropertyBox::populateViewPlayFrame: container " << m_container << " (name " << m_container->getPropertyContainerName().toStdString() << ") params " << params << std::endl;
Chris@36 127 #endif
Chris@36 128
Chris@33 129 if (layer) {
Chris@34 130 QLabel *showLabel = new QLabel(tr("Show"));
Chris@34 131 layout->addWidget(showLabel);
Chris@34 132 layout->setAlignment(showLabel, Qt::AlignVCenter);
Chris@34 133
Chris@33 134 LEDButton *showButton = new LEDButton(Qt::blue);
Chris@33 135 layout->addWidget(showButton);
Chris@47 136 connect(showButton, SIGNAL(stateChanged(bool)),
Chris@47 137 this, SIGNAL(showLayer(bool)));
Chris@34 138 layout->setAlignment(showButton, Qt::AlignVCenter);
Chris@33 139 }
Chris@33 140
Chris@33 141 if (params) {
Chris@34 142
Chris@34 143 QLabel *playLabel = new QLabel(tr("Play"));
Chris@34 144 layout->addWidget(playLabel);
Chris@34 145 layout->setAlignment(playLabel, Qt::AlignVCenter);
Chris@34 146
Chris@33 147 LEDButton *playButton = new LEDButton(Qt::darkGreen);
Chris@33 148 layout->addWidget(playButton);
Chris@33 149 connect(playButton, SIGNAL(stateChanged(bool)),
Chris@33 150 params, SLOT(setPlayAudible(bool)));
Chris@34 151 connect(params, SIGNAL(playAudibleChanged(bool)),
Chris@34 152 playButton, SLOT(setState(bool)));
Chris@34 153 layout->setAlignment(playButton, Qt::AlignVCenter);
Chris@34 154
Chris@34 155 layout->insertStretch(-1, 10);
Chris@34 156
Chris@63 157 if (params->getPlayPluginId() != "") {
Chris@64 158 QPushButton *pluginButton = new QPushButton(QIcon(":icons/faders.png"), "");
Chris@64 159 pluginButton->setFixedWidth(24);
Chris@64 160 pluginButton->setFixedHeight(24);
Chris@63 161 layout->addWidget(pluginButton);
Chris@63 162 connect(pluginButton, SIGNAL(clicked()),
Chris@63 163 this, SLOT(editPlugin()));
Chris@63 164 }
Chris@63 165
Chris@34 166 AudioDial *gainDial = new AudioDial;
Chris@34 167 layout->addWidget(gainDial);
Chris@34 168 gainDial->setMeterColor(Qt::darkRed);
Chris@34 169 gainDial->setMinimum(-50);
Chris@34 170 gainDial->setMaximum(50);
Chris@34 171 gainDial->setPageStep(1);
Chris@34 172 gainDial->setFixedWidth(24);
Chris@34 173 gainDial->setFixedHeight(24);
Chris@34 174 gainDial->setNotchesVisible(false);
Chris@57 175 gainDial->setToolTip(tr("Playback Level"));
Chris@34 176 gainDial->setDefaultValue(0);
Chris@34 177 connect(gainDial, SIGNAL(valueChanged(int)),
Chris@34 178 this, SLOT(playGainDialChanged(int)));
Chris@34 179 connect(params, SIGNAL(playGainChanged(float)),
Chris@34 180 this, SLOT(playGainChanged(float)));
Chris@34 181 connect(this, SIGNAL(changePlayGain(float)),
Chris@34 182 params, SLOT(setPlayGain(float)));
Chris@34 183 connect(this, SIGNAL(changePlayGainDial(int)),
Chris@34 184 gainDial, SLOT(setValue(int)));
Chris@34 185 layout->setAlignment(gainDial, Qt::AlignVCenter);
Chris@34 186
Chris@34 187 AudioDial *panDial = new AudioDial;
Chris@34 188 layout->addWidget(panDial);
Chris@34 189 panDial->setMeterColor(Qt::darkGreen);
Chris@34 190 panDial->setMinimum(-50);
Chris@34 191 panDial->setMaximum(50);
Chris@34 192 panDial->setPageStep(1);
Chris@34 193 panDial->setFixedWidth(24);
Chris@34 194 panDial->setFixedHeight(24);
Chris@34 195 panDial->setNotchesVisible(false);
Chris@57 196 panDial->setToolTip(tr("Playback Pan / Balance"));
Chris@34 197 panDial->setDefaultValue(0);
Chris@34 198 connect(panDial, SIGNAL(valueChanged(int)),
Chris@34 199 this, SLOT(playPanDialChanged(int)));
Chris@34 200 connect(params, SIGNAL(playPanChanged(float)),
Chris@34 201 this, SLOT(playPanChanged(float)));
Chris@34 202 connect(this, SIGNAL(changePlayPan(float)),
Chris@34 203 params, SLOT(setPlayPan(float)));
Chris@34 204 connect(this, SIGNAL(changePlayPanDial(int)),
Chris@34 205 panDial, SLOT(setValue(int)));
Chris@34 206 layout->setAlignment(panDial, Qt::AlignVCenter);
Chris@34 207
Chris@34 208 } else {
Chris@34 209
Chris@34 210 layout->insertStretch(-1, 10);
Chris@33 211 }
Chris@33 212 }
Chris@33 213
Chris@33 214 void
Chris@0 215 PropertyBox::updatePropertyEditor(PropertyContainer::PropertyName name)
Chris@0 216 {
Chris@0 217 PropertyContainer::PropertyType type = m_container->getPropertyType(name);
Chris@0 218 int row = m_layout->rowCount();
Chris@0 219
Chris@0 220 int min = 0, max = 0, value = 0;
Chris@0 221 value = m_container->getPropertyRangeAndValue(name, &min, &max);
Chris@0 222
Chris@0 223 bool have = (m_propertyControllers.find(name) !=
Chris@0 224 m_propertyControllers.end());
Chris@0 225
Chris@0 226 QString groupName = m_container->getPropertyGroupName(name);
Chris@0 227
Chris@0 228 #ifdef DEBUG_PROPERTY_BOX
Chris@0 229 std::cerr << "PropertyBox[" << this
Chris@0 230 << "(\"" << m_container->getPropertyContainerName().toStdString()
Chris@0 231 << "\")]";
Chris@0 232 std::cerr << "::updatePropertyEditor(\"" << name.toStdString() << "\"):";
Chris@0 233 std::cerr << " value " << value << ", have " << have << ", group \""
Chris@0 234 << groupName.toStdString() << "\"" << std::endl;
Chris@0 235 #endif
Chris@0 236
Chris@0 237 bool inGroup = (groupName != QString());
Chris@0 238
Chris@0 239 if (!have) {
Chris@0 240 if (inGroup) {
Chris@0 241 if (m_groupLayouts.find(groupName) == m_groupLayouts.end()) {
Chris@0 242 #ifdef DEBUG_PROPERTY_BOX
Chris@0 243 std::cerr << "PropertyBox: adding label \"" << groupName.toStdString() << "\" and frame for group for \"" << name.toStdString() << "\"" << std::endl;
Chris@0 244 #endif
Chris@33 245 m_layout->addWidget(new QLabel(groupName, m_mainWidget), row, 0);
Chris@33 246 QFrame *frame = new QFrame(m_mainWidget);
Chris@0 247 m_layout->addWidget(frame, row, 1, 1, 2);
Chris@0 248 m_groupLayouts[groupName] = new QHBoxLayout;
Chris@0 249 m_groupLayouts[groupName]->setMargin(0);
Chris@0 250 frame->setLayout(m_groupLayouts[groupName]);
Chris@0 251 }
Chris@0 252 } else {
Chris@0 253 #ifdef DEBUG_PROPERTY_BOX
Chris@0 254 std::cerr << "PropertyBox: adding label \"" << name.toStdString() << "\"" << std::endl;
Chris@0 255 #endif
Chris@33 256 m_layout->addWidget(new QLabel(name, m_mainWidget), row, 0);
Chris@0 257 }
Chris@0 258 }
Chris@0 259
Chris@0 260 switch (type) {
Chris@0 261
Chris@0 262 case PropertyContainer::ToggleProperty:
Chris@0 263 {
Chris@0 264 QCheckBox *cb;
Chris@0 265
Chris@0 266 if (have) {
Chris@0 267 cb = dynamic_cast<QCheckBox *>(m_propertyControllers[name]);
Chris@0 268 assert(cb);
Chris@0 269 } else {
Chris@0 270 #ifdef DEBUG_PROPERTY_BOX
Chris@0 271 std::cerr << "PropertyBox: creating new checkbox" << std::endl;
Chris@0 272 #endif
Chris@0 273 cb = new QCheckBox();
Chris@0 274 cb->setObjectName(name);
Chris@0 275 connect(cb, SIGNAL(stateChanged(int)),
Chris@0 276 this, SLOT(propertyControllerChanged(int)));
Chris@0 277 if (inGroup) {
Chris@0 278 cb->setToolTip(name);
Chris@0 279 m_groupLayouts[groupName]->addWidget(cb);
Chris@0 280 } else {
Chris@0 281 m_layout->addWidget(cb, row, 1, 1, 2);
Chris@0 282 }
Chris@0 283 m_propertyControllers[name] = cb;
Chris@0 284 }
Chris@0 285
Chris@55 286 if (cb->isChecked() != (value > 0)) {
Chris@55 287 cb->blockSignals(true);
Chris@55 288 cb->setChecked(value > 0);
Chris@55 289 cb->blockSignals(false);
Chris@55 290 }
Chris@0 291 break;
Chris@0 292 }
Chris@0 293
Chris@0 294 case PropertyContainer::RangeProperty:
Chris@0 295 {
Chris@0 296 AudioDial *dial;
Chris@0 297
Chris@0 298 if (have) {
Chris@0 299 dial = dynamic_cast<AudioDial *>(m_propertyControllers[name]);
Chris@0 300 assert(dial);
Chris@0 301 } else {
Chris@0 302 #ifdef DEBUG_PROPERTY_BOX
Chris@0 303 std::cerr << "PropertyBox: creating new dial" << std::endl;
Chris@0 304 #endif
Chris@0 305 dial = new AudioDial();
Chris@0 306 dial->setObjectName(name);
Chris@0 307 dial->setMinimum(min);
Chris@0 308 dial->setMaximum(max);
Chris@0 309 dial->setPageStep(1);
Chris@34 310 dial->setNotchesVisible((max - min) <= 12);
Chris@34 311 dial->setDefaultValue(value);
Chris@0 312 connect(dial, SIGNAL(valueChanged(int)),
Chris@0 313 this, SLOT(propertyControllerChanged(int)));
Chris@0 314
Chris@0 315 if (inGroup) {
Chris@0 316 dial->setFixedWidth(24);
Chris@0 317 dial->setFixedHeight(24);
Chris@0 318 dial->setToolTip(name);
Chris@0 319 m_groupLayouts[groupName]->addWidget(dial);
Chris@0 320 } else {
Chris@0 321 dial->setFixedWidth(32);
Chris@0 322 dial->setFixedHeight(32);
Chris@0 323 m_layout->addWidget(dial, row, 1);
Chris@33 324 QLabel *label = new QLabel(m_mainWidget);
Chris@0 325 connect(dial, SIGNAL(valueChanged(int)),
Chris@0 326 label, SLOT(setNum(int)));
Chris@0 327 label->setNum(value);
Chris@0 328 m_layout->addWidget(label, row, 2);
Chris@0 329 }
Chris@0 330
Chris@0 331 m_propertyControllers[name] = dial;
Chris@0 332 }
Chris@0 333
Chris@55 334 if (dial->value() != value) {
Chris@55 335 dial->blockSignals(true);
Chris@55 336 dial->setValue(value);
Chris@55 337 dial->blockSignals(false);
Chris@55 338 }
Chris@0 339 break;
Chris@0 340 }
Chris@0 341
Chris@0 342 case PropertyContainer::ValueProperty:
Chris@0 343 {
Chris@0 344 QComboBox *cb;
Chris@0 345
Chris@0 346 if (have) {
Chris@0 347 cb = dynamic_cast<QComboBox *>(m_propertyControllers[name]);
Chris@0 348 assert(cb);
Chris@0 349 } else {
Chris@0 350 #ifdef DEBUG_PROPERTY_BOX
Chris@0 351 std::cerr << "PropertyBox: creating new combobox" << std::endl;
Chris@0 352 #endif
Chris@0 353
Chris@0 354 cb = new QComboBox();
Chris@0 355 cb->setObjectName(name);
Chris@0 356 for (int i = min; i <= max; ++i) {
Chris@0 357 cb->addItem(m_container->getPropertyValueLabel(name, i));
Chris@0 358 }
Chris@0 359 connect(cb, SIGNAL(activated(int)),
Chris@0 360 this, SLOT(propertyControllerChanged(int)));
Chris@0 361 if (inGroup) {
Chris@0 362 cb->setToolTip(name);
Chris@0 363 m_groupLayouts[groupName]->addWidget(cb);
Chris@0 364 } else {
Chris@0 365 m_layout->addWidget(cb, row, 1, 1, 2);
Chris@0 366 }
Chris@0 367 m_propertyControllers[name] = cb;
Chris@0 368 }
Chris@0 369
Chris@55 370 if (cb->currentIndex() != value) {
Chris@55 371 cb->blockSignals(true);
Chris@55 372 cb->setCurrentIndex(value);
Chris@55 373 cb->blockSignals(false);
Chris@55 374 }
Chris@0 375
Chris@0 376 #ifdef Q_WS_MAC
Chris@0 377 // Crashes on startup without this, for some reason
Chris@0 378 cb->setMinimumSize(QSize(10, 10));
Chris@0 379 #endif
Chris@0 380
Chris@0 381 break;
Chris@0 382 }
Chris@0 383
Chris@0 384 default:
Chris@0 385 break;
Chris@0 386 }
Chris@0 387 }
Chris@0 388
Chris@0 389 void
Chris@0 390 PropertyBox::propertyContainerPropertyChanged(PropertyContainer *pc)
Chris@0 391 {
Chris@0 392 if (pc != m_container) return;
Chris@0 393
Chris@55 394 #ifdef DEBUG_PROPERTY_BOX
Chris@55 395 std::cerr << "PropertyBox::propertyContainerPropertyChanged" << std::endl;
Chris@55 396 #endif
Chris@55 397
Chris@0 398 PropertyContainer::PropertyList properties = m_container->getProperties();
Chris@0 399 size_t i;
Chris@0 400
Chris@0 401 blockSignals(true);
Chris@0 402
Chris@0 403 for (i = 0; i < properties.size(); ++i) {
Chris@0 404 updatePropertyEditor(properties[i]);
Chris@0 405 }
Chris@0 406
Chris@0 407 blockSignals(false);
Chris@0 408 }
Chris@0 409
Chris@0 410 void
Chris@0 411 PropertyBox::propertyControllerChanged(int value)
Chris@0 412 {
Chris@0 413 QObject *obj = sender();
Chris@0 414 QString name = obj->objectName();
Chris@0 415
Chris@34 416 #ifdef DEBUG_PROPERTY_BOX
Chris@33 417 std::cerr << "PropertyBox::propertyControllerChanged(" << name.toStdString()
Chris@33 418 << ", " << value << ")" << std::endl;
Chris@34 419 #endif
Chris@0 420
Chris@0 421 PropertyContainer::PropertyType type = m_container->getPropertyType(name);
Chris@0 422
Chris@0 423 if (type != PropertyContainer::InvalidProperty) {
Chris@55 424 m_container->setPropertyWithCommand(name, value);
Chris@0 425 }
Chris@0 426
Chris@0 427 if (type == PropertyContainer::RangeProperty) {
Chris@0 428 AudioDial *dial = dynamic_cast<AudioDial *>(m_propertyControllers[name]);
Chris@0 429 if (dial) {
Chris@0 430 dial->setToolTip(QString("%1: %2").arg(name).arg(value));
Chris@0 431 //!!! unfortunately this doesn't update an already-visible tooltip
Chris@0 432 }
Chris@0 433 }
Chris@0 434 }
Chris@0 435
Chris@34 436 void
Chris@34 437 PropertyBox::playGainChanged(float gain)
Chris@34 438 {
Chris@34 439 int dialValue = lrint(log10(gain) * 20.0);
Chris@34 440 if (dialValue < -50) dialValue = -50;
Chris@34 441 if (dialValue > 50) dialValue = 50;
Chris@34 442 emit changePlayGainDial(dialValue);
Chris@34 443 }
Chris@34 444
Chris@34 445 void
Chris@34 446 PropertyBox::playGainDialChanged(int dialValue)
Chris@34 447 {
Chris@34 448 float gain = pow(10, float(dialValue) / 20.0);
Chris@34 449 emit changePlayGain(gain);
Chris@34 450 }
Chris@34 451
Chris@34 452 void
Chris@34 453 PropertyBox::playPanChanged(float pan)
Chris@34 454 {
Chris@34 455 int dialValue = lrint(pan * 50.0);
Chris@34 456 if (dialValue < -50) dialValue = -50;
Chris@34 457 if (dialValue > 50) dialValue = 50;
Chris@34 458 emit changePlayPanDial(dialValue);
Chris@34 459 }
Chris@34 460
Chris@34 461 void
Chris@34 462 PropertyBox::playPanDialChanged(int dialValue)
Chris@34 463 {
Chris@34 464 float pan = float(dialValue) / 50.0;
Chris@34 465 if (pan < -1.0) pan = -1.0;
Chris@34 466 if (pan > 1.0) pan = 1.0;
Chris@34 467 emit changePlayPan(pan);
Chris@34 468 }
Chris@0 469
Chris@63 470 void
Chris@63 471 PropertyBox::editPlugin()
Chris@63 472 {
Chris@63 473 //!!! should probably just emit and let something else do this
Chris@63 474
Chris@63 475 PlayParameters *params = m_container->getPlayParameters();
Chris@63 476 if (!params) return;
Chris@63 477
Chris@63 478 QString pluginId = params->getPlayPluginId();
Chris@63 479 QString configurationXml = params->getPlayPluginConfiguration();
Chris@63 480
Chris@63 481 RealTimePluginFactory *factory =
Chris@63 482 RealTimePluginFactory::instanceFor(pluginId);
Chris@63 483 if (!factory) return;
Chris@63 484
Chris@63 485 RealTimePluginInstance *instance =
Chris@63 486 factory->instantiatePlugin(pluginId, 0, 0, 48000, 1024, 1);
Chris@63 487 if (!instance) return;
Chris@63 488
Chris@71 489 PluginXml(instance).setParametersFromXml(configurationXml);
Chris@63 490
Chris@69 491 PluginParameterDialog *dialog = new PluginParameterDialog(instance, -1, -1, -1);
Chris@64 492 connect(dialog, SIGNAL(pluginConfigurationChanged(QString)),
Chris@64 493 this, SLOT(pluginConfigurationChanged(QString)));
Chris@64 494
Chris@63 495 if (dialog->exec() == QDialog::Accepted) {
Chris@71 496 params->setPlayPluginConfiguration(PluginXml(instance).toXmlString());
Chris@64 497 } else {
Chris@64 498 // restore in case we mucked about with the configuration
Chris@64 499 // as a consequence of signals from the dialog
Chris@64 500 params->setPlayPluginConfiguration(configurationXml);
Chris@63 501 }
Chris@63 502
Chris@63 503 delete dialog;
Chris@63 504 delete instance;
Chris@63 505 }
Chris@63 506
Chris@64 507 void
Chris@64 508 PropertyBox::pluginConfigurationChanged(QString configurationXml)
Chris@64 509 {
Chris@64 510 PlayParameters *params = m_container->getPlayParameters();
Chris@64 511 if (!params) return;
Chris@64 512
Chris@64 513 params->setPlayPluginConfiguration(configurationXml);
Chris@64 514 }
Chris@64 515
Chris@64 516
Chris@64 517
Chris@0 518 #ifdef INCLUDE_MOCFILES
Chris@0 519 #include "PropertyBox.moc.cpp"
Chris@0 520 #endif
Chris@0 521