]> sigrok.org Git - pulseview.git/commitdiff
Trace view: Add setting to keep ruler item selected
authorSoeren Apel <redacted>
Wed, 18 Oct 2023 23:19:55 +0000 (01:19 +0200)
committerSoeren Apel <redacted>
Wed, 18 Oct 2023 23:19:55 +0000 (01:19 +0200)
pv/dialogs/settings.cpp
pv/dialogs/settings.hpp
pv/globalsettings.cpp
pv/globalsettings.hpp
pv/views/trace/timemarker.cpp

index 1c8a161184f34daf8a6e7e48bd379c92a6b929e6..55b7e826291eb69f057025582febef7b65c319be 100644 (file)
@@ -351,6 +351,10 @@ QWidget *Settings::get_view_settings_form(QWidget *parent) const
                SLOT(on_view_showHoverMarker_changed(int)));
        trace_view_layout->addRow(tr("Highlight mouse cursor using a vertical marker line"), cb);
 
+       cb = create_checkbox(GlobalSettings::Key_View_KeepRulerItemSelected,
+               SLOT(on_view_keepRulerItemSelected_changed(int)));
+       trace_view_layout->addRow(tr("Keep active item on ruler selected when editing popup is closed"), cb);
+
        QSpinBox *snap_distance_sb = new QSpinBox();
        snap_distance_sb->setRange(0, 1000);
        snap_distance_sb->setSuffix(tr(" pixels"));
@@ -765,6 +769,12 @@ void Settings::on_view_showHoverMarker_changed(int state)
        settings.setValue(GlobalSettings::Key_View_ShowHoverMarker, state ? true : false);
 }
 
+void Settings::on_view_keepRulerItemSelected_changed(int state)
+{
+       GlobalSettings settings;
+       settings.setValue(GlobalSettings::Key_View_KeepRulerItemSelected, state ? true : false);
+}
+
 void Settings::on_view_snapDistance_changed(int value)
 {
        GlobalSettings settings;
index c8ba8162e03a4c03313e72515e01ff08ccfe71cd..bd3572ff977620daeff29968a9fc50a163312543 100644 (file)
@@ -74,6 +74,7 @@ private Q_SLOTS:
        void on_view_fillSignalHighAreaColor_changed(QColor color);
        void on_view_showAnalogMinorGrid_changed(int state);
        void on_view_showHoverMarker_changed(int state);
+       void on_view_keepRulerItemSelected_changed(int state);
        void on_view_snapDistance_changed(int value);
        void on_view_cursorFillColor_changed(QColor color);
        void on_view_conversionThresholdDispMode_changed(int state);
index 6239374778a4886af74cf2bc13f1120d17bb3dd4..ecca21d5216ed534ef433f0b95740cb14cd34f0b 100644 (file)
@@ -67,6 +67,7 @@ const QString GlobalSettings::Key_View_ConversionThresholdDispMode = "View_Conve
 const QString GlobalSettings::Key_View_DefaultDivHeight = "View_DefaultDivHeight";
 const QString GlobalSettings::Key_View_DefaultLogicHeight = "View_DefaultLogicHeight";
 const QString GlobalSettings::Key_View_ShowHoverMarker = "View_ShowHoverMarker";
+const QString GlobalSettings::Key_View_KeepRulerItemSelected = "View_KeepRulerItemSelected";
 const QString GlobalSettings::Key_View_SnapDistance = "View_SnapDistance";
 const QString GlobalSettings::Key_View_CursorFillColor = "View_CursorFillColor";
 const QString GlobalSettings::Key_View_CursorShowFrequency = "View_CursorShowFrequency";
@@ -152,6 +153,9 @@ void GlobalSettings::set_defaults_where_needed()
        if (!contains(Key_View_ShowHoverMarker))
                setValue(Key_View_ShowHoverMarker, true);
 
+       if (!contains(Key_View_KeepRulerItemSelected))
+               setValue(Key_View_KeepRulerItemSelected, false);
+
        if (!contains(Key_View_SnapDistance))
                setValue(Key_View_SnapDistance, 15);
 
index 67922d7a696c0c032450c634e9230772add3ba77..f6239a6b3d089f726cea54afd1bffaf3f211b14a 100644 (file)
@@ -72,6 +72,7 @@ public:
        static const QString Key_View_DefaultDivHeight;
        static const QString Key_View_DefaultLogicHeight;
        static const QString Key_View_ShowHoverMarker;
+       static const QString Key_View_KeepRulerItemSelected;
        static const QString Key_View_SnapDistance;
        static const QString Key_View_CursorFillColor;
        static const QString Key_View_CursorShowInterval;
index 063e579a6cc3dd73567e85e490b17d73abb4b6be..0f390f528004858f3a835fcb781bc5d1ad332b18 100644 (file)
@@ -202,7 +202,9 @@ pv::widgets::Popup* TimeMarker::create_popup(QWidget *parent)
 
 void TimeMarker::on_popup_closed()
 {
-       select(false);
+       GlobalSettings settings;
+       if (!settings.value(GlobalSettings::Key_View_KeepRulerItemSelected).toBool())
+               select(false);
 }
 
 void TimeMarker::on_value_changed(const pv::util::Timestamp& value)