forked from osmocom/wireshark
Preferences: Support configuring debounce timers
This commit is contained in:
parent
8812c5ed20
commit
9e1905f88d
13
epan/prefs.c
13
epan/prefs.c
|
@ -3322,6 +3322,18 @@ prefs_register_modules(void)
|
|||
10,
|
||||
&prefs.gui_update_interval);
|
||||
|
||||
prefs_register_uint_preference(gui_module, "debounce.timer",
|
||||
"How long to wait before processing computationally intensive user input",
|
||||
"How long to wait (in milliseconds) before processing\
|
||||
computationally intensive user input.\
|
||||
If you type quickly, consider lowering the value for a 'snappier'\
|
||||
experience.\
|
||||
If you type slowly, consider increasing the value to avoid performance issues.\
|
||||
This is currently used to delay searches in View -> Internals -> Supported Protocols\
|
||||
and Preferences -> Advanced menu.",
|
||||
10,
|
||||
&prefs.gui_debounce_timer);
|
||||
|
||||
register_string_like_preference(gui_module, "window_title", "Custom window title",
|
||||
"Custom window title to be appended to the existing title\n"
|
||||
"%F = file path of the capture file\n"
|
||||
|
@ -4180,6 +4192,7 @@ pre_init_prefs(void)
|
|||
prefs.gui_update_enabled = TRUE;
|
||||
prefs.gui_update_channel = UPDATE_CHANNEL_STABLE;
|
||||
prefs.gui_update_interval = 60*60*24; /* Seconds */
|
||||
prefs.gui_debounce_timer = 400; /* milliseconds */
|
||||
g_free(prefs.gui_window_title);
|
||||
prefs.gui_window_title = g_strdup("");
|
||||
g_free(prefs.gui_prepend_window_title);
|
||||
|
|
|
@ -208,6 +208,7 @@ typedef struct _e_prefs {
|
|||
gboolean gui_update_enabled;
|
||||
software_update_channel_e gui_update_channel;
|
||||
gint gui_update_interval;
|
||||
gint gui_debounce_timer;
|
||||
gchar *saved_at_version;
|
||||
gboolean unknown_prefs; /* unknown or obsolete pref(s) */
|
||||
gboolean unknown_colorfilters; /* Warn when saving unknown or obsolete color filters. */
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -282,6 +282,24 @@
|
|||
</item>
|
||||
</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><html><head/><body><p>How long to wait (in milliseconds) before processing user input<br/>If you type quickly, consider lowering the value for a 'snappier' experience.<br/> If you type slowly, consider increasing the value to avoid performance issues.<br/>This is currently used to delay searches in View -> Internals -> Supported Protocols and Preferences -> Advanced menu.</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue