X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fdialogs%2Fsettings.cpp;h=bc6688c22a40dafb7f9a86c903516b524de44fb3;hp=f0752c0704ef63312ba9114f0649d8b7f954a6c3;hb=4971985821bf983a56a8e6399a8609f0e4dacbe7;hpb=fb64180193664005567570724d52b685913e15ed diff --git a/pv/dialogs/settings.cpp b/pv/dialogs/settings.cpp index f0752c07..bc6688c2 100644 --- a/pv/dialogs/settings.cpp +++ b/pv/dialogs/settings.cpp @@ -20,7 +20,6 @@ #include "config.h" #include -#include #include #include @@ -43,6 +42,7 @@ #include "settings.hpp" +#include "pv/application.hpp" #include "pv/devicemanager.hpp" #include "pv/globalsettings.hpp" #include "pv/logging.hpp" @@ -318,167 +318,74 @@ QWidget *Settings::get_decoder_settings_form(QWidget *parent) #endif } -#ifdef ENABLE_DECODE -static gint sort_pds(gconstpointer a, gconstpointer b) -{ - const struct srd_decoder *sda, *sdb; - - sda = (const struct srd_decoder *)a; - sdb = (const struct srd_decoder *)b; - return strcmp(sda->id, sdb->id); -} -#endif - QWidget *Settings::get_about_page(QWidget *parent) const { -#ifdef ENABLE_DECODE - struct srd_decoder *dec; -#endif + Application* a = qobject_cast(QApplication::instance()); QLabel *icon = new QLabel(); icon->setPixmap(QPixmap(QString::fromUtf8(":/icons/pulseview.svg"))); - /* Setup the license field, with the project homepage link. */ + // Setup the license field with the project homepage link QLabel *gpl_home_info = new QLabel(); gpl_home_info->setText(tr("%1
%2").arg( tr("GNU GPL, version 3 or later"), QApplication::organizationDomain())); gpl_home_info->setOpenExternalLinks(true); - shared_ptr context = device_manager_.context(); - QString s; s.append(""); s.append(""); - /* Version, library, and feature info */ s.append(""); - - s.append(QString("") - .arg(QApplication::applicationName(), - QApplication::applicationVersion())); - s.append(QString("") - .arg(QString("Qt"), qVersion())); - s.append(QString("") - .arg(QString("glibmm"), PV_GLIBMM_VERSION)); - s.append(QString("") - .arg(QString("Boost"), BOOST_LIB_VERSION)); - - s.append(QString("") - .arg(QString("libsigrok"), SR_PACKAGE_VERSION_STRING, - SR_LIB_VERSION_STRING, sr_package_version_string_get(), - sr_lib_version_string_get())); - - GSList *l_orig = sr_buildinfo_libs_get(); - for (GSList *l = l_orig; l; l = l->next) { - GSList *m = (GSList *)l->data; - const char *lib = (const char *)m->data; - const char *version = (const char *)m->next->data; - s.append(QString("") - .arg(QString(lib), QString(version))); - g_slist_free_full(m, g_free); - } - g_slist_free(l_orig); - - char *host = sr_buildinfo_host_get(); - s.append(QString("") - .arg(QString(host))); - g_free(host); - - char *scpi_backends = sr_buildinfo_scpi_backends_get(); - s.append(QString("") - .arg(QString(scpi_backends))); - g_free(scpi_backends); - -#ifdef ENABLE_DECODE - s.append(QString("") - .arg(QString("libsigrokdecode"), SRD_PACKAGE_VERSION_STRING, - SRD_LIB_VERSION_STRING, srd_package_version_string_get(), - srd_lib_version_string_get())); - - l_orig = srd_buildinfo_libs_get(); - for (GSList *l = l_orig; l; l = l->next) { - GSList *m = (GSList *)l->data; - const char *lib = (const char *)m->data; - const char *version = (const char *)m->next->data; - s.append(QString("") - .arg(QString(lib), QString(version))); - g_slist_free_full(m, g_free); - } - g_slist_free(l_orig); - - host = srd_buildinfo_host_get(); - s.append(QString("") - .arg(QString(host))); - g_free(host); -#endif + for (pair &entry : a->get_version_info()) + s.append(QString("") + .arg(entry.first, entry.second)); s.append(""); s.append(""); - - l_orig = sr_resourcepaths_get(SR_RESOURCE_FIRMWARE); - for (GSList *l = l_orig; l; l = l->next) - s.append(QString("").arg( - QString((char*)l->data))); - g_slist_free_full(l_orig, g_free); + for (QString &entry : a->get_fw_path_list()) + s.append(QString("").arg(entry)); #ifdef ENABLE_DECODE s.append(""); s.append(""); - - l_orig = srd_searchpaths_get(); - for (GSList *l = l_orig; l; l = l->next) - s.append(QString("").arg( - QString((char*)l->data))); - g_slist_free_full(l_orig, g_free); + for (QString &entry : a->get_pd_path_list()) + s.append(QString("").arg(entry)); #endif - /* Set up the supported field */ s.append(""); s.append(""); - for (auto entry : context->drivers()) { + for (pair &entry : a->get_driver_list()) s.append(QString("") - .arg(QString::fromUtf8(entry.first.c_str()), - QString::fromUtf8(entry.second->long_name().c_str()))); - } + .arg(entry.first, entry.second)); s.append(""); s.append(""); - for (auto entry : context->input_formats()) { + for (pair &entry : a->get_input_format_list()) s.append(QString("") - .arg(QString::fromUtf8(entry.first.c_str()), - QString::fromUtf8(entry.second->description().c_str()))); - } + .arg(entry.first, entry.second)); s.append(""); s.append(""); - for (auto entry : context->output_formats()) { + for (pair &entry : a->get_output_format_list()) s.append(QString("") - .arg(QString::fromUtf8(entry.first.c_str()), - QString::fromUtf8(entry.second->description().c_str()))); - } + .arg(entry.first, entry.second)); #ifdef ENABLE_DECODE s.append(""); s.append(""); - GSList *sl = g_slist_copy((GSList *)srd_decoder_list()); - sl = g_slist_sort(sl, sort_pds); - for (const GSList *l = sl; l; l = l->next) { - dec = (struct srd_decoder *)l->data; + for (pair &entry : a->get_pd_list()) s.append(QString("") - .arg(QString::fromUtf8(dec->id), - QString::fromUtf8(dec->longname))); - } - g_slist_free(sl); + .arg(entry.first, entry.second)); #endif s.append("
" + tr("Versions, libraries and features:") + "
%1%2
%1%2
%1%2
%1%2
%1%2/%3 (rt: %4/%5)
- %1%2
- Host%1
- SCPI backends%1
%1%2/%3 (rt: %4/%5)
- %1%2
- Host%1
%1%2
" + tr("Firmware search paths:") + "
%1
%1
" + tr("Protocol decoder search paths:") + "
%1
%1
" + tr("Supported hardware drivers:") + "
%1%2
" + tr("Supported input formats:") + "
%1%2
" + tr("Supported output formats:") + "
%1%2
" + tr("Supported protocol decoders:") + "
%1%2
");