-
-
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
lp1783392: Configurable debouncing timeout for WSearchLineEdit #1762
Conversation
After reverting the change of the debouncing timeout this PR actually fixes ...nothing. Actual changes:
|
The setting is now configurable, which might disqualify it from being included in the 2.2 beta. |
|
||
#define MIXXX_ADDONS_URL "http://www.mixxx.org/wiki/doku.php/add-ons" |
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 macro is still in use. Is this an unrelated change, slipped in?
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.
Slipped in. I didn't notice, because I'm already using a version without plugins for development. I've removed this obsolete #define now from master to prevent such mistakes in the future.
<property name="text"> | ||
<string>Edit metadata after clicking selected track</string> | ||
<string>Incremental Search Delay:</string> |
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 might be misleading for me since "Incremental Search" for me is more an algorithm that works all the time in background guessing the final user result. Google has it in the search bar if the network bandwidth is good enough.
That would be great for Mixxx, but we are not there.
"Search after edit"
"Search As You Type Delay"
Or inverse
"Search inhibit time"
"Zero disables the feature" ??
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.
Ok, I will revert back to the debouncing terminology also for the configuration setting for consistency.
For the text on the label we can use one of the proposed variants. Feedback by native speakers and especially non-developers welcome ;)
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 don't want to allow a configurable timeout of 0 to disable this feature entirely. A maximum delay of almost 10 sec should be ok. But I've fixed the code to handle empty or invalid timeouts by not starting the timer.
The configurable timeout has proven to be very useful to me, because the optimal setting depends on both the size of your library as well as your personal typing speed and habits. We have a similar fixed timeout for navigation within the side bar that is currently set to kPressedUntilClickedTimeoutMillis = 300. But this is not so sensitive, because when repeatedly clicking a button or turning an encoder you don't have to account for the delays while looking up different keys or thinking about how to finish your search. |
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.
The timeout is bypassed if you delete the last character in the search box.
This also happens also in 2.1.
Can we have a minimal fix it there as well?
If I put the settingsPath on a USB HDD, I can reproduce the leaks. But they only happens if many tracks are shown or hidden due the search.
We may be able to explain it if all tracks are shown again, but why is this happening when tracks are hidden? Do we have a caching issue?
Disabling some columns doe does not change the issue by the way.
.clang-format
Outdated
@@ -0,0 +1,108 @@ | |||
--- |
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 file addition is unrelated to this PR.
src/dialog/dlgdevelopertools.cpp
Outdated
@@ -118,7 +118,7 @@ void DlgDeveloperTools::timerEvent(QTimerEvent* pEvent) { | |||
} | |||
} | |||
|
|||
void DlgDeveloperTools::slotControlSearch(const QString& search) { | |||
void DlgDeveloperTools::slotControlSearch(QString search) { |
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.
Why is this change required? I think we should prefer passing strings by references, to avoid shared counting.o
In the queued connection case Qt makes the copy for us:
https://www.embeddeduse.com/2013/06/29/copied-or-not-copied-arguments-signals-slots/
src/library/library.cpp
Outdated
@@ -325,8 +325,8 @@ void Library::slotLoadTrackToPlayer(TrackPointer pTrack, QString group, bool pla | |||
emit(loadTrackToPlayer(pTrack, group, play)); | |||
} | |||
|
|||
void Library::slotRestoreSearch(const QString& text) { | |||
emit(restoreSearch(text)); | |||
void Library::slotRestoreSearch(QString text) { |
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.
Please keep passing by const reference here as well, if possible.
src/widget/wlibrary.cpp
Outdated
@@ -68,7 +68,7 @@ void WLibrary::switchToView(const QString& name) { | |||
} | |||
} | |||
|
|||
void WLibrary::search(const QString& name) { | |||
void WLibrary::search(QString name) { |
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.
Please keep passing by const reference here as well, if possible.
src/widget/wsearchlineedit.cpp
Outdated
} | ||
|
||
void WSearchLineEdit::slotTextChanged(const QString& text) { | ||
// slot | ||
void WSearchLineEdit::updateText(QString text) { |
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.
Please keep passing by const reference here as well, if possible.
src/widget/wsearchlineedit.cpp
Outdated
setAttribute(Qt::WA_MacShowFocusRect, false); | ||
} | ||
|
||
void WSearchLineEdit::updatePlaceholder(QString text) { |
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.
updatePlaceholder -> updateTextBox()
This function is hard to understand anyway. I would prefer to inline it.
Alternative it may call getSearchText() itselves.
Unfortunately yes. Maybe the major issue can be fixed via solving the bypass issue. |
All intermediate, unwanted, or controversial changes have been reverted and the branch rebased on 2.2. |
I cannot confirm that the timeout and timer is bypassed when deleting single characters. Deleting the last character with backspace triggers text changed events and the timer is reset as expected. |
Target branch: One option would be to split the UI changes off from this PR and merge them separately into master. The new configuration remains undocumented, but could already be used by editing a single line in the config file manually. We might need this configuration option to help fixing issues of users with big libraries. I expect at least some complaints once the new version has been released to a broader audience. |
If you think this option can be essential for 2.2 I think it is better to merge it including the GUI changes. A non translated essential feature is better than a hidden essentially feature. Both share the same regression risk. Is this search bar issue a regression from 2.1? If yes, let's include it. |
Are you able to reproduce the deleting the last character GUI freezing? |
Deleting the last characters works as like any other editing operation and restarts the timer as expected. |
With Qt4 I was able to continue typing while the UI was frozen and ended up with the search phrase I typed. With Qt5 the characters typed while the UI is frozen are reordered in unforeseeable ways. |
The issue with the last character is "emit searchCleared();" during typing. I am also still unsure about the target branch. |
I misunderstood your description "last character"! Ok, now I got it. Deleting the last character before the edit field becomes empty ;) |
It still doesn't feel right, but I'm tired of improving this even more. I will only fix outstanding bugs. No backport to 2.1, this has already cost me much more time then planned. |
Thank you.
We also don't have a conclusion if this as suits for 2.2. Do we know if this a Wayland issue? I have tried to find something about the key stroke reordering on the web, but I haven't found anything. |
"still not right": The underlying state machine with its side effects is still complicated. I'm not able to guarantee that all possible states and transitions are covered and work as expected. Testing with a large library that causes ui freezes and by varying the timeout were hopefully sufficient to reveal and fix most issues. |
I've update the target to master/2.3.0, but I will keep this branch aligned with 2.2 until we know if this is an issue that affects multiple users. |
Let's merge this to 2.2 even if we have untranslated strings. Without it, Mixxx might be unusable for some users. |
Thank you! |
Add a configurable debouncing timeout for the search edit field. Depending on the size of their library users are now able to adjust this to mitigate the issues caused by locking the UI thread while searching.
Another user now has exactly reported the same issues that I am experiencing, i.e. Mixxx is almost unusable with bigger libraries and the default settings: https://bugs.launchpad.net/mixxx/+bug/1783392