aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorMoshe Kaplan <mosheekaplan@gmail.com>2023-02-09 20:54:14 +0000
committerMartin Mathieson <martin.r.mathieson@googlemail.com>2023-02-09 20:54:14 +0000
commit9e1905f88dca42114d861292c5be2c39f280d55b (patch)
tree9c7443ab96823f339d89316021eb66f8e30b8b1f /ui
parent8812c5ed20b9f7548800d36d1f2edfad8e3567f2 (diff)
Preferences: Support configuring debounce timers
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/main_window_preferences_frame.cpp7
-rw-r--r--ui/qt/main_window_preferences_frame.h2
-rw-r--r--ui/qt/main_window_preferences_frame.ui18
-rw-r--r--ui/qt/preferences_dialog.cpp4
-rw-r--r--ui/qt/supported_protocols_dialog.cpp4
5 files changed, 33 insertions, 2 deletions
diff --git a/ui/qt/main_window_preferences_frame.cpp b/ui/qt/main_window_preferences_frame.cpp
index e7ad9ae7b0..9216ea92d8 100644
--- a/ui/qt/main_window_preferences_frame.cpp
+++ b/ui/qt/main_window_preferences_frame.cpp
@@ -39,6 +39,7 @@ MainWindowPreferencesFrame::MainWindowPreferencesFrame(QWidget *parent) :
pref_toolbar_main_style_ = prefFromPrefPtr(&prefs.gui_toolbar_main_style);
pref_window_title_ = prefFromPrefPtr(&prefs.gui_window_title);
pref_prepend_window_title_ = prefFromPrefPtr(&prefs.gui_prepend_window_title);
+ pref_debounce_timer_ = prefFromPrefPtr(&prefs.gui_debounce_timer);
QStyleOption style_opt;
QString indent_ss = QString(
@@ -136,6 +137,7 @@ void MainWindowPreferencesFrame::updateWidgets()
ui->windowTitle->setText(prefs_get_string_value(pref_window_title_, pref_stashed));
ui->prependWindowTitle->setText(prefs_get_string_value(pref_prepend_window_title_, pref_stashed));
+ ui->debounceTime->setText(QString::number(prefs_get_uint_value_real(pref_debounce_timer_, pref_stashed)));
}
void MainWindowPreferencesFrame::on_geometryCheckBox_toggled(bool checked)
@@ -219,3 +221,8 @@ void MainWindowPreferencesFrame::on_prependWindowTitle_textEdited(const QString
{
prefs_set_string_value(pref_prepend_window_title_, new_prefix.toStdString().c_str(), pref_stashed);
}
+
+void MainWindowPreferencesFrame::on_debounceTime_textEdited(const QString &new_timer)
+{
+ prefs_set_uint_value(pref_debounce_timer_, new_timer.toUInt(), pref_stashed);
+}
diff --git a/ui/qt/main_window_preferences_frame.h b/ui/qt/main_window_preferences_frame.h
index 52d01049c0..586170e1fd 100644
--- a/ui/qt/main_window_preferences_frame.h
+++ b/ui/qt/main_window_preferences_frame.h
@@ -44,6 +44,7 @@ private:
pref_t *pref_toolbar_main_style_;
pref_t *pref_window_title_;
pref_t *pref_prepend_window_title_;
+ pref_t *pref_debounce_timer_;
void updateWidgets();
private slots:
@@ -60,6 +61,7 @@ private slots:
void on_languageComboBox_currentIndexChanged(int index);
void on_windowTitle_textEdited(const QString &new_title);
void on_prependWindowTitle_textEdited(const QString &new_prefix);
+ void on_debounceTime_textEdited(const QString &new_timer);
};
#endif // MAIN_WINDOW_PREFERENCES_FRAME_H
diff --git a/ui/qt/main_window_preferences_frame.ui b/ui/qt/main_window_preferences_frame.ui
index 429d7d2eb1..50ac1ed32f 100644
--- a/ui/qt/main_window_preferences_frame.ui
+++ b/ui/qt/main_window_preferences_frame.ui
@@ -283,6 +283,24 @@
</layout>
</item>
<item>
+ <layout class="QHBoxLayout" name="horizontalLayout_7">
+ <item>
+ <widget class="QLabel" name="label_9">
+ <property name="text">
+ <string>Debounce Timer</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="debounceTime">
+ <property name="toolTip">
+ <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;How long to wait (in milliseconds) before processing user input&lt;br/&gt;If you type quickly, consider lowering the value for a &apos;snappier&apos; experience.&lt;br/&gt; If you type slowly, consider increasing the value to avoid performance issues.&lt;br/&gt;This is currently used to delay searches in View -> Internals -> Supported Protocols and Preferences -> Advanced menu.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
diff --git a/ui/qt/preferences_dialog.cpp b/ui/qt/preferences_dialog.cpp
index bebf245b2d..ff8af8a904 100644
--- a/ui/qt/preferences_dialog.cpp
+++ b/ui/qt/preferences_dialog.cpp
@@ -12,6 +12,7 @@
#include "module_preferences_scroll_area.h"
+#include <epan/prefs.h>
#include <epan/prefs-int.h>
#include <epan/decode_as.h>
#include <ui/language.h>
@@ -224,7 +225,8 @@ void PreferencesDialog::on_advancedSearchLineEdit_textEdited(const QString &text
* the countdown.
*/
searchLineEditText = text;
- searchLineEditTimer->start(200);
+ guint gui_debounce_timer = prefs_get_uint_value("gui", "debounce.timer");
+ searchLineEditTimer->start(gui_debounce_timer);
}
void PreferencesDialog::on_buttonBox_accepted()
diff --git a/ui/qt/supported_protocols_dialog.cpp b/ui/qt/supported_protocols_dialog.cpp
index b7f6740c1d..eea2d738d6 100644
--- a/ui/qt/supported_protocols_dialog.cpp
+++ b/ui/qt/supported_protocols_dialog.cpp
@@ -11,6 +11,7 @@
#include "supported_protocols_dialog.h"
#include <ui_supported_protocols_dialog.h>
+#include <epan/prefs.h>
#include <QElapsedTimer>
@@ -92,5 +93,6 @@ void SupportedProtocolsDialog::on_searchLineEdit_textChanged(const QString &sear
* the countdown.
*/
searchLineEditText = search_re;
- searchLineEditTimer->start(1000);
+ guint gui_debounce_timer = prefs_get_uint_value("gui", "debounce.timer");
+ searchLineEditTimer->start(gui_debounce_timer);
}