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
Conversation
Please do not make revision.h being part of any commit. |
mscore/musescore.cpp
Outdated
connect(mag, SIGNAL(magChanged(MagIdx)), SLOT(magChanged(MagIdx))); | ||
fileTools->addWidget(mag); | ||
viewModeCombo = new QComboBox(this); | ||
#if defined(Q_OS_MAC) |
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.
No indent for pre-processor directives, please.
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 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
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, please. Here and in the other places.
mscore/musescore.cpp
Outdated
for (auto s : _fileOperationEntries) { | ||
if (!*s) | ||
fileTools->addSeparator(); | ||
fileTools->addWidget(new AccessibleToolButton(fileTools, getAction(s))); |
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.
don't we need an else
here?
mscore/musescore.cpp
Outdated
for (auto s : _fileOperationEntries) { | ||
if (!*s) | ||
fileTools->addSeparator(); | ||
fileTools->addWidget(new AccessibleToolButton(fileTools, getAction(s))); |
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 here?
091f141
to
f1bc277
Compare
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 |
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) |
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.
Dumb question - is it really (!*s) as opposed to (*s != "")? Or does that conversion happen elsewhere?
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.
Most of this was just copying and pasting from existing code. I personally like *s != ""
better if it works as expected
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.
Upon compilation, it says that ISO C++ forbids that. The only thing that seems to work (for compilation) is strcmp(s, "")
.
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, it segfaults when I tried that. So, !*s
checks the first character of s for '\0'
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.
Good point. Like I said, dumb question :-)
mscore/musescore.cpp
Outdated
transportTools->addSeparator(); | ||
else { | ||
if (QString(s) == "midi-on") { | ||
#ifdef HAS_MIDI |
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.
As I think was mentioned elsewhere, we don't indent ifdef's
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 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)
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 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?
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 @Jojo-Schmitz actually wrote was "No indent for pre-processor directives, please.". Emphasis on the "no".
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.
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
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.
Yep, that's what I meant
422be72
to
da18960
Compare
mscore/musescore.cpp
Outdated
if (QString(s) == "midi-on") { | ||
#ifdef HAS_MIDI | ||
transportTools->addWidget(new AccessibleToolButton(transportTools, getAction(s))); | ||
#endif |
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.
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?
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 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?
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.
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.
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.
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.
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.
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 ;-)
b635e25
to
b30e7d2
Compare
The toolbar editor now behaves correctly, each toolbar may be edited Playback controls and File operations are now saved to the workspace
b30e7d2
to
bdfdf6b
Compare
Needs a rebase |
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) |
as a separate PR now in #4078 |
Merged #4078 |
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.