diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2020-11-28 20:47:28 +0100 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2020-12-03 22:25:12 +0100 |
commit | b064a6cbb58a0db1a70fbac2e82242ce0c7509b1 (patch) | |
tree | c9090d367d237cbd408afbd24d5809e55a1a2653 /rbutil/rbutilqt/configure.cpp | |
parent | 78a01db47cac5fa67aeee6f1c5134f89c3e4944a (diff) | |
download | rockbox-b064a6cbb58a0db1a70fbac2e82242ce0c7509b1.tar.gz rockbox-b064a6cbb58a0db1a70fbac2e82242ce0c7509b1.zip |
rbutil: Rework and merge player and build server info handling.
Handling the data for players from rbutil.ini and the build-info data
from the server is closely related. Splitting things up into different
classes only creates tightly coupling, which is unnecessary, and the
need to differentiate between them in the application.
Merge both classes into a single one and rework handling so the
application doesn't have to deal with two separate classes anymore.
Furthermore, change URL templates to use new values from build-info
instead of hard coding them.
Change-Id: Ica550973ce23d1559110782add52bc214eba552d
Diffstat (limited to 'rbutil/rbutilqt/configure.cpp')
-rw-r--r-- | rbutil/rbutilqt/configure.cpp | 54 |
1 files changed, 30 insertions, 24 deletions
diff --git a/rbutil/rbutilqt/configure.cpp b/rbutil/rbutilqt/configure.cpp index b34379641e..6b784a6383 100644 --- a/rbutil/rbutilqt/configure.cpp +++ b/rbutil/rbutilqt/configure.cpp | |||
@@ -33,8 +33,8 @@ | |||
33 | #include "system.h" | 33 | #include "system.h" |
34 | #include "encttscfggui.h" | 34 | #include "encttscfggui.h" |
35 | #include "rbsettings.h" | 35 | #include "rbsettings.h" |
36 | #include "serverinfo.h" | ||
37 | #include "systeminfo.h" | 36 | #include "systeminfo.h" |
37 | #include "playerbuildinfo.h" | ||
38 | #include "utils.h" | 38 | #include "utils.h" |
39 | #include "comboboxviewdelegate.h" | 39 | #include "comboboxviewdelegate.h" |
40 | #if defined(Q_OS_WIN32) | 40 | #if defined(Q_OS_WIN32) |
@@ -355,8 +355,8 @@ void Config::setDevices() | |||
355 | QMultiMap <QString, QString> manuf; | 355 | QMultiMap <QString, QString> manuf; |
356 | for(int it = 0; it < platformList.size(); it++) | 356 | for(int it = 0; it < platformList.size(); it++) |
357 | { | 357 | { |
358 | QString curbrand = SystemInfo::platformValue( | 358 | QString curbrand = PlayerBuildInfo::instance()->value( |
359 | SystemInfo::Brand, platformList.at(it)).toString(); | 359 | PlayerBuildInfo::Brand, platformList.at(it)).toString(); |
360 | manuf.insert(curbrand, platformList.at(it)); | 360 | manuf.insert(curbrand, platformList.at(it)); |
361 | } | 361 | } |
362 | 362 | ||
@@ -384,9 +384,10 @@ void Config::setDevices() | |||
384 | if(!manuf.values(brands.at(c)).contains(platformList.at(it))) | 384 | if(!manuf.values(brands.at(c)).contains(platformList.at(it))) |
385 | continue; | 385 | continue; |
386 | // construct display name | 386 | // construct display name |
387 | QString curname = SystemInfo::platformValue( | 387 | QString curname = QString("%1 (%2)").arg( |
388 | SystemInfo::Name, platformList.at(it)).toString() | 388 | PlayerBuildInfo::instance()->value(PlayerBuildInfo::DisplayName, |
389 | + " (" + ServerInfo::instance()->statusAsString(platformList.at(it)) + ")"; | 389 | platformList.at(it)).toString(), |
390 | PlayerBuildInfo::instance()->statusAsString(platformList.at(it))); | ||
390 | LOG_INFO() << "add supported device:" << brands.at(c) << curname; | 391 | LOG_INFO() << "add supported device:" << brands.at(c) << curname; |
391 | w2 = new QTreeWidgetItem(w, QStringList(curname)); | 392 | w2 = new QTreeWidgetItem(w, QStringList(curname)); |
392 | w2->setData(0, Qt::UserRole, platformList.at(it)); | 393 | w2->setData(0, Qt::UserRole, platformList.at(it)); |
@@ -470,10 +471,10 @@ void Config::updateEncState() | |||
470 | return; | 471 | return; |
471 | 472 | ||
472 | QString devname = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString(); | 473 | QString devname = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString(); |
473 | QString encoder = SystemInfo::platformValue( | 474 | QString encoder = PlayerBuildInfo::instance()->value( |
474 | SystemInfo::Encoder, devname).toString(); | 475 | PlayerBuildInfo::Encoder, devname).toString(); |
475 | ui.encoderName->setText(EncoderBase::getEncoderName(SystemInfo::platformValue( | 476 | ui.encoderName->setText(EncoderBase::getEncoderName( |
476 | SystemInfo::Encoder, devname).toString())); | 477 | PlayerBuildInfo::instance()->value(PlayerBuildInfo::Encoder, devname).toString())); |
477 | 478 | ||
478 | EncoderBase* enc = EncoderBase::getEncoder(this,encoder); | 479 | EncoderBase* enc = EncoderBase::getEncoder(this,encoder); |
479 | 480 | ||
@@ -741,8 +742,9 @@ void Config::autodetect() | |||
741 | mp = tr("(unknown)"); | 742 | mp = tr("(unknown)"); |
742 | } | 743 | } |
743 | msg += QString("<li>%1</li>").arg(tr("%1 at %2").arg( | 744 | msg += QString("<li>%1</li>").arg(tr("%1 at %2").arg( |
744 | SystemInfo::platformValue( | 745 | PlayerBuildInfo::instance()->value( |
745 | SystemInfo::Name, detected.at(i).device).toString(), | 746 | PlayerBuildInfo::DisplayName, |
747 | detected.at(i).device).toString(), | ||
746 | QDir::toNativeSeparators(mp))); | 748 | QDir::toNativeSeparators(mp))); |
747 | } | 749 | } |
748 | msg += "</ul>"; | 750 | msg += "</ul>"; |
@@ -767,22 +769,25 @@ void Config::autodetect() | |||
767 | case Autodetection::PlayerIncompatible: | 769 | case Autodetection::PlayerIncompatible: |
768 | msg += tr("Detected an unsupported player:\n%1\n" | 770 | msg += tr("Detected an unsupported player:\n%1\n" |
769 | "Sorry, Rockbox doesn't run on your player.") | 771 | "Sorry, Rockbox doesn't run on your player.") |
770 | .arg(SystemInfo::platformValue( | 772 | .arg(PlayerBuildInfo::instance()->value( |
771 | SystemInfo::Name, detected.at(0).device).toString()); | 773 | PlayerBuildInfo::DisplayName, |
774 | detected.at(0).device).toString()); | ||
772 | break; | 775 | break; |
773 | case Autodetection::PlayerMtpMode: | 776 | case Autodetection::PlayerMtpMode: |
774 | msg = tr("%1 in MTP mode found!\n" | 777 | msg = tr("%1 in MTP mode found!\n" |
775 | "You need to change your player to MSC mode for installation. ") | 778 | "You need to change your player to MSC mode for installation. ") |
776 | .arg(SystemInfo::platformValue( | 779 | .arg(PlayerBuildInfo::instance()->value( |
777 | SystemInfo::Name, detected.at(0).device).toString()); | 780 | PlayerBuildInfo::DisplayName, |
781 | detected.at(0).device).toString()); | ||
778 | break; | 782 | break; |
779 | case Autodetection::PlayerWrongFilesystem: | 783 | case Autodetection::PlayerWrongFilesystem: |
780 | if(SystemInfo::platformValue( | 784 | if(PlayerBuildInfo::instance()->value( |
781 | SystemInfo::BootloaderMethod, detected.at(0).device) == "ipod") { | 785 | PlayerBuildInfo::BootloaderMethod, detected.at(0).device) == "ipod") { |
782 | msg = tr("%1 \"MacPod\" found!\n" | 786 | msg = tr("%1 \"MacPod\" found!\n" |
783 | "Rockbox needs a FAT formatted Ipod (so-called \"WinPod\") " | 787 | "Rockbox needs a FAT formatted Ipod (so-called \"WinPod\") " |
784 | "to run. ").arg(SystemInfo::platformValue( | 788 | "to run. ").arg(PlayerBuildInfo::instance()->value( |
785 | SystemInfo::Name, detected.at(0).device).toString()); | 789 | PlayerBuildInfo::DisplayName, |
790 | detected.at(0).device).toString()); | ||
786 | } | 791 | } |
787 | else { | 792 | else { |
788 | msg = tr("The player contains an incompatible filesystem.\n" | 793 | msg = tr("The player contains an incompatible filesystem.\n" |
@@ -961,10 +966,11 @@ void Config::configEnc() | |||
961 | return; | 966 | return; |
962 | 967 | ||
963 | QString devname = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString(); | 968 | QString devname = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString(); |
964 | QString encoder = SystemInfo::platformValue( | 969 | QString encoder = PlayerBuildInfo::instance()->value( |
965 | SystemInfo::Encoder, devname).toString(); | 970 | PlayerBuildInfo::Encoder, devname).toString(); |
966 | ui.encoderName->setText(EncoderBase::getEncoderName(SystemInfo::platformValue( | 971 | ui.encoderName->setText( |
967 | SystemInfo::Encoder, devname).toString())); | 972 | EncoderBase::getEncoderName(PlayerBuildInfo::instance()->value( |
973 | PlayerBuildInfo::Encoder, devname).toString())); | ||
968 | 974 | ||
969 | 975 | ||
970 | EncoderBase* enc = EncoderBase::getEncoder(this,encoder); | 976 | EncoderBase* enc = EncoderBase::getEncoder(this,encoder); |