2021-04-19 16:06:08 +02:00
|
|
|
/*
|
|
|
|
* SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
* MuseScore-CLA-applies
|
|
|
|
*
|
|
|
|
* MuseScore
|
|
|
|
* Music Composition & Notation
|
|
|
|
*
|
|
|
|
* Copyright (C) 2021 MuseScore BVBA and others
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 3 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2021-03-30 19:30:16 +02:00
|
|
|
#include "userscoresuiactions.h"
|
|
|
|
|
|
|
|
using namespace mu::userscores;
|
|
|
|
using namespace mu::ui;
|
|
|
|
|
|
|
|
const UiActionList UserScoresUiActions::m_actions = {
|
|
|
|
UiAction("file-open",
|
|
|
|
mu::context::UiCtxAny,
|
|
|
|
QT_TRANSLATE_NOOP("action", "Open..."),
|
|
|
|
QT_TRANSLATE_NOOP("action", "Load score from file")
|
|
|
|
),
|
|
|
|
UiAction("file-new",
|
|
|
|
mu::context::UiCtxAny,
|
|
|
|
QT_TRANSLATE_NOOP("action", "New..."),
|
|
|
|
QT_TRANSLATE_NOOP("action", "Create new score")
|
|
|
|
),
|
|
|
|
UiAction("file-close",
|
|
|
|
mu::context::UiCtxNotationOpened,
|
|
|
|
QT_TRANSLATE_NOOP("action", "Close"),
|
|
|
|
QT_TRANSLATE_NOOP("action", "Close current score")
|
|
|
|
),
|
|
|
|
UiAction("file-save",
|
|
|
|
mu::context::UiCtxNotationOpened,
|
|
|
|
QT_TRANSLATE_NOOP("action", "Save"),
|
|
|
|
QT_TRANSLATE_NOOP("action", "Save score to file")
|
|
|
|
),
|
2021-06-11 09:26:15 +02:00
|
|
|
UiAction("file-save-online",
|
|
|
|
mu::context::UiCtxNotationOpened,
|
|
|
|
QT_TRANSLATE_NOOP("action", "Upload to MuseScore.com"),
|
|
|
|
QT_TRANSLATE_NOOP("action", "Save score on MuseScore.com"),
|
|
|
|
IconCode::Code::CLOUD_FILE
|
|
|
|
),
|
2021-03-30 19:30:16 +02:00
|
|
|
UiAction("file-save-as",
|
|
|
|
mu::context::UiCtxNotationOpened,
|
2021-07-16 00:55:01 +02:00
|
|
|
QT_TRANSLATE_NOOP("action", "Save as..."),
|
2021-03-30 19:30:16 +02:00
|
|
|
QT_TRANSLATE_NOOP("action", "Save score under a new file name")
|
|
|
|
),
|
|
|
|
UiAction("file-save-a-copy",
|
|
|
|
mu::context::UiCtxNotationOpened,
|
2021-07-16 00:55:01 +02:00
|
|
|
QT_TRANSLATE_NOOP("action", "Save a copy..."),
|
2021-03-30 19:30:16 +02:00
|
|
|
QT_TRANSLATE_NOOP("action", "Save a copy of the score in addition to the current file")
|
|
|
|
),
|
|
|
|
UiAction("file-save-selection",
|
2021-04-28 13:07:36 +02:00
|
|
|
mu::context::UiCtxNotationFocused,
|
2021-07-16 00:55:01 +02:00
|
|
|
QT_TRANSLATE_NOOP("action", "Save selection..."),
|
2021-03-30 19:30:16 +02:00
|
|
|
QT_TRANSLATE_NOOP("action", "Save current selection as new score")
|
|
|
|
),
|
|
|
|
UiAction("file-export",
|
|
|
|
mu::context::UiCtxNotationOpened,
|
2021-06-10 13:44:56 +02:00
|
|
|
QT_TRANSLATE_NOOP("action", "Export"),
|
|
|
|
QT_TRANSLATE_NOOP("action", "Save a copy of the score in various formats"),
|
|
|
|
IconCode::Code::SHARE_FILE
|
2021-03-30 19:30:16 +02:00
|
|
|
),
|
2021-04-30 11:51:55 +02:00
|
|
|
UiAction("file-import-pdf",
|
2021-03-30 19:30:16 +02:00
|
|
|
mu::context::UiCtxAny,
|
|
|
|
QT_TRANSLATE_NOOP("action", "Import PDF..."),
|
|
|
|
QT_TRANSLATE_NOOP("action", "Import a PDF file with an experimental service on musescore.com")
|
|
|
|
),
|
|
|
|
UiAction("print",
|
|
|
|
mu::context::UiCtxAny,
|
|
|
|
QT_TRANSLATE_NOOP("action", "Print..."),
|
|
|
|
QT_TRANSLATE_NOOP("action", "Print score/part")
|
|
|
|
),
|
|
|
|
UiAction("clear-recent",
|
|
|
|
mu::context::UiCtxAny,
|
2021-07-16 00:55:01 +02:00
|
|
|
QT_TRANSLATE_NOOP("action", "Clear recent files")
|
2021-03-30 19:30:16 +02:00
|
|
|
)
|
|
|
|
};
|
|
|
|
|
|
|
|
UserScoresUiActions::UserScoresUiActions(std::shared_ptr<FileScoreController> controller)
|
|
|
|
: m_controller(controller)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
const UiActionList& UserScoresUiActions::actionsList() const
|
|
|
|
{
|
|
|
|
return m_actions;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool UserScoresUiActions::actionEnabled(const UiAction& act) const
|
|
|
|
{
|
|
|
|
if (!m_controller->canReceiveAction(act.code)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool UserScoresUiActions::actionChecked(const UiAction&) const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
mu::async::Channel<mu::actions::ActionCodeList> UserScoresUiActions::actionEnabledChanged() const
|
|
|
|
{
|
|
|
|
return m_actionEnabledChanged;
|
|
|
|
}
|
|
|
|
|
|
|
|
mu::async::Channel<mu::actions::ActionCodeList> UserScoresUiActions::actionCheckedChanged() const
|
|
|
|
{
|
|
|
|
return m_actionCheckedChanged;
|
|
|
|
}
|