Mercurial > hg > svgui
comparison widgets/PluginPathConfigurator.cpp @ 1292:41824255ddf2 plugin-path-config
Plugin review dialog
author | Chris Cannam |
---|---|
date | Fri, 25 May 2018 13:39:08 +0100 |
parents | b5c71304286e |
children | 6dd15b5c14f9 |
comparison
equal
deleted
inserted
replaced
1291:b5c71304286e | 1292:41824255ddf2 |
---|---|
11 License, or (at your option) any later version. See the file | 11 License, or (at your option) any later version. See the file |
12 COPYING included with this distribution for more information. | 12 COPYING included with this distribution for more information. |
13 */ | 13 */ |
14 | 14 |
15 #include "PluginPathConfigurator.h" | 15 #include "PluginPathConfigurator.h" |
16 #include "PluginReviewDialog.h" | |
16 | 17 |
17 #include <QPushButton> | 18 #include <QPushButton> |
18 #include <QListWidget> | 19 #include <QListWidget> |
19 #include <QGridLayout> | 20 #include <QGridLayout> |
20 #include <QComboBox> | 21 #include <QComboBox> |
28 PluginPathConfigurator::PluginPathConfigurator(QWidget *parent) : | 29 PluginPathConfigurator::PluginPathConfigurator(QWidget *parent) : |
29 QFrame(parent) | 30 QFrame(parent) |
30 { | 31 { |
31 m_layout = new QGridLayout; | 32 m_layout = new QGridLayout; |
32 setLayout(m_layout); | 33 setLayout(m_layout); |
33 | 34 |
34 QHBoxLayout *buttons = new QHBoxLayout; | 35 QHBoxLayout *buttons = new QHBoxLayout; |
35 | 36 |
36 m_down = new QPushButton; | 37 m_down = new QPushButton; |
37 m_down->setIcon(IconLoader().load("down")); | 38 m_down->setIcon(IconLoader().load("down")); |
38 m_down->setToolTip(tr("Move the selected location later in the list")); | 39 m_down->setToolTip(tr("Move the selected location later in the list")); |
82 m_layout->setRowStretch(row, 20); | 83 m_layout->setRowStretch(row, 20); |
83 connect(m_list, SIGNAL(currentRowChanged(int)), | 84 connect(m_list, SIGNAL(currentRowChanged(int)), |
84 this, SLOT(currentLocationChanged(int))); | 85 this, SLOT(currentLocationChanged(int))); |
85 ++row; | 86 ++row; |
86 | 87 |
87 m_layout->addLayout(buttons, row, 2); | 88 m_layout->addLayout(buttons, row, 0, Qt::AlignLeft); |
89 | |
90 m_seePlugins = new QPushButton; | |
91 m_seePlugins->setText(tr("Review plugins...")); | |
92 connect(m_seePlugins, SIGNAL(clicked()), this, SLOT(seePluginsClicked())); | |
93 m_layout->addWidget(m_seePlugins, row, 2); | |
94 | |
88 ++row; | 95 ++row; |
89 | 96 |
90 m_envOverride = new QCheckBox; | 97 m_envOverride = new QCheckBox; |
91 connect(m_envOverride, SIGNAL(stateChanged(int)), | 98 connect(m_envOverride, SIGNAL(stateChanged(int)), |
92 this, SLOT(envOverrideChanged(int))); | 99 this, SLOT(envOverrideChanged(int))); |
170 { | 177 { |
171 populateFor(type, -1); | 178 populateFor(type, -1); |
172 } | 179 } |
173 | 180 |
174 void | 181 void |
175 PluginPathConfigurator::envOverrideChanged(int ) | 182 PluginPathConfigurator::envOverrideChanged(int state) |
176 { | 183 { |
177 //!!! | 184 bool useEnvVariable = (state == Qt::Checked); |
185 | |
186 QString type = m_pluginTypeSelector->currentText(); | |
187 | |
188 auto newEntry = m_paths.at(type); | |
189 newEntry.useEnvVariable = useEnvVariable; | |
190 m_paths[type] = newEntry; | |
191 | |
192 emit pathsChanged(m_paths); | |
178 } | 193 } |
179 | 194 |
180 void | 195 void |
181 PluginPathConfigurator::upClicked() | 196 PluginPathConfigurator::upClicked() |
182 { | 197 { |
200 auto newEntry = m_paths.at(type); | 215 auto newEntry = m_paths.at(type); |
201 newEntry.directories = newPath; | 216 newEntry.directories = newPath; |
202 m_paths[type] = newEntry; | 217 m_paths[type] = newEntry; |
203 | 218 |
204 populateFor(type, current - 1); | 219 populateFor(type, current - 1); |
220 | |
221 emit pathsChanged(m_paths); | |
205 } | 222 } |
206 | 223 |
207 void | 224 void |
208 PluginPathConfigurator::downClicked() | 225 PluginPathConfigurator::downClicked() |
209 { | 226 { |
227 auto newEntry = m_paths.at(type); | 244 auto newEntry = m_paths.at(type); |
228 newEntry.directories = newPath; | 245 newEntry.directories = newPath; |
229 m_paths[type] = newEntry; | 246 m_paths[type] = newEntry; |
230 | 247 |
231 populateFor(type, current + 1); | 248 populateFor(type, current + 1); |
249 | |
250 emit pathsChanged(m_paths); | |
232 } | 251 } |
233 | 252 |
234 void | 253 void |
235 PluginPathConfigurator::addClicked() | 254 PluginPathConfigurator::addClicked() |
236 { | 255 { |
244 auto newEntry = m_paths.at(type); | 263 auto newEntry = m_paths.at(type); |
245 newEntry.directories.push_back(newDir); | 264 newEntry.directories.push_back(newDir); |
246 m_paths[type] = newEntry; | 265 m_paths[type] = newEntry; |
247 | 266 |
248 populateFor(type, newEntry.directories.size() - 1); | 267 populateFor(type, newEntry.directories.size() - 1); |
268 | |
269 emit pathsChanged(m_paths); | |
249 } | 270 } |
250 | 271 |
251 void | 272 void |
252 PluginPathConfigurator::deleteClicked() | 273 PluginPathConfigurator::deleteClicked() |
253 { | 274 { |
267 auto newEntry = m_paths.at(type); | 288 auto newEntry = m_paths.at(type); |
268 newEntry.directories = newPath; | 289 newEntry.directories = newPath; |
269 m_paths[type] = newEntry; | 290 m_paths[type] = newEntry; |
270 | 291 |
271 populateFor(type, current < newPath.size() ? current : current-1); | 292 populateFor(type, current < newPath.size() ? current : current-1); |
293 | |
294 emit pathsChanged(m_paths); | |
272 } | 295 } |
273 | 296 |
274 void | 297 void |
275 PluginPathConfigurator::resetClicked() | 298 PluginPathConfigurator::resetClicked() |
276 { | 299 { |
277 QString type = m_pluginTypeSelector->currentText(); | 300 QString type = m_pluginTypeSelector->currentText(); |
278 m_paths[type] = m_originalPaths[type]; | 301 m_paths[type] = m_originalPaths[type]; |
279 populateFor(type, -1); | 302 populateFor(type, -1); |
280 } | 303 |
304 emit pathsChanged(m_paths); | |
305 } | |
306 | |
307 void | |
308 PluginPathConfigurator::seePluginsClicked() | |
309 { | |
310 PluginReviewDialog dialog(this); | |
311 dialog.populate(); | |
312 dialog.exec(); | |
313 } | |
314 |