-
Notifications
You must be signed in to change notification settings - Fork 800
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
Improve wizard ui #2895
Improve wizard ui #2895
Conversation
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 so glad to see the welcome page split out!
One thing for later: this PR would have benefited from being more than one commit, roughly one commit per sub-task in the issue it solves. Oh well...
Wow, really great now @FlexW! :) I’d only say to slightly reduce the size of the two-way arrow, and then it’s good to go! |
void OwncloudAdvancedSetupPage::setupSyncModeLabel() | ||
{ | ||
auto sizePolicy = _ui.syncModeLabel->sizePolicy(); | ||
sizePolicy.setRetainSizeWhenHidden(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.
Just wondering, wouldn't doing this at the page level be enough instead of doing it per widget?
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.
If I do this on the page the layout of the other pages changes too
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.
Well, isn't it what we want? Because we want all the pages to have the same size in the end to avoid resizes on step changes? So wouldn't that lead to not needing the adjustWizardSize
in the wizard class?
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.
Sorry I wasn't specific enough. If I set the size policy on the OwncloudAdvancedSetupPage
int the constructor then I get a incorrect layout on all the other pages. For example https://cloud.nextcloud.com/s/g5maTToEcwERY3t . I'm unsure what here is happening.
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.
Hm... looks like it's overconstrained somehow... Or that one of the components claims a too small size... would be a good target for investigating with Gammaray.
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 admit I'm still dismayed this needs to be done like this for individual widgets, I'd expect there's a better way... as I said I'd have expected it to be enough on individual pages. But if that's really not the case it seems to be on most widgets in each page, so maybe use findChildren<QWidget>
and apply it to them all in a loop? Not super in love with that but would at least remove some of the noise related to this...
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.
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 agree with you both. I try to fix that.
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.
After some more investigation I'm still unable to solve that. Are you sure that it would be enough to set the size policy on the page level because from my observations in gammaray the size policy got not propagated to the child widgets and I couldn't find any documentation that states something else. However, I simplified the setting of the size policy a little bit so that it makes less noise.
62d4516
to
070618d
Compare
Screenshot: |
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.
Looks great design-wise! :) Nice work
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 think it's time to try to simplify a bit that history (which is not the same thing as squashing into a single commit). I admit that at that point I'm merely glancing over because I'm overwhelmed. A few logically consistent commits I could cling on to see the steps you're going through would help me.
b52c98d
to
b98e706
Compare
void customizeSecondaryButtonStyle(QAbstractButton *button) | ||
{ | ||
#ifdef Q_OS_LINUX | ||
// Only style push buttons on Linux as on other platforms we are unable to style the background color |
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.
What? This sounds surprising to me... Where is it coming from?
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.
Yes, in the past we used style sheets to make the buttons blue. But if we use style sheets, the buttons do not look native anymore as can be seen on the current wizard in OSX and Windows.
See also the warning here: https://doc.qt.io/qt-5/qpalette.html#details
I guess this warning applies to Windows 10 as well but really if you know how to change the background color of push buttons with the palette on Windows and OSX I would love to hear that:) I searched quite a while for a solution...
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.
Yes, in the past we used style sheets to make the buttons blue. But if we use style sheets, the buttons do not look native anymore as can be seen on the current wizard in OSX and Windows.
Yes, that's one of the reasons why I don't like stylesheets.
See also the warning here: https://doc.qt.io/qt-5/qpalette.html#details
I guess this warning applies to Windows 10 as well but really if you know how to change the background color of push buttons with the palette on Windows and OSX I would love to hear that:) I searched quite a while for a solution...
Well let's say that the thing is: you should modify the palette as intended and accept that it might be ignored by some styles (actually even on Linux depending the style the user set it might be ignored). Clearly this doesn't warrant all those ifdefs. And I'd argue it's the same for the spin box by the way.
Just do what's semantically right with the API whatever the platform or the style. Otherwise you're overfitting your code to a particular set of styles and if for some reason that changes things will break in unexpected ways.
And I know that designers might not like that as an answer they don't get 100% the style expected but with widgets based there's a price to the desktop integration it's that you need to abandon some freedom to the platform. This is kind of intended.
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.
And I know that designers might not like that as an answer they don't get 100% the style expected but with widgets based there's a price to the desktop integration it's that you need to abandon some freedom to the platform. This is kind of intended.
I'm with you with that :)
The problem was that when you, for example, set the font to white, you get also a white font on the buttons (If I remember correctly) but the background color of the button does not change to your expected background color (blue for example). Now you can't read the text on the buttons anymore. This is especially an issue for us because we allow our customers to brand their application. Now when they choose a dark background and a light font color they don't see the text anymore on the buttons.
In my opinion, we should stay away from modifying the palette. We would have a lot less trouble, and the application would look native (I would argue that users love that).
EDIT: One thing we can do to remove the ifdefs is doing on Linux the same as on Windows and OSX.
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.
@er-vin I removed the ifdefs as far as possible
void OwncloudAdvancedSetupPage::setupSyncModeLabel() | ||
{ | ||
auto sizePolicy = _ui.syncModeLabel->sizePolicy(); | ||
sizePolicy.setRetainSizeWhenHidden(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 admit I'm still dismayed this needs to be done like this for individual widgets, I'd expect there's a better way... as I said I'd have expected it to be enough on individual pages. But if that's really not the case it seems to be on most widgets in each page, so maybe use findChildren<QWidget>
and apply it to them all in a loop? Not super in love with that but would at least remove some of the noise related to this...
d6a0efc
to
7482ddc
Compare
@@ -269,7 +250,7 @@ bool OwncloudSetupPage::validatePage() | |||
QString u = url(); | |||
QUrl qurl(u); | |||
if (!qurl.isValid() || qurl.host().isEmpty()) { | |||
setErrorString(tr("Invalid URL"), false); | |||
setErrorString(tr("Server address does not seem to be valid"), false); |
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.
@FlexW Really up to you to decide, but, I think, having it as simple as Server address is invalid would do the trick :)
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.
Was a suggestion by @jancborchardt . I'm fine with both:) Jan what do you think?
70a2e4b
to
89d0397
Compare
|
||
namespace OCC { | ||
|
||
class LinkLabel : public QLabel |
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'd argue you don't need that class at all, QLabel supports URLs just fine:
https://doc.qt.io/qt-5/qlabel.html#linkActivated
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 created this class because of the hover event. I needed to underline the font on hover. I couldn't find an API in QLabel that allows me to underline the label just on hover. There is QLabel::linkHover() but with that, you get just the hover entry signal not the hover out signal. Please correct me if I'm wrong ;)
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.
Honestly I'd consider like it's overdoing it and I'd be fine to have the text underlined. I'd rather spare the extra class with debatable API just for that. :-)
Now if really... one thing which could be done is to use an event filter to catch the enter/leave events and force the style on the label. We're back at having an extra class though, it's just that it'd have a safer API in my views. Indeed it'd be more focused on "change some property of a widget when it is entered, restore it when it's left" so it's easier to have a focused API.
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.
@er-vin
It was wished by the design team ;)
One problem I see with not making an extra class is how to embed the link into the label? I know I can use rich text for that but when rich text is used the font of the label stays not white anymore it uses a different color. Now I know I can work around this by setting the font in the rich text again but it gets then a lot more complicated than it is now. Another possibility would be to create another event filter or even use the HoverEventFilter and rename it to LinkLabelEventFilter but I'm unsure if this brings any benefit to what we have now. What do you think?
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.
@er-vin
It was wished by the design team ;)
Not argument enough in my opinion if that leads to potentially harmful code piling up. ;-)
(not that this single occurrence is super harmful of course, but my experience is that unchallenged design decisions lead to a path of death by 1000 cuts, hence why the question should be at least asked, every single time)
One problem I see with not making an extra class is how to embed the link into the label? I know I can use rich text for that but when rich text is used the font of the label stays not white anymore it uses a different color. Now I know I can work around this by setting the font in the rich text again but it gets then a lot more complicated than it is now. Another possibility would be to create another event filter or even use the HoverEventFilter and rename it to LinkLabelEventFilter but I'm unsure if this brings any benefit to what we have now. What do you think?
Alright, I prefer the event filter but I see you'll be struggling with that one. Let's scrap that...
Well the main problem really is the QLabel inheritance. I'd be fine even with inheriting from QWidget and have a single QLabel as child (and in a private member). Design wise the problem is that this is still a QLabel with all its API being exposed to the users of LinkLabel. Delegation is way better than inheritance in most cases, here included.
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... too bad this went in unsolved. Is there any PR I should look forward to regarding this?
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.
@er-vin No not at the moment but I like to do better here. I will create one and let you know then.
void customizeSecondaryButtonStyle(QAbstractButton *button) | ||
{ | ||
#ifdef Q_OS_LINUX | ||
// Only style push buttons on Linux as on other platforms we are unable to style the background color |
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.
Yes, in the past we used style sheets to make the buttons blue. But if we use style sheets, the buttons do not look native anymore as can be seen on the current wizard in OSX and Windows.
Yes, that's one of the reasons why I don't like stylesheets.
See also the warning here: https://doc.qt.io/qt-5/qpalette.html#details
I guess this warning applies to Windows 10 as well but really if you know how to change the background color of push buttons with the palette on Windows and OSX I would love to hear that:) I searched quite a while for a solution...
Well let's say that the thing is: you should modify the palette as intended and accept that it might be ignored by some styles (actually even on Linux depending the style the user set it might be ignored). Clearly this doesn't warrant all those ifdefs. And I'd argue it's the same for the spin box by the way.
Just do what's semantically right with the API whatever the platform or the style. Otherwise you're overfitting your code to a particular set of styles and if for some reason that changes things will break in unexpected ways.
And I know that designers might not like that as an answer they don't get 100% the style expected but with widgets based there's a price to the desktop integration it's that you need to abandon some freedom to the platform. This is kind of intended.
9b9aede
to
5a39db6
Compare
Screencast (recorded on Linux with i3): Screencast Windows: |
5a39db6
to
91a3c3d
Compare
@FlexW looks very nice with white/default background as well! :) Only 2 details then:
Otherwise all good to go :) |
@jancborchardt Okay. I'm unsure which glitch you mean. I think it works as expected. Maybe I was pressing the buttons to fast and therefore it looks like a glitch. |
91a3c3d
to
1c511b4
Compare
@er-vin Could you please approve this pr or tell me if there is anything that needs to be changed in your opinion? Since we need that pr for the release tomorrow:) |
AppImage file: Nextcloud-PR-2895-1c511b4b3b9a6940b4068b12b88fd8f7d0c20ab0-x86_64.AppImage |
Busy busy, trying to find some free time tonight.
Indeed it's cutting it short now... |
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.
Still that LinkLabel class which needs a round, other than that... well... this PR is became hard to review a while ago so it might be hiding other things.
|
||
namespace OCC { | ||
|
||
class LinkLabel : public QLabel |
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.
@er-vin
It was wished by the design team ;)
Not argument enough in my opinion if that leads to potentially harmful code piling up. ;-)
(not that this single occurrence is super harmful of course, but my experience is that unchallenged design decisions lead to a path of death by 1000 cuts, hence why the question should be at least asked, every single time)
One problem I see with not making an extra class is how to embed the link into the label? I know I can use rich text for that but when rich text is used the font of the label stays not white anymore it uses a different color. Now I know I can work around this by setting the font in the rich text again but it gets then a lot more complicated than it is now. Another possibility would be to create another event filter or even use the HoverEventFilter and rename it to LinkLabelEventFilter but I'm unsure if this brings any benefit to what we have now. What do you think?
Alright, I prefer the event filter but I see you'll be struggling with that one. Let's scrap that...
Well the main problem really is the QLabel inheritance. I'd be fine even with inheriting from QWidget and have a single QLabel as child (and in a private member). Design wise the problem is that this is still a QLabel with all its API being exposed to the users of LinkLabel. Delegation is way better than inheritance in most cases, here included.
Signed-off-by: Felix Weilbach <[email protected]>
Signed-off-by: Felix Weilbach <[email protected]>
Signed-off-by: Felix Weilbach <[email protected]>
Signed-off-by: Felix Weilbach <[email protected]>
1c511b4
to
e0b7ef1
Compare
AppImage file: Nextcloud-PR-2895-e0b7ef15b207f59d73884f8e1c12a206803c5c40-x86_64.AppImage |
🎉 |
Really great work @FlexW! :) And thanks @er-vin @allexzander for the reviews |
Resolves #2720
Signed-off-by: Felix Weilbach [email protected]