Also share on Audio.com dialog
This commit is contained in:
parent
5f57ce04e0
commit
7db9074a62
18 changed files with 367 additions and 60 deletions
|
@ -64,19 +64,17 @@ PreferencesPage {
|
|||
navigation.order: root.navigationOrderStart + 2
|
||||
}
|
||||
|
||||
/* TODO: https://github.com/musescore/MuseScore/issues/19115
|
||||
SeparatorLine { }
|
||||
|
||||
PublishMuseScoreComSection {
|
||||
promptShareAudioCom: preferencesModel.promptShareAudioCom
|
||||
alsoShareAudioCom: preferencesModel.alsoShareAudioCom
|
||||
|
||||
navigation.section: root.navigationSection
|
||||
navigation.order: root.navigationOrderStart + 3
|
||||
|
||||
onPromptShareAudioComChangeRequested: function(prompt) {
|
||||
preferencesModel.promptShareAudioCom = prompt;
|
||||
onAlsoShareAudioComChangeRequested: function(share) {
|
||||
preferencesModel.alsoShareAudioCom = share;
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,22 +29,22 @@ BaseSection {
|
|||
|
||||
title: qsTrc("appshell/preferences", "Publish to MuseScore.com")
|
||||
|
||||
property alias promptShareAudioCom: promptShareAudioComCheckBox.checked
|
||||
property alias alsoShareAudioCom: alsoShareAudioComCheckBox.checked
|
||||
|
||||
signal promptShareAudioComChangeRequested(bool prompt)
|
||||
signal alsoShareAudioComChangeRequested(bool share)
|
||||
|
||||
CheckBox {
|
||||
id: promptShareAudioComCheckBox
|
||||
id: alsoShareAudioComCheckBox
|
||||
|
||||
width: parent.width
|
||||
|
||||
text: qsTrc("appshell/preferences", "Always prompt to share on Audio.com after publishing to MuseScore.com")
|
||||
|
||||
navigation.name: "PromptShareAudioComCheckBox"
|
||||
navigation.name: "AlsoShareAudioComCheckBox"
|
||||
navigation.panel: root.navigation
|
||||
|
||||
onClicked: {
|
||||
root.promptShareAudioComChangeRequested(!checked)
|
||||
root.alsoShareAudioComChangeRequested(!checked)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,8 +38,8 @@ void SaveAndPublishPreferencesModel::load()
|
|||
emit autoSaveIntervalChanged(minutes);
|
||||
});
|
||||
|
||||
projectConfiguration()->promptShareAudioComChanged().onReceive(this, [this](bool prompt) {
|
||||
emit promptShareAudioComChanged(prompt);
|
||||
projectConfiguration()->alsoShareAudioComChanged().onReceive(this, [this](bool share) {
|
||||
emit alsoShareAudioComChanged(share);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -53,9 +53,9 @@ int SaveAndPublishPreferencesModel::autoSaveInterval() const
|
|||
return projectConfiguration()->autoSaveIntervalMinutes();
|
||||
}
|
||||
|
||||
bool SaveAndPublishPreferencesModel::promptShareAudioCom() const
|
||||
bool SaveAndPublishPreferencesModel::alsoShareAudioCom() const
|
||||
{
|
||||
return projectConfiguration()->promptShareAudioCom();
|
||||
return projectConfiguration()->alsoShareAudioCom();
|
||||
}
|
||||
|
||||
void SaveAndPublishPreferencesModel::setAutoSaveEnabled(bool enabled)
|
||||
|
@ -76,11 +76,11 @@ void SaveAndPublishPreferencesModel::setAutoSaveInterval(int minutes)
|
|||
projectConfiguration()->setAutoSaveInterval(minutes);
|
||||
}
|
||||
|
||||
void SaveAndPublishPreferencesModel::setPromptShareAudioCom(bool prompt)
|
||||
void SaveAndPublishPreferencesModel::setAlsoShareAudioCom(bool share)
|
||||
{
|
||||
if (prompt == promptShareAudioCom()) {
|
||||
if (share == alsoShareAudioCom()) {
|
||||
return;
|
||||
}
|
||||
|
||||
projectConfiguration()->setPromptShareAudioCom(prompt);
|
||||
projectConfiguration()->setAlsoShareAudioCom(share);
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ class SaveAndPublishPreferencesModel : public QObject, public async::Asyncable
|
|||
|
||||
Q_PROPERTY(bool isAutoSaveEnabled READ isAutoSaveEnabled WRITE setAutoSaveEnabled NOTIFY autoSaveEnabledChanged)
|
||||
Q_PROPERTY(int autoSaveInterval READ autoSaveInterval WRITE setAutoSaveInterval NOTIFY autoSaveIntervalChanged)
|
||||
Q_PROPERTY(int promptShareAudioCom READ promptShareAudioCom WRITE setPromptShareAudioCom NOTIFY promptShareAudioComChanged)
|
||||
Q_PROPERTY(int alsoShareAudioCom READ alsoShareAudioCom WRITE setAlsoShareAudioCom NOTIFY alsoShareAudioComChanged)
|
||||
|
||||
public:
|
||||
explicit SaveAndPublishPreferencesModel(QObject* parent = nullptr);
|
||||
|
@ -47,17 +47,17 @@ public:
|
|||
|
||||
bool isAutoSaveEnabled() const;
|
||||
int autoSaveInterval() const;
|
||||
bool promptShareAudioCom() const;
|
||||
bool alsoShareAudioCom() const;
|
||||
|
||||
public slots:
|
||||
void setAutoSaveEnabled(bool enabled);
|
||||
void setAutoSaveInterval(int minutes);
|
||||
void setPromptShareAudioCom(bool prompt);
|
||||
void setAlsoShareAudioCom(bool share);
|
||||
|
||||
signals:
|
||||
void autoSaveEnabledChanged(bool enabled);
|
||||
void autoSaveIntervalChanged(int minutes);
|
||||
void promptShareAudioComChanged(int prompt);
|
||||
void alsoShareAudioComChanged(int prompt);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ public:
|
|||
|
||||
framework::ProgressPtr uploadAudio(QIODevice& audioData, const QString& audioFormat, const QString& title, const QUrl& url,
|
||||
Visibility visibility = Visibility::Private, bool replaceExisting = false) override;
|
||||
|
||||
private:
|
||||
ServerConfig serverConfig() const override;
|
||||
|
||||
|
|
|
@ -43,6 +43,8 @@ public:
|
|||
virtual framework::ProgressPtr uploadAudio(QIODevice& audioData, const QString& audioFormat, const QString& title,
|
||||
const QUrl& existingUrl, Visibility visibility = Visibility::Private,
|
||||
bool replaceExisting = false) = 0;
|
||||
|
||||
virtual CloudInfo cloudInfo() const = 0;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -755,7 +755,7 @@ void ProjectActionsController::publish()
|
|||
}
|
||||
}
|
||||
|
||||
void ProjectActionsController::shareAudio()
|
||||
void ProjectActionsController::shareAudio(const AudioFile& existingAudio)
|
||||
{
|
||||
if (m_isAudioSharing) {
|
||||
return;
|
||||
|
@ -778,10 +778,15 @@ void ProjectActionsController::shareAudio()
|
|||
|
||||
CloudAudioInfo cloudAudioInfo = retVal.val;
|
||||
|
||||
AudioFile audio = exportMp3(project->masterNotation()->notation());
|
||||
AudioFile audio;
|
||||
if (existingAudio.isValid()) {
|
||||
audio = existingAudio;
|
||||
} else {
|
||||
audio = exportMp3(project->masterNotation()->notation());
|
||||
if (!audio.isValid()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
m_uploadingAudioProgress = audioComService()->uploadAudio(*audio.device, audio.format, cloudAudioInfo.name,
|
||||
project->cloudAudioInfo().url, cloudAudioInfo.visibility,
|
||||
|
@ -962,6 +967,36 @@ bool ProjectActionsController::saveProjectToCloud(CloudProjectInfo info, SaveMod
|
|||
return ret;
|
||||
}
|
||||
|
||||
void ProjectActionsController::alsoShareAudioCom(const AudioFile& audio)
|
||||
{
|
||||
if (!configuration()->showAlsoShareAudioComDialog()) {
|
||||
shareAudio(audio);
|
||||
return;
|
||||
}
|
||||
|
||||
QUrl audioComUrl = audioComService()->authorization()->cloudInfo().url;
|
||||
|
||||
UriQuery query("musescore://project/alsoshareaudiocom");
|
||||
query.addParam("audioComUrl", Val(audioComUrl.toString()));
|
||||
query.addParam("rememberChoice", Val(!configuration()->hasAskedAlsoShareAudioCom()));
|
||||
RetVal<Val> rv = interactive()->open(query);
|
||||
|
||||
if (!rv.val.isNull()) {
|
||||
QVariantMap vals = rv.val.toQVariant().toMap();
|
||||
bool shareAudioCom = vals["share"].toBool();
|
||||
bool rememberChoice = vals["remember"].toBool();
|
||||
|
||||
if (shareAudioCom) {
|
||||
shareAudio(audio);
|
||||
}
|
||||
|
||||
configuration()->setShowAlsoShareAudioComDialog(!rememberChoice);
|
||||
configuration()->setAlsoShareAudioCom(shareAudioCom);
|
||||
}
|
||||
|
||||
configuration()->setHasAskedAlsoShareAudioCom(true);
|
||||
}
|
||||
|
||||
Ret ProjectActionsController::askAudioGenerationSettings() const
|
||||
{
|
||||
RetVal<Val> res = interactive()->open("musescore://project/audiogenerationsettings");
|
||||
|
@ -1145,6 +1180,10 @@ Ret ProjectActionsController::uploadProject(const CloudProjectInfo& info, const
|
|||
uploadAudio(audio, newSourceUrl, editUrl, isFirstSave);
|
||||
} else {
|
||||
onProjectSuccessfullyUploaded(editUrl, isFirstSave);
|
||||
|
||||
if (configuration()->alsoShareAudioCom() || configuration()->showAlsoShareAudioComDialog()) {
|
||||
alsoShareAudioCom(audio);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -1170,13 +1209,17 @@ void ProjectActionsController::uploadAudio(const AudioFile& audio, const QUrl& s
|
|||
m_uploadingAudioProgress->finished.onReceive(this, [this, audio, urlToOpen, isFirstSave](const ProgressResult& res) {
|
||||
LOGD() << "Uploading audio finished";
|
||||
|
||||
audio.device->deleteLater();
|
||||
|
||||
if (!res.ret) {
|
||||
LOGE() << res.ret.toString();
|
||||
}
|
||||
|
||||
onProjectSuccessfullyUploaded(urlToOpen, isFirstSave);
|
||||
|
||||
if (configuration()->alsoShareAudioCom() || configuration()->showAlsoShareAudioComDialog()) {
|
||||
alsoShareAudioCom(audio);
|
||||
}
|
||||
|
||||
audio.device->deleteLater();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -115,13 +115,6 @@ private:
|
|||
Ret canSaveProject() const;
|
||||
bool saveProject(SaveMode saveMode, SaveLocationType saveLocationType = SaveLocationType::Undefined, bool force = false);
|
||||
|
||||
void publish();
|
||||
void shareAudio();
|
||||
|
||||
bool saveProjectAt(const SaveLocation& saveLocation, SaveMode saveMode = SaveMode::Save, bool force = false);
|
||||
bool saveProjectLocally(const io::path_t& path = io::path_t(), SaveMode saveMode = SaveMode::Save);
|
||||
bool saveProjectToCloud(CloudProjectInfo info, SaveMode saveMode = SaveMode::Save);
|
||||
|
||||
struct AudioFile {
|
||||
QString format;
|
||||
QIODevice* device = nullptr;
|
||||
|
@ -134,6 +127,16 @@ private:
|
|||
}
|
||||
};
|
||||
|
||||
void publish();
|
||||
void shareAudio(const AudioFile& existingAudio);
|
||||
void shareAudio() { shareAudio(AudioFile()); }
|
||||
|
||||
bool saveProjectAt(const SaveLocation& saveLocation, SaveMode saveMode = SaveMode::Save, bool force = false);
|
||||
bool saveProjectLocally(const io::path_t& path = io::path_t(), SaveMode saveMode = SaveMode::Save);
|
||||
bool saveProjectToCloud(CloudProjectInfo info, SaveMode saveMode = SaveMode::Save);
|
||||
|
||||
void alsoShareAudioCom(const AudioFile& audio);
|
||||
|
||||
Ret askAudioGenerationSettings() const;
|
||||
RetVal<bool> needGenerateAudio(bool isPublic) const;
|
||||
AudioFile exportMp3(const notation::INotationPtr notation) const;
|
||||
|
|
|
@ -53,7 +53,9 @@ static const Settings::Key PREFERRED_SCORE_CREATION_MODE_KEY(module_name, "proje
|
|||
static const Settings::Key MIGRATION_OPTIONS(module_name, "project/migration");
|
||||
static const Settings::Key AUTOSAVE_ENABLED_KEY(module_name, "project/autoSaveEnabled");
|
||||
static const Settings::Key AUTOSAVE_INTERVAL_KEY(module_name, "project/autoSaveInterval");
|
||||
static const Settings::Key ALWAYS_PROMPT_SHARE_AUDIO_COM_AFTER_PUBLISH(module_name, "project/promptShareAudioCom");
|
||||
static const Settings::Key ALSO_SHARE_AUDIO_COM_AFTER_PUBLISH(module_name, "project/alsoShareAudioCom");
|
||||
static const Settings::Key SHOW_ALSO_SHARE_AUDIO_COM_DIALOG(module_name, "project/showAlsoShareAudioComDialog");
|
||||
static const Settings::Key HAS_ASKED_ALSO_SHARE_AUDIO_COM(module_name, "project/hasAskedAlsoShareAudioCom");
|
||||
static const Settings::Key SHOULD_DESTINATION_FOLDER_BE_OPENED_ON_EXPORT(module_name, "project/shouldDestinationFolderBeOpenedOnExport");
|
||||
static const Settings::Key OPEN_DETAILED_PROJECT_UPLOADED_DIALOG(module_name, "project/openDetailedProjectUploadedDialog");
|
||||
static const Settings::Key HAS_ASKED_AUDIO_GENERATION_SETTINGS(module_name, "project/hasAskedAudioGenerationSettings");
|
||||
|
@ -98,11 +100,14 @@ void ProjectConfiguration::init()
|
|||
m_autoSaveIntervalChanged.send(val.toInt());
|
||||
});
|
||||
|
||||
settings()->setDefaultValue(ALWAYS_PROMPT_SHARE_AUDIO_COM_AFTER_PUBLISH, Val(false));
|
||||
settings()->valueChanged(ALWAYS_PROMPT_SHARE_AUDIO_COM_AFTER_PUBLISH).onReceive(nullptr, [this](const Val& val) {
|
||||
m_promptShareAudioComChanged.send(val.toBool());
|
||||
settings()->setDefaultValue(ALSO_SHARE_AUDIO_COM_AFTER_PUBLISH, Val(true));
|
||||
settings()->valueChanged(ALSO_SHARE_AUDIO_COM_AFTER_PUBLISH).onReceive(nullptr, [this](const Val& val) {
|
||||
m_alsoShareAudioComChanged.send(val.toBool());
|
||||
});
|
||||
|
||||
settings()->setDefaultValue(SHOW_ALSO_SHARE_AUDIO_COM_DIALOG, Val(true));
|
||||
settings()->setDefaultValue(HAS_ASKED_ALSO_SHARE_AUDIO_COM, Val(false));
|
||||
|
||||
settings()->setDefaultValue(SHOULD_DESTINATION_FOLDER_BE_OPENED_ON_EXPORT, Val(false));
|
||||
settings()->setDefaultValue(OPEN_DETAILED_PROJECT_UPLOADED_DIALOG, Val(true));
|
||||
settings()->setDefaultValue(HAS_ASKED_AUDIO_GENERATION_SETTINGS, Val(false));
|
||||
|
@ -531,19 +536,39 @@ async::Channel<int> ProjectConfiguration::autoSaveIntervalChanged() const
|
|||
return m_autoSaveIntervalChanged;
|
||||
}
|
||||
|
||||
bool ProjectConfiguration::promptShareAudioCom() const
|
||||
bool ProjectConfiguration::alsoShareAudioCom() const
|
||||
{
|
||||
return settings()->value(ALWAYS_PROMPT_SHARE_AUDIO_COM_AFTER_PUBLISH).toBool();
|
||||
return settings()->value(ALSO_SHARE_AUDIO_COM_AFTER_PUBLISH).toBool();
|
||||
}
|
||||
|
||||
void ProjectConfiguration::setPromptShareAudioCom(bool prompt)
|
||||
void ProjectConfiguration::setAlsoShareAudioCom(bool share)
|
||||
{
|
||||
settings()->setSharedValue(ALWAYS_PROMPT_SHARE_AUDIO_COM_AFTER_PUBLISH, Val(prompt));
|
||||
settings()->setSharedValue(ALSO_SHARE_AUDIO_COM_AFTER_PUBLISH, Val(share));
|
||||
}
|
||||
|
||||
async::Channel<bool> ProjectConfiguration::promptShareAudioComChanged() const
|
||||
async::Channel<bool> ProjectConfiguration::alsoShareAudioComChanged() const
|
||||
{
|
||||
return m_promptShareAudioComChanged;
|
||||
return m_alsoShareAudioComChanged;
|
||||
}
|
||||
|
||||
bool ProjectConfiguration::showAlsoShareAudioComDialog() const
|
||||
{
|
||||
return settings()->value(SHOW_ALSO_SHARE_AUDIO_COM_DIALOG).toBool();
|
||||
}
|
||||
|
||||
void ProjectConfiguration::setShowAlsoShareAudioComDialog(bool show)
|
||||
{
|
||||
settings()->setSharedValue(SHOW_ALSO_SHARE_AUDIO_COM_DIALOG, Val(show));
|
||||
}
|
||||
|
||||
bool ProjectConfiguration::hasAskedAlsoShareAudioCom() const
|
||||
{
|
||||
return settings()->value(HAS_ASKED_ALSO_SHARE_AUDIO_COM).toBool();
|
||||
}
|
||||
|
||||
void ProjectConfiguration::setHasAskedAlsoShareAudioCom(bool has)
|
||||
{
|
||||
settings()->setSharedValue(HAS_ASKED_ALSO_SHARE_AUDIO_COM, Val(has));
|
||||
}
|
||||
|
||||
io::path_t ProjectConfiguration::newProjectTemporaryPath() const
|
||||
|
|
|
@ -115,9 +115,15 @@ public:
|
|||
void setAutoSaveInterval(int minutes) override;
|
||||
async::Channel<int> autoSaveIntervalChanged() const override;
|
||||
|
||||
bool promptShareAudioCom() const override;
|
||||
void setPromptShareAudioCom(bool prompt) override;
|
||||
async::Channel<bool> promptShareAudioComChanged() const override;
|
||||
bool alsoShareAudioCom() const override;
|
||||
void setAlsoShareAudioCom(bool share) override;
|
||||
async::Channel<bool> alsoShareAudioComChanged() const override;
|
||||
|
||||
bool showAlsoShareAudioComDialog() const override;
|
||||
void setShowAlsoShareAudioComDialog(bool show) override;
|
||||
|
||||
bool hasAskedAlsoShareAudioCom() const override;
|
||||
void setHasAskedAlsoShareAudioCom(bool has) override;
|
||||
|
||||
io::path_t newProjectTemporaryPath() const override;
|
||||
|
||||
|
@ -160,7 +166,7 @@ private:
|
|||
async::Channel<bool> m_autoSaveEnabledChanged;
|
||||
async::Channel<int> m_autoSaveIntervalChanged;
|
||||
|
||||
async::Channel<bool> m_promptShareAudioComChanged;
|
||||
async::Channel<bool> m_alsoShareAudioComChanged;
|
||||
|
||||
mutable std::map<MigrationType, MigrationOptions> m_migrationOptions;
|
||||
};
|
||||
|
|
|
@ -119,9 +119,15 @@ public:
|
|||
virtual void setAutoSaveInterval(int minutes) = 0;
|
||||
virtual async::Channel<int> autoSaveIntervalChanged() const = 0;
|
||||
|
||||
virtual bool promptShareAudioCom() const = 0;
|
||||
virtual void setPromptShareAudioCom(bool prompt) = 0;
|
||||
virtual async::Channel<bool> promptShareAudioComChanged() const = 0;
|
||||
virtual bool alsoShareAudioCom() const = 0;
|
||||
virtual void setAlsoShareAudioCom(bool share) = 0;
|
||||
virtual async::Channel<bool> alsoShareAudioComChanged() const = 0;
|
||||
|
||||
virtual bool showAlsoShareAudioComDialog() const = 0;
|
||||
virtual void setShowAlsoShareAudioComDialog(bool show) = 0;
|
||||
|
||||
virtual bool hasAskedAlsoShareAudioCom() const = 0;
|
||||
virtual void setHasAskedAlsoShareAudioCom(bool has) = 0;
|
||||
|
||||
virtual io::path_t newProjectTemporaryPath() const = 0;
|
||||
|
||||
|
|
|
@ -69,5 +69,7 @@
|
|||
<file>qml/MuseScore/Project/internal/Migration/MigrationContentForPre362.qml</file>
|
||||
<file>qml/MuseScore/Project/internal/Migration/migration.png</file>
|
||||
<file>qml/MuseScore/Project/UploadProgressDialog.qml</file>
|
||||
<file>qml/MuseScore/Project/AlsoShareAudioComDialog.qml</file>
|
||||
<file>resources/AudioCom_Waveform.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -121,6 +121,7 @@ void ProjectModule::resolveImports()
|
|||
ir->registerQmlUri(Uri("musescore://project/newscore"), "MuseScore/Project/NewScoreDialog.qml");
|
||||
ir->registerQmlUri(Uri("musescore://project/asksavelocationtype"), "MuseScore/Project/AskSaveLocationTypeDialog.qml");
|
||||
ir->registerQmlUri(Uri("musescore://project/savetocloud"), "MuseScore/Project/SaveToCloudDialog.qml");
|
||||
ir->registerQmlUri(Uri("musescore://project/alsoshareaudiocom"), "MuseScore/Project/AlsoShareAudioComDialog.qml");
|
||||
ir->registerQmlUri(Uri("musescore://project/export"), "MuseScore/Project/ExportDialog.qml");
|
||||
ir->registerQmlUri(Uri("musescore://project/migration"), "MuseScore/Project/MigrationDialog.qml");
|
||||
ir->registerQmlUri(Uri("musescore://project/properties"), "MuseScore/Project/ProjectPropertiesDialog.qml");
|
||||
|
|
190
src/project/qml/MuseScore/Project/AlsoShareAudioComDialog.qml
Normal file
190
src/project/qml/MuseScore/Project/AlsoShareAudioComDialog.qml
Normal file
|
@ -0,0 +1,190 @@
|
|||
/*
|
||||
* SPDX-License-Identifier: GPL-3.0-only
|
||||
* MuseScore-CLA-applies
|
||||
*
|
||||
* MuseScore
|
||||
* Music Composition & Notation
|
||||
*
|
||||
* Copyright (C) 2023 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/>.
|
||||
*/
|
||||
import QtQuick 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
|
||||
import MuseScore.Ui 1.0
|
||||
import MuseScore.UiComponents 1.0
|
||||
|
||||
StyledDialogView {
|
||||
id: root
|
||||
|
||||
property string audioComUrl
|
||||
property bool rememberChoice
|
||||
|
||||
contentHeight: 355
|
||||
contentWidth: 496
|
||||
|
||||
margins: 24
|
||||
|
||||
function done(data = {}) {
|
||||
let value = Object.assign(data)
|
||||
|
||||
root.ret = {
|
||||
errcode: 0,
|
||||
value: value
|
||||
}
|
||||
|
||||
root.hide()
|
||||
}
|
||||
|
||||
onNavigationActivateRequested: {
|
||||
var btn = buttonBox.firstFocusBtn
|
||||
if (btn) {
|
||||
btn.navigation.requestActive()
|
||||
}
|
||||
}
|
||||
|
||||
onAccessibilityActivateRequested: {
|
||||
accessibleInfo.readInfo()
|
||||
}
|
||||
|
||||
NavigationPanel {
|
||||
id: buttonsPanel
|
||||
|
||||
name: "ButtonsPanel"
|
||||
order: 1
|
||||
section: root.navigationSection
|
||||
direction: NavigationPanel.Horizontal
|
||||
accessible.role: MUAccessible.Dialog
|
||||
|
||||
onNavigationEvent: function(event) {
|
||||
if (event.type === NavigationEvent.AboutActive) {
|
||||
var btn = buttonBox.firstFocusBtn
|
||||
if (Boolean(btn) && btn.enabled) {
|
||||
event.setData("controlIndex", [ btn.navigation.row, btn.navigation.column ])
|
||||
}
|
||||
} else {
|
||||
buttonBox.restoreAccessibility()
|
||||
accessibleInfo.resetFocus()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AccessibleItem {
|
||||
id: accessibleInfo
|
||||
|
||||
accessibleParent: buttonsPanel.accessible
|
||||
role: MUAccessible.Button
|
||||
name: titleInfo.text + "; " + subtitleInfo.text
|
||||
|
||||
function readInfo() {
|
||||
accessibleInfo.ignored = false
|
||||
accessibleInfo.focused = true
|
||||
}
|
||||
|
||||
function resetFocus() {
|
||||
accessibleInfo.ignored = true
|
||||
accessibleInfo.focused = false
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: content
|
||||
|
||||
anchors.fill: parent
|
||||
spacing: 20
|
||||
|
||||
ColumnLayout {
|
||||
id: header
|
||||
|
||||
width: parent.width
|
||||
spacing: 16
|
||||
|
||||
StyledTextLabel {
|
||||
id: titleInfo
|
||||
|
||||
Layout.fillWidth: true
|
||||
|
||||
//: The text between `<a href=\"%1\">` and `</a>` will be a clickable link to Audio.com
|
||||
text: qsTrc("project/cloud", "Would you also like to share your music on <a href=\"%1\">Audio.com</a>?").arg(root.audioComUrl)
|
||||
font: ui.theme.largeBodyBoldFont
|
||||
}
|
||||
|
||||
StyledTextLabel {
|
||||
id: subtitleInfo
|
||||
|
||||
Layout.fillWidth: true
|
||||
|
||||
text: qsTrc("project/cloud", "Share your score's audio with millions of listeners on this free streaming platform")
|
||||
font: ui.theme.bodyFont
|
||||
}
|
||||
}
|
||||
|
||||
Image {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: sourceSize.height * (width / sourceSize.width)
|
||||
fillMode: Image.PreserveAspectFit
|
||||
|
||||
source: "qrc:/resources/AudioCom_Waveform.png"
|
||||
}
|
||||
|
||||
StyledTextLabel {
|
||||
id: preferenceInfo
|
||||
|
||||
Layout.fillWidth: true
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
|
||||
text: qsTrc("project/cloud", "You can change this setting in Preferences at any time.")
|
||||
font: ui.theme.bodyFont
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: options
|
||||
|
||||
CheckBox {
|
||||
id: checkbox
|
||||
|
||||
Layout.fillWidth: true
|
||||
|
||||
navigation.panel: NavigationPanel {
|
||||
name: "RememberChoiceCheckBox"
|
||||
section: root.navigationSection
|
||||
order: 2
|
||||
}
|
||||
navigation.row: 1
|
||||
navigation.accessible.name: text + "; " + preferenceInfo.text
|
||||
|
||||
text: qsTrc("project/cloud", "Remember my choice")
|
||||
|
||||
checked: root.rememberChoice
|
||||
|
||||
onClicked: {
|
||||
checked = !checked
|
||||
}
|
||||
}
|
||||
|
||||
ButtonBox {
|
||||
id: buttonBox
|
||||
|
||||
buttons: [ ButtonBoxModel.No, ButtonBoxModel.Yes ]
|
||||
|
||||
navigationPanel: buttonsPanel
|
||||
isAccessibilityDisabledWhenInit: true
|
||||
|
||||
onStandardButtonClicked: function(buttonId) {
|
||||
root.done({ share: buttonId === ButtonBoxModel.Yes, remember: checkbox.checked })
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
BIN
src/project/resources/AudioCom_Waveform.png
Normal file
BIN
src/project/resources/AudioCom_Waveform.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 256 KiB |
|
@ -97,9 +97,15 @@ public:
|
|||
MOCK_METHOD(void, setAutoSaveInterval, (int), (override));
|
||||
MOCK_METHOD(async::Channel<int>, autoSaveIntervalChanged, (), (const, override));
|
||||
|
||||
MOCK_METHOD(bool, promptShareAudioCom, (), (const, override));
|
||||
MOCK_METHOD(void, setPromptShareAudioCom, (bool), (override));
|
||||
MOCK_METHOD(async::Channel<bool>, promptShareAudioComChanged, (), (const, override));
|
||||
MOCK_METHOD(bool, alsoShareAudioCom, (), (const, override));
|
||||
MOCK_METHOD(void, setAlsoShareAudioCom, (bool), (override));
|
||||
MOCK_METHOD(async::Channel<bool>, alsoShareAudioComChanged, (), (const, override));
|
||||
|
||||
MOCK_METHOD(bool, showAlsoShareAudioComDialog, (), (const, override));
|
||||
MOCK_METHOD(void, setShowAlsoShareAudioComDialog, (bool), (override));
|
||||
|
||||
MOCK_METHOD(bool, hasAskedAlsoShareAudioCom, (), (const, override));
|
||||
MOCK_METHOD(void, setHasAskedAlsoShareAudioCom, (bool), (override));
|
||||
|
||||
MOCK_METHOD(io::path_t, newProjectTemporaryPath, (), (const, override));
|
||||
|
||||
|
|
|
@ -212,21 +212,39 @@ async::Channel<int> ProjectConfigurationStub::autoSaveIntervalChanged() const
|
|||
return ch;
|
||||
}
|
||||
|
||||
bool ProjectConfigurationStub::promptShareAudioCom() const
|
||||
bool ProjectConfigurationStub::alsoShareAudioCom() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void ProjectConfigurationStub::setPromptShareAudioCom(bool prompt)
|
||||
void ProjectConfigurationStub::setAlsoShareAudioCom(bool share)
|
||||
{
|
||||
}
|
||||
|
||||
async::Channel<bool> ProjectConfigurationStub::promptShareAudioComChanged() const
|
||||
async::Channel<bool> ProjectConfigurationStub::alsoShareAudioComChanged() const
|
||||
{
|
||||
static async::Channel<bool> ch;
|
||||
return ch;
|
||||
}
|
||||
|
||||
bool ProjectConfigurationStub::showAlsoShareAudioComDialog() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void ProjectConfigurationStub::setShowAlsoShareAudioComDialog(bool show)
|
||||
{
|
||||
}
|
||||
|
||||
bool ProjectConfigurationStub::hasAskedAlsoShareAudioCom() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void ProjectConfigurationStub::setHasAskedAlsoShareAudioCom(bool has)
|
||||
{
|
||||
}
|
||||
|
||||
io::path_t ProjectConfigurationStub::newProjectTemporaryPath() const
|
||||
{
|
||||
return io::path_t();
|
||||
|
|
|
@ -88,9 +88,15 @@ public:
|
|||
void setAutoSaveInterval(int minutes) override;
|
||||
async::Channel<int> autoSaveIntervalChanged() const override;
|
||||
|
||||
bool promptShareAudioCom() const override;
|
||||
void setPromptShareAudioCom(bool prompt) override;
|
||||
async::Channel<bool> promptShareAudioComChanged() const override;
|
||||
bool alsoShareAudioCom() const override;
|
||||
void setAlsoShareAudioCom(bool share) override;
|
||||
async::Channel<bool> alsoShareAudioComChanged() const override;
|
||||
|
||||
bool showAlsoShareAudioComDialog() const override;
|
||||
void setShowAlsoShareAudioComDialog(bool show) override;
|
||||
|
||||
bool hasAskedAlsoShareAudioCom() const override;
|
||||
void setHasAskedAlsoShareAudioCom(bool has) override;
|
||||
|
||||
io::path_t newProjectTemporaryPath() const override;
|
||||
|
||||
|
|
Loading…
Reference in a new issue