Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/condo4/carbudget
Browse files Browse the repository at this point in the history
  • Loading branch information
thmichel committed Jul 27, 2015
2 parents d6b66b9 + a327925 commit 376e71a
Show file tree
Hide file tree
Showing 19 changed files with 2,020 additions and 44 deletions.
6 changes: 4 additions & 2 deletions CarBudget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,13 @@ int main(int argc, char *argv[])
QQuickView *view = SailfishApp::createView();

QTranslator translator;
if(translator.load((QLocale::system().name() != "C")?(QLocale::system().name()):("en_GB"), ":/i18n"))
if(translator.load((QLocale::system().name() != "C")?(QLocale::system().name()):("en_GB"), "/usr/share/harbour-carbudget/translations/"))
{
QGuiApplication::installTranslator(&translator);
}

app->setApplicationVersion(QString(APP_VERSION));

qmlRegisterType<Tank>( "harbour.carbudget",1,0,"Tank");
qmlRegisterType<Fueltype>( "harbour.carbudget",1,0,"Fueltype");
qmlRegisterType<Station>( "harbour.carbudget",1,0,"Station");
Expand All @@ -66,7 +68,7 @@ int main(int argc, char *argv[])
qmlRegisterType<Tire>( "harbour.carbudget",1,0,"Tire");
qmlRegisterType<Tiremount>( "harbour.carbudget",1,0,"Tiremount");
qmlRegisterType<Car>( "harbour.carbudget",1,0,"Car");
qmlRegisterType<FileModel>("harbour.carbudget", 1, 0, "FileModel");
qmlRegisterType<FileModel>( "harbour.carbudget",1,0,"FileModel");


CarManager manager;
Expand Down
6 changes: 0 additions & 6 deletions Ressources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,4 @@
<file alias="Wrench.png">picture/Wrench.png</file>
<file alias="Dollar.png">picture/Dollar.png</file>
</qresource>
<qresource prefix="/i18n">
<file alias="fr_FR.qm">i18n/fr_FR.qm</file>
<file alias="it_IT.qm">i18n/it_IT.qm</file>
<file alias="de_DE.qm">i18n/de_DE.qm</file>
<file alias="ru_RU.qm">i18n/ru_RU.qm</file>
</qresource>
</RCC>
6 changes: 3 additions & 3 deletions car.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void Car::db_load()
_fueltypelist.append(fueltype);
}
}
if(query.exec("SELECT id,name,sum(TankList.quantity) as quantity FROM StationList, TankList WHERE StationList.id == TankList.station GROUP BY StationList.id;"))
if(query.exec("SELECT id,name,sum(TankList.quantity) as quantity FROM StationList LEFT JOIN TankList ON StationList.id == TankList.station GROUP BY StationList.id;"))
{
while(query.next())
{
Expand Down Expand Up @@ -717,11 +717,11 @@ double Car::budget_invest_total()
double Car::budget_invest()
{
//returns bying costs per 100 KM
if (maxdistance()== mindistance()) return 0;
if (maxdistance()== mindistance()) return 0.0;
QDate today = QDate::currentDate();
unsigned int monthsused = 1;
double valuecosts;
if (maxdistance()==mindistance() ) return 0.0;

if (_buyingdate.toString()=="")
{
qDebug() << "Invalid buying date ";
Expand Down
9 changes: 9 additions & 0 deletions carmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,15 @@ void CarManager::importFromFuelpad(QString filename, QString name)
db.close();
}

bool CarManager::is_debug() const
{
#ifdef QT_NO_DEBUG
return false;
#else
return true;
#endif
}

QString CarManager::getEnv(QString name)
{
qDebug() << "Find environment value for" << name << ": " << getenv(name.toStdString().c_str());
Expand Down
2 changes: 2 additions & 0 deletions carmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ class CarManager : public QObject

Q_PROPERTY(QStringList cars READ cars NOTIFY carsChanged())
Q_PROPERTY(Car *car READ car NOTIFY carChanged())
Q_PROPERTY(bool is_debug READ is_debug CONSTANT)

private:
QStringList _cars;
Expand Down Expand Up @@ -61,5 +62,6 @@ public slots:
void createCar(QString name);
void importFromMyCar( QString filename, QString name);
void importFromFuelpad( QString filenme, QString name);
bool is_debug() const;
};
#endif // CARMANAGER_H
19 changes: 12 additions & 7 deletions harbour-carbudget.pro
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ lupdate_only{
SOURCES += qml/pages/*.qml
}


CONFIG += sailfishapp_i18n

TRANSLATIONS = translations/de_DE.ts \
translations/fr_FR.ts \
translations/it_IT.ts \
translations/ru_RU.ts \
translations/sv_SE.ts


DEFINES += APP_VERSION=\"\\\"$${VERSION}\\\"\"

OTHER_FILES += qml/cover/CoverPage.qml \
rpm/CarBudget.yaml \
harbour-carbudget.desktop \
Expand All @@ -50,13 +62,10 @@ OTHER_FILES += qml/cover/CoverPage.qml \
qml/pages/TireMount.qml \
qml/pages/About.qml \
qml/pages/CarCreate.qml \
i18n/FR_fr.ts \
i18n/RU_ru.ts \
qml/pages/BudgetView.qml \
qml/pages/Settings.qml \
qml/pages/CosttypeEntry.qml \
qml/pages/CosttypeView.qml \
i18n/de_DE.ts \
qml/pages/SelectImportFile.qml \
qml/pages/MycarImport.qml \
qml/pages/FuelpadImport.qml \
Expand All @@ -81,10 +90,6 @@ HEADERS += \
statfileinfo.h \
globals.h

TRANSLATIONS = i18n/de_DE.ts \
i18n/fr_FR.ts \
i18n/it_IT.ts \
i18n/ru_RU.ts

RESOURCES += \
Ressources.qrc
Binary file removed i18n/de_DE.qm
Binary file not shown.
Binary file removed i18n/fr_FR.qm
Binary file not shown.
Binary file removed i18n/it_IT.qm
Binary file not shown.
Binary file removed i18n/ru_RU.qm
Binary file not shown.
8 changes: 5 additions & 3 deletions qml/pages/About.qml
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,18 @@ Page {
anchors.fill: parent

// PullDownMenu and PushUpMenu must be declared in SilicaFlickable, SilicaListView or SilicaGridView
/*
PullDownMenu {
enabled: manager.is_debug
visible: manager.is_debug

MenuItem {
text: qsTr("Simulation")
onClicked: {
manager.car.simulation()
}
}
}
*/


// Tell SilicaFlickable the height of its content.
contentHeight: column.height
Expand All @@ -53,7 +55,7 @@ Page {
width: page.width
spacing: Theme.paddingLarge
PageHeader {
title: "CarBudget 0.12"
title: "CarBudget " + Qt.application.version
}

Label {
Expand Down
5 changes: 4 additions & 1 deletion rpm/CarBudget.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Name: harbour-carbudget
Summary: Car expenses calculation
Version: 0.12
Version: 0.13
Release: 0
Group: Qt/Qt
License: GPL
Expand All @@ -22,9 +22,12 @@ Requires:
Files:
- '%{_bindir}'
- '%{_datadir}/%{name}/qml'
- '%{_datadir}/%{name}/translations'
- '%{_datadir}/applications/%{name}.desktop'
- '%{_datadir}/icons/hicolor/86x86/apps/%{name}.png'
- '%{_datadir}/applications'
- '%{_datadir}/icons/hicolor/86x86/apps'
- '%{_datadir}/%{name}'
PkgBR: []
QMakeOptions:
- VERSION=%{version}
13 changes: 9 additions & 4 deletions i18n/de_DE.ts → translations/de_DE.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="de_DE">
<TS version="2.1" language="de_DE">
<context>
<name>About</name>
<message>
<location filename="../qml/pages/About.qml" line="61"/>
<location filename="../qml/pages/About.qml" line="39"/>
<source>Simulation</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/pages/About.qml" line="63"/>
<source>License: GPLv3</source>
<translation>Lizenz: GPLv3</translation>
</message>
<message>
<location filename="../qml/pages/About.qml" line="66"/>
<location filename="../qml/pages/About.qml" line="68"/>
<source>Created by condo4 (Fabien Proriol)</source>
<translation>Erstellt von condo4 (Fabien Proriol) </translation>
</message>
<message>
<location filename="../qml/pages/About.qml" line="72"/>
<location filename="../qml/pages/About.qml" line="74"/>
<source>Credits to:&lt;br&gt;- Lorenzo Facca (Italian translation)&lt;br&gt;- Alois Spitzbart (German translation)&lt;br&gt;- Michal Hrusecky (Many improvments)&lt;br&gt;- Denis Fedoseev (Russion translation)&lt;br &gt;- Thomas Michel (Many improvments)</source>
<translation>Dank an:&lt;br&gt;- Lorenzo Facca (Italienisch Übersetzung)&lt;br&gt;- Alois Spitzbart (Deutsche Übersetzung)&lt;br&gt;- Michal Hrusecky (Viele Verbesserungen)&lt;br&gt;- Denis Fedoseev (Russische Übersetzung)&lt;br &gt;- Thomas Michel (Viele Verbesserungen)</translation>
</message>
Expand Down
11 changes: 6 additions & 5 deletions i18n/fr_FR.ts → translations/fr_FR.ts
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.0" language="fr_FR">
<TS version="2.1" language="fr_FR">
<context>
<name>About</name>
<message>
<location filename="../qml/pages/About.qml" line="39"/>
<source>Simulation</source>
<translation type="obsolete">Simulation</translation>
<translation type="unfinished">Simulation</translation>
</message>
<message>
<source>Distance: %L1 km</source>
<translation type="obsolete">Distance: %L1 km</translation>
</message>
<message>
<location filename="../qml/pages/About.qml" line="61"/>
<location filename="../qml/pages/About.qml" line="63"/>
<source>License: GPLv3</source>
<translation>Licence : GPLv3</translation>
</message>
<message>
<location filename="../qml/pages/About.qml" line="66"/>
<location filename="../qml/pages/About.qml" line="68"/>
<source>Created by condo4 (Fabien Proriol)</source>
<translation>Créé par condo4 (Fabien Proriol)</translation>
</message>
<message>
<location filename="../qml/pages/About.qml" line="72"/>
<location filename="../qml/pages/About.qml" line="74"/>
<source>Credits to:&lt;br&gt;- Lorenzo Facca (Italian translation)&lt;br&gt;- Alois Spitzbart (German translation)&lt;br&gt;- Michal Hrusecky (Many improvments)&lt;br&gt;- Denis Fedoseev (Russion translation)&lt;br &gt;- Thomas Michel (Many improvments)</source>
<translation>Remerciments :&lt;br&gt;- Lorenzo Facca (Italien)&lt;br&gt;- Alois Spitzbart (Allemand)&lt;br&gt;- Denis Fedoseev (Russe)&lt;br&gt;- Michal Hrusecky (divers améliorations)&lt;br &gt;- Thomas Michel (divers améliorations)</translation>
</message>
Expand Down
Loading

0 comments on commit 376e71a

Please sign in to comment.