Skip to content

Commit

Permalink
Implemented learn module
Browse files Browse the repository at this point in the history
  • Loading branch information
Eism authored and igorkorsukov committed Jun 30, 2021
1 parent a6c77ec commit 0200c5e
Show file tree
Hide file tree
Showing 19 changed files with 510 additions and 4 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions build/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 2 additions & 4 deletions src/appshell/qml/HomePage/HomePage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -124,10 +125,7 @@ DockPage {
Component {
id: learnComp

StyledTextLabel {
anchors.centerIn: parent
text: "Learn"
}
LearnPage {}
}

Component {
Expand Down
33 changes: 33 additions & 0 deletions src/learn/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.

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)

6 changes: 6 additions & 0 deletions src/learn/learn.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<RCC>
<qresource prefix="/">
<file>qml/MuseScore/Learn/LearnPage.qml</file>
<file>qml/MuseScore/Learn/qmldir</file>
</qresource>
</RCC>
41 changes: 41 additions & 0 deletions src/learn/learnmodule.cpp
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
*/
#include "learnmodule.h"

#include <QQmlEngine>

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();
}
36 changes: 36 additions & 0 deletions src/learn/learnmodule.h
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
*/
#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
220 changes: 220 additions & 0 deletions src/learn/qml/MuseScore/Learn/LearnPage.qml
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
*/
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
}
}
}

2 changes: 2 additions & 0 deletions src/learn/qml/MuseScore/Learn/qmldir
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module MuseScore.Learn
LearnPage 1.0 LearnPage.qml
1 change: 1 addition & 0 deletions src/main/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ set(LINK_LIB ${LINK_LIB}
midi
midi_old
userscores
learn
notation
commonscene
palette
Expand Down
Loading

0 comments on commit 0200c5e

Please sign in to comment.