Add themed chart layout to gui. Needs backend code.
This commit is contained in:
@@ -28,7 +28,7 @@ include(KDECompilerSettings NO_POLICY_SCOPE)
|
|||||||
|
|
||||||
################# Find dependencies #################
|
################# Find dependencies #################
|
||||||
|
|
||||||
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Core Quick Test Gui Svg QuickControls2 Bluetooth)
|
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Core Quick Test Gui Svg QuickControls2 Bluetooth Charts)
|
||||||
find_package(KF5Kirigami2 ${KF5_MIN_VERSION})
|
find_package(KF5Kirigami2 ${KF5_MIN_VERSION})
|
||||||
|
|
||||||
################# Enable C++11 features for clang and gcc #################
|
################# Enable C++11 features for clang and gcc #################
|
||||||
|
|||||||
@@ -7,5 +7,5 @@ set(qiflora_SRCS
|
|||||||
|
|
||||||
qt5_add_resources(RESOURCES resources.qrc)
|
qt5_add_resources(RESOURCES resources.qrc)
|
||||||
add_executable(qiflora ${qiflora_SRCS} ${RESOURCES})
|
add_executable(qiflora ${qiflora_SRCS} ${RESOURCES})
|
||||||
target_link_libraries(qiflora Qt5::Core Qt5::Qml Qt5::Quick Qt5::Svg Qt5::Bluetooth)
|
target_link_libraries(qiflora Qt5::Core Qt5::Qml Qt5::Quick Qt5::Svg Qt5::Bluetooth Qt5::Charts)
|
||||||
install(TARGETS qiflora ${KF5_INSTALL_TARGETS_DEFAULT_ARGS})
|
install(TARGETS qiflora ${KF5_INSTALL_TARGETS_DEFAULT_ARGS})
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import QtQuick 2.6
|
|||||||
import org.kde.kirigami 2.4 as Kirigami
|
import org.kde.kirigami 2.4 as Kirigami
|
||||||
import QtQuick.Controls 2.0 as Controls
|
import QtQuick.Controls 2.0 as Controls
|
||||||
import QtQuick.Layouts 1.12 as Layouts
|
import QtQuick.Layouts 1.12 as Layouts
|
||||||
|
import QtCharts 2.3 as Charts
|
||||||
import org.eyecreate.qiflora 1.0
|
import org.eyecreate.qiflora 1.0
|
||||||
|
|
||||||
Kirigami.ApplicationWindow {
|
Kirigami.ApplicationWindow {
|
||||||
@@ -30,10 +31,10 @@ Kirigami.ApplicationWindow {
|
|||||||
title: "Monitor"
|
title: "Monitor"
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
monitorTypes.append({"chartType": "temperature", "title": i18n("Temperature"), "icon": "filename-bpm-amarok"});
|
monitorTypes.append({"chartType": "temperature", "title": i18n("Temperature"), "icon": "filename-bpm-amarok", "lineColor": "red"});
|
||||||
monitorTypes.append({"chartType": "moisture", "title": i18n("Moisture"), "icon": "colors-chromablue"});
|
monitorTypes.append({"chartType": "moisture", "title": i18n("Moisture"), "icon": "colors-chromablue", "lineColor": "cyan"});
|
||||||
monitorTypes.append({"chartType": "conductivity", "title": i18n("Conductivity"), "icon": "quickopen"});
|
monitorTypes.append({"chartType": "conductivity", "title": i18n("Conductivity"), "icon": "quickopen", "lineColor": "green"});
|
||||||
monitorTypes.append({"chartType": "brightness", "title": i18n("Brightness"), "icon": "contrast"});
|
monitorTypes.append({"chartType": "brightness", "title": i18n("Brightness"), "icon": "contrast", "lineColor": "yellow"});
|
||||||
}
|
}
|
||||||
|
|
||||||
Kirigami.CardsListView {
|
Kirigami.CardsListView {
|
||||||
@@ -71,9 +72,29 @@ Kirigami.ApplicationWindow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
contentItem: Controls.Label {
|
contentItem: Item {
|
||||||
wrapMode: Text.WordWrap
|
implicitWidth: 300
|
||||||
text: i18n("") //TODO: replace with graph?
|
implicitHeight: 200
|
||||||
|
Charts.ChartView {
|
||||||
|
antialiasing: true
|
||||||
|
backgroundColor: Kirigami.Theme.backgroundColor
|
||||||
|
titleColor: Kirigami.Theme.textColor
|
||||||
|
legend.visible: false
|
||||||
|
anchors.fill: parent
|
||||||
|
Charts.LineSeries {
|
||||||
|
axisX: Charts.ValueAxis {
|
||||||
|
labelsColor: Kirigami.Theme.textColor
|
||||||
|
titleText: i18n("Hours")
|
||||||
|
}
|
||||||
|
axisY: Charts.ValueAxis {
|
||||||
|
labelsColor: Kirigami.Theme.textColor
|
||||||
|
}
|
||||||
|
color: model.lineColor
|
||||||
|
name: model.title
|
||||||
|
Charts.XYPoint{x: 1; y: 1}
|
||||||
|
Charts.XYPoint{x: 2; y: 2}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user