Skip to content

Commit

Permalink
Various cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
emericg committed Aug 5, 2024
1 parent 6b48340 commit 5935fb0
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 16 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,6 @@ You can help us find and report bugs, suggest new features, help with translatio
## License

WatchFlower is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
Read the [LICENSE](LICENSE) file or [consult the license on the FSF website](https://www.gnu.org/licenses/gpl-3.0.txt) directly.
Read the [LICENSE](LICENSE.md) file or [consult the license on the FSF website](https://www.gnu.org/licenses/gpl-3.0.txt) directly.

> Emeric Grange <[email protected]>
1 change: 1 addition & 0 deletions assets/android/res/values/apptheme.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme">
<item name="android:windowFullscreen">true</item>
<item name="android:windowBackground">@android:color/white</item>
<item name="android:statusBarColor">@android:color/white</item>
<item name="android:navigationBarColor">@android:color/white</item>
Expand Down
11 changes: 8 additions & 3 deletions qml/components/ChartThermometerMinMaxBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ import ThemeEngine
import "qrc:/utils/UtilsNumber.js" as UtilsNumber

Item {
id: chartThermometerMinMaxBar
id: minMaxBar

implicitWidth: 32
implicitHeight: 128

property int www: 20

///////////////

Component.onCompleted: {
setTemp()
computeSize()
Expand Down Expand Up @@ -76,7 +79,7 @@ Item {
text_temp_low.text = tl.toFixed(1) + "°"
}

////////////////////////////////////////////////////////////////////////////
///////////////

Rectangle {
id: background
Expand Down Expand Up @@ -112,7 +115,7 @@ Item {
color: Theme.colorText
}

////////////////////////////////////////////////////////////////////////////
///////////////

Item {
id: containerbar
Expand Down Expand Up @@ -242,4 +245,6 @@ Item {
}
}
}

///////////////
}
3 changes: 2 additions & 1 deletion qml/components/PlantSizeWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@ RangeSlider {
color: "#e1e4e9" // Theme.colorForeground

Rectangle {
anchors.top: parent.top
anchors.bottom: parent.bottom
x: (control.first.visualPosition * parent.width)
width: (control.second.visualPosition * parent.width) - x
height: parent.height
radius: 2
color: "#ed5565" // Theme.colorPrimary
}
Expand Down
4 changes: 2 additions & 2 deletions qml/widgets/DeviceWidget.qml
Original file line number Diff line number Diff line change
Expand Up @@ -525,9 +525,9 @@ Item {
////

Item {
anchors.verticalCenter: parent.verticalCenter
anchors.top: parent.top
anchors.bottom: parent.bottom
width: parent.height * 0.5
height: parent.height

visible: !boxDevice.hasDataToday

Expand Down
2 changes: 1 addition & 1 deletion src/DeviceManager_export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ QString DeviceManager::exportDataOpen()
if (!m_devices_model->hasDevices()) return exportFilePath;

// Get temp directory path
QString exportDirectoryPath = QStandardPaths::standardLocations(QStandardPaths::AppDataLocation).value(0);
QString exportDirectoryPath = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);

QDir exportDirectory(exportDirectoryPath + "/export");
if (!exportDirectory.exists()) exportDirectory.mkpath(exportDirectoryPath + "/export");
Expand Down
2 changes: 1 addition & 1 deletion src/device_environmental.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ void DeviceEnvironmental::updateChartData_environmentalVoc(int maxDays)
"FROM sensorData " \
"WHERE deviceAddr = :deviceAddr AND timestamp >= " + datetime_months + " " \
"GROUP BY " + strftime_mid + " " \
"ORDER BY timestamp DESC "
"ORDER BY timestamp DESC " \
"LIMIT :maxDays;");
graphData.bindValue(":deviceAddr", getAddress());
graphData.bindValue(":maxDays", maxDays);
Expand Down
16 changes: 9 additions & 7 deletions src/device_sensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -980,8 +980,8 @@ void DeviceSensor::checkDataAvailability()

if (hasData.exec() == false)
{
qWarning() << "> hasData.exec(1) ERROR" << hasData.lastError().type() << ":" << hasData.lastError().text();
qWarning() << "> hasData.exec(1) >" << hasData.lastQuery();
qWarning() << "> hasData.exec(1) ERROR"
<< hasData.lastError().type() << ":" << hasData.lastError().text();
}

while (hasData.next())
Expand Down Expand Up @@ -1060,13 +1060,15 @@ bool DeviceSensor::hasDataNamed(const QString &dataName) const
if (m_dbInternal || m_dbExternal)
{
QSqlQuery hasData;
hasData.prepare("SELECT COUNT(" + dataName + ") FROM " + tableName + " WHERE deviceAddr = :deviceAddr AND " + dataName + " > 0;");
hasData.prepare("SELECT COUNT(" + dataName + ") " \
"FROM " + tableName + " " \
"WHERE deviceAddr = :deviceAddr AND " + dataName + " > 0;");
hasData.bindValue(":deviceAddr", getAddress());

if (hasData.exec() == false)
{
qWarning() << "> hasData.exec(2) ERROR" << hasData.lastError().type() << ":" << hasData.lastError().text();
qWarning() << "> hasData.exec(2) >" << hasData.lastQuery();
qWarning() << "> hasData.exec(2) ERROR"
<< hasData.lastError().type() << ":" << hasData.lastError().text();
}

while (hasData.next())
Expand Down Expand Up @@ -1173,8 +1175,8 @@ bool DeviceSensor::hasData() const

if (hasData.exec() == false)
{
qWarning() << "> hasData.exec(3) ERROR" << hasData.lastError().type() << ":" << hasData.lastError().text();
qWarning() << "> hasData.exec(3) >" << hasData.lastQuery();
qWarning() << "> hasData.exec(3) ERROR"
<< hasData.lastError().type() << ":" << hasData.lastError().text();
}

while (hasData.next())
Expand Down

0 comments on commit 5935fb0

Please sign in to comment.