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@62
|
7 This file copyright 2006 Chris Cannam.
|
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@62
|
19
|
Chris@62
|
20 #include <QGridLayout>
|
Chris@62
|
21 #include <QLabel>
|
Chris@62
|
22 #include <QGroupBox>
|
Chris@62
|
23 #include <QHBoxLayout>
|
Chris@62
|
24 #include <QPushButton>
|
Chris@62
|
25
|
Chris@62
|
26 PluginParameterDialog::PluginParameterDialog(PluginInstance *plugin,
|
Chris@62
|
27 QWidget *parent) :
|
Chris@62
|
28 QDialog(parent),
|
Chris@62
|
29 m_plugin(plugin),
|
Chris@62
|
30 m_parameterBox(0)
|
Chris@62
|
31 {
|
Chris@62
|
32 QGridLayout *grid = new QGridLayout;
|
Chris@62
|
33 setLayout(grid);
|
Chris@62
|
34
|
Chris@62
|
35 QGroupBox *pluginBox = new QGroupBox;
|
Chris@62
|
36 pluginBox->setTitle(tr("Plugin"));
|
Chris@62
|
37 grid->addWidget(pluginBox, 0, 0);
|
Chris@62
|
38
|
Chris@62
|
39 QGridLayout *subgrid = new QGridLayout;
|
Chris@62
|
40 pluginBox->setLayout(subgrid);
|
Chris@62
|
41
|
Chris@63
|
42 subgrid->setSpacing(0);
|
Chris@63
|
43 subgrid->setMargin(10);
|
Chris@63
|
44
|
Chris@62
|
45 QFont font(pluginBox->font());
|
Chris@62
|
46 font.setBold(true);
|
Chris@62
|
47
|
Chris@62
|
48 QLabel *nameLabel = new QLabel(plugin->getDescription().c_str());
|
Chris@62
|
49 nameLabel->setFont(font);
|
Chris@62
|
50
|
Chris@62
|
51 QLabel *makerLabel = new QLabel(plugin->getMaker().c_str());
|
Chris@62
|
52 makerLabel->setFont(font);
|
Chris@62
|
53
|
Chris@62
|
54 QLabel *versionLabel = new QLabel(QString("%1")
|
Chris@62
|
55 .arg(plugin->getPluginVersion()));
|
Chris@62
|
56 versionLabel->setFont(font);
|
Chris@62
|
57
|
Chris@62
|
58 QLabel *copyrightLabel = new QLabel(plugin->getCopyright().c_str());
|
Chris@62
|
59 copyrightLabel->setFont(font);
|
Chris@62
|
60
|
Chris@63
|
61 QLabel *typeLabel = new QLabel(plugin->getType().c_str());
|
Chris@63
|
62 typeLabel->setFont(font);
|
Chris@63
|
63
|
Chris@62
|
64 subgrid->addWidget(new QLabel(tr("Name:")), 0, 0);
|
Chris@62
|
65 subgrid->addWidget(nameLabel, 0, 1);
|
Chris@62
|
66
|
Chris@63
|
67 subgrid->addWidget(new QLabel(tr("Type:")), 1, 0);
|
Chris@63
|
68 subgrid->addWidget(typeLabel, 1, 1);
|
Chris@62
|
69
|
Chris@63
|
70 subgrid->addWidget(new QLabel(tr("Maker:")), 2, 0);
|
Chris@63
|
71 subgrid->addWidget(makerLabel, 2, 1);
|
Chris@62
|
72
|
Chris@63
|
73 subgrid->addWidget(new QLabel(tr("Copyright: ")), 3, 0);
|
Chris@63
|
74 subgrid->addWidget(copyrightLabel, 3, 1);
|
Chris@63
|
75
|
Chris@63
|
76 subgrid->addWidget(new QLabel(tr("Version:")), 4, 0);
|
Chris@63
|
77 subgrid->addWidget(versionLabel, 4, 1);
|
Chris@62
|
78
|
Chris@62
|
79 subgrid->setColumnStretch(1, 2);
|
Chris@62
|
80
|
Chris@62
|
81 QGroupBox *paramBox = new QGroupBox;
|
Chris@62
|
82 paramBox->setTitle(tr("Plugin Parameters"));
|
Chris@62
|
83 grid->addWidget(paramBox, 1, 0);
|
Chris@62
|
84 grid->setRowStretch(1, 10);
|
Chris@62
|
85
|
Chris@62
|
86 QHBoxLayout *paramLayout = new QHBoxLayout;
|
Chris@63
|
87 paramLayout->setMargin(0);
|
Chris@62
|
88 paramBox->setLayout(paramLayout);
|
Chris@62
|
89
|
Chris@62
|
90 m_parameterBox = new PluginParameterBox(m_plugin);
|
Chris@62
|
91 paramLayout->addWidget(m_parameterBox);
|
Chris@62
|
92
|
Chris@62
|
93 QHBoxLayout *hbox = new QHBoxLayout;
|
Chris@62
|
94 grid->addLayout(hbox, 2, 0);
|
Chris@62
|
95
|
Chris@62
|
96 QPushButton *ok = new QPushButton(tr("OK"));
|
Chris@62
|
97 QPushButton *cancel = new QPushButton(tr("Cancel"));
|
Chris@62
|
98 hbox->addStretch(10);
|
Chris@62
|
99 hbox->addWidget(ok);
|
Chris@62
|
100 hbox->addWidget(cancel);
|
Chris@62
|
101 connect(ok, SIGNAL(clicked()), this, SLOT(accept()));
|
Chris@62
|
102 connect(cancel, SIGNAL(clicked()), this, SLOT(reject()));
|
Chris@62
|
103 }
|
Chris@62
|
104
|
Chris@62
|
105 PluginParameterDialog::~PluginParameterDialog()
|
Chris@62
|
106 {
|
Chris@62
|
107 }
|
Chris@62
|
108
|