X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fdialogs%2Fsettings.cpp;h=5e2be818c34c60f3634c976f503a12c635728764;hp=cf4757336e333044b053895ef916332ad05718dd;hb=0f5e2c7db1dc3e86ac741e8c1c89cce6202b43cc;hpb=6f925ba9d6faf1077b73c5a5808259576081716a diff --git a/pv/dialogs/settings.cpp b/pv/dialogs/settings.cpp index cf475733..5e2be818 100644 --- a/pv/dialogs/settings.cpp +++ b/pv/dialogs/settings.cpp @@ -17,6 +17,11 @@ * along with this program; if not, see . */ +#include "config.h" + +#include +#include + #include #include #include @@ -57,7 +62,7 @@ Settings::Settings(DeviceManager &device_manager, QWidget *parent) : page_list->setViewMode(QListView::IconMode); page_list->setIconSize(QSize(icon_size, icon_size)); page_list->setMovement(QListView::Static); - page_list->setMaximumWidth(icon_size + icon_size/2); + page_list->setMaximumWidth(icon_size + (icon_size / 2)); page_list->setSpacing(12); pages = new QStackedWidget; @@ -140,9 +145,25 @@ QWidget *Settings::get_view_settings_form(QWidget *parent) const connect(show_sampling_points_cb, SIGNAL(stateChanged(int)), this, SLOT(on_view_showSamplingPoints_changed(int))); trace_view_layout->addRow(tr("Show data &sampling points"), show_sampling_points_cb); + QCheckBox *show_analog_minor_grid_cb = new QCheckBox(); + show_analog_minor_grid_cb->setChecked(settings.value(GlobalSettings::Key_View_ShowAnalogMinorGrid).toBool()); + connect(show_analog_minor_grid_cb, SIGNAL(stateChanged(int)), this, SLOT(on_view_showAnalogMinorGrid_changed(int))); + trace_view_layout->addRow(tr("Show analog minor grid in addition to vdiv grid"), show_analog_minor_grid_cb); + return form; } +#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 @@ -164,46 +185,108 @@ QWidget *Settings::get_about_page(QWidget *parent) const shared_ptr context = device_manager_.context(); QString s; + + s.append(""); + s.append(""); + /* Library info */ + s.append(""); + + 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 + /* Set up the supported field */ s.append(""); + tr("Supported hardware drivers:") + ""); for (auto entry : context->drivers()) { - s.append(QString("") + s.append(QString("") .arg(QString::fromUtf8(entry.first.c_str()), QString::fromUtf8(entry.second->long_name().c_str()))); } s.append(""); + tr("Supported input formats:") + ""); for (auto entry : context->input_formats()) { - s.append(QString("") + s.append(QString("") .arg(QString::fromUtf8(entry.first.c_str()), QString::fromUtf8(entry.second->description().c_str()))); } s.append(""); + tr("Supported output formats:") + ""); for (auto entry : context->output_formats()) { - s.append(QString("") + s.append(QString("") .arg(QString::fromUtf8(entry.first.c_str()), QString::fromUtf8(entry.second->description().c_str()))); } #ifdef ENABLE_DECODE s.append(""); - for (const GSList *l = srd_decoder_list(); l; l = l->next) { + tr("Supported protocol decoders:") + ""); + 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; - s.append(QString("") + s.append(QString("") .arg(QString::fromUtf8(dec->id), QString::fromUtf8(dec->longname))); } + g_slist_free(sl); #endif s.append("
" + + tr("Libraries and features:") + "
%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
" + - tr("Supported hardware drivers:") + - "
%1%2
%1%2
" + - tr("Supported input formats:") + - "
%1%2
%1%2
" + - tr("Supported output formats:") + - "
%1%2
%1%2
" + - tr("Supported protocol decoders:") + - "
%1%2
%1%2
"); @@ -273,5 +356,11 @@ void Settings::on_view_showSamplingPoints_changed(int state) settings.setValue(GlobalSettings::Key_View_ShowSamplingPoints, state ? true : false); } +void Settings::on_view_showAnalogMinorGrid_changed(int state) +{ + GlobalSettings settings; + settings.setValue(GlobalSettings::Key_View_ShowAnalogMinorGrid, state ? true : false); +} + } // namespace dialogs } // namespace pv