comparison widgets/PluginParameterDialog.cpp @ 62:50429a56680f

* Add plugin parameter dialog, and use it to set up parameters for feature extraction plugins via a semi-opaque (translucent?) configurationXml string which is associated with a given transform instance. This is not yet saved to and restored from the SV file properly. * Remove no-longer-relevant BeatDetect and BeatDetectionFunction transforms (replaced a long time ago with the beat detector plugin).
author Chris Cannam
date Wed, 22 Mar 2006 17:38:29 +0000
parents
children fb02fe13ff47
comparison
equal deleted inserted replaced
61:d072a3b59a0d 62:50429a56680f
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
2
3 /*
4 Sonic Visualiser
5 An audio file viewer and annotation editor.
6 Centre for Digital Music, Queen Mary, University of London.
7 This file copyright 2006 Chris Cannam.
8
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License as
11 published by the Free Software Foundation; either version 2 of the
12 License, or (at your option) any later version. See the file
13 COPYING included with this distribution for more information.
14 */
15
16 #include "PluginParameterDialog.h"
17
18 #include "PluginParameterBox.h"
19
20 #include <QGridLayout>
21 #include <QLabel>
22 #include <QGroupBox>
23 #include <QHBoxLayout>
24 #include <QPushButton>
25
26 PluginParameterDialog::PluginParameterDialog(PluginInstance *plugin,
27 QWidget *parent) :
28 QDialog(parent),
29 m_plugin(plugin),
30 m_parameterBox(0)
31 {
32 QGridLayout *grid = new QGridLayout;
33 setLayout(grid);
34
35 QGroupBox *pluginBox = new QGroupBox;
36 pluginBox->setTitle(tr("Plugin"));
37 grid->addWidget(pluginBox, 0, 0);
38
39 QGridLayout *subgrid = new QGridLayout;
40 pluginBox->setLayout(subgrid);
41
42 QFont font(pluginBox->font());
43 font.setBold(true);
44
45 QLabel *nameLabel = new QLabel(plugin->getDescription().c_str());
46 nameLabel->setFont(font);
47
48 QLabel *makerLabel = new QLabel(plugin->getMaker().c_str());
49 makerLabel->setFont(font);
50
51 QLabel *versionLabel = new QLabel(QString("%1")
52 .arg(plugin->getPluginVersion()));
53 versionLabel->setFont(font);
54
55 QLabel *copyrightLabel = new QLabel(plugin->getCopyright().c_str());
56 copyrightLabel->setFont(font);
57
58 subgrid->addWidget(new QLabel(tr("Name:")), 0, 0);
59 subgrid->addWidget(nameLabel, 0, 1);
60
61 subgrid->addWidget(new QLabel(tr("Maker:")), 1, 0);
62 subgrid->addWidget(makerLabel, 1, 1);
63
64 subgrid->addWidget(new QLabel(tr("Copyright:")), 2, 0);
65 subgrid->addWidget(copyrightLabel, 2, 1);
66
67 subgrid->addWidget(new QLabel(tr("Version:")), 3, 0);
68 subgrid->addWidget(versionLabel, 3, 1);
69
70 subgrid->setColumnStretch(1, 2);
71
72 QGroupBox *paramBox = new QGroupBox;
73 paramBox->setTitle(tr("Plugin Parameters"));
74 grid->addWidget(paramBox, 1, 0);
75 grid->setRowStretch(1, 10);
76
77 QHBoxLayout *paramLayout = new QHBoxLayout;
78 paramBox->setLayout(paramLayout);
79
80 m_parameterBox = new PluginParameterBox(m_plugin);
81 paramLayout->addWidget(m_parameterBox);
82
83 QHBoxLayout *hbox = new QHBoxLayout;
84 grid->addLayout(hbox, 2, 0);
85
86 QPushButton *ok = new QPushButton(tr("OK"));
87 QPushButton *cancel = new QPushButton(tr("Cancel"));
88 hbox->addStretch(10);
89 hbox->addWidget(ok);
90 hbox->addWidget(cancel);
91 connect(ok, SIGNAL(clicked()), this, SLOT(accept()));
92 connect(cancel, SIGNAL(clicked()), this, SLOT(reject()));
93 }
94
95 PluginParameterDialog::~PluginParameterDialog()
96 {
97 }
98