Skip to content

Commit

Permalink
Merge pull request #4193 from MarcSabatella/tours-menu
Browse files Browse the repository at this point in the history
add Help / Tours submenu
  • Loading branch information
anatoly-os committed Nov 22, 2018
2 parents a4e6ad8 + 49c85f9 commit 8df7239
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 4 deletions.
14 changes: 14 additions & 0 deletions mscore/musescore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ void MuseScore::preferencesChanged(bool fromWorkspace)
getAction("follow")->setChecked(preferences.getBool(PREF_APP_PLAYBACK_FOLLOWSONG));
getAction("midi-on")->setEnabled(preferences.getBool(PREF_IO_MIDI_ENABLEINPUT));
getAction("toggle-statusbar")->setChecked(preferences.getBool(PREF_UI_APP_SHOWSTATUSBAR));
getAction("show-tours")->setChecked(preferences.getBool(PREF_UI_APP_STARTUP_SHOWTOURS));
_statusBar->setVisible(preferences.getBool(PREF_UI_APP_SHOWSTATUSBAR));

MuseScore::updateUiStyleAndTheme();
Expand Down Expand Up @@ -1733,6 +1734,13 @@ MuseScore::MuseScore()
menuHelp->addAction(onlineHandbookAction);
Workspace::addActionAndString(onlineHandbookAction, "online-handbook");

menuTours = new QMenu();
a = getAction("show-tours");
a->setChecked(preferences.getBool(PREF_UI_APP_STARTUP_SHOWTOURS));
menuTours->addAction(a);
menuTours->addAction(getAction("reset-tours"));
menuHelp->addMenu(menuTours);

menuHelp->addSeparator();

aboutAction = new QAction("", 0);
Expand Down Expand Up @@ -1810,6 +1818,7 @@ MuseScore::MuseScore()
Workspace::addMenuAndString(menuVoices, "menu-voices");
Workspace::addMenuAndString(menuPlugins, "menu-plugins");
Workspace::addMenuAndString(menuHelp, "menu-help");
Workspace::addMenuAndString(menuTours, "menu-tours");

Workspace::writeGlobalMenuBar(mb);

Expand Down Expand Up @@ -1901,6 +1910,7 @@ void MuseScore::retranslate()
menuVoices->setTitle(tr("&Voices"));
menuPlugins->setTitle(tr("&Plugins"));
menuHelp->setTitle(tr("&Help"));
menuTours->setTitle(tr("&Tours"));

aboutAction->setText(tr("&About..."));
aboutQtAction->setText(tr("About &Qt..."));
Expand Down Expand Up @@ -5867,6 +5877,10 @@ void MuseScore::cmd(QAction* a, const QString& cmd)
switchLayoutMode(LayoutMode::PAGE);
}
}
else if (cmd == "show-tours")
preferences.setPreference(PREF_UI_APP_STARTUP_SHOWTOURS, a->isChecked());
else if (cmd == "reset-tours")
tourHandler()->resetCompletedTours();
else if (cmd == "report-bug")
reportBug("panel");
else if (cmd == "leave-feedback")
Expand Down
1 change: 1 addition & 0 deletions mscore/musescore.h
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,7 @@ class MuseScore : public QMainWindow, public MuseScoreCore {

QMenu* menuPlugins;
QMenu* menuHelp;
QMenu* menuTours;
AlbumManager* albumManager { 0 };

QWidget* _searchDialog { 0 };
Expand Down
21 changes: 21 additions & 0 deletions mscore/shortcut.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3563,6 +3563,27 @@ Shortcut Shortcut::_sc[] = {
Icons::Invalid_ICON,
Qt::ApplicationShortcut
},
{
MsWidget::MAIN_WINDOW,
STATE_ALL,
"show-tours",
QT_TRANSLATE_NOOP("action", "Show Tours"),
QT_TRANSLATE_NOOP("action", "Show tours"),
QT_TRANSLATE_NOOP("action", "Toggle display of tours"),
Icons::Invalid_ICON,
Qt::WindowShortcut,
ShortcutFlags::A_CHECKABLE
},
{
MsWidget::MAIN_WINDOW,
STATE_ALL,
"reset-tours",
QT_TRANSLATE_NOOP("action", "Reset Tours"),
QT_TRANSLATE_NOOP("action", "Reset tours"),
0,
Icons::Invalid_ICON,
Qt::WindowShortcut
},
{
MsWidget::MAIN_WINDOW,
STATE_ALL,
Expand Down
18 changes: 14 additions & 4 deletions mscore/tourhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,16 @@ void TourHandler::loadTour(XmlReader& tourXml)
shortcutToTour[s] = tour;
}

//---------------------------------------------------------
// resetCompletedTours
//---------------------------------------------------------

void TourHandler::resetCompletedTours()
{
for (auto tour : allTours)
tour->setCompleted(false);
}

//---------------------------------------------------------
// readCompletedTours
//---------------------------------------------------------
Expand Down Expand Up @@ -426,9 +436,9 @@ void TourHandler::displayTour(Tour* tour)
// Add text (translation?)
mbox->setText(tourMessages[i].message);

// Add "Do not show again" checkbox
QCheckBox* showToursBox = new QCheckBox(tr("Do not show me tours"), mbox);
showToursBox->setChecked(!showTours);
// Add checkbox to show tours
QCheckBox* showToursBox = new QCheckBox(tr("Continue showing tours"), mbox);
showToursBox->setChecked(showTours);
mbox->setCheckBox(showToursBox);

// Display the message box, position it if needed
Expand All @@ -443,7 +453,7 @@ void TourHandler::displayTour(Tour* tour)
overlay->show();
mbox->exec();
overlay->hide();
showTours = !(showToursBox->isChecked());
showTours = showToursBox->isChecked();

// Handle the button presses
if (mbox->clickedButton() == nextButton) {
Expand Down
1 change: 1 addition & 0 deletions mscore/tourhandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ public slots:
public:
TourHandler(QObject* parent) : QObject(parent) {}
void loadTours();
void resetCompletedTours();
void readCompletedTours();
void writeCompletedTours();

Expand Down

0 comments on commit 8df7239

Please sign in to comment.