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

System lock improvements #26324

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

mike-spa
Copy link
Contributor

@mike-spa mike-spa commented Feb 4, 2025

Resolves: #26278
Resolves: #26273
Resolves: #25806
Resolves: #26336
Resolves: #26337

@avvvvve regarding this request

@mike-spa Also, the tooltip width should match the width of the buttons.

I don't think we do that anywhere else. In fact, I don't even know if it's possible to do that, given that tooltips by definition pop up above the UI and are not bound to it, see e.g.
image
But I'm also deeply QML-ignorant, so I may well be talking BS (@cbjeukendrup is the expert here).

@@ -156,10 +156,10 @@ InspectorSectionView {

orientation: Qt.Horizontal
icon: Boolean(model.allSystemsAreLocked) ? IconCode.LOCK_CLOSED : IconCode.LOCK_OPEN
text: qsTrc("inspector", "Lock current system")
text: qsTrc("inspector", "%1 selected %2".arg(Boolean(model.allSystemsAreLocked) ? "Unlock" : "Lock").arg(model.systemCount > 1 ? "systems" : "system"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lupdate is too dumb for this; can only textually analyse the code, so does not understand that it should extract 2x2 strings from this.

One way would be to make each part separately translatable:

Suggested change
text: qsTrc("inspector", "%1 selected %2".arg(Boolean(model.allSystemsAreLocked) ? "Unlock" : "Lock").arg(model.systemCount > 1 ? "systems" : "system"))
text: qsTrc("inspector", "%1 selected %2").arg(Boolean(model.allSystemsAreLocked) ? qsTrc("inspector", "Unlock") : qsTrc("inspector", "Lock")).arg(model.systemCount > 1 ? qsTrc("inspector", "systems") : qsTrc("inspector", "system")) // not recommended

But that is very ugly, and means the translators will have to translate 5 cryptical strings instead of 4 normal ones. So I'd just write them out in full; makes the code a bit longer, but that's okay.

Suggested change
text: qsTrc("inspector", "%1 selected %2".arg(Boolean(model.allSystemsAreLocked) ? "Unlock" : "Lock").arg(model.systemCount > 1 ? "systems" : "system"))
text: {
if (model.allSystemsAreLocked) {
return model.systemCount > 1 ?:
} else {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I suspected that might have been the better way. Thanks 👍

@cbjeukendrup
Copy link
Contributor

Also, the tooltip width should match the width of the buttons.

I don't think we do that anywhere else. In fact, I don't even know if it's possible to do that, given that tooltips by definition pop up above the UI and are not bound to it, see e.g.

It's possible, but would be a little bit cumbersome to implement. Also, are we sure we really want that? I'd think the tooltips stand out more when they don't have the same width as the button, increasing clarity.

@avvvvve
Copy link

avvvvve commented Feb 4, 2025

Functionality fixes & copy look great! Some requests below, and while I was testing I noticed two other issues that I logged separately.


Newly logged issues
Should be small fixes, so might make sense to just do them in this PR too.


Shortcut function while system lock is selected
Can we make the following two shortcuts remove a system lock when the actual system lock icon is selected? Right now, nothing happens. There's precedent for this with system breaks/page breaks (when you select one and press enter/ctrl + enter, it's deleted).

  • Add/remove system lock
  • Toggle system lock
image

Tooltip width
I didn't mean that tooltips should match the width of their buttons as a general rule, but in this case they're exactly as wide as the left panel, which I don't think helps them stand out and just looks clunky. And when the panel is up against the edge of the window, the tooltip gets bumped out to the right a bit and ends up looking off center (third screenshot).

Could we hard-code the width of these two tooltips specifically to 276px to be the same as their buttons? It seems like their max width is already set to 300.

image image image

Copy link

@avvvvve avvvvve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above comment

@cbjeukendrup
Copy link
Contributor

cbjeukendrup commented Feb 5, 2025

Changing the maximum width for some particular tooltips is actually the cumbersome bit. But it's doable; @mike-spa see StyledToolTip.qml, ToolTipProvider.qml and qmltooltip.cpp, and basically add a maxWidth property similar to title/description/shortcut. (And see the toolTip… properties of FlatButton of course.) Will make the list of properties/parameters even longer, but that's perhaps acceptable in this case.

@avvvvve
Copy link

avvvvve commented Feb 5, 2025

@cbjeukendrup @mike-spa goes without saying, but the other stuff is more important than tooltip width so if it's a major pain we can save it for later.

@mike-spa mike-spa force-pushed the systemLockImprovements branch from 95e936e to 06caad8 Compare February 5, 2025 12:52
@mike-spa
Copy link
Contributor Author

mike-spa commented Feb 5, 2025

@avvvvve all done except the tooltip. It's a lot of work and it's just not worth it right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants