├── .gitignore ├── _config.yml ├── docs ├── _config.yml ├── assets │ └── images │ │ ├── location.png │ │ ├── settings.png │ │ ├── weather.gif │ │ ├── weather.png │ │ ├── weather_green.png │ │ ├── weather_purp.png │ │ └── weather_red.png ├── multiple_inst.md └── index.md ├── android ├── assets │ ├── api.png │ ├── key.png │ ├── map.png │ ├── credits.png │ ├── cumulus.png │ ├── palette.png │ ├── yw_logo.png │ ├── speed_icon.png │ ├── temperature_icon.png │ └── screens │ │ ├── toggle-screens.png │ │ ├── location-search.png │ │ ├── locations-screen.png │ │ └── main-screen-forecast.png ├── res │ ├── drawable-ldpi │ │ ├── api.png │ │ ├── map.png │ │ ├── icon.png │ │ ├── credits.png │ │ ├── palette.png │ │ ├── speed_icon.png │ │ └── temperature_icon.png │ ├── drawable-mdpi │ │ ├── api.png │ │ ├── map.png │ │ ├── icon.png │ │ ├── credits.png │ │ ├── palette.png │ │ ├── speed_icon.png │ │ └── temperature_icon.png │ ├── drawable-hdpi │ │ └── icon.png │ └── values │ │ └── libs.xml ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── build.gradle ├── gradlew.bat ├── AndroidManifest.xml └── gradlew ├── assets ├── fonts │ ├── Ubuntu-C.ttf │ ├── fontawesome.ttf │ └── weathericons-regular-webfont.ttf ├── icons │ ├── wund_logo.png │ ├── yw_logo.png │ ├── wund_logo_light.png │ └── hicolor │ │ ├── 128x128 │ │ ├── api.png │ │ ├── key.png │ │ ├── map.png │ │ ├── credits.png │ │ ├── cumulus.png │ │ ├── palette.png │ │ ├── speed_icon.png │ │ └── temperature_icon.png │ │ ├── 256x256 │ │ ├── api.png │ │ ├── map.png │ │ ├── credits.png │ │ ├── cumulus.png │ │ ├── palette.png │ │ ├── speed_icon.png │ │ └── temperature_icon.png │ │ ├── 512x512 │ │ ├── api.png │ │ ├── key.png │ │ ├── map.png │ │ ├── credits.png │ │ ├── cumulus.png │ │ ├── palette.png │ │ ├── speed_icon.png │ │ └── temperature_icon.png │ │ ├── 64x64 │ │ ├── api.png │ │ ├── key.png │ │ ├── map.png │ │ ├── credits.png │ │ ├── cumulus.png │ │ ├── palette.png │ │ ├── speed_icon.png │ │ └── temperature_icon.png │ │ └── scalable │ │ └── cumulus.svg └── screens │ ├── toggle-screens.png │ ├── location-search.png │ ├── locations-screen.png │ └── main-screen-forecast.png ├── translations ├── tempestas_ro.qm └── tempestas_ro.po ├── qml ├── LinkedText.qml ├── SimpleItem.qml ├── ResizeController.qml ├── CustomComponents │ ├── Item.qml │ └── ClickableItem.qml ├── CustomControls │ ├── SettingsItem.qml │ ├── Button.qml │ └── CustomButton.qml ├── GpsLocationItem.qml ├── ClickableItem.qml ├── MenuButton.qml ├── ColorPalleteButton.qml ├── LocationItemDelegate.qml ├── SelectionButton.qml ├── WeatherInfoItem.qml ├── ForecastView.qml ├── ForecastItemDelegate.qml ├── WelcomeView.qml ├── SettingsOptionItem.qml ├── CreditsListDelegate.qml ├── MainView.qml ├── LocationView.qml ├── CustomSwitch.qml ├── ApplicationBar.qml └── SearchLocation.qml ├── deployment.pri ├── CppFiles ├── WundWeatherController.h ├── LocationController.h ├── CreditsAuthor.cpp ├── CustomImageProvider.h ├── FontImageProvider.h ├── ThreadWorker.h ├── MainWindow.h ├── FontImageProvider.cpp ├── YWeatherController.h ├── OwmWeatherController.h ├── CreditsAuthor.h ├── DataController.h ├── CustomImageProvider.cpp ├── TrayController.h ├── AbstractWeatherController.h ├── ThreadWorker.cpp ├── Util.h ├── Forecast.h ├── DataController.cpp ├── Location.h ├── Forecast.cpp ├── LocationController.cpp ├── MainWindow.cpp ├── TrayController.cpp ├── DatabaseHelper.h ├── AbstractWeatherController.cpp ├── WeatherType.h └── SettingsController.h ├── qml.qrc ├── .travis.yml ├── README.md ├── main.cpp └── Cumulus.pro /.gitignore: -------------------------------------------------------------------------------- 1 | Cumulus.pro.user 2 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-midnight -------------------------------------------------------------------------------- /docs/_config.yml: -------------------------------------------------------------------------------- 1 | theme: jekyll-theme-slate -------------------------------------------------------------------------------- /android/assets/api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/android/assets/api.png -------------------------------------------------------------------------------- /android/assets/key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/android/assets/key.png -------------------------------------------------------------------------------- /android/assets/map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/android/assets/map.png -------------------------------------------------------------------------------- /android/assets/credits.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/android/assets/credits.png -------------------------------------------------------------------------------- /android/assets/cumulus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/android/assets/cumulus.png -------------------------------------------------------------------------------- /android/assets/palette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/android/assets/palette.png -------------------------------------------------------------------------------- /android/assets/yw_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/android/assets/yw_logo.png -------------------------------------------------------------------------------- /assets/fonts/Ubuntu-C.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/fonts/Ubuntu-C.ttf -------------------------------------------------------------------------------- /assets/icons/wund_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/icons/wund_logo.png -------------------------------------------------------------------------------- /assets/icons/yw_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/icons/yw_logo.png -------------------------------------------------------------------------------- /assets/fonts/fontawesome.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/fonts/fontawesome.ttf -------------------------------------------------------------------------------- /translations/tempestas_ro.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/translations/tempestas_ro.qm -------------------------------------------------------------------------------- /android/assets/speed_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/android/assets/speed_icon.png -------------------------------------------------------------------------------- /docs/assets/images/location.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/docs/assets/images/location.png -------------------------------------------------------------------------------- /docs/assets/images/settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/docs/assets/images/settings.png -------------------------------------------------------------------------------- /docs/assets/images/weather.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/docs/assets/images/weather.gif -------------------------------------------------------------------------------- /docs/assets/images/weather.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/docs/assets/images/weather.png -------------------------------------------------------------------------------- /android/res/drawable-ldpi/api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/android/res/drawable-ldpi/api.png -------------------------------------------------------------------------------- /android/res/drawable-ldpi/map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/android/res/drawable-ldpi/map.png -------------------------------------------------------------------------------- /android/res/drawable-mdpi/api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/android/res/drawable-mdpi/api.png -------------------------------------------------------------------------------- /android/res/drawable-mdpi/map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/android/res/drawable-mdpi/map.png -------------------------------------------------------------------------------- /assets/icons/wund_logo_light.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/icons/wund_logo_light.png -------------------------------------------------------------------------------- /assets/screens/toggle-screens.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/screens/toggle-screens.png -------------------------------------------------------------------------------- /android/assets/temperature_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/android/assets/temperature_icon.png -------------------------------------------------------------------------------- /android/res/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/android/res/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /android/res/drawable-ldpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/android/res/drawable-ldpi/icon.png -------------------------------------------------------------------------------- /android/res/drawable-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/android/res/drawable-mdpi/icon.png -------------------------------------------------------------------------------- /assets/icons/hicolor/128x128/api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/icons/hicolor/128x128/api.png -------------------------------------------------------------------------------- /assets/icons/hicolor/128x128/key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/icons/hicolor/128x128/key.png -------------------------------------------------------------------------------- /assets/icons/hicolor/128x128/map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/icons/hicolor/128x128/map.png -------------------------------------------------------------------------------- /assets/icons/hicolor/256x256/api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/icons/hicolor/256x256/api.png -------------------------------------------------------------------------------- /assets/icons/hicolor/256x256/map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/icons/hicolor/256x256/map.png -------------------------------------------------------------------------------- /assets/icons/hicolor/512x512/api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/icons/hicolor/512x512/api.png -------------------------------------------------------------------------------- /assets/icons/hicolor/512x512/key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/icons/hicolor/512x512/key.png -------------------------------------------------------------------------------- /assets/icons/hicolor/512x512/map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/icons/hicolor/512x512/map.png -------------------------------------------------------------------------------- /assets/icons/hicolor/64x64/api.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/icons/hicolor/64x64/api.png -------------------------------------------------------------------------------- /assets/icons/hicolor/64x64/key.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/icons/hicolor/64x64/key.png -------------------------------------------------------------------------------- /assets/icons/hicolor/64x64/map.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/icons/hicolor/64x64/map.png -------------------------------------------------------------------------------- /assets/screens/location-search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/screens/location-search.png -------------------------------------------------------------------------------- /assets/screens/locations-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/screens/locations-screen.png -------------------------------------------------------------------------------- /docs/assets/images/weather_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/docs/assets/images/weather_green.png -------------------------------------------------------------------------------- /docs/assets/images/weather_purp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/docs/assets/images/weather_purp.png -------------------------------------------------------------------------------- /docs/assets/images/weather_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/docs/assets/images/weather_red.png -------------------------------------------------------------------------------- /android/res/drawable-ldpi/credits.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/android/res/drawable-ldpi/credits.png -------------------------------------------------------------------------------- /android/res/drawable-ldpi/palette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/android/res/drawable-ldpi/palette.png -------------------------------------------------------------------------------- /android/res/drawable-mdpi/credits.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/android/res/drawable-mdpi/credits.png -------------------------------------------------------------------------------- /android/res/drawable-mdpi/palette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/android/res/drawable-mdpi/palette.png -------------------------------------------------------------------------------- /assets/icons/hicolor/64x64/credits.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/icons/hicolor/64x64/credits.png -------------------------------------------------------------------------------- /assets/icons/hicolor/64x64/cumulus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/icons/hicolor/64x64/cumulus.png -------------------------------------------------------------------------------- /assets/icons/hicolor/64x64/palette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/icons/hicolor/64x64/palette.png -------------------------------------------------------------------------------- /android/assets/screens/toggle-screens.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/android/assets/screens/toggle-screens.png -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /android/res/drawable-ldpi/speed_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/android/res/drawable-ldpi/speed_icon.png -------------------------------------------------------------------------------- /android/res/drawable-mdpi/speed_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/android/res/drawable-mdpi/speed_icon.png -------------------------------------------------------------------------------- /assets/icons/hicolor/128x128/credits.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/icons/hicolor/128x128/credits.png -------------------------------------------------------------------------------- /assets/icons/hicolor/128x128/cumulus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/icons/hicolor/128x128/cumulus.png -------------------------------------------------------------------------------- /assets/icons/hicolor/128x128/palette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/icons/hicolor/128x128/palette.png -------------------------------------------------------------------------------- /assets/icons/hicolor/256x256/credits.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/icons/hicolor/256x256/credits.png -------------------------------------------------------------------------------- /assets/icons/hicolor/256x256/cumulus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/icons/hicolor/256x256/cumulus.png -------------------------------------------------------------------------------- /assets/icons/hicolor/256x256/palette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/icons/hicolor/256x256/palette.png -------------------------------------------------------------------------------- /assets/icons/hicolor/512x512/credits.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/icons/hicolor/512x512/credits.png -------------------------------------------------------------------------------- /assets/icons/hicolor/512x512/cumulus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/icons/hicolor/512x512/cumulus.png -------------------------------------------------------------------------------- /assets/icons/hicolor/512x512/palette.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/icons/hicolor/512x512/palette.png -------------------------------------------------------------------------------- /assets/icons/hicolor/64x64/speed_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/icons/hicolor/64x64/speed_icon.png -------------------------------------------------------------------------------- /assets/screens/main-screen-forecast.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/screens/main-screen-forecast.png -------------------------------------------------------------------------------- /android/assets/screens/location-search.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/android/assets/screens/location-search.png -------------------------------------------------------------------------------- /android/assets/screens/locations-screen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/android/assets/screens/locations-screen.png -------------------------------------------------------------------------------- /assets/icons/hicolor/128x128/speed_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/icons/hicolor/128x128/speed_icon.png -------------------------------------------------------------------------------- /assets/icons/hicolor/256x256/speed_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/icons/hicolor/256x256/speed_icon.png -------------------------------------------------------------------------------- /assets/icons/hicolor/512x512/speed_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/icons/hicolor/512x512/speed_icon.png -------------------------------------------------------------------------------- /android/res/drawable-ldpi/temperature_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/android/res/drawable-ldpi/temperature_icon.png -------------------------------------------------------------------------------- /android/res/drawable-mdpi/temperature_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/android/res/drawable-mdpi/temperature_icon.png -------------------------------------------------------------------------------- /assets/fonts/weathericons-regular-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/fonts/weathericons-regular-webfont.ttf -------------------------------------------------------------------------------- /android/assets/screens/main-screen-forecast.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/android/assets/screens/main-screen-forecast.png -------------------------------------------------------------------------------- /assets/icons/hicolor/64x64/temperature_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/icons/hicolor/64x64/temperature_icon.png -------------------------------------------------------------------------------- /assets/icons/hicolor/128x128/temperature_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/icons/hicolor/128x128/temperature_icon.png -------------------------------------------------------------------------------- /assets/icons/hicolor/256x256/temperature_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/icons/hicolor/256x256/temperature_icon.png -------------------------------------------------------------------------------- /assets/icons/hicolor/512x512/temperature_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vadrian89/cumulus-qt/HEAD/assets/icons/hicolor/512x512/temperature_icon.png -------------------------------------------------------------------------------- /qml/LinkedText.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.0 2 | 3 | Text { 4 | id: root 5 | property string url 6 | MouseArea { 7 | anchors.fill: parent 8 | cursorShape: Qt.PointingHandCursor 9 | onClicked: Qt.openUrlExternally(root.url) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Feb 20 10:43:22 EST 2017 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-3.4-bin.zip 7 | -------------------------------------------------------------------------------- /deployment.pri: -------------------------------------------------------------------------------- 1 | unix:!android { 2 | isEmpty(target.path) { 3 | qnx { 4 | target.path = /tmp/$${TARGET}/bin 5 | } else { 6 | target.path = /opt/$${TARGET}/bin 7 | } 8 | export(target.path) 9 | } 10 | INSTALLS += target 11 | } 12 | 13 | export(INSTALLS) 14 | 15 | DISTFILES += 16 | -------------------------------------------------------------------------------- /docs/multiple_inst.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Cumulus Multiple Instances 4 | --- 5 | 6 | # Cumulus QT 7 | # For multiple instances: 8 | 1. make a new shell script with the following content updated for Cumulus installation path: 9 | #!/bin/bash 10 | \ -i \ 11 | 12 | e.g. /home/user/Cumulus/Cumulus -i NewInstance 13 | 14 | 2. Make the shell script executable: 15 | $sudo chmod +x 16 | -------------------------------------------------------------------------------- /qml/SimpleItem.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.0 2 | 3 | Item { 4 | id: root 5 | property string backgroundColor: "#ffffff" 6 | property double backgroundOpacity: 1.0 7 | property int radius: 0 8 | property int borderWidth: 0 9 | property string borderColor: "transparent" 10 | Rectangle { 11 | anchors.fill: parent 12 | color: root.backgroundColor 13 | opacity: root.backgroundOpacity 14 | radius: root.radius 15 | border.width: root.borderWidth 16 | border.color: root.borderColor 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /qml/ResizeController.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.0 2 | 3 | Item { 4 | id: root 5 | property int cursorShape: Qt.SizeHorCursor 6 | property int xResize: 0 7 | property int yResize: 0 8 | 9 | MouseArea { 10 | id: mouseArea 11 | anchors.fill: parent 12 | acceptedButtons: Qt.LeftButton 13 | cursorShape: root.cursorShape 14 | property variant clickPos 15 | onPressed: clickPos = Qt.point(mouse.x,mouse.y) 16 | onPositionChanged: { 17 | var delta = Qt.point(mouse.x-clickPos.x, mouse.y-clickPos.y) 18 | xResize = delta.x 19 | yResize = delta.y 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /android/res/values/libs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | https://download.qt.io/ministro/android/qt5/qt-5.9 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /CppFiles/WundWeatherController.h: -------------------------------------------------------------------------------- 1 | #ifndef WUNDWEATHERCONTROLLER_H 2 | #define WUNDWEATHERCONTROLLER_H 3 | 4 | #include "AbstractWeatherController.h" 5 | 6 | class WundWeatherController : public AbstractWeatherController { 7 | Q_OBJECT 8 | void getWeatherFromJson(const QJsonObject &jsonObject); 9 | void getForecastFromJson(const QJsonObject &jsonObject); 10 | void getLocationFromJson(const QJsonObject &jsonObject); 11 | void getForecast(const QString &code); 12 | void getAstronomy(const QString &code); 13 | QDate dateFromJson(const QJsonObject &jsonObject); 14 | public: 15 | explicit WundWeatherController(QObject *parent = nullptr); 16 | void searchBycode(QString &code); 17 | void searchByGps(const double &lat, const double &lon); 18 | private slots: 19 | void searchByLocation(QString &location); 20 | void getAstronomyFromJson(const QJsonObject &jsonObject); 21 | }; 22 | 23 | #endif // WUNDWEATHERCONTROLLER_H 24 | -------------------------------------------------------------------------------- /qml/CustomComponents/Item.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.0 2 | import QtGraphicalEffects 1.0 3 | 4 | Item { 5 | id: root 6 | property string backgroundColor: "#ffffff" 7 | property string disabledBgColor: "#a8a8a8" 8 | property string disabledTxtColor: "#000000" 9 | property double backgroundOpacity: 1.0 10 | property int radius: 0 11 | property int borderWidth: 0 12 | property string borderColor: "transparent" 13 | property alias dropShadow: dropShadow 14 | property alias background: background 15 | Rectangle { 16 | id: background 17 | anchors.fill: parent 18 | color: root.enabled ? root.backgroundColor : root.disabledBgColor 19 | opacity: root.backgroundOpacity 20 | radius: root.radius 21 | border.width: root.borderWidth 22 | border.color: root.borderColor 23 | } 24 | DropShadow { 25 | id: dropShadow 26 | visible: false 27 | source: background 28 | anchors.fill: background 29 | color: "#494949" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /qml/CustomControls/SettingsItem.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.0 2 | 3 | CustomButton { 4 | id: root 5 | dropShadow.visible: false 6 | radius: 0 7 | textColor: "#000000" 8 | backgroundColor: "#ffffff" 9 | text.text: "Setting" 10 | text.height: summaryText.visible ? ((root.height / 2) - 5) : root.height 11 | text.horizontalAlignment: Text.AlignLeft 12 | text.verticalAlignment: summaryText.visible ? Text.AlignBottom : Text.AlignVCenter 13 | icon.height: 35 14 | icon.width: 35 15 | property alias summaryText: summaryText 16 | Text { 17 | id: summaryText 18 | text: "Summary" 19 | color: "#606060" 20 | width: root.text.width 21 | height: root.text.height 22 | anchors.left: root.text.anchors.left 23 | anchors.leftMargin: root.text.anchors.leftMargin 24 | anchors.top: root.text.bottom 25 | anchors.topMargin: 5 26 | horizontalAlignment: Text.AlignLeft 27 | verticalAlignment: Text.AlignTop 28 | font.pixelSize: (root.text.font.pixelSize - 2) 29 | wrapMode: Text.NoWrap 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /CppFiles/LocationController.h: -------------------------------------------------------------------------------- 1 | #ifndef LOCATIONCONTROLLER_H 2 | #define LOCATIONCONTROLLER_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #include "DatabaseHelper.h" 11 | class LocationController : public QObject { 12 | Q_OBJECT 13 | QString m_locationName; 14 | public: 15 | double m_lon, m_lat; 16 | explicit LocationController(QObject *parent = nullptr); 17 | void setLocationQuery(const QString &locationQuery); 18 | private slots: 19 | void getLocationFromJson(const QJsonArray &jsonArray); 20 | void getGeoLocation(const QJsonObject &jsonObject); 21 | public slots: 22 | void getLocationList(); 23 | void searchByLocation(); 24 | void searchByCoordinates(); 25 | bool insertLocation(const QString &locationName); 26 | bool deleteLocation(const int &locationId); 27 | signals: 28 | void locationList(const QList &locationList); 29 | void locationSearchList(const QStringList &locationList); 30 | void networkError(const QString &error); 31 | void duplicateLocation(const QString &location); 32 | void locationFromGps(const QString &location); 33 | }; 34 | 35 | #endif // LOCATIONCONTROLLER_H 36 | -------------------------------------------------------------------------------- /qml/GpsLocationItem.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.0 2 | 3 | ClickableItem { 4 | id: root 5 | property int locationId: 0 6 | property alias text: delegateText.text 7 | property alias textColor: delegateText.color 8 | property alias textFontFamily: delegateText.font.family 9 | property alias fontSize: delegateText.font.pixelSize 10 | 11 | backgroundOpacity: (root.isSelected) ? 0.4 : 0.2 12 | hoveredBackgroundOpacity: 0.4 13 | unhoveredBackgroundOpacity: (root.isSelected) ? 0.4 : 0.2 14 | radius: 2 15 | Image { 16 | id: iconImage 17 | anchors.left: parent.left 18 | anchors.leftMargin: 20 19 | anchors.top: parent.top 20 | anchors.topMargin: 10 21 | height: root.height - 20 22 | width: iconImage.height 23 | sourceSize.height: iconImage.height 24 | sourceSize.width: iconImage.width 25 | source: "image://fontimage/\uf14e" + (root.textColor ? root.textColor : "#ffffff") 26 | } 27 | Text { 28 | id: delegateText 29 | anchors.left: iconImage.right 30 | anchors.leftMargin: 10 31 | anchors.top: parent.top 32 | width: (parent.width - iconImage.width - iconImage.anchors.leftMargin - anchors.leftMargin) 33 | height: parent.height 34 | verticalAlignment: Text.AlignVCenter 35 | wrapMode: Text.Wrap 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /CppFiles/CreditsAuthor.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 - 2017 Adrian Verban 3 | * Maintainers: Adrian Verban 4 | * Derived from Typhoon by Archisman Panigrahi which is based on Stormcloud by Jono Cooper 5 | * Thanks to all the contributors. 6 | * Using the Ubuntu Condensed font. 7 | * This file is part of Cumulus. 8 | # 9 | * Cumulus is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | # 14 | * Cumulus is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | # 19 | * You should have received a copy of the GNU General Public License 20 | * along with Cumulus. If not, see . 21 | */ 22 | #include "CreditsAuthor.h" 23 | 24 | CreditsAuthor::CreditsAuthor(QObject *parent) : QObject(parent){} 25 | 26 | CreditsAuthor::CreditsAuthor(QObject *parent, QString author, QString authorUrl, QString icon, QString license) 27 | : QObject(parent){ 28 | m_author = author; 29 | m_authorUrl = authorUrl; 30 | m_icon = icon; 31 | m_license = license; 32 | } 33 | -------------------------------------------------------------------------------- /qml/ClickableItem.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.0 2 | 3 | SimpleItem { 4 | property double hoveredBackgroundOpacity: backgroundOpacity 5 | property double unhoveredBackgroundOpacity: backgroundOpacity 6 | signal clicked() 7 | signal entered() 8 | signal exited() 9 | signal pressed() 10 | signal released() 11 | signal containsMouseChanged(bool containsMouse) 12 | MouseArea { 13 | anchors.fill: parent 14 | hoverEnabled: true 15 | onClicked: parent.clicked() 16 | onEntered: { 17 | parent.backgroundOpacity = parent.hoveredBackgroundOpacity 18 | parent.entered() 19 | } 20 | onExited: { 21 | parent.backgroundOpacity = parent.unhoveredBackgroundOpacity 22 | parent.exited() 23 | } 24 | onPressed: { 25 | parent.backgroundOpacity = parent.hoveredBackgroundOpacity 26 | parent.pressed() 27 | } 28 | onReleased: { 29 | parent.backgroundOpacity = parent.unhoveredBackgroundOpacity 30 | parent.released() 31 | } 32 | onContainsMouseChanged: { 33 | parent.containsMouseChanged(containsMouse) 34 | if (!containsMouse) 35 | parent.backgroundOpacity = parent.unhoveredBackgroundOpacity 36 | else 37 | parent.backgroundOpacity = parent.hoveredBackgroundOpacity 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /CppFiles/CustomImageProvider.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Adrian Verban 3 | * Maintainers: Adrian Verban 4 | * Derived from Typhoon by Archisman Panigrahi which is based on Stormcloud by Jono Cooper 5 | * Thanks to all the contributors. 6 | * Using the Ubuntu Condensed font. 7 | * This file is part of Cumulus. 8 | # 9 | * Cumulus is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | # 14 | * Cumulus is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | # 19 | * You should have received a copy of the GNU General Public License 20 | * along with Cumulus. If not, see . 21 | */ 22 | #ifndef CUSTOMIMAGEPROVIDER_H 23 | #define CUSTOMIMAGEPROVIDER_H 24 | 25 | #include 26 | #include 27 | 28 | class CustomImageProvider : public QQuickImageProvider { 29 | public: 30 | CustomImageProvider(); 31 | QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize); 32 | QImage getImageFromText(const QString &text, const QString &color, const int &width, const int &height); 33 | }; 34 | 35 | #endif // CUSTOMIMAGEPROVIDER_H 36 | -------------------------------------------------------------------------------- /CppFiles/FontImageProvider.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Adrian Verban 3 | * Maintainers: Adrian Verban 4 | * Derived from Typhoon by Archisman Panigrahi which is based on Stormcloud by Jono Cooper 5 | * Thanks to all the contributors. 6 | * Using the Ubuntu Condensed font. 7 | * This file is part of Cumulus. 8 | # 9 | * Cumulus is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | # 14 | * Cumulus is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | # 19 | * You should have received a copy of the GNU General Public License 20 | * along with Cumulus. If not, see . 21 | */ 22 | #ifndef FONTIMAGEPROVIDER_H 23 | #define FONTIMAGEPROVIDER_H 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | class FontImageProvider : public QQuickImageProvider { 32 | public: 33 | FontImageProvider(); 34 | QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize); 35 | QImage getImageFromText(const QString &text, const QString &color, const int &width, const int &height); 36 | }; 37 | 38 | #endif // FONTIMAGEPROVIDER_H 39 | -------------------------------------------------------------------------------- /CppFiles/ThreadWorker.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 - 2017 Adrian Verban 3 | * Maintainers: Adrian Verban 4 | * Derived from Typhoon by Archisman Panigrahi which is based on Stormcloud by Jono Cooper 5 | * Thanks to all the contributors. 6 | * Using the Ubuntu Condensed font. 7 | * This file is part of Cumulus. 8 | # 9 | * Cumulus is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | # 14 | * Cumulus is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | # 19 | * You should have received a copy of the GNU General Public License 20 | * along with Cumulus. If not, see . 21 | */ 22 | #ifndef THREADWORKER_H 23 | #define THREADWORKER_H 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | class ThreadWorker : public QObject { 36 | Q_OBJECT 37 | public: 38 | explicit ThreadWorker(QObject *parent = 0); 39 | public slots: 40 | void updaterTimerStart(); 41 | private slots: 42 | void startLookingForUpdates(); 43 | signals: 44 | void startUpdateTimerSignal(); 45 | void stopUpdatesSearch(); 46 | }; 47 | 48 | #endif // THREADWORKER_H 49 | -------------------------------------------------------------------------------- /qml/MenuButton.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 - 2017 Adrian Verban 3 | * Maintainers: Adrian Verban 4 | * Derived from Typhoon by Archisman Panigrahi which is based on Stormcloud by Jono Cooper 5 | * Thanks to all the contributors. 6 | * Using the Ubuntu Condensed font. 7 | * This file is part of Cumulus. 8 | # 9 | * Cumulus is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | # 14 | * Cumulus is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | # 19 | * You should have received a copy of the GNU General Public License 20 | * along with Cumulus. If not, see . 21 | */ 22 | import QtQuick 2.0 23 | 24 | ClickableItem { 25 | id: root 26 | backgroundOpacity: 0 27 | property double hoveredIconOpacity: 1.0 28 | property double unhoveredIconOpacity: 0.8 29 | property string imageSource: "" 30 | Image { 31 | id: buttonIcon 32 | opacity: 0.8 33 | anchors.centerIn: parent 34 | height: parent.height 35 | width: parent.width 36 | source: root.imageSource 37 | sourceSize.width: width 38 | sourceSize.height: height 39 | } 40 | onEntered: buttonIcon.opacity = hoveredIconOpacity 41 | onExited: buttonIcon.opacity = unhoveredIconOpacity 42 | } 43 | -------------------------------------------------------------------------------- /CppFiles/MainWindow.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Adrian Verban 3 | * Maintainers: Adrian Verban 4 | * Derived from Typhoon by Archisman Panigrahi which is based on Stormcloud by Jono Cooper 5 | * Thanks to all the contributors. 6 | * Using the Ubuntu Condensed font. 7 | * This file is part of Cumulus. 8 | # 9 | * Cumulus is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | # 14 | * Cumulus is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | # 19 | * You should have received a copy of the GNU General Public License 20 | * along with Cumulus. If not, see . 21 | */ 22 | #ifndef MAINWINDOW_H 23 | #define MAINWINDOW_H 24 | 25 | #include 26 | #include "SettingsController.h" 27 | 28 | class MainWindow : public QMainWindow { 29 | Q_OBJECT 30 | void saveSettings(); 31 | void registerQmlType(); 32 | bool m_closeApp; 33 | SettingsController *settingsController; 34 | public: 35 | explicit MainWindow(QWidget *parent = nullptr); 36 | ~MainWindow(); 37 | void closeEvent(QCloseEvent *event); 38 | void launchApp(); 39 | public slots: 40 | void loadSettings(); 41 | void closeApp(); 42 | void moveWindow(const QPoint &mousePosition); 43 | void minimizeWindow(); 44 | }; 45 | 46 | #endif // MAINWINDOW_H 47 | -------------------------------------------------------------------------------- /CppFiles/FontImageProvider.cpp: -------------------------------------------------------------------------------- 1 | #include "FontImageProvider.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | FontImageProvider::FontImageProvider() : QQuickImageProvider(QQuickImageProvider::Image) {} 8 | 9 | QImage FontImageProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize) { 10 | int width = 22; 11 | int height = 22; 12 | QString text = "no text"; 13 | QString color = "#ffffff"; 14 | QStringList stringList = id.split(QRegExp("[#]")); 15 | if (stringList.size() < 3) { 16 | text = stringList.at(0); 17 | color = "#" + stringList.at(1); 18 | } 19 | if (size) 20 | *size = QSize(width, height); 21 | return getImageFromText(text, color, requestedSize.width() > 0 ? requestedSize.width() : width, 22 | requestedSize.height() > 0 ? requestedSize.height() : height); 23 | } 24 | 25 | QImage FontImageProvider::getImageFromText(const QString &text, const QString &color, const int &width, const int &height) { 26 | int id = QFontDatabase::addApplicationFont(":/assets/fonts/fontawesome.ttf"); 27 | if (id < 0) 28 | qDebug() << "Font not loaded"; 29 | QString family = QFontDatabase::applicationFontFamilies(id).at(0); 30 | QFont fontAwesome(family); 31 | fontAwesome.setPixelSize(height * 60 / 100); 32 | QImage image(width, height, QImage::Format_ARGB32_Premultiplied); 33 | image.fill(Qt::transparent); 34 | QPainter painter(&image); 35 | painter.setFont(fontAwesome); 36 | painter.setPen(QColor(color)); 37 | painter.setRenderHint(QPainter::TextAntialiasing); 38 | painter.drawText(image.rect(), Qt::AlignCenter, text); 39 | return image; 40 | } 41 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | jcenter() 4 | } 5 | 6 | dependencies { 7 | classpath 'com.android.tools.build:gradle:2.2.3' 8 | } 9 | } 10 | 11 | allprojects { 12 | repositories { 13 | jcenter() 14 | } 15 | } 16 | 17 | apply plugin: 'com.android.application' 18 | 19 | dependencies { 20 | compile fileTree(dir: 'libs', include: ['*.jar']) 21 | } 22 | 23 | android { 24 | /******************************************************* 25 | * The following variables: 26 | * - androidBuildToolsVersion, 27 | * - androidCompileSdkVersion 28 | * - qt5AndroidDir - holds the path to qt android files 29 | * needed to build any Qt application 30 | * on Android. 31 | * 32 | * are defined in gradle.properties file. This file is 33 | * updated by QtCreator and androiddeployqt tools. 34 | * Changing them manually might break the compilation! 35 | *******************************************************/ 36 | 37 | compileSdkVersion androidCompileSdkVersion.toInteger() 38 | 39 | buildToolsVersion androidBuildToolsVersion 40 | 41 | sourceSets { 42 | main { 43 | manifest.srcFile 'AndroidManifest.xml' 44 | java.srcDirs = [qt5AndroidDir + '/src', 'src', 'java'] 45 | aidl.srcDirs = [qt5AndroidDir + '/src', 'src', 'aidl'] 46 | res.srcDirs = [qt5AndroidDir + '/res', 'res'] 47 | resources.srcDirs = ['src'] 48 | renderscript.srcDirs = ['src'] 49 | assets.srcDirs = ['assets'] 50 | jniLibs.srcDirs = ['libs'] 51 | } 52 | } 53 | 54 | lintOptions { 55 | abortOnError false 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /CppFiles/YWeatherController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 - 2017 Adrian Verban 3 | * Maintainers: Adrian Verban 4 | * Derived from Typhoon by Archisman Panigrahi which is based on Stormcloud by Jono Cooper 5 | * Thanks to all the contributors. 6 | * Using the Ubuntu Condensed font. 7 | * This file is part of Cumulus. 8 | # 9 | * Cumulus is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | # 14 | * Cumulus is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | # 19 | * You should have received a copy of the GNU General Public License 20 | * along with Cumulus. If not, see . 21 | */ 22 | #ifndef YWEATHERCONTROLLER_H 23 | #define YWEATHERCONTROLLER_H 24 | 25 | #include "AbstractWeatherController.h" 26 | 27 | 28 | class YWeatherController : public AbstractWeatherController { 29 | Q_OBJECT 30 | void getWeatherFromJson(const QJsonObject &jsonObject); 31 | void getForecastFromJson(const QJsonObject &jsonObject); 32 | void getLocationFromJson(const QJsonObject &jsonObject); 33 | void getForecast(const QString &code); 34 | public: 35 | explicit YWeatherController(QObject *parent = 0); 36 | void searchByLocation(QString &location); 37 | void searchBycode(QString &code); 38 | void searchByGps(const double &lat, const double &lon); 39 | }; 40 | 41 | #endif // YWEATHERCONTROLLER_H 42 | -------------------------------------------------------------------------------- /CppFiles/OwmWeatherController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 - 2017 Adrian Verban 3 | * Maintainers: Adrian Verban 4 | * Derived from Typhoon by Archisman Panigrahi which is based on Stormcloud by Jono Cooper 5 | * Thanks to all the contributors. 6 | * Using the Ubuntu Condensed font. 7 | * This file is part of Cumulus. 8 | # 9 | * Cumulus is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | # 14 | * Cumulus is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | # 19 | * You should have received a copy of the GNU General Public License 20 | * along with Cumulus. If not, see . 21 | */ 22 | #ifndef OWMWEATHERCONTROLLER_H 23 | #define OWMWEATHERCONTROLLER_H 24 | 25 | #include "AbstractWeatherController.h" 26 | 27 | class OwmWeatherController : public AbstractWeatherController { 28 | Q_OBJECT 29 | void getWeatherFromJson(const QJsonObject &jsonObject); 30 | void getForecastFromJson(const QJsonObject &jsonObject); 31 | void getLocationFromJson(const QJsonObject &jsonObject); 32 | void getForecast(const QString &code); 33 | public: 34 | explicit OwmWeatherController(QObject *parent = 0); 35 | void searchByLocation(QString &location); 36 | void searchBycode(QString &code); 37 | void searchByGps(const double &lat, const double &lon); 38 | }; 39 | 40 | #endif // OWMWEATHERCONTROLLER_H 41 | -------------------------------------------------------------------------------- /qml.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | qml/ApplicationBar.qml 4 | qml/ColorPalleteButton.qml 5 | qml/CreditsListDelegate.qml 6 | qml/CreditsView.qml 7 | qml/CustomSwitch.qml 8 | qml/ForecastView.qml 9 | qml/LinkedText.qml 10 | qml/main-android.qml 11 | qml/MenuButton.qml 12 | qml/ResizeController.qml 13 | qml/SearchLocation.qml 14 | qml/SelectionButton.qml 15 | qml/SettingsOptionItem.qml 16 | qml/SettingsWindow.qml 17 | qml/WeatherInfoItem.qml 18 | qml/WeatherWindow.qml 19 | assets/fonts/fontawesome.ttf 20 | assets/fonts/Ubuntu-C.ttf 21 | assets/fonts/weathericons-regular-webfont.ttf 22 | qml/main-desktop.qml 23 | assets/weather_codes.json 24 | qml/SimpleItem.qml 25 | qml/MainView.qml 26 | qml/LocationView.qml 27 | qml/LocationItemDelegate.qml 28 | qml/ClickableItem.qml 29 | qml/GpsLocationItem.qml 30 | qml/ForecastItemDelegate.qml 31 | qml/CustomComponents/ClickableItem.qml 32 | qml/CustomComponents/Item.qml 33 | qml/CustomControls/Button.qml 34 | qml/WelcomeView.qml 35 | translations/tempestas_ro.po 36 | translations/tempestas_ro.qm 37 | qml/CustomControls/CustomButton.qml 38 | qml/CustomControls/SettingsItem.qml 39 | 40 | 41 | -------------------------------------------------------------------------------- /CppFiles/CreditsAuthor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 - 2017 Adrian Verban 3 | * Maintainers: Adrian Verban 4 | * Derived from Typhoon by Archisman Panigrahi which is based on Stormcloud by Jono Cooper 5 | * Thanks to all the contributors. 6 | * Using the Ubuntu Condensed font. 7 | * This file is part of Cumulus. 8 | # 9 | * Cumulus is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | # 14 | * Cumulus is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | # 19 | * You should have received a copy of the GNU General Public License 20 | * along with Cumulus. If not, see . 21 | */ 22 | #ifndef CREDITSAUTHOR_H 23 | #define CREDITSAUTHOR_H 24 | 25 | #include 26 | 27 | class CreditsAuthor : public QObject { 28 | Q_OBJECT 29 | QString m_author, m_authorUrl, m_icon, m_license; 30 | Q_PROPERTY(QString author MEMBER m_author NOTIFY authorChanged) 31 | Q_PROPERTY(QString authorUrl MEMBER m_authorUrl NOTIFY authorUrlChanged) 32 | Q_PROPERTY(QString icon MEMBER m_icon NOTIFY iconChanged) 33 | Q_PROPERTY(QString license MEMBER m_license NOTIFY licenseChanged) 34 | public: 35 | explicit CreditsAuthor(QObject *parent = nullptr); 36 | explicit CreditsAuthor(QObject *parent = nullptr, QString author = "", QString authorUrl = "", QString icon = "", QString license = ""); 37 | signals: 38 | void authorChanged(); 39 | void authorUrlChanged(); 40 | void iconChanged(); 41 | void licenseChanged(); 42 | }; 43 | 44 | #endif // CREDITSAUTHOR_H 45 | -------------------------------------------------------------------------------- /CppFiles/DataController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 - 2017 Adrian Verban 3 | * Maintainers: Adrian Verban 4 | * Derived from Typhoon by Archisman Panigrahi which is based on Stormcloud by Jono Cooper 5 | * Thanks to all the contributors. 6 | * Using the Ubuntu Condensed font. 7 | * This file is part of Cumulus. 8 | # 9 | * Cumulus is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | # 14 | * Cumulus is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | # 19 | * You should have received a copy of the GNU General Public License 20 | * along with Cumulus. If not, see . 21 | */ 22 | #ifndef DATACONTROLLER_H 23 | #define DATACONTROLLER_H 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | class DataController : public QObject { 36 | Q_OBJECT 37 | QNetworkAccessManager *networkManager; 38 | QJsonObject receivedData; 39 | public: 40 | explicit DataController(QObject *parent = 0); 41 | void getDataFromUrl(QString urlString); 42 | void getJsonArrayDataFromUrl(QString urlString); 43 | QString managerError() const; 44 | private slots: 45 | void readFinished(QNetworkReply *reply); 46 | void readJsonArrayFinished(QNetworkReply *reply); 47 | signals: 48 | void jsonObjectReady(QJsonObject); 49 | void jsonArrayReady(QJsonArray); 50 | void networkError(const QString &error); 51 | }; 52 | 53 | #endif // DATACONTROLLER_H 54 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: cpp 2 | compiler: gcc 3 | sudo: require 4 | dist: trusty 5 | 6 | before_install: 7 | - sudo add-apt-repository ppa:beineri/opt-qt596-trusty -y 8 | - sudo apt-get update -qq 9 | 10 | install: 11 | - sudo apt-get -y install qt59base qt59declarative qt59quickcontrols qt59quickcontrols2 qt59graphicaleffects qt59location 12 | - source /opt/qt*/bin/qt*-env.sh 13 | 14 | script: 15 | - qmake PREFIX=/usr 16 | - make -j$(nproc) 17 | - mkdir -p appdir/usr/bin 18 | - mkdir -p appdir/usr/share/applications 19 | - mkdir -p appdir/usr/share/icons/hicolor/512x512/apps 20 | - mkdir -p appdir/usr/share/assets/screens 21 | - cp Cumulus appdir/usr/bin/ 22 | - cp assets/icons/*.png appdir/usr/share/icons/ 23 | - cp assets/icons/hicolor/512x512/* appdir/usr/share/icons/ 24 | - cp assets/icons/hicolor/512x512/cumulus.* appdir/ 25 | - cp assets/icons/hicolor/512x512/cumulus.* appdir/usr/share/icons/hicolor/512x512/apps/ 26 | - cp assets/screens/* appdir/usr/share/assets/screens/ 27 | - echo "[Desktop Entry]" > appdir/cumulus.desktop 28 | - echo "Name=Cumulus" >> appdir/cumulus.desktop 29 | - echo "Icon=cumulus" >> appdir/cumulus.desktop 30 | - echo "Exec=Cumulus" >> appdir/cumulus.desktop 31 | - echo "Type=Application" >> appdir/cumulus.desktop 32 | - echo "Categories=Utility;" >> appdir/cumulus.desktop 33 | - cp appdir/cumulus.desktop appdir/usr/share/applications/ 34 | 35 | after_success: 36 | - wget -c "https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage" 37 | - chmod a+x linuxdeployqt*.AppImage 38 | - unset QTDIR; unset QT_PLUGIN_PATH ; unset LD_LIBRARY_PATH 39 | - ./linuxdeployqt*.AppImage appdir/usr/share/applications/*desktop -bundle-non-qt-libs -appimage -no-translations -qmldir=qml 40 | - find ./appdir -executable -type f -exec ldd {} \; | grep " => /usr" | cut -d " " -f 2-3 | sort | uniq 41 | - curl --upload-file ./Cumulus*.AppImage https://transfer.sh/Cumulus-git.$(git rev-parse --short HEAD)-x86_64.AppImage 42 | 43 | -------------------------------------------------------------------------------- /assets/icons/hicolor/scalable/cumulus.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 11 | 16 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /docs/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | layout: default 3 | title: Cumulus 4 | --- 5 | 6 | # Cumulus QT 7 | ## About 8 | Cumulus is a simple weather application, with a back end powered by: 9 | - [Yahoo! Weather](http://weather.yahoo.com) 10 | - [Open Weather Map](http://openweathermap.org/) 11 | - [Weather Underground](https://www.wunderground.com/?apiref=697599e3b1e7adec) 12 | 13 | This is a port to Qt/Qml of the [original cumulus](legacy_cumulus.md) 14 | 15 | ![weather](assets/images/weather.gif) ![location](assets/images/location.png) 16 | 17 | ## Features 18 | - Colors selectors for background and text with alpha channel, knock yourselves up out 19 | - Re-sizable window with weather data adjusting accordingly 20 | - Units recalculations on-the-fly without data needed to be re-downloaded 21 | - Tray icon, with additional data to be added on menu :) 22 | - Qt installer, without root installation to allow future updates fast without breaking on upgrade 23 | - Possibility for multiple instances with different settings and locations [Read Here](multiple_inst.md) 24 | 25 | ## Install/Update 26 | 1. Download installer for x64 bit Linux distributions 27 | - [Linux amd64](https://github.com/vadrian89/cumulus-qt/releases/) 28 | 2. Mark installer executable 29 | `$sudo chmod +x Cumulus-online-installer-x64` 30 | 3. Run 31 | `$./Cumulus-online-installer-x64` 32 | 4. Enjoy! 33 | 34 | ## Known Issues 35 | - The resizing is a bit haotic on Linux-based OSes, looking into it. 36 | 37 | ## History 38 | Forked from [typhoon](https://github.com/apandada1/typhoon) which was 39 | Based on [Stormcloud](https://github.com/consindo/stormcloud/) by [Jono Cooper](https://twitter.com/consindo) 40 | 41 | ## Major Thanks 42 | - [Adrian Verban](https://github.com/vadrian89) 43 | - [Daryl Bennett](https://github.com/kd8bny) 44 | - [Archisman Panigrahi](https://github.com/apandada1) 45 | - [Adam Whitcroft](https://twitter.com/AdamWhitcroft), for his fonts used in original Typhoon/Cumulus 46 | - [Erik Flowers](https://github.com/erikflowers) for his [weather icons](https://github.com/erikflowers/weather-icons), 47 | which sadly has discontinued support for them 48 | -------------------------------------------------------------------------------- /qml/ColorPalleteButton.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 - 2017 Adrian Verban 3 | * Maintainers: Adrian Verban 4 | * Derived from Typhoon by Archisman Panigrahi which is based on Stormcloud by Jono Cooper 5 | * Thanks to all the contributors. 6 | * Using the Ubuntu Condensed font. 7 | * This file is part of Cumulus. 8 | # 9 | * Cumulus is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | # 14 | * Cumulus is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | # 19 | * You should have received a copy of the GNU General Public License 20 | * along with Cumulus. If not, see . 21 | */ 22 | import QtQuick 2.0 23 | import QtQuick.Layouts 1.0 24 | 25 | Item { 26 | id: root 27 | property string text 28 | property string textColor 29 | property string backgroundColor 30 | property string buttonBorderColor: "#FFFFFF" 31 | signal clicked() 32 | 33 | RowLayout { 34 | anchors.fill: parent 35 | spacing: 10 36 | Text { 37 | Layout.fillHeight: true 38 | Layout.fillWidth: true 39 | color: root.textColor 40 | text: root.text 41 | horizontalAlignment: Text.AlignRight 42 | verticalAlignment: Text.AlignVCenter 43 | } 44 | Rectangle { 45 | Layout.fillHeight: false 46 | Layout.fillWidth: false 47 | Layout.preferredHeight: 30 48 | Layout.preferredWidth: 30 49 | color: root.backgroundColor 50 | radius: 15 51 | border.width: 2 52 | border.color: root.buttonBorderColor 53 | MouseArea { 54 | anchors.fill: parent 55 | cursorShape: Qt.PointingHandCursor 56 | onClicked: root.clicked() 57 | } 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /qml/LocationItemDelegate.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.0 2 | 3 | ClickableItem { 4 | id: root 5 | property int locationId: 0 6 | property alias text: delegateText.text 7 | property alias textColor: delegateText.color 8 | property alias textFontFamily: delegateText.font.family 9 | property alias fontSize: delegateText.font.pixelSize 10 | property bool isSelected: false 11 | signal clickedDelete() 12 | 13 | backgroundOpacity: (root.isSelected) ? 0.4 : 0.2 14 | hoveredBackgroundOpacity: 0.4 15 | unhoveredBackgroundOpacity: (root.isSelected) ? 0.4 : 0.2 16 | radius: 2 17 | Image { 18 | id: selectedImage 19 | anchors.right: left.right 20 | anchors.rightMargin: 10 21 | anchors.top: parent.top 22 | anchors.topMargin: 10 23 | height: root.height - 20 24 | width: selectedImage.height 25 | sourceSize.height: selectedImage.height 26 | sourceSize.width: selectedImage.width 27 | source: "image://fontimage/\uf00c" + (root.textColor ? root.textColor : "#ffffff") 28 | visible: root.isSelected 29 | } 30 | Text { 31 | id: delegateText 32 | anchors.left: selectedImage.right 33 | anchors.leftMargin: 10 34 | anchors.top: parent.top 35 | width: (parent.width - selectedImage.width - deleteButton.width) 36 | height: parent.height 37 | verticalAlignment: Text.AlignVCenter 38 | wrapMode: Text.Wrap 39 | } 40 | ClickableItem { 41 | id: deleteButton 42 | anchors.right: parent.right 43 | anchors.rightMargin: 10 44 | anchors.top: parent.top 45 | anchors.topMargin: 10 46 | width: deleteButton.height 47 | height: root.height - 20 48 | visible: true 49 | backgroundOpacity: 0.0 50 | hoveredBackgroundOpacity: backgroundOpacity 51 | unhoveredBackgroundOpacity: backgroundOpacity 52 | Image { 53 | anchors.fill: parent 54 | sourceSize.height: selectedImage.height 55 | sourceSize.width: selectedImage.width 56 | source: "image://fontimage/\uf1f8" + (root.textColor ? root.textColor : "#ffffff") 57 | } 58 | onClicked: root.clickedDelete() 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /qml/SelectionButton.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 - 2017 Adrian Verban 3 | * Maintainers: Adrian Verban 4 | * Derived from Typhoon by Archisman Panigrahi which is based on Stormcloud by Jono Cooper 5 | * Thanks to all the contributors. 6 | * Using the Ubuntu Condensed font. 7 | * This file is part of Cumulus. 8 | # 9 | * Cumulus is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | # 14 | * Cumulus is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | # 19 | * You should have received a copy of the GNU General Public License 20 | * along with Cumulus. If not, see . 21 | */ 22 | import QtQuick 2.0 23 | import QtQuick.Controls 1.4 24 | 25 | Item { 26 | id: rootItem 27 | signal clicked(); 28 | property alias buttonText: buttonText.text 29 | property alias backgroundColor: buttonRectangle.color 30 | 31 | Rectangle { 32 | id: buttonRectangle 33 | anchors.fill: parent 34 | color: "#333333"; 35 | border.width: 2 36 | border.color: "#222222" 37 | Text { 38 | id: buttonText 39 | color: "#ffffff" 40 | horizontalAlignment: Text.AlignHCenter 41 | verticalAlignment: Text.AlignVCenter 42 | font.pixelSize: 14 43 | anchors.centerIn: parent 44 | } 45 | MouseArea { 46 | anchors.fill: parent 47 | hoverEnabled: true 48 | cursorShape: Qt.PointingHandCursor 49 | onHoveredChanged: { 50 | if (containsMouse == true) { 51 | parent.color = "#555555"; 52 | } 53 | else { 54 | parent.color = "#333333"; 55 | } 56 | } 57 | onClicked: { 58 | rootItem.clicked() 59 | } 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /qml/WeatherInfoItem.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 - 2017 Adrian Verban 3 | * Maintainers: Adrian Verban 4 | * Derived from Typhoon by Archisman Panigrahi which is based on Stormcloud by Jono Cooper 5 | * Thanks to all the contributors. 6 | * Using the Ubuntu Condensed font. 7 | * This file is part of Cumulus. 8 | # 9 | * Cumulus is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | # 14 | * Cumulus is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | # 19 | * You should have received a copy of the GNU General Public License 20 | * along with Cumulus. If not, see . 21 | */ 22 | import QtQuick 2.0 23 | 24 | Item { 25 | id: root 26 | property string icon 27 | property string infoText 28 | property string iconFont 29 | property int fontSize 30 | property string fontFamily 31 | property string fontColor 32 | property alias iconRotation: dataIcon.rotation 33 | property bool fontBold: false 34 | 35 | Text { 36 | id: dataIcon 37 | anchors.left: root.left 38 | anchors.top: root.top 39 | width: root.width * 20 / 100 40 | height: root.height 41 | font.pixelSize: fontSize 42 | font.family: iconFont 43 | font.bold: fontBold 44 | color: fontColor 45 | horizontalAlignment: Text.AlignHCenter 46 | verticalAlignment: Text.AlignVCenter 47 | text: icon 48 | } 49 | Text { 50 | id: dataText 51 | anchors.left: dataIcon.right 52 | anchors.leftMargin: 10 53 | anchors.top: root.top 54 | width: root.width - dataIcon.width 55 | height: root.height 56 | font.pixelSize: fontSize 57 | font.family: fontFamily 58 | font.bold: fontBold 59 | color: fontColor 60 | horizontalAlignment: Text.AlignLeft 61 | verticalAlignment: Text.AlignVCenter 62 | text: infoText 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /qml/CustomControls/Button.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.0 2 | 3 | import "../CustomComponents" as CoreItems 4 | 5 | CoreItems.ClickableItem { 6 | id: root 7 | width: 150 8 | height: 50 9 | radius: 5 10 | backgroundColor: "#bfbfbf" 11 | background.color: !enabled ? disabledBgColor : backgroundColor 12 | dropShadow.visible: true 13 | dropShadow.antialiasing: true 14 | dropShadow.radius: 12 15 | dropShadow.samples: 25 16 | dropShadow.transparentBorder: true 17 | property string textColor: "#ffffff" 18 | property bool checkable: false 19 | property bool checked: false 20 | property alias icon: icon 21 | property alias text: text 22 | Rectangle { 23 | id: clickedLayer 24 | anchors.fill: parent 25 | color: "#000000" 26 | opacity: 0.1 27 | visible: false 28 | radius: parent.radius 29 | z: 0 30 | } 31 | Image { 32 | id: icon 33 | visible: false 34 | anchors.left: parent.left 35 | anchors.leftMargin: 10 36 | anchors.top: parent.top 37 | anchors.topMargin: ((root.height / 2) - (height / 2)) 38 | width: height 39 | height: (root.height * 0.6) 40 | sourceSize.width: width 41 | sourceSize.height: height 42 | horizontalAlignment: Image.AlignHCenter 43 | verticalAlignment: Image.AlignVCenter 44 | z: 1 45 | } 46 | Text { 47 | id: text 48 | visible: (text.text.trim().length > 0) 49 | anchors.left: icon.visible ? icon.right : parent.left 50 | anchors.leftMargin: 5 51 | anchors.top: parent.top 52 | width: (text.visible && icon.visible) ? (root.width - icon.width - icon.anchors.leftMargin - anchors.leftMargin * 2) : (root.width - anchors.leftMargin * 2) 53 | height: root.height 54 | font.pixelSize: 14 55 | horizontalAlignment: Text.AlignHCenter 56 | verticalAlignment: Text.AlignVCenter 57 | color: root.enabled ? root.textColor : root.disabledTxtColor 58 | z: 2 59 | } 60 | onPressed: { 61 | if (!ripple) 62 | clickedLayer.visible = true 63 | } 64 | onReleased: { 65 | if (!ripple) 66 | clickedLayer.visible = false 67 | if (checkable && containsMouse) 68 | root.checked = !root.checked 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /qml/CustomControls/CustomButton.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.0 2 | 3 | import "../CustomComponents" as CoreItems 4 | 5 | CoreItems.ClickableItem { 6 | id: root 7 | width: 150 8 | height: 50 9 | radius: 5 10 | background.color: !enabled ? disabledBgColor : backgroundColor 11 | dropShadow.visible: true 12 | dropShadow.antialiasing: true 13 | dropShadow.radius: 12 14 | dropShadow.samples: 25 15 | dropShadow.transparentBorder: true 16 | property alias text: buttonText 17 | property alias icon: icon 18 | property bool checkable: false 19 | property bool checked: false 20 | property string disabledTxtColor: "#000000" 21 | property string textColor: "#ffffff" 22 | property string backgroundColor: "#bfbfbf" 23 | Rectangle { 24 | id: clickedLayer 25 | anchors.fill: parent 26 | color: "#000000" 27 | opacity: 0.1 28 | visible: false 29 | radius: root.radius 30 | z: 0 31 | } 32 | Image { 33 | id: icon 34 | visible: false 35 | anchors.left: root.left 36 | anchors.leftMargin: 10 37 | anchors.top: root.top 38 | anchors.topMargin: ((root.height / 2) - (height / 2)) 39 | width: height 40 | height: (root.height * 0.6) 41 | sourceSize.width: width 42 | sourceSize.height: height 43 | horizontalAlignment: Image.AlignHCenter 44 | verticalAlignment: Image.AlignVCenter 45 | z: 1 46 | } 47 | Text { 48 | id: buttonText 49 | text: "Button" 50 | anchors.left: icon.visible ? icon.right : root.left 51 | anchors.leftMargin: 5 52 | anchors.top: root.top 53 | width: icon.visible ? (root.width - icon.width - icon.anchors.leftMargin - (anchors.leftMargin * 2)) : (root.width - (anchors.leftMargin * 2)) 54 | height: root.height 55 | horizontalAlignment: Text.AlignHCenter 56 | verticalAlignment: Text.AlignVCenter 57 | wrapMode: Text.Wrap 58 | color: root.enabled ? root.textColor : root.disabledTxtColor 59 | } 60 | onPressed: { 61 | if (!ripple) 62 | clickedLayer.visible = true 63 | } 64 | onReleased: { 65 | if (!ripple) 66 | clickedLayer.visible = false 67 | if (checkable && containsMouse) 68 | root.checked = !root.checked 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /qml/ForecastView.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 - 2017 Adrian Verban 3 | * Maintainers: Adrian Verban 4 | * Derived from Typhoon by Archisman Panigrahi which is based on Stormcloud by Jono Cooper 5 | * Thanks to all the contributors. 6 | * Using the Ubuntu Condensed font. 7 | * This file is part of Cumulus. 8 | # 9 | * Cumulus is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | # 14 | * Cumulus is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | # 19 | * You should have received a copy of the GNU General Public License 20 | * along with Cumulus. If not, see . 21 | */ 22 | import QtQuick 2.0 23 | 24 | Item { 25 | id: root 26 | property string fontFamily: "Arial" 27 | property string fontColor: "#ffffff" 28 | property string iconsFontFamily: "" 29 | property int fontSize: 20 30 | property alias viewModel: forecastList.model 31 | property int widthBreakPoint: 200 32 | 33 | ListView { 34 | id: forecastList 35 | anchors.fill: parent 36 | orientation: ListView.Vertical 37 | clip: true 38 | spacing: 2 39 | snapMode: ListView.SnapToItem 40 | delegate: ForecastItemDelegate { 41 | width: forecastList.width 42 | height: 60 43 | stringFont: root.fontFamily 44 | iconFont: root.iconsFontFamily 45 | fontColor: root.fontColor 46 | forecastDay: model.modelData.forecastDate 47 | forecastIcon: model.modelData.weatherIcon 48 | forecastTempHigh: model.modelData.tempHigh + "°" 49 | forecastTempLow: model.modelData.tempLow + "°" 50 | forecastDesc: model.modelData.forecastDesc 51 | radius: 2 52 | widthBreakPoint: root.widthBreakPoint 53 | } 54 | onModelChanged: positionViewAtBeginning() 55 | onWidthChanged: positionViewAtBeginning() 56 | onHeightChanged: positionViewAtBeginning() 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /CppFiles/CustomImageProvider.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2017 Adrian Verban 3 | * Maintainers: Adrian Verban 4 | * Derived from Typhoon by Archisman Panigrahi which is based on Stormcloud by Jono Cooper 5 | * Thanks to all the contributors. 6 | * Using the Ubuntu Condensed font. 7 | * This file is part of Cumulus. 8 | # 9 | * Cumulus is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | # 14 | * Cumulus is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | # 19 | * You should have received a copy of the GNU General Public License 20 | * along with Cumulus. If not, see . 21 | */ 22 | #include "CustomImageProvider.h" 23 | #include 24 | #include 25 | 26 | CustomImageProvider::CustomImageProvider() : QQuickImageProvider(QQuickImageProvider::Image) {} 27 | 28 | QImage CustomImageProvider::requestImage(const QString &id, QSize *size, const QSize &requestedSize) { 29 | int width = 268; 30 | int height = 58; 31 | QString text = "no text"; 32 | QString color = "#ffffff"; 33 | QStringList stringList = id.split(QRegExp("[#]")); 34 | if (stringList.size() < 3) { 35 | text = stringList.at(0); 36 | color = "#" + stringList.at(1); 37 | } 38 | else { 39 | text = stringList.at(0) + "\n" + stringList.at(1); 40 | color = "#" + stringList.at(2); 41 | } 42 | if (size) 43 | *size = QSize(width, height); 44 | return getImageFromText(text, color, requestedSize.width() > 0 ? requestedSize.width() : width, 45 | requestedSize.height() > 0 ? requestedSize.height() : height); 46 | } 47 | 48 | QImage CustomImageProvider::getImageFromText(const QString &text, const QString &color, const int &width, const int &height) { 49 | QImage image(width, height, QImage::Format_ARGB32_Premultiplied); 50 | QFont font; 51 | font.setPixelSize(24); 52 | image.fill(Qt::transparent); 53 | QPainter painter(&image); 54 | painter.setFont(font); 55 | painter.setPen(QColor(color)); 56 | painter.drawText(image.rect(), Qt::AlignCenter, text); 57 | return image; 58 | } 59 | -------------------------------------------------------------------------------- /android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS=-Xmx1024m -Dfile.encoding=UTF-8 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /CppFiles/TrayController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 - 2017 Adrian Verban 3 | * Maintainers: Adrian Verban 4 | * Derived from Typhoon by Archisman Panigrahi which is based on Stormcloud by Jono Cooper 5 | * Thanks to all the contributors. 6 | * Using the Ubuntu Condensed font. 7 | * This file is part of Cumulus. 8 | # 9 | * Cumulus is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | # 14 | * Cumulus is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | # 19 | * You should have received a copy of the GNU General Public License 20 | * along with Cumulus. If not, see . 21 | */ 22 | #ifndef TRAYCONTROLLER_H 23 | #define TRAYCONTROLLER_H 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | #include "ThreadWorker.h" 38 | class TrayController : public QObject { 39 | Q_OBJECT 40 | QString m_trayTheme; 41 | bool m_trayVisibility; 42 | QSystemTrayIcon *trayIcon; 43 | int m_temperature; 44 | Q_PROPERTY(int temperature MEMBER m_temperature WRITE setTemperature NOTIFY temperatureChanged) 45 | Q_PROPERTY(bool trayVisibility READ trayVisibility WRITE setTrayVisibility NOTIFY trayVisibilityChanged) 46 | Q_PROPERTY(QString trayTheme READ trayTheme WRITE setTrayTheme NOTIFY trayThemeChanged) 47 | 48 | void initialiseTray(); 49 | void disableTray(); 50 | void enableTray(); 51 | QThread *thread; 52 | ThreadWorker *worker; 53 | QAction *currentWeatherAction; 54 | QImage createTrayIcon(const int &temperature, const QString &theme); 55 | bool isTrayAvailable(); 56 | public: 57 | explicit TrayController(QObject *parent = nullptr); 58 | bool startUp() const; 59 | void setStartUp(const bool &startUp); 60 | bool trayVisibility() const; 61 | void setTrayVisibility(const bool &trayVisibility); 62 | QString trayTheme() const; 63 | void setTrayTheme(const QString &trayTheme); 64 | void setTemperature(const int &temperature); 65 | private slots: 66 | void emitCloseApp(); 67 | void emitShowGui(); 68 | void setTrayIcon(); 69 | signals: 70 | void trayVisibilityChanged(); 71 | void closeApp(); 72 | void showGui(); 73 | void trayThemeChanged(); 74 | void temperatureChanged(); 75 | }; 76 | 77 | #endif // TRAYCONTROLLER_H 78 | -------------------------------------------------------------------------------- /CppFiles/AbstractWeatherController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 - 2017 Adrian Verban 3 | * Maintainers: Adrian Verban 4 | * Derived from Typhoon by Archisman Panigrahi which is based on Stormcloud by Jono Cooper 5 | * Thanks to all the contributors. 6 | * Using the Ubuntu Condensed font. 7 | * This file is part of Cumulus. 8 | # 9 | * Cumulus is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | # 14 | * Cumulus is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | # 19 | * You should have received a copy of the GNU General Public License 20 | * along with Cumulus. If not, see . 21 | */ 22 | #ifndef ABSTRACTWEATHERCONTROLLER_H 23 | #define ABSTRACTWEATHERCONTROLLER_H 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | #include "DataController.h" 36 | #include "Util.h" 37 | #include "DatabaseHelper.h" 38 | #include "Forecast.h" 39 | #include "SettingsController.h" 40 | 41 | using namespace std; 42 | 43 | class AbstractWeatherController : public QObject { 44 | Q_OBJECT 45 | protected: 46 | DataController *dataController; 47 | QString temperatureUnit, apiKey, locationCode; 48 | weather_struct m_weather; 49 | 50 | QJsonObject nextBranch(const QJsonObject &jsonObject, const QString current) const; 51 | bool saveWeather(const weather_struct &weather); 52 | void saveForecast(QList &forecastList); 53 | bool saveLocation(const QString &code); 54 | bool saveLocation(const QString &code, const QString &name); 55 | public: 56 | QString name; 57 | explicit AbstractWeatherController(QObject *parent = nullptr); 58 | virtual void searchByLocation(QString &location) = 0; 59 | virtual void searchBycode(QString &code) = 0; 60 | virtual void searchByGps(const double &lat, const double &lon) = 0; 61 | private slots: 62 | void locationPositionInfo(const QGeoPositionInfo &posInfo); 63 | void locationPositionError(const QGeoPositionInfoSource::Error &positioningError); 64 | protected slots: 65 | virtual void getLocationFromJson(const QJsonObject &jsonObject) = 0; 66 | virtual void getWeatherFromJson(const QJsonObject &jsonObject) = 0; 67 | virtual void getForecastFromJson(const QJsonObject &jsonObject) = 0; 68 | void manageError(const QString error); 69 | public slots: 70 | void getWeather(); 71 | signals: 72 | void forecastChanged(); 73 | void saveDataError(const QString &error); 74 | void networkError(const QString &error); 75 | void weatherSet(const weather_struct &weather); 76 | }; 77 | 78 | #endif // ABSTRACTWEATHERCONTROLLER_H 79 | -------------------------------------------------------------------------------- /CppFiles/ThreadWorker.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 - 2017 Adrian Verban 3 | * Maintainers: Adrian Verban 4 | * Derived from Typhoon by Archisman Panigrahi which is based on Stormcloud by Jono Cooper 5 | * Thanks to all the contributors. 6 | * Using the Ubuntu Condensed font. 7 | * This file is part of Cumulus. 8 | # 9 | * Cumulus is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | # 14 | * Cumulus is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | # 19 | * You should have received a copy of the GNU General Public License 20 | * along with Cumulus. If not, see . 21 | */ 22 | #include "ThreadWorker.h" 23 | #include "Util.h" 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | ThreadWorker::ThreadWorker(QObject *parent) : QObject(parent) { 33 | } 34 | 35 | void ThreadWorker::updaterTimerStart() { 36 | QTimer::singleShot(60000, this, SLOT(startLookingForUpdates())); 37 | } 38 | 39 | void ThreadWorker::startLookingForUpdates() { 40 | qDebug() << "Updater started."; 41 | QString maintenancetoolPath = QCoreApplication::applicationDirPath() + "/maintenancetool"; 42 | if (!QFile::exists(maintenancetoolPath)) { 43 | qDebug() << "maintenancetool is missing!"; 44 | qDebug() << "For automatic updates download the online installer!"; 45 | emit stopUpdatesSearch(); 46 | } 47 | else { 48 | QNetworkAccessManager networkManager; 49 | QProcess process; 50 | process.start(maintenancetoolPath + " --checkupdates"); 51 | process.waitForFinished(); 52 | if(networkManager.networkAccessible() != QNetworkAccessManager::Accessible || process.error() != QProcess::UnknownError) { 53 | qDebug() << "Error checking for updates!"; 54 | qDebug() << "Error message: " + process.errorString(); 55 | emit startUpdateTimerSignal(); 56 | } 57 | else { 58 | QByteArray data = process.readAllStandardOutput(); 59 | qDebug() << "data: " << data; 60 | if (data.isEmpty()) { 61 | qDebug() << "No updates are available!"; 62 | emit startUpdateTimerSignal(); 63 | } 64 | else if (QString(data).toLower().contains(QRegExp("(error|null|empty)"))) { 65 | qDebug() << "Error occurred while searching for updates!"; 66 | qDebug() << "Error: " << data; 67 | emit startUpdateTimerSignal(); 68 | } 69 | else { 70 | QStringList args("--updater"); 71 | QProcess::startDetached(maintenancetoolPath, args); 72 | } 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /qml/ForecastItemDelegate.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.0 2 | 3 | ClickableItem { 4 | id: root 5 | property string forecastDay 6 | property string forecastIcon 7 | property string forecastTempHigh 8 | property string forecastTempLow 9 | property string forecastDesc 10 | property string stringFont 11 | property string iconFont 12 | property string fontColor 13 | unhoveredBackgroundOpacity: 0.2 14 | hoveredBackgroundOpacity: 0.4 15 | backgroundOpacity: unhoveredBackgroundOpacity 16 | property int widthBreakPoint: 0 17 | 18 | Text { 19 | id: icon 20 | width: height 21 | height: parent.height 22 | anchors.top: parent.top 23 | anchors.left: parent.left 24 | horizontalAlignment: Text.AlignHCenter 25 | verticalAlignment: Text.AlignVCenter 26 | font.family: iconFont 27 | font.pixelSize: 20 28 | color: fontColor 29 | text: root.forecastIcon 30 | visible: (parent.width > parent.widthBreakPoint) 31 | } 32 | Text { 33 | id: date 34 | width: (icon.visible) ? (parent.width - icon.width - tempHigh.width - tempLow.width) : (parent.width - anchors.leftMargin - tempHigh.width - tempLow.width) 35 | height: (parent.height * 50 / 100) 36 | anchors.top: parent.top 37 | anchors.left: (icon.visible) ? icon.right : parent.left 38 | anchors.leftMargin: (icon.visible) ? 0 : 10 39 | color: fontColor 40 | font.family: stringFont 41 | font.pixelSize: 18 42 | horizontalAlignment: Text.AlignLeft 43 | verticalAlignment: Text.AlignVCenter 44 | text: qsTr(util.forecastDate(root.forecastDay)) 45 | } 46 | Text { 47 | id: description 48 | width: date.width 49 | height: (parent.height - date.height) 50 | anchors.top: date.bottom 51 | anchors.left: date.anchors.left 52 | anchors.leftMargin: date.anchors.leftMargin 53 | color: fontColor 54 | font.family: stringFont 55 | font.pixelSize: 14 56 | horizontalAlignment: Text.AlignLeft 57 | verticalAlignment: Text.AlignVCenter 58 | text: qsTr(root.forecastDesc) 59 | } 60 | Text { 61 | id: tempHigh 62 | width: 40 63 | height: width 64 | anchors.top: parent.top 65 | anchors.topMargin: ((parent.height / 2) - (height / 2)) 66 | anchors.left: description.right 67 | color: fontColor 68 | font.family: stringFont 69 | font.pixelSize: 20 70 | font.weight: Font.DemiBold 71 | horizontalAlignment: Text.AlignRight 72 | verticalAlignment: Text.AlignVCenter 73 | text: root.forecastTempHigh + " / " 74 | } 75 | Text { 76 | id: tempLow 77 | width: tempHigh.width 78 | height: tempHigh.height 79 | anchors.top: parent.top 80 | anchors.topMargin: tempHigh.anchors.topMargin 81 | anchors.left: tempHigh.right 82 | color: fontColor 83 | font.family: tempHigh.font.family 84 | font.pixelSize: (tempHigh.font.pixelSize - 4) 85 | horizontalAlignment: Text.AlignLeft 86 | verticalAlignment: Text.AlignVCenter 87 | text: root.forecastTempLow 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /CppFiles/Util.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 - 2017 Adrian Verban 3 | * Maintainers: Adrian Verban 4 | * Derived from Typhoon by Archisman Panigrahi which is based on Stormcloud by Jono Cooper 5 | * Thanks to all the contributors. 6 | * Using the Ubuntu Condensed font. 7 | * This file is part of Cumulus. 8 | # 9 | * Cumulus is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | # 14 | * Cumulus is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | # 19 | * You should have received a copy of the GNU General Public License 20 | * along with Cumulus. If not, see . 21 | */ 22 | #ifndef UTIL_H 23 | #define UTIL_H 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | #include "SettingsController.h" 38 | 39 | class Util : public QObject { 40 | Q_OBJECT 41 | public: 42 | explicit Util(QObject *parent = nullptr); 43 | static double calculateTemperature(const double &temperature, const QString &oldUnit, const QString &newUnit); 44 | static double calculateWindSpeed(double speed, const QString &oldUnit, const QString &newUnit); 45 | static double calculatePressure(double pressure, const QString &unit); 46 | static double kelvinToCelsiu(const double &temperature); 47 | static double fahrenheitToCelsiu(const double &temperature); 48 | static double celsiusToKelvin(const double &temperature); 49 | static double celsiusToFahrenheit(const double &temperature); 50 | static double kelvinToFahrenheit(const double &temperature); 51 | static double fahrenheitToKelvin(const double &temperature); 52 | static double msToMph(double speed); 53 | static double msToKph(double speed); 54 | static double mphToKph(double speed); 55 | static double mphToMs(double speed); 56 | static double kphToMph(double speed); 57 | static double kphToMs(double speed); 58 | static int roundToInt(const double &unit); 59 | static QString findFontCode(const QString &branch,const QString &code); 60 | 61 | Q_INVOKABLE static QString tempUnitSymbol(const QString &unit); 62 | Q_INVOKABLE static QString speedUnitSymbol(const QString &unit); 63 | Q_INVOKABLE static QString pressureUnitSymbol(const QString &unit); 64 | Q_INVOKABLE static QString osType(); 65 | Q_INVOKABLE static QString firstLetterUp(const QString &string); 66 | Q_INVOKABLE static QList creditsList(); 67 | Q_INVOKABLE static QString iconPathPrefix(); 68 | Q_INVOKABLE static QString forecastDate(const QString &string); 69 | Q_INVOKABLE static QString assetsPath(); 70 | public slots: 71 | QString getLogoImage() const; 72 | 73 | }; 74 | 75 | #endif // UTIL_H 76 | -------------------------------------------------------------------------------- /CppFiles/Forecast.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 - 2017 Adrian Verban 3 | * Maintainers: Adrian Verban 4 | * Derived from Typhoon by Archisman Panigrahi which is based on Stormcloud by Jono Cooper 5 | * Thanks to all the contributors. 6 | * Using the Ubuntu Condensed font. 7 | * This file is part of Cumulus. 8 | # 9 | * Cumulus is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | # 14 | * Cumulus is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | # 19 | * You should have received a copy of the GNU General Public License 20 | * along with Cumulus. If not, see . 21 | */ 22 | #ifndef FORECAST_H 23 | #define FORECAST_H 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | class Forecast : public QObject { 32 | Q_OBJECT 33 | int m_forecastIndex, m_tempHigh, m_tempLow, m_locationId, m_weatherCode; 34 | QString m_weatherIcon, m_forecastDate, m_forecastDesc; 35 | 36 | Q_PROPERTY(int forecastIndex READ forecastIndex WRITE setForecastIndex NOTIFY forecastIndexChanged) 37 | Q_PROPERTY(int weatherCode READ weatherCode WRITE setWeatherCode NOTIFY weatherCodeChanged) 38 | Q_PROPERTY(QString weatherIcon READ weatherIcon WRITE setWeatherIcon NOTIFY weatherIconChanged) 39 | Q_PROPERTY(int tempHigh READ tempHigh WRITE setTempHigh NOTIFY tempHighChanged) 40 | Q_PROPERTY(int tempLow READ tempLow WRITE setTempLow NOTIFY tempLowChanged) 41 | Q_PROPERTY(QString forecastDate READ forecastDate WRITE setForecastDate NOTIFY forecastDateChanged) 42 | Q_PROPERTY(QString forecastDesc READ forecastDesc WRITE setForecastDesc NOTIFY forecastDescChanged) 43 | Q_PROPERTY(int locationId READ locationId WRITE setLocationId NOTIFY locationIdChanged) 44 | public: 45 | explicit Forecast(QObject *parent = 0); 46 | void setForecastIndex(const int &forecastIndex); 47 | void setWeatherCode(const int &weatherCode); 48 | void setTempHigh(const int &tempHigh); 49 | void setTempLow(const int &tempLow); 50 | void setForecastDate(const QString &forecastDate); 51 | 52 | int forecastIndex() const; 53 | int weatherCode() const; 54 | int tempHigh() const; 55 | int tempLow() const; 56 | QString forecastDate() const; 57 | QString forecastDesc() const; 58 | void setForecastDesc(const QString &desc); 59 | void setLocationId(const int &locationId); 60 | int locationId() const; 61 | void setWeatherIcon(const QString &weatherIcon); 62 | QString weatherIcon() const; 63 | private slots: 64 | signals: 65 | void forecastIndexChanged(); 66 | void weatherCodeChanged(); 67 | void tempHighChanged(); 68 | void tempLowChanged(); 69 | void forecastDateChanged(); 70 | void forecastChanged(); 71 | void forecastDescChanged(); 72 | void locationIdChanged(); 73 | void weatherIconChanged(); 74 | }; 75 | 76 | #endif // FORECAST_H 77 | -------------------------------------------------------------------------------- /qml/WelcomeView.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.0 2 | import QtQuick.Controls 2.2 3 | 4 | import "CustomControls" as CoreControls 5 | 6 | Rectangle { 7 | id: window 8 | color: "#ff0099ff" 9 | signal finished() 10 | SwipeView { 11 | id: welcomeView 12 | anchors.top: window.top 13 | anchors.left: window.left 14 | width: window.width 15 | height: (window.height - nextScreenButton.height - nextScreenButton.anchors.topMargin - pageIndicator.height - pageIndicator.anchors.topMargin) 16 | currentIndex: 0 17 | 18 | Image { 19 | id: welcomeScreen 20 | source: util.assetsPath() + "screens/toggle-screens.png" 21 | width: window.width 22 | height: (window.height - 100) 23 | horizontalAlignment: Image.AlignHCenter 24 | verticalAlignment: Image.AlignVCenter 25 | fillMode: Image.PreserveAspectFit 26 | } 27 | 28 | Image { 29 | id: forecastScreen 30 | source: util.assetsPath() + "screens/main-screen-forecast.png" 31 | width: window.width 32 | height: (window.height - 100) 33 | horizontalAlignment: Image.AlignHCenter 34 | verticalAlignment: Image.AlignVCenter 35 | fillMode: Image.PreserveAspectFit 36 | } 37 | 38 | Image { 39 | id: locationsScreen 40 | source: util.assetsPath() + "screens/locations-screen.png" 41 | width: window.width 42 | height: (window.height - 100) 43 | horizontalAlignment: Image.AlignHCenter 44 | verticalAlignment: Image.AlignVCenter 45 | fillMode: Image.PreserveAspectFit 46 | } 47 | Image { 48 | id: locationsSearchScreen 49 | source: util.assetsPath() + "screens/location-search.png" 50 | width: window.width 51 | height: (window.height - 100) 52 | horizontalAlignment: Image.AlignHCenter 53 | verticalAlignment: Image.AlignVCenter 54 | fillMode: Image.PreserveAspectFit 55 | } 56 | } 57 | 58 | CoreControls.Button { 59 | id: nextScreenButton 60 | anchors.top: welcomeView.bottom 61 | anchors.topMargin: 20 62 | anchors.left: window.left 63 | anchors.leftMargin: ((parent.width / 2) - (nextScreenButton.width / 2)) 64 | width: (window.width * 0.7) 65 | height: 50 66 | backgroundColor: "#3d8fb5" 67 | text.text: (welcomeView.currentIndex < 3 ? (qsTr("Next ")) : (qsTr("Done "))) + (" >") 68 | text.color: "#ffffff" 69 | text.wrapMode: Text.Wrap 70 | dropShadow.verticalOffset: 3 71 | ripple: true 72 | onClicked: { 73 | if (welcomeView.currentIndex < 3) { 74 | welcomeView.currentIndex += 1 75 | } 76 | else { 77 | welcomeView.currentIndex = 0 78 | window.finished() 79 | } 80 | } 81 | } 82 | 83 | PageIndicator { 84 | id: pageIndicator 85 | count: welcomeView.count 86 | currentIndex: welcomeView.currentIndex 87 | anchors.top: nextScreenButton.bottom 88 | anchors.topMargin: 10 89 | anchors.horizontalCenter: window.horizontalCenter 90 | interactive: true 91 | onCurrentIndexChanged: welcomeView.currentIndex = pageIndicator.currentIndex 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /CppFiles/DataController.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 - 2017 Adrian Verban 3 | * Maintainers: Adrian Verban 4 | * Derived from Typhoon by Archisman Panigrahi which is based on Stormcloud by Jono Cooper 5 | * Thanks to all the contributors. 6 | * Using the Ubuntu Condensed font. 7 | * This file is part of Cumulus. 8 | # 9 | * Cumulus is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | # 14 | * Cumulus is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | # 19 | * You should have received a copy of the GNU General Public License 20 | * along with Cumulus. If not, see . 21 | */ 22 | #include "DataController.h" 23 | 24 | DataController::DataController(QObject *parent) : QObject(parent) {} 25 | 26 | void DataController::getDataFromUrl(QString urlString) { 27 | networkManager = new QNetworkAccessManager(this); 28 | if (networkManager->networkAccessible() == QNetworkAccessManager::Accessible) { 29 | connect(networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(readFinished(QNetworkReply*))); 30 | QNetworkRequest networkRequest; 31 | networkRequest.setUrl(QUrl(urlString)); 32 | networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); 33 | networkManager->get(networkRequest); 34 | } 35 | else { 36 | emit networkError("Network not accessible!"); 37 | } 38 | } 39 | 40 | void DataController::readFinished(QNetworkReply *reply) { 41 | if (reply->error() == QNetworkReply::NoError) { 42 | QString dataRead = (QString)reply->readAll(); 43 | QJsonDocument jsonResponse = QJsonDocument::fromJson(dataRead.toUtf8()); 44 | QJsonObject jsonObject = jsonResponse.object(); 45 | emit jsonObjectReady(jsonObject); 46 | } 47 | else { 48 | emit networkError(reply->errorString()); 49 | } 50 | } 51 | 52 | void DataController::getJsonArrayDataFromUrl(QString urlString) { 53 | networkManager = new QNetworkAccessManager(this); 54 | if (networkManager->networkAccessible() == QNetworkAccessManager::Accessible) { 55 | connect(networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(readJsonArrayFinished(QNetworkReply*))); 56 | QNetworkRequest networkRequest; 57 | networkRequest.setUrl(QUrl(urlString)); 58 | networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); 59 | networkManager->get(networkRequest); 60 | } 61 | else { 62 | emit networkError("Network not accessible!"); 63 | } 64 | } 65 | 66 | void DataController::readJsonArrayFinished(QNetworkReply *reply) { 67 | if (reply->error() == QNetworkReply::NoError) { 68 | QString dataRead = (QString)reply->readAll(); 69 | QJsonDocument jsonResponse = QJsonDocument::fromJson(dataRead.toUtf8()); 70 | QJsonArray jsonArray = jsonResponse.array(); 71 | emit jsonArrayReady(jsonArray); 72 | } 73 | else { 74 | emit networkError(reply->errorString()); 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /CppFiles/Location.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Adrian Verban 3 | * Maintainers: Adrian Verban 4 | * Derived from Typhoon by Archisman Panigrahi which is based on Stormcloud by Jono Cooper 5 | * Thanks to all the contributors. 6 | * Using the Ubuntu Condensed font. 7 | * This file is part of Cumulus. 8 | # 9 | * Cumulus is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | # 14 | * Cumulus is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | # 19 | * You should have received a copy of the GNU General Public License 20 | * along with Cumulus. If not, see . 21 | */ 22 | #ifndef LOCATION_H 23 | #define LOCATION_H 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #include "DatabaseHelper.h" 33 | class Location : public QObject { 34 | Q_OBJECT 35 | int m_locationId; 36 | QString m_locationCode, m_locationName, m_gpsLocation; 37 | bool m_isCurrentLocation; 38 | QList m_locationList; 39 | QStringList m_locationSearchList; 40 | public: 41 | explicit Location(QObject *parent = nullptr); 42 | Q_PROPERTY(int locationId MEMBER m_locationId NOTIFY locationIdChanged) 43 | Q_PROPERTY(QString locationCode MEMBER m_locationCode NOTIFY locationCodeChanged) 44 | Q_PROPERTY(QString locationName MEMBER m_locationName NOTIFY locationNameChanged) 45 | Q_PROPERTY(QList locationList MEMBER m_locationList WRITE setLocationList NOTIFY locationListChanged) 46 | Q_PROPERTY(bool isCurrentLocation MEMBER m_isCurrentLocation NOTIFY isCurrentLocationChanged) 47 | Q_PROPERTY(QStringList locationSearchList READ locationSearchList WRITE setLocationSearchList NOTIFY locationSearchListChanged) 48 | Q_PROPERTY(QString gpsLocation MEMBER m_gpsLocation WRITE setGpsLocation NOTIFY gpsLocationChanged) 49 | 50 | void setLocationList(const QList &locationList); 51 | QStringList locationSearchList() const; 52 | private slots: 53 | void readLocationList(const QList &locationList); 54 | void locationPositionInfo(const QGeoPositionInfo &posInfo); 55 | void geoPositionSourceError(QGeoPositionInfoSource::Error positioningError); 56 | public slots: 57 | void getLocationList(); 58 | void searchLocation(const QString &query); 59 | void setLocationSearchList(const QStringList &locationList); 60 | void insertLocation(const QString &location); 61 | void deleteLocation(const int &locationId); 62 | void changeCurrentLocation(const int &locationId); 63 | void getGpsLocation(); 64 | void setGpsLocation(const QString &gpsLocation); 65 | signals: 66 | void locationListChanged(); 67 | void locationIdChanged(); 68 | void locationCodeChanged(); 69 | void locationNameChanged(); 70 | void isCurrentLocationChanged(); 71 | void noLocation(); 72 | void locationSearchListChanged(); 73 | void duplicateLocation(const QString &location); 74 | void networkError(const QString &error); 75 | void gpsLocationChanged(); 76 | }; 77 | 78 | #endif // LOCATION_H 79 | -------------------------------------------------------------------------------- /qml/SettingsOptionItem.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 - 2017 Adrian Verban 3 | * Maintainers: Adrian Verban 4 | * Derived from Typhoon by Archisman Panigrahi which is based on Stormcloud by Jono Cooper 5 | * Thanks to all the contributors. 6 | * Using the Ubuntu Condensed font. 7 | * This file is part of Cumulus. 8 | # 9 | * Cumulus is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | # 14 | * Cumulus is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | # 19 | * You should have received a copy of the GNU General Public License 20 | * along with Cumulus. If not, see . 21 | */ 22 | import QtQuick 2.0 23 | import QtQuick.Layouts 1.0 24 | 25 | Item { 26 | id: root 27 | signal clicked() 28 | signal pressed() 29 | signal released() 30 | property alias iconUrl: optionIcon.source 31 | property alias optionText: optionText.text 32 | property alias backgroundColor: rectangle.color 33 | property alias textColor: optionText.color 34 | property alias bottomBorderVisibility: bottomBorder.visible 35 | 36 | Rectangle { 37 | id: rectangle 38 | anchors.fill: parent 39 | 40 | RowLayout { 41 | anchors.fill: parent 42 | 43 | Image { 44 | id: optionIcon 45 | Layout.fillHeight: false 46 | Layout.fillWidth: false 47 | Layout.preferredHeight: parent.height * 50 / 100 48 | Layout.preferredWidth: height 49 | Layout.alignment: Qt.AlignVCenter 50 | fillMode: Image.PreserveAspectFit 51 | anchors.leftMargin: (parent.width - (parent.width * 80 / 100)) / 2 52 | anchors.left: parent.left 53 | } 54 | Text { 55 | id: optionText 56 | Layout.fillHeight: false 57 | Layout.fillWidth: false 58 | Layout.preferredWidth: parent.width - optionIcon.width - 9 59 | Layout.alignment: Qt.AlignVCenter 60 | anchors.leftMargin: 20 61 | anchors.left: optionIcon.right 62 | font.pixelSize: 18 63 | color: "#555656" 64 | } 65 | } 66 | Rectangle { 67 | id: bottomBorder 68 | color: "#666C6C6C" 69 | height: 1 70 | width: parent.width * 80 / 100 71 | anchors.bottom: rectangle.bottom 72 | anchors.left: parent.left 73 | anchors.leftMargin: (parent.width - width) / 2 74 | visible: true 75 | } 76 | 77 | MouseArea { 78 | anchors.fill: parent 79 | hoverEnabled: true 80 | cursorShape: Qt.PointingHandCursor 81 | onClicked: { 82 | root.clicked() 83 | } 84 | onPressed: { 85 | root.pressed() 86 | parent.color = "#DDDDDD" 87 | } 88 | onReleased: { 89 | root.released() 90 | parent.color = "#FFFFFF" 91 | } 92 | onExited: parent.color = "#FFFFFF" 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /CppFiles/Forecast.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 - 2017 Adrian Verban 3 | * Maintainers: Adrian Verban 4 | * Derived from Typhoon by Archisman Panigrahi which is based on Stormcloud by Jono Cooper 5 | * Thanks to all the contributors. 6 | * Using the Ubuntu Condensed font. 7 | * This file is part of Cumulus. 8 | # 9 | * Cumulus is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | # 14 | * Cumulus is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | # 19 | * You should have received a copy of the GNU General Public License 20 | * along with Cumulus. If not, see . 21 | */ 22 | #include "Forecast.h" 23 | #include "Util.h" 24 | #include 25 | 26 | Forecast::Forecast(QObject *parent) : QObject(parent){ 27 | m_forecastIndex = 1; 28 | m_weatherCode = -1; 29 | m_tempHigh = 0; 30 | m_tempLow = 0; 31 | m_forecastDate = QDate::currentDate().toString(Qt::SystemLocaleLongDate); 32 | } 33 | 34 | void Forecast::setForecastIndex(const int &forecastIndex) { 35 | if ( m_forecastIndex != forecastIndex ) { 36 | m_forecastIndex = forecastIndex; 37 | emit forecastIndexChanged(); 38 | } 39 | } 40 | 41 | int Forecast::weatherCode() const { 42 | return m_weatherCode; 43 | } 44 | 45 | void Forecast::setWeatherCode(const int &weatherCode) { 46 | if ( m_weatherCode != weatherCode ) { 47 | m_weatherCode = weatherCode; 48 | emit weatherCodeChanged(); 49 | } 50 | } 51 | 52 | void Forecast::setTempHigh(const int &tempHigh) { 53 | if ( m_tempHigh != tempHigh ) { 54 | m_tempHigh = tempHigh; 55 | emit tempHighChanged(); 56 | } 57 | } 58 | 59 | void Forecast::setTempLow(const int &tempLow) { 60 | if ( m_tempLow != tempLow ) { 61 | m_tempLow = tempLow; 62 | emit tempLowChanged(); 63 | } 64 | } 65 | 66 | void Forecast::setForecastDate(const QString &forecastDate) { 67 | if ( m_forecastDate != forecastDate ) { 68 | m_forecastDate = forecastDate; 69 | emit forecastDateChanged(); 70 | } 71 | } 72 | 73 | int Forecast::forecastIndex() const { 74 | return m_forecastIndex; 75 | } 76 | int Forecast::tempHigh() const { 77 | return m_tempHigh; 78 | } 79 | int Forecast::tempLow() const { 80 | return m_tempLow; 81 | } 82 | QString Forecast::forecastDate() const { 83 | return m_forecastDate; 84 | } 85 | 86 | QString Forecast::forecastDesc() const { 87 | return m_forecastDesc; 88 | } 89 | 90 | void Forecast::setForecastDesc(const QString &forecastDesc) { 91 | if (m_forecastDesc != forecastDesc) { 92 | m_forecastDesc = Util::firstLetterUp(forecastDesc); 93 | emit forecastDescChanged(); 94 | } 95 | } 96 | 97 | void Forecast::setLocationId(const int &locationId) { 98 | if (m_locationId != locationId) { 99 | m_locationId = locationId; 100 | emit locationIdChanged(); 101 | } 102 | } 103 | 104 | int Forecast::locationId() const { 105 | return m_locationId; 106 | } 107 | 108 | void Forecast::setWeatherIcon(const QString &weatherIcon) { 109 | if (m_weatherIcon != weatherIcon) { 110 | m_weatherIcon = weatherIcon; 111 | emit weatherIconChanged(); 112 | } 113 | } 114 | 115 | QString Forecast::weatherIcon() const { 116 | return m_weatherIcon; 117 | } 118 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # News 2 | Hello everybody, 3 | Sadly due to my attention being in the direction of my own development company, which is pretty new on the local market and struggling especially now with the pandemic of Covid-19, I cannot afford to spend time on other projects. 4 | I am really sorry since this is a close-to-heart project, I really wanted it to thrive. 5 | If I will be able to have more time in the future, I will pursue further development of Cumulus. At the moment I cannot. 6 | If anyone wants to take over development of it, feel free, I don't mind. 7 | Keep your fingers crossed, if the company becomes stable and fruitful my vision also includes investing in developing UX-oriented open-source software, on Linux. 8 | 9 | If you want to add translations of your language to your UI, do the following: 10 | - clone the repository; 11 | - copy tempestas_ro.po to tempestas_\.po; 12 | - modify your copy with the text from romanian to your language; 13 | - make pull request with your change; 14 | 15 | # Info 16 | [![Build Status](https://travis-ci.org/vadrian89/cumulus-qt.svg?branch=master)](https://travis-ci.org/vadrian89/cumulus-qt) 17 | Both offline and online installers for 64 bit Linux distributions can be found at the [releases page](https://github.com/vadrian89/cumulus-qt/releases). 18 | For any feedback you can mail me at verbanady@gmail.com, please add the following subject so I can save them into a special category: Cumulus - Feedback. 19 | Thanks! 20 | 21 | # Cumulus 22 | Cross platform and open source weather application for GNU/Linux and Android built with Qt. 23 | 24 | Forked from [typhoon](https://github.com/apandada1/typhoon) which was 25 | Based on [Stormcloud](https://github.com/consindo/stormcloud/) by [Jono Cooper](https://twitter.com/consindo). 26 | 27 | Features: 28 | - colors selectors for background and text with alpha channel, knock yourselves up ^^; 29 | - tray icon, with aditional data to be added on menu :); 30 | - qt installer, without root installation to allow future updates fast without breaking on upgrade; 31 | - AppImage for those who want the application in a portable fashion; 32 | - possbility for multiple instances with different settings and locations; 33 | - weather provided by [Open Weather Map](http://openweathermap.org/); 34 | - locations list; 35 | 36 | # For multiple instances: 37 | 38 | 1. make a new shell script with the following content updated for Cumulus installation path 39 | #!/bin/bash 40 | \ -i \ 41 | Example: /home/user/Cumulus/Cumulus -i NewInstance 42 | 43 | 2. make the shell script executable 44 | 45 | # In case you want to build it yourself: 46 | 47 | - recommended Qt version: 5.9 48 | 49 | # Major Thanks: 50 | - [Daryl Bennett](https://github.com/kd8bny) 51 | - [Archisman Panigrahi](https://github.com/apandada1) 52 | - [Erik Flowers](https://github.com/erikflowers) for his [weather icons](https://github.com/erikflowers/weather-icons), 53 | which sadly has discontinued support for them 54 | - People working on [linuxdeployqt](https://github.com/probonopd/linuxdeployqt) and [AppImage](https://github.com/AppImage) 55 | 56 | # Known Issues 57 | - [Yahoo is currently not working](https://github.com/vadrian89/cumulus-qt/issues/40); 58 | - AppImage seems highly unstable on Deepin Linux, might also be the case for other distros; 59 | - Geo location is not working correctly on some distributions; 60 | 61 | # TODO 62 | - Fix connection to [Yahoo! Weather](http://weather.yahoo.com); 63 | - Code refactoring; 64 | - Translations for weather conditions; 65 | - Improve UI; 66 | - Rename application; 67 | - Support for custom API keys, for OpenWeatherMap and Weather Underground; 68 | - Snap package; 69 | - Ubuntu Touch support; 70 | -------------------------------------------------------------------------------- /qml/CreditsListDelegate.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 - 2017 Adrian Verban 3 | * Maintainers: Adrian Verban 4 | * Derived from Typhoon by Archisman Panigrahi which is based on Stormcloud by Jono Cooper 5 | * Thanks to all the contributors. 6 | * Using the Ubuntu Condensed font. 7 | * This file is part of Cumulus. 8 | # 9 | * Cumulus is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | # 14 | * Cumulus is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | # 19 | * You should have received a copy of the GNU General Public License 20 | * along with Cumulus. If not, see . 21 | */ 22 | import QtQuick 2.0 23 | import QtQuick.Layouts 1.0 24 | 25 | Item { 26 | id: root 27 | property string author 28 | property string authorUrl 29 | property string license 30 | property string icon 31 | property string textColor 32 | visible: true 33 | Rectangle { 34 | anchors.fill: parent 35 | color: "transparent" 36 | RowLayout { 37 | anchors.fill: parent 38 | Rectangle { 39 | Layout.fillHeight: false 40 | Layout.fillWidth: false 41 | Layout.preferredHeight: parent.height 42 | Layout.preferredWidth: parent.height 43 | Layout.alignment: Qt.AlignCenter 44 | color: "transparent" 45 | Image { 46 | anchors.centerIn: parent 47 | width: 28 48 | height: 28 49 | horizontalAlignment: Image.AlignHCenter 50 | verticalAlignment: Image.AlignVCenter 51 | source: util.iconPathPrefix() + root.icon 52 | } 53 | } 54 | ColumnLayout { 55 | Layout.fillHeight: true 56 | Layout.fillWidth: true 57 | Layout.alignment: Qt.AlignLeft | Qt.AlignBottom 58 | Text { 59 | Layout.fillHeight: true 60 | Layout.fillWidth: true 61 | Layout.alignment: Qt.AlignLeft | Qt.AlignBottom 62 | horizontalAlignment: Text.AlignLeft 63 | verticalAlignment: Text.AlignBottom 64 | text: qsTr("Author: ") + root.author 65 | color: root.textColor 66 | } 67 | Text { 68 | Layout.fillHeight: true 69 | Layout.fillWidth: true 70 | Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter 71 | horizontalAlignment: Text.AlignLeft 72 | verticalAlignment: Text.AlignVCenter 73 | text: qsTr("License: ") + root.license 74 | color: root.textColor 75 | } 76 | } 77 | } 78 | MouseArea { 79 | anchors.fill: parent 80 | onClicked: Qt.openUrlExternally(authorUrl) 81 | cursorShape: Qt.PointingHandCursor 82 | } 83 | } 84 | Rectangle { 85 | id: bottomBorder 86 | color: root.textColor 87 | height: 1 88 | width: parent.width 89 | anchors.bottom: parent.bottom 90 | anchors.left: parent.left 91 | anchors.leftMargin: (parent.width - width) / 2 92 | visible: true 93 | } 94 | } 95 | -------------------------------------------------------------------------------- /CppFiles/LocationController.cpp: -------------------------------------------------------------------------------- 1 | #include "LocationController.h" 2 | #include "DataController.h" 3 | LocationController::LocationController(QObject *parent) : QObject(parent) {} 4 | 5 | void LocationController::setLocationQuery(const QString &locationName) { 6 | if (m_locationName != locationName) { 7 | m_locationName = locationName; 8 | } 9 | } 10 | 11 | void LocationController::getLocationList() { 12 | DatabaseHelper dbHelper; 13 | QList list; 14 | list = dbHelper.getLocationList(); 15 | emit locationList(list); 16 | } 17 | 18 | void LocationController::searchByLocation() { 19 | DataController *dataController = new DataController(this); 20 | connect(dataController, SIGNAL(networkError(QString)), this, SIGNAL(networkError(QString))); 21 | connect(dataController, SIGNAL(jsonArrayReady(QJsonArray)), this, SLOT(getLocationFromJson(QJsonArray))); 22 | dataController->getJsonArrayDataFromUrl("https://api.locationiq.com/v1/autocomplete.php?key=91832c9892b3cc&q=" + m_locationName); 23 | } 24 | 25 | void LocationController::searchByCoordinates() { 26 | DataController *dataController = new DataController(this); 27 | connect(dataController, SIGNAL(networkError(QString)), this, SIGNAL(networkError(QString))); 28 | connect(dataController, SIGNAL(jsonObjectReady(QJsonObject)), this, SLOT(getGeoLocation(QJsonObject))); 29 | dataController->getDataFromUrl("https://eu1.locationiq.com/v1/reverse.php?key=91832c9892b3cc&lat=" + QString::number(m_lat) + "&lon=" + QString::number(m_lon) + "&format=json"); 30 | } 31 | 32 | void LocationController::getGeoLocation(const QJsonObject &jsonObject) { 33 | QJsonObject result = jsonObject.find("address").value().toObject(); 34 | QString city = result.find("city").value().toString(); 35 | if (city.trimmed().length() == 0) 36 | city = result.find("city_district").value().toString(); 37 | if (city.trimmed().length() == 0) 38 | city = result.find("locality").value().toString(); 39 | if (city.trimmed().length() == 0) 40 | city = result.find("town").value().toString(); 41 | if (city.trimmed().length() == 0) 42 | city = result.find("borough").value().toString(); 43 | if (city.trimmed().length() == 0) 44 | city = result.find("municipality").value().toString(); 45 | if (city.trimmed().length() == 0) 46 | city = result.find("village").value().toString(); 47 | if (city.trimmed().length() == 0) 48 | city = result.find("hamlet").value().toString(); 49 | if (city.trimmed().length() == 0) 50 | city = result.find("quarter").value().toString(); 51 | if (city.trimmed().length() == 0) 52 | city = result.find("neighbourhood").value().toString(); 53 | QString country = result.find("country").value().toString(); 54 | QString gpsCity = city.append(", ").append(country); 55 | emit locationFromGps(gpsCity); 56 | } 57 | 58 | void LocationController::getLocationFromJson(const QJsonArray &jsonArray) { 59 | QStringList stringList; 60 | for (int i = 0; i < jsonArray.size(); i++) { 61 | stringList.append(jsonArray.at(i).toObject().find("display_name").value().toString()); 62 | } 63 | emit locationSearchList(stringList); 64 | } 65 | 66 | bool LocationController::insertLocation(const QString &locationName) { 67 | DatabaseHelper dbHelper; 68 | location_struct loc = dbHelper.findLocation(locationName); 69 | if (loc.m_locationId > 0) { 70 | return false; 71 | } 72 | else { 73 | loc.m_locationCode = ""; 74 | loc.m_locationName = locationName; 75 | return dbHelper.insertLocation(loc); 76 | } 77 | } 78 | 79 | bool LocationController::deleteLocation(const int &locationId) { 80 | DatabaseHelper dbHelper; 81 | return dbHelper.deleteLocation(locationId); 82 | } 83 | -------------------------------------------------------------------------------- /qml/CustomComponents/ClickableItem.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.0 2 | import "." as CoreItems 3 | 4 | CoreItems.Item { 5 | id: root 6 | property double hoveredBackgroundOpacity: backgroundOpacity 7 | property double unhoveredBackgroundOpacity: backgroundOpacity 8 | property bool ripple: false 9 | property int rippleDuration: 250 10 | property int rippleHideDuration: 300 11 | property bool containsMouse: mouseArea.containsMouse 12 | signal clicked() 13 | signal entered() 14 | signal exited() 15 | signal pressed() 16 | signal released() 17 | Rectangle { 18 | id: itemRipple 19 | x: (root.width / 2) 20 | y: (root.height / 2) 21 | width: 0 22 | height: 0 23 | radius: (root.width / 2) 24 | visible: root.ripple 25 | color: "#000000" 26 | opacity: 0.2 27 | SequentialAnimation { 28 | id: rippleAnim 29 | ParallelAnimation { 30 | NumberAnimation { 31 | target: itemRipple 32 | property: "radius" 33 | from: (root.width / 2) 34 | to: root.radius 35 | duration: root.rippleDuration 36 | } 37 | NumberAnimation { 38 | id: xAnim 39 | target: itemRipple 40 | property: "x" 41 | from: (root.width / 2) 42 | to: 0 43 | duration: root.rippleDuration 44 | } 45 | NumberAnimation { 46 | id: yAnim 47 | target: itemRipple 48 | property: "y" 49 | from: (root.height / 2) 50 | to: 0 51 | duration: root.rippleDuration 52 | } 53 | NumberAnimation { 54 | target: itemRipple 55 | property: "width" 56 | from: 0 57 | to: root.width 58 | duration: root.rippleDuration 59 | } 60 | NumberAnimation { 61 | target: itemRipple 62 | property: "height" 63 | from: 0 64 | to: root.height 65 | duration: root.rippleDuration 66 | } 67 | } 68 | NumberAnimation { 69 | target: itemRipple 70 | property: "opacity" 71 | from: 0.2 72 | to: 0.0 73 | duration: root.rippleHideDuration 74 | } 75 | } 76 | } 77 | MouseArea { 78 | id: mouseArea 79 | anchors.fill: parent 80 | hoverEnabled: true 81 | onClicked: parent.clicked() 82 | onEntered: { 83 | parent.backgroundOpacity = parent.hoveredBackgroundOpacity 84 | parent.entered() 85 | } 86 | onExited: { 87 | parent.backgroundOpacity = parent.unhoveredBackgroundOpacity 88 | parent.exited() 89 | } 90 | onPressed: { 91 | xAnim.from = mouseX 92 | yAnim.from = mouseY 93 | itemRipple.width = 0 94 | itemRipple.height = 0 95 | itemRipple.opacity = 0.2 96 | rippleAnim.restart() 97 | parent.pressed() 98 | } 99 | onReleased: { 100 | parent.released() 101 | } 102 | onContainsMouseChanged: { 103 | if (!containsMouse) 104 | parent.backgroundOpacity = parent.unhoveredBackgroundOpacity 105 | else 106 | parent.backgroundOpacity = parent.hoveredBackgroundOpacity 107 | } 108 | } 109 | } 110 | -------------------------------------------------------------------------------- /qml/MainView.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.0 2 | 3 | Item { 4 | id: root 5 | property alias tempValue: weatherView.tempValue 6 | property int contentWidth: ((root.width < 600) ? (root.width * 2) : root.width) 7 | property int viewWidth: ((root.width < 600) ? root.width : (root.width / 2)) 8 | property int startPoint: ((root.width < 600) ? root.viewWidth : 0) 9 | property string textColor 10 | property string textFontFamily 11 | property string iconsFont 12 | property string speedUnit 13 | property string tempUnit 14 | property string pressureUnit 15 | property int widthBreakPoint 16 | property string backgroundColor 17 | signal locationNameChanged(string name) 18 | signal finishedWeatherUpdate() 19 | signal updateWeather() 20 | signal networkError() 21 | signal loadLogoImage() 22 | signal goToLocationsList() 23 | signal closeApp(); 24 | 25 | onTextColorChanged: weatherView.loadLogoImage() 26 | onLoadLogoImage: weatherView.loadLogoImage() 27 | onUpdateWeather: weatherView.updateWeather() 28 | onGoToLocationsList: { 29 | if (flickable.contentX > 0) { 30 | scrollToLocation.from = root.startPoint 31 | scrollToLocation.to = 0 32 | scrollToLocation.start() 33 | } 34 | else { 35 | scrollToLocation.from = 0 36 | scrollToLocation.to = root.startPoint 37 | scrollToLocation.start() 38 | } 39 | } 40 | 41 | Flickable { 42 | id: flickable 43 | anchors.fill: parent 44 | contentWidth: root.contentWidth 45 | contentHeight: root.height 46 | interactive: true 47 | contentX: root.startPoint 48 | LocationView { 49 | id: locationView 50 | anchors.left: parent.left 51 | anchors.top: parent.top 52 | width: root.viewWidth 53 | height: parent.height 54 | backgroundOpacity: 0.0 55 | backgroundColor: root.backgroundColor 56 | textColor: root.textColor 57 | textFontFamily: root.textFontFamily 58 | visible: true 59 | onNoLocation: { 60 | weatherView.visible = false 61 | flickable.contentX = 0 62 | } 63 | onViewWeather: { 64 | root.forceActiveFocus() 65 | scrollToLocation.from = 0 66 | scrollToLocation.to = root.startPoint 67 | scrollToLocation.start() 68 | } 69 | } 70 | WeatherWindow { 71 | id: weatherView 72 | anchors.left: locationView.right 73 | anchors.top: parent.top 74 | width: root.viewWidth 75 | height: parent.height 76 | textColor: root.textColor 77 | textFontFamily: root.textFontFamily 78 | iconsFont: root.iconsFont 79 | speedUnit: root.speedUnit 80 | widthBreakPoint: root.widthBreakPoint 81 | tempUnit: root.tempUnit 82 | pressureUnit: root.pressureUnit 83 | onFinishedWeatherUpdate: root.finishedWeatherUpdate() 84 | onNetworkError: root.networkError() 85 | onLocationNameChanged: root.locationNameChanged(locationName) 86 | } 87 | onMovementEnded: { 88 | if (contentX > (root.viewWidth / 2)) 89 | flickable.contentX = root.startPoint 90 | else { 91 | flickable.contentX = 0 92 | locationView.forceActiveFocus() 93 | } 94 | 95 | } 96 | PropertyAnimation on contentX { 97 | id: scrollToLocation 98 | from: flickable.contentX 99 | to: 0 100 | running: false 101 | } 102 | } 103 | onWidthChanged: { 104 | if (flickable.contentX != 0) 105 | flickable.contentX = root.viewWidth 106 | } 107 | onRotationChanged: { 108 | if (contentX > (root.viewWidth / 2)) 109 | flickable.contentX = root.startPoint 110 | else 111 | flickable.contentX = 0 112 | } 113 | Keys.onBackPressed: root.closeApp() 114 | } 115 | -------------------------------------------------------------------------------- /CppFiles/MainWindow.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Adrian Verban 3 | * Maintainers: Adrian Verban 4 | * Derived from Typhoon by Archisman Panigrahi which is based on Stormcloud by Jono Cooper 5 | * Thanks to all the contributors. 6 | * Using the Ubuntu Condensed font. 7 | * This file is part of Cumulus. 8 | # 9 | * Cumulus is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | # 14 | * Cumulus is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | # 19 | * You should have received a copy of the GNU General Public License 20 | * along with Cumulus. If not, see . 21 | */ 22 | #include "MainWindow.h" 23 | #include "WeatherType.h" 24 | #include "Forecast.h" 25 | #include "Util.h" 26 | #include "SettingsController.h" 27 | #include "TrayController.h" 28 | #include "CustomImageProvider.h" 29 | #include "FontImageProvider.h" 30 | #include "Location.h" 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { 39 | m_closeApp = false; 40 | QQuickWidget *view = new QQuickWidget(parent); 41 | QQmlEngine *engine = view->engine(); 42 | connect(engine, SIGNAL(quit()), this, SLOT(closeApp())); 43 | QQmlContext *context = engine->rootContext(); 44 | Util *util = new Util(view); 45 | settingsController = new SettingsController(view); 46 | engine->addImageProvider(QLatin1String("customimage"), new CustomImageProvider()); 47 | engine->addImageProvider(QLatin1String("fontimage"), new FontImageProvider()); 48 | context->setContextProperty("util", util); 49 | context->setContextProperty("settingsController", settingsController); 50 | context->setContextProperty("applicationPath", "file://" + qApp->applicationDirPath() + "/"); 51 | context->setContextProperty("applicationWindow", this); 52 | registerQmlType(); 53 | view->setSource(QUrl(QLatin1String("qrc:/qml/main-desktop.qml"))); 54 | view->show(); 55 | view->setResizeMode(QQuickWidget::SizeRootObjectToView); 56 | view->setClearColor(Qt::transparent); 57 | setAttribute(Qt::WA_TranslucentBackground); 58 | loadSettings(); 59 | setCentralWidget(view); 60 | setMinimumHeight(150); 61 | setMinimumWidth(200); 62 | setWindowIcon(QIcon(Util::iconPathPrefix() + "cumulus.png")); 63 | } 64 | 65 | MainWindow::~MainWindow() {} 66 | 67 | void MainWindow::loadSettings() { 68 | QSettings settings; 69 | settings.beginGroup("app-settings"); 70 | if (!restoreGeometry(settings.value("geo").toByteArray()) && Util::osType() != "android") 71 | resize(300, 500); 72 | if (settingsController->firstUse()) 73 | resize(300, 600); 74 | restoreState(settings.value("state").toByteArray()); 75 | settings.endGroup(); 76 | } 77 | 78 | void MainWindow::saveSettings(){ 79 | QSettings settings; 80 | settings.beginGroup("app-settings"); 81 | settings.setValue("geo",saveGeometry()); 82 | settings.setValue("state",saveState()); 83 | settings.endGroup(); 84 | } 85 | 86 | void MainWindow::registerQmlType() { 87 | qmlRegisterType("ownTypes.weather", 1, 9, "Weather"); 88 | qmlRegisterType("ownTypes.settingsController", 1, 0, "SettingsController"); 89 | qmlRegisterType("ownTypes.TrayController", 0, 3, "TrayController"); 90 | qmlRegisterType("ownTypes.LocationController", 0, 1, "LocationController"); 91 | } 92 | 93 | void MainWindow::closeEvent(QCloseEvent *event) { 94 | saveSettings(); 95 | SettingsController settings; 96 | if (!m_closeApp && settings.trayVisibility()) { 97 | this->hide(); 98 | event->ignore(); 99 | } 100 | else { 101 | QMainWindow::closeEvent(event); 102 | } 103 | } 104 | 105 | void MainWindow::launchApp() { 106 | SettingsController settings; 107 | if (!settings.trayVisibility()) 108 | this->show(); 109 | } 110 | 111 | void MainWindow::closeApp() { 112 | m_closeApp = true; 113 | this->close(); 114 | } 115 | 116 | void MainWindow::moveWindow(const QPoint &mousePosition) { 117 | move(this->x() + mousePosition.x(), (this->y() + mousePosition.y())); 118 | } 119 | 120 | void MainWindow::minimizeWindow() { 121 | this->setWindowState(Qt::WindowMinimized); 122 | } 123 | -------------------------------------------------------------------------------- /CppFiles/TrayController.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 - 2017 Adrian Verban 3 | * Maintainers: Adrian Verban 4 | * Derived from Typhoon by Archisman Panigrahi which is based on Stormcloud by Jono Cooper 5 | * Thanks to all the contributors. 6 | * Using the Ubuntu Condensed font. 7 | * This file is part of Cumulus. 8 | # 9 | * Cumulus is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | # 14 | * Cumulus is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | # 19 | * You should have received a copy of the GNU General Public License 20 | * along with Cumulus. If not, see . 21 | */ 22 | #include "TrayController.h" 23 | #include "Util.h" 24 | 25 | TrayController::TrayController(QObject *parent) : 26 | QObject(parent), trayIcon(nullptr), m_temperature(300) {} 27 | 28 | void TrayController::setTemperature(const int &temperature) { 29 | if (m_temperature != temperature) { 30 | m_temperature = temperature; 31 | emit temperatureChanged(); 32 | } 33 | } 34 | 35 | void TrayController::setTrayVisibility(const bool &trayVisibility) { 36 | if (m_trayVisibility != trayVisibility) { 37 | if (trayVisibility) 38 | enableTray(); 39 | else 40 | disableTray(); 41 | m_trayVisibility = trayVisibility; 42 | emit trayVisibilityChanged(); 43 | } 44 | } 45 | 46 | bool TrayController::trayVisibility() const { 47 | return m_trayVisibility; 48 | } 49 | 50 | void TrayController::setTrayTheme(const QString &trayTheme) { 51 | if (m_trayTheme != trayTheme) { 52 | m_trayTheme = trayTheme; 53 | emit trayThemeChanged(); 54 | } 55 | } 56 | 57 | QString TrayController::trayTheme() const { 58 | return m_trayTheme; 59 | } 60 | 61 | void TrayController::setTrayIcon() { 62 | if (isTrayAvailable() && !m_trayTheme.isEmpty() && m_temperature < 300) { 63 | trayIcon->setIcon(QIcon(QPixmap::fromImage(createTrayIcon(m_temperature, m_trayTheme)))); 64 | } 65 | } 66 | 67 | void TrayController::initialiseTray() { 68 | if (!isTrayAvailable()) { 69 | QIcon firstIcon(Util::iconPathPrefix().remove("file:") + "cumulus.png"); 70 | trayIcon = new QSystemTrayIcon(); 71 | trayIcon->setIcon(firstIcon); 72 | QMenu *trayMenu = new QMenu(); 73 | QAction *showAction = new QAction("Show", trayMenu); 74 | connect(showAction, SIGNAL(triggered(bool)), this, SLOT(emitShowGui())); 75 | QAction *closeAction = new QAction("Close", trayMenu); 76 | connect(closeAction, SIGNAL(triggered(bool)), this, SLOT(emitCloseApp())); 77 | trayMenu->addAction(showAction); 78 | trayMenu->addAction(closeAction); 79 | trayIcon->setContextMenu(trayMenu); 80 | trayIcon->show(); 81 | connect(this, SIGNAL(temperatureChanged()), this, SLOT(setTrayIcon())); 82 | connect(this, SIGNAL(trayThemeChanged()), this, SLOT(setTrayIcon())); 83 | } 84 | } 85 | 86 | void TrayController::enableTray() { 87 | initialiseTray(); 88 | if (isTrayAvailable()) 89 | setTrayIcon(); 90 | } 91 | 92 | void TrayController::disableTray() { 93 | if (isTrayAvailable()) { 94 | trayIcon->hide(); 95 | delete trayIcon; 96 | trayIcon = nullptr; 97 | } 98 | } 99 | 100 | void TrayController::emitCloseApp() { 101 | emit closeApp(); 102 | } 103 | 104 | void TrayController::emitShowGui() { 105 | emit showGui(); 106 | } 107 | 108 | QImage TrayController::createTrayIcon(const int &temperature, const QString &theme) { 109 | QString color = theme == "light" ? "white" : "black"; 110 | QString temperatureString = QString::number(temperature) + "°"; 111 | int imageSize = 44; 112 | int pixelSize = 24; 113 | if (temperature >= 100) { 114 | imageSize = 66; 115 | pixelSize = 28; 116 | } 117 | QImage image(imageSize, imageSize, QImage::Format_ARGB32_Premultiplied); 118 | QFont font; 119 | font.setPixelSize(pixelSize); 120 | font.setBold(true); 121 | image.fill(Qt::transparent); 122 | QPainter painter(&image); 123 | painter.setFont(font); 124 | painter.setPen(QColor(color)); 125 | painter.setRenderHint(QPainter::Antialiasing); 126 | painter.drawText(image.rect(), Qt::AlignCenter, temperatureString); 127 | return image; 128 | } 129 | 130 | bool TrayController::isTrayAvailable() { 131 | return (QSystemTrayIcon::isSystemTrayAvailable() 132 | && trayIcon != nullptr 133 | && trayIcon->isVisible()); 134 | } 135 | -------------------------------------------------------------------------------- /qml/LocationView.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.0 2 | import QtQuick.Controls 1.4 3 | 4 | import ownTypes.LocationController 0.1 5 | 6 | SimpleItem { 7 | id: root 8 | property string textColor: "#ffffff" 9 | property string textFontFamily: "Arial" 10 | property alias locationController: locationController 11 | signal noLocation() 12 | signal viewWeather() 13 | ListView { 14 | id: locationList 15 | anchors.top: parent.top 16 | anchors.left: parent.left 17 | anchors.leftMargin: 10 18 | width: parent.width - 20 19 | height: (parent.height - addLocationButton.height - 20) 20 | orientation: ListView.Vertical 21 | snapMode: ListView.SnapToItem 22 | clip: true 23 | spacing: 2 24 | delegate: LocationItemDelegate { 25 | locationId: model.modelData.locationId 26 | text: model.modelData.locationName 27 | textColor: root.textColor 28 | textFontFamily: root.textFontFamily 29 | width: parent.width 30 | height: 50 31 | isSelected: model.modelData.isCurrentLocation 32 | onClicked: { 33 | if (!isSelected) { 34 | locationController.changeCurrentLocation(locationId) 35 | } 36 | } 37 | onClickedDelete: { 38 | if (!isSelected) 39 | locationController.deleteLocation(locationId) 40 | } 41 | } 42 | model: locationController.locationList 43 | } 44 | 45 | ClickableItem { 46 | id: addLocationButton 47 | width: 50 48 | height: width 49 | anchors.right: parent.right 50 | anchors.rightMargin: 10 51 | anchors.bottom: parent.bottom 52 | anchors.bottomMargin: 10 53 | backgroundOpacity: 1.0 54 | backgroundColor: "transparent" 55 | hoveredBackgroundOpacity: 0.6 56 | unhoveredBackgroundOpacity: 1.0 57 | borderColor: root.textColor 58 | borderWidth: 1 59 | radius: (width / 2) 60 | Image { 61 | anchors.centerIn: parent 62 | height: (parent.height * 70 / 100) 63 | width: height 64 | sourceSize.height: height 65 | sourceSize.width: width 66 | source: "image://fontimage/\uf067" + (root.textColor ? root.textColor : "#ffffff") 67 | } 68 | onClicked: { 69 | locationSearchLoader.source = "SearchLocation.qml" 70 | locationSearchLoader.visible = true 71 | locationSearchLoader.item.visible = true 72 | locationController.getGpsLocation() 73 | } 74 | } 75 | 76 | Loader { 77 | id: locationSearchLoader 78 | visible: false 79 | Binding { 80 | when: (locationSearchLoader.visible) 81 | target: locationSearchLoader.item 82 | property: "backgroundColor" 83 | value: root.backgroundColor 84 | } 85 | Binding { 86 | when: (locationSearchLoader.visible) 87 | target: locationSearchLoader.item 88 | property: "textColor" 89 | value: root.textColor 90 | } 91 | Binding { 92 | when: (locationSearchLoader.visible) 93 | target: locationSearchLoader.item 94 | property: "textFontFamily" 95 | value: root.textFontFamily 96 | } 97 | Binding { 98 | when: (locationSearchLoader.visible) 99 | target: locationSearchLoader.item 100 | property: "width" 101 | value: root.width 102 | } 103 | Binding { 104 | when: (locationSearchLoader.visible) 105 | target: locationSearchLoader.item 106 | property: "height" 107 | value: root.height 108 | } 109 | Binding { 110 | when: (locationSearchLoader.visible) 111 | target: locationSearchLoader.item 112 | property: "searchListModel" 113 | value: locationController.locationSearchList 114 | } 115 | Binding { 116 | when: (locationSearchLoader.visible) 117 | target: locationSearchLoader.item 118 | property: "gpsLocation" 119 | value: locationController.gpsLocation 120 | } 121 | Connections { 122 | id: locationSearchCon 123 | target: locationSearchLoader.item 124 | onLocationQueryChanged: locationController.searchLocation(locationSearchLoader.item.locationQuery) 125 | onLocationSelected: { 126 | locationController.insertLocation(locationSelected) 127 | locationSearchLoader.visible = false 128 | } 129 | onVisibleChanged: if (!locationSearchLoader.item.visible) root.forceActiveFocus() 130 | } 131 | } 132 | LocationController { 133 | id: locationController 134 | onNoLocation: { 135 | root.noLocation() 136 | addLocationButton.clicked() 137 | } 138 | } 139 | Component.onCompleted: locationController.getLocationList() 140 | Keys.onEscapePressed: root.viewWeather() 141 | Keys.onBackPressed: root.viewWeather() 142 | } 143 | -------------------------------------------------------------------------------- /CppFiles/DatabaseHelper.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 Adrian Verban 3 | * Maintainers: Adrian Verban 4 | * Derived from Typhoon by Archisman Panigrahi which is based on Stormcloud by Jono Cooper 5 | * Thanks to all the contributors. 6 | * Using the Ubuntu Condensed font. 7 | * This file is part of Cumulus. 8 | # 9 | * Cumulus is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | # 14 | * Cumulus is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | # 19 | * You should have received a copy of the GNU General Public License 20 | * along with Cumulus. If not, see . 21 | */ 22 | #ifndef DATABASEHELPER_H 23 | #define DATABASEHELPER_H 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | #include "Forecast.h" 38 | #include "SettingsController.h" 39 | 40 | using namespace std; 41 | 42 | struct location_table_definition { 43 | const QString 44 | TABLE_NAME = "db_ma_location", 45 | LOC_ID_COLUMN = "loc_id", 46 | LOC_CODE_COLUMN = "loc_code", 47 | LOC_NAME_COLUMN = "loc_name"; 48 | }; 49 | 50 | struct location_struct { 51 | int m_locationId; 52 | QString m_locationCode, m_locationName; 53 | }; 54 | 55 | struct weather_struct { 56 | QString m_weatherIcon, m_weatherDescription, m_location, m_locationLink, m_tempUnit, 57 | m_sunrise, m_sunset, m_speedUnit; 58 | float m_pressure; 59 | int m_weatherCode, m_temperature, m_windSpeed, m_windDegree, m_humidity, m_locationId, 60 | m_tempMin, m_tempMax; 61 | QList m_forecastList; 62 | QList *m_forecastListPtr; 63 | }; 64 | 65 | struct weather_table_definition { 66 | const QString 67 | TABLE_NAME = "db_tr_weather", 68 | WEATHER_ID_COLUMN = "weather_id", 69 | WEATHER_CODE_COLUMN = "weather_code", 70 | WEATHER_DESCRIPTION_COLUMN = "weather_description", 71 | WEATHER_TEMPERATURE_COLUMN = "weather_temperature", 72 | WEATHER_PRESSURE_COLUMN = "weather_pressure", 73 | WEATHER_HUMIDITY_COLUMN = "weather_humidity", 74 | WEATHER_WIND_SPEED_COLUMN = "weather_wind_speed", 75 | WEATHER_WIND_DEGREE_COLUMN = "weather_wind_degree", 76 | WEATHER_SUNRISE_COLUMN = "weather_sunrise", 77 | WEATHER_SUNSET_COLUMN = "weather_sunset", 78 | WEATHER_LINK_COLUMN = "weather_link", 79 | WEATHER_LOC_ID_COLUMN = "weather_loc_id"; 80 | }; 81 | 82 | struct forecast_table_definition { 83 | const QString 84 | TABLE_NAME = "db_tr_forecast", 85 | FOREC_ID_COLUMN = "forec_id", 86 | FOREC_DATE_COLUMN = "forec_date", 87 | FOREC_WEATHER_CODE_COLUMN = "forec_weather_code", 88 | FOREC_WEATHER_DESCRIPTION_COLUMN = "forec_weather_description", 89 | FOREC_TEMP_MIN_COLUMN = "forec_temp_min", 90 | FOREC_TEMP_MAX_COLUMN = "forec_temp_max", 91 | FOREC_PRESSURE_COLUMN = "forec_pressure", 92 | FOREC_HUMIDITY_COLUMN = "forec_humidity", 93 | FOREC_WIND_SPEED_COLUMN = "forec_wind_speed", 94 | FOREC_WIND_DEGREE_COLUMN = "forec_wind_degree", 95 | FOREC_LOC_ID_COLUMN = "forec_loc_id"; 96 | }; 97 | 98 | class DatabaseHelper : public QObject { 99 | Q_OBJECT 100 | QString locationTableCreationQuery(); 101 | QString weatherTableCreationQuery(); 102 | QString forecastTableCreationQuery(); 103 | bool startCon(QSqlDatabase &db); 104 | bool stopCon(QSqlDatabase &db); 105 | QSqlDatabase getDatabase(); 106 | QString databaseName(const QString &appName); 107 | void emitQueryError(const QString &method, const QString &errorString); 108 | public: 109 | bool databaseInit(); 110 | static struct location_table_definition DB_MA_LOCATION; 111 | static struct weather_table_definition DB_TR_WEATHER; 112 | static struct forecast_table_definition DB_TR_FORECAST; 113 | explicit DatabaseHelper(QObject *parent = nullptr); 114 | bool clearLocationCode(); 115 | location_struct getLocation(const int &locationId); 116 | location_struct findLocation(const QString &locationName); 117 | QList getLocationList(); 118 | bool insertLocation(const location_struct &location); 119 | bool updateLocation(const location_struct &location); 120 | bool deleteLocation(const int &locationId); 121 | int lastLocationId(); 122 | weather_struct getWeather(const int &locationId); 123 | bool insertWeather(const weather_struct &weatherPtr); 124 | bool deleteWeather(const int &locationId); 125 | QList getForecast(const int &locationId); 126 | bool insertForecast(const QList &forecastList); 127 | bool insertForecast(const Forecast *forecast, const QSqlDatabase &db); 128 | bool deleteForecast(const int &locationId); 129 | signals: 130 | void queryError(QString errorString); 131 | void querySuccessful(); 132 | }; 133 | 134 | #endif // DATABASEHELPER_H 135 | -------------------------------------------------------------------------------- /main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 2017 Adrian Verban 3 | * Maintainers: Adrian Verban 4 | * Derived from Typhoon by Archisman Panigrahi which is based on Stormcloud by Jono Cooper 5 | * Thanks to all the contributors. 6 | * Using the Ubuntu Condensed font. 7 | * This file is part of Cumulus. 8 | # 9 | * Cumulus is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | # 14 | * Cumulus is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | # 19 | * You should have received a copy of the GNU General Public License 20 | * along with Cumulus. If not, see . 21 | */ 22 | #include 23 | #include 24 | #include "CppFiles/DatabaseHelper.h" 25 | #if defined(Q_OS_ANDROID) 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | 33 | #include "CppFiles/WeatherType.h" 34 | #include "CppFiles/Forecast.h" 35 | #include "CppFiles/Util.h" 36 | #include "CppFiles/SettingsController.h" 37 | #include "CppFiles/TrayController.h" 38 | #include "CppFiles/ThreadWorker.h" 39 | #include "CppFiles/CustomImageProvider.h" 40 | #include "CppFiles/FontImageProvider.h" 41 | #include "CppFiles/Location.h" 42 | void registerQmlType(); 43 | #else 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | 50 | #include "CppFiles/MainWindow.h" 51 | #include "CppFiles/ThreadWorker.h" 52 | #endif 53 | 54 | #define SHLIB_VERSION_NUMBER "1.0.0" 55 | int main(int argc, char *argv[]) { 56 | QLibrary libcrypto, libssl; 57 | libcrypto.setFileNameAndVersion(QLatin1String("crypto"), QLatin1String(SHLIB_VERSION_NUMBER)); 58 | libssl.setFileNameAndVersion(QLatin1String("ssl"), QLatin1String(SHLIB_VERSION_NUMBER)); 59 | #if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 2)) 60 | QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); 61 | #endif 62 | QApplication app(argc, argv); 63 | QCoreApplication::addLibraryPath(QLibraryInfo::location(QLibraryInfo::LibrariesPath)); 64 | QString applicationName = "Cumulus"; 65 | if (argc > 2 && QString::fromLatin1(argv[1]) == "-i") { 66 | applicationName = applicationName + "-" + argv[2]; 67 | } 68 | QApplication::setOrganizationName("Visoft"); 69 | QApplication::setApplicationName(applicationName); 70 | qRegisterMetaType>("QList"); 71 | qRegisterMetaType("weather_struct"); 72 | DatabaseHelper *dbHelper = new DatabaseHelper; 73 | dbHelper->databaseInit(); 74 | delete(dbHelper); 75 | QTranslator translator; 76 | QString defaultLocale = QLocale::system().name(); 77 | defaultLocale.truncate(defaultLocale.lastIndexOf("_")); 78 | QString langPath = ":/translations/"; 79 | if (translator.load(langPath.append("tempestas_").append(defaultLocale).append(".qm"))) { 80 | app.installTranslator(&translator); 81 | } 82 | #if defined(Q_OS_ANDROID) 83 | Util util; 84 | SettingsController settingsController; 85 | QQmlApplicationEngine engine; 86 | engine.addImageProvider(QLatin1String("customimage"), new CustomImageProvider()); 87 | engine.addImageProvider(QLatin1String("fontimage"), new FontImageProvider()); 88 | QQmlContext *context = engine.rootContext(); 89 | context->setContextProperty("util", &util); 90 | context->setContextProperty("settingsController", &settingsController); 91 | context->setContextProperty("applicationPath", "file://" + qApp->applicationDirPath() + "/"); 92 | registerQmlType(); 93 | engine.load(QUrl(QLatin1String("qrc:/qml/main-android.qml"))); 94 | #else 95 | MainWindow w; 96 | w.launchApp(); 97 | if (QFile::exists(QApplication::applicationDirPath() + "/maintenancetool")) { 98 | ThreadWorker *threadWorker = new ThreadWorker(); 99 | QThread *thread = new QThread(); 100 | threadWorker->moveToThread(thread); 101 | QObject::connect(thread, SIGNAL(started()), threadWorker, SLOT(updaterTimerStart())); 102 | QObject::connect(threadWorker, SIGNAL(startUpdateTimerSignal()), threadWorker, SLOT(updaterTimerStart())); 103 | QObject::connect(threadWorker, SIGNAL(stopUpdatesSearch()), thread, SLOT(quit())); 104 | QObject::connect(thread, SIGNAL(finished()), threadWorker, SLOT(deleteLater())); 105 | QObject::connect(thread, SIGNAL(finished()), thread, SLOT(deleteLater())); 106 | thread->start(); 107 | } 108 | #endif 109 | return app.exec(); 110 | } 111 | 112 | #if defined(Q_OS_ANDROID) 113 | void registerQmlType() { 114 | qmlRegisterType("ownTypes.weather", 1, 9, "Weather"); 115 | qmlRegisterType("ownTypes.settingsController", 1, 0, "SettingsController"); 116 | qmlRegisterType("ownTypes.TrayController", 0, 3, "TrayController"); 117 | qmlRegisterType("ownTypes.LocationController", 0, 1, "LocationController"); 118 | } 119 | #endif 120 | -------------------------------------------------------------------------------- /android/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 71 | 72 | 73 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /qml/CustomSwitch.qml: -------------------------------------------------------------------------------- 1 | import QtQuick 2.0 2 | import QtGraphicalEffects 1.0 3 | import QtQuick.Layouts 1.0 4 | 5 | Item { 6 | id: root 7 | property string railColor: root.checked == true ? root.checkedColor : root.uncheckedColor 8 | property string textColor: "#ffffff" 9 | property string labelColor: "#000000" 10 | property string leftTextColor: root.textColor 11 | property string rightTextColor: root.textColor 12 | property int borderRadius: 0 13 | property string rightText: "" 14 | property string leftText: "" 15 | property string state: root.leftStateValue 16 | property bool checked: root.state == rightStateValue ? true : false 17 | property string leftStateValue: "left" 18 | property string rightStateValue: "right" 19 | property string checkedColor: "#34ad32" 20 | property string uncheckedColor: "#666666" 21 | property string font: "Arial" 22 | property int switchRailWidth: 100 23 | property int switchRailHeight: 30 24 | property string switchLabel: "" 25 | RowLayout { 26 | id: switchLayout 27 | anchors.fill: parent 28 | spacing: 5 29 | Text { 30 | id: labelText 31 | Layout.fillWidth: true 32 | Layout.fillHeight: true 33 | Layout.leftMargin: 10 34 | horizontalAlignment: Text.AlignLeft 35 | verticalAlignment: Text.AlignVCenter 36 | color: root.labelColor 37 | text: root.switchLabel 38 | } 39 | Rectangle { 40 | id: switchRail 41 | Layout.fillWidth: false 42 | Layout.fillHeight: false 43 | Layout.preferredWidth: root.switchRailWidth 44 | Layout.preferredHeight: root.switchRailHeight 45 | Layout.alignment: Qt.AlignRight | Qt.AlignVCenter 46 | Layout.rightMargin: 10 47 | color: root.railColor 48 | radius: root.borderRadius 49 | antialiasing: true 50 | Rectangle { 51 | id: switchRailBorder 52 | anchors.top: parent.top 53 | anchors.topMargin: 1 54 | anchors.left: parent.left 55 | anchors.leftMargin: 1 56 | width: parent.width - 2 57 | height: parent.height - 2 58 | border.color: "gray" 59 | border.width: 1 60 | color: "transparent" 61 | Text { 62 | id: leftText 63 | anchors.left: parent.left 64 | height: switchRailBorder.height 65 | width: switchRailBorder.width / 2 66 | horizontalAlignment: Text.AlignHCenter 67 | verticalAlignment: Text.AlignVCenter 68 | font.bold: true 69 | text: root.leftText 70 | color: root.leftTextColor 71 | font.family: root.font 72 | } 73 | Text { 74 | id: rightText 75 | anchors.right: parent.right 76 | height: switchRailBorder.height 77 | width: switchRailBorder.width / 2 78 | horizontalAlignment: Text.AlignHCenter 79 | verticalAlignment: Text.AlignVCenter 80 | font.bold: true 81 | text: root.rightText 82 | color: root.rightTextColor 83 | font.family: root.font 84 | } 85 | Rectangle { 86 | id: switchButton 87 | anchors.top: switchRailBorder.top 88 | anchors.topMargin: (switchRailBorder.height - switchButton.height) / 2 89 | height: switchRailBorder.height 90 | width: (switchRailBorder.width / 2) 91 | border.width: 1 92 | border.color: "#BBBBBB" 93 | state: root.state 94 | states: [ 95 | State { 96 | name: root.rightStateValue 97 | PropertyChanges { 98 | target: switchButton 99 | x: (switchRailBorder.width / 2) 100 | } 101 | }, 102 | State { 103 | name: root.leftStateValue 104 | PropertyChanges { 105 | target: switchButton 106 | x: 0 107 | } 108 | } 109 | ] 110 | transitions: Transition { 111 | NumberAnimation { 112 | properties: "x" 113 | easing.type: Easing.InOutBack 114 | } 115 | } 116 | RadialGradient { 117 | anchors.fill: parent 118 | source: parent 119 | gradient: Gradient { 120 | GradientStop { position: 0.0; color: "#bcbcbc" } 121 | GradientStop { position: 1.0; color: "#cccccc" } 122 | } 123 | } 124 | } 125 | MouseArea { 126 | id: mouse 127 | anchors.fill: parent 128 | onClicked: root.state = ((root.state == root.leftStateValue) ? root.rightStateValue : root.leftStateValue) 129 | } 130 | } 131 | } 132 | } 133 | } 134 | -------------------------------------------------------------------------------- /qml/ApplicationBar.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 - 2017 Adrian Verban 3 | * Maintainers: Adrian Verban 4 | * Derived from Typhoon by Archisman Panigrahi which is based on Stormcloud by Jono Cooper 5 | * Thanks to all the contributors. 6 | * Using the Ubuntu Condensed font. 7 | * This file is part of Cumulus. 8 | # 9 | * Cumulus is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | # 14 | * Cumulus is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | # 19 | * You should have received a copy of the GNU General Public License 20 | * along with Cumulus. If not, see . 21 | */ 22 | import QtQuick 2.0 23 | import QtQuick.Layouts 1.0 24 | 25 | Item { 26 | id: root 27 | signal menuButtonClicked() 28 | signal closeButtonClicked() 29 | signal minimizeButtonClicked() 30 | signal refreshButtonClicked() 31 | signal locationButtonClicked() 32 | property string textColor: "#ffffff" 33 | property string iconsFont 34 | property alias animationAlias: refreshRotateAnim 35 | property alias moveControlAlias: moveControlBar 36 | property alias menuButtonAlias: menuButton 37 | property alias refreshButtonAlias: refreshButton 38 | property alias locationButtonAlias: locationButton 39 | property int controlButtonsSize: 18 40 | property string windowControlsPos: "" 41 | property string locationName: "" 42 | property string textFontFamily: "Arial" 43 | property point mousePosition: Qt.point(0,0) 44 | 45 | MenuButton { 46 | id: closeButton 47 | anchors.top: parent.top 48 | anchors.left: (windowControlsPos == "left") ? parent.left : minimizeButton.right 49 | height: parent.height 50 | width: visible ? height : 0 51 | visible: false 52 | imageSource: ("image://customimage/x" + root.textColor) 53 | onClicked: root.closeButtonClicked() 54 | } 55 | MenuButton { 56 | id: minimizeButton 57 | anchors.top: parent.top 58 | anchors.left: (windowControlsPos == "left") ? closeButton.right : locationButton.right 59 | height: parent.height 60 | width: visible ? height : 0 61 | visible: false 62 | imageSource: ("image://customimage/-" + root.textColor) 63 | onClicked: root.minimizeButtonClicked() 64 | } 65 | MenuButton { 66 | id: locationButton 67 | anchors.top: parent.top 68 | anchors.left: (windowControlsPos == "left") ? minimizeButton.right : moveControlBar.right 69 | anchors.leftMargin: (closeButton.visible && minimizeButton.visible) ? 0 : (windowControlsPos == "left") ? 0 : locationButtonAlias.width 70 | height: parent.height 71 | width: height 72 | visible: true 73 | imageSource: ("image://fontimage/\uf041" + root.textColor) 74 | onClicked: root.locationButtonClicked() 75 | } 76 | Text { 77 | id: moveControlBar 78 | text: locationName 79 | color: root.textColor 80 | anchors.top: parent.top 81 | anchors.left: (windowControlsPos == "left") ? locationButton.right : refreshButton.right 82 | anchors.leftMargin: (closeButton.visible && minimizeButton.visible) ? 0 : (windowControlsPos == "left") ? locationButtonAlias.width : 0 83 | height: parent.height 84 | width: (closeButton.visible && minimizeButton.visible) ? (parent.width - (parent.height * 5)) : (parent.width - (parent.height * 4)) 85 | horizontalAlignment: Text.AlignHCenter 86 | verticalAlignment: Text.AlignVCenter 87 | font.family: root.textFontFamily 88 | font.pixelSize: 18 89 | MouseArea { 90 | id: moveMouseArea 91 | anchors.fill: parent 92 | cursorShape: pressed ? Qt.ClosedHandCursor : Qt.OpenHandCursor 93 | property point pressPosition: Qt.point(0,0) 94 | onPressed: moveMouseArea.pressPosition = Qt.point(mouseX, mouseY) 95 | onPositionChanged: { 96 | if (pressed && closeButton.visible && minimizeButton.visible) { 97 | root.mousePosition = Qt.point(mouseX - pressPosition.x, mouseY - pressPosition.y) 98 | } 99 | } 100 | } 101 | } 102 | 103 | MenuButton { 104 | id: refreshButton 105 | anchors.top: parent.top 106 | anchors.left: (windowControlsPos == "left") ? moveControlBar.right : menuButton.right 107 | height: parent.height 108 | width: height 109 | visible: true 110 | imageSource: ("image://fontimage/\uf021" + root.textColor) 111 | onClicked: root.refreshButtonClicked() 112 | RotationAnimation on rotation { 113 | id: refreshRotateAnim 114 | direction: RotationAnimation.Clockwise 115 | from: 0 116 | to: 360 117 | loops: RotationAnimation.Infinite 118 | alwaysRunToEnd: true 119 | } 120 | } 121 | MenuButton { 122 | id: menuButton 123 | anchors.top: parent.top 124 | anchors.left: windowControlsPos == "left" ? refreshButton.right : parent.left 125 | height: parent.height 126 | width: height 127 | visible: true 128 | imageSource: ("image://fontimage/\uf085" + root.textColor) 129 | onClicked: root.menuButtonClicked() 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /CppFiles/AbstractWeatherController.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 - 2017 Adrian Verban 3 | * Maintainers: Adrian Verban 4 | * Derived from Typhoon by Archisman Panigrahi which is based on Stormcloud by Jono Cooper 5 | * Thanks to all the contributors. 6 | * Using the Ubuntu Condensed font. 7 | * This file is part of Cumulus. 8 | # 9 | * Cumulus is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | # 14 | * Cumulus is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | # 19 | * You should have received a copy of the GNU General Public License 20 | * along with Cumulus. If not, see . 21 | */ 22 | #include "AbstractWeatherController.h" 23 | 24 | AbstractWeatherController::AbstractWeatherController(QObject *parent) : QObject(parent) 25 | , name("abstract") {} 26 | 27 | QJsonObject AbstractWeatherController::nextBranch(const QJsonObject &jsonObject, const QString current) const { 28 | return jsonObject.find(current).value().toObject(); 29 | } 30 | 31 | void AbstractWeatherController::manageError(const QString error) { 32 | qDebug() << "AbstractWeatherController::manageError" << error; 33 | emit networkError(error); 34 | } 35 | 36 | void AbstractWeatherController::getWeather() { 37 | SettingsController settings; 38 | dataController = new DataController(this); 39 | connect(dataController, SIGNAL(networkError(QString)), this, SLOT(manageError(QString))); 40 | if (settings.useGps()) { 41 | QGeoPositionInfoSource *posInfoSource = QGeoPositionInfoSource::createDefaultSource(this); 42 | if (posInfoSource) { 43 | posInfoSource->setUpdateInterval(10000); 44 | connect(posInfoSource, SIGNAL(positionUpdated(QGeoPositionInfo)), this, SLOT(locationPositionInfo(QGeoPositionInfo))); 45 | connect(posInfoSource, SIGNAL(positionUpdated(QGeoPositionInfo)), posInfoSource, SLOT(stopUpdates())); 46 | connect(posInfoSource, SIGNAL(positionUpdated(QGeoPositionInfo)), posInfoSource, SLOT(deleteLater())); 47 | connect(posInfoSource, SIGNAL(error(QGeoPositionInfoSource::Error)), this, SLOT(locationPositionError(QGeoPositionInfoSource::Error))); 48 | posInfoSource->startUpdates(); 49 | } 50 | else { 51 | emit networkError("Could not use GPS!"); 52 | } 53 | } 54 | else { 55 | DatabaseHelper dbHelper; 56 | location_struct location = dbHelper.getLocation(settings.currentLocationId()); 57 | if (location.m_locationId > 0) { 58 | if (location.m_locationCode.trimmed().size() > 0) { 59 | searchBycode(location.m_locationCode); 60 | } 61 | else { 62 | searchByLocation(location.m_locationName); 63 | } 64 | } 65 | } 66 | } 67 | 68 | bool AbstractWeatherController::saveLocation(const QString &code) { 69 | SettingsController settings; 70 | bool result = true; 71 | if (!settings.useGps()) { 72 | result = false; 73 | DatabaseHelper dbHelper; 74 | location_struct location = dbHelper.getLocation(settings.currentLocationId()); 75 | location.m_locationCode = code; 76 | result = dbHelper.updateLocation(location); 77 | if (!result) 78 | emit saveDataError("Error saving location code!"); 79 | } 80 | return result; 81 | } 82 | 83 | bool AbstractWeatherController::saveLocation(const QString &code, const QString &name) { 84 | SettingsController settings; 85 | DatabaseHelper dbHelper; 86 | bool result = false; 87 | location_struct location = dbHelper.getLocation(settings.currentLocationId()); 88 | location.m_locationCode = code; 89 | location.m_locationName = name; 90 | result = dbHelper.updateLocation(location); 91 | if (!result) 92 | emit saveDataError("Error saving location code!"); 93 | return result; 94 | } 95 | 96 | bool AbstractWeatherController::saveWeather(const weather_struct &weather) { 97 | DatabaseHelper dbHelper; 98 | bool result = dbHelper.deleteWeather(weather.m_locationId); 99 | if (result) { 100 | result = dbHelper.insertWeather(weather); 101 | if (!result) 102 | emit saveDataError("Error saving weather!"); 103 | } 104 | return result; 105 | } 106 | 107 | void AbstractWeatherController::saveForecast(QList &forecastList) { 108 | DatabaseHelper dbHelper; 109 | bool result = dbHelper.insertForecast(forecastList); 110 | m_weather.m_forecastListPtr = new QList(forecastList); 111 | if (!result) 112 | emit saveDataError("Error saving forecast!"); 113 | else 114 | emit weatherSet(m_weather); 115 | } 116 | 117 | void AbstractWeatherController::locationPositionInfo(const QGeoPositionInfo &posInfo) { 118 | double lat = posInfo.coordinate().latitude(); 119 | double lon = posInfo.coordinate().longitude(); 120 | searchByGps(lat, lon); 121 | } 122 | 123 | void AbstractWeatherController::locationPositionError(const QGeoPositionInfoSource::Error &positioningError) { 124 | switch (positioningError) { 125 | case QGeoPositionInfoSource::AccessError: 126 | manageError("Location has access error!"); 127 | break; 128 | case QGeoPositionInfoSource::ClosedError: 129 | manageError("Location services are off!"); 130 | break; 131 | case QGeoPositionInfoSource::UnknownSourceError: 132 | manageError("An unidentified error occurred when requesting loation!"); 133 | break; 134 | default: 135 | break; 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="-Xmx1024m -Dfile.encoding=UTF-8" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn ( ) { 37 | echo "$*" 38 | } 39 | 40 | die ( ) { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save ( ) { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /CppFiles/WeatherType.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 - 2017 Adrian Verban 3 | * Maintainers: Adrian Verban 4 | * Derived from Typhoon by Archisman Panigrahi which is based on Stormcloud by Jono Cooper 5 | * Thanks to all the contributors. 6 | * Using the Ubuntu Condensed font. 7 | * This file is part of Cumulus. 8 | # 9 | * Cumulus is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | # 14 | * Cumulus is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | # 19 | * You should have received a copy of the GNU General Public License 20 | * along with Cumulus. If not, see . 21 | */ 22 | #ifndef WEATHERTYPE_H 23 | #define WEATHERTYPE_H 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #include "Util.h" 31 | #include "YWeatherController.h" 32 | #include "OwmWeatherController.h" 33 | #include "Forecast.h" 34 | #include "WundWeatherController.h" 35 | class WeatherType : public QObject { 36 | Q_OBJECT 37 | QString m_weather, m_weatherIcon, m_weatherDescription, m_location, m_locationLink, m_tempUnit, 38 | m_sunrise, m_sunset, m_speedUnit; 39 | float m_pressure; 40 | int m_weatherCode, m_temperature, m_windSpeed, m_windDegree, m_humidity; 41 | int m_tempMin, m_tempMax; 42 | QList m_forecastList; 43 | QThread *thread; 44 | 45 | Q_PROPERTY(QString weather READ weather WRITE setWeather NOTIFY weatherChanged) 46 | Q_PROPERTY(int weatherCode READ weatherCode WRITE setWeatherCode NOTIFY weatherCodeChanged) 47 | Q_PROPERTY(QString weatherIcon READ weatherIcon WRITE setWeatherIcon NOTIFY weatherIconChanged) 48 | Q_PROPERTY(QString weatherDescription READ weatherDescription WRITE setWeatherDescription NOTIFY weatherDescriptionChanged) 49 | Q_PROPERTY(int temperature READ temperature WRITE setTemperature NOTIFY temperatureChanged) 50 | Q_PROPERTY(double pressure READ pressure WRITE setPressure NOTIFY pressureChanged) 51 | Q_PROPERTY(QString tempUnit READ tempUnit WRITE setTempUnit NOTIFY tempUnitChanged) 52 | Q_PROPERTY(QString location READ location WRITE setLocation NOTIFY locationChanged) 53 | Q_PROPERTY(QString locationLink READ locationLink WRITE setLocationLink NOTIFY locationLinkChanged) 54 | Q_PROPERTY(int windSpeed READ windSpeed WRITE setWindSpeed NOTIFY windSpeedChanged) 55 | Q_PROPERTY(int windDegree READ windDegree WRITE setWindDegree NOTIFY windDegreeChanged) 56 | Q_PROPERTY(int humidity READ humidity WRITE setHumidity NOTIFY humidityChanged) 57 | Q_PROPERTY(QString sunrise READ sunrise WRITE setSunrise NOTIFY sunriseChanged) 58 | Q_PROPERTY(QString sunset READ sunset WRITE setSunset NOTIFY sunsetChanged) 59 | Q_PROPERTY(int tempMax READ tempMax WRITE setTempMax NOTIFY tempMaxChanged) 60 | Q_PROPERTY(int tempMin READ tempMin WRITE setTempMin NOTIFY tempMinChanged) 61 | Q_PROPERTY(QList forecastList READ forecastList WRITE setForecastList NOTIFY forecastListChanged) 62 | Q_PROPERTY(QString speedUnit READ speedUnit WRITE setSpeedUnit NOTIFY speedUnitChanged) 63 | 64 | void updateTemperature(const QString &tempUnit); 65 | void updateForecastTemp(const QString &newUnit); 66 | void clearForecastList(); 67 | QPointer weatherController; 68 | public: 69 | explicit WeatherType(QObject *parent = nullptr); 70 | ~WeatherType(); 71 | void setWeather(const QString &weather); 72 | QString weather() const; 73 | void setWeatherCode(const int &weatherCode); 74 | int weatherCode() const; 75 | void setWeatherIcon(const QString &weatherIcon); 76 | QString weatherIcon() const; 77 | void setWeatherDescription(const QString &weatherDescription); 78 | QString weatherDescription() const; 79 | void setTemperature(const int &temp); 80 | int temperature() const; 81 | void setPressure(const double &pressure); 82 | double pressure() const; 83 | void setHumidity(const float &humidity); 84 | float humidity() const; 85 | void setWindSpeed(const int &windspeed); 86 | int windSpeed() const; 87 | void setWindDegree(const int &windDegree); 88 | int windDegree() const; 89 | void setTempUnit(const QString &tempUnit); 90 | QString tempUnit() const; 91 | void setLocation(const QString &location); 92 | QString location() const; 93 | void setLocationLink(const QString &locationLink); 94 | QString locationLink() const; 95 | void setSunrise(const QString &sunrise); 96 | QString sunrise() const; 97 | void setSunset(const QString &sunset); 98 | QString sunset() const; 99 | void setTempMax(const int &tempMax); 100 | int tempMax() const; 101 | void setTempMin(const int &tempMin); 102 | int tempMin() const; 103 | QList forecastList() const; 104 | void setForecastList(const QList &list); 105 | QString speedUnit() const; 106 | void setSpeedUnit(const QString &unit); 107 | public slots: 108 | void getWeatherData(); 109 | void setWeatherData(); 110 | void setWeatherData(const weather_struct &weather); 111 | signals: 112 | void weatherChanged(); 113 | void weatherCodeChanged(); 114 | void weatherDescriptionChanged(); 115 | void temperatureChanged(); 116 | void tempUnitChanged(); 117 | void locationChanged(); 118 | void windSpeedChanged(); 119 | void windDegreeChanged(); 120 | void humidityChanged(); 121 | void weatherDataChanged(); 122 | void locationLinkChanged(); 123 | void pressureChanged(); 124 | void weatherIconChanged(); 125 | void sunriseChanged(); 126 | void sunsetChanged(); 127 | void tempMinChanged(); 128 | void tempMaxChanged(); 129 | void dataDownloadFinished(); 130 | void forecastListChanged(); 131 | void speedUnitChanged(); 132 | void networkError(const QString &error); 133 | }; 134 | 135 | #endif // WEATHERTYPE_H 136 | -------------------------------------------------------------------------------- /Cumulus.pro: -------------------------------------------------------------------------------- 1 | QT += qml quick sql widgets quickwidgets concurrent positioning 2 | 3 | CONFIG += c++11 4 | 5 | SOURCES += \ 6 | CppFiles/AbstractWeatherController.cpp \ 7 | CppFiles/CreditsAuthor.cpp \ 8 | CppFiles/CustomImageProvider.cpp \ 9 | CppFiles/DatabaseHelper.cpp \ 10 | CppFiles/DataController.cpp \ 11 | CppFiles/FontImageProvider.cpp \ 12 | CppFiles/Forecast.cpp \ 13 | CppFiles/Location.cpp \ 14 | CppFiles/LocationController.cpp \ 15 | CppFiles/MainWindow.cpp \ 16 | CppFiles/OwmWeatherController.cpp \ 17 | CppFiles/SettingsController.cpp \ 18 | CppFiles/ThreadWorker.cpp \ 19 | CppFiles/TrayController.cpp \ 20 | CppFiles/Util.cpp \ 21 | CppFiles/WeatherType.cpp \ 22 | CppFiles/WundWeatherController.cpp \ 23 | CppFiles/YWeatherController.cpp \ 24 | main.cpp 25 | 26 | RESOURCES += qml.qrc 27 | 28 | # Additional import path used to resolve QML modules in Qt Creator's code model 29 | QML_IMPORT_PATH = 30 | 31 | # Default rules for deployment. 32 | include(deployment.pri) 33 | 34 | HEADERS += \ 35 | CppFiles/AbstractWeatherController.h \ 36 | CppFiles/CreditsAuthor.h \ 37 | CppFiles/CustomImageProvider.h \ 38 | CppFiles/DatabaseHelper.h \ 39 | CppFiles/DataController.h \ 40 | CppFiles/FontImageProvider.h \ 41 | CppFiles/Forecast.h \ 42 | CppFiles/Location.h \ 43 | CppFiles/LocationController.h \ 44 | CppFiles/MainWindow.h \ 45 | CppFiles/OwmWeatherController.h \ 46 | CppFiles/SettingsController.h \ 47 | CppFiles/ThreadWorker.h \ 48 | CppFiles/TrayController.h \ 49 | CppFiles/Util.h \ 50 | CppFiles/WeatherType.h \ 51 | CppFiles/WundWeatherController.h \ 52 | CppFiles/YWeatherController.h 53 | 54 | #QMAKE_LFLAGS += "-Wl,-rpath,\'\$$ORIGIN/lib\'" 55 | 56 | DISTFILES += \ 57 | README.md \ 58 | .travis.yml \ 59 | _config.yml \ 60 | android/AndroidManifest.xml \ 61 | android/gradle/wrapper/gradle-wrapper.jar \ 62 | android/gradlew \ 63 | docs/_config.yml \ 64 | android/res/values/libs.xml \ 65 | docs/assets/images/weather.gif \ 66 | android/assets/api.png \ 67 | android/assets/credits.png \ 68 | android/assets/cumulus.png \ 69 | android/assets/map.png \ 70 | android/assets/palette.png \ 71 | android/assets/speed_icon.png \ 72 | android/assets/temperature_icon.png \ 73 | android/assets/wund_logo.png \ 74 | android/assets/wund_logo_light.png \ 75 | android/assets/yw_logo.png \ 76 | android/res/drawable-hdpi/icon.png \ 77 | android/res/drawable-ldpi/api.png \ 78 | android/res/drawable-ldpi/credits.png \ 79 | android/res/drawable-ldpi/icon.png \ 80 | android/res/drawable-ldpi/map.png \ 81 | android/res/drawable-ldpi/palette.png \ 82 | android/res/drawable-ldpi/speed_icon.png \ 83 | android/res/drawable-ldpi/temperature_icon.png \ 84 | android/res/drawable-mdpi/api.png \ 85 | android/res/drawable-mdpi/credits.png \ 86 | android/res/drawable-mdpi/icon.png \ 87 | android/res/drawable-mdpi/map.png \ 88 | android/res/drawable-mdpi/palette.png \ 89 | android/res/drawable-mdpi/speed_icon.png \ 90 | android/res/drawable-mdpi/temperature_icon.png \ 91 | docs/assets/images/location.png \ 92 | docs/assets/images/settings.png \ 93 | docs/assets/images/weather.png \ 94 | docs/assets/images/weather_green.png \ 95 | docs/assets/images/weather_purp.png \ 96 | docs/assets/images/weather_red.png \ 97 | assets/icons/hicolor/128x128/api.png \ 98 | assets/icons/hicolor/128x128/credits.png \ 99 | assets/icons/hicolor/128x128/cumulus.png \ 100 | assets/icons/hicolor/128x128/map.png \ 101 | assets/icons/hicolor/128x128/palette.png \ 102 | assets/icons/hicolor/128x128/speed_icon.png \ 103 | assets/icons/hicolor/256x256/api.png \ 104 | assets/icons/hicolor/256x256/credits.png \ 105 | assets/icons/hicolor/256x256/cumulus.png \ 106 | assets/icons/hicolor/256x256/map.png \ 107 | assets/icons/hicolor/256x256/palette.png \ 108 | assets/icons/hicolor/256x256/speed_icon.png \ 109 | assets/icons/hicolor/256x256/temperature_icon.png \ 110 | assets/icons/hicolor/512x512/api.png \ 111 | assets/icons/hicolor/512x512/credits.png \ 112 | assets/icons/hicolor/512x512/cumulus.png \ 113 | assets/icons/hicolor/512x512/map.png \ 114 | assets/icons/hicolor/512x512/palette.png \ 115 | assets/icons/hicolor/512x512/speed_icon.png \ 116 | assets/icons/hicolor/512x512/temperature_icon.png \ 117 | assets/icons/hicolor/64x64/api.png \ 118 | assets/icons/hicolor/64x64/credits.png \ 119 | assets/icons/hicolor/64x64/cumulus.png \ 120 | assets/icons/hicolor/64x64/map.png \ 121 | assets/icons/hicolor/64x64/palette.png \ 122 | assets/icons/hicolor/64x64/speed_icon.png \ 123 | assets/icons/hicolor/64x64/temperature_icon.png \ 124 | assets/icons/wund_logo.png \ 125 | assets/icons/wund_logo_light.png \ 126 | assets/icons/yw_logo.png \ 127 | docs/index.md \ 128 | docs/multiple_inst.md \ 129 | android/gradle/wrapper/gradle-wrapper.properties \ 130 | android/build.gradle \ 131 | android/gradlew.bat \ 132 | assets/icons/hicolor/128x128/temperature_icon.png \ 133 | assets/icons/hicolor/scalable/cumulus.svg \ 134 | assets/weather_codes.json \ 135 | assets/screens/location-search.png \ 136 | assets/screens/locations-screen.png \ 137 | assets/screens/main-screen-forecast.png \ 138 | assets/screens/toggle-screens.png \ 139 | assets/screens/location-search.png \ 140 | assets/screens/locations-screen.png \ 141 | assets/screens/main-screen-forecast.png \ 142 | assets/screens/toggle-screens.png \ 143 | android/assets/screens/location-search.png \ 144 | android/assets/screens/locations-screen.png \ 145 | android/assets/screens/main-screen-forecast.png \ 146 | android/assets/screens/toggle-screens.png \ 147 | translations/tempestas_ro.qm \ 148 | translations/tempestas_ro.po \ 149 | assets/icons/hicolor/512x512/key.png \ 150 | assets/icons/hicolor/128x128/key.png \ 151 | assets/icons/hicolor/64x64/key.png \ 152 | android/assets/key.png 153 | 154 | MOC_DIR = .moc 155 | OBJECTS_DIR = .obj 156 | 157 | ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android 158 | 159 | TRANSLATIONS = translations/tempestas_ro.po 160 | -------------------------------------------------------------------------------- /translations/tempestas_ro.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "MIME-Version: 1.0\n" 4 | "Content-Type: text/plain; charset=UTF-8\n" 5 | "Content-Transfer-Encoding: 8bit\n" 6 | "Plural-Forms: nplurals=3; plural=(n==1 ? 0 : (n==0 || (n%100 > 0 && n%100 < 20)) ? 1 : 2);\n" 7 | "X-Language: ro_RO\n" 8 | "X-Qt-Contexts: true\n" 9 | 10 | #: /media/Workspace/Qt-workspace/cumulus-qt/qml/SearchLocation.qml:47 11 | msgctxt "SearchLocation|" 12 | msgid "Search" 13 | msgstr "Caută" 14 | 15 | #: /media/Workspace/Qt-workspace/cumulus-qt/qml/SettingsWindow.qml:73 16 | msgctxt "SettingsWindow|" 17 | msgid "Temperature Unit" 18 | msgstr "Unitate temperatură" 19 | 20 | #: /media/Workspace/Qt-workspace/cumulus-qt/qml/SettingsWindow.qml:132 21 | msgctxt "SettingsWindow|" 22 | msgid "Speed Unit" 23 | msgstr "Unitate viteză" 24 | 25 | #: /media/Workspace/Qt-workspace/cumulus-qt/qml/SettingsWindow.qml:191 26 | msgctxt "SettingsWindow|" 27 | msgid "Colors" 28 | msgstr "Culori" 29 | 30 | #: /media/Workspace/Qt-workspace/cumulus-qt/qml/SettingsWindow.qml:225 31 | msgctxt "SettingsWindow|" 32 | msgid "Background" 33 | msgstr "Fundal" 34 | 35 | #: /media/Workspace/Qt-workspace/cumulus-qt/qml/SettingsWindow.qml:241 36 | msgctxt "SettingsWindow|" 37 | msgid "Text" 38 | msgstr "Text" 39 | 40 | #: /media/Workspace/Qt-workspace/cumulus-qt/qml/SettingsWindow.qml:264 41 | msgctxt "SettingsWindow|" 42 | msgid "Provider" 43 | msgstr "Furnizor" 44 | 45 | #: /media/Workspace/Qt-workspace/cumulus-qt/qml/SettingsWindow.qml:278 46 | msgctxt "SettingsWindow|" 47 | msgid "Provider key" 48 | msgstr "Cheie furnizor" 49 | 50 | #: /media/Workspace/Qt-workspace/cumulus-qt/qml/SettingsWindow.qml:323 51 | msgctxt "SettingsWindow|" 52 | msgid "Credits" 53 | msgstr "Credite" 54 | 55 | #: /media/Workspace/Qt-workspace/cumulus-qt/qml/SettingsWindow.qml:345 56 | msgctxt "SettingsWindow|" 57 | msgid "Use GPS" 58 | msgstr "Foloseşte GPS" 59 | 60 | #: /media/Workspace/Qt-workspace/cumulus-qt/qml/SettingsWindow.qml:360 61 | msgctxt "SettingsWindow|" 62 | msgid "Close To Tray" 63 | msgstr "Închide în tavă" 64 | 65 | #: /media/Workspace/Qt-workspace/cumulus-qt/qml/SettingsWindow.qml:375 66 | msgctxt "SettingsWindow|" 67 | msgid "Tray theme" 68 | msgstr "Temă tavă" 69 | 70 | #: /media/Workspace/Qt-workspace/cumulus-qt/qml/SettingsWindow.qml:397 71 | msgctxt "SettingsWindow|" 72 | msgid "Window controls position" 73 | msgstr "Poziţia controalelor ferestrei" 74 | 75 | #: /media/Workspace/Qt-workspace/cumulus-qt/qml/SettingsWindow.qml:415 76 | msgctxt "SettingsWindow|" 77 | msgid "Start on login" 78 | msgstr "Porneşte la conectare" 79 | 80 | #: /media/Workspace/Qt-workspace/cumulus-qt/qml/SettingsWindow.qml:452 81 | msgctxt "SettingsWindow|" 82 | msgid "Enter API key" 83 | msgstr "Introdu cheia API" 84 | 85 | #: /media/Workspace/Qt-workspace/cumulus-qt/qml/SettingsWindow.qml:478 86 | msgctxt "SettingsWindow|" 87 | msgid "Error when saving API key!" 88 | msgstr "Eroare la salvarea cheii!" 89 | 90 | #: /media/Workspace/Qt-workspace/cumulus-qt/qml/SettingsWindow.qml:479 91 | msgctxt "SettingsWindow|" 92 | msgid "Key cannot be empty!" 93 | msgstr "Cheia nu poate fi goală!" 94 | 95 | #: /media/Workspace/Qt-workspace/cumulus-qt/qml/SettingsWindow.qml:494 96 | msgctxt "SettingsWindow|" 97 | msgid "Ok" 98 | msgstr "Ok" 99 | 100 | #: /media/Workspace/Qt-workspace/cumulus-qt/qml/SettingsWindow.qml:510 101 | msgctxt "SettingsWindow|" 102 | msgid "Cancel" 103 | msgstr "Anulează" 104 | 105 | #: /media/Workspace/Qt-workspace/cumulus-qt/qml/CreditsListDelegate.qml:64 106 | msgctxt "CreditsListDelegate|" 107 | msgid "Author: " 108 | msgstr "Autor: " 109 | 110 | #: /media/Workspace/Qt-workspace/cumulus-qt/qml/CreditsListDelegate.qml:73 111 | msgctxt "CreditsListDelegate|" 112 | msgid "License: " 113 | msgstr "Licenţă: " 114 | 115 | #: /media/Workspace/Qt-workspace/cumulus-qt/qml/CreditsView.qml:72 116 | msgctxt "CreditsView|" 117 | msgid "Thanks to Erik Flowers for his weather icons fonts!" 118 | msgstr "Mulţumesc lui Erik Flowers pentru font-urile pictograme de vreme!" 119 | 120 | #: /media/Workspace/Qt-workspace/cumulus-qt/qml/CreditsView.qml:84 121 | msgctxt "CreditsView|" 122 | msgid "Thanks to Dave Gandy for Font Awesome!" 123 | msgstr "Mulţumesc lui Dave Gandy pentru Font Awesome!" 124 | 125 | #: /media/Workspace/Qt-workspace/cumulus-qt/qml/CreditsView.qml:96 126 | msgctxt "CreditsView|" 127 | msgid "Cumulus is a simple weather application based on Qt framework.
" 128 | msgstr "" 129 | "Cumulus este o aplicaţie simplă de urmărit vremea, bazată pe cadrul Qt.
" 130 | 131 | #: /media/Workspace/Qt-workspace/cumulus-qt/qml/CreditsView.qml:97 132 | msgctxt "CreditsView|" 133 | msgid "It is and always be free.
" 134 | msgstr "Este şi întotdeauna va fi liberă şi gratuită.
" 135 | 136 | #: /media/Workspace/Qt-workspace/cumulus-qt/qml/CreditsView.qml:98 137 | msgctxt "CreditsView|" 138 | msgid "Source code released under GPL-3.
" 139 | msgstr "Codul sursă eliberat sub GPL-3.
" 140 | 141 | #: /media/Workspace/Qt-workspace/cumulus-qt/qml/CreditsView.qml:99 142 | msgctxt "CreditsView|" 143 | msgid "Forked from Typhoon, which was based of Stormcloud.
" 144 | msgstr "Ramificat din Typhoon, care a fost făcut din Stormcloud.
" 145 | 146 | #: /media/Workspace/Qt-workspace/cumulus-qt/qml/CreditsView.qml:100 147 | msgctxt "CreditsView|" 148 | msgid "Active developers:
  • Adrian Verban verbanady@gmail.com
" 149 | msgstr "" 150 | "Dezvoltatori activi:
  • Adrian Verban verbanady@gmail.com
" 151 | 152 | #: /media/Workspace/Qt-workspace/cumulus-qt/qml/CreditsView.qml:101 153 | msgctxt "CreditsView|" 154 | msgid "" 155 | "Special thanks to:
  • Daryl Bennett
  • Archisman " 156 | "Panigrahi
" 157 | msgstr "" 158 | "Mulţumiri speciale:
  • Daryl Bennett
  • Archisman " 159 | "Panigrahi
" 160 | 161 | #: /media/Workspace/Qt-workspace/cumulus-qt/qml/CreditsView.qml:102 162 | msgctxt "CreditsView|" 163 | msgid "Weather data provided by: " 164 | msgstr "Vremea asigurată de: " 165 | 166 | #: /media/Workspace/Qt-workspace/cumulus-qt/qml/CreditsView.qml:105 167 | msgctxt "CreditsView|" 168 | msgid "Icons credits:" 169 | msgstr "Acreditări pictograme:" 170 | 171 | #: /media/Workspace/Qt-workspace/cumulus-qt/qml/WelcomeView.qml:67 172 | msgctxt "WelcomeView|" 173 | msgid "Next " 174 | msgstr "Înainte " 175 | 176 | #: /media/Workspace/Qt-workspace/cumulus-qt/qml/WelcomeView.qml:67 177 | msgctxt "WelcomeView|" 178 | msgid "Done " 179 | msgstr "Finalizat " 180 | -------------------------------------------------------------------------------- /qml/SearchLocation.qml: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 - 2017 Adrian Verban 3 | * Maintainers: Adrian Verban 4 | * Derived from Typhoon by Archisman Panigrahi which is based on Stormcloud by Jono Cooper 5 | * Thanks to all the contributors. 6 | * Using the Ubuntu Condensed font. 7 | * This file is part of Cumulus. 8 | # 9 | * Cumulus is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | # 14 | * Cumulus is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | # 19 | * You should have received a copy of the GNU General Public License 20 | * along with Cumulus. If not, see . 21 | */ 22 | import QtQuick 2.0 23 | import QtQuick.Controls 1.4 24 | import QtQuick.Controls.Styles 1.4 25 | 26 | Item { 27 | id: root 28 | property string backgroundColor 29 | property string textColor 30 | property string textFontFamily 31 | property string locationQuery 32 | property string gpsLocation: "-" 33 | property alias searchListModel: searchList.model 34 | signal locationSelected(string locationSelected) 35 | visible: true 36 | 37 | Rectangle { 38 | id: body 39 | anchors.fill: parent 40 | color: root.backgroundColor.length > 7 ? ("#" + root.backgroundColor.substring(3)) : root.backgroundColor 41 | 42 | TextField { 43 | id: searchField 44 | placeholderText: qsTr("Search") 45 | maximumLength: 120 46 | font.pixelSize: 22 47 | font.family: root.textFontFamily 48 | width: (parent.width * 80 / 100) - loadingIcon.width 49 | anchors.top: parent.top 50 | anchors.topMargin: 10 51 | anchors.left: parent.left 52 | anchors.leftMargin: ((parent.width * 90 / 100) - width) / 2 53 | textColor: root.textColor 54 | style: TextFieldStyle { 55 | background: Rectangle { 56 | border.width: 0 57 | color: "transparent" 58 | } 59 | placeholderTextColor: root.textColor 60 | } 61 | onTextChanged: { 62 | if (text.trim().length > 0) { 63 | searchTimer.restart() 64 | } 65 | } 66 | Keys.onEscapePressed: root.visible = false 67 | Keys.onBackPressed: root.visible = false 68 | } 69 | 70 | Image { 71 | id: loadingIcon 72 | source: "image://fontimage/\uf013" + (root.textColor ? root.textColor : "#ffffff") 73 | height: searchField.height 74 | width: loadingIcon.height 75 | sourceSize.width: loadingIcon.width 76 | sourceSize.height: loadingIcon.height 77 | anchors.top: parent.top 78 | anchors.topMargin: 10 79 | anchors.left: searchField.right 80 | visible: false 81 | RotationAnimation on rotation { 82 | id: refreshRotateAnim 83 | direction: RotationAnimation.Clockwise 84 | from: 0 85 | to: 360 86 | loops: RotationAnimation.Infinite 87 | alwaysRunToEnd: true 88 | duration: 1000 89 | } 90 | } 91 | 92 | Rectangle { 93 | id: searchFieldBottomBorder 94 | anchors.top: searchField.bottom 95 | anchors.topMargin: 0 96 | anchors.left: parent.left 97 | width: searchField.width 98 | height: 1 99 | anchors.leftMargin: ((parent.width * 90 / 100) - width) / 2 100 | color: "#AAffffff" 101 | 102 | } 103 | 104 | ListView { 105 | id: searchList 106 | anchors.top: searchFieldBottomBorder.bottom 107 | anchors.topMargin: 10 108 | anchors.left: parent.left 109 | anchors.leftMargin: (parent.width - searchList.width) / 2 110 | width: (parent.width * 80 / 100) 111 | height: (body.height - searchField.height - gpsLocation.height - 10) 112 | cacheBuffer: 0 113 | clip: true 114 | delegate: Rectangle { 115 | height: 40 116 | width: searchList.width 117 | color: "transparent" 118 | Text { 119 | id: delegateText 120 | text: modelData 121 | color: root.textColor 122 | font.pixelSize: 18 123 | anchors.fill: parent 124 | verticalAlignment: Qt.AlignVCenter 125 | } 126 | MouseArea { 127 | anchors.fill: parent 128 | hoverEnabled: true 129 | cursorShape: Qt.PointingHandCursor 130 | onClicked: root.locationSelected(delegateText.text); 131 | } 132 | } 133 | onModelChanged: loadingIcon.visible = false 134 | } 135 | GpsLocationItem { 136 | id: gpsLocation 137 | anchors.bottom: parent.bottom 138 | anchors.left: parent.left 139 | anchors.leftMargin: searchList.anchors.leftMargin 140 | width: searchList.width 141 | height: 60 142 | textColor: root.textColor 143 | textFontFamily: root.textFontFamily 144 | text: root.gpsLocation 145 | onClicked: root.locationSelected(text); 146 | fontSize: 16 147 | } 148 | } 149 | Timer { 150 | id: searchTimer 151 | interval: 3000 152 | running: false 153 | repeat: false 154 | onTriggered: { 155 | loadingIcon.visible = true 156 | root.locationQuery = searchField.text.trim() 157 | } 158 | } 159 | onVisibleChanged: { 160 | if (root.visible) { 161 | searchField.focus = true 162 | searchField.forceActiveFocus() 163 | } 164 | } 165 | } 166 | -------------------------------------------------------------------------------- /CppFiles/SettingsController.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2016 - 2017 Adrian Verban 3 | * Maintainers: Adrian Verban 4 | * Derived from Typhoon by Archisman Panigrahi which is based on Stormcloud by Jono Cooper 5 | * Thanks to all the contributors. 6 | * Using the Ubuntu Condensed font. 7 | * This file is part of Cumulus. 8 | # 9 | * Cumulus is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | # 14 | * Cumulus is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | # 19 | * You should have received a copy of the GNU General Public License 20 | * along with Cumulus. If not, see . 21 | */ 22 | #ifndef SETTINGSCONTROLLER_H 23 | #define SETTINGSCONTROLLER_H 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | using namespace std; 38 | 39 | struct api_keys { 40 | const QString owm = "15c2836a71c126524d35af1d29d563c5"; 41 | }; 42 | 43 | class SettingsController : public QObject { 44 | Q_OBJECT 45 | bool m_trayVisibility, m_loginStart, m_useGps; 46 | QString m_trayTheme, m_windowControlsPos, m_applicationBackground, m_textColor, m_weatherApi, 47 | m_windSpeedUnit, m_tempUnit, m_pressureUnit; 48 | float m_applicationOpacity; 49 | int m_windowX, m_windowY, m_windowHeight, m_windowWidth, m_currentLocationId; 50 | static api_keys API_KEYS; 51 | static QString WEATHER_SETTINGS_GROUP; 52 | 53 | Q_PROPERTY(QString applicationBackground MEMBER m_applicationBackground WRITE setApplicationBackground NOTIFY applicationBackgroundChanged) 54 | Q_PROPERTY(QString textColor READ textColor WRITE setTextColor NOTIFY textColorChanged) 55 | Q_PROPERTY(float applicationOpacity MEMBER m_applicationOpacity WRITE setApplicationOpacity NOTIFY applicationOpacityChanged) 56 | Q_PROPERTY(bool trayVisibility READ trayVisibility WRITE setTrayVisibility NOTIFY trayVisibilityChanged) 57 | Q_PROPERTY(QString trayTheme MEMBER m_trayTheme WRITE setTrayTheme NOTIFY trayThemeChanged) 58 | Q_PROPERTY(QString windowControlsPos MEMBER m_windowControlsPos WRITE setWindowControlsPos NOTIFY windowControlsPosChanged) 59 | Q_PROPERTY(bool loginStart MEMBER m_loginStart WRITE setLoginStart NOTIFY loginStartChanged) 60 | Q_PROPERTY(int windowX MEMBER m_windowX WRITE setWindowX NOTIFY windowXChanged) 61 | Q_PROPERTY(int windowY MEMBER m_windowY WRITE setWindowY NOTIFY windowYChanged) 62 | Q_PROPERTY(int windowHeight MEMBER m_windowHeight WRITE setWindowHeight NOTIFY windowHeightChanged) 63 | Q_PROPERTY(int windowWidth MEMBER m_windowWidth WRITE setWindowWidth NOTIFY windowWidthChanged) 64 | Q_PROPERTY(int currentLocationId READ currentLocationId WRITE setCurrentLocationId NOTIFY currentLocationIdChanged) 65 | Q_PROPERTY(QString weatherApi READ weatherApi WRITE setWeatherApi NOTIFY weatherApiChanged) 66 | Q_PROPERTY(QString windSpeedUnit READ windSpeedUnit WRITE setWindSpeedUnit NOTIFY windSpeedUnitChanged) 67 | Q_PROPERTY(QString tempUnit READ tempUnit WRITE setTempUnit NOTIFY tempUnitChanged) 68 | Q_PROPERTY(QString pressureUnit READ pressureUnit WRITE setPressureUnit NOTIFY pressureUnitChanged) 69 | Q_PROPERTY(bool useGps READ useGps WRITE setUseGps NOTIFY useGpsChanged) 70 | Q_PROPERTY(QString apiKey READ apiKey WRITE setApiKey NOTIFY apiKeyChanged) 71 | Q_PROPERTY(bool firstUse READ firstUse WRITE setFirstUse NOTIFY firstUseChanged) 72 | 73 | void loginStartLinux(const bool &loginStart); 74 | bool clearLocationCode(); 75 | void saveString(const QString &key, const QString &value, const QString &group); 76 | QString loadString(const QString &key, const QString &group) const; 77 | public: 78 | explicit SettingsController(QObject *parent = nullptr); 79 | void setApplicationBackground(const QString &applicationBackground); 80 | void setTextColor(const QString &textColor); 81 | QString textColor() const; 82 | void setApplicationOpacity(const float &applicationOpacity); 83 | void setTrayVisibility(const bool &trayVisibility); 84 | bool trayVisibility() const; 85 | void setTrayTheme(const QString &trayTheme); 86 | void setWindowControlsPos(const QString &windowControlsPos); 87 | void setLoginStart(const bool &loginStart); 88 | void setWindowX(const int &windowX); 89 | void setWindowY(const int &windowY); 90 | void setWindowHeight(const int &windowHeight); 91 | void setWindowWidth(const int &windowWidth); 92 | void setCurrentLocationId(const int &locationId); 93 | int currentLocationId() const; 94 | void setWeatherApi(const QString &weatherApi); 95 | QString weatherApi() const; 96 | void setWindSpeedUnit(const QString &windSpeedUnit); 97 | QString windSpeedUnit() const; 98 | void setTempUnit(const QString &tempUnit); 99 | QString tempUnit() const; 100 | void setPressureUnit(const QString &pressureUnit); 101 | QString pressureUnit() const; 102 | bool useGps() const; 103 | void setUseGps(const bool &useGps); 104 | void setApiKey(const QString &apiKey); 105 | QString apiKey() const; 106 | Q_INVOKABLE static bool loginStartCheck(); 107 | Q_INVOKABLE static QString getWeatherApi(); 108 | static short unsigned int SETTINGS_VERSION; 109 | bool firstUse() const; 110 | void setFirstUse(const bool &firstUse); 111 | signals: 112 | void applicationBackgroundChanged(); 113 | void textColorChanged(); 114 | void applicationOpacityChanged(); 115 | void trayVisibilityChanged(); 116 | void trayThemeChanged(); 117 | void windowControlsPosChanged(); 118 | void loginStartChanged(); 119 | void windowXChanged(); 120 | void windowYChanged(); 121 | void windowHeightChanged(); 122 | void windowWidthChanged(); 123 | void currentLocationIdChanged(); 124 | void weatherApiChanged(); 125 | void tempUnitChanged(); 126 | void windSpeedUnitChanged(); 127 | void pressureUnitChanged(); 128 | void useGpsChanged(); 129 | void apiKeyChanged(); 130 | void firstUseChanged(); 131 | }; 132 | 133 | #endif // SETTINGSCONTROLLER_H 134 | --------------------------------------------------------------------------------