Save/restore view type
authorSoeren Apel <soeren@apelpie.net>
Wed, 27 Nov 2019 20:06:54 +0000 (21:06 +0100)
committerSoeren Apel <soeren@apelpie.net>
Wed, 27 Nov 2019 20:06:54 +0000 (21:06 +0100)
pv/session.cpp
pv/views/decoder_output/view.cpp
pv/views/decoder_output/view.hpp
pv/views/trace/view.cpp
pv/views/trace/view.hpp
pv/views/viewbase.hpp

index 39b1fb354fff6d10f0320e3f47708af7154f2adb..79c32947e1f619b43895516d0fb1b0820bdc349e 100644 (file)
@@ -218,6 +218,7 @@ void Session::save_setup(QSettings &settings) const
        for (const shared_ptr<views::ViewBase>& view : views_) {
                if (view != main_view_) {
                        settings.beginGroup("view" + QString::number(views++));
+                       settings.setValue("type", view->get_type());
                        view->save_settings(settings);
                        settings.endGroup();
                }
index 28fe907ece0614b50cc961cdfe16ae706fbb3299..8da1e84ae73499c506cff31e3bbf63e5d7c69e39 100644 (file)
@@ -57,6 +57,11 @@ View::~View()
 {
 }
 
+ViewType View::get_type() const
+{
+       return ViewTypeDecoderOutput;
+}
+
 void View::reset_view_state()
 {
        ViewBase::reset_view_state();
index a4db819e50f1f883fbaf38f67f7c509b70f23a3d..79dfe234aac4751827d233352a8528328cf1761f 100644 (file)
@@ -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.
index 8c2b37b85874d09cf884e6456b7d98e565ac76e3..a3861d1f99afba820d2f7ce1e7efc0339f4e9a37 100644 (file)
@@ -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();
index b0cf02603d53a22a38f758fe54af8b37e7b5093a..0ba23bb6cb4d8af09e48b3637a4a38b9b6e4ff85 100644 (file)
@@ -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.
index 3d43ca9a12bc6d3277f92ee7805da0e851f1584f..7f0a17fd004c59d3041e380a73b6bd829379e843 100644 (file)
@@ -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.