Mercurial > hg > svgui
comparison widgets/PluginPathConfigurator.cpp @ 1285:abd52bd8d435 plugin-path-config
Toward allowing the user to see (at least, and maybe change) the plugin path
author | Chris Cannam |
---|---|
date | Fri, 11 May 2018 16:59:14 +0100 |
parents | |
children | e327bbf4bf57 |
comparison
equal
deleted
inserted
replaced
1284:51e6125627fa | 1285:abd52bd8d435 |
---|---|
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 | |
8 This program is free software; you can redistribute it and/or | |
9 modify it under the terms of the GNU General Public License as | |
10 published by the Free Software Foundation; either version 2 of the | |
11 License, or (at your option) any later version. See the file | |
12 COPYING included with this distribution for more information. | |
13 */ | |
14 | |
15 #include "PluginPathConfigurator.h" | |
16 | |
17 #include <QPushButton> | |
18 #include <QLabel> | |
19 | |
20 #include "IconLoader.h" | |
21 #include "WidgetScale.h" | |
22 | |
23 PluginPathConfigurator::PluginPathConfigurator(QWidget *parent) : | |
24 QFrame(parent) | |
25 { | |
26 setFrameStyle(StyledPanel | Sunken); | |
27 m_layout = new QGridLayout; | |
28 setLayout(m_layout); | |
29 populate(); | |
30 } | |
31 | |
32 PluginPathConfigurator::~PluginPathConfigurator() | |
33 { | |
34 } | |
35 | |
36 void | |
37 PluginPathConfigurator::setPath(QStringList directories, QString envVariable) | |
38 { | |
39 m_path = directories; | |
40 m_var = envVariable; | |
41 populate(); | |
42 } | |
43 | |
44 void | |
45 PluginPathConfigurator::populate() | |
46 { | |
47 QLabel *header = new QLabel; | |
48 header->setText(QString("<b>%1</b>").arg(tr("Location"))); | |
49 m_layout->addWidget(header, 0, 3); | |
50 | |
51 for (int i = 0; i < m_path.size(); ++i) { | |
52 | |
53 int col = 0; | |
54 int row = i + 1; | |
55 QString dir = m_path[i]; | |
56 | |
57 if (i > 0) { | |
58 QPushButton *up = new QPushButton; | |
59 up->setIcon(IconLoader().load("up")); | |
60 up->setFixedSize(WidgetScale::scaleQSize(QSize(16, 16))); | |
61 connect(up, SIGNAL(clicked()), this, SLOT(upClicked())); | |
62 m_layout->addWidget(up, row, col); | |
63 } | |
64 ++col; | |
65 | |
66 if (i + 1 < m_path.size()) { | |
67 QPushButton *down = new QPushButton; | |
68 down->setIcon(IconLoader().load("down")); | |
69 down->setFixedSize(WidgetScale::scaleQSize(QSize(16, 16))); | |
70 connect(down, SIGNAL(clicked()), this, SLOT(downClicked())); | |
71 m_layout->addWidget(down, row, col); | |
72 } | |
73 ++col; | |
74 | |
75 QPushButton *del = new QPushButton; | |
76 del->setIcon(IconLoader().load("datadelete")); | |
77 del->setFixedSize(WidgetScale::scaleQSize(QSize(16, 16))); | |
78 connect(del, SIGNAL(clicked()), this, SLOT(deleteClicked())); | |
79 m_layout->addWidget(del, row, col); | |
80 ++col; | |
81 | |
82 QLabel *dirLabel = new QLabel; | |
83 dirLabel->setText(dir); | |
84 m_layout->addWidget(dirLabel, row, col); | |
85 m_layout->setColumnStretch(col, 10); | |
86 ++col; | |
87 } | |
88 } | |
89 | |
90 void | |
91 PluginPathConfigurator::upClicked() | |
92 { | |
93 //!!! | |
94 } | |
95 | |
96 void | |
97 PluginPathConfigurator::downClicked() | |
98 { | |
99 //!!!! | |
100 } | |
101 | |
102 void | |
103 PluginPathConfigurator::deleteClicked() | |
104 { | |
105 //!!! | |
106 } |