diff options
-rw-r--r-- | rbutil/rbutilqt/base/systeminfo.cpp | 12 | ||||
-rw-r--r-- | rbutil/rbutilqt/base/systeminfo.h | 4 | ||||
-rw-r--r-- | rbutil/rbutilqt/configure.cpp | 40 |
3 files changed, 20 insertions, 36 deletions
diff --git a/rbutil/rbutilqt/base/systeminfo.cpp b/rbutil/rbutilqt/base/systeminfo.cpp index a941f43078..72a62ac2fb 100644 --- a/rbutil/rbutilqt/base/systeminfo.cpp +++ b/rbutil/rbutilqt/base/systeminfo.cpp | |||
@@ -156,18 +156,6 @@ QStringList SystemInfo::languages() | |||
156 | } | 156 | } |
157 | 157 | ||
158 | 158 | ||
159 | QString SystemInfo::name(QString platform) | ||
160 | { | ||
161 | ensureSystemInfoExists(); | ||
162 | return systemInfos->value(platform + "/name").toString(); | ||
163 | } | ||
164 | |||
165 | QString SystemInfo::brand(QString platform) | ||
166 | { | ||
167 | ensureSystemInfoExists(); | ||
168 | return systemInfos->value(platform + "/brand").toString(); | ||
169 | } | ||
170 | |||
171 | QMap<int, QString> SystemInfo::usbIdMap(enum MapType type) | 159 | QMap<int, QString> SystemInfo::usbIdMap(enum MapType type) |
172 | { | 160 | { |
173 | ensureSystemInfoExists(); | 161 | ensureSystemInfoExists(); |
diff --git a/rbutil/rbutilqt/base/systeminfo.h b/rbutil/rbutilqt/base/systeminfo.h index 76d00d4949..fb5fa9e1ac 100644 --- a/rbutil/rbutilqt/base/systeminfo.h +++ b/rbutil/rbutilqt/base/systeminfo.h | |||
@@ -77,10 +77,6 @@ class SystemInfo : public QObject | |||
77 | QString variant=""); | 77 | QString variant=""); |
78 | //! returns a list of all languages | 78 | //! returns a list of all languages |
79 | static QStringList languages(void); | 79 | static QStringList languages(void); |
80 | //! maps a platform to its name | ||
81 | static QString name(QString platform); | ||
82 | //! maps a platform to its brand | ||
83 | static QString brand(QString platform); | ||
84 | //! returns a map of usb-ids and their targets | 80 | //! returns a map of usb-ids and their targets |
85 | static QMap<int, QString> usbIdMap(enum MapType); | 81 | static QMap<int, QString> usbIdMap(enum MapType); |
86 | //! get a value from system settings | 82 | //! get a value from system settings |
diff --git a/rbutil/rbutilqt/configure.cpp b/rbutil/rbutilqt/configure.cpp index 7507833297..c57554aef3 100644 --- a/rbutil/rbutilqt/configure.cpp +++ b/rbutil/rbutilqt/configure.cpp | |||
@@ -309,20 +309,13 @@ void Config::setDevices() | |||
309 | platformList = SystemInfo::platforms(SystemInfo::PlatformAll); | 309 | platformList = SystemInfo::platforms(SystemInfo::PlatformAll); |
310 | 310 | ||
311 | QMap <QString, QString> manuf; | 311 | QMap <QString, QString> manuf; |
312 | QMap <QString, QString> devcs; | ||
313 | for(int it = 0; it < platformList.size(); it++) | 312 | for(int it = 0; it < platformList.size(); it++) |
314 | { | 313 | { |
315 | QString curname = SystemInfo::name(platformList.at(it)) + | 314 | QString curbrand = SystemInfo::platformValue(platformList.at(it), |
316 | " (" +ServerInfo::platformValue(platformList.at(it), | 315 | SystemInfo::CurBrand).toString(); |
317 | ServerInfo::CurStatus).toString() + ")"; | ||
318 | QString curbrand = SystemInfo::brand(platformList.at(it)); | ||
319 | manuf.insertMulti(curbrand, platformList.at(it)); | 316 | manuf.insertMulti(curbrand, platformList.at(it)); |
320 | devcs.insert(platformList.at(it), curname); | ||
321 | } | 317 | } |
322 | 318 | ||
323 | QString platform; | ||
324 | platform = devcs.value(RbSettings::value(RbSettings::Platform).toString()); | ||
325 | |||
326 | // set up devices table | 319 | // set up devices table |
327 | ui.treeDevices->header()->hide(); | 320 | ui.treeDevices->header()->hide(); |
328 | ui.treeDevices->expandAll(); | 321 | ui.treeDevices->expandAll(); |
@@ -334,25 +327,28 @@ void Config::setDevices() | |||
334 | QTreeWidgetItem *w; | 327 | QTreeWidgetItem *w; |
335 | QTreeWidgetItem *w2; | 328 | QTreeWidgetItem *w2; |
336 | QTreeWidgetItem *w3 = 0; | 329 | QTreeWidgetItem *w3 = 0; |
330 | |||
331 | QString selected = RbSettings::value(RbSettings::Platform).toString(); | ||
337 | for(int c = 0; c < brands.size(); c++) { | 332 | for(int c = 0; c < brands.size(); c++) { |
338 | w = new QTreeWidgetItem(); | 333 | w = new QTreeWidgetItem(); |
339 | w->setFlags(Qt::ItemIsEnabled); | 334 | w->setFlags(Qt::ItemIsEnabled); |
340 | w->setText(0, brands.at(c)); | 335 | w->setText(0, brands.at(c)); |
341 | items.append(w); | 336 | items.append(w); |
342 | 337 | // go through platforms and add all players matching the current brand | |
343 | // go through platforms again for sake of order | ||
344 | for(int it = 0; it < platformList.size(); it++) { | 338 | for(int it = 0; it < platformList.size(); it++) { |
345 | 339 | // skip if not current brand | |
346 | QString curname = SystemInfo::name(platformList.at(it)) + | 340 | if(!manuf.values(brands.at(c)).contains(platformList.at(it))) |
347 | " (" +ServerInfo::platformValue(platformList.at(it),ServerInfo::CurStatus).toString() +")"; | 341 | continue; |
348 | QString curbrand = SystemInfo::brand(platformList.at(it)); | 342 | // construct display name |
349 | 343 | QString curname = SystemInfo::platformValue(platformList.at(it), | |
350 | if(curbrand != brands.at(c)) continue; | 344 | SystemInfo::CurName).toString() + |
345 | " (" +ServerInfo::platformValue(platformList.at(it), | ||
346 | ServerInfo::CurStatus).toString() +")"; | ||
351 | qDebug() << "[Config] add supported device:" << brands.at(c) << curname; | 347 | qDebug() << "[Config] add supported device:" << brands.at(c) << curname; |
352 | w2 = new QTreeWidgetItem(w, QStringList(curname)); | 348 | w2 = new QTreeWidgetItem(w, QStringList(curname)); |
353 | w2->setData(0, Qt::UserRole, platformList.at(it)); | 349 | w2->setData(0, Qt::UserRole, platformList.at(it)); |
354 | 350 | ||
355 | if(platform.contains(curname)) { | 351 | if(platformList.at(it) == selected) { |
356 | w2->setSelected(true); | 352 | w2->setSelected(true); |
357 | w->setExpanded(true); | 353 | w->setExpanded(true); |
358 | w3 = w2; // save pointer to hilight old selection | 354 | w3 = w2; // save pointer to hilight old selection |
@@ -369,8 +365,10 @@ void Config::setDevices() | |||
369 | while(widgetitem); | 365 | while(widgetitem); |
370 | // add new items | 366 | // add new items |
371 | ui.treeDevices->insertTopLevelItems(0, items); | 367 | ui.treeDevices->insertTopLevelItems(0, items); |
372 | if(w3 != 0) | 368 | if(w3 != 0) { |
373 | ui.treeDevices->setCurrentItem(w3); // hilight old selection | 369 | ui.treeDevices->setCurrentItem(w3); // hilight old selection |
370 | ui.treeDevices->scrollToItem(w3); | ||
371 | } | ||
374 | 372 | ||
375 | // tts / encoder tab | 373 | // tts / encoder tab |
376 | 374 | ||
@@ -589,7 +587,8 @@ void Config::autodetect() | |||
589 | 587 | ||
590 | // find the new item | 588 | // find the new item |
591 | // enumerate all platform items | 589 | // enumerate all platform items |
592 | QList<QTreeWidgetItem*> itmList= ui.treeDevices->findItems("*",Qt::MatchWildcard); | 590 | QList<QTreeWidgetItem*> itmList |
591 | = ui.treeDevices->findItems("*",Qt::MatchWildcard); | ||
593 | for(int i=0; i< itmList.size();i++) | 592 | for(int i=0; i< itmList.size();i++) |
594 | { | 593 | { |
595 | //enumerate device items | 594 | //enumerate device items |
@@ -602,6 +601,7 @@ void Config::autodetect() | |||
602 | itmList.at(i)->child(j)->setSelected(true); //select the item | 601 | itmList.at(i)->child(j)->setSelected(true); //select the item |
603 | itmList.at(i)->setExpanded(true); //expand the platform item | 602 | itmList.at(i)->setExpanded(true); //expand the platform item |
604 | //ui.treeDevices->indexOfTopLevelItem(itmList.at(i)->child(j)); | 603 | //ui.treeDevices->indexOfTopLevelItem(itmList.at(i)->child(j)); |
604 | ui.treeDevices->scrollToItem(itmList.at(i)->child(j)); | ||
605 | break; | 605 | break; |
606 | } | 606 | } |
607 | } | 607 | } |