added some new components and a font
This commit is contained in:
parent
c75bbc2c65
commit
305656ab1e
12 changed files with 289 additions and 72 deletions
|
@ -6,8 +6,11 @@ ScStwLibraries::ScStwLibraries(QObject *parent) : QObject(parent)
|
|||
}
|
||||
|
||||
void ScStwLibraries::init() {
|
||||
qmlRegisterType<ScStw>("de.itsblue.ScStw", 2, 0, "ScStw");
|
||||
qRegisterMetaType<ScStw::BaseStationSetting>("ScStw::BaseStationSetting");
|
||||
qRegisterMetaType<ScStw::SocketCommand>("ScStw::SocketCommand");
|
||||
|
||||
qmlRegisterType<ScStwRace>("de.itsblue.ScStw", 2, 0, "ScStwRace");
|
||||
qmlRegisterType<ScStwTimer>("de.itsblue.ScStw", 2, 0, "ScStwTimer");
|
||||
qmlRegisterType<ScStw>("de.itsblue.ScStw", 2, 0, "ScStw");
|
||||
qmlRegisterType<ScStwClient>("de.itsblue.ScStw", 2, 0, "ScStwClient");
|
||||
}
|
||||
|
|
|
@ -3,5 +3,8 @@
|
|||
<file>lib/ScStwQmlComponents/qmldir</file>
|
||||
<file>lib/ScStwQmlComponents/Test.qml</file>
|
||||
<file>lib/ScStwQmlComponents/BusyIndicator.qml</file>
|
||||
<file>lib/ScStwQmlComponents/Icon.qml</file>
|
||||
<file>lib/ScStwQmlComponents/TimerColumn.qml</file>
|
||||
<file>lib/ScStwQmlComponents/FadeAnimation.qml</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
|
@ -1,65 +1,26 @@
|
|||
import QtQuick 2.3
|
||||
import QtQuick.Controls 2.4
|
||||
import QtQuick.Controls.Styles 1.2
|
||||
import QtQuick 2.0
|
||||
import QtQuick.Templates 2.0 as T
|
||||
import QtQuick.Controls 2.0
|
||||
|
||||
BusyIndicator {
|
||||
T.BusyIndicator {
|
||||
id: control
|
||||
|
||||
property double animationSpeed: 1000
|
||||
property double formFactor: 4.5
|
||||
|
||||
property color lineColor: "#21be2b"
|
||||
|
||||
contentItem: Item {
|
||||
implicitWidth: 64
|
||||
implicitHeight: 64
|
||||
|
||||
Item {
|
||||
id: item
|
||||
|
||||
Image {
|
||||
id: holdImage
|
||||
anchors.fill: parent
|
||||
source: "qrc:/images/SpeedHold.png"
|
||||
fillMode: Image.PreserveAspectFit
|
||||
}
|
||||
|
||||
property int currentHeight: 0
|
||||
|
||||
SequentialAnimation {
|
||||
running: control.running
|
||||
loops: Animation.Infinite
|
||||
|
||||
NumberAnimation {
|
||||
target: item
|
||||
property: "currentHeight"
|
||||
from: 0
|
||||
to: 800
|
||||
duration: control.animationSpeed
|
||||
}
|
||||
}
|
||||
|
||||
Row {
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
spacing: item.width / 9
|
||||
|
||||
Repeater {
|
||||
id: repeater
|
||||
model: 5
|
||||
|
||||
Rectangle {
|
||||
|
||||
property double heightMultiplier: Math.abs( Math.sin( ( ((item.currentHeight/100) + (index*(control.formFactor/repeater.model)))) * (Math.PI/8) ) )
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
width: item.width / 9
|
||||
height: ( heightMultiplier ) * ( item.height - 1 ) + 1
|
||||
|
||||
radius: width * 0.5
|
||||
|
||||
color: control.lineColor
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
RotationAnimation {
|
||||
target: holdImage
|
||||
running: control.running
|
||||
duration: 1000
|
||||
loops: Animation.Infinite
|
||||
from: 0
|
||||
to: 360
|
||||
easing.type: Easing.InOutQuad
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
Speed Climbing Stopwatch - Simple Stopwatch for Climbers
|
||||
Copyright (C) 2018 Itsblue Development - Dorian Zeder
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Affero General Public License as published
|
||||
by the Free Software Foundation, version 3 of the License.
|
||||
|
||||
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 Affero General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Affero General Public License
|
||||
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
|
||||
SequentialAnimation {
|
||||
id: root
|
||||
property QtObject target
|
||||
property int fadeDuration: 150
|
||||
property int fadeDuration_in: fadeDuration
|
||||
property int fadeDuration_out: fadeDuration
|
||||
|
||||
property alias outValueScale: outAnimationScale.to
|
||||
property alias inValueScale: inAnimationScale.to
|
||||
|
||||
property alias outValueOpacity: outAnimationOpacity.to
|
||||
property alias inValueOpacity: inAnimationOpacity.to
|
||||
|
||||
property string easingType: "Quad"
|
||||
ParallelAnimation {
|
||||
NumberAnimation { // in the default case, fade scale to 0
|
||||
id: outAnimationScale
|
||||
target: root.target
|
||||
property: "scale"
|
||||
duration: root.fadeDuration_in
|
||||
to: 0.9
|
||||
easing.type: Easing["In"+root.easingType]
|
||||
}
|
||||
NumberAnimation { // in the default case, fade scale to 0
|
||||
id: outAnimationOpacity
|
||||
target: root.target
|
||||
property: "opacity"
|
||||
duration: root.fadeDuration_in
|
||||
to: 0
|
||||
easing.type: Easing["In"+root.easingType]
|
||||
}
|
||||
}
|
||||
PropertyAction { } // actually change the property targeted by the Behavior between the 2 other animations
|
||||
ParallelAnimation {
|
||||
NumberAnimation { // in the default case, fade scale back to 1
|
||||
id: inAnimationScale
|
||||
target: root.target
|
||||
property: "scale"
|
||||
duration: root.fadeDuration_out
|
||||
to: 1
|
||||
easing.type: Easing["Out"+root.easingType]
|
||||
}
|
||||
NumberAnimation { // in the default case, fade scale to 0
|
||||
id: inAnimationOpacity
|
||||
target: root.target
|
||||
property: "opacity"
|
||||
duration: root.fadeDuration_in
|
||||
to: 1
|
||||
easing.type: Easing["In"+root.easingType]
|
||||
}
|
||||
}
|
||||
|
||||
}
|
27
ScStwStyling/resources/qml/lib/ScStwQmlComponents/Icon.qml
Normal file
27
ScStwStyling/resources/qml/lib/ScStwQmlComponents/Icon.qml
Normal file
|
@ -0,0 +1,27 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.Controls 2.0
|
||||
|
||||
Item {
|
||||
id: control
|
||||
|
||||
property string fontName
|
||||
property color color
|
||||
property string icon: "\uf850"
|
||||
|
||||
Label {
|
||||
anchors.fill: parent
|
||||
|
||||
text: control.icon
|
||||
|
||||
font.styleName: control.fontName
|
||||
color: control.color
|
||||
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
|
||||
fontSizeMode: Text.Fit
|
||||
font.pixelSize: height
|
||||
minimumPixelSize: 1
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,144 @@
|
|||
import QtQuick 2.0
|
||||
import QtQuick.Controls 2.0
|
||||
import de.itsblue.ScStw 2.0
|
||||
import de.itsblue.ScStwMonitor 2.0
|
||||
|
||||
Column {
|
||||
id: control
|
||||
|
||||
property var timers
|
||||
property var colors
|
||||
property var fontName
|
||||
|
||||
opacity: backend.scStwClient.state === ScStwClient.CONNECTED ? 1:0
|
||||
|
||||
spacing: 0
|
||||
|
||||
Repeater {
|
||||
id: timerRep
|
||||
|
||||
property var clearedTimers: removeDisabledTimers(control.timers)
|
||||
|
||||
function removeDisabledTimers(timers) {
|
||||
var ret = []
|
||||
for(var i = 0; i < timers.length; i++) {
|
||||
if(timers[i]["state"] !== ScStwTimer.DISABLED)
|
||||
ret.push(timers[i])
|
||||
}
|
||||
return ret
|
||||
}
|
||||
|
||||
model: clearedTimers.length
|
||||
|
||||
delegate: Item {
|
||||
id: timerDel
|
||||
|
||||
width: parent.width
|
||||
height: control.height / timerRep.model
|
||||
|
||||
Label {
|
||||
id: laneNameLa
|
||||
|
||||
anchors {
|
||||
left: parent.left
|
||||
}
|
||||
|
||||
leftPadding: parent.width * 0.03
|
||||
|
||||
width: parent.width * 0.15
|
||||
height: parent.height * 0.5
|
||||
|
||||
fontSizeMode: Text.Fit
|
||||
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignLeft
|
||||
|
||||
text: ""//index === 0 ? "A":"B"
|
||||
|
||||
color: control.colors.text
|
||||
|
||||
font.pixelSize: height
|
||||
font.styleName: control.fontName
|
||||
}
|
||||
|
||||
Label {
|
||||
id: timerTextLa
|
||||
|
||||
anchors.centerIn: parent
|
||||
anchors.horizontalCenterOffset: laneNameLa.text !== "" ? parent.width * 0.06:0
|
||||
anchors.verticalCenterOffset: -(parent.height * 0.04 * reactTimeLa.opacity)
|
||||
|
||||
width: parent.width * 0.8
|
||||
height: parent.height * 0.8
|
||||
|
||||
elide: "ElideRight"
|
||||
color: ([ScStwTimer.WON].indexOf(timerRep.clearedTimers[index]["state"]) >= 0 ? control.colors.success :
|
||||
[ScStwTimer.FAILED,ScStwTimer.LOST].indexOf(timerRep.clearedTimers[index]["state"]) >= 0 ? control.colors.error:
|
||||
control.colors.text)
|
||||
|
||||
text: timerRep.clearedTimers[index]["text"]
|
||||
|
||||
fontSizeMode: Text.Fit
|
||||
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
|
||||
font.pixelSize: height
|
||||
font.styleName: control.fontName
|
||||
minimumPixelSize: 1
|
||||
}
|
||||
|
||||
Label {
|
||||
id: reactTimeLa
|
||||
|
||||
property int rtime: timerRep.clearedTimers[index]["reactionTime"]
|
||||
|
||||
anchors {
|
||||
centerIn: parent
|
||||
verticalCenterOffset: timerTextLa.contentHeight * 0.4 + reactTimeLa.contentHeight * 0.4 + timerTextLa.anchors.verticalCenterOffset
|
||||
horizontalCenterOffset: parent.width * 0.06
|
||||
}
|
||||
|
||||
width: parent.width * 0.6
|
||||
height: parent.height * 0.15
|
||||
|
||||
scale: enabled ? 1:0.9
|
||||
opacity: enabled ? 1:0
|
||||
|
||||
enabled: timerRep.clearedTimers[index]["state"] >= ScStwTimer.STARTING && rtime !== 0
|
||||
|
||||
fontSizeMode: Text.Fit
|
||||
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
|
||||
text: "reaction time (ms): " + Math.round(rtime)
|
||||
|
||||
color: control.colors.text
|
||||
|
||||
font.pixelSize: timerTextLa.font.pixelSize * 0.5
|
||||
font.styleName: control.fontName
|
||||
minimumPixelSize: 1
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: 200
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on scale {
|
||||
NumberAnimation {
|
||||
duration: 200
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation {
|
||||
duration: 200
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,3 +1,5 @@
|
|||
module ScStwQmlComponents
|
||||
Test 1.0 Test.qml
|
||||
BusyIndicator 1.0 BusyIndicator.qml
|
||||
Icon 1.0 Icon.qml
|
||||
TimerColumn 1.0 TimerColumn.qml
|
||||
FadeAnimation 1.0 FadeAnimation.qml
|
||||
|
|
|
@ -3,5 +3,7 @@
|
|||
<file>fonts/fa5solid.woff</file>
|
||||
<file>images/BaseStationBlack.png</file>
|
||||
<file>images/BaseStationWhite.png</file>
|
||||
<file>images/SpeedHold.png</file>
|
||||
<file>fonts/PTMono-Regular.ttf</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
|
BIN
ScStwStyling/resources/shared/fonts/PTMono-Regular.ttf
Normal file
BIN
ScStwStyling/resources/shared/fonts/PTMono-Regular.ttf
Normal file
Binary file not shown.
BIN
ScStwStyling/resources/shared/images/SpeedHold.png
Normal file
BIN
ScStwStyling/resources/shared/images/SpeedHold.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
|
@ -3,6 +3,7 @@
|
|||
ScStwAppThemeManager::ScStwAppThemeManager(QObject *parent) : QObject(parent)
|
||||
{
|
||||
QFontDatabase::addApplicationFont(":/fonts/fa5solid.woff");
|
||||
QFontDatabase::addApplicationFont(":/fonts/PTMono-Regular.ttf");
|
||||
|
||||
QVariantMap icons = {
|
||||
{"back", "\uf053"},
|
||||
|
@ -10,7 +11,14 @@ ScStwAppThemeManager::ScStwAppThemeManager(QObject *parent) : QObject(parent)
|
|||
{"toppad", "\uf10a"},
|
||||
{"startpad", "\uf3fa"},
|
||||
{"profiles", "\uf007"},
|
||||
{"confirm", "\uf00c"}
|
||||
{"confirm", "\uf00c"},
|
||||
{"volumeUp", "\uf028"},
|
||||
{"volumeDown", "\uf027"}
|
||||
};
|
||||
|
||||
QVariantMap fonts= {
|
||||
{"icons", "Font Awesome 5 Free"},
|
||||
{"timers", "PT Mono"}
|
||||
};
|
||||
|
||||
ScStwAppTheme * lightTheme = new ScStwAppTheme (
|
||||
|
@ -43,14 +51,12 @@ ScStwAppThemeManager::ScStwAppThemeManager(QObject *parent) : QObject(parent)
|
|||
|
||||
{"success", "#60de26"},
|
||||
{"error", "#ff0000"},
|
||||
{"warning", "#e0b928"},
|
||||
|
||||
{"line", "grey"},
|
||||
},
|
||||
icons
|
||||
,
|
||||
{
|
||||
{"icons", "Font Awesome 5 Free"}
|
||||
},
|
||||
icons,
|
||||
fonts,
|
||||
{
|
||||
{"backIcon", "qrc:/graphics/icons/back_black.png"},
|
||||
{"settIcon", "qrc:/graphics/icons/settings_black.png"},
|
||||
|
@ -91,17 +97,14 @@ ScStwAppThemeManager::ScStwAppThemeManager(QObject *parent) : QObject(parent)
|
|||
|
||||
{"success", "#6bd43b"},
|
||||
{"error", "#e03b2f"},
|
||||
{"warning", "#e0b928"},
|
||||
|
||||
{"line", "grey"},
|
||||
|
||||
{"iconFontName", "Font Awesome 5 Free"},
|
||||
},
|
||||
{
|
||||
icons
|
||||
},
|
||||
{
|
||||
{"icons", "Font Awesome 5 Free"}
|
||||
},
|
||||
icons,
|
||||
fonts,
|
||||
{
|
||||
{"backIcon", "qrc:/graphics/icons/back.png"},
|
||||
{"settIcon", "qrc:/graphics/icons/settings.png"},
|
||||
|
|
|
@ -6,7 +6,7 @@ ScStwStyling::ScStwStyling(QObject *parent) : QObject(parent)
|
|||
}
|
||||
|
||||
void ScStwStyling::init(QQmlApplicationEngine *engine) {
|
||||
qmlRegisterUncreatableType<ScStwAppTheme>("de.itsblue.ScStw.styling", 2, 0, "ScStwAppTheme", "The ScStwAppTheme has to be managed by a ScStwAppTheme manager and is therefore not creatable");
|
||||
qmlRegisterType<ScStwAppThemeManager>("de.itsblue.ScStw.styling", 2, 0, "ScStwAppThemeManager");
|
||||
qmlRegisterUncreatableType<ScStwAppTheme>("de.itsblue.ScStw.Styling", 2, 0, "ScStwAppTheme", "The ScStwAppTheme has to be managed by a ScStwAppTheme manager and is therefore not creatable");
|
||||
qmlRegisterType<ScStwAppThemeManager>("de.itsblue.ScStw.Styling", 2, 0, "ScStwAppThemeManager");
|
||||
engine->addImportPath(":/lib");
|
||||
}
|
||||
|
|
Reference in a new issue