svgui  1.9
PluginParameterDialog.cpp
Go to the documentation of this file.
00001 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*-  vi:set ts=8 sts=4 sw=4: */
00002 
00003 /*
00004     Sonic Visualiser
00005     An audio file viewer and annotation editor.
00006     Centre for Digital Music, Queen Mary, University of London.
00007     This file copyright 2006 Chris Cannam and QMUL.
00008     
00009     This program is free software; you can redistribute it and/or
00010     modify it under the terms of the GNU General Public License as
00011     published by the Free Software Foundation; either version 2 of the
00012     License, or (at your option) any later version.  See the file
00013     COPYING included with this distribution for more information.
00014 */
00015 
00016 #include "PluginParameterDialog.h"
00017 
00018 #include "PluginParameterBox.h"
00019 #include "WindowTypeSelector.h"
00020 
00021 #include "TextAbbrev.h"
00022 #include "IconLoader.h"
00023 
00024 #include <vamp-hostsdk/Plugin.h>
00025 #include <vamp-hostsdk/PluginHostAdapter.h>
00026 #include <vamp-hostsdk/PluginWrapper.h>
00027 
00028 #include <QGridLayout>
00029 #include <QLabel>
00030 #include <QGroupBox>
00031 #include <QHBoxLayout>
00032 #include <QVBoxLayout>
00033 #include <QScrollArea>
00034 #include <QPushButton>
00035 #include <QMessageBox>
00036 #include <QComboBox>
00037 #include <QCheckBox>
00038 #include <QSettings>
00039 #include <QDialogButtonBox>
00040 #include <QDesktopServices>
00041 #include <QUrl>
00042 
00043 #include "base/Debug.h"
00044 
00045 PluginParameterDialog::PluginParameterDialog(Vamp::PluginBase *plugin,
00046                                              QWidget *parent) :
00047     QDialog(parent),
00048     m_plugin(plugin),
00049     m_channel(-1),
00050     m_stepSize(0),
00051     m_blockSize(0),
00052     m_windowType(HanningWindow),
00053     m_parameterBox(0),
00054     m_currentSelectionOnly(false)
00055 {
00056     setWindowTitle(tr("Plugin Parameters"));
00057 
00058     QGridLayout *grid = new QGridLayout;
00059     setLayout(grid);
00060 
00061     QGroupBox *pluginBox = new QGroupBox;
00062     pluginBox->setTitle(plugin->getType().c_str());
00063     grid->addWidget(pluginBox, 0, 0);
00064 
00065     QGridLayout *subgrid = new QGridLayout;
00066     pluginBox->setLayout(subgrid);
00067 
00068     subgrid->setSpacing(0);
00069     subgrid->setMargin(10);
00070 
00071     QFont boldFont(pluginBox->font());
00072     boldFont.setBold(true);
00073 
00074     QFont italicFont(pluginBox->font());
00075     italicFont.setItalic(true);
00076 
00077     QLabel *nameLabel = new QLabel(plugin->getName().c_str());
00078     nameLabel->setWordWrap(true);
00079     nameLabel->setFont(boldFont);
00080 
00081     QLabel *makerLabel = new QLabel(plugin->getMaker().c_str());
00082     makerLabel->setWordWrap(true);
00083 
00084     int version = plugin->getPluginVersion();
00085     QLabel *versionLabel = new QLabel(QString("%1").arg(version));
00086     versionLabel->setWordWrap(true);
00087 
00088     QLabel *copyrightLabel = new QLabel(plugin->getCopyright().c_str());
00089     copyrightLabel->setWordWrap(true);
00090 
00091 //    QLabel *typeLabel = new QLabel(plugin->getType().c_str());
00092 //    typeLabel->setWordWrap(true);
00093 //    typeLabel->setFont(boldFont);
00094 
00095     QLabel *descriptionLabel = 0;
00096     if (plugin->getDescription() != "") {
00097         descriptionLabel = new QLabel(plugin->getDescription().c_str());
00098         descriptionLabel->setWordWrap(true);
00099         descriptionLabel->setFont(italicFont);
00100     }
00101 
00102     int row = 0;
00103 
00104     QLabel *label = new QLabel(tr("Name:"));
00105     label->setAlignment(Qt::AlignTop | Qt::AlignLeft);
00106     subgrid->addWidget(label, row, 0);
00107     subgrid->addWidget(nameLabel, row, 1);
00108 
00109     m_moreInfo = new QPushButton;
00110     m_moreInfo->setIcon(IconLoader().load("info"));
00111     m_moreInfo->setFixedSize(QSize(16, 16));
00112     connect(m_moreInfo, SIGNAL(clicked()), this, SLOT(moreInfo()));
00113     subgrid->addWidget(m_moreInfo, row, 2, Qt::AlignTop | Qt::AlignRight);
00114     m_moreInfo->hide();
00115 
00116     row++;
00117 
00118     if (descriptionLabel) {
00119 //        label = new QLabel(tr("Description:"));
00120 //        label->setAlignment(Qt::AlignTop | Qt::AlignLeft);
00121 //        subgrid->addWidget(label, row, 0);
00122         subgrid->addWidget(descriptionLabel, row, 1, 1, 2);
00123         row++;
00124     }
00125 
00126     if (version >= 0) {
00127         label = new QLabel(tr("Version:"));
00128         label->setAlignment(Qt::AlignTop | Qt::AlignLeft);
00129         subgrid->addWidget(label, row, 0);
00130         subgrid->addWidget(versionLabel, row, 1);
00131         row++;
00132     }
00133 
00134 //    label = new QLabel(tr("Type:"));
00135 //    label->setAlignment(Qt::AlignTop | Qt::AlignLeft);
00136 //    subgrid->addWidget(label, row, 0);
00137 //    subgrid->addWidget(typeLabel, row, 1);
00138 //    row++;
00139 
00140     label = new QLabel(tr("Maker:"));
00141     label->setAlignment(Qt::AlignTop | Qt::AlignLeft);
00142     subgrid->addWidget(label, row, 0);
00143     subgrid->addWidget(makerLabel, row, 1);
00144     row++;
00145 
00146     label = new QLabel(tr("Copyright:  "));
00147     label->setAlignment(Qt::AlignTop | Qt::AlignLeft);
00148     subgrid->addWidget(label, row, 0);
00149     subgrid->addWidget(copyrightLabel, row, 1);
00150     row++;
00151     
00152     m_outputSpacer = new QLabel;
00153     subgrid->addWidget(m_outputSpacer, row, 0);
00154     m_outputSpacer->setFixedHeight(7);
00155     m_outputSpacer->hide();
00156     row++;
00157 
00158     m_outputLabel = new QLabel(tr("Output:"));
00159     m_outputLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft);
00160     subgrid->addWidget(m_outputLabel, row, 0);
00161     m_outputValue = new QLabel;
00162     m_outputValue->setFont(boldFont);
00163     subgrid->addWidget(m_outputValue, row, 1);
00164     m_outputLabel->hide();
00165     m_outputValue->hide();
00166     row++;
00167 
00168     m_outputDescription = new QLabel;
00169     m_outputDescription->setFont(italicFont);
00170     subgrid->addWidget(m_outputDescription, row, 1);
00171     m_outputDescription->hide();
00172     row++;
00173 
00174     subgrid->setColumnStretch(1, 2);
00175 
00176     m_inputModelBox = new QGroupBox;
00177     m_inputModelBox->setTitle(tr("Input Material"));
00178     grid->addWidget(m_inputModelBox, 1, 0);
00179     
00180     m_inputModels = new QComboBox;
00181     QVBoxLayout *inputLayout = new QVBoxLayout;
00182     m_inputModelBox->setLayout(inputLayout);
00183     inputLayout->addWidget(m_inputModels);
00184     m_inputModels->hide();
00185 
00186     m_selectionOnly = new QCheckBox(tr("Restrict to selection extents"));
00187     inputLayout->addWidget(m_selectionOnly);
00188     m_selectionOnly->hide();
00189 
00190     m_inputModelBox->hide();
00191 
00192     QGroupBox *paramBox = new QGroupBox;
00193     paramBox->setTitle(tr("Plugin Parameters"));
00194     grid->addWidget(paramBox, 2, 0);
00195     grid->setRowStretch(2, 10);
00196 
00197     QHBoxLayout *paramLayout = new QHBoxLayout;
00198     paramLayout->setMargin(0);
00199     paramBox->setLayout(paramLayout);
00200 
00201     QScrollArea *scroll = new QScrollArea;
00202     scroll->setWidgetResizable(true);
00203     scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
00204     scroll->setFrameShape(QFrame::NoFrame);
00205     paramLayout->addWidget(scroll);
00206 
00207     m_parameterBox = new PluginParameterBox(m_plugin);
00208     connect(m_parameterBox, SIGNAL(pluginConfigurationChanged(QString)),
00209             this,  SIGNAL(pluginConfigurationChanged(QString)));
00210     scroll->setWidget(m_parameterBox);
00211 
00212     m_advanced = new QFrame;
00213     QVBoxLayout *advancedLayout = new QVBoxLayout;
00214     advancedLayout->setMargin(0);
00215     m_advanced->setLayout(advancedLayout);
00216     grid->addWidget(m_advanced, 3, 0);
00217 
00218     m_channelBox = new QGroupBox;
00219     m_channelBox->setTitle(tr("Channels"));
00220     advancedLayout->addWidget(m_channelBox);
00221     m_channelBox->setVisible(false);
00222     m_haveChannelBoxData = false;
00223 
00224     m_windowBox = new QGroupBox;
00225     m_windowBox->setTitle(tr("Processing"));
00226     advancedLayout->addWidget(m_windowBox);
00227     m_windowBox->setVisible(false);
00228     m_haveWindowBoxData = false;
00229 
00230     QHBoxLayout *hbox = new QHBoxLayout;
00231     grid->addLayout(hbox, 4, 0);
00232 
00233     m_advancedVisible = false;
00234 
00235     m_advancedButton = new QPushButton(tr("Advanced >>"));
00236     m_advancedButton->setCheckable(true);
00237     connect(m_advancedButton, SIGNAL(clicked()), this, SLOT(advancedToggled()));
00238         
00239     QSettings settings;
00240     settings.beginGroup("PluginParameterDialog");
00241     m_advancedVisible = settings.value("advancedvisible", false).toBool();
00242     settings.endGroup();
00243     
00244     m_advanced->hide();
00245 
00246     hbox->addWidget(m_advancedButton);
00247     m_advancedButton->hide();
00248 
00249     QDialogButtonBox *bb = new QDialogButtonBox(QDialogButtonBox::Ok |
00250                                                 QDialogButtonBox::Cancel);
00251     hbox->addWidget(bb);
00252     connect(bb, SIGNAL(accepted()), this, SLOT(dialogAccepted()));
00253     connect(bb, SIGNAL(rejected()), this, SLOT(reject()));
00254     bb->button(QDialogButtonBox::Ok)->setDefault(true);
00255 
00256     setAdvancedVisible(m_advancedVisible);
00257 }
00258 
00259 PluginParameterDialog::~PluginParameterDialog()
00260 {
00261 }
00262 
00263 int
00264 PluginParameterDialog::exec()
00265 {
00266     show();
00267     setAdvancedVisible(m_advancedVisible);
00268     return QDialog::exec();
00269 }
00270 
00271 
00272 void
00273 PluginParameterDialog::setOutputLabel(QString text,
00274                                       QString description)
00275 {
00276     if (text == "") {
00277         m_outputSpacer->hide();
00278         m_outputLabel->hide();
00279         m_outputValue->hide();
00280         m_outputDescription->hide();
00281     } else {
00282         m_outputSpacer->show();
00283         m_outputValue->setText(text);
00284         m_outputValue->setWordWrap(true);
00285         m_outputDescription->setText(description);
00286         m_outputDescription->setWordWrap(true);
00287         m_outputLabel->show();
00288         m_outputValue->show();
00289         if (description != "") {
00290             m_outputDescription->show();
00291         } else {
00292             m_outputDescription->hide();
00293         }
00294     }
00295 }
00296 
00297 void
00298 PluginParameterDialog::setMoreInfoUrl(QString moreInfoUrl)
00299 {
00300     m_moreInfoUrl = moreInfoUrl;
00301     if (m_moreInfoUrl != "") {
00302         m_moreInfo->show();
00303     } else {
00304         m_moreInfo->hide();
00305     }
00306 }
00307 
00308 void
00309 PluginParameterDialog::setChannelArrangement(int sourceChannels,
00310                                              int targetChannels,
00311                                              int defaultChannel)
00312 {
00313     m_channel = defaultChannel;
00314 
00315     if (sourceChannels != targetChannels) {
00316 
00317         // At the moment we can only cope with the case where
00318         // sourceChannels > targetChannels and targetChannels == 1
00319 
00320         if (sourceChannels < targetChannels) {
00321 
00322             QMessageBox::warning
00323                 (parentWidget(),
00324                  tr("Channel mismatch"),
00325                  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")),
00326                  QMessageBox::Ok,
00327                  QMessageBox::NoButton);
00328 
00329         } else {
00330 
00331             if (m_haveChannelBoxData) {
00332                 cerr << "WARNING: PluginParameterDialog::setChannelArrangement: Calling more than once on same dialog is not currently implemented" << endl;
00333                 return;
00334             }
00335             
00336             QVBoxLayout *channelLayout = new QVBoxLayout;
00337             m_channelBox->setLayout(channelLayout);
00338 
00339             if (targetChannels != 1) {
00340 
00341                 channelLayout->addWidget
00342                     (new QLabel(tr("This plugin accepts no more than %1 input channels,\nbut %2 are available.  Only the first %3 will be used.\n")
00343                                 .arg(targetChannels)
00344                                 .arg(sourceChannels)
00345                                 .arg(targetChannels)));
00346 
00347             } else {
00348 
00349                 channelLayout->addWidget(new QLabel(tr("This plugin only has a single channel input,\nbut the source has %1 channels.").arg(sourceChannels)));
00350 
00351                 QComboBox *channelCombo = new QComboBox;
00352                 channelCombo->addItem(tr("Use mean of source channels"));
00353                 for (int i = 0; i < sourceChannels; ++i) {
00354                     channelCombo->addItem(tr("Use channel %1 only").arg(i + 1));
00355                 }
00356 
00357                 connect(channelCombo, SIGNAL(activated(int)),
00358                         this, SLOT(channelComboChanged(int)));
00359 
00360                 channelLayout->addWidget(channelCombo);
00361             }
00362 
00363             m_channelBox->setVisible(true);
00364             m_haveChannelBoxData = true;
00365             m_advancedButton->show();
00366         }
00367     }
00368 
00369     setAdvancedVisible(m_advancedVisible);
00370 }
00371 
00372 void
00373 PluginParameterDialog::setShowProcessingOptions(bool showWindowSize,
00374                                                 bool showFrequencyDomainOptions)
00375 {
00376     if (m_haveWindowBoxData) {
00377         cerr << "WARNING: PluginParameterDialog::setShowProcessingOptions: Calling more than once on same dialog is not currently implemented" << endl;
00378         return;
00379     }
00380 
00381     if (showWindowSize) {
00382 
00383         Vamp::Plugin *fePlugin = dynamic_cast<Vamp::Plugin *>(m_plugin);
00384         if (!fePlugin) fePlugin = dynamic_cast<Vamp::PluginHostAdapter *>(m_plugin);
00385         if (!fePlugin) fePlugin = dynamic_cast<Vamp::HostExt::PluginWrapper *>(m_plugin);
00386         int size = 1024;
00387         int increment = 1024;
00388         if (fePlugin) {
00389             size = fePlugin->getPreferredBlockSize();
00390             cerr << "Feature extraction plugin \"" << fePlugin->getName() << "\" reports preferred block size as " << size << endl;
00391             if (size == 0) size = 1024;
00392             increment = fePlugin->getPreferredStepSize();
00393             if (increment == 0) {
00394                 if (fePlugin->getInputDomain() == Vamp::Plugin::TimeDomain) {
00395                     increment = size;
00396                 } else {
00397                     increment = size/2;
00398                 }
00399             }
00400         }
00401 
00402         QGridLayout *windowLayout = new QGridLayout;
00403         m_windowBox->setLayout(windowLayout);
00404 
00405         if (showFrequencyDomainOptions) {
00406             windowLayout->addWidget(new QLabel(tr("Window size:")), 0, 0);
00407         } else {
00408             windowLayout->addWidget(new QLabel(tr("Audio frames per block:")), 0, 0);
00409         }
00410 
00411         cerr << "size: " << size << ", increment: " << increment << endl;
00412 
00413         QComboBox *blockSizeCombo = new QComboBox;
00414         blockSizeCombo->setEditable(true);
00415         bool found = false;
00416         for (int i = 0; i < 14; ++i) {
00417             int val = 1 << (i + 3);
00418             blockSizeCombo->addItem(QString("%1").arg(val));
00419             if (val == size) {
00420                 blockSizeCombo->setCurrentIndex(i);
00421                 found = true;
00422             }
00423         }
00424         if (!found) {
00425             blockSizeCombo->addItem(QString("%1").arg(size));
00426             blockSizeCombo->setCurrentIndex(blockSizeCombo->count() - 1);
00427         }
00428         blockSizeCombo->setValidator(new QIntValidator(1, int(pow(2., 18)), this));
00429         connect(blockSizeCombo, SIGNAL(editTextChanged(const QString &)),
00430                 this, SLOT(blockSizeComboChanged(const QString &)));
00431         windowLayout->addWidget(blockSizeCombo, 0, 1);
00432 
00433         windowLayout->addWidget(new QLabel(tr("Window increment:")), 1, 0);
00434         
00435         QComboBox *incrementCombo = new QComboBox;
00436         incrementCombo->setEditable(true);
00437         found = false;
00438         for (int i = 0; i < 14; ++i) {
00439             int val = 1 << (i + 3);
00440             incrementCombo->addItem(QString("%1").arg(val));
00441             if (val == increment) {
00442                 incrementCombo->setCurrentIndex(i);
00443                 found = true;
00444             }
00445         }
00446         if (!found) {
00447             incrementCombo->addItem(QString("%1").arg(increment));
00448             incrementCombo->setCurrentIndex(incrementCombo->count() - 1);
00449         }
00450         incrementCombo->setValidator(new QIntValidator(1, int(pow(2., 18)), this));
00451         connect(incrementCombo, SIGNAL(editTextChanged(const QString &)),
00452                 this, SLOT(incrementComboChanged(const QString &)));
00453         windowLayout->addWidget(incrementCombo, 1, 1);
00454         
00455         if (showFrequencyDomainOptions) {
00456             
00457             windowLayout->addWidget(new QLabel(tr("Window shape:")), 2, 0);
00458             WindowTypeSelector *windowTypeSelector = new WindowTypeSelector;
00459             connect(windowTypeSelector, SIGNAL(windowTypeChanged(WindowType)),
00460                     this, SLOT(windowTypeChanged(WindowType)));
00461             windowLayout->addWidget(windowTypeSelector, 2, 1);
00462         }
00463 
00464         m_windowBox->setVisible(true);
00465         m_haveWindowBoxData = true;
00466         m_advancedButton->show();
00467     }
00468 
00469     setAdvancedVisible(m_advancedVisible);
00470 }
00471 
00472 void
00473 PluginParameterDialog::setCandidateInputModels(const QStringList &models,
00474                                                QString defaultModel)
00475 {
00476     m_inputModels->clear();
00477 
00478     QSettings settings;
00479     settings.beginGroup("PluginParameterDialog");
00480     QString lastModel = settings.value("lastinputmodel").toString();
00481     settings.endGroup();
00482 
00483     if (defaultModel == "") defaultModel = lastModel;
00484 
00485     m_inputModels->show();
00486 
00487     m_inputModelList = models;
00488     m_inputModels->addItems(TextAbbrev::abbreviate(models, 80));
00489     m_inputModels->setCurrentIndex(0);
00490 
00491     if (defaultModel != "") {
00492         for (int i = 0; i < models.size(); ++i) {
00493             if (defaultModel == models[i]) {
00494                 m_inputModels->setCurrentIndex(i);
00495                 m_currentInputModel = models[i];
00496                 break;
00497             }
00498         }
00499     }
00500 
00501     connect(m_inputModels, SIGNAL(activated(int)),
00502             this, SLOT(inputModelComboChanged(int)));
00503     m_inputModelBox->show();
00504 }
00505 
00506 void
00507 PluginParameterDialog::setShowSelectionOnlyOption(bool show)
00508 {
00509     if (!show) {
00510         m_selectionOnly->hide();
00511         if (!m_inputModels->isVisible()) m_inputModelBox->hide();
00512         return;
00513     }
00514 
00515     QSettings settings;
00516     settings.beginGroup("PluginParameterDialog");
00517     bool lastSelectionOnly = settings.value("lastselectiononly", false).toBool();
00518     settings.endGroup();
00519 
00520     m_selectionOnly->setChecked(lastSelectionOnly);
00521     m_currentSelectionOnly = lastSelectionOnly;
00522 
00523     connect(m_selectionOnly, SIGNAL(stateChanged(int)),
00524             this, SLOT(selectionOnlyChanged(int)));
00525 
00526     m_selectionOnly->show();
00527     m_inputModelBox->show();
00528 }
00529 
00530 QString
00531 PluginParameterDialog::getInputModel() const
00532 {
00533     return m_currentInputModel;
00534 }
00535 
00536 bool
00537 PluginParameterDialog::getSelectionOnly() const
00538 {
00539     return m_currentSelectionOnly;
00540 }
00541 
00542 void
00543 PluginParameterDialog::getProcessingParameters(int &blockSize) const
00544 {
00545     blockSize = m_blockSize;
00546     return;
00547 }
00548 
00549 void
00550 PluginParameterDialog::getProcessingParameters(int &stepSize,
00551                                                int &blockSize,
00552                                                WindowType &windowType) const
00553 {
00554     stepSize = m_stepSize;
00555     blockSize = m_blockSize;
00556     windowType = m_windowType;
00557     return;
00558 }
00559 
00560 void
00561 PluginParameterDialog::blockSizeComboChanged(const QString &text)
00562 {
00563     m_blockSize = text.toInt();
00564     cerr << "Block size changed to " << m_blockSize << endl;
00565 }
00566 
00567 void
00568 PluginParameterDialog::incrementComboChanged(const QString &text)
00569 {
00570     m_stepSize = text.toInt();
00572     cerr << "Increment changed to " << m_stepSize << endl;
00573 }
00574 
00575 void
00576 PluginParameterDialog::windowTypeChanged(WindowType type)
00577 {
00578     m_windowType = type;
00579 }
00580 
00581 void
00582 PluginParameterDialog::moreInfo()
00583 {
00584     if (m_moreInfoUrl != "") {
00585         QDesktopServices::openUrl(QUrl(m_moreInfoUrl));
00586     }
00587 }
00588 
00589 void
00590 PluginParameterDialog::advancedToggled()
00591 {
00592     setAdvancedVisible(!m_advancedVisible);
00593 }
00594 
00595 void
00596 PluginParameterDialog::setAdvancedVisible(bool visible)
00597 {
00598 //    m_advanced->setVisible(visible);
00599 
00600     if (visible) {
00601         m_advancedButton->setText(tr("Advanced <<"));
00602         m_advancedButton->setChecked(true);
00603         m_advanced->show();
00604     } else {
00605         m_advanced->hide();
00606         m_advancedButton->setText(tr("Advanced >>"));
00607         m_advancedButton->setChecked(false);
00608     }
00609 
00610 //    cerr << "resize to " << sizeHint().width() << " x " << sizeHint().height() << endl;
00611 
00612 //    setMinimumHeight(sizeHint().height());
00613     adjustSize();
00614 
00615 //    (sizeHint());
00616 
00617     m_advancedVisible = visible;
00618 
00619     QSettings settings;
00620     settings.beginGroup("PluginParameterDialog");
00621     settings.setValue("advancedvisible", visible);
00622     settings.endGroup();
00623 
00624 //    if (visible) setMaximumHeight(sizeHint().height());
00625 //    adjustSize();
00626 }
00627 
00628 void
00629 PluginParameterDialog::channelComboChanged(int index)
00630 {
00631     m_channel = index - 1;
00632 }
00633 
00634 void
00635 PluginParameterDialog::inputModelComboChanged(int index)
00636 {
00637     if (index >= m_inputModelList.size()) return;
00638     m_currentInputModel = m_inputModelList[index];
00639     emit inputModelChanged(m_currentInputModel);
00640 }
00641 
00642 void
00643 PluginParameterDialog::selectionOnlyChanged(int state)
00644 {
00645     if (state == Qt::Checked) {
00646         m_currentSelectionOnly = true;
00647     } else {
00648         m_currentSelectionOnly = false;
00649     }
00650 }
00651 
00652 void
00653 PluginParameterDialog::dialogAccepted()
00654 {
00655     QSettings settings;
00656     settings.beginGroup("PluginParameterDialog");
00657 
00658     if (m_inputModels->isVisible()) {
00659         settings.setValue("lastinputmodel", getInputModel());
00660     }
00661 
00662     if (m_selectionOnly->isVisible()) {
00663         settings.setValue("lastselectiononly", getSelectionOnly());
00664     }
00665 
00666     settings.endGroup();
00667     
00668     accept();
00669 }
00670