This repository has been archived by the owner on Feb 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Init commit
- Loading branch information
Showing
27 changed files
with
23,415 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[Desktop Entry] | ||
Type=Application | ||
X-Nemo-Application-Type=silica-qt5 | ||
Icon=SuiviSante | ||
Exec=SuiviSante | ||
Name=SuiviSante | ||
# translation example: | ||
# your app name in German locale (de) | ||
# | ||
# Remember to comment out the following line, if you do not want to use | ||
# a different app name in German locale (de). | ||
Name[de]=SuiviSante |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# NOTICE: | ||
# | ||
# Application name defined in TARGET has a corresponding QML filename. | ||
# If name defined in TARGET is changed, the following needs to be done | ||
# to match new name: | ||
# - corresponding QML filename must be changed | ||
# - desktop icon filename must be changed | ||
# - desktop filename must be changed | ||
# - icon definition filename in desktop file must be changed | ||
# - translation filenames have to be changed | ||
|
||
# The name of your application | ||
TARGET = SuiviSante | ||
|
||
CONFIG += sailfishapp | ||
|
||
SOURCES += src/SuiviSante.cpp | ||
|
||
DISTFILES += \ | ||
qml/SuiviSante.qml \ | ||
qml/calculesFunctions.qml \ | ||
qml/cover/CoverPage.qml \ | ||
qml/pages/FirstPage.qml \ | ||
qml/pages/GraphTest.qml \ | ||
qml/pages/SecondPage.qml \ | ||
qml/pages/About.qml \ | ||
qml/pages/AddMetric.qml \ | ||
qml/pages/History.qml \ | ||
qml/pages/Profile_Settings.qml \ | ||
qml/js/util.js \ | ||
qml/js/d3.js \ | ||
qml/js/utils.js \ | ||
rpm/SuiviSante.changes.in \ | ||
rpm/SuiviSante.changes.run.in \ | ||
rpm/SuiviSante.spec \ | ||
rpm/SuiviSante.yaml \ | ||
translations/*.ts \ | ||
SuiviSante.desktop | ||
|
||
SAILFISHAPP_ICONS = 86x86 108x108 128x128 172x172 | ||
|
||
# to disable building translations every time, comment out the | ||
# following CONFIG line | ||
CONFIG += sailfishapp_i18n | ||
|
||
# German translation is enabled as an example. If you aren't | ||
# planning to localize your app, remember to comment out the | ||
# following TRANSLATIONS line. And also do not forget to | ||
# modify the localized app name in the the .desktop file. | ||
TRANSLATIONS += translations/SuiviSante-de.ts |
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import QtQuick 2.0 | ||
import Sailfish.Silica 1.0 | ||
import "pages" | ||
import QtQuick.LocalStorage 2.0 | ||
|
||
ApplicationWindow | ||
{ | ||
initialPage: Component { FirstPage { } } | ||
cover: Qt.resolvedUrl("cover/CoverPage.qml") | ||
allowedOrientations: defaultAllowedOrientations | ||
|
||
|
||
Component.onCompleted: { | ||
createLastUser() | ||
setProfil(); | ||
setMetric(); | ||
console.log("DB created"); | ||
} | ||
|
||
function createLastUser() { | ||
var db = LocalStorage.openDatabaseSync("WeightTracker", "1.0", "Database application", 100000); | ||
|
||
var createUsersTable = 'CREATE TABLE IF NOT EXISTS SETTINGS( | ||
USER_CODE INTEGER NOT NULL, | ||
PRIMARY KEY(USER_CODE) | ||
);'; | ||
db.transaction( | ||
function(tx){ | ||
tx.executeSql(createUsersTable); | ||
} | ||
) | ||
} | ||
|
||
|
||
function setProfil() { | ||
var db = LocalStorage.openDatabaseSync("WeightTracker", "1.0", "Database application", 100000); | ||
|
||
var createUsersTable = 'CREATE TABLE IF NOT EXISTS USERS( | ||
USER_CODE INTEGER NOT NULL, | ||
LASTNAME VARCHAR(30) NOT NULL, | ||
FIRSTNAME VARCHAR(30) NOT NULL, | ||
GENDER CHAR(1) NOT NULL, | ||
BIRTHDAY DATE NOT NULL, | ||
HEIGHT INTEGER NOT NULL, | ||
PRIMARY KEY(USER_CODE) | ||
);'; | ||
db.transaction( | ||
function(tx){ | ||
tx.executeSql(createUsersTable); | ||
} | ||
) | ||
} | ||
|
||
function setMetric() { | ||
var db = LocalStorage.openDatabaseSync("WeightTracker", "1.0", "Database application", 100000); | ||
|
||
var createMetricsTable = 'CREATE TABLE IF NOT EXISTS METRICS( | ||
USER_CODE INTEGER NOT NULL, | ||
METRIC_CODE INTEGER NOT NULL, | ||
METRIC_DATE DATE NOT NULL, | ||
CATEGORIE VARCHAR(20) NOT NULL, | ||
VAL DECIMAL(3,2) NOT NULL, | ||
PRIMARY KEY(USER_CODE,METRIC_CODE), | ||
FOREIGN KEY(USER_CODE) REFERENCES USERS(USER_CODE) | ||
);'; | ||
db.transaction( | ||
function(tx){ | ||
tx.executeSql(createMetricsTable); | ||
} | ||
) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import QtQuick 2.0 | ||
|
||
|
||
Item { | ||
property double bmi: 0.0; | ||
property string bmi_text; | ||
property double height_bmi: 0.0; | ||
property double weight_bmi: 0.0; | ||
property double recommended_min_weight: 0.0; | ||
property double recommended_max_weight: 0.0; | ||
property string category_bmi; | ||
property string category_bmi_description; | ||
property string recommended_weight_description; | ||
property double height_square: 0.0; | ||
|
||
function calculate() { | ||
weight_bmi = weightField.value | ||
height_bmi = heightField.value / 100 | ||
|
||
height_square = (height_bmi * height_bmi) | ||
|
||
if ((weight_bmi > 0) && (height_bmi > 0)) { | ||
bmi = weight_bmi / height_square; | ||
recommended_min_weight = 18.5 * height_square | ||
recommended_max_weight = 24.9 * height_square | ||
recommended_weight_description = "The recommended weight for your height is between " + recommended_min_weight.toFixed(2) + " kg and " + recommended_max_weight.toFixed(2) + " kg" | ||
calculate_bmi_category(); | ||
} | ||
|
||
bmi_text = "Your BMI is: " + bmi.toFixed(2); | ||
} | ||
|
||
function calculate_bmi_category() { | ||
if (bmi < 18.5) { | ||
category_bmi = "Underweight"; | ||
category_bmi_description = "Your weight is under the recommended values. Talk to your doctor for medical advice." | ||
} else if (bmi < 25) { | ||
category_bmi = "Normal weight"; | ||
category_bmi_description = "Your weight is in the normal category for adults of your height." | ||
} else if (bmi < 30) { | ||
category_bmi = "Overweight (pre-obesity)"; | ||
category_bmi_description = "Your weight is above the recommended values. Talk to your doctor for medical advice." | ||
} else if (bmi < 35) { | ||
category_bmi = "Obese Class I"; | ||
category_bmi_description = "Your weight is high above the recommended values. People who are overweight or obese are at higher risk for chronic conditions such as high blood pressure, diabetes, and high cholesterol. Talk to your doctor for medical advice." | ||
} else if (bmi < 40) { | ||
category_bmi = "Obese Class II"; | ||
category_bmi_description = "Your weight is high above the recommended values. People who are overweight or obese are at higher risk for chronic conditions such as high blood pressure, diabetes, and high cholesterol. Talk to your doctor for medical advice." | ||
} else if (bmi >= 40) { | ||
category_bmi = "Obese Class III"; | ||
category_bmi_description = "Your weight is high above the recommended values. People who are overweight or obese are at higher risk for chronic conditions such as high blood pressure, diabetes, and high cholesterol. Talk to your doctor for medical advice." | ||
} else { | ||
category_bmi = "Unkown category"; | ||
category_bmi_description = "" | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import QtQuick 2.0 | ||
import Sailfish.Silica 1.0 | ||
import QtQuick.LocalStorage 2.0 | ||
|
||
import "../js/utils.js" as WtUtils | ||
|
||
CoverBackground { | ||
anchors.fill: parent | ||
|
||
function loadData() { | ||
var WtData = WtUtils.info_user(WtUtils.getLastUser()); | ||
label_first_name.text = WtData.firstname; | ||
label_last_name.text = WtData.lastname; | ||
label_weight.text = WtData.weight + " kg"; | ||
label_bmi.text = "BMI: " + WtData.bmi.toFixed(2); | ||
} | ||
|
||
Label { | ||
id: label_first_name | ||
anchors.top: parent.top | ||
text: "First" | ||
anchors.topMargin: 30 | ||
font.pixelSize: Theme.fontSizeLarge | ||
anchors.horizontalCenter: parent.horizontalCenter | ||
} | ||
|
||
Label { | ||
id: label_last_name | ||
anchors.top: label_first_name.bottom | ||
text: "Last" | ||
font.pixelSize: Theme.fontSizeLarge | ||
anchors.horizontalCenter: parent.horizontalCenter | ||
} | ||
|
||
Label { | ||
id: label_weight | ||
anchors.top: label_last_name.bottom | ||
text: "Weight" | ||
anchors.topMargin: 30 | ||
font.pixelSize: Theme.fontSizeExtraLarge | ||
anchors.horizontalCenter: parent.horizontalCenter | ||
} | ||
|
||
Label { | ||
id: label_bmi | ||
anchors.top: label_weight.bottom | ||
text: "BMI" | ||
anchors.topMargin: 30 | ||
font.pixelSize: Theme.fontSizeLarge | ||
anchors.horizontalCenter: parent.horizontalCenter | ||
} | ||
|
||
Component.onCompleted: loadData() | ||
|
||
CoverActionList { | ||
id: coverAction | ||
CoverAction { | ||
iconSource: "image://theme/icon-cover-refresh" | ||
onTriggered: loadData() | ||
} | ||
} | ||
} |
Oops, something went wrong.