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

fix #272441: Toolbar Editor: Toolbar duplication #3689

Closed

Conversation

JoshuaBonn1
Copy link
Contributor

Originally, the toolbar only worked for the note input toolbar and had a bug for each other one. Now it correctly handles any edit to the toolbars.
The workspace only had the note input toolbar saved into the workspace. That has now been expanded to playback controls toolbar and file operations toolbar.

@JoshuaBonn1 JoshuaBonn1 changed the title Fix toolbar editor, save all toolbars to workspace fix #272441: Toolbar Editor: Toolbar duplication May 22, 2018
@Jojo-Schmitz
Copy link
Contributor

Jojo-Schmitz commented May 22, 2018

Please do not make revision.h being part of any commit.
See developers' handbook and the post-checkout hook, https://musescore.org/en/handbook/developers-handbook/compilation/compile-instructions-windows-mingw-git#Source-Code, the part marked optional but recommended

connect(mag, SIGNAL(magChanged(MagIdx)), SLOT(magChanged(MagIdx)));
fileTools->addWidget(mag);
viewModeCombo = new QComboBox(this);
#if defined(Q_OS_MAC)
Copy link
Contributor

Choose a reason for hiding this comment

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

No indent for pre-processor directives, please.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just to clarify, you want me to change it to the following?

#if defined(Q_OS_MAC)
      viewModeCombo->setFocusPolicy(Qt::StrongFocus);
#else
      viewModeCombo->setFocusPolicy(Qt::TabFocus);
#endif

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, please. Here and in the other places.

for (auto s : _fileOperationEntries) {
if (!*s)
fileTools->addSeparator();
fileTools->addWidget(new AccessibleToolButton(fileTools, getAction(s)));
Copy link
Contributor

Choose a reason for hiding this comment

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

don't we need an else here?

for (auto s : _fileOperationEntries) {
if (!*s)
fileTools->addSeparator();
fileTools->addWidget(new AccessibleToolButton(fileTools, getAction(s)));
Copy link
Contributor

Choose a reason for hiding this comment

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

and here?

@JoshuaBonn1
Copy link
Contributor Author

It seems the message about the revision.h is not found in the Ubuntu build instructions. Is it a specific windows thing? Cause, it worked for me on Ubuntu 16.04LTS

@anatoly-os
Copy link
Contributor

It does work on any platform 'cause revision.h is not used in development, but in release process only. So, the content of this file is changed by release managers before the official release.


if (qApp->layoutDirection() == Qt::LayoutDirection::LeftToRight) {
for (auto s : _fileOperationEntries) {
if (!*s)
Copy link
Contributor

Choose a reason for hiding this comment

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

Dumb question - is it really (!*s) as opposed to (*s != "")? Or does that conversion happen elsewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Most of this was just copying and pasting from existing code. I personally like *s != "" better if it works as expected

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Upon compilation, it says that ISO C++ forbids that. The only thing that seems to work (for compilation) is strcmp(s, "").

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, it segfaults when I tried that. So, !*s checks the first character of s for '\0'

Copy link
Contributor

Choose a reason for hiding this comment

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

Good point. Like I said, dumb question :-)

transportTools->addSeparator();
else {
if (QString(s) == "midi-on") {
#ifdef HAS_MIDI
Copy link
Contributor

Choose a reason for hiding this comment

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

As I think was mentioned elsewhere, we don't indent ifdef's

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I asked Jojo Schmitz and he said I should add tabs. Or am I confused about the actual purpose (see an above outdated message for that)

Copy link
Contributor

Choose a reason for hiding this comment

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

if you peruse the source I don't think you'll find a single instance of the ifdef statement itself being indented. The content of the ifdef, sure, it should be inline with the rest of the code. I think that's what the comment you mention was talking about. @Jojo-Schmitz?

Copy link
Contributor

Choose a reason for hiding this comment

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

What @Jojo-Schmitz actually wrote was "No indent for pre-processor directives, please.". Emphasis on the "no".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, I was misunderstanding. I thought it meant no indent between the ifdefs. But it meant the ifdefs themselves should have no whitespace before them. I'll fix that

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, that's what I meant

@JoshuaBonn1 JoshuaBonn1 force-pushed the 272441-toolbar-editor branch 2 times, most recently from 422be72 to da18960 Compare May 28, 2018 18:16
if (QString(s) == "midi-on") {
#ifdef HAS_MIDI
transportTools->addWidget(new AccessibleToolButton(transportTools, getAction(s)));
#endif
Copy link
Contributor

Choose a reason for hiding this comment

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

doesn't this result in starting with a separator in case of no MIDI? Wouldn't we need to skip that separator in an #else branch? The old code certainly only added the separator in the #if branch.
So either skip it or explicitly add it here but remove the empty entry from that array?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I add it explicitly, then it's going to have odd behavior when switching the MIDI around to different locations. If I add a skip, then what do I skip when midi is placed in different places? Or will "midi-on" even be an available action if there is no midi?

Copy link
Contributor

Choose a reason for hiding this comment

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

In other apps I've used with customizable toolbars, buttons are buttons, separators are separators, and there is no connection between them. Adding a button doesn't ever add a separator, or does deleting a button delete a separator, nor does moving a button move a separator. Both are under the user's independent control.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For midi not being there, maybe it should remove both the midi option and the separator on the first run and then let the user customize it from then on. Then it will work for the default workspaces and anything custom past that is the user’s choice.

Copy link
Contributor

Choose a reason for hiding this comment

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

Now with your latest change that whole section is no longer needed, as that string (and the separator) doesn't exist if HAS_MIDI is not #define'd.
I like that change, it kills 2 birds with one stone ;-)

@JoshuaBonn1 JoshuaBonn1 force-pushed the 272441-toolbar-editor branch 2 times, most recently from b635e25 to b30e7d2 Compare May 30, 2018 22:10
The toolbar editor now behaves correctly, each toolbar may be edited
Playback controls and File operations are now saved to the workspace
@Jojo-Schmitz
Copy link
Contributor

Needs a rebase

@Jojo-Schmitz
Copy link
Contributor

OK, I've rebased/cherry-picked it into my #4076 now, in the understand that @JoshuaBonn1 lost his build environment and won't get it back any time soon (enough)

@Jojo-Schmitz
Copy link
Contributor

as a separate PR now in #4078

@anatoly-os
Copy link
Contributor

Merged #4078

@anatoly-os anatoly-os closed this Oct 29, 2018
@JoshuaBonn1 JoshuaBonn1 deleted the 272441-toolbar-editor branch January 12, 2024 03:06
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.

None yet

4 participants