Skip to content
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

#3233 UI: Common method to delete server and custom directory entries #3260

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

AdamGLIN
Copy link

@AdamGLIN AdamGLIN commented Apr 3, 2024

I added a horizontal box layout which include the box and the delete button. I wrote a fonction to implement the delete button.

It works well when we change the focus with the mouse to add a new directory but I can't make the enter key work : it delete the input and nothing happend. I tried to add the QLineEdit::returnPressed signal but it changed nothing. I struggle to understand the former use of the QComboBox::activated signal since I commented it and nothing seems to have changed.

TODO :
Allowing to add directory via enter key.
Improve spacers in the ui.

Short description of changes

CHANGELOG: UI: Add "Delete Entry" button to Advanced Settings, Custom Directories

Context: Fixes an issue?

#3233

Does this change need documentation? What needs to be documented and how?

Status of this Pull Request

What is missing until this pull request can be merged?

Checklist

  • I've verified that this Pull Request follows the general code principles
  • I tested my code and it does what I want
  • My code follows the style guide
  • I waited some time after this Pull Request was opened and all GitHub checks completed without errors.
  • I've filled all the content above

I added a horizontal box layout which include the box and the delete button. I wrote a fonction to implement the delete button.

It works well when we change the focus with the mouse to add a new directory but I can't make the enter key work : it delete the input and nothing happend.
I tried to add the QLineEdit::returnPressed signal but it changed nothing.
I struggle to understand the former use of the QComboBox::activated signal since I commented it and nothing seems to have changed.

TODO :
Allowing to add directory via enter key.
Improve spacers in the ui.
@ann0see ann0see changed the title first commit to resolve the issue #3233 WIP: resolve #3233 Apr 3, 2024
@ann0see
Copy link
Member

ann0see commented Apr 3, 2024

Thanks for opening this PR. It's a draft/WIP so it needs discussion. @pljones Should be most familiar with this.

@ann0see
Copy link
Member

ann0see commented Apr 3, 2024

Could you please also post your questions here? Best right in the code tab close to where the question arises.

@AdamGLIN
Copy link
Author

AdamGLIN commented Apr 3, 2024

Hello,

It works for the main part, I mostly followed this commit.

However, I have some issues :

  • I can't figure out why the QLineEdit::editingFinished signal that we use to notify the changes, don't seems to work when I press the enter key (I read that it was supposed to). (src/clientsettingsdlg.cpp, line ~700)
  • I don't understand the use of the QComboBox::activated signal since I commented it and it changed nothing. Also I read that the signal was sent when the user clicks on an item of the list and I think that it was not a interesting behavior for this feature because the order doesn't matter. Tell me if I'm wrong. (src/clientsettingsdlg, line ~700)
  • I found out that we use the StringFiFoWithCompare method (src/util.h, line ~170) to update the list without repetition (I think) for both directories and server address lists (src/clientsettingsdlg, line ~1060). However, there is a loop introduced in this commit (src/connectdlg.cpp, line ~750) to avoid repetition, and hence it is useless. For the first change I decided just to copy the loop and not think to much about it. What do you think about it ? Did I miss something ?

I have still things to improve such as the interface (boxes are not equally spaced), but I would like your opinion to continue this way !

Thanks for your time !

@softins
Copy link
Member

softins commented Apr 3, 2024

Thanks Adam! I started to look at your commit and questions earlier today, but got diverted onto other things. I will have a look soon, hopefully tomorrow!

src/clientsettingsdlg.cpp Outdated Show resolved Hide resolved
src/clientsettingsdlg.cpp Outdated Show resolved Hide resolved
src/clientsettingsdlg.cpp Outdated Show resolved Hide resolved
src/clientsettingsdlg.cpp Outdated Show resolved Hide resolved
I followed the suggestions made py @pljones and I changed a size hint of a spacer in the UI to make sure that everything is evenly spaced.

TODO :

Allowing adding directory via enter key
src/clientsettingsdlg.cpp Outdated Show resolved Hide resolved
src/clientsettingsdlg.cpp Outdated Show resolved Hide resolved
src/clientsettingsdlg.cpp Outdated Show resolved Hide resolved
src/clientsettingsdlg.cpp Outdated Show resolved Hide resolved
I used flags to allow the use of only one function for the delete button and the list itself, I deleted a ":" in
the label (other labels didn't use ":") and I added a tabstop for the button
src/clientsettingsdlg.cpp Outdated Show resolved Hide resolved
src/clientsettingsdlg.cpp Outdated Show resolved Hide resolved
I added return in case the data isn't valid. I also added a ":" to avoid translations problems.
@pljones
Copy link
Collaborator

pljones commented Apr 16, 2024

Looks good to me, now. I've kicked off the build.

Thanks for all the time you've spent on this! :)

@AdamGLIN
Copy link
Author

Thank you for your patience and your advices :)

@pljones
Copy link
Collaborator

pljones commented Apr 17, 2024

Just tried the Windows version from the build artifacts and it looks okay to me.

@pljones pljones added this to the Release 3.11.0 milestone Apr 17, 2024
@ann0see ann0see self-requested a review April 17, 2024 21:15
@ann0see
Copy link
Member

ann0see commented Apr 17, 2024

This needs some squashing and rebasing, I believe. I'll look into it once I have time.

@pljones pljones changed the title WIP: resolve #3233 #3233 UI: Common method to delete server and custom directory entries May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

Ability to delete Server and Directory from a list should be the same
4 participants