From 0200c5e997d4191d8082cc189eed1a76ea7b6d65 Mon Sep 17 00:00:00 2001 From: Eism Date: Wed, 30 Jun 2021 13:18:43 +0200 Subject: [PATCH] Implemented learn module --- CMakeLists.txt | 1 + build/config.h.in | 1 + src/CMakeLists.txt | 4 + src/appshell/qml/HomePage/HomePage.qml | 6 +- src/learn/CMakeLists.txt | 33 +++ src/learn/learn.qrc | 6 + src/learn/learnmodule.cpp | 41 ++++ src/learn/learnmodule.h | 36 +++ src/learn/qml/MuseScore/Learn/LearnPage.qml | 220 ++++++++++++++++++ src/learn/qml/MuseScore/Learn/qmldir | 2 + src/main/CMakeLists.txt | 1 + src/main/main.cpp | 8 + src/stubs/CMakeLists.txt | 4 + src/stubs/learn/CMakeLists.txt | 33 +++ src/stubs/learn/learn.qrc | 6 + src/stubs/learn/learnmodule.cpp | 41 ++++ src/stubs/learn/learnmodule.h | 36 +++ .../learn/qml/MuseScore/Learn/LearnPage.qml | 33 +++ src/stubs/learn/qml/MuseScore/Learn/qmldir | 2 + 19 files changed, 510 insertions(+), 4 deletions(-) create mode 100644 src/learn/CMakeLists.txt create mode 100644 src/learn/learn.qrc create mode 100644 src/learn/learnmodule.cpp create mode 100644 src/learn/learnmodule.h create mode 100644 src/learn/qml/MuseScore/Learn/LearnPage.qml create mode 100644 src/learn/qml/MuseScore/Learn/qmldir create mode 100644 src/stubs/learn/CMakeLists.txt create mode 100644 src/stubs/learn/learn.qrc create mode 100644 src/stubs/learn/learnmodule.cpp create mode 100644 src/stubs/learn/learnmodule.h create mode 100644 src/stubs/learn/qml/MuseScore/Learn/LearnPage.qml create mode 100644 src/stubs/learn/qml/MuseScore/Learn/qmldir diff --git a/CMakeLists.txt b/CMakeLists.txt index ca0f314a5cd00..8ddab08c2f68f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,6 +60,7 @@ option(BUILD_SYSTEM_MODULE "Build system module" ON) option(BUILD_NETWORK_MODULE "Build network module" ON) option(BUILD_AUDIO_MODULE "Build audio module" ON) option(BUILD_USERSCORES_MODULE "Build userscores module" ON) +option(BUILD_LEARN_MODULE "Build learn module" ON) option(BUILD_WORKSPACE_MODULE "Build workspace module" ON) option(BUILD_CLOUD_MODULE "Build cloud module" ON) option(BUILD_EXTENSIONS_MODULE "Build extensions module" ON) diff --git a/build/config.h.in b/build/config.h.in index 6a3e52f347b42..0bafa89d26838 100644 --- a/build/config.h.in +++ b/build/config.h.in @@ -46,6 +46,7 @@ #cmakedefine BUILD_NETWORK_MODULE #cmakedefine BUILD_AUDIO_MODULE #cmakedefine BUILD_USERSCORES_MODULE +#cmakedefine BUILD_LEARN_MODULE #cmakedefine BUILD_WORKSPACE_MODULE #cmakedefine BUILD_CLOUD_MODULE #cmakedefine BUILD_EXTENSIONS_MODULE diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7638d32ab8baa..e2c3de191d76e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -39,6 +39,10 @@ if (BUILD_USERSCORES_MODULE) add_subdirectory(userscores) endif (BUILD_USERSCORES_MODULE) +if (BUILD_LEARN_MODULE) + add_subdirectory(learn) +endif (BUILD_LEARN_MODULE) + add_subdirectory(converter) if (BUILD_WORKSPACE_MODULE) diff --git a/src/appshell/qml/HomePage/HomePage.qml b/src/appshell/qml/HomePage/HomePage.qml index dd0ced00043c6..12ed0781c2155 100644 --- a/src/appshell/qml/HomePage/HomePage.qml +++ b/src/appshell/qml/HomePage/HomePage.qml @@ -28,6 +28,7 @@ import MuseScore.Dock 1.0 import MuseScore.UserScores 1.0 import MuseScore.Cloud 1.0 +import MuseScore.Learn 1.0 import "../dockwindow" @@ -124,10 +125,7 @@ DockPage { Component { id: learnComp - StyledTextLabel { - anchors.centerIn: parent - text: "Learn" - } + LearnPage {} } Component { diff --git a/src/learn/CMakeLists.txt b/src/learn/CMakeLists.txt new file mode 100644 index 0000000000000..d094dbf127500 --- /dev/null +++ b/src/learn/CMakeLists.txt @@ -0,0 +1,33 @@ +# 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 . + +set(MODULE learn) + +set(MODULE_QRC learn.qrc) + +set(MODULE_QML_IMPORT ${CMAKE_CURRENT_LIST_DIR}/qml) + +set(MODULE_SRC + ${CMAKE_CURRENT_LIST_DIR}/learnmodule.cpp + ${CMAKE_CURRENT_LIST_DIR}/learnmodule.h + ) + +include(${PROJECT_SOURCE_DIR}/build/module.cmake) + diff --git a/src/learn/learn.qrc b/src/learn/learn.qrc new file mode 100644 index 0000000000000..d53310827e843 --- /dev/null +++ b/src/learn/learn.qrc @@ -0,0 +1,6 @@ + + + qml/MuseScore/Learn/LearnPage.qml + qml/MuseScore/Learn/qmldir + + diff --git a/src/learn/learnmodule.cpp b/src/learn/learnmodule.cpp new file mode 100644 index 0000000000000..abc48e874398e --- /dev/null +++ b/src/learn/learnmodule.cpp @@ -0,0 +1,41 @@ +/* + * 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 . + */ +#include "learnmodule.h" + +#include + +using namespace mu::learn; + +static void learn_init_qrc() +{ + Q_INIT_RESOURCE(learn); +} + +std::string LearnModule::moduleName() const +{ + return "learn"; +} + +void LearnModule::registerResources() +{ + learn_init_qrc(); +} diff --git a/src/learn/learnmodule.h b/src/learn/learnmodule.h new file mode 100644 index 0000000000000..54cb325e9444b --- /dev/null +++ b/src/learn/learnmodule.h @@ -0,0 +1,36 @@ +/* + * 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 . + */ +#ifndef MU_LEARN_LEARNMODULE_H +#define MU_LEARN_LEARNMODULE_H + +#include "modularity/imodulesetup.h" + +namespace mu::learn { +class LearnModule : public framework::IModuleSetup +{ +public: + std::string moduleName() const override; + void registerResources() override; +}; +} + +#endif // MU_LEARN_LEARNMODULE_H diff --git a/src/learn/qml/MuseScore/Learn/LearnPage.qml b/src/learn/qml/MuseScore/Learn/LearnPage.qml new file mode 100644 index 0000000000000..8b426569e64b2 --- /dev/null +++ b/src/learn/qml/MuseScore/Learn/LearnPage.qml @@ -0,0 +1,220 @@ +/* + * 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 . + */ +import QtQuick 2.15 +import QtQuick.Controls 2.2 +import QtQuick.Layouts 1.3 + +import MuseScore.Ui 1.0 +import MuseScore.UiComponents 1.0 + +FocusScope { + id: root + + property var color: ui.theme.backgroundSecondaryColor + property string item: "" + + signal requestActiveFocus() + + NavigationSection { + id: navSec + name: "Learn" + enabled: root.visible + order: 3 + onActiveChanged: { + if (active) { + root.requestActiveFocus() + } + } + } + + onItemChanged: { + if (!Boolean(root.item)) { + return + } + + bar.selectPage(root.item) + } + + Rectangle { + anchors.fill: parent + color: root.color + } + + RowLayout { + id: topLayout + anchors.top: parent.top + anchors.topMargin: 46 + anchors.left: parent.left + anchors.leftMargin: 46 + anchors.right: parent.right + anchors.rightMargin: 46 + + spacing: 12 + + NavigationPanel { + id: navSearchPanel + name: "LearnSearch" + section: navSec + order: 1 + accessible.name: qsTrc("learn", "Learn") + } + + StyledTextLabel { + id: learnLabel + + font: ui.theme.titleBoldFont + text: qsTrc("learn", "Learn") + } + + Item { + Layout.preferredWidth: topLayout.width - learnLabel.width - 24 - searchField.width + Layout.fillHeight: true + } + + SearchField { + id: searchField + + Layout.preferredWidth: 220 + + navigation.name: "LearnSearch" + navigation.panel: navSearchPanel + navigation.order: 1 + accessible.name: qsTrc("learn", "Learn search") + } + } + + TabBar { + id: bar + + anchors.top: topLayout.bottom + anchors.topMargin: 36 + anchors.left: parent.left + anchors.leftMargin: 24 + + contentHeight: 32 + spacing: 0 + + function pageIndex(pageName) { + switch (pageName) { + case "get-started": return 0 + case "advanced": return 1 + case "classes": return 2 + } + + return 0 + } + + function selectPage(pageName) { + currentIndex = pageIndex(pageName) + } + + NavigationPanel { + id: navTabPanel + name: "LearnTabs" + section: navSec + order: 2 + accessible.name: qsTrc("learn", "Learn tabs") + + onNavigationEvent: { + if (event.type === NavigationEvent.AboutActive) { + event.setData("controlName", bar.currentItem.navigation.name) + } + } + } + + StyledTabButton { + text: qsTrc("learn", "Get Started") + sideMargin: 22 + isCurrent: bar.currentIndex === 0 + backgroundColor: root.color + + navigation.name: "Get Started" + navigation.panel: navTabPanel + navigation.order: 1 + onNavigationTriggered: bar.currentIndex = 0 + } + + StyledTabButton { + text: qsTrc("learn", "Advanced") + sideMargin: 22 + isCurrent: bar.currentIndex === 1 + backgroundColor: root.color + + navigation.name: "Advanced" + navigation.panel: navTabPanel + navigation.order: 2 + onNavigationTriggered: bar.currentIndex = 1 + } + + StyledTabButton { + text: qsTrc("learn", "Classes") + sideMargin: 22 + isCurrent: bar.currentIndex === 2 + backgroundColor: root.color + + navigation.name: "Classes" + navigation.panel: navTabPanel + navigation.order: 3 + onNavigationTriggered: bar.currentIndex = 2 + } + } + + StackLayout { + anchors.top: bar.bottom + anchors.topMargin: 24 + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + + currentIndex: bar.currentIndex + + Rectangle { + id: getStartedComp + + color: root.color + + // search: searchField.searchText + // backgroundColor: root.color + } + + Rectangle { + id: advancedComp + + color: root.color + + // search: searchField.searchText + // backgroundColor: root.color + } + + Rectangle { + id: classesComp + + color: root.color + + // navigation.section: navSec + // navigation.order: 3 + // search: searchField.searchText + // backgroundColor: root.color + } + } +} + diff --git a/src/learn/qml/MuseScore/Learn/qmldir b/src/learn/qml/MuseScore/Learn/qmldir new file mode 100644 index 0000000000000..0062a1056d8d7 --- /dev/null +++ b/src/learn/qml/MuseScore/Learn/qmldir @@ -0,0 +1,2 @@ +module MuseScore.Learn +LearnPage 1.0 LearnPage.qml diff --git a/src/main/CMakeLists.txt b/src/main/CMakeLists.txt index c4d23e45e2f5f..52ecfa3f2819b 100644 --- a/src/main/CMakeLists.txt +++ b/src/main/CMakeLists.txt @@ -152,6 +152,7 @@ set(LINK_LIB ${LINK_LIB} midi midi_old userscores + learn notation commonscene palette diff --git a/src/main/main.cpp b/src/main/main.cpp index d110f68386096..d9dca77007cd1 100644 --- a/src/main/main.cpp +++ b/src/main/main.cpp @@ -66,6 +66,12 @@ #include "stubs/userscores/userscoresstubmodule.h" #endif +#ifdef BUILD_LEARN_MODULE +#include "learn/learnmodule.h" +#else +#include "stubs/learn/learnmodule.h" +#endif + #include "engraving/engravingmodule.h" #include "notation/notationmodule.h" @@ -212,6 +218,8 @@ int main(int argc, char** argv) app.addModule(new mu::userscores::UserScoresStubModule()); #endif + app.addModule(new mu::learn::LearnModule()); + app.addModule(new mu::engraving::EngravingModule()); app.addModule(new mu::notation::NotationModule()); app.addModule(new mu::commonscene::CommonSceneModule()); diff --git a/src/stubs/CMakeLists.txt b/src/stubs/CMakeLists.txt index 3a266c8a85caa..4871ce6de8ceb 100644 --- a/src/stubs/CMakeLists.txt +++ b/src/stubs/CMakeLists.txt @@ -24,6 +24,10 @@ if (NOT BUILD_USERSCORES_MODULE) add_subdirectory(userscores) endif (NOT BUILD_USERSCORES_MODULE) +if (NOT BUILD_LEARN_MODULE) + add_subdirectory(learn) +endif (NOT BUILD_LEARN_MODULE) + if (NOT BUILD_WORKSPACE_MODULE) add_subdirectory(workspace) endif (NOT BUILD_WORKSPACE_MODULE) diff --git a/src/stubs/learn/CMakeLists.txt b/src/stubs/learn/CMakeLists.txt new file mode 100644 index 0000000000000..d094dbf127500 --- /dev/null +++ b/src/stubs/learn/CMakeLists.txt @@ -0,0 +1,33 @@ +# 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 . + +set(MODULE learn) + +set(MODULE_QRC learn.qrc) + +set(MODULE_QML_IMPORT ${CMAKE_CURRENT_LIST_DIR}/qml) + +set(MODULE_SRC + ${CMAKE_CURRENT_LIST_DIR}/learnmodule.cpp + ${CMAKE_CURRENT_LIST_DIR}/learnmodule.h + ) + +include(${PROJECT_SOURCE_DIR}/build/module.cmake) + diff --git a/src/stubs/learn/learn.qrc b/src/stubs/learn/learn.qrc new file mode 100644 index 0000000000000..d53310827e843 --- /dev/null +++ b/src/stubs/learn/learn.qrc @@ -0,0 +1,6 @@ + + + qml/MuseScore/Learn/LearnPage.qml + qml/MuseScore/Learn/qmldir + + diff --git a/src/stubs/learn/learnmodule.cpp b/src/stubs/learn/learnmodule.cpp new file mode 100644 index 0000000000000..ba865eca5dbad --- /dev/null +++ b/src/stubs/learn/learnmodule.cpp @@ -0,0 +1,41 @@ +/* + * 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 . + */ +#include "learnmodule.h" + +#include + +using namespace mu::learn; + +static void learn_init_qrc() +{ + Q_INIT_RESOURCE(learn); +} + +std::string LearnModule::moduleName() const +{ + return "learn_stub"; +} + +void LearnModule::registerResources() +{ + learn_init_qrc(); +} diff --git a/src/stubs/learn/learnmodule.h b/src/stubs/learn/learnmodule.h new file mode 100644 index 0000000000000..54cb325e9444b --- /dev/null +++ b/src/stubs/learn/learnmodule.h @@ -0,0 +1,36 @@ +/* + * 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 . + */ +#ifndef MU_LEARN_LEARNMODULE_H +#define MU_LEARN_LEARNMODULE_H + +#include "modularity/imodulesetup.h" + +namespace mu::learn { +class LearnModule : public framework::IModuleSetup +{ +public: + std::string moduleName() const override; + void registerResources() override; +}; +} + +#endif // MU_LEARN_LEARNMODULE_H diff --git a/src/stubs/learn/qml/MuseScore/Learn/LearnPage.qml b/src/stubs/learn/qml/MuseScore/Learn/LearnPage.qml new file mode 100644 index 0000000000000..0c9de9d53989c --- /dev/null +++ b/src/stubs/learn/qml/MuseScore/Learn/LearnPage.qml @@ -0,0 +1,33 @@ +/* + * 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 . + */ +import QtQuick 2.15 + +import MuseScore.UiComponents 1.0 + +Rectangle { + color: ui.theme.backgroundPrimaryColor + + StyledTextLabel { + anchors.centerIn: parent + text: "Learn Page Stub" + } +} diff --git a/src/stubs/learn/qml/MuseScore/Learn/qmldir b/src/stubs/learn/qml/MuseScore/Learn/qmldir new file mode 100644 index 0000000000000..0062a1056d8d7 --- /dev/null +++ b/src/stubs/learn/qml/MuseScore/Learn/qmldir @@ -0,0 +1,2 @@ +module MuseScore.Learn +LearnPage 1.0 LearnPage.qml