9 Commits

Author SHA1 Message Date
6c77cea3c5 use version of spec, not app 2024-04-10 21:45:17 -04:00
bda6c6f98c update icon location and bluez building 2024-04-10 21:34:38 -04:00
1995b62d46 update git repo source 2024-04-10 21:17:32 -04:00
b0598a5875 update build packaging 2024-04-10 21:04:29 -04:00
8d97b886de Update app to 1.1.4 for release. 2021-12-01 16:35:43 -05:00
d043be7754 * Fix chart background based on theme
* Change chart history to one day based on some devices having less history.(thanks michael.hufer@gmx.de)
* Have charts min/max be based on actual data received instead of hard coded values.(thanks michael.hufer@gmx.de)
2021-12-01 16:32:15 -05:00
Kevin Whitaker
07079b7d1b Fix flatpak manifest. 2021-11-30 15:52:10 -05:00
ad3cf543c8 add pureos form factor config 2020-10-22 14:03:56 -04:00
f562ef5ee2 add donation link 2020-07-21 21:29:30 -04:00
10 changed files with 63 additions and 21 deletions

View File

@@ -1,6 +1,6 @@
project(qiflora) project(qiflora)
cmake_minimum_required(VERSION 2.8.12) cmake_minimum_required(VERSION 3.5.0)
set(KF5_MIN_VERSION "5.44.0") set(KF5_MIN_VERSION "5.44.0")
set(QT_MIN_VERSION "5.12.0") set(QT_MIN_VERSION "5.12.0")
@@ -40,7 +40,7 @@ set(CMAKE_CXX_STANDARD 11)
add_subdirectory(src) add_subdirectory(src)
install(PROGRAMS packaging/org.eyecreate.qiflora.desktop DESTINATION ${KDE_INSTALL_APPDIR}) install(PROGRAMS packaging/org.eyecreate.qiflora.desktop DESTINATION ${KDE_INSTALL_APPDIR})
install(FILES packaging/org.eyecreate.qiflora.svg DESTINATION ${KDE_INSTALL_ICONDIR}) install(FILES packaging/org.eyecreate.qiflora.svg DESTINATION ${KDE_INSTALL_ICONDIR}/hicolor/scalable/apps)
install(FILES packaging/org.eyecreate.qiflora.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR}) install(FILES packaging/org.eyecreate.qiflora.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR})
feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)

View File

@@ -8,6 +8,8 @@
<content_rating type="oars-1.1" /> <content_rating type="oars-1.1" />
<url type="homepage">https://git.eyecreate.org/eyecreate/qiflora</url> <url type="homepage">https://git.eyecreate.org/eyecreate/qiflora</url>
<url type="contact">https://www.eyecreate.org</url> <url type="contact">https://www.eyecreate.org</url>
<url type="donation">https://liberapay.com/eyecreate/donate</url>
<launchable type="desktop-id">org.eyecreate.qiflora.desktop</launchable>
<developer_name>eyecreate</developer_name> <developer_name>eyecreate</developer_name>
<description> <description>
<p>Mobile friendly application to monitor Mi Flora devices.</p> <p>Mobile friendly application to monitor Mi Flora devices.</p>
@@ -22,6 +24,12 @@
</screenshot> </screenshot>
</screenshots> </screenshots>
<releases> <releases>
<release version="1.1.4" date="2021-12-1" type="stable">
<description>
<p>Fixed chart axis and history based on code from Michael Hufer.</p>
<p>Fixed colors of charts based on widget theme.</p>
</description>
</release>
<release version="1.1.3" date="2020-07-14" type="stable"> <release version="1.1.3" date="2020-07-14" type="stable">
<description> <description>
<p>Fixed icon display on some platforms.</p> <p>Fixed icon display on some platforms.</p>

View File

@@ -1,10 +1,11 @@
[Desktop Entry] [Desktop Entry]
Name=QiFlora Name=QiFlora
Comment=Monitor plants with Mi Flora sensors. Comment=Monitor plants with Mi Flora sensors.
Version=1.1.2 Version=1.0
Exec=qiflora Exec=qiflora
MimeType=application/x-qiflora; MimeType=application/x-qiflora;
Icon=org.eyecreate.qiflora Icon=org.eyecreate.qiflora
Type=Application Type=Application
Terminal=false Terminal=false
Categories=Utility;Qt;KDE; Categories=Utility;Qt;KDE;
X-Purism-FormFactor=Workstation;Mobile;

View File

@@ -2,14 +2,14 @@
"id": "org.eyecreate.qiflora", "id": "org.eyecreate.qiflora",
"runtime": "org.kde.Platform", "runtime": "org.kde.Platform",
"command": "qiflora", "command": "qiflora",
"runtime-version": "5.15-23.08",
"sdk": "org.kde.Sdk",
"finish-args": [ "finish-args": [
"--share=ipc", "--share=ipc",
"--allow=bluetooth", "--allow=bluetooth",
"runtime-version": "5.13",
"sdk": "org.kde.Sdk",
"--system-talk-name=org.bluez", "--system-talk-name=org.bluez",
"--share=network", "--share=network",
"--socket=x11", "--socket=fallback-x11",
"--socket=wayland", "--socket=wayland",
"--device=dri", "--device=dri",
"--filesystem=home", "--filesystem=home",
@@ -41,6 +41,7 @@
"config-opts": [ "config-opts": [
"--disable-datafiles", "--disable-datafiles",
"--disable-systemd", "--disable-systemd",
"--disable-manpages",
"--enable-library", "--enable-library",
"--prefix=/app", "--prefix=/app",
"--sysconfdir=/app/etc", "--sysconfdir=/app/etc",
@@ -49,8 +50,8 @@
"sources": [ "sources": [
{ {
"type": "archive", "type": "archive",
"url": "https://mirrors.edge.kernel.org/pub/linux/bluetooth/bluez-5.52.tar.xz", "url": "https://mirrors.edge.kernel.org/pub/linux/bluetooth/bluez-5.69.tar.xz",
"sha256": "f7144ce2039202cfac18ccb52426efea11c98e4f6e1bb8041bcb994b8378560a" "sha256": "bc5a35ddc7c72d0d3999a0d7b2175c8b7d57ab670774f8b5b4900ff38a2627fc"
} }
] ]
}, },
@@ -65,8 +66,8 @@
{ {
"type": "git", "type": "git",
"url": "https://github.com/qt/qtconnectivity", "url": "https://github.com/qt/qtconnectivity",
"branch": "5.13.2", "branch": "v5.13.2",
"commit": "f6be1f73a810514335ab3d27e1d05825a36b06af" "commit": "ca6cc606d9fc0947ea6c27738a1ca8f12f3258ea"
} }
], ],
"build-commands": [ "build-commands": [
@@ -85,7 +86,7 @@
"builddir": true, "builddir": true,
"config-opts": [ "config-opts": [
"-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_BUILD_TYPE=Release"
] ],
"sources": [ "sources": [
{ {
"type": "git", "type": "git",

View File

@@ -145,7 +145,7 @@ Kirigami.ApplicationWindow {
Charts.ChartView { Charts.ChartView {
id: chart id: chart
antialiasing: true antialiasing: true
backgroundColor: Kirigami.Theme.buttonBackgroundColor backgroundColor: Kirigami.Theme.backgroundColor
titleColor: Kirigami.Theme.textColor titleColor: Kirigami.Theme.textColor
legend.visible: false legend.visible: false
anchors.fill: parent anchors.fill: parent
@@ -169,8 +169,10 @@ Kirigami.ApplicationWindow {
id: valueAx id: valueAx
labelFormat: "%d "+units labelFormat: "%d "+units
labelsColor: Kirigami.Theme.textColor labelsColor: Kirigami.Theme.textColor
min: yMin Component.onCompleted: {
max: yMax valueAx.min = yMin;
valueAx.max = yMax;
}
} }
color: model.lineColor color: model.lineColor
name: model.title name: model.title
@@ -188,6 +190,7 @@ Kirigami.ApplicationWindow {
//Readjust graphs to show date range from earliest item. //Readjust graphs to show date range from earliest item.
dateAx.max = new Date(); dateAx.max = new Date();
dateAx.min = qiflora.model.data(qiflora.model.index(0,0)); dateAx.min = qiflora.model.data(qiflora.model.index(0,0));
valueAx.max = qiflora.model.maxValue(modelCol)*1.25;
} }
} }
} }

View File

@@ -17,7 +17,7 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
QQuickStyle::setStyle("Material"); QQuickStyle::setStyle("Material");
#endif #endif
KAboutData aboutData("org.eyecreate.qiflora", "QiFlora", "1.1.3", "Mobile friendly application to monitor Mi Flora devices.",KAboutLicense::GPL_V3);//TODO:i18n KAboutData aboutData("org.eyecreate.qiflora", "QiFlora", "1.1.4", "Mobile friendly application to monitor Mi Flora devices.",KAboutLicense::GPL_V3);//TODO:i18n
aboutData.setProductName("qiflora"); aboutData.setProductName("qiflora");
aboutData.addAuthor("Kevin Whitaker",QString(),"eyecreate@eyecreate.org","https://www.eyecreate.org"); aboutData.addAuthor("Kevin Whitaker",QString(),"eyecreate@eyecreate.org","https://www.eyecreate.org");
aboutData.setDesktopFileName("org.eyecreate.qiflora"); aboutData.setDesktopFileName("org.eyecreate.qiflora");
@@ -30,7 +30,7 @@ Q_DECL_EXPORT int main(int argc, char *argv[])
QQmlApplicationEngine engine; QQmlApplicationEngine engine;
qmlRegisterType<BluetoothDevices>(); qmlRegisterAnonymousType<BluetoothDevices>("",1);
qmlRegisterType<MiFlora>("org.eyecreate.qiflora",1,1,"QiFlora"); qmlRegisterType<MiFlora>("org.eyecreate.qiflora",1,1,"QiFlora");
engine.rootContext()->setContextProperty(QStringLiteral("appAboutData"), QVariant::fromValue(aboutData)); engine.rootContext()->setContextProperty(QStringLiteral("appAboutData"), QVariant::fromValue(aboutData));
engine.load(QUrl(QStringLiteral("qrc:///main.qml"))); engine.load(QUrl(QStringLiteral("qrc:///main.qml")));

View File

@@ -55,6 +55,14 @@ int FloraHistory::rowCount(const QModelIndex& parent) const
void FloraHistory::addData(QDateTime time, float temperature, quint32 brightness, quint8 moisture, quint16 conductivity) void FloraHistory::addData(QDateTime time, float temperature, quint32 brightness, quint8 moisture, quint16 conductivity)
{ {
beginInsertRows(QModelIndex(),tableData.size(),tableData.size()); beginInsertRows(QModelIndex(),tableData.size(),tableData.size());
if( tableData.size() == 0 ) {
maxData = {time, temperature, brightness, moisture, conductivity};
} else {
if( maxData.temperature < temperature ) maxData.temperature = temperature;
if( maxData.brightness < brightness ) maxData.brightness = brightness;
if( maxData.moisture < moisture ) maxData.moisture = moisture;
if( maxData.conductivity < conductivity ) maxData.conductivity = conductivity;
}
tableData.append(flora_data{time, temperature, brightness, moisture, conductivity}); tableData.append(flora_data{time, temperature, brightness, moisture, conductivity});
endInsertRows(); endInsertRows();
} }
@@ -65,4 +73,21 @@ void FloraHistory::clear()
emit layoutChanged(); emit layoutChanged();
} }
QVariant FloraHistory::maxValue(int Column )
{
if( Column == 1 ) {
return QVariant( std::round( maxData.temperature*10/10 ));
} else if( Column == 2 ) {
return QVariant( maxData.brightness );
} else if( Column == 3 ) {
return QVariant( maxData.moisture );
} else if( Column == 4 ) {
return QVariant( maxData.conductivity );
} else if( Column == 5 ) {
return QVariant( std::round( (maxData.temperature*1.8+32)*10/10 ));
} else {
return QVariant();
}
}

View File

@@ -41,6 +41,8 @@ public:
void addData(QDateTime time, float temperature, quint32 brightness, quint8 moisture, quint16 conductivity); void addData(QDateTime time, float temperature, quint32 brightness, quint8 moisture, quint16 conductivity);
Q_INVOKABLE QVariant maxValue(int Column);
private: private:
struct flora_data { struct flora_data {
QDateTime time; QDateTime time;
@@ -51,6 +53,7 @@ private:
}; };
QList<flora_data> tableData; QList<flora_data> tableData;
flora_data maxData;
}; };

View File

@@ -71,7 +71,7 @@ void MiFlora::foundDevice ( const QBluetoothDeviceInfo& device )
QQmlListProperty<BluetoothDevices> MiFlora::getDeviceList() QQmlListProperty<BluetoothDevices> MiFlora::getDeviceList()
{ {
return QQmlListProperty<BluetoothDevices>(this, devices); return QQmlListProperty<BluetoothDevices>(this, &devices);
} }
void MiFlora::logControllerError ( QLowEnergyController::Error err ) void MiFlora::logControllerError ( QLowEnergyController::Error err )
@@ -175,10 +175,10 @@ void MiFlora::historyServiceCharRead(QLowEnergyCharacteristic readChar, QByteArr
connect(historyService, &QLowEnergyService::characteristicRead, this, &MiFlora::historyServiceCharReadData); connect(historyService, &QLowEnergyService::characteristicRead, this, &MiFlora::historyServiceCharReadData);
disconnect(historyService, &QLowEnergyService::characteristicWritten, this, &MiFlora::historyServiceCharWritten); disconnect(historyService, &QLowEnergyService::characteristicWritten, this, &MiFlora::historyServiceCharWritten);
connect(historyService, &QLowEnergyService::characteristicWritten, this, &MiFlora::historyServiceCharWrittenData); connect(historyService, &QLowEnergyService::characteristicWritten, this, &MiFlora::historyServiceCharWrittenData);
//Take size given and start by giving the last 48 numbers(if that many) to represent the last day of data. TODO: look to have amount of time be configurable. //Take size given and start by giving the last 24 numbers(if that many) to represent the last day of data. TODO: look to have amount of time be configurable.
lastHistoryEntry = 0; lastHistoryEntry = 0;
if(size > 48) { if(size > historySize) {
currentHistoryEntry = 48; currentHistoryEntry = historySize;
} else { } else {
currentHistoryEntry = size; currentHistoryEntry = size;
} }

View File

@@ -96,6 +96,7 @@ private:
const QByteArray magicBytes = QByteArray::fromHex("a01f"); const QByteArray magicBytes = QByteArray::fromHex("a01f");
const QByteArray historyReadInit = QByteArray::fromHex("a00000"); const QByteArray historyReadInit = QByteArray::fromHex("a00000");
const quint16 historySize = 24;
float temp = 0.0; float temp = 0.0;
quint32 bright = 0; quint32 bright = 0;