Make vehicle card look better. Erase records on vehilce removal.

This commit is contained in:
2020-06-11 10:38:31 -04:00
parent fb41074c45
commit cbcd7e400e
5 changed files with 19 additions and 8 deletions

View File

@@ -3,4 +3,4 @@ Mobile friendly app to track vehicle service history.
# Usage # Usage
See [docs.plasma-mobile.org](https://docs.plasma-mobile.org/AppDevelopment.html) See [docs.plasma-mobile.org](https://docs.plasma-mobile.org/AppDevelopment.html)
Icon made by iconixar from www.flaticon.com Icon made by iconixar, monkik and freepik from www.flaticon.com

1
src/contents/license.svg Normal file
View File

@@ -0,0 +1 @@
<svg height="512" viewBox="0 0 512 512" width="512" xmlns="http://www.w3.org/2000/svg"><g id="Flat"><path d="m24 88h464v336h-464z" fill="#348ed8"/><g fill="#2d7dbe"><path d="m77.66 130.34-11.32 11.32-42.34-42.34v-11.32h11.32z"/><path d="m488 88v11.32l-42.34 42.34-11.32-11.32 42.34-42.34z"/><path d="m24 424h11.32l42.34-42.34-11.32-11.32-42.34 42.34z"/><path d="m488 412.68v11.32h-11.32l-50.34-50.34 11.32-11.32z"/></g><path d="m56 120h400v272h-400z" fill="#4db6e4"/><path d="m158.051 307.553c7.261-11.5-6.1-24.865-17.6-17.6-3-13.265-21.9-13.265-24.894 0-11.5-7.261-24.865 6.1-17.6 17.6-13.265 3-13.265 21.9 0 24.894-7.261 11.5 6.1 24.865 17.6 17.6 3 13.265 21.9 13.265 24.894 0 11.5 7.261 24.865-6.1 17.6-17.6 13.265-2.996 13.265-21.898 0-24.894z" fill="#ffb431"/><g fill="#2f9ccb"><path d="m232 152h16v32h-16z"/><path d="m200 152h16v32h-16z"/><path d="m168 152h16v32h-16z"/><path d="m328 152h16v32h-16z"/><path d="m296 152h16v32h-16z"/><path d="m264 152h16v32h-16z"/><path d="m152 208h208v16h-208z"/><path d="m168 240h176v16h-176z"/><path d="m224 272h112v16h-112z"/><path d="m176 272h32v16h-32z"/><path d="m208 304h96v16h-96z"/><path d="m400 368h-36a8 8 0 0 1 -7.155-11.578 55.46 55.46 0 0 0 4.06-11.029c-4.095 3-9.853 10.432-13.753 18.192a8 8 0 0 1 -15.152-3.585c-.023-6.22-1.877-14.845-4.008-16.023-3.593.023-11.781 9.541-16.84 19.608l-14.307-7.163c2.373-4.746 15.028-28.422 31.155-28.422 4.318 0 11.513 1.66 16.028 11.541 5.372-6.152 12.278-11.541 19.972-11.541a12.608 12.608 0 0 1 11.2 5.906c3.063 4.955 2.4 11.788.584 18.094h24.216z"/><path d="m416 352h16v16h-16z"/></g><path d="m56 120h400v16h-400z" fill="#4aaeda"/><path d="m56 120h16v272h-16z" fill="#4aaeda"/><path d="m80 152h16v16h-16z" fill="#5cc1ed"/><path d="m80 184h16v64h-16z" fill="#5cc1ed"/></g></svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@@ -60,21 +60,28 @@ Kirigami.ApplicationWindow {
layoutDirection: Qt.RightToLeft layoutDirection: Qt.RightToLeft
topPadding: 10.0 topPadding: 10.0
rightPadding: 10.0 rightPadding: 10.0
spacing: 5
Controls.Label { Controls.Label {
text: vin text: vin
anchors.verticalCenter: parent.verticalCenter
}
Image {
source: "qrc:/license.svg"
sourceSize.width: 32
sourceSize.height: 32
anchors.verticalCenter: parent.verticalCenter
} }
} }
contentItem: Item{ contentItem: Item{
implicitHeight: Kirigami.Units.gridUnit * 4 implicitHeight: Kirigami.Units.gridUnit * 4
Layouts.ColumnLayout { Layouts.ColumnLayout {
Controls.Label { Kirigami.Heading {
text: maker text: maker + " " + vmodel
level: 2
} }
Controls.Label { Kirigami.Heading {
text: vmodel
}
Controls.Label {
text: year text: year
level: 4
} }
} }
} }

View File

@@ -17,6 +17,7 @@
#include "sqlvehicle.h" #include "sqlvehicle.h"
#include <QSqlRecord> #include <QSqlRecord>
#include <QSqlQuery>
SqlVehicle::SqlVehicle(QObject* parent, QSqlDatabase db) : QSqlTableModel(parent, db) SqlVehicle::SqlVehicle(QObject* parent, QSqlDatabase db) : QSqlTableModel(parent, db)
{ {
@@ -74,7 +75,7 @@ void SqlVehicle::addNewVehicle ( const QString name, const QString maker, const
void SqlVehicle::removeVehicle(int index) void SqlVehicle::removeVehicle(int index)
{ {
//TODO: remove any service records related this->database().exec("DELETE FROM records WHERE records.vehicle="+this->record(index).value("id").toString());
this->removeRow(index); this->removeRow(index);
if(this->submitAll()) { if(this->submitAll()) {
printf("removed vehicle record"); printf("removed vehicle record");

View File

@@ -1,5 +1,7 @@
<RCC> <RCC>
<qresource prefix="/"> <qresource prefix="/">
<file alias="main.qml">contents/ui/main.qml</file> <file alias="main.qml">contents/ui/main.qml</file>
<file alias="speed.svg">contents/speed.svg</file>
<file alias="license.svg">contents/license.svg</file>
</qresource> </qresource>
</RCC> </RCC>