X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fdialogs%2Fsettings.cpp;h=f2f9e2692a753624b2750a5771405a7bce038660;hp=214ac9cf26e862aefd4208a4da84d685709d2655;hb=edfe64fd633d83ea30cf4f61de9fdff0dcbc398e;hpb=e6d42eec32b61b6831b7926a9d6a5cd03d1f3430 diff --git a/pv/dialogs/settings.cpp b/pv/dialogs/settings.cpp index 214ac9cf..f2f9e269 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 @@ -40,6 +45,8 @@ #include #endif +using std::shared_ptr; + namespace pv { namespace dialogs { @@ -55,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; @@ -133,9 +140,30 @@ QWidget *Settings::get_view_settings_form(QWidget *parent) const connect(sticky_scrolling_cb, SIGNAL(stateChanged(int)), this, SLOT(on_view_stickyScrolling_changed(int))); trace_view_layout->addRow(tr("Always keep &newest samples at the right edge during capture"), sticky_scrolling_cb); + QCheckBox *show_sampling_points_cb = new QCheckBox(); + show_sampling_points_cb->setChecked(settings.value(GlobalSettings::Key_View_ShowSamplingPoints).toBool()); + 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 @@ -154,49 +182,115 @@ QWidget *Settings::get_about_page(QWidget *parent) const QApplication::organizationDomain())); version_info->setOpenExternalLinks(true); - std::shared_ptr context = device_manager_.context(); + 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(""); 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(""); 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(""); 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(""); 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
"); @@ -260,6 +354,17 @@ void Settings::on_view_stickyScrolling_changed(int state) settings.setValue(GlobalSettings::Key_View_StickyScrolling, state ? true : false); } +void Settings::on_view_showSamplingPoints_changed(int state) +{ + GlobalSettings settings; + 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