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 #289190 - Toolbar customization refinements & fixes #5019

Closed

Conversation

Obliquely
Copy link
Contributor

@Obliquely Obliquely commented May 15, 2019

  • made dialogue show the proper names for customisable actions / item
    previously it was showing the internal tags/ids (which won't translate)

  • allow for the view mode / view zoom to be customised like other items

  • fixed title of dialogue box

  • removed text box showing workspace name from dialogue box - it's an
    edit box showing information that can never be edited - unhelpful UI

  • added name of workspace being edited to the dialogue box title

  • re-ordered the available and chosen lists in the dialogue box to make
    more sense - most specific is at the right and not in the middle

  • added tooltips to various items in dialogue box

  • menu is greyed out / disabled when toolbars are not customisable,
    i.e. because we're in advanced or basic mode

  • available actions now maintain STANDARD order when items are removed
    from the current toolbar

@Obliquely
Copy link
Contributor Author

Before changes

After changes


viewModeCombo = new QComboBox(this);
for (auto s : _fileOperationEntries) {
Copy link
Contributor

Choose a reason for hiding this comment

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

wrong indentation, we use 6 spaces per level, here it is 8


// view-options is treated as a special case as it's not a QToolButton
// but, rather, made up of two QComboBox objects (one sub-classed).
void MuseScore::addViewOptionsDoubleWidget()
Copy link
Contributor

Choose a reason for hiding this comment

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

here it is 4

@@ -882,6 +883,7 @@ MasterSynthesizer* synthesizerFactory();
Driver* driverFactory(Seq*, QString driver);

extern QAction* getAction(const char*);
extern QString getShortcutText(const char*);
Copy link
Contributor

Choose a reason for hiding this comment

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

wrong indent again

QT_TRANSLATE_NOOP("action","View Options"),
0,
0,
Icons::viewOptions_ICON,
Copy link
Contributor

Choose a reason for hiding this comment

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

different indeting here, but one space too much ;-)


QString getShortcutText(const char* id)
{
Shortcut* shortcut = Shortcut::getShortcut(id);
Copy link
Contributor

Choose a reason for hiding this comment

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

6 spaces here please

<item row="1" column="0" rowspan="2" colspan="2">
<widget class="QListWidget" name="toolbarList">
<property name="toolTip">
<string>Toolbar to customise</string>
Copy link
Contributor

Choose a reason for hiding this comment

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

customize please, US spelling. And I promise to translate it to customise for the Brits ;-)

}
else
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.

Wrong indent (we use banner style, braces indented)

bool leftToRightLayout = qApp->layoutDirection() == Qt::LayoutDirection::LeftToRight;

if (!leftToRightLayout)
_fileOperationEntries.reverse();
Copy link
Contributor

Choose a reason for hiding this comment

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

6 spaces here

}

if (!leftToRightLayout)
_fileOperationEntries.reverse();
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

mag = new MagBox;
connect(mag, SIGNAL(magChanged(MagIdx)), SLOT(magChanged(MagIdx)));
fileTools->addWidget(mag);

Copy link
Contributor

Choose a reason for hiding this comment

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

no spaces here

viewModeCombo = new QComboBox(this);
#if defined(Q_OS_MAC)
viewModeCombo->setFocusPolicy(Qt::StrongFocus);
#else
viewModeCombo->setFocusPolicy(Qt::TabFocus);
#endif
viewModeCombo->setFixedHeight(preferences.getInt(PREF_UI_THEME_ICONHEIGHT) + 8); // hack

Copy link
Contributor

Choose a reason for hiding this comment

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

nor here

viewModeCombo->setAccessibleName(tr("View Mode"));
viewModeCombo->addItem(tr("Page View"), int(LayoutMode::PAGE));
viewModeCombo->addItem(tr("Continuous View"), int(LayoutMode::LINE));
viewModeCombo->addItem(tr("Single Page"), int(LayoutMode::SYSTEM));

Copy link
Contributor

Choose a reason for hiding this comment

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

nor here


//---------------------------------------------------------
// populatePlaybackControls
//---------------------------------------------------------

void MuseScore::populatePlaybackControls()
{
{
Copy link
Contributor

Choose a reason for hiding this comment

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

Either no spaces (for methods/functions) or 6

if (!*s)
transportTools->addSeparator();
if (!*s) {
transportTools->addSeparator();
Copy link
Contributor

Choose a reason for hiding this comment

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

indent... here and below

editToolbars = new ToolbarEditor(this);
}
editToolbars = new ToolbarEditor(this);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

banner style indent. Or no braces here at all for a single statement

@@ -111,49 +117,63 @@ void ToolbarEditor::accepted()
//---------------------------------------------------------

void ToolbarEditor::populateLists(const std::list<const char*>& all, std::list<const char*>* current)
{
{
Copy link
Contributor

Choose a reason for hiding this comment

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

no or 6 spaces...

actionList->clear();
for (auto currentId : *current) {
QString shortcutText = getShortcutText(currentId);
Copy link
Contributor

Choose a reason for hiding this comment

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

indent... here and below

actionList->addItem(item);

for (auto id : all) {
bool found = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

here too





Copy link
Contributor

Choose a reason for hiding this comment

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

excess white space

@@ -169,17 +169,20 @@ void MuseScore::changeWorkspace(QAction* a)
//---------------------------------------------------------

void MuseScore::changeWorkspace(Workspace* p, bool first)
{
Copy link
Contributor

Choose a reason for hiding this comment

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

indent...

Workspace::currentWorkspace->save();

Workspace::currentWorkspace->save();
Copy link
Contributor

Choose a reason for hiding this comment

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

spaces for nothing

updateIcons();
preferencesChanged(true);
}
updateIcons();
Copy link
Contributor

Choose a reason for hiding this comment

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

indent...

@Jojo-Schmitz
Copy link
Contributor

Jojo-Schmitz commented May 15, 2019

@anatoly-os
Copy link
Contributor

Please don't squash :) It will be useful during the review process of such non trivial changes

@Obliquely Obliquely force-pushed the Toolbar-customising-improvements branch from 3e77744 to e4602ee Compare May 17, 2019 18:37
@Obliquely
Copy link
Contributor Author

@Jojo-Schmitz I very much hope I've caught all the indenting errors now. I've squashed. Thanks for the help and apologies for using up your time on those kinds of error.

STATE_NORMAL,
"view-options",
QT_TRANSLATE_NOOP("action","View Options"),
0,
Copy link
Contributor

Choose a reason for hiding this comment

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

Please change that 0, into QT_TRANSLATE_NOOP("action","View options"),, needed for the shortcuts dialog (and as a tooltip) and there in sentence case

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This comment got me thinking. The zoom box and view mode box don't really belong in the shortcuts list at all. There are already shortcuts for various zoom and page mode actions. So I've slightly changed tack. (See below.)

@Obliquely Obliquely force-pushed the Toolbar-customising-improvements branch from e4602ee to 4f1e9c7 Compare May 20, 2019 22:57
@Obliquely
Copy link
Contributor Author

@Jojo-Schmitz 's comment about shortcuts (above) made me realise that it doesn't make sense to use shortcuts to represent the zoom and view mode combo boxes. There are already shortcut actions related to what the dropdown boxes do. This slightly reduces scope of changes and avoids the need for a new icon. Also added option to customise the zoom box and the view mode independently and fixed some spacing issues related to those toolbar items.

return new QListWidgetItem(action->icon(), itemName);
}

qDebug()<<"ToolbarEditor does not recognize id for toolbar item: "<<QString(id);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is it OK to leave the qDebug() in or is it better to do something with ASSERT (the syntax of which I'd need to look up :)). This should never be sprung, but it's pretty benign if it is.

Copy link
Contributor

Choose a reason for hiding this comment

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

IIRC qDebug()s vanish when build in RELEASE mode

@Jojo-Schmitz
Copy link
Contributor

Now Travis CI's mtests fail, check https://travis-ci.org/musescore/MuseScore/jobs/535052660#L4293-L4321

@@ -4140,7 +4140,10 @@ void MuseScore::changeState(ScoreState val)
if (getAction("split-measure")->isEnabled())
getAction("split-measure")->setEnabled(cs && cs->masterScore()->excerpts().size() == 0);

getAction("edit-toolbars")->setEnabled(!Workspace::currentWorkspace->readOnly());
Workspace* currentWorkspace = Workspace::currentWorkspace;
if (currentWorkspace) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

When running tst_runscripts test the currentWorkspace returns nullptr and MuseScore crashes before it even gets to run any of the tests. I've put in an explicit check to avoid this. It now passes 43/44 tests, which is exactly what master is currently passing. Is currentWorkspace unexpectedly being null because the tests are running MuseScore in "headless" mode (if that's the right terminology)? Might this be an issue elsewhere?

@Obliquely Obliquely force-pushed the Toolbar-customising-improvements branch from 3e43eb7 to 0fc921d Compare June 14, 2019 17:02
@dmitrio95 dmitrio95 added the strings Affects translatable strings label Feb 10, 2020
@Jojo-Schmitz
Copy link
Contributor

rebase needed

@Obliquely Obliquely force-pushed the Toolbar-customising-improvements branch from 0fc921d to c2db354 Compare February 22, 2020 12:05
@Jojo-Schmitz
Copy link
Contributor

Another rebase needed

@RobFog
Copy link

RobFog commented Aug 29, 2020

Is this another one for the design department and @Tantacrul to consider?

@Obliquely Obliquely force-pushed the Toolbar-customising-improvements branch from c2db354 to 22d5834 Compare August 30, 2020 13:01
@Jojo-Schmitz
Copy link
Contributor

Code style issues. The Travis fails seems to be unrelated to this PR

- make ToolbarEditor dialog show the proper names for customisable
  actions / item as previously it was showing the internal tags/ids

- allow for the view mode & page zoom dropdowns to be customised
  like all other toolbar items

- re-ordered the available and chosen lists in the dialogue box to make
  more sense - most specific is now at the right and not in the middle

- Customize Toolbars menu is greyed out / disabled when toolbars are
  not customisable, i.e. because we're in advanced or basic mode or
  because although workspace is editable the toolbars are not

- available actions now maintain STANDARD order when items are removed
  from the current toolbar

- improved the spacing of view mode and page zoom dropdowns on the toolbar
@Obliquely Obliquely force-pushed the Toolbar-customising-improvements branch from 22d5834 to abf514e Compare August 30, 2020 13:57
@Obliquely
Copy link
Contributor Author

Code style issues. The Travis fails seems to be unrelated to this PR

Code style fixed (via uncrustify - thanks :) ). Not sure i can do anything wrt TRAVIS fail.

@Jojo-Schmitz
Copy link
Contributor

No idea what to do about Travis, https://travis-ci.org/github/musescore/MuseScore/jobs/722473721#L484-L653
Seems entirely unrelated to the changer in this PR here

@vpereverzev vpereverzev added the archived PRs that have gone stale but could potentially be revived in the future label Dec 30, 2020
@vpereverzev
Copy link
Member

Automatically archived due to long inactivity. Could be re-opened later once an author will come back

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
archived PRs that have gone stale but could potentially be revived in the future strings Affects translatable strings
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants