mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-10-06 09:17:07 +02:00
Cleanup test projects
This commit is contained in:
parent
fa1c1afd71
commit
3bab9fbb72
@ -2,6 +2,7 @@ import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Material
|
||||
import QtQuick.Controls.Material.impl
|
||||
import ScreenPlaySysInfo
|
||||
|
||||
Window {
|
||||
@ -10,11 +11,10 @@ Window {
|
||||
height: 768
|
||||
visible: true
|
||||
title: qsTr("ScreenPlaySysInfo")
|
||||
color: "#19181E"
|
||||
|
||||
property color accentColor: "#FF9800"
|
||||
property color accentColor: Material.secondaryTextColor
|
||||
property string fontFamily: "Arial"
|
||||
property int fontPointSize: 16
|
||||
property int fontPointSize: 14
|
||||
|
||||
SysInfo {
|
||||
id: sysInfo
|
||||
@ -32,27 +32,44 @@ Window {
|
||||
return out
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
spacing: 40
|
||||
anchors.fill: parent
|
||||
anchors.margins: 20
|
||||
Rectangle {
|
||||
anchors.fill: wrapper
|
||||
anchors.margins: -50
|
||||
color: Material.backgroundColor
|
||||
radius: 4
|
||||
|
||||
layer.enabled: true
|
||||
layer.effect: ElevationEffect {
|
||||
elevation: 4
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id:wrapper
|
||||
spacing: 40
|
||||
anchors.centerIn: parent
|
||||
ColumnLayout {
|
||||
id: wrapperLeft
|
||||
Text {
|
||||
text: "IpAddress"
|
||||
color: root.accentColor
|
||||
font.family: root.fontFamily
|
||||
font.pointSize: 60
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
Layout.preferredWidth: 500
|
||||
|
||||
|
||||
ColumnLayout {
|
||||
spacing: 10
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Text {
|
||||
text: "Private Addresses"
|
||||
color: root.accentColor
|
||||
font {
|
||||
pointSize: 24
|
||||
family: root.fontFamily
|
||||
}
|
||||
}
|
||||
Text {
|
||||
text: root.stringListToString(
|
||||
ipAddress.privateIpV4AddressList)
|
||||
color: root.accentColor
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
font {
|
||||
pointSize: 16
|
||||
family: "Fira Code"
|
||||
@ -62,22 +79,35 @@ Window {
|
||||
text: root.stringListToString(
|
||||
ipAddress.privateIpV6AddressList)
|
||||
color: root.accentColor
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
font {
|
||||
pointSize: 16
|
||||
family: "Fira Code"
|
||||
}
|
||||
}
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
color: root.accentColor
|
||||
Layout.preferredHeight: 5
|
||||
Layout.preferredHeight: 3
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
Text {
|
||||
text: "Public Addresses"
|
||||
color: root.accentColor
|
||||
font {
|
||||
pointSize: 24
|
||||
family: root.fontFamily
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
text: ipAddress.publicIpV4Address
|
||||
color: root.accentColor
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
font {
|
||||
pointSize: 16
|
||||
family: root.fontFamily
|
||||
@ -86,7 +116,6 @@ Window {
|
||||
Text {
|
||||
text: ipAddress.publicIpV6Address
|
||||
color: root.accentColor
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
font {
|
||||
pointSize: 16
|
||||
family: root.fontFamily
|
||||
@ -96,18 +125,19 @@ Window {
|
||||
}
|
||||
Rectangle {
|
||||
color: root.accentColor
|
||||
Layout.fillHeight: true
|
||||
width: 10
|
||||
Layout.preferredHeight: 600
|
||||
width: 3
|
||||
}
|
||||
ColumnLayout {
|
||||
id: wrapperRight
|
||||
|
||||
spacing: 20
|
||||
Layout.preferredWidth: 500
|
||||
Text {
|
||||
id: txtGPU
|
||||
text: "GPU"
|
||||
color: root.accentColor
|
||||
font.family: root.fontFamily
|
||||
font.pointSize: 60
|
||||
font.pointSize: 36
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
|
||||
@ -137,20 +167,13 @@ Window {
|
||||
text: "UPTIME"
|
||||
color: root.accentColor
|
||||
font.family: root.fontFamily
|
||||
font.pointSize: 60
|
||||
font.pointSize: 36
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: valuesLayout
|
||||
spacing: 20
|
||||
Text {
|
||||
id: txtYears
|
||||
text: "YEARS " + sysInfo.uptime.years
|
||||
color: root.accentColor
|
||||
font.family: root.fontFamily
|
||||
font.pointSize: root.fontPointSize
|
||||
}
|
||||
Text {
|
||||
text: "DAYS " + sysInfo.uptime.days
|
||||
color: root.accentColor
|
||||
@ -183,13 +206,12 @@ Window {
|
||||
text: "CPU"
|
||||
color: root.accentColor
|
||||
font.family: root.fontFamily
|
||||
font.pointSize: 60
|
||||
font.pointSize: 36
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
Row {
|
||||
id: row
|
||||
RowLayout {
|
||||
spacing: 10
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredWidth: 300
|
||||
Text {
|
||||
id: txtCPUValue
|
||||
text: Math.floor(sysInfo.cpu.usage)
|
||||
@ -210,14 +232,10 @@ Window {
|
||||
text: "STORAGE"
|
||||
color: root.accentColor
|
||||
font.family: root.fontFamily
|
||||
font.pointSize: 60
|
||||
font.pointSize: 36
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: 20
|
||||
}
|
||||
|
||||
ListView {
|
||||
id: storageListView
|
||||
@ -225,10 +243,12 @@ Window {
|
||||
Layout.preferredHeight: 100
|
||||
model: sysInfo.storage
|
||||
delegate: Item {
|
||||
width: storageListView.width
|
||||
width: 500
|
||||
height: 40
|
||||
Row {
|
||||
RowLayout {
|
||||
spacing: 10
|
||||
width: 500
|
||||
|
||||
Text {
|
||||
id: txtStorageName
|
||||
text: name
|
||||
@ -240,7 +260,7 @@ Window {
|
||||
from: 0
|
||||
to: bytesTotal
|
||||
value: bytesAvailable
|
||||
width: storageListView.width - txtStorageName.width - row.spacing
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,12 +5,12 @@
|
||||
|
||||
#include "HelpersCommon.h"
|
||||
|
||||
template <class ObjType>
|
||||
class QQmlSmartListWrapper : public QQmlListProperty<ObjType> {
|
||||
template <class T>
|
||||
class QQmlSmartListWrapper : public QQmlListProperty<T> {
|
||||
public:
|
||||
typedef QVector<ObjType*> CppListType;
|
||||
typedef QQmlListProperty<ObjType> QmlListPropertyType;
|
||||
typedef QQmlSmartListWrapper<ObjType> SmartListWrapperType;
|
||||
typedef QVector<T*> CppListType;
|
||||
typedef QQmlListProperty<T> QmlListPropertyType;
|
||||
typedef QQmlSmartListWrapper<T> SmartListWrapperType;
|
||||
|
||||
typedef typename CppListType::const_iterator const_iterator;
|
||||
|
||||
@ -41,12 +41,12 @@ public:
|
||||
|
||||
static void callbackClear(QmlListPropertyType* prop) { static_cast<CppListType*>(prop->data)->clear(); }
|
||||
|
||||
static void callbackAppend(QmlListPropertyType* prop, ObjType* obj)
|
||||
static void callbackAppend(QmlListPropertyType* prop, T* obj)
|
||||
{
|
||||
static_cast<CppListType*>(prop->data)->append(obj);
|
||||
}
|
||||
|
||||
static ObjType* callbackAt(QmlListPropertyType* prop, qsizetype idx)
|
||||
static T* callbackAt(QmlListPropertyType* prop, qsizetype idx)
|
||||
{
|
||||
return static_cast<CppListType*>(prop->data)->at(idx);
|
||||
}
|
||||
|
@ -2,6 +2,8 @@ import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Material
|
||||
import QtQuick.Controls.Material.impl
|
||||
import Qt5Compat.GraphicalEffects
|
||||
import ScreenPlayWeather
|
||||
|
||||
Window {
|
||||
@ -16,8 +18,12 @@ Window {
|
||||
city: "Friedrichshafen"
|
||||
onReady: {
|
||||
rp.model = weather.days
|
||||
// Qt bug https://bugreports.qt.io/browse/QTBUG-105137
|
||||
test()
|
||||
}
|
||||
}
|
||||
function test() {}
|
||||
|
||||
function mapWeatherCode(code) {
|
||||
const weather_time = "" // or "-day", "-night"
|
||||
const weather_prefix = "wi" + weather_time + "-"
|
||||
@ -62,10 +68,29 @@ Window {
|
||||
return weather_prefix + "storm-showers"
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
anchors.fill: wrapper
|
||||
color: Material.backgroundColor
|
||||
Material.elevation: 5
|
||||
radius: 4
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: wrapper
|
||||
color: Material.backgroundColor
|
||||
radius: 4
|
||||
|
||||
layer.enabled: true
|
||||
layer.effect: ElevationEffect {
|
||||
elevation: 4
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 20
|
||||
id: wrapper
|
||||
anchors.centerIn: parent
|
||||
width: implicitWidth + 100
|
||||
height: implicitHeight + 100
|
||||
TextField {
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
@ -80,76 +105,87 @@ Window {
|
||||
+ "m - population: " + weather.population
|
||||
}
|
||||
|
||||
component TextItem: Column {
|
||||
property alias value: value.text
|
||||
property alias text: description.text
|
||||
Layout.preferredWidth: 120
|
||||
Text {
|
||||
id: value
|
||||
width: 120
|
||||
font.pointSize: 16
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
color: Material.primaryTextColor
|
||||
}
|
||||
Text {
|
||||
id: description
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
color: Material.secondaryTextColor
|
||||
width: 120
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
Repeater {
|
||||
id: rp
|
||||
onModelChanged: print("MODEL CHANGED")
|
||||
onCountChanged: print(count)
|
||||
ColumnLayout {
|
||||
id: cl
|
||||
spacing: 20
|
||||
Text {
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: day + "\nday"
|
||||
Layout.preferredWidth: 120
|
||||
TextItem {
|
||||
text: "Day"
|
||||
value: day
|
||||
}
|
||||
Text {
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: dateTime + "\ndateTime"
|
||||
TextItem {
|
||||
text: "Sunrise"
|
||||
value: sunrise
|
||||
}
|
||||
Text {
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: sunrise + "\nsunrise"
|
||||
}
|
||||
Text {
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: sunset + "\nsunset"
|
||||
TextItem {
|
||||
text: "Sunset"
|
||||
value: sunset
|
||||
}
|
||||
|
||||
Image {
|
||||
height: 64
|
||||
width: height
|
||||
sourceSize: Qt.size(height, height)
|
||||
layer {
|
||||
enabled: true
|
||||
effect: ColorOverlay {
|
||||
color: Material.primaryColor
|
||||
}
|
||||
}
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
horizontalAlignment: Image.AlignHCenter
|
||||
source: "qrc:/qml/ScreenPlayWeather/assets/icons/" + root.mapWeatherCode(
|
||||
weatherCode) + ".svg"
|
||||
}
|
||||
TextItem {
|
||||
text: "Weather Code"
|
||||
value: weatherCode
|
||||
}
|
||||
TextItem {
|
||||
text: "Temperature min"
|
||||
value: temperature_2m_min
|
||||
}
|
||||
TextItem {
|
||||
text: "Temperature max"
|
||||
value: temperature_2m_max
|
||||
}
|
||||
|
||||
Text {
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: weatherCode + "\nweatherCode"
|
||||
}
|
||||
Text {
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: temperature_2m_min + "\ntemperature_2m_min"
|
||||
}
|
||||
Text {
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: temperature_2m_max + "\ntemperature_2m_max"
|
||||
}
|
||||
Text {
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: precipitationHours + "\nprecipitationHours"
|
||||
}
|
||||
Text {
|
||||
Layout.alignment: Qt.AlignCenter
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
text: precipitationSum + "\nprecipitationSum"
|
||||
}
|
||||
// TextItem {
|
||||
// text: "Precipitation Sum"
|
||||
// value: precipitationSum
|
||||
// }
|
||||
|
||||
// TextItem {
|
||||
// text: "Precipitation Hours"
|
||||
// value: precipitationHours
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
Button {
|
||||
text: "getDay"
|
||||
onClicked: {
|
||||
var day = weather.getDay(1)
|
||||
print("weatherCode:", day.weatherCode, day.precipitationSum)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,8 +10,8 @@ class Day : public QObject {
|
||||
public:
|
||||
W_PROPERTY(int, day)
|
||||
W_PROPERTY(QDateTime, dateTime)
|
||||
W_PROPERTY(QDateTime, sunrise)
|
||||
W_PROPERTY(QDateTime, sunset)
|
||||
W_PROPERTY(QString, sunrise)
|
||||
W_PROPERTY(QString, sunset)
|
||||
W_PROPERTY_DEFAULT(int, weatherCode, 0)
|
||||
W_PROPERTY_DEFAULT(float, temperature_2m_min, 0.0f)
|
||||
W_PROPERTY_DEFAULT(float, temperature_2m_max, 0.0f)
|
||||
|
@ -25,7 +25,7 @@ void ScreenPlayWeather::updateLatitudeLongtitude(const QString& city)
|
||||
request.setUrl(url);
|
||||
auto* reply = m_networkAccessManager.get(request);
|
||||
|
||||
QObject::connect(reply, &QNetworkReply::readyRead, this, [this, reply]() {
|
||||
QObject::connect(reply, &QNetworkReply::finished, this, [this, reply]() {
|
||||
const QByteArray data = reply->readAll();
|
||||
if (data.size() <= 0)
|
||||
return;
|
||||
@ -50,7 +50,7 @@ void ScreenPlayWeather::updateLatitudeLongtitude(const QString& city)
|
||||
if (result.contains("population"))
|
||||
setPopulation(result.value("population").toInt());
|
||||
});
|
||||
QObject::connect(reply, &QNetworkReply::finished, this, []() { qInfo() << "finished!"; });
|
||||
QObject::connect(reply, &QNetworkReply::finished, this, []() { qInfo() << "updateLatitudeLongtitude finished!"; });
|
||||
QObject::connect(reply, &QNetworkReply::errorOccurred, this, []() { qInfo() << "errorOccurred!"; });
|
||||
}
|
||||
|
||||
@ -80,7 +80,7 @@ void ScreenPlayWeather::update()
|
||||
qInfo() << url;
|
||||
auto* reply = m_networkAccessManager.get(request);
|
||||
|
||||
QObject::connect(reply, &QNetworkReply::readyRead, this, [this, reply]() {
|
||||
QObject::connect(reply, &QNetworkReply::finished, this, [this, reply]() {
|
||||
const QByteArray data = reply->readAll();
|
||||
if (data.size() <= 0)
|
||||
return;
|
||||
@ -108,9 +108,9 @@ void ScreenPlayWeather::update()
|
||||
for (int i = 0; i < time.size(); ++i) {
|
||||
auto day = new Day();
|
||||
day->set_day(i);
|
||||
day->set_sunrise(QDateTime::fromString(sunrise.at(i).toString(), m_dataTimeFormat));
|
||||
day->set_sunset(QDateTime::fromString(sunset.at(i).toString(), m_dataTimeFormat));
|
||||
day->set_dateTime(QDateTime::fromString(time.at(i).toString(), m_dataTimeFormat));
|
||||
day->set_sunrise(QDateTime::fromString(sunrise.at(i).toString(), m_dataTimeFormat).toString("mm:ss"));
|
||||
day->set_sunset(QDateTime::fromString(sunset.at(i).toString(), m_dataTimeFormat).toString("mm:ss"));
|
||||
day->set_weatherCode(weathercode.at(i).toInt());
|
||||
day->set_temperature_2m_min(ScreenPlayUtil::roundDecimalPlaces(temperature_2m_min.at(i).toDouble()));
|
||||
day->set_temperature_2m_max(ScreenPlayUtil::roundDecimalPlaces(temperature_2m_max.at(i).toDouble()));
|
||||
@ -121,7 +121,7 @@ void ScreenPlayWeather::update()
|
||||
const auto hourly = msgOpt->value("hourly").toObject();
|
||||
emit ready();
|
||||
});
|
||||
QObject::connect(reply, &QNetworkReply::finished, this, []() { qInfo() << "finished!"; });
|
||||
|
||||
QObject::connect(reply, &QNetworkReply::errorOccurred, this, []() { qInfo() << "errorOccurred!"; });
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user