@@ -98,6 +102,17 @@ void Settings::create_pages()
viewButton->setTextAlignment(Qt::AlignHCenter);
viewButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
+#ifdef ENABLE_DECODE
+ // Decoder page
+ pages->addWidget(get_decoder_settings_form(pages));
+
+ QListWidgetItem *decoderButton = new QListWidgetItem(page_list);
+ decoderButton->setIcon(QIcon(":/icons/add-decoder.svg"));
+ decoderButton->setText(tr("Decoders"));
+ decoderButton->setTextAlignment(Qt::AlignHCenter);
+ decoderButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
+#endif
+
// About page
pages->addWidget(get_about_page(pages));
@@ -108,9 +123,20 @@ void Settings::create_pages()
aboutButton->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
}
+QCheckBox *Settings::create_checkbox(const QString& key, const char* slot) const
+{
+ GlobalSettings settings;
+
+ QCheckBox *cb = new QCheckBox();
+ cb->setChecked(settings.value(key).toBool());
+ connect(cb, SIGNAL(stateChanged(int)), this, slot);
+ return cb;
+}
+
QWidget *Settings::get_view_settings_form(QWidget *parent) const
{
GlobalSettings settings;
+ QCheckBox *cb;
QWidget *form = new QWidget(parent);
QVBoxLayout *form_layout = new QVBoxLayout(form);
@@ -122,32 +148,89 @@ QWidget *Settings::get_view_settings_form(QWidget *parent) const
QFormLayout *trace_view_layout = new QFormLayout();
trace_view_group->setLayout(trace_view_layout);
- QCheckBox *coloured_bg_cb = new QCheckBox();
- coloured_bg_cb->setChecked(settings.value(GlobalSettings::Key_View_ColouredBG).toBool());
- connect(coloured_bg_cb, SIGNAL(stateChanged(int)), this, SLOT(on_view_colouredBG_changed(int)));
- trace_view_layout->addRow(tr("Use coloured trace &background"), coloured_bg_cb);
+ cb = create_checkbox(GlobalSettings::Key_View_ColouredBG,
+ SLOT(on_view_colouredBG_changed(int)));
+ trace_view_layout->addRow(tr("Use coloured trace &background"), cb);
+
+ cb = create_checkbox(GlobalSettings::Key_View_ZoomToFitDuringAcq,
+ SLOT(on_view_zoomToFitDuringAcq_changed(int)));
+ trace_view_layout->addRow(tr("Constantly perform &zoom-to-fit during acquisition"), cb);
+
+ cb = create_checkbox(GlobalSettings::Key_View_ZoomToFitAfterAcq,
+ SLOT(on_view_zoomToFitAfterAcq_changed(int)));
+ trace_view_layout->addRow(tr("Perform a zoom-to-&fit when acquisition stops"), cb);
+
+ cb = create_checkbox(GlobalSettings::Key_View_TriggerIsZeroTime,
+ SLOT(on_view_triggerIsZero_changed(int)));
+ trace_view_layout->addRow(tr("Show time zero at the trigger"), cb);
+
+ cb = create_checkbox(GlobalSettings::Key_View_StickyScrolling,
+ SLOT(on_view_stickyScrolling_changed(int)));
+ trace_view_layout->addRow(tr("Always keep &newest samples at the right edge during capture"), cb);
+
+ cb = create_checkbox(GlobalSettings::Key_View_ShowSamplingPoints,
+ SLOT(on_view_showSamplingPoints_changed(int)));
+ trace_view_layout->addRow(tr("Show data &sampling points"), cb);
+
+ cb = create_checkbox(GlobalSettings::Key_View_ShowAnalogMinorGrid,
+ SLOT(on_view_showAnalogMinorGrid_changed(int)));
+ trace_view_layout->addRow(tr("Show analog minor grid in addition to div grid"), cb);
+
+ QComboBox *thr_disp_mode_cb = new QComboBox();
+ thr_disp_mode_cb->addItem(tr("None"), GlobalSettings::ConvThrDispMode_None);
+ thr_disp_mode_cb->addItem(tr("Background"), GlobalSettings::ConvThrDispMode_Background);
+ thr_disp_mode_cb->addItem(tr("Dots"), GlobalSettings::ConvThrDispMode_Dots);
+ thr_disp_mode_cb->setCurrentIndex(
+ settings.value(GlobalSettings::Key_View_ConversionThresholdDispMode).toInt());
+ connect(thr_disp_mode_cb, SIGNAL(currentIndexChanged(int)),
+ this, SLOT(on_view_conversionThresholdDispMode_changed(int)));
+ trace_view_layout->addRow(tr("Conversion threshold display mode (analog traces only)"), thr_disp_mode_cb);
+
+ QSpinBox *default_div_height_sb = new QSpinBox();
+ default_div_height_sb->setRange(20, 1000);
+ default_div_height_sb->setSuffix(tr(" pixels"));
+ default_div_height_sb->setValue(
+ settings.value(GlobalSettings::Key_View_DefaultDivHeight).toInt());
+ connect(default_div_height_sb, SIGNAL(valueChanged(int)), this,
+ SLOT(on_view_defaultDivHeight_changed(int)));
+ trace_view_layout->addRow(tr("Default analog trace div height"), default_div_height_sb);
+
+ QSpinBox *default_logic_height_sb = new QSpinBox();
+ default_logic_height_sb->setRange(5, 1000);
+ default_logic_height_sb->setSuffix(tr(" pixels"));
+ default_logic_height_sb->setValue(
+ settings.value(GlobalSettings::Key_View_DefaultLogicHeight).toInt());
+ connect(default_logic_height_sb, SIGNAL(valueChanged(int)), this,
+ SLOT(on_view_defaultLogicHeight_changed(int)));
+ trace_view_layout->addRow(tr("Default logic trace height"), default_logic_height_sb);
+
+ return form;
+}
+
+QWidget *Settings::get_decoder_settings_form(QWidget *parent) const
+{
+#ifdef ENABLE_DECODE
+ QCheckBox *cb;
- QCheckBox *always_zoom_to_fit_cb = new QCheckBox();
- always_zoom_to_fit_cb->setChecked(settings.value(GlobalSettings::Key_View_AlwaysZoomToFit).toBool());
- connect(always_zoom_to_fit_cb, SIGNAL(stateChanged(int)), this, SLOT(on_view_alwaysZoomToFit_changed(int)));
- trace_view_layout->addRow(tr("Constantly perform &zoom-to-fit during capture"), always_zoom_to_fit_cb);
+ QWidget *form = new QWidget(parent);
+ QVBoxLayout *form_layout = new QVBoxLayout(form);
- QCheckBox *sticky_scrolling_cb = new QCheckBox();
- sticky_scrolling_cb->setChecked(settings.value(GlobalSettings::Key_View_StickyScrolling).toBool());
- 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);
+ // Decoder settings
+ QGroupBox *decoder_group = new QGroupBox(tr("Decoders"));
+ form_layout->addWidget(decoder_group);
- 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);
+ QFormLayout *decoder_layout = new QFormLayout();
+ decoder_group->setLayout(decoder_layout);
- 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);
+ cb = create_checkbox(GlobalSettings::Key_Dec_InitialStateConfigurable,
+ SLOT(on_dec_initialStateConfigurable_changed(int)));
+ decoder_layout->addRow(tr("Allow configuration of &initial signal state"), cb);
return form;
+#else
+ (void)parent;
+ return nullptr;
+#endif
}
#ifdef ENABLE_DECODE
@@ -168,7 +251,7 @@ QWidget *Settings::get_about_page(QWidget *parent) const
#endif
QLabel *icon = new QLabel();
- icon->setPixmap(QPixmap(QString::fromUtf8(":/icons/sigrok-logo-notext.svg")));
+ icon->setPixmap(QPixmap(QString::fromUtf8(":/icons/pulseview.svg")));
/* Setup the version field */
QLabel *version_info = new QLabel();
@@ -190,10 +273,18 @@ QWidget *Settings::get_about_page(QWidget *parent) const
/* Library info */
s.append("" +
tr("Libraries and features:") + " |
");
+
s.append(QString("%1 | %2 |
")
.arg(QString("Qt"), qVersion()));
- s.append(QString("%1 | %2 (lib version %3) |
")
- .arg(QString("libsigrok"), sr_package_version_string_get(), sr_lib_version_string_get()));
+ s.append(QString("%1 | %2 |
")
+ .arg(QString("glibmm"), PV_GLIBMM_VERSION));
+ s.append(QString("%1 | %2 |
")
+ .arg(QString("Boost"), BOOST_LIB_VERSION));
+
+ s.append(QString("%1 | %2/%3 (rt: %4/%5) |
")
+ .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) {
@@ -217,11 +308,30 @@ QWidget *Settings::get_about_page(QWidget *parent) const
g_free(scpi_backends);
#ifdef ENABLE_DECODE
- s.append(QString("%1 | %2 (lib version %3) |
")
- .arg(QString("libsigrokdecode"), srd_package_version_string_get(), srd_lib_version_string_get()));
+ s.append(QString("%1 | %2/%3 (rt: %4/%5) |
")
+ .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("- %1 | %2 |
")
+ .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("- Host | %1 |
")
+ .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()) {
@@ -230,6 +340,7 @@ QWidget *Settings::get_about_page(QWidget *parent) const
QString::fromUtf8(entry.second->long_name().c_str())));
}
+ s.append(" |
");
s.append("" +
tr("Supported input formats:") + " |
");
for (auto entry : context->input_formats()) {
@@ -238,6 +349,7 @@ QWidget *Settings::get_about_page(QWidget *parent) const
QString::fromUtf8(entry.second->description().c_str())));
}
+ s.append(" |
");
s.append("" +
tr("Supported output formats:") + " |
");
for (auto entry : context->output_formats()) {
@@ -247,6 +359,7 @@ QWidget *Settings::get_about_page(QWidget *parent) const
}
#ifdef ENABLE_DECODE
+ s.append(" |
");
s.append("" +
tr("Supported protocol decoders:") + " |
");
GSList *sl = g_slist_copy((GSList *)srd_decoder_list());
@@ -303,10 +416,22 @@ void Settings::on_page_changed(QListWidgetItem *current, QListWidgetItem *previo
pages->setCurrentIndex(page_list->row(current));
}
-void Settings::on_view_alwaysZoomToFit_changed(int state)
+void Settings::on_view_zoomToFitDuringAcq_changed(int state)
{
GlobalSettings settings;
- settings.setValue(GlobalSettings::Key_View_AlwaysZoomToFit, state ? true : false);
+ settings.setValue(GlobalSettings::Key_View_ZoomToFitDuringAcq, state ? true : false);
+}
+
+void Settings::on_view_zoomToFitAfterAcq_changed(int state)
+{
+ GlobalSettings settings;
+ settings.setValue(GlobalSettings::Key_View_ZoomToFitAfterAcq, state ? true : false);
+}
+
+void Settings::on_view_triggerIsZero_changed(int state)
+{
+ GlobalSettings settings;
+ settings.setValue(GlobalSettings::Key_View_TriggerIsZeroTime, state ? true : false);
}
void Settings::on_view_colouredBG_changed(int state)
@@ -333,5 +458,29 @@ void Settings::on_view_showAnalogMinorGrid_changed(int state)
settings.setValue(GlobalSettings::Key_View_ShowAnalogMinorGrid, state ? true : false);
}
+void Settings::on_view_conversionThresholdDispMode_changed(int state)
+{
+ GlobalSettings settings;
+ settings.setValue(GlobalSettings::Key_View_ConversionThresholdDispMode, state);
+}
+
+void Settings::on_view_defaultDivHeight_changed(int value)
+{
+ GlobalSettings settings;
+ settings.setValue(GlobalSettings::Key_View_DefaultDivHeight, value);
+}
+
+void Settings::on_view_defaultLogicHeight_changed(int value)
+{
+ GlobalSettings settings;
+ settings.setValue(GlobalSettings::Key_View_DefaultLogicHeight, value);
+}
+
+void Settings::on_dec_initialStateConfigurable_changed(int state)
+{
+ GlobalSettings settings;
+ settings.setValue(GlobalSettings::Key_Dec_InitialStateConfigurable, state ? true : false);
+}
+
} // namespace dialogs
} // namespace pv