From c5ce063e0d00b10f401ed165f2858f2ef651868b Mon Sep 17 00:00:00 2001
From: SeeLook <SeeLook@localhost>
Date: Sat, 6 Jan 2018 10:20:44 +0100
Subject: [PATCH] Increase radius for popup background to improve visibility,
 create dialog loader on demand - reduces launch time a little

---
 src/qml/MainWindow.qml              | 19 +++++++++++++------
 src/qml/ScoreMenuContent.qml        |  4 ++--
 src/qml/instruments/OutScaleTip.qml | 13 ++++++++-----
 src/qml/sound/TempoMenu.qml         |  7 ++++---
 4 files changed, 27 insertions(+), 16 deletions(-)

diff --git a/src/qml/MainWindow.qml b/src/qml/MainWindow.qml
index 91f312dd4..ee395da1e 100644
--- a/src/qml/MainWindow.qml
+++ b/src/qml/MainWindow.qml
@@ -1,5 +1,5 @@
 /** This file is part of Nootka (http://nootka.sf.net)               *
- * Copyright (C) 2017 by Tomasz Bojczuk (seelook@gmail.com)          *
+ * Copyright (C) 2017-2018 by Tomasz Bojczuk (seelook@gmail.com)     *
  * on the terms of GNU GPLv3 license (http://www.gnu.org/licenses)   */
 
 import QtQuick 2.9
@@ -26,6 +26,7 @@ ApplicationWindow {
   property var noteName: null
   property var examResults: null
   property var executor: null
+  property var dialogLoader: null
 
   SystemPalette { id: activPal; colorGroup: SystemPalette.Active }
   SystemPalette { id: disdPal; colorGroup: SystemPalette.Disabled }
@@ -35,15 +36,15 @@ ApplicationWindow {
     icon: "systemsettings"
     text: qsTranslate("TtoolBar", "Settings")
     tip: qsTranslate("TtoolBar", "Application preferences")
-    onTriggered: dialogLoader.page = Nootka.Settings
+    onTriggered: showDialog(Nootka.Settings)
   }
-  Taction { id: aboutAct; onTriggered: dialogLoader.page = Nootka.About }
+  Taction { id: aboutAct; onTriggered: showDialog(Nootka.About) }
   Taction {
     id: levelAct
     icon: "levelCreator"
     text: qsTranslate("TtoolBar", "Level")
     tip: qsTranslate("TtoolBar", "Levels creator")
-    onTriggered: dialogLoader.page = Nootka.LevelCreator
+    onTriggered: showDialog(Nootka.LevelCreator)
   }
   Taction { // desktop only
     id: scoreAct
@@ -57,7 +58,7 @@ ApplicationWindow {
     icon: "startExam"
     text: qsTranslate("TtoolBar", "Lessons")
     tip: qsTranslate("TtoolBar", "Start exercises or an exam")
-    onTriggered: dialogLoader.page = Nootka.ExamStart
+    onTriggered: showDialog(Nootka.ExamStart)
   }
 
   width: GLOB.geometry.width
@@ -124,5 +125,11 @@ ApplicationWindow {
     }
   }
 
-  DialogLoader { id: dialogLoader }
+  function showDialog(page) {
+    if (!dialogLoader) {
+      var c = Qt.createComponent("qrc:/DialogLoader.qml")
+      dialogLoader = c.createObject(nootkaWindow)
+    }
+    dialogLoader.page = page
+  }
 }
diff --git a/src/qml/ScoreMenuContent.qml b/src/qml/ScoreMenuContent.qml
index c65236a49..3d9001e6b 100644
--- a/src/qml/ScoreMenuContent.qml
+++ b/src/qml/ScoreMenuContent.qml
@@ -1,5 +1,5 @@
 /** This file is part of Nootka (http://nootka.sf.net)               *
- * Copyright (C) 2017 by Tomasz Bojczuk (seelook@gmail.com)          *
+ * Copyright (C) 2017-2018 by Tomasz Bojczuk (seelook@gmail.com)     *
  * on the terms of GNU GPLv3 license (http://www.gnu.org/licenses)   */
 
 import QtQuick 2.9
@@ -12,7 +12,7 @@ Menu {
   x: toolBar.scoreAct.x
   y: score.y
 
-  background: TipRect { color: activPal.window }
+  background: TipRect { color: activPal.window; shadowRadius: Noo.fontSize() }
 
   Repeater {
     model: score.scoreActions
diff --git a/src/qml/instruments/OutScaleTip.qml b/src/qml/instruments/OutScaleTip.qml
index dc81aa37e..4648d6f3a 100644
--- a/src/qml/instruments/OutScaleTip.qml
+++ b/src/qml/instruments/OutScaleTip.qml
@@ -1,5 +1,5 @@
 /** This file is part of Nootka (http://nootka.sf.net)               *
- * Copyright (C) 2017 by Tomasz Bojczuk (seelook@gmail.com)          *
+ * Copyright (C) 2017-2018 by Tomasz Bojczuk (seelook@gmail.com)     *
  * on the terms of GNU GPLv3 license (http://www.gnu.org/licenses)   */
 
 import QtQuick 2.9
@@ -7,14 +7,17 @@ import QtQuick 2.9
 import "../"
 
 
-Tile {
-  width: visible ? parent.width / 4 : 0
+TipRect {
+  width: visible ? parent.width / 4 : 0; height: Noo.fontSize() * (2 + txt.lineCount * 1.5)
   x: (parent.width - width) / 2
   y: visible ? (parent.height - height) / 2 : parent.height
   z: 100
-  bgColor: Qt.tint("red", Noo.alpha(activPal.base, 80))
+  color: Qt.tint("red", Noo.alpha(activPal.base, 80))
+  shadowRadius: Noo.fontSize()
   Text {
-    width: parent.width * 0.96
+    id: txt
+    width: parent.width * 0.9
+    anchors.centerIn: parent
     text: qsTr("Out of instrument scale!")
     font.pixelSize: Noo.fontSize() * 1.5
     wrapMode: Text.WordWrap
diff --git a/src/qml/sound/TempoMenu.qml b/src/qml/sound/TempoMenu.qml
index 99aa959da..716d1b2ff 100644
--- a/src/qml/sound/TempoMenu.qml
+++ b/src/qml/sound/TempoMenu.qml
@@ -1,5 +1,5 @@
 /** This file is part of Nootka (http://nootka.sf.net)               *
- * Copyright (C) 2017 by Tomasz Bojczuk (seelook@gmail.com)          *
+ * Copyright (C) 2017-2018 by Tomasz Bojczuk (seelook@gmail.com)     *
  * on the terms of GNU GPLv3 license (http://www.gnu.org/licenses)   */
 
 import QtQuick 2.9
@@ -14,7 +14,7 @@ Popup {
 
   margins: Noo.fontSize()
 
-  background: TipRect { color: activPal.window }
+  background: TipRect { color: activPal.window; shadowRadius: Noo.fontSize() }
 
   signal accepted()
 
@@ -73,8 +73,9 @@ Popup {
       checked: true
     }
 
-    Button {
+    TiconButton {
       text:  Noo.TR("QPlatformTheme", "Apply")
+      pixmap: Noo.pix("check")
       anchors.horizontalCenter: parent.horizontalCenter
       onClicked: {
         SOUND.tempo = tempoSpin.value
-- 
GitLab