Chris@1285
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@1285
|
2
|
Chris@1285
|
3 /*
|
Chris@1285
|
4 Sonic Visualiser
|
Chris@1285
|
5 An audio file viewer and annotation editor.
|
Chris@1285
|
6 Centre for Digital Music, Queen Mary, University of London.
|
Chris@1285
|
7
|
Chris@1285
|
8 This program is free software; you can redistribute it and/or
|
Chris@1285
|
9 modify it under the terms of the GNU General Public License as
|
Chris@1285
|
10 published by the Free Software Foundation; either version 2 of the
|
Chris@1285
|
11 License, or (at your option) any later version. See the file
|
Chris@1285
|
12 COPYING included with this distribution for more information.
|
Chris@1285
|
13 */
|
Chris@1285
|
14
|
Chris@1285
|
15 #include "PluginPathConfigurator.h"
|
Chris@1285
|
16
|
Chris@1285
|
17 #include <QPushButton>
|
Chris@1285
|
18 #include <QLabel>
|
Chris@1285
|
19
|
Chris@1285
|
20 #include "IconLoader.h"
|
Chris@1285
|
21 #include "WidgetScale.h"
|
Chris@1285
|
22
|
Chris@1285
|
23 PluginPathConfigurator::PluginPathConfigurator(QWidget *parent) :
|
Chris@1285
|
24 QFrame(parent)
|
Chris@1285
|
25 {
|
Chris@1285
|
26 setFrameStyle(StyledPanel | Sunken);
|
Chris@1285
|
27 m_layout = new QGridLayout;
|
Chris@1285
|
28 setLayout(m_layout);
|
Chris@1285
|
29 populate();
|
Chris@1285
|
30 }
|
Chris@1285
|
31
|
Chris@1285
|
32 PluginPathConfigurator::~PluginPathConfigurator()
|
Chris@1285
|
33 {
|
Chris@1285
|
34 }
|
Chris@1285
|
35
|
Chris@1285
|
36 void
|
Chris@1285
|
37 PluginPathConfigurator::setPath(QStringList directories, QString envVariable)
|
Chris@1285
|
38 {
|
Chris@1285
|
39 m_path = directories;
|
Chris@1285
|
40 m_var = envVariable;
|
Chris@1285
|
41 populate();
|
Chris@1285
|
42 }
|
Chris@1285
|
43
|
Chris@1285
|
44 void
|
Chris@1285
|
45 PluginPathConfigurator::populate()
|
Chris@1285
|
46 {
|
Chris@1285
|
47 QLabel *header = new QLabel;
|
Chris@1285
|
48 header->setText(QString("<b>%1</b>").arg(tr("Location")));
|
Chris@1285
|
49 m_layout->addWidget(header, 0, 3);
|
Chris@1285
|
50
|
Chris@1285
|
51 for (int i = 0; i < m_path.size(); ++i) {
|
Chris@1285
|
52
|
Chris@1285
|
53 int col = 0;
|
Chris@1285
|
54 int row = i + 1;
|
Chris@1285
|
55 QString dir = m_path[i];
|
Chris@1285
|
56
|
Chris@1285
|
57 if (i > 0) {
|
Chris@1285
|
58 QPushButton *up = new QPushButton;
|
Chris@1285
|
59 up->setIcon(IconLoader().load("up"));
|
Chris@1285
|
60 up->setFixedSize(WidgetScale::scaleQSize(QSize(16, 16)));
|
Chris@1285
|
61 connect(up, SIGNAL(clicked()), this, SLOT(upClicked()));
|
Chris@1285
|
62 m_layout->addWidget(up, row, col);
|
Chris@1285
|
63 }
|
Chris@1285
|
64 ++col;
|
Chris@1285
|
65
|
Chris@1285
|
66 if (i + 1 < m_path.size()) {
|
Chris@1285
|
67 QPushButton *down = new QPushButton;
|
Chris@1285
|
68 down->setIcon(IconLoader().load("down"));
|
Chris@1285
|
69 down->setFixedSize(WidgetScale::scaleQSize(QSize(16, 16)));
|
Chris@1285
|
70 connect(down, SIGNAL(clicked()), this, SLOT(downClicked()));
|
Chris@1285
|
71 m_layout->addWidget(down, row, col);
|
Chris@1285
|
72 }
|
Chris@1285
|
73 ++col;
|
Chris@1285
|
74
|
Chris@1285
|
75 QPushButton *del = new QPushButton;
|
Chris@1285
|
76 del->setIcon(IconLoader().load("datadelete"));
|
Chris@1285
|
77 del->setFixedSize(WidgetScale::scaleQSize(QSize(16, 16)));
|
Chris@1285
|
78 connect(del, SIGNAL(clicked()), this, SLOT(deleteClicked()));
|
Chris@1285
|
79 m_layout->addWidget(del, row, col);
|
Chris@1285
|
80 ++col;
|
Chris@1285
|
81
|
Chris@1285
|
82 QLabel *dirLabel = new QLabel;
|
Chris@1285
|
83 dirLabel->setText(dir);
|
Chris@1285
|
84 m_layout->addWidget(dirLabel, row, col);
|
Chris@1285
|
85 m_layout->setColumnStretch(col, 10);
|
Chris@1285
|
86 ++col;
|
Chris@1285
|
87 }
|
Chris@1285
|
88 }
|
Chris@1285
|
89
|
Chris@1285
|
90 void
|
Chris@1285
|
91 PluginPathConfigurator::upClicked()
|
Chris@1285
|
92 {
|
Chris@1285
|
93 //!!!
|
Chris@1285
|
94 }
|
Chris@1285
|
95
|
Chris@1285
|
96 void
|
Chris@1285
|
97 PluginPathConfigurator::downClicked()
|
Chris@1285
|
98 {
|
Chris@1285
|
99 //!!!!
|
Chris@1285
|
100 }
|
Chris@1285
|
101
|
Chris@1285
|
102 void
|
Chris@1285
|
103 PluginPathConfigurator::deleteClicked()
|
Chris@1285
|
104 {
|
Chris@1285
|
105 //!!!
|
Chris@1285
|
106 }
|