Skip to content
Snippets Groups Projects
Commit 84dc2b3b authored by SeeLook's avatar SeeLook :musical_note:
Browse files

Get rid of mobile drawer button of dialogs

Use buttons like on desktop
parent 1406a141
No related branches found
No related tags found
No related merge requests found
......@@ -9,7 +9,6 @@
<file alias="NootkaLabel.qml">qml/NootkaLabel.qml</file>
<file alias="MainScore.qml">qml/MainScore.qml</file>
<file alias="DialogLoader.qml">qml/DialogLoader.qml</file>
<file alias="+android/DialogDrawer.qml">qml/+android/DialogDrawer.qml</file>
<file alias="NoteName.qml">qml/NoteName.qml</file>
<file alias="ScoreMenuContent.qml">qml/ScoreMenuContent.qml</file>
<file alias="MelodyMenuContent.qml">qml/MelodyMenuContent.qml</file>
......
/** This file is part of Nootka (http://nootka.sf.net) *
* Copyright (C) 2017 by Tomasz Bojczuk (seelook@gmail.com) *
* on the terms of GNU GPLv3 license (http://www.gnu.org/licenses) */
import QtQuick 2.9
import QtQuick.Controls 2.2
import Nootka 1.0
import "../"
Drawer {
width: Noo.fontSize() * 20
height: dialLoader.height
ListView {
spacing: Noo.fontSize() / 4
anchors.fill: parent
model: dialLoader.buttons
delegate: Component {
MenuButton {
property int role: dialLoader.buttons[index]
action: Taction {
text: dialogObj.stdButtonText(dialLoader.buttons[index])
icon: dialogObj.stdButtonIcon(dialLoader.buttons[index])
}
onClicked: mapRole(role)
}
}
}
function mapRole(role) {
switch (role) {
case DialogButtonBox.Ok: dialLoader.accept(); break
case DialogButtonBox.Apply: dialLoader.apply(); break
case DialogButtonBox.Cancel: dialLoader.reject(); break
case DialogButtonBox.RestoreDefaults: dialLoader.reset(); break
case DialogButtonBox.Help: dialLoader.help(); break
case DialogButtonBox.Close: dialLoader.close(); break
}
close()
}
}
/** This file is part of Nootka (http://nootka.sf.net) *
* Copyright (C) 2017-2018 by Tomasz Bojczuk (seelook@gmail.com) *
* Copyright (C) 2017-2020 by Tomasz Bojczuk (seelook@gmail.com) *
* on the terms of GNU GPLv3 license (http://www.gnu.org/licenses) */
import QtQuick 2.9
......@@ -23,8 +23,6 @@ Old.Dialog {
// private
property var currentDialog: null
property var dialogDrawer: null
property var buttons: []
TdialogObject {
id: dialogObj
......@@ -51,8 +49,8 @@ Old.Dialog {
}
DialogButtonBox {
id: box
visible: !Noo.isAndroid() && standardButtons != 0
width: parent.width; height: Noo.isAndroid() ? 0 : Noo.fontSize() * 3
visible: standardButtons !== 0
width: parent.width; height: Noo.fontSize() * 3
padding: Noo.fontSize() / 4
spacing: Noo.fontSize()
delegate: TiconButton {
......@@ -77,11 +75,9 @@ Old.Dialog {
onPageChanged: {
if (page > 0) {
if (Noo.isAndroid()) {
standardButtons = 0
} else {
width = nootkaWindow.width * 0.9
height = nootkaWindow.height * 0.9
if (!Noo.isAndroid()) {
width = nootkaWindow.width * 0.9
height = nootkaWindow.height * 0.9
}
switch (page) {
case Nootka.Settings:
......@@ -116,14 +112,9 @@ Old.Dialog {
SOUND.stopListen()
SOUND.stopPlaying()
open()
if (Noo.isAndroid()) {
var c = Qt.createComponent("qrc:/+android/DialogDrawer.qml")
dialogDrawer = c.createObject(currentDialog)
}
}
}
onVisibleChanged: {
if (visible === false && currentDialog) {
if (page !== Nootka.ExamStart)
......
/** This file is part of Nootka (http://nootka.sf.net) *
* Copyright (C) 2017 by Tomasz Bojczuk (seelook@gmail.com) *
* Copyright (C) 2017-2020 by Tomasz Bojczuk (seelook@gmail.com) *
* on the terms of GNU GPLv3 license (http://www.gnu.org/licenses) */
import QtQuick 2.9
......@@ -26,16 +26,7 @@ Item {
"about/Donors")
pages.addItem("changes", qsTr("Changes"), "about/Changes")
pages.addItem("qt", "Qt", "about/Qt")
if (Noo.isAndroid()) {
dialLoader.buttons = [DialogButtonBox.Close]
} else {
dialLoader.standardButtons = DialogButtonBox.Close
dialLoader.title = qsTr("About Nootka")
}
}
Connections {
target: pages.mobileButt
onClicked: dialLoader.dialogDrawer.open()
dialLoader.standardButtons = DialogButtonBox.Close
dialLoader.title = qsTr("About Nootka")
}
}
/** This file is part of Nootka (http://nootka.sf.net) *
* Copyright (C) 2018-2019 by Tomasz Bojczuk (seelook@gmail.com) *
* Copyright (C) 2018-2020 by Tomasz Bojczuk (seelook@gmail.com) *
* on the terms of GNU GPLv3 license (http://www.gnu.org/licenses) */
import QtQuick 2.9
......@@ -90,12 +90,8 @@ TexamSummary {
}
Component.onCompleted: {
if (Noo.isAndroid()) {
dialLoader.buttons = []
} else {
dialLoader.standardButtons = 0
dialLoader.title = summDialog.title()
}
dialLoader.standardButtons = 0
dialLoader.title = summDialog.title()
}
Component.onDestruction: {
......
/** This file is part of Nootka (http://nootka.sf.net) *
* Copyright (C) 2017-2019 by Tomasz Bojczuk (seelook@gmail.com) *
* Copyright (C) 2017-2020 by Tomasz Bojczuk (seelook@gmail.com) *
* on the terms of GNU GPLv3 license (http://www.gnu.org/licenses) */
import QtQuick 2.9
......@@ -190,12 +190,8 @@ TstartExamItem {
}
Component.onCompleted: {
if (Noo.isAndroid()) {
dialLoader.buttons = []
} else {
dialLoader.standardButtons = 0
dialLoader.title = qsTr("Start exercises or an exam")
}
dialLoader.standardButtons = 0
dialLoader.title = qsTr("Start exercises or an exam")
}
onContinueExam: start(Texecutor.ContinueExam, examFile)
......
/** This file is part of Nootka (http://nootka.sf.net) *
* Copyright (C) 2017-2018 by Tomasz Bojczuk (seelook@gmail.com) *
* Copyright (C) 2017-2020 by Tomasz Bojczuk (seelook@gmail.com) *
* on the terms of GNU GPLv3 license (http://www.gnu.org/licenses) */
import QtQuick 2.9
......@@ -23,17 +23,14 @@ TlevelCreatorItem {
pages.addItem("rhythms", qsTr("Rhythms"), "level/Rhythms")
pages.addItem("accidentals", qsTr("Accidentals"), "level/Accids")
pages.addItem("range", qsTr("Range"), "level/Range")
if (Noo.isAndroid()) {
dialLoader.buttons = [DialogButtonBox.Close, DialogButtonBox.Help, DialogButtonBox.RestoreDefaults]
} else {
dialLoader.title = creator.title
dialLoader.standardButtons = DialogButtonBox.Close | DialogButtonBox.Help | DialogButtonBox.RestoreDefaults
var b = dialLoader.buttonBox.standardButton(DialogButtonBox.RestoreDefaults)
b.text = qsTr("Check")
b.DialogButtonBox.buttonRole = DialogButtonBox.ActionRole
b.pixmap = Noo.pix("levelCreator")
b.clicked.connect(checkLevel)
}
dialLoader.title = creator.title
dialLoader.standardButtons = DialogButtonBox.Close | DialogButtonBox.Help | DialogButtonBox.RestoreDefaults
var b = dialLoader.buttonBox.standardButton(DialogButtonBox.RestoreDefaults)
b.text = qsTr("Check")
b.DialogButtonBox.buttonRole = DialogButtonBox.ActionRole
b.pixmap = Noo.pix("levelCreator")
b.clicked.connect(checkLevel)
}
onSaveStateChanged: {
......@@ -52,10 +49,5 @@ TlevelCreatorItem {
pages.pages[2].saveLevel()
}
Connections {
target: pages.mobileButt
onClicked: dialLoader.dialogDrawer.open()
}
function help() { Noo.openHelpLink("level-creator") }
}
/** This file is part of Nootka (http://nootka.sf.net) *
* Copyright (C) 2018-2019 by Tomasz Bojczuk (seelook@gmail.com) *
* Copyright (C) 2018-2020 by Tomasz Bojczuk (seelook@gmail.com) *
* on the terms of GNU GPLv3 license (http://www.gnu.org/licenses) */
import QtQuick 2.9
......@@ -80,17 +80,13 @@ TmelGenItem {
property var defButt: null
Component.onCompleted: {
if (Noo.isAndroid()) {
dialLoader.buttons = [DialogButtonBox.Close, DialogButtonBox.Help, DialogButtonBox.RestoreDefaults]
} else {
dialLoader.title = Noo.TR("TmelodySettings", "Random melody")
dialLoader.standardButtons = DialogButtonBox.Close | DialogButtonBox.Help | DialogButtonBox.RestoreDefaults
defButt = dialLoader.buttonBox.standardButton(DialogButtonBox.RestoreDefaults)
defButt.text = Noo.TR("TmainScoreObject", "Generate melody")
defButt.DialogButtonBox.buttonRole = DialogButtonBox.ActionRole
defButt.pixmap = Noo.pix("melody")
defButt.clicked.connect(doGenerate)
}
dialLoader.title = Noo.TR("TmelodySettings", "Random melody")
dialLoader.standardButtons = DialogButtonBox.Close | DialogButtonBox.Help | DialogButtonBox.RestoreDefaults
defButt = dialLoader.buttonBox.standardButton(DialogButtonBox.RestoreDefaults)
defButt.text = Noo.TR("TmainScoreObject", "Generate melody")
defButt.DialogButtonBox.buttonRole = DialogButtonBox.ActionRole
defButt.pixmap = Noo.pix("melody")
defButt.clicked.connect(doGenerate)
}
function doGenerate() {
......
/** This file is part of Nootka (http://nootka.sf.net) *
* Copyright (C) 2017-2019 by Tomasz Bojczuk (seelook@gmail.com) *
* Copyright (C) 2017-2020 by Tomasz Bojczuk (seelook@gmail.com) *
* on the terms of GNU GPLv3 license (http://www.gnu.org/licenses) */
import QtQuick 2.9
......@@ -22,17 +22,8 @@ Item {
pages.addItem("sound", qsTr("Sound"), "settings/Sound")
}
pages.addItem("questions", qsTr("Exercises") + "\n& " + qsTr("Exam"), "settings/Exam")
if (Noo.isAndroid()) {
dialLoader.buttons = [DialogButtonBox.Apply, DialogButtonBox.RestoreDefaults, DialogButtonBox.Help, DialogButtonBox.Cancel]
} else {
dialLoader.standardButtons = DialogButtonBox.Apply | DialogButtonBox.Cancel | DialogButtonBox.RestoreDefaults | DialogButtonBox.Help
dialLoader.title = "Nootka - " + qsTranslate("TsettingsDialog", "application's settings")
}
}
Connections {
target: pages.mobileButt
onClicked: dialLoader.dialogDrawer.open()
dialLoader.standardButtons = DialogButtonBox.Apply | DialogButtonBox.Cancel | DialogButtonBox.RestoreDefaults | DialogButtonBox.Help
dialLoader.title = "Nootka - " + qsTranslate("TsettingsDialog", "application's settings")
}
function apply() {
......
/** This file is part of Nootka (http://nootka.sf.net) *
* Copyright (C) 2017-2019 by Tomasz Bojczuk (seelook@gmail.com) *
* Copyright (C) 2017-2020 by Tomasz Bojczuk (seelook@gmail.com) *
* on the terms of GNU GPLv3 license (http://www.gnu.org/licenses) */
import QtQuick 2.9
......@@ -17,7 +17,6 @@ Item {
property alias pages: navList.pages
property alias currentPage: stack.currentItem
property var buttons: []
property alias mobileButt: mobBut
anchors { fill: parent; leftMargin: Noo.fontSize() / 4 }
......@@ -41,7 +40,7 @@ Item {
ListView {
id: navList
clip: true
height: parent.height - (Noo.isAndroid() ? mobBut.height : 0)
height: parent.height
width: maxWidth
z: 3 // above stack
topMargin: Noo.fontSize() / 2
......@@ -108,24 +107,6 @@ Item {
Behavior on contentY { enabled: GLOB.useAnimations; NumberAnimation { duration: 300; easing.type: Easing.OutBounce }}
}
Button {
id: mobBut
visible: Noo.isAndroid()
width: navList.width
height: Noo.fontSize() * 2
background: Rectangle {
anchors.fill: parent
color: mobBut.down ? activPal.highlight : activPal.text
}
contentItem: Text {
text: ". . ."
font.bold: true
color: mobBut.down ? activPal.highlightedText : activPal.base
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
}
}
// pages container on the right
......
/** This file is part of Nootka (http://nootka.sf.net) *
* Copyright (C) 2018-2019 by Tomasz Bojczuk (seelook@gmail.com) *
* Copyright (C) 2018-2020 by Tomasz Bojczuk (seelook@gmail.com) *
* on the terms of GNU GPLv3 license (http://www.gnu.org/licenses) */
import QtQuick 2.9
......@@ -83,12 +83,7 @@ TtunerDialogItem {
}
Component.onCompleted: {
if (Noo.isAndroid()) {
dialLoader.buttons = [DialogButtonBox.Close]
} else {
dialLoader.standardButtons = DialogButtonBox.Close
dialLoader.title = qsTr("Nooter - Nootka tuner")
}
dialLoader.standardButtons = DialogButtonBox.Close
dialLoader.title = qsTr("Nooter - Nootka tuner")
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment