[patch] Save file dialog directories, delete and interaction

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderator: Committer

Post Reply
Message
Author
Mitten.O
Programmer
Posts: 255
Joined: Sun Apr 06, 2014 4:15 pm

[patch] Save file dialog directories, delete and interaction

#1 Post by Mitten.O »

In response to some user reactions,
this patch adds a few tweaks the save file dialog.

* Return to inline directory browsing
* Add a delete button (local only)
* Add confirmation prompts for deletion and overriding
* Color folder edit red when folder is invalid (local only)

Deleting non-local seems unnecessary dangerous (and troublesome to implement),
folder coloring on remote on the other hand is very feasible, since we have the list of valid subdirectories,
but I don't have the time to do that just now, and I anticipate needing to iterate after comments anyways,
so I'm posting this version without that.
Attachments
faulty_dir.png
faulty_dir.png (80.9 KiB) Viewed 1174 times
delete_confirmation.png
delete_confirmation.png (66.57 KiB) Viewed 1174 times

[The extension patch has been deactivated and can no longer be displayed.]

Any code by me in this post is released under GPL 2.0 or later.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: [patch] Save file dialog directories, delete and interac

#2 Post by Geoff the Medio »

[..] should probably be at the top of the list.

The scrollwheel increment should be adjusted to about 3 save file rows. Currently it sometimes increments a small enough amount that the scrollbar moving one tick doesn't actually scroll the list.

In-game text needs to all be gotten by UserString, not hard coded (including "Yes" or "Cancel").

I haven't checked, but does the dialog respond well to write-protected files, or changes to the directory contents while it's open?

Mitten.O
Programmer
Posts: 255
Joined: Sun Apr 06, 2014 4:15 pm

Re: [patch] Save file dialog directories, delete and interac

#3 Post by Mitten.O »

* Sort directories differently from saves
* Increased scrollwheel increment
* Translate yes and cancel
* Color invalid directory also against remote server
I haven't checked, but does the dialog respond well to write-protected files, or changes to the directory contents while it's open?
No and no. Based on a quick search, neither seems worth the trouble. The best way to find out if a file is writable is to write it;
and getting notifications of a folder's changes does not seem to be within boost's powers.
Ok, if there is an easy way to get notified when the application loses and regains focus,
reloading the folder every time that happens might be a potentially useful approximation.
Attachments

[The extension patch has been deactivated and can no longer be displayed.]

Any code by me in this post is released under GPL 2.0 or later.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: [patch] Save file dialog directories, delete and interac

#4 Post by Geoff the Medio »

Mitten.O wrote:...if there is an easy way to get notified when the application loses and regains focus...
HumanClientApp has a FocusChangedSignal.

A couple issues:
* yes/no text is broken and only says yes.
* randomly odd-sized directory rows when going up a directory.
Attachments
broken text
broken text
error_text.png (4.7 KiB) Viewed 1161 times
row sizes are odd
row sizes are odd
dir_size.png (21.07 KiB) Viewed 1161 times

Mitten.O
Programmer
Posts: 255
Joined: Sun Apr 06, 2014 4:15 pm

Re: [patch] Save file dialog directories, delete and interac

#5 Post by Mitten.O »

HumanClientApp has a FocusChangedSignal.
Excellent. I made the list get updated on focus change. Should cover most use cases.
Makes the selection and scrolling be lost, though.
* yes/no text is broken and only says yes.
Fixed.
* randomly odd-sized directory rows when going up a directory.
GiGi's word wrapping text can be a bit tricky. Should be better now, I gave it more explicit space.
Attachments

[The extension patch has been deactivated and can no longer be displayed.]

Any code by me in this post is released under GPL 2.0 or later.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: [patch] Save file dialog directories, delete and interac

#6 Post by Geoff the Medio »

ListBox has a SetVScrollWheelIncrement function that would be better to use than your overridden MouseWheel function.

Can't follow this comment...

Code: Select all

+    /// Sorts row alphabetically, to sort correctly byt ht time stamps,
+    /// But but puts anything wrappend in PATH_DELIM_BEGIN and PATH_DELIM_END
+    /// first, in alphabetical order, to put directories first
I still get seemingly-random double or triple-tall directory rows.

The usual minor code formatting nitpicks.

Otherwise seems OK.

Mitten.O
Programmer
Posts: 255
Joined: Sun Apr 06, 2014 4:15 pm

Re: [patch] Save file dialog directories, delete and interac

#7 Post by Mitten.O »

ListBox has a SetVScrollWheelIncrement function that would be better to use than your overridden MouseWheel function.
Done.
I still get seemingly-random double or triple-tall directory rows.
I disabled line breaking for directory rows entirely. That should make them behave more consistently.
I would expect directory names wider than the dialog to be very rare.
The usual minor code formatting nitpicks.
Fixed a couple if(:s again.
Attachments

[The extension patch has been deactivated and can no longer be displayed.]

Any code by me in this post is released under GPL 2.0 or later.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: [patch] Save file dialog directories, delete and interac

#8 Post by Geoff the Medio »


Post Reply