annotate widgets/PluginParameterDialog.cpp @ 293:15b8a4bfe855

* continue to pick "new" colours for coloured layers even when all colours have been used at least once, rather than sticking on the last one * some messing about with application palette settings * when replacing an audio file, retain the previous playback settings for any layers that depended on the old file * re-check plugin program setting when a parameter changes -- so a plugin can decide to reset the program if the parameters no longer match those for the current program * fix failure to update check-boxes for toggled plugin parameters when their parameters are changed by program changes
author Chris Cannam
date Thu, 09 Aug 2007 14:40:03 +0000
parents 4edaff85875d
children 919740b20cc9
rev   line source
Chris@62 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@62 2
Chris@62 3 /*
Chris@62 4 Sonic Visualiser
Chris@62 5 An audio file viewer and annotation editor.
Chris@62 6 Centre for Digital Music, Queen Mary, University of London.
Chris@182 7 This file copyright 2006 Chris Cannam and QMUL.
Chris@62 8
Chris@62 9 This program is free software; you can redistribute it and/or
Chris@62 10 modify it under the terms of the GNU General Public License as
Chris@62 11 published by the Free Software Foundation; either version 2 of the
Chris@62 12 License, or (at your option) any later version. See the file
Chris@62 13 COPYING included with this distribution for more information.
Chris@62 14 */
Chris@62 15
Chris@62 16 #include "PluginParameterDialog.h"
Chris@62 17
Chris@62 18 #include "PluginParameterBox.h"
Chris@140 19 #include "WindowTypeSelector.h"
Chris@62 20
Chris@106 21 #include "vamp-sdk/Plugin.h"
Chris@147 22 #include "vamp-sdk/PluginHostAdapter.h"
Chris@106 23
Chris@62 24 #include <QGridLayout>
Chris@62 25 #include <QLabel>
Chris@62 26 #include <QGroupBox>
Chris@62 27 #include <QHBoxLayout>
Chris@143 28 #include <QVBoxLayout>
Chris@149 29 #include <QScrollArea>
Chris@62 30 #include <QPushButton>
Chris@69 31 #include <QMessageBox>
Chris@69 32 #include <QComboBox>
Chris@143 33 #include <QSettings>
Chris@282 34 #include <QDialogButtonBox>
Chris@62 35
Chris@71 36 PluginParameterDialog::PluginParameterDialog(Vamp::PluginBase *plugin,
Chris@62 37 QWidget *parent) :
Chris@62 38 QDialog(parent),
Chris@62 39 m_plugin(plugin),
Chris@163 40 m_channel(-1),
Chris@145 41 m_stepSize(0),
Chris@145 42 m_blockSize(0),
Chris@145 43 m_windowType(HanningWindow),
Chris@62 44 m_parameterBox(0)
Chris@62 45 {
Chris@122 46 setWindowTitle(tr("Plugin Parameters"));
Chris@122 47
Chris@62 48 QGridLayout *grid = new QGridLayout;
Chris@62 49 setLayout(grid);
Chris@62 50
Chris@62 51 QGroupBox *pluginBox = new QGroupBox;
Chris@208 52 pluginBox->setTitle(plugin->getType().c_str());
Chris@62 53 grid->addWidget(pluginBox, 0, 0);
Chris@62 54
Chris@62 55 QGridLayout *subgrid = new QGridLayout;
Chris@62 56 pluginBox->setLayout(subgrid);
Chris@62 57
Chris@63 58 subgrid->setSpacing(0);
Chris@63 59 subgrid->setMargin(10);
Chris@63 60
Chris@208 61 QFont boldFont(pluginBox->font());
Chris@208 62 boldFont.setBold(true);
Chris@208 63
Chris@208 64 QFont italicFont(pluginBox->font());
Chris@208 65 italicFont.setItalic(true);
Chris@62 66
Chris@207 67 QLabel *nameLabel = new QLabel(plugin->getName().c_str());
Chris@146 68 nameLabel->setWordWrap(true);
Chris@208 69 nameLabel->setFont(boldFont);
Chris@62 70
Chris@62 71 QLabel *makerLabel = new QLabel(plugin->getMaker().c_str());
Chris@146 72 makerLabel->setWordWrap(true);
Chris@62 73
Chris@62 74 QLabel *versionLabel = new QLabel(QString("%1")
Chris@62 75 .arg(plugin->getPluginVersion()));
Chris@146 76 versionLabel->setWordWrap(true);
Chris@62 77
Chris@62 78 QLabel *copyrightLabel = new QLabel(plugin->getCopyright().c_str());
Chris@146 79 copyrightLabel->setWordWrap(true);
Chris@62 80
Chris@208 81 // QLabel *typeLabel = new QLabel(plugin->getType().c_str());
Chris@208 82 // typeLabel->setWordWrap(true);
Chris@208 83 // typeLabel->setFont(boldFont);
Chris@208 84
Chris@208 85 QLabel *descriptionLabel = 0;
Chris@208 86 if (plugin->getDescription() != "") {
Chris@208 87 descriptionLabel = new QLabel(plugin->getDescription().c_str());
Chris@208 88 descriptionLabel->setWordWrap(true);
Chris@208 89 descriptionLabel->setFont(italicFont);
Chris@208 90 }
Chris@63 91
Chris@163 92 int row = 0;
Chris@163 93
Chris@147 94 QLabel *label = new QLabel(tr("Name:"));
Chris@147 95 label->setAlignment(Qt::AlignTop | Qt::AlignLeft);
Chris@163 96 subgrid->addWidget(label, row, 0);
Chris@163 97 subgrid->addWidget(nameLabel, row, 1);
Chris@163 98 row++;
Chris@62 99
Chris@208 100 if (descriptionLabel) {
Chris@208 101 // label = new QLabel(tr("Description:"));
Chris@208 102 // label->setAlignment(Qt::AlignTop | Qt::AlignLeft);
Chris@208 103 // subgrid->addWidget(label, row, 0);
Chris@208 104 subgrid->addWidget(descriptionLabel, row, 1);
Chris@208 105 row++;
Chris@208 106 }
Chris@208 107
Chris@208 108 Vamp::PluginHostAdapter *fePlugin =
Chris@208 109 dynamic_cast<Vamp::PluginHostAdapter *>(m_plugin);
Chris@208 110
Chris@208 111 if (fePlugin) {
Chris@208 112 label = new QLabel(tr("Version:"));
Chris@208 113 label->setAlignment(Qt::AlignTop | Qt::AlignLeft);
Chris@208 114 subgrid->addWidget(label, row, 0);
Chris@208 115 subgrid->addWidget(versionLabel, row, 1);
Chris@208 116 row++;
Chris@208 117 }
Chris@208 118
Chris@208 119 // label = new QLabel(tr("Type:"));
Chris@208 120 // label->setAlignment(Qt::AlignTop | Qt::AlignLeft);
Chris@208 121 // subgrid->addWidget(label, row, 0);
Chris@208 122 // subgrid->addWidget(typeLabel, row, 1);
Chris@208 123 // row++;
Chris@62 124
Chris@147 125 label = new QLabel(tr("Maker:"));
Chris@147 126 label->setAlignment(Qt::AlignTop | Qt::AlignLeft);
Chris@163 127 subgrid->addWidget(label, row, 0);
Chris@163 128 subgrid->addWidget(makerLabel, row, 1);
Chris@163 129 row++;
Chris@63 130
Chris@147 131 label = new QLabel(tr("Copyright: "));
Chris@147 132 label->setAlignment(Qt::AlignTop | Qt::AlignLeft);
Chris@163 133 subgrid->addWidget(label, row, 0);
Chris@163 134 subgrid->addWidget(copyrightLabel, row, 1);
Chris@163 135 row++;
Chris@208 136
Chris@208 137 m_outputSpacer = new QLabel;
Chris@208 138 subgrid->addWidget(m_outputSpacer, row, 0);
Chris@208 139 m_outputSpacer->setFixedHeight(7);
Chris@208 140 m_outputSpacer->hide();
Chris@208 141 row++;
Chris@106 142
Chris@208 143 m_outputLabel = new QLabel(tr("Output:"));
Chris@208 144 m_outputLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft);
Chris@208 145 subgrid->addWidget(m_outputLabel, row, 0);
Chris@208 146 m_outputValue = new QLabel;
Chris@208 147 m_outputValue->setFont(boldFont);
Chris@208 148 subgrid->addWidget(m_outputValue, row, 1);
Chris@208 149 m_outputLabel->hide();
Chris@208 150 m_outputValue->hide();
Chris@208 151 row++;
Chris@208 152
Chris@208 153 m_outputDescription = new QLabel;
Chris@208 154 m_outputDescription->setFont(italicFont);
Chris@208 155 subgrid->addWidget(m_outputDescription, row, 1);
Chris@208 156 m_outputDescription->hide();
Chris@163 157 row++;
Chris@62 158
Chris@62 159 subgrid->setColumnStretch(1, 2);
Chris@62 160
Chris@164 161 m_inputModelBox = new QGroupBox;
Chris@164 162 m_inputModelBox->setTitle(tr("Input Source"));
Chris@164 163 grid->addWidget(m_inputModelBox, 1, 0);
Chris@164 164
Chris@164 165 m_inputModels = new QComboBox;
Chris@164 166 QHBoxLayout *inputLayout = new QHBoxLayout;
Chris@164 167 m_inputModelBox->setLayout(inputLayout);
Chris@164 168 inputLayout->addWidget(m_inputModels);
Chris@164 169 m_inputModelBox->hide();
Chris@164 170
Chris@62 171 QGroupBox *paramBox = new QGroupBox;
Chris@62 172 paramBox->setTitle(tr("Plugin Parameters"));
Chris@164 173 grid->addWidget(paramBox, 2, 0);
Chris@164 174 grid->setRowStretch(2, 10);
Chris@62 175
Chris@62 176 QHBoxLayout *paramLayout = new QHBoxLayout;
Chris@63 177 paramLayout->setMargin(0);
Chris@62 178 paramBox->setLayout(paramLayout);
Chris@62 179
Chris@149 180 QScrollArea *scroll = new QScrollArea;
Chris@149 181 scroll->setWidgetResizable(true);
Chris@149 182 scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
Chris@149 183 scroll->setFrameShape(QFrame::NoFrame);
Chris@149 184 paramLayout->addWidget(scroll);
Chris@149 185
Chris@62 186 m_parameterBox = new PluginParameterBox(m_plugin);
Chris@64 187 connect(m_parameterBox, SIGNAL(pluginConfigurationChanged(QString)),
Chris@64 188 this, SIGNAL(pluginConfigurationChanged(QString)));
Chris@149 189 scroll->setWidget(m_parameterBox);
Chris@62 190
Chris@143 191 m_advanced = new QFrame;
Chris@143 192 QVBoxLayout *advancedLayout = new QVBoxLayout;
Chris@143 193 advancedLayout->setMargin(0);
Chris@143 194 m_advanced->setLayout(advancedLayout);
Chris@164 195 grid->addWidget(m_advanced, 3, 0);
Chris@143 196
Chris@163 197 m_channelBox = new QGroupBox;
Chris@163 198 m_channelBox->setTitle(tr("Channels"));
Chris@163 199 advancedLayout->addWidget(m_channelBox);
Chris@163 200 m_channelBox->setVisible(false);
Chris@163 201 m_haveChannelBoxData = false;
Chris@163 202
Chris@163 203 m_windowBox = new QGroupBox;
Chris@163 204 m_windowBox->setTitle(tr("Processing"));
Chris@163 205 advancedLayout->addWidget(m_windowBox);
Chris@163 206 m_windowBox->setVisible(false);
Chris@163 207 m_haveWindowBoxData = false;
Chris@163 208
Chris@163 209 QHBoxLayout *hbox = new QHBoxLayout;
Chris@163 210 grid->addLayout(hbox, 4, 0);
Chris@163 211
Chris@163 212 m_advancedVisible = false;
Chris@163 213
Chris@163 214 m_advancedButton = new QPushButton(tr("Advanced >>"));
Chris@163 215 m_advancedButton->setCheckable(true);
Chris@163 216 connect(m_advancedButton, SIGNAL(clicked()), this, SLOT(advancedToggled()));
Chris@163 217
Chris@163 218 QSettings settings;
Chris@163 219 settings.beginGroup("PluginParameterDialog");
Chris@163 220 m_advancedVisible = settings.value("advancedvisible", false).toBool();
Chris@163 221 settings.endGroup();
Chris@163 222
Chris@163 223 m_advanced->setVisible(false);
Chris@163 224
Chris@163 225 hbox->addWidget(m_advancedButton);
Chris@163 226 m_advancedButton->hide();
Chris@163 227
Chris@282 228 QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Ok |
Chris@282 229 QDialogButtonBox::Cancel);
Chris@282 230 hbox->addWidget(bb);
Chris@282 231 connect(bb, SIGNAL(accepted()), this, SLOT(accept()));
Chris@282 232 connect(bb, SIGNAL(rejected()), this, SLOT(reject()));
Chris@163 233
Chris@163 234 setAdvancedVisible(m_advancedVisible);
Chris@163 235 }
Chris@163 236
Chris@163 237 PluginParameterDialog::~PluginParameterDialog()
Chris@163 238 {
Chris@163 239 }
Chris@163 240
Chris@163 241
Chris@163 242 void
Chris@208 243 PluginParameterDialog::setOutputLabel(QString text,
Chris@208 244 QString description)
Chris@163 245 {
Chris@163 246 if (text == "") {
Chris@208 247 m_outputSpacer->hide();
Chris@163 248 m_outputLabel->hide();
Chris@163 249 m_outputValue->hide();
Chris@208 250 m_outputDescription->hide();
Chris@163 251 } else {
Chris@208 252 m_outputSpacer->show();
Chris@163 253 m_outputValue->setText(text);
Chris@163 254 m_outputValue->setWordWrap(true);
Chris@208 255 m_outputDescription->setText(description);
Chris@163 256 m_outputLabel->show();
Chris@163 257 m_outputValue->show();
Chris@208 258 if (description != "") {
Chris@208 259 m_outputDescription->show();
Chris@208 260 } else {
Chris@208 261 m_outputDescription->hide();
Chris@208 262 }
Chris@163 263 }
Chris@163 264 }
Chris@163 265
Chris@163 266 void
Chris@163 267 PluginParameterDialog::setChannelArrangement(int sourceChannels,
Chris@163 268 int targetChannels,
Chris@163 269 int defaultChannel)
Chris@163 270 {
Chris@163 271 m_channel = defaultChannel;
Chris@163 272
Chris@69 273 if (sourceChannels != targetChannels) {
Chris@69 274
Chris@69 275 // At the moment we can only cope with the case where
Chris@69 276 // sourceChannels > targetChannels and targetChannels == 1
Chris@69 277
Chris@69 278 if (sourceChannels < targetChannels) {
Chris@69 279
Chris@69 280 QMessageBox::warning
Chris@163 281 (parentWidget(),
Chris@69 282 tr("Channel mismatch"),
Chris@69 283 tr("This plugin requires at least %1 input channels, but only %2 %3 available. The plugin probably will not work correctly.").arg(targetChannels).arg(sourceChannels).arg(sourceChannels != 1 ? tr("are") : tr("is")),
Chris@69 284 QMessageBox::Ok,
Chris@69 285 QMessageBox::NoButton);
Chris@69 286
Chris@69 287 } else {
Chris@69 288
Chris@163 289 if (m_haveChannelBoxData) {
Chris@163 290 std::cerr << "WARNING: PluginParameterDialog::setChannelArrangement: Calling more than once on same dialog is not currently implemented" << std::endl;
Chris@163 291 return;
Chris@163 292 }
Chris@69 293
Chris@69 294 QVBoxLayout *channelLayout = new QVBoxLayout;
Chris@163 295 m_channelBox->setLayout(channelLayout);
Chris@69 296
Chris@69 297 if (targetChannels != 1) {
Chris@69 298
Chris@69 299 channelLayout->addWidget
Chris@69 300 (new QLabel(tr("This plugin accepts no more than %1 input channels,\nbut %2 are available. Only the first %3 will be used.\n")
Chris@69 301 .arg(targetChannels)
Chris@69 302 .arg(sourceChannels)
Chris@69 303 .arg(targetChannels)));
Chris@69 304
Chris@69 305 } else {
Chris@69 306
Chris@69 307 channelLayout->addWidget(new QLabel(tr("This plugin only has a single channel input,\nbut the source has %1 channels.").arg(sourceChannels)));
Chris@69 308
Chris@69 309 QComboBox *channelCombo = new QComboBox;
Chris@76 310 channelCombo->addItem(tr("Use mean of source channels"));
Chris@69 311 for (int i = 0; i < sourceChannels; ++i) {
Chris@69 312 channelCombo->addItem(tr("Use channel %1 only").arg(i + 1));
Chris@69 313 }
Chris@69 314
Chris@69 315 connect(channelCombo, SIGNAL(activated(int)),
Chris@69 316 this, SLOT(channelComboChanged(int)));
Chris@69 317
Chris@69 318 channelLayout->addWidget(channelCombo);
Chris@69 319 }
Chris@163 320
Chris@163 321 m_channelBox->setVisible(true);
Chris@163 322 m_haveChannelBoxData = true;
Chris@163 323 m_advancedButton->show();
Chris@69 324 }
Chris@69 325 }
Chris@69 326
Chris@163 327 setAdvancedVisible(m_advancedVisible);
Chris@163 328 }
Chris@163 329
Chris@163 330 void
Chris@163 331 PluginParameterDialog::setShowProcessingOptions(bool showWindowSize,
Chris@163 332 bool showFrequencyDomainOptions)
Chris@163 333 {
Chris@163 334 if (m_haveWindowBoxData) {
Chris@163 335 std::cerr << "WARNING: PluginParameterDialog::setShowProcessingOptions: Calling more than once on same dialog is not currently implemented" << std::endl;
Chris@163 336 return;
Chris@163 337 }
Chris@163 338
Chris@140 339 if (showWindowSize) {
Chris@140 340
Chris@147 341 Vamp::PluginHostAdapter *fePlugin = dynamic_cast<Vamp::PluginHostAdapter *>(m_plugin);
Chris@140 342 int size = 1024;
Chris@140 343 int increment = 1024;
Chris@140 344 if (fePlugin) {
Chris@140 345 size = fePlugin->getPreferredBlockSize();
Chris@207 346 std::cerr << "Feature extraction plugin \"" << fePlugin->getName() << "\" reports preferred block size as " << size << std::endl;
Chris@140 347 if (size == 0) size = 1024;
Chris@140 348 increment = fePlugin->getPreferredStepSize();
Chris@146 349 if (increment == 0) {
Chris@146 350 if (fePlugin->getInputDomain() == Vamp::Plugin::TimeDomain) {
Chris@146 351 increment = size;
Chris@146 352 } else {
Chris@146 353 increment = size/2;
Chris@146 354 }
Chris@146 355 }
Chris@140 356 }
Chris@140 357
Chris@140 358 QGridLayout *windowLayout = new QGridLayout;
Chris@163 359 m_windowBox->setLayout(windowLayout);
Chris@140 360
Chris@140 361 if (showFrequencyDomainOptions) {
Chris@140 362 windowLayout->addWidget(new QLabel(tr("Window size:")), 0, 0);
Chris@140 363 } else {
Chris@140 364 windowLayout->addWidget(new QLabel(tr("Audio frames per block:")), 0, 0);
Chris@140 365 }
Chris@140 366
Chris@143 367 std::cerr << "size: " << size << ", increment: " << increment << std::endl;
Chris@143 368
Chris@140 369 QComboBox *blockSizeCombo = new QComboBox;
Chris@140 370 blockSizeCombo->setEditable(true);
Chris@147 371 bool found = false;
Chris@143 372 for (int i = 0; i < 14; ++i) {
Chris@249 373 int val = 1 << (i + 3);
Chris@140 374 blockSizeCombo->addItem(QString("%1").arg(val));
Chris@147 375 if (val == size) {
Chris@147 376 blockSizeCombo->setCurrentIndex(i);
Chris@147 377 found = true;
Chris@147 378 }
Chris@147 379 }
Chris@147 380 if (!found) {
Chris@147 381 blockSizeCombo->addItem(QString("%1").arg(size));
Chris@147 382 blockSizeCombo->setCurrentIndex(blockSizeCombo->count() - 1);
Chris@140 383 }
Chris@282 384 blockSizeCombo->setValidator(new QIntValidator(1, int(pow(2, 18)), this));
Chris@155 385 connect(blockSizeCombo, SIGNAL(editTextChanged(const QString &)),
Chris@155 386 this, SLOT(blockSizeComboChanged(const QString &)));
Chris@140 387 windowLayout->addWidget(blockSizeCombo, 0, 1);
Chris@140 388
Chris@148 389 windowLayout->addWidget(new QLabel(tr("Window increment:")), 1, 0);
Chris@148 390
Chris@148 391 QComboBox *incrementCombo = new QComboBox;
Chris@148 392 incrementCombo->setEditable(true);
Chris@148 393 found = false;
Chris@148 394 for (int i = 0; i < 14; ++i) {
Chris@249 395 int val = 1 << (i + 3);
Chris@148 396 incrementCombo->addItem(QString("%1").arg(val));
Chris@148 397 if (val == increment) {
Chris@148 398 incrementCombo->setCurrentIndex(i);
Chris@148 399 found = true;
Chris@148 400 }
Chris@148 401 }
Chris@148 402 if (!found) {
Chris@148 403 incrementCombo->addItem(QString("%1").arg(increment));
Chris@148 404 incrementCombo->setCurrentIndex(incrementCombo->count() - 1);
Chris@148 405 }
Chris@282 406 incrementCombo->setValidator(new QIntValidator(1, int(pow(2, 18)), this));
Chris@155 407 connect(incrementCombo, SIGNAL(editTextChanged(const QString &)),
Chris@155 408 this, SLOT(incrementComboChanged(const QString &)));
Chris@148 409 windowLayout->addWidget(incrementCombo, 1, 1);
Chris@148 410
Chris@140 411 if (showFrequencyDomainOptions) {
Chris@140 412
Chris@140 413 windowLayout->addWidget(new QLabel(tr("Window shape:")), 2, 0);
Chris@140 414 WindowTypeSelector *windowTypeSelector = new WindowTypeSelector;
Chris@171 415 connect(windowTypeSelector, SIGNAL(windowTypeChanged(WindowType)),
Chris@171 416 this, SLOT(windowTypeChanged(WindowType)));
Chris@140 417 windowLayout->addWidget(windowTypeSelector, 2, 1);
Chris@140 418 }
Chris@163 419
Chris@163 420 m_windowBox->setVisible(true);
Chris@163 421 m_haveWindowBoxData = true;
Chris@163 422 m_advancedButton->show();
Chris@140 423 }
Chris@140 424
Chris@163 425 setAdvancedVisible(m_advancedVisible);
Chris@62 426 }
Chris@62 427
Chris@69 428 void
Chris@164 429 PluginParameterDialog::setCandidateInputModels(const QStringList &models)
Chris@164 430 {
Chris@164 431 m_inputModels->clear();
Chris@164 432 m_inputModels->insertItems(0, models);
Chris@164 433 connect(m_inputModels, SIGNAL(activated(const QString &)),
Chris@164 434 this, SIGNAL(inputModelChanged(QString)));
Chris@164 435 m_inputModelBox->show();
Chris@164 436 }
Chris@164 437
Chris@164 438 QString
Chris@164 439 PluginParameterDialog::getInputModel() const
Chris@164 440 {
Chris@164 441 return m_inputModels->currentText();
Chris@164 442 }
Chris@164 443
Chris@164 444 void
Chris@145 445 PluginParameterDialog::getProcessingParameters(size_t &blockSize) const
Chris@145 446 {
Chris@145 447 blockSize = m_blockSize;
Chris@145 448 return;
Chris@145 449 }
Chris@145 450
Chris@145 451 void
Chris@145 452 PluginParameterDialog::getProcessingParameters(size_t &stepSize,
Chris@145 453 size_t &blockSize,
Chris@145 454 WindowType &windowType) const
Chris@145 455 {
Chris@145 456 stepSize = m_stepSize;
Chris@145 457 blockSize = m_blockSize;
Chris@145 458 windowType = m_windowType;
Chris@146 459 return;
Chris@145 460 }
Chris@145 461
Chris@145 462 void
Chris@155 463 PluginParameterDialog::blockSizeComboChanged(const QString &text)
Chris@145 464 {
Chris@145 465 m_blockSize = text.toInt();
Chris@146 466 std::cerr << "Block size changed to " << m_blockSize << std::endl;
Chris@145 467 }
Chris@145 468
Chris@145 469 void
Chris@155 470 PluginParameterDialog::incrementComboChanged(const QString &text)
Chris@145 471 {
Chris@145 472 m_stepSize = text.toInt();
Chris@146 473 //!!! rename increment to step size throughout
Chris@147 474 std::cerr << "Increment changed to " << m_stepSize << std::endl;
Chris@145 475 }
Chris@145 476
Chris@145 477 void
Chris@145 478 PluginParameterDialog::windowTypeChanged(WindowType type)
Chris@145 479 {
Chris@145 480 m_windowType = type;
Chris@145 481 }
Chris@145 482
Chris@145 483 void
Chris@143 484 PluginParameterDialog::advancedToggled()
Chris@143 485 {
Chris@163 486 setAdvancedVisible(!m_advancedVisible);
Chris@163 487 }
Chris@143 488
Chris@163 489 void
Chris@163 490 PluginParameterDialog::setAdvancedVisible(bool visible)
Chris@163 491 {
Chris@143 492 m_advanced->setVisible(visible);
Chris@143 493
Chris@163 494 if (visible) {
Chris@163 495 m_advancedButton->setText(tr("Advanced <<"));
Chris@163 496 m_advancedButton->setChecked(true);
Chris@163 497 } else {
Chris@163 498 m_advancedButton->setText(tr("Advanced >>"));
Chris@163 499 m_advancedButton->setChecked(false);
Chris@163 500 }
Chris@143 501
Chris@143 502 QSettings settings;
Chris@143 503 settings.beginGroup("PluginParameterDialog");
Chris@143 504 settings.setValue("advancedvisible", visible);
Chris@143 505 settings.endGroup();
Chris@143 506
Chris@213 507 // std::cerr << "resize to " << sizeHint().width() << " x " << sizeHint().height() << std::endl;
Chris@143 508
Chris@149 509 setMinimumHeight(sizeHint().height());
Chris@163 510 adjustSize();
Chris@163 511
Chris@163 512 m_advancedVisible = visible;
Chris@163 513
Chris@163 514 // if (visible) setMaximumHeight(sizeHint().height());
Chris@163 515 // adjustSize();
Chris@143 516 }
Chris@143 517
Chris@143 518 void
Chris@69 519 PluginParameterDialog::channelComboChanged(int index)
Chris@69 520 {
Chris@69 521 m_channel = index - 1;
Chris@69 522 }
Chris@69 523