Improve setting background images. #285

Merged
MicheleC merged 1 commits from feat/set-background into master 2 years ago
Owner
  1. Use Scale & Crop as default style for wallpaper.
  2. Do not reset the "Position" field to scaled/tiled when changing image.
  3. Add all available options to "Set as Background" menu in Konqueror.

This resolves issue #280 and issue #281.

1. Use Scale & Crop as default style for wallpaper. 2. Do not reset the "Position" field to scaled/tiled when changing image. 3. Add all available options to "Set as Background" menu in Konqueror. This resolves issue #280 and issue #281.
MicheleC added this to the R14.0.13 release milestone 2 years ago
MicheleC requested review from SlavekB 2 years ago
MicheleC force-pushed feat/set-background from 18936f7a9d to 12175ba59f 2 years ago
blu.256 reviewed 2 years ago
blu.256 left a comment
Collaborator

Some questions I had after testing the code and reading the changes.

Some questions I had after testing the code and reading the changes.
}
}
KFileMetaInfo metaInfo(path);
Collaborator

Is the removal of this code block really necessary? The code in question makes it unneeded, for example, to manually pick "Tiled" for tiled wallpapers, which is really comfortable and which is what most KDE/TDE users expect. Maybe just changing the default from Scaled to Scale and Crop would be enough?

Is the removal of this code block really necessary? The code in question makes it unneeded, for example, to manually pick "Tiled" for tiled wallpapers, which is really comfortable and which is what most KDE/TDE users expect. Maybe just changing the default from `Scaled` to `Scale and Crop` would be enough?
Poster
Owner

The original code sets the "Position" combobox to either "Scaled" or "Tiled" depending on the image size. That means if you like to use a different method, you need to change the "Position" every time you change a picture, which is the original problem reported in one of the two issues.
We could of course keep the code and just change "Scaled" to "Scaled and Crop", but I thought "why not give the user the possibility to set its own Position style and just quickly browse through the various pictures?"

This is a point for discussion, so we should at least hear from @SlavekB as well, then we can either keep the behavior in this PR or change it as you mentioned.

The original code sets the "Position" combobox to either "Scaled" or "Tiled" depending on the image size. That means if you like to use a different method, you need to change the "Position" every time you change a picture, which is the original problem reported in one of the two issues. We could of course keep the code and just change "Scaled" to "Scaled and Crop", but I thought "why not give the user the possibility to set its own Position style and just quickly browse through the various pictures?" This is a point for discussion, so we should at least hear from @SlavekB as well, then we can either keep the behavior in this PR or change it as you mentioned.
Collaborator

What I meant is that the fact that it automatically switches to and from Tiled mode for small images is comfortable. Maybe the position setting for each type can be stored separately and restored? For example, you select a Maxpect option for a wallpaper then you select a tile, and the previous default for tiles is restored. Switch back to a normal wallpaper and the previous Maxpect option is restored. This could be a good compromise IMO.

What I meant is that the fact that it automatically switches to and from Tiled mode for small images is comfortable. Maybe the position setting for each type can be stored separately and restored? For example, you select a Maxpect option for a wallpaper then you select a tile, and the previous default for tiles is restored. Switch back to a normal wallpaper and the previous Maxpect option is restored. This could be a good compromise IMO.
Poster
Owner

Yeah, I also thought of this as a possible solution last night. I will look into it.

Yeah, I also thought of this as a possible solution last night. I will look into it.
Poster
Owner

I have pushed a version that remembers the previous choice. So if the image is smaller than 800x600, it selects Tiled by default, otherwise it will use the user choice.

I have pushed a version that remembers the previous choice. So if the image is smaller than 800x600, it selects Tiled by default, otherwise it will use the user choice.
Collaborator

Haven't tested yet, but this could also work for the three tiled variants.

Haven't tested yet, but this could also work for the three tiled variants.
Poster
Owner

Currently this is either Tiled or user choice (and user choice can be anything, even Tiled). If we want something more advanced, I will need to code it. Test first, then we can discuss further.

Currently this is either Tiled or user choice (and user choice can be anything, even Tiled). If we want something more advanced, I will need to code it. Test first, then we can discuss further.
Collaborator

Tested, works like a charm. But I still think storing the option for small images would be great too.

Tested, works like a charm. But I still think storing the option for small images would be great too.
Poster
Owner

ok, will look into adding that extra functionality too

ok, will look into adding that extra functionality too
Collaborator

I tried to implement it and I think I succeeded. I'll test my attempt and report back.

I tried to implement it and I think I succeeded. I'll test my attempt and report back.
Poster
Owner

I have pushed an updated version that implements what discussed.

I tried to implement it and I think I succeeded. I'll test my attempt and report back.

Sorry, hadn't seen this before :-)

I have pushed an updated version that implements what discussed. > I tried to implement it and I think I succeeded. I'll test my attempt and report back. Sorry, hadn't seen this before :-)
blu.256 marked this conversation as resolved
grid = new TQGridLayout( 0, 0, 10 );
layoutItem = TQT_TQLAYOUTITEM(grid);
layoutItem = TQT_TQLAYOUTITEM(grid);
Collaborator

How is this change related to the issue?

How is this change related to the issue?
Poster
Owner

This is actually not related to the functionality but the compiler was giving a warning of potentially missing braces because the line was aligned to the previous one that was under an if without braces. Looking at the code, I initially thought this line should not be part of the if body, but looking at it again I think it should since grid is only defined under the if block (hence I would need to add braces around the if block)
What is your take on this? part of the if body or not?

This is actually not related to the functionality but the compiler was giving a warning of potentially missing braces because the line was aligned to the previous one that was under an ```if``` without braces. Looking at the code, I initially thought this line should not be part of the ```if``` body, but looking at it again I think it should since ```grid``` is only defined under the if block (hence I would need to add braces around the if block) What is your take on this? part of the if body or not?
Collaborator

Looks like part of the body, because what would be the point of casting a null pointer?

Looks like part of the body, because what would be the point of casting a null pointer?
Poster
Owner

Updated

Updated
MicheleC marked this conversation as resolved
Poster
Owner

Btw thanks for testing Philippe :-)

Btw thanks for testing Philippe :-)
MicheleC force-pushed feat/set-background from 12175ba59f to ad406e9ce2 2 years ago
MicheleC requested review from blu.256 2 years ago
blu.256 reviewed 2 years ago
if (mode == r->wallpaperMode())
return;
m_prevWallpaperPos = mode;
Collaborator

I think identation is a little off here...

I think identation is a little off here...
Poster
Owner

ah thanks... missed that (y)

ah thanks... missed that (y)
MicheleC marked this conversation as resolved
blu.256 reviewed 2 years ago
if (m_wallpaperPos == KBackgroundSettings::NoWallpaper)
m_wallpaperPos = KBackgroundSettings::Centred; // Default
m_prevWallpaperPos = m_wallpaperPos;
Collaborator

Also here identation seems to be off.

Also here identation seems to be off.
MicheleC marked this conversation as resolved
MicheleC force-pushed feat/set-background from ad406e9ce2 to c3b47cbbf0 2 years ago
Collaborator

issue 1

  1. select a nontiled wallpaper and set the option to anything but the default Scale and Crop.
  2. save and close the dialog
  3. open the options dialog again
  4. the position option is correct
  5. change the wallpaper to another nontiled wallpaper
  6. the option gets reset to the default

issue 2

  1. you have a nontiled wallpaper
  2. switch to a tiled wallpaper
  3. switching to a nontiled wallpaper again reproduces issue 1
  4. switch back to a tiled wallpaper
  5. set any nontiled option
  6. switch to a nontiled wallpaper. the option has been changed to the one you set for tiled
issue 1 1) select a nontiled wallpaper and set the option to anything but the default Scale and Crop. 2) save and close the dialog 3) open the options dialog again 4) the position option is correct 5) change the wallpaper to another nontiled wallpaper 6) the option gets reset to the default issue 2 1) you have a nontiled wallpaper 2) switch to a tiled wallpaper 3) switching to a nontiled wallpaper again reproduces issue 1 4) switch back to a tiled wallpaper 5) set any nontiled option 6) switch to a nontiled wallpaper. the option has been changed to the one you set for tiled
Poster
Owner

issue 1

  1. select a nontiled wallpaper and set the option to anything but the default Scale and Crop.
  2. save and close the dialog
  3. open the options dialog again
  4. the position option is correct
  5. change the wallpaper to another nontiled wallpaper
  6. the option gets reset to the default

Ah I see. The user options are not saved across "closing/opening" dialogs, so I guess I am not initializing them correctly when opening the dialog.

> issue 1 > > 1) select a nontiled wallpaper and set the option to anything but the default Scale and Crop. > 2) save and close the dialog > 3) open the options dialog again > 4) the position option is correct > 5) change the wallpaper to another nontiled wallpaper > 6) the option gets reset to the default Ah I see. The user options are not saved across "closing/opening" dialogs, so I guess I am not initializing them correctly when opening the dialog.
blu.256 force-pushed feat/set-background from c3b47cbbf0 to 099e09a8e8 2 years ago
MicheleC reviewed 2 years ago
int m_wallpaperPos; // Remembers last wallpaper pos
int m_prevWallpaperPos = KBackgroundSettings::ScaleAndCrop; // Previous normal wallpaper pos
int m_prevTilePos = KBackgroundSettings::Tiled; // Previous tile wallpaper pos
bool m_isTile; // Whether the wallpaper is a tile (800x600 or smaller)
Poster
Owner

This needs to be done in the constructor, not here.

This needs to be done in the constructor, not here.
blu.256 marked this conversation as resolved
MicheleC reviewed 2 years ago
// If the image is greater than 800x600 default to using the user selected mode
// for a normal wallpaper, otherwise default to user selection for tiles.
TQSize s = metaInfo.item("Dimensions").value().toSize();
m_isTile = (s.width() < 800 && s.height() < 600);
Poster
Owner

&& should be a ||, to preserve original logic to detect when to tile and when not.

&& should be a ||, to preserve original logic to detect when to tile and when not.
blu.256 marked this conversation as resolved
MicheleC reviewed 2 years ago
TQSize s = metaInfo.item("Dimensions").value().toSize();
if (s.width() >= 800 && s.height() >= 600)
m_wallpaperPos = KBackgroundSettings::Scaled;
m_isTile = (s.width() < 800 && s.height() < 600);
Poster
Owner

&& should be a ||, to preserve original logic to detect when to tile and when not.

&& should be a ||, to preserve original logic to detect when to tile and when not.
Collaborator

Good catch.. (facepalms self)

Good catch.. (*facepalms self*)
blu.256 marked this conversation as resolved
blu.256 force-pushed feat/set-background from 099e09a8e8 to c1ba57551e 2 years ago
blu.256 force-pushed feat/set-background from c1ba57551e to bc7575c019 2 years ago
blu.256 force-pushed feat/set-background from bc7575c019 to f1f94aa343 2 years ago
blu.256 approved these changes 2 years ago
blu.256 force-pushed feat/set-background from f1f94aa343 to 14bc816be9 2 years ago
Poster
Owner

Looks better but still an issue.

  1. select a nontiled wallpaper and set the option
  2. select a tiled wallpaper and set the option different from "Tiled"
  3. select a nontiled wallpaper and apply the settings + close the dialog.
  4. open the dialog again. The last non tiled option is correctly selected.
  5. select a tiled wallpaper: the Position is set to Tiled instead of the last chosen value.

EDIT: Strangle, the opposite does not seem to happen. the same happens, I had done a wrong test.

Looks better but still an issue. 1. select a nontiled wallpaper and set the option 2. select a tiled wallpaper and set the option different from "Tiled" 3. select a nontiled wallpaper and apply the settings + close the dialog. 4. open the dialog again. The last non tiled option is correctly selected. 5. select a tiled wallpaper: the Position is set to Tiled instead of the last chosen value. EDIT: ~~Strangle, the opposite does not seem to happen.~~ the same happens, I had done a wrong test.
Poster
Owner

Overall, I think we could merge as is. @SlavekB: what do you think?

Overall, I think we could merge as is. @SlavekB: what do you think?
SlavekB approved these changes 2 years ago
SlavekB left a comment
Owner

It seems good.
The last mentioned issue does not seem to be significant enough to block the merge.

It seems good. The last mentioned issue does not seem to be significant enough to block the merge.
MicheleC merged commit 14bc816be9 into master 2 years ago
MicheleC deleted branch feat/set-background 2 years ago

Reviewers

blu.256 approved these changes 2 years ago
SlavekB approved these changes 2 years ago
The pull request has been merged as 14bc816be9.
Sign in to join this conversation.
No reviewers
No Milestone
No Assignees
3 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: TDE/tdebase#285
Loading…
There is no content yet.