Skip to content

7613 effect panel - #7637

Merged
saintmatthieu merged 3 commits into
audacity:masterfrom
saintmatthieu:7613-effect-panel
Nov 4, 2024
Merged

saintmatthieu merged 3 commits into
audacity:masterfrom
saintmatthieu:7613-effect-panel

Conversation

@saintmatthieu

Copy link
Copy Markdown
Contributor

Resolves: #7613

  • I signed CLA
  • The title of the pull request describes an issue it addresses
  • If changes are extensive, then there is a sequence of easily reviewable commits
  • Each commit's message describes its purpose and effects
  • There are no behavior changes unnecessary for the stated purpose of the PR

Recommended:

  • Each commit compiles and runs on my machine without known undesirable changes of behavior

@saintmatthieu saintmatthieu Oct 30, 2024 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The diff tool didn't really get the change here:
This ColumnLayout actually didn't change, except for its indentation and anchors.fill: parent which got replaced by

Layout.fillWidth: true
Layout.fillHeight: true

So from here on, there are no changes left in this file.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I would suggest using section in name, as it is misleading with our real panels

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't mind, but what is it that you call "panel" ? Those dockable guys ?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

yes

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ok

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can you please explain what's going on here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes:
ProjectPage constructs a TracksTitleBar (A) and a TracksPanel (B). Before this change, these two only had to fill the width of their parent.
Now, optionally, A' and B' will appear, meaning TracksTitleBar and TracksPanel need to use the same width so the end result looks like a regular grid.
Unbenannt

In C++, I'd probably just add a non-optional ctor argument to these classes, and this would be passed by ProjectPage.
But I don't know of non-optional ctor args in QML. These lines you've commented were a feeble attempt from me to solve this: ProjectPage, when instantiating these two guys, would have to specify TracksTitleBar { effectsPanelWidth: 240 } and likewise for TracksPanel, and if it doesn't, I issue a warning.
I think the proper way would actually be to have a global constant for these two guys to reuse, but I thought you and Greg might teach me some best practice during the review?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The title bar width is calculated based on the parent width (anchors.fill: parent for root), so it looks like you don't need to calculate anything extra here.
try without these manipulations

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, the title bar width is calculated based on the parent width, but then internally it has to know the relative width of its two sections, so I'm afraid there's no way around these manipulations.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

you can use effectsTitleBar directly
or even better make an alias for root
property alias showEffectsPanel: effectsTitleBar.visible

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

qsTrc("projectscene", "Effects")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

In qml there is a concept of binding: if you assign one property to another property (line 175), the value is automatically assigned to the first property when the second property changes. But if you later assign a fixed value to the first property, as in this line, then the binding stops working.

You of course need to remove the entire onShowEffectsSectionChanged block because you are already doing the same thing from line 175

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Is binding really what's happening line 175 in this case, though?
root.verticalPanelDefaultWidth + (showEffectsSection ? effectsSectionWidth : 0) isn't a property but an expression using properties.
I would really have liked this to work, but I tried your suggestion and indeed, it doesn't.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

please add new line before this line

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

please add new line before this line

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I wasn't the author, I'm certainly not going to begin applying rules I don't hold for important to code I haven't modified.

@Eism Eism Nov 1, 2024 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

please add new line before this line

also this is old style for qml, you should use function like for onAddRequested

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Line 85 of this file is onInited: {, and git tells me you're the author.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

we all make mistakes

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@Eism By the way, what our codestyle says about arrow function syntax?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Using functions is necessary to resolve warnings in qml so that we can use the arrow function because it is also a function :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'll pay attention to this warning, thanks for the info.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

extra space :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ok, that one's obvious :D

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

id always comes first in properties

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

try adding it here:

spacing: 0

There are multiple items within layout and it probably has some default spacing set (which is more than 0, hence vertical misalignment)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Spot on! 😚

@saintmatthieu
saintmatthieu merged commit 7130629 into audacity:master Nov 4, 2024
@saintmatthieu
saintmatthieu deleted the 7613-effect-panel branch August 28, 2026 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Effect panel (part 1)

4 participants