From: Soeren Apel Date: Wed, 27 Nov 2019 20:06:54 +0000 (+0100) Subject: Save/restore view type X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=commitdiff_plain;h=db29815836442ac83d453b3de2bf1755e9fd89f0 Save/restore view type --- diff --git a/pv/session.cpp b/pv/session.cpp index 39b1fb35..79c32947 100644 --- a/pv/session.cpp +++ b/pv/session.cpp @@ -218,6 +218,7 @@ void Session::save_setup(QSettings &settings) const for (const shared_ptr& view : views_) { if (view != main_view_) { settings.beginGroup("view" + QString::number(views++)); + settings.setValue("type", view->get_type()); view->save_settings(settings); settings.endGroup(); } diff --git a/pv/views/decoder_output/view.cpp b/pv/views/decoder_output/view.cpp index 28fe907e..8da1e84a 100644 --- a/pv/views/decoder_output/view.cpp +++ b/pv/views/decoder_output/view.cpp @@ -57,6 +57,11 @@ View::~View() { } +ViewType View::get_type() const +{ + return ViewTypeDecoderOutput; +} + void View::reset_view_state() { ViewBase::reset_view_state(); diff --git a/pv/views/decoder_output/view.hpp b/pv/views/decoder_output/view.hpp index a4db819e..79dfe234 100644 --- a/pv/views/decoder_output/view.hpp +++ b/pv/views/decoder_output/view.hpp @@ -39,6 +39,8 @@ public: ~View(); + virtual ViewType get_type() const; + /** * Resets the view to its default state after construction. It does however * not reset the signal bases or any other connections with the session. diff --git a/pv/views/trace/view.cpp b/pv/views/trace/view.cpp index 8c2b37b8..a3861d1f 100644 --- a/pv/views/trace/view.cpp +++ b/pv/views/trace/view.cpp @@ -244,6 +244,11 @@ View::~View() GlobalSettings::remove_change_handler(this); } +ViewType View::get_type() const +{ + return ViewTypeTrace; +} + void View::reset_view_state() { ViewBase::reset_view_state(); diff --git a/pv/views/trace/view.hpp b/pv/views/trace/view.hpp index b0cf0260..0ba23bb6 100644 --- a/pv/views/trace/view.hpp +++ b/pv/views/trace/view.hpp @@ -104,6 +104,8 @@ public: ~View(); + virtual ViewType get_type() const; + /** * Resets the view to its default state after construction. It does however * not reset the signal bases or any other connections with the session. diff --git a/pv/views/viewbase.hpp b/pv/views/viewbase.hpp index 3d43ca9a..7f0a17fd 100644 --- a/pv/views/viewbase.hpp +++ b/pv/views/viewbase.hpp @@ -72,6 +72,8 @@ private: public: explicit ViewBase(Session &session, bool is_main_view = false, QMainWindow *parent = nullptr); + virtual ViewType get_type() const = 0; + /** * Resets the view to its default state after construction. It does however * not reset the signal bases or any other connections with the session.