QWidget *Settings::get_general_settings_form(QWidget *parent) const
{
GlobalSettings settings;
+ QCheckBox *cb;
QWidget *form = new QWidget(parent);
QVBoxLayout *form_layout = new QVBoxLayout(form);
description_2->setAlignment(Qt::AlignRight);
general_layout->addRow(description_2);
+ cb = create_checkbox(GlobalSettings::Key_General_SaveWithSetup,
+ SLOT(on_general_save_with_setup_changed(int)));
+ general_layout->addRow(tr("Save session &setup along with .sr file"), cb);
+
return form;
}
settings.apply_theme();
}
+void Settings::on_general_save_with_setup_changed(int state)
+{
+ GlobalSettings settings;
+ settings.setValue(GlobalSettings::Key_General_SaveWithSetup, state ? true : false);
+}
+
void Settings::on_view_zoomToFitDuringAcq_changed(int state)
{
GlobalSettings settings;
void on_page_changed(QListWidgetItem *current, QListWidgetItem *previous);
void on_general_theme_changed_changed(int state);
void on_general_style_changed(int state);
+ void on_general_save_with_setup_changed(int state);
void on_view_zoomToFitDuringAcq_changed(int state);
void on_view_zoomToFitAfterAcq_changed(int state);
void on_view_triggerIsZero_changed(int state);
const QString GlobalSettings::Key_General_Theme = "General_Theme";
const QString GlobalSettings::Key_General_Style = "General_Style";
+const QString GlobalSettings::Key_General_SaveWithSetup = "General_SaveWithSetup";
const QString GlobalSettings::Key_View_ZoomToFitDuringAcq = "View_ZoomToFitDuringAcq";
const QString GlobalSettings::Key_View_ZoomToFitAfterAcq = "View_ZoomToFitAfterAcq";
const QString GlobalSettings::Key_View_TriggerIsZeroTime = "View_TriggerIsZeroTime";
if (!contains(Key_General_Style))
setValue(Key_General_Style, "");
+ // Save setup with .sr files by default
+ if (!contains(Key_General_SaveWithSetup))
+ setValue(Key_General_SaveWithSetup, true);
+
// Enable zoom-to-fit after acquisition by default
if (!contains(Key_View_ZoomToFitAfterAcq))
setValue(Key_View_ZoomToFitAfterAcq, true);
public:
static const QString Key_General_Theme;
static const QString Key_General_Style;
+ static const QString Key_General_SaveWithSetup;
static const QString Key_View_ZoomToFitDuringAcq;
static const QString Key_View_ZoomToFitAfterAcq;
static const QString Key_View_TriggerIsZeroTime;
return;
}
+ // Auto-load the setup if one exists
+ QString setup_file_name = file_name;
+ setup_file_name.truncate(setup_file_name.lastIndexOf('.'));
+ setup_file_name.append(".pvs");
+ if (QFileInfo::exists(setup_file_name) && QFileInfo(setup_file_name).isReadable()) {
+ QSettings settings_storage(setup_file_name, QSettings::IniFormat);
+ restore_setup(settings_storage);
+ }
+
main_bar_->update_device_list();
start_capture([&, errorMessage](QString infoMessage) {
#include "storesession.hpp"
+#include <QSettings>
+
#include <pv/data/analog.hpp>
#include <pv/data/analogsegment.hpp>
#include <pv/data/logic.hpp>
#include <pv/data/signalbase.hpp>
#include <pv/devicemanager.hpp>
#include <pv/devices/device.hpp>
+#include <pv/globalsettings.hpp>
#include <pv/session.hpp>
#include <libsigrokcxx/libsigrokcxx.hpp>
thread_ = std::thread(&StoreSession::store_proc, this,
achannel_list, asegment_list, lsegment);
+
+ // Save session setup if we're saving to srzip and the user wants it
+ GlobalSettings settings;
+ bool save_with_setup = settings.value(GlobalSettings::Key_General_SaveWithSetup).toBool();
+
+ if ((output_format_->name() == "srzip") && (save_with_setup)) {
+ QString setup_file_name = QString::fromStdString(file_name_);
+ setup_file_name.truncate(setup_file_name.lastIndexOf('.'));
+ setup_file_name.append(".pvs");
+
+ QSettings settings_storage(setup_file_name, QSettings::IniFormat);
+ session_.save_setup(settings_storage);
+ }
+
return true;
}