- added two banners with some text

- added commandline argument for dark mode
This commit is contained in:
Dorian Zedler 2020-06-14 18:16:31 +02:00
parent 76133ca283
commit daf65b4cb1
Signed by: dorian
GPG key ID: 989DE36109AFA354
6 changed files with 108 additions and 6 deletions

View file

@ -58,7 +58,7 @@ Window {
id: appTheme
Component.onCompleted: {
appTheme.setTheme("Light")
appTheme.setTheme(darkMode ? "Dark":"Light")
}
}
@ -95,10 +95,43 @@ Window {
Component {
id: displayComp
Column {
Rectangle {
id: topBanner
width: parent.width
height: !showControls && showBanners ? backend.race.state === ScStwRace.IDLE ? parent.height * 0.1:parent.height * 0.05 : 0
color: "black"
Text {
anchors.fill: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.pixelSize: height * 0.5
visible: height > 0
color: "white"
text: qsTr("Speed Climbing Stopwatch")
}
Behavior on height {
NumberAnimation {
duration: 200
easing.type: Easing.Linear
}
}
}
Item {
id: displayItm
anchors.fill: parent
width: parent.width
height: parent.height - bottomBanner.height - topBanner.height
Image {
id: bannerImg
@ -123,12 +156,22 @@ Window {
TimerColumn {
anchors.fill: parent
timers: backend.race.timers
timers: removeDisabledTimers(backend.race.timers)
colors: appTheme.theme.colors
fontName: appTheme.theme.fonts.timers
opacity: !showControls || [ScStwRace.IDLE,ScStwRace.STARTING].indexOf(backend.race.state) < 0 ? 1:0
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
}
Behavior on opacity {
NumberAnimation {
duration: 200
@ -405,6 +448,40 @@ Window {
}
}
Rectangle {
id: bottomBanner
width: parent.width
height: !showControls && showBanners ? backend.race.state === ScStwRace.IDLE ? parent.height * 0.1:parent.height * 0.05 : 0
color: "black"
Text {
anchors.fill: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.pixelSize: height * 0.5
visible: height > 0
color: "white"
text: qsTr("www.itsblue.de/scstw")
}
Behavior on height {
NumberAnimation {
duration: 200
easing.type: Easing.Linear
}
}
}
}
}
Component {
@ -425,6 +502,13 @@ Window {
image: appTheme.theme.images.SpeedHold
}
MouseArea {
id: textFieldEnableMa
hoverEnabled: true
anchors.fill: parent
anchors.leftMargin: parent.width * 0.9
}
TextField {
id: ipAddrInputTf
@ -433,6 +517,8 @@ Window {
horizontalCenter: parent.horizontalCenter
}
visible: !textFieldEnableMa.containsMouse
opacity: backend.scStwClient.state === ScStwClient.CONNECTED ? 0:1
text: appSettings.baseStationIp

View file

@ -51,11 +51,27 @@ int main(int argc, char *argv[])
engine.rootContext()->setContextProperty("XscreenHeight", size.height());
engine.rootContext()->setContextProperty("XscreenWidth", size.width());
if(argc > 1 && QString(argv[1]) == "--noControls")
QStringList args;
for(int i = 0; i <= argc; i++) {
args.append(argv[i]);
}
if(args.contains("--noControls"))
engine.rootContext()->setContextProperty("showControls", false);
else
engine.rootContext()->setContextProperty("showControls", true);
if(args.contains("--noBanners"))
engine.rootContext()->setContextProperty("showBanners", false);
else
engine.rootContext()->setContextProperty("showBanners", true);
if(args.contains("--darkMode"))
engine.rootContext()->setContextProperty("darkMode", true);
else
engine.rootContext()->setContextProperty("darkMode", false);
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
if (engine.rootObjects().isEmpty())
return -1;

Binary file not shown.

View file

@ -6,7 +6,7 @@ After=network.target
[Service]
#ExecStartPre=/usr/sbin/sshd -t
ExecStart=xinit /usr/bin/ScStwMonitor --noControls --
ExecStart=xinit /usr/bin/ScStwMonitor --noControls --darkMode --
WorkingDirectory=/
User=root
StandardOutput=inherit

@ -1 +1 @@
Subproject commit ac0d1a46168ee8563caed54e54548893c6c9066d
Subproject commit eb1328642db8fb194659e1ff4b53d45c1dcbc56d