-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WSearchLineEdit: Add options to disable auto-completion and history #10942
Conversation
78c3c9c
to
8328736
Compare
Hm, the build failure is strange, is |
Can you explain your use case a bit more? |
It's mostly minor things that I find a bit inconvenient:
|
Just a side note, the new options should be in the Library page. |
Use Also, instead of parsing the config on each Up/Down/Space press, why not use a static functions to set bools, like the one setting the debounce timeout? Furthermore, I'm not comfortable with removing the history function altogether (which is not the case now btw, queries are still saved and restored, though not accessible). |
I've moved the settings as per your suggestion to the Library page (see the updated screenshot in the PR description) and renamed the history setting to 'Enable search history shortcuts' to clarify that it only affects the shortcuts and not the history itself. Suppressing the emulated keystrokes in Regarding the static functions: While this may work for the history shortcuts (since we only need to read the value during key events), Since I'm not that familiar with the data flow of configuration changes yet, do you have some pointers on how to do cleanly propagate config changes to |
You could check if this bool changed in the focusInEvent() |
Anyways, I assume this setting is changed rarely, so applying this after start / skin change/reload may be sufficient IMO |
As per the PR suggestions: - mixxxdj#10942 (comment) - mixxxdj#10942 (comment)
60b99fe
to
c549daf
Compare
I've now wired up the settings as static bools as you suggested. Also, One thing that struck me as slightly odd is that some settings are updated differently: For example, the debounce time is updated immediately when the user changes the widget whereas most other settings are first applied when the user clicks 'Apply'. This feels a bit inconsistent (but is probably a topic for another PR). With these new settings, I've tried to match the original semantics (i.e. first update the config when 'Apply' is clicked). In the longer term, we'd probably want to find a clean way to notify |
I support this feature, I do not personally like the autocomplete / history but I understand others may find it useful. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm sorry you had to wait so long, this was kinda pushed off the table.
It's working nicely, thanks. Just some nitpicks.
I guess it doesn't matter that the completer is always created even if it will never actually be loaded to lineEdit->completer.
As per the PR suggestions: - mixxxdj#10942 (comment) - mixxxdj#10942 (comment)
ba3a787
to
a10dc31
Compare
I've updated the branch with your suggestions |
a10dc31
to
6e5d3be
Compare
src/widget/wsearchlineedit.cpp
Outdated
#include <QAbstractItemView> | ||
#include <QApplication> | ||
#include <QCompleter> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, during my previous review I didn't notice this is already included in wsearchlineedit.h
Please remove it here, git commit --amend (maybe name it more explicitely) and push one last time.
FYI rebasing after a review without approval is not appreciated since that means someone has to review again, instead of just checking the last commits. Here, it's not much of a drama because the change set is rather small and can be verified by manual testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI rebasing after a review without approval is not appreciated
Ah sorry, I'll try to keep that in mind for the next time (in this case the rebase was useful since the row numbering in dlgpreflibraryui changed upstream and would have silently merged without a conflict)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't neither review again nor test manually, so if you like to --fixup previous commits with the latest changes and squash.. feel free.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I went with amending for now, most of these are just small stylistic changes anyway
6e5d3be
to
5340f35
Compare
Any updates on this? |
After #11207 is merged, the completion is no longer applied immediately. It requires "→" or "⏎" to take effect. This means the
part will be solved. Can we reduce this to only add the "EnableSearchHistoryShortcuts" preferences option for less clutter in the preferences? |
I still think having the option to disable auto-completion would be cool, if only to reduce visual noise |
src/widget/wsearchlineedit.h
Outdated
static constexpr bool kEnableCompletionsByDefault = true; | ||
static constexpr bool kEnableHistoryShortcutsByDefault = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a function name, how about
static constexpr bool kEnableCompletionsByDefault = true; | |
static constexpr bool kEnableHistoryShortcutsByDefault = true; | |
static constexpr bool kDefaultSearchCompletionsEnabled = true; | |
static constexpr bool kDefaultSearchHistoryShortcutsEnabled = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I preferred to remove the redundant 'search' string, so let's name these
kCompletionsEnabledDefault
kHistoryShortcutsEnabledDefault
?
@@ -495,6 +513,15 @@ void DlgPrefLibrary::slotSearchDebouncingTimeoutMillisChanged(int searchDebounci | |||
WSearchLineEdit::setDebouncingTimeoutMillis(searchDebouncingTimeoutMillis); | |||
} | |||
|
|||
void DlgPrefLibrary::searchHistoryOptionsChanged() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is not a slot, name the function according to what it does, not when it is called.
void DlgPrefLibrary::searchHistoryOptionsChanged() { | |
void DlgPrefLibrary::updateSearchLineEditHistoryOptions() { |
OK |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM Thank you.
Fixes #10634
This adds two options (that are enabled by default) to configure whether search completions and history (including up/down keyboard shortcuts) should be enabled: