Change QGuiApplication to QApplication to allow proper palette usage on desktop. Add VIN to data storage options.
Change add vehicle layout to use form layout insteaf of manual layout.
This commit is contained in:
@@ -28,7 +28,7 @@ include(KDECompilerSettings NO_POLICY_SCOPE)
|
||||
|
||||
################# Find dependencies #################
|
||||
|
||||
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Core Quick Test Gui Sql QuickControls2)
|
||||
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Core Quick Test Gui Sql QuickControls2 Widgets)
|
||||
find_package(KF5Kirigami2 ${KF5_MIN_VERSION} REQUIRED)
|
||||
find_package(KF5CoreAddons ${KF5_MIN_VERSION} REQUIRED)
|
||||
|
||||
|
||||
@@ -6,5 +6,5 @@ set(vehiclevoyage_SRCS
|
||||
|
||||
qt5_add_resources(RESOURCES resources.qrc)
|
||||
add_executable(vehiclevoyage ${vehiclevoyage_SRCS} ${RESOURCES})
|
||||
target_link_libraries(vehiclevoyage Qt5::Core Qt5::Qml Qt5::Quick Qt5::Sql KF5::CoreAddons)
|
||||
target_link_libraries(vehiclevoyage Qt5::Core Qt5::Qml Qt5::Quick Qt5::Sql Qt5::Widgets KF5::CoreAddons)
|
||||
install(TARGETS vehiclevoyage ${KF5_INSTALL_TARGETS_DEFAULT_ARGS})
|
||||
|
||||
@@ -76,47 +76,52 @@ Kirigami.ApplicationWindow {
|
||||
title: qsTr("Add Vehicle")
|
||||
Layouts.ColumnLayout {
|
||||
anchors.fill: parent
|
||||
Layouts.RowLayout {
|
||||
Controls.Label {
|
||||
text: qsTr("Name")+":"
|
||||
Kirigami.FormLayout {
|
||||
Layouts.Layout.alignment: Qt.AlignHCenter
|
||||
Layouts.Layout.fillWidth: true
|
||||
width: page.width
|
||||
|
||||
Item {
|
||||
Kirigami.FormData.isSection: true
|
||||
Kirigami.FormData.label: "Vehicle Information"
|
||||
}
|
||||
|
||||
Controls.TextField {
|
||||
//
|
||||
}
|
||||
}
|
||||
Layouts.RowLayout {
|
||||
Controls.Label {
|
||||
text: qsTr("Make")+":"
|
||||
selectByMouse: true
|
||||
Kirigami.FormData.label: qsTr("Name")+":"
|
||||
}
|
||||
|
||||
Controls.TextField {
|
||||
//
|
||||
}
|
||||
}
|
||||
Layouts.RowLayout {
|
||||
Controls.Label {
|
||||
text: qsTr("Model")+":"
|
||||
selectByMouse: true
|
||||
Kirigami.FormData.label: qsTr("Make")+":"
|
||||
}
|
||||
|
||||
Controls.TextField {
|
||||
//
|
||||
}
|
||||
}
|
||||
Layouts.RowLayout {
|
||||
Controls.Label {
|
||||
text: qsTr("Year")+":"
|
||||
selectByMouse: true
|
||||
Kirigami.FormData.label: qsTr("Model")+":"
|
||||
}
|
||||
|
||||
Controls.TextField {
|
||||
selectByMouse: true
|
||||
Kirigami.FormData.label: qsTr("Year")+":"
|
||||
inputMethodHints: Qt.ImhDigitsOnly
|
||||
validator: IntValidator {
|
||||
bottom: 1900
|
||||
top: 4000
|
||||
}
|
||||
}
|
||||
}
|
||||
Controls.Button {
|
||||
text: qsTr("Add")
|
||||
highlighted: true
|
||||
onClicked: {
|
||||
router.popRoute();
|
||||
|
||||
Controls.TextField {
|
||||
selectByMouse: true
|
||||
Kirigami.FormData.label: qsTr("VIN")+":"
|
||||
}
|
||||
|
||||
Controls.Button {
|
||||
text: qsTr("Add")
|
||||
highlighted: true
|
||||
onClicked: {
|
||||
router.popRoute();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -124,225 +129,4 @@ Kirigami.ApplicationWindow {
|
||||
}
|
||||
}
|
||||
}
|
||||
/*Kirigami.Page {
|
||||
id: mainPage
|
||||
mainAction: Kirigami.Action {
|
||||
iconName: "view-refresh"
|
||||
text: qsTr("Query Device")
|
||||
onTriggered: {
|
||||
deviceSelect.open();
|
||||
}
|
||||
}
|
||||
contextualActions: [
|
||||
Kirigami.Action {
|
||||
iconName: "help-about"
|
||||
text: qsTr("About")
|
||||
onTriggered: {
|
||||
pageStack.replace(aboutPageComponent);
|
||||
}
|
||||
}
|
||||
]
|
||||
title: "Monitor"
|
||||
leftPadding: 0
|
||||
rightPadding: 0
|
||||
|
||||
Layouts.ColumnLayout {
|
||||
anchors.fill: parent
|
||||
Kirigami.InlineMessage {
|
||||
Layouts.Layout.fillWidth: true
|
||||
Layouts.Layout.leftMargin: 10
|
||||
Layouts.Layout.rightMargin: 10
|
||||
z: 9997
|
||||
type: Kirigami.MessageType.Error
|
||||
id: errorMessage
|
||||
showCloseButton: true
|
||||
Connections {
|
||||
target: qiflora
|
||||
onErrorHappened: {
|
||||
errorMessage.text = description;
|
||||
errorMessage.visible = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Kirigami.CardsListView {
|
||||
Layouts.Layout.fillWidth: true
|
||||
Layouts.Layout.fillHeight: true
|
||||
id: monitorView
|
||||
model: ListModel {
|
||||
id: monitorTypes
|
||||
ListElement{
|
||||
chartType: "temperature"
|
||||
title: "Temperature"
|
||||
icon: "filename-bpm-amarok"
|
||||
lineColor: "red"
|
||||
units: "°C"
|
||||
yMin: -20
|
||||
yMax: 40
|
||||
modelCol: 1
|
||||
}
|
||||
ListElement{
|
||||
chartType: "moisture"
|
||||
title: "Moisture"
|
||||
icon: "colors-chromablue"
|
||||
lineColor: "cyan"
|
||||
units: "%"
|
||||
yMin: 0
|
||||
yMax: 75
|
||||
modelCol: 3
|
||||
}
|
||||
ListElement{
|
||||
chartType: "conductivity"
|
||||
title: "Conductivity"
|
||||
icon: "quickopen"
|
||||
lineColor: "gold"
|
||||
units: "µS/cm"
|
||||
yMin: 0
|
||||
yMax: 6000
|
||||
modelCol: 4
|
||||
}
|
||||
ListElement{
|
||||
chartType: "brightness"
|
||||
title: "Brightness"
|
||||
icon: "contrast"
|
||||
lineColor: "orange"
|
||||
units: "lux"
|
||||
yMin: 0
|
||||
yMax: 30000
|
||||
modelCol: 2
|
||||
}
|
||||
}
|
||||
|
||||
delegate: Kirigami.Card {
|
||||
id: card
|
||||
banner {
|
||||
title: qsTr(model.title)
|
||||
titleIcon: model.icon
|
||||
titleLevel: 2
|
||||
}
|
||||
header: Row {
|
||||
layoutDirection: Qt.RightToLeft
|
||||
topPadding: 10.0
|
||||
rightPadding: 10.0
|
||||
Layouts.ColumnLayout {
|
||||
Kirigami.Heading {
|
||||
Layouts.Layout.alignment: Qt.AlignCenter
|
||||
level: 4
|
||||
text: qsTr("Last Measured")
|
||||
}
|
||||
Kirigami.Heading {
|
||||
Layouts.Layout.alignment: Qt.AlignCenter
|
||||
level: 3
|
||||
text: {
|
||||
if(model.chartType == "temperature") Math.round(qiflora.temperature*10)/10 + "°C\n" + (Math.round((qiflora.temperature*1.8+32)*10)/10) + "°F"
|
||||
else if(model.chartType == "moisture") qiflora.moisture + "%"
|
||||
else if(model.chartType == "conductivity") qiflora.conduction + " µS/cm"
|
||||
else if(model.chartType == "brightness") qiflora.brightness + " lux"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
contentItem: Item {
|
||||
implicitWidth: 300
|
||||
implicitHeight: 200
|
||||
Charts.ChartView {
|
||||
id: chart
|
||||
antialiasing: true
|
||||
backgroundColor: Kirigami.Theme.buttonBackgroundColor
|
||||
titleColor: Kirigami.Theme.textColor
|
||||
legend.visible: false
|
||||
anchors.fill: parent
|
||||
|
||||
Charts.LineSeries {
|
||||
id: series
|
||||
axisX: Charts.DateTimeAxis {
|
||||
id: dateAx
|
||||
labelsColor: Kirigami.Theme.textColor
|
||||
format: "MMM d yyyy ha"
|
||||
|
||||
Component.onCompleted: {
|
||||
//On load, change date span to last 24 to remove awkward 1969 empty dates.
|
||||
var yesterday = new Date();
|
||||
yesterday.setDate(yesterday.getDate() -1);
|
||||
dateAx.min = yesterday;
|
||||
dateAx.max = new Date();
|
||||
}
|
||||
}
|
||||
axisY: Charts.ValueAxis {
|
||||
id: valueAx
|
||||
labelFormat: "%d "+units
|
||||
labelsColor: Kirigami.Theme.textColor
|
||||
min: yMin
|
||||
max: yMax
|
||||
}
|
||||
color: model.lineColor
|
||||
name: model.title
|
||||
|
||||
Charts.VXYModelMapper {
|
||||
model: qiflora.model
|
||||
xColumn: 0
|
||||
yColumn: modelCol
|
||||
|
||||
}
|
||||
}
|
||||
Connections {
|
||||
target: qiflora.model
|
||||
onRowsInserted: {
|
||||
//Readjust graphs to show date range from earliest item.
|
||||
dateAx.max = new Date();
|
||||
dateAx.min = qiflora.model.data(qiflora.model.index(0,0));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Controls.ScrollBar.vertical: Controls.ScrollBar {}
|
||||
}
|
||||
}
|
||||
|
||||
Kirigami.OverlaySheet {
|
||||
id: deviceSelect
|
||||
showCloseButton: false
|
||||
contentItem: ListView {
|
||||
header: Column {
|
||||
Rectangle {
|
||||
height: 10
|
||||
color: "transparent"
|
||||
}
|
||||
Kirigami.Heading {
|
||||
text: qsTr("Select Device to Query")
|
||||
}
|
||||
Rectangle {
|
||||
height: 10
|
||||
color: "transparent"
|
||||
}
|
||||
}
|
||||
id: deviceList
|
||||
model: qiflora.devices
|
||||
delegate: Kirigami.AbstractListItem {
|
||||
Layouts.ColumnLayout {
|
||||
Kirigami.Heading {
|
||||
text:model.modelData.name
|
||||
level: 2
|
||||
}
|
||||
Kirigami.Heading {
|
||||
text:model.modelData.address
|
||||
level: 5
|
||||
}
|
||||
}
|
||||
onClicked: {
|
||||
qiflora.updateDataFromDevice(model.modelData.address);
|
||||
deviceSelect.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
onSheetOpenChanged: {
|
||||
if(!sheetOpen) {
|
||||
qiflora.stopSearch();
|
||||
} else {
|
||||
qiflora.startSearch();
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*/
|
||||
|
||||
#include <QGuiApplication>
|
||||
#include <QtWidgets/QApplication>
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <KAboutData>
|
||||
#include <QIcon>
|
||||
@@ -33,7 +34,7 @@
|
||||
Q_DECL_EXPORT int main(int argc, char *argv[])
|
||||
{
|
||||
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
QGuiApplication app(argc, argv);
|
||||
QApplication app(argc, argv);
|
||||
|
||||
KAboutData aboutData("org.eyecreate.vehiclevoyage", "Vehicle Voyage", "1.0", "Track vehicle service history.",KAboutLicense::GPL_V3);//TODO:i18n
|
||||
aboutData.setProductName("vehiclevoyage");
|
||||
@@ -57,7 +58,7 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
|
||||
QFile(db.databaseName()).open(QIODevice::ReadWrite);
|
||||
//Create table structure
|
||||
db.open();
|
||||
db.exec("CREATE TABLE vehicles (id INTEGER PRIMARY KEY, name TEXT, maker TEXT, model TEXT, year INTEGER, image TEXT);");
|
||||
db.exec("CREATE TABLE vehicles (id INTEGER PRIMARY KEY, name TEXT, maker TEXT, model TEXT, year INTEGER, image TEXT, vin TEXT);");
|
||||
db.exec("CREATE TABLE records (id INTEGER PRIMARY KEY, servicetype TEXT, date INTEGER, miles INTEGER, notes TEXT);");
|
||||
db.commit();
|
||||
db.close();
|
||||
|
||||
Reference in New Issue
Block a user