Skip to content

Commit

Permalink
added navigation for Home Menu
Browse files Browse the repository at this point in the history
  • Loading branch information
igorkorsukov authored and vpereverzev committed Apr 29, 2021
1 parent 6813bfa commit 1401057
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 6 deletions.
21 changes: 18 additions & 3 deletions src/appshell/qml/HomePage/HomeMenu.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,21 @@
* 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.7
import QtQuick 2.15
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.3

import MuseScore.UiComponents 1.0
import MuseScore.Ui 1.0

import MuseScore.UiComponents 1.0
import MuseScore.Cloud 1.0

Rectangle {
id: root

property string currentPageName: ""

property NavigationSection navigationSection: null

signal selected(string name)

color: ui.theme.backgroundPrimaryColor
Expand All @@ -46,6 +47,9 @@ Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 60

navirationPanel.section: root.navigationSection
navirationPanel.order: 1

checked: root.currentPageName === "account"

onToggled: {
Expand All @@ -66,6 +70,13 @@ Rectangle {
orientation: ListView.Vertical
spacing: 0

property NavigationPanel navigationPanel: NavigationPanel {
name: "MenuPanel"
section: root.navigationSection
order: 2
direction: NavigationPanel.Vertical
}

model: [
{ "name": "scores", "title": qsTrc("appshell", "Scores"), "icon": IconCode.MUSIC_NOTES },
{ "name": "add-ons", "title": qsTrc("appshell", "Add-ons"), "icon": IconCode.PLUS },
Expand All @@ -82,6 +93,10 @@ Rectangle {

width: parent.width

navigation.name: title
navigation.panel: radioButtonList.navigationPanel
navigation.row: 1 + model.index

spacing: 30
leftPadding: spacing

Expand Down
10 changes: 8 additions & 2 deletions src/appshell/qml/HomePage/HomePage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
* 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.7
import QtQuick 2.15
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.2

Expand All @@ -37,6 +37,11 @@ DockPage {
property string item: ""
property string subItem: ""

property NavigationSection menuNavigationSectionSec: NavigationSection {
name: "HomeMenu"
order: 2
}

onItemChanged: {
if (!Boolean(item)) {
return
Expand All @@ -57,7 +62,8 @@ DockPage {

color: ui.theme.backgroundPrimaryColor

HomeMenu {
HomeMenu {
navigationSection: homePage.menuNavigationSectionSec
currentPageName: homeCentral.currentCompName

onSelected: {
Expand Down
3 changes: 3 additions & 0 deletions src/appshell/qml/NotationPage/NotationPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -46,16 +46,19 @@ DockPage {

property NavigationSection keynavNoteInputSec: NavigationSection {
name: "NoteInputSection"
enabled: notationPage.visible
order: 2
}

property NavigationSection keynavLeftPanelSec: NavigationSection {
name: "LeftPanel"
enabled: notationPage.visible
order: 3
}

property NavigationSection keynavRightPanelSec: NavigationSection {
name: "RightPanel"
enabled: notationPage.visible
order: 5
}

Expand Down
4 changes: 4 additions & 0 deletions src/appshell/view/dockwindow/dockwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ void DockWindow::hidePage(DockPage* page)
w->setParent(sDummy);
}

page->setVisible(false);

m_window->update();
m_window->repaint();
}
Expand Down Expand Up @@ -286,6 +288,8 @@ void DockWindow::showPage(DockPage* page)
}

restoreState(page->objectName());

page->setVisible(true);
}

void DockWindow::updateStyle()
Expand Down
12 changes: 12 additions & 0 deletions src/cloud/qml/MuseScore/Cloud/AccountInfoButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ GradientTabButton {
property string userName: accountModel.accountInfo.userName
property string avatarUrl: accountModel.accountInfo.avatarUrl

property alias navirationPanel: navPanel

signal userAuthorizedChanged()

orientation: Qt.Horizontal
Expand All @@ -43,6 +45,16 @@ GradientTabButton {
title: Boolean(userName) ? userName : qsTrc("cloud", "My Account")
iconComponent: Boolean(avatarUrl) ? avatarComp : stubAvatarComp

NavigationPanel {
id: navPanel
name: "AccountInfo"
direction: NavigationPanel.Vertical
}

navigation.name: "AccountInfo"
navigation.panel: navPanel
navigation.row: 1

AccountModel {
id: accountModel

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ RadioDelegate {
leftPadding: 0
rightPadding: 0

onToggled: {
onPressed: {
if (!keynavCtrl.active) {
keynavCtrl.forceActive()
}
Expand All @@ -59,6 +59,7 @@ RadioDelegate {
onActiveChanged: {
if (keynavCtrl.active) {
root.forceActiveFocus()
root.toggled()
}
}

Expand Down

0 comments on commit 1401057

Please sign in to comment.