From 2721822a8b51d58b40ffc50892fd6e1c480fa09a Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 5 Apr 2017 11:24:51 +0200 Subject: Qt Hangman example: Add a settings file for fonts On Windows/UWP, change the font to "Arial" to prevent the ugly default font. Change-Id: I7adffec3c3469a33ee432093368144a1f139ce06 Reviewed-by: Maurice Kalinowski --- .../qthangman/qml/qthangman/+windows/Settings.qml | 57 ++++++++++++++++++++++ .../qthangman/qml/qthangman/GameView.qml | 5 +- .../qthangman/qml/qthangman/HowToView.qml | 8 +-- .../purchasing/qthangman/qml/qthangman/Letter.qml | 3 +- .../qthangman/qml/qthangman/PageHeader.qml | 2 +- .../qthangman/qml/qthangman/ScoreItem.qml | 3 +- .../qthangman/qml/qthangman/Settings.qml | 57 ++++++++++++++++++++++ .../qthangman/qml/qthangman/SimpleButton.qml | 3 +- .../qthangman/qml/qthangman/SplashScreen.qml | 2 +- examples/purchasing/qthangman/qml/qthangman/qmldir | 17 +++++++ examples/purchasing/qthangman/resources.qrc | 3 ++ 11 files changed, 149 insertions(+), 11 deletions(-) create mode 100644 examples/purchasing/qthangman/qml/qthangman/+windows/Settings.qml create mode 100644 examples/purchasing/qthangman/qml/qthangman/Settings.qml create mode 100644 examples/purchasing/qthangman/qml/qthangman/qmldir (limited to 'examples') diff --git a/examples/purchasing/qthangman/qml/qthangman/+windows/Settings.qml b/examples/purchasing/qthangman/qml/qthangman/+windows/Settings.qml new file mode 100644 index 0000000..96f78f7 --- /dev/null +++ b/examples/purchasing/qthangman/qml/qthangman/+windows/Settings.qml @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Purchasing module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +pragma Singleton +import QtQml 2.0 + +QtObject { + property string fontFamily: "Arial" + property string helpFontFamily: "Arial" +} diff --git a/examples/purchasing/qthangman/qml/qthangman/GameView.qml b/examples/purchasing/qthangman/qml/qthangman/GameView.qml index c80892b..972eea7 100644 --- a/examples/purchasing/qthangman/qml/qthangman/GameView.qml +++ b/examples/purchasing/qthangman/qml/qthangman/GameView.qml @@ -28,6 +28,7 @@ import QtQuick 2.2 import QtQuick.Controls 1.1 +import "." Item { id: gameView @@ -190,7 +191,7 @@ Item { minimumPointSize: 8 font.pointSize: 64 color: "white" - font.family: "Helvetica Neue" + font.family: Settings.fontFamily font.weight: Font.Light } @@ -205,7 +206,7 @@ Item { minimumPointSize: 8 font.pointSize: 64 color: "white" - font.family: "Helvetica Neue" + font.family: Settings.fontFamily font.weight: Font.Light } } diff --git a/examples/purchasing/qthangman/qml/qthangman/HowToView.qml b/examples/purchasing/qthangman/qml/qthangman/HowToView.qml index 277372f..0ef1f8b 100644 --- a/examples/purchasing/qthangman/qml/qthangman/HowToView.qml +++ b/examples/purchasing/qthangman/qml/qthangman/HowToView.qml @@ -60,7 +60,7 @@ Item { height: contentHeight width: parent.width wrapMode: Text.Wrap - font.family: ".Helvetica Neue Interface -M3" + font.family: Settings.helpFontFamily color: "white" font.pixelSize: helpFlickable.height * 0.04 text: "\ @@ -79,7 +79,7 @@ before you make too many mistakes and the hangman gets hung.\n" height: contentHeight width: parent.width wrapMode: Text.Wrap - font.family: ".Helvetica Neue Interface -M3" + font.family: Settings.helpFontFamily color: "white" font.pixelSize: helpFlickable.height * 0.04 text: "\ @@ -99,7 +99,7 @@ step closer to death. \n" height: contentHeight width: parent.width wrapMode: Text.Wrap - font.family: ".Helvetica Neue Interface -M3" + font.family: Settings.helpFontFamily color: "white" font.pixelSize: helpFlickable.height * 0.04 text: "\ @@ -116,7 +116,7 @@ any vowels that have not been guess already will be added to your vowel pool." height: contentHeight width: parent.width wrapMode: Text.Wrap - font.family: ".Helvetica Neue Interface -M3" + font.family: Settings.helpFontFamily color: "white" font.pixelSize: helpFlickable.height * 0.04 text: "\ diff --git a/examples/purchasing/qthangman/qml/qthangman/Letter.qml b/examples/purchasing/qthangman/qml/qthangman/Letter.qml index ab9edab..b5722f0 100644 --- a/examples/purchasing/qthangman/qml/qthangman/Letter.qml +++ b/examples/purchasing/qthangman/qml/qthangman/Letter.qml @@ -27,6 +27,7 @@ ****************************************************************************/ import QtQuick 2.2 +import "." Item { property alias text: label.text @@ -37,7 +38,7 @@ Item { id: label color: "white" font.pixelSize: parent.height * 0.75 - font.family: "Helvetica Neue" + font.family: Settings.fontFamily opacity: applicationData.lettersOwned.indexOf(text) >= 0 ? 1.0 : 0.0 visible: opacity > 0.0 diff --git a/examples/purchasing/qthangman/qml/qthangman/PageHeader.qml b/examples/purchasing/qthangman/qml/qthangman/PageHeader.qml index 92bc5fd..7bb5a90 100644 --- a/examples/purchasing/qthangman/qml/qthangman/PageHeader.qml +++ b/examples/purchasing/qthangman/qml/qthangman/PageHeader.qml @@ -60,7 +60,7 @@ Item { anchors.right: parent.right anchors.bottom: parent.bottom anchors.margins: topLevel.globalMargin - font.family: ".Helvetica Neue Interface -M3" + font.family: Settings.helpFontFamily color: "white" font.pointSize: 64 fontSizeMode: Text.Fit diff --git a/examples/purchasing/qthangman/qml/qthangman/ScoreItem.qml b/examples/purchasing/qthangman/qml/qthangman/ScoreItem.qml index 4ff7968..bbe518d 100644 --- a/examples/purchasing/qthangman/qml/qthangman/ScoreItem.qml +++ b/examples/purchasing/qthangman/qml/qthangman/ScoreItem.qml @@ -28,6 +28,7 @@ import QtQuick 2.2 import QtQuick.Controls 1.1 +import "." Rectangle { id: borderRect @@ -45,7 +46,7 @@ Rectangle { horizontalAlignment: Text.AlignRight verticalAlignment: Text.AlignVCenter font.pixelSize: parent.height - font.family: "Helvetica Neue" + font.family: Settings.fontFamily font.weight: Font.Light text: applicationData.score color: "white" diff --git a/examples/purchasing/qthangman/qml/qthangman/Settings.qml b/examples/purchasing/qthangman/qml/qthangman/Settings.qml new file mode 100644 index 0000000..2861d8b --- /dev/null +++ b/examples/purchasing/qthangman/qml/qthangman/Settings.qml @@ -0,0 +1,57 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Purchasing module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** BSD License Usage +** Alternatively, you may use this file under the terms of the BSD license +** as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of The Qt Company Ltd nor the names of its +** contributors may be used to endorse or promote products derived +** from this software without specific prior written permission. +** +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +pragma Singleton +import QtQml 2.0 + +QtObject { + property string fontFamily: "Helvetica Neue" + property string helpFontFamily: ".Helvetica Neue Interface -M3" +} diff --git a/examples/purchasing/qthangman/qml/qthangman/SimpleButton.qml b/examples/purchasing/qthangman/qml/qthangman/SimpleButton.qml index 7c83350..2aa222d 100644 --- a/examples/purchasing/qthangman/qml/qthangman/SimpleButton.qml +++ b/examples/purchasing/qthangman/qml/qthangman/SimpleButton.qml @@ -27,6 +27,7 @@ ****************************************************************************/ import QtQuick 2.2 +import "." Item { id: button @@ -60,7 +61,7 @@ Item { verticalAlignment: Text.AlignVCenter minimumPointSize: 8 font.pointSize: 64 - font.family: "Helvetica Neue" + font.family: Settings.fontFamily font.weight: Font.Light } } diff --git a/examples/purchasing/qthangman/qml/qthangman/SplashScreen.qml b/examples/purchasing/qthangman/qml/qthangman/SplashScreen.qml index 801ce99..78f4e4d 100644 --- a/examples/purchasing/qthangman/qml/qthangman/SplashScreen.qml +++ b/examples/purchasing/qthangman/qml/qthangman/SplashScreen.qml @@ -58,7 +58,7 @@ Rectangle { anchors.top: logo.bottom anchors.topMargin: 10 text: "Qt Hangman" - font.family: ".Helvetica Neue Interface -M3" + font.family: Settings.helpFontFamily color: "white" font.pointSize: 24 } diff --git a/examples/purchasing/qthangman/qml/qthangman/qmldir b/examples/purchasing/qthangman/qml/qthangman/qmldir new file mode 100644 index 0000000..063b238 --- /dev/null +++ b/examples/purchasing/qthangman/qml/qthangman/qmldir @@ -0,0 +1,17 @@ +GameView 1.0 GameView.qml +GuessWordView 1.0 GuessWordView.qml +Hangman 1.0 Hangman.qml +HowToView 1.0 HowToView.qml +Key 1.0 Key.qml +Letter 1.0 Letter.qml +LetterSelector 1.0 LetterSelector.qml +main 1.0 main.qml +MainView 1.0 MainView.qml +PageHeader 1.0 PageHeader.qml +ScoreItem 1.0 ScoreItem.qml +singleton Settings 1.0 Settings.qml +SimpleButton 1.0 SimpleButton.qml +SplashScreen 1.0 SplashScreen.qml +StoreItem 1.0 StoreItem.qml +StoreView 1.0 StoreView.qml +Word 1.0 Word.qml diff --git a/examples/purchasing/qthangman/resources.qrc b/examples/purchasing/qthangman/resources.qrc index b0002fb..d011039 100644 --- a/examples/purchasing/qthangman/resources.qrc +++ b/examples/purchasing/qthangman/resources.qrc @@ -1,6 +1,7 @@ enable2.txt + qml/qthangman/qmldir qml/qthangman/GameView.qml qml/qthangman/GuessWordView.qml qml/qthangman/Hangman.qml @@ -11,11 +12,13 @@ qml/qthangman/MainView.qml qml/qthangman/PageHeader.qml qml/qthangman/ScoreItem.qml + qml/qthangman/Settings.qml qml/qthangman/SimpleButton.qml qml/qthangman/SplashScreen.qml qml/qthangman/StoreItem.qml qml/qthangman/StoreView.qml qml/qthangman/Word.qml qml/qthangman/HowToView.qml + qml/qthangman/+windows/Settings.qml -- cgit v1.2.3