Mercurial > hg > vamp-plugin-pack
comparison installer.cpp @ 46:6dc29a50b89a
Start fancifying layout
author | Chris Cannam |
---|---|
date | Wed, 22 Jan 2020 13:54:03 +0000 |
parents | 4aea515b404f |
children | c9e811d9edbe |
comparison
equal
deleted
inserted
replaced
45:8c1f0280c425 | 46:6dc29a50b89a |
---|---|
6 | 6 |
7 #include <QDialog> | 7 #include <QDialog> |
8 #include <QFrame> | 8 #include <QFrame> |
9 #include <QVBoxLayout> | 9 #include <QVBoxLayout> |
10 #include <QCheckBox> | 10 #include <QCheckBox> |
11 #include <QScrollArea> | |
11 #include <QDialogButtonBox> | 12 #include <QDialogButtonBox> |
13 #include <QLabel> | |
12 | 14 |
13 #include <vamp-hostsdk/PluginHostAdapter.h> | 15 #include <vamp-hostsdk/PluginHostAdapter.h> |
14 | 16 |
15 #include <dataquay/BasicStore.h> | 17 #include <dataquay/BasicStore.h> |
16 #include <dataquay/RDFException.h> | 18 #include <dataquay/RDFException.h> |
139 Node maker = store.complete(Triple(t.subject(), | 141 Node maker = store.complete(Triple(t.subject(), |
140 store.expand("foaf:maker"), | 142 store.expand("foaf:maker"), |
141 Node())); | 143 Node())); |
142 if (maker.type == Node::Literal) { | 144 if (maker.type == Node::Literal) { |
143 info.maker = maker.value; | 145 info.maker = maker.value; |
144 } | 146 } else if (maker != Node()) { |
145 | 147 maker = store.complete(Triple(maker, |
148 store.expand("foaf:name"), | |
149 Node())); | |
150 if (maker.type == Node::Literal) { | |
151 info.maker = maker.value; | |
152 } | |
153 } | |
154 | |
146 Node desc = store.complete(Triple(t.subject(), | 155 Node desc = store.complete(Triple(t.subject(), |
147 store.expand("dc:description"), | 156 store.expand("dc:description"), |
148 Node())); | 157 Node())); |
149 if (desc.type == Node::Literal) { | 158 if (desc.type == Node::Literal) { |
150 info.description = desc.value; | 159 info.description = desc.value; |
181 | 190 |
182 QStringList | 191 QStringList |
183 getUserApprovedPluginLibraries(vector<LibraryInfo> libraries) | 192 getUserApprovedPluginLibraries(vector<LibraryInfo> libraries) |
184 { | 193 { |
185 QDialog dialog; | 194 QDialog dialog; |
186 auto layout = new QVBoxLayout; | 195 |
196 auto mainLayout = new QGridLayout; | |
197 dialog.setLayout(mainLayout); | |
198 | |
199 int mainRow = 0; | |
200 | |
201 //!!! at top: title and check/uncheck all button | |
202 | |
203 auto scroll = new QScrollArea; | |
204 mainLayout->addWidget(scroll, mainRow, 0, 1, 2); | |
205 mainLayout->setRowStretch(mainRow, 10); | |
206 ++mainRow; | |
207 | |
208 auto selectionFrame = new QWidget; | |
209 | |
210 auto selectionLayout = new QGridLayout; | |
211 selectionFrame->setLayout(selectionLayout); | |
212 int selectionRow = 0; | |
187 | 213 |
188 map<QString, QCheckBox *> checkBoxMap; | 214 map<QString, QCheckBox *> checkBoxMap; |
189 | 215 |
190 map<QString, LibraryInfo> orderedInfo; | 216 map<QString, LibraryInfo> orderedInfo; |
191 for (auto info: libraries) { | 217 for (auto info: libraries) { |
192 orderedInfo[info.title] = info; | 218 orderedInfo[info.title] = info; |
193 } | 219 } |
194 | 220 |
195 for (auto ip: orderedInfo) { | 221 for (auto ip: orderedInfo) { |
222 | |
223 auto cb = new QCheckBox; | |
224 selectionLayout->addWidget(cb, selectionRow, 0, Qt::AlignTop); | |
225 | |
196 LibraryInfo info = ip.second; | 226 LibraryInfo info = ip.second; |
197 auto cb = new QCheckBox(info.title); | 227 |
198 layout->addWidget(cb); | 228 QString text = QObject::tr("<b>%1</b> (%2)<br><i>%3</i>") |
229 .arg(info.title) | |
230 .arg(info.id) | |
231 .arg(info.maker); | |
232 | |
233 auto label = new QLabel(text); | |
234 | |
235 selectionLayout->addWidget(label, selectionRow, 1, Qt::AlignTop); | |
236 | |
237 ++selectionRow; | |
238 | |
199 checkBoxMap[info.fileName] = cb; | 239 checkBoxMap[info.fileName] = cb; |
200 } | 240 } |
241 | |
242 scroll->setWidget(selectionFrame); | |
201 | 243 |
202 auto bb = new QDialogButtonBox(QDialogButtonBox::Ok | | 244 auto bb = new QDialogButtonBox(QDialogButtonBox::Ok | |
203 QDialogButtonBox::Cancel); | 245 QDialogButtonBox::Cancel); |
204 layout->addWidget(bb); | 246 mainLayout->addWidget(bb, mainRow, 0, 1, 2); |
247 ++mainRow; | |
205 QObject::connect(bb, SIGNAL(accepted()), &dialog, SLOT(accept())); | 248 QObject::connect(bb, SIGNAL(accepted()), &dialog, SLOT(accept())); |
206 QObject::connect(bb, SIGNAL(rejected()), &dialog, SLOT(reject())); | 249 QObject::connect(bb, SIGNAL(rejected()), &dialog, SLOT(reject())); |
207 | 250 |
208 dialog.setLayout(layout); | |
209 | |
210 if (dialog.exec() == QDialog::Accepted) { | 251 if (dialog.exec() == QDialog::Accepted) { |
211 cerr << "accepted" << endl; | 252 cerr << "accepted" << endl; |
212 } else { | 253 } else { |
213 cerr << "rejected" << endl; | 254 cerr << "rejected" << endl; |
214 } | 255 } |