├── .gitignore ├── android ├── AndroidManifest.xml └── res │ ├── drawable-hdpi │ └── icon.png │ ├── drawable-ldpi │ └── icon.png │ └── drawable-mdpi │ └── icon.png ├── app-icons ├── AppIcon_100px.png ├── AppIcon_100x100.png ├── AppIcon_1024px.png ├── AppIcon_114px.png ├── AppIcon_120px.png ├── AppIcon_134x202.png ├── AppIcon_144px.png ├── AppIcon_150x150.png ├── AppIcon_152px.png ├── AppIcon_29px.png ├── AppIcon_30x30.png ├── AppIcon_36px.png ├── AppIcon_40px.png ├── AppIcon_48px.png ├── AppIcon_50px.png ├── AppIcon_50x50.png ├── AppIcon_512px.png ├── AppIcon_57px.png ├── AppIcon_58px.png ├── AppIcon_620x300.png ├── AppIcon_71x110.png ├── AppIcon_72px.png ├── AppIcon_76px.png └── AppIcon_80px.png ├── fonts ├── LICENSE.txt ├── OpenSans-Bold.ttf ├── OpenSans-Regular.ttf └── OpenSans-Semibold.ttf ├── ios ├── Images.xcassets │ ├── AppIcon.appiconset │ │ ├── AppIcon_100px.png │ │ ├── AppIcon_114px.png │ │ ├── AppIcon_120px.png │ │ ├── AppIcon_144px.png │ │ ├── AppIcon_152px.png │ │ ├── AppIcon_29px.png │ │ ├── AppIcon_40px.png │ │ ├── AppIcon_50px.png │ │ ├── AppIcon_57px.png │ │ ├── AppIcon_58px.png │ │ ├── AppIcon_72px.png │ │ ├── AppIcon_76px.png │ │ ├── AppIcon_80px.png │ │ └── Contents.json │ └── LaunchImage.launchimage │ │ ├── Contents.json │ │ ├── NoSB_ipad_7_Land.png │ │ ├── NoSB_ipad_7_Port.png │ │ ├── NoSB_ipad_7_R_Land.png │ │ ├── NoSB_ipad_7_R_Port.png │ │ ├── ipad_7_Land.png │ │ ├── ipad_7_Port.png │ │ ├── ipad_7_R_Land.png │ │ ├── ipad_7_R_Port.png │ │ ├── iphone_6.1.png │ │ ├── iphone_7_R3.5.png │ │ └── iphone_7_R4.png ├── iosInfo.plist └── readme.txt ├── qml ├── js │ └── utils.js ├── main.qml ├── models │ └── WeatherModel.qml ├── pages │ ├── BasicPage.qml │ ├── CitiesPage.qml │ ├── LongTermDayItem.qml │ ├── LongTermPage.qml │ ├── OneDayPage.qml │ ├── OneDaySliderItem.qml │ ├── OneDayZoomItem.qml │ └── Separator.qml └── touch │ ├── ListViewDelegate.qml │ ├── TouchLabel.qml │ ├── TouchScrollView.qml │ ├── TouchSlider.qml │ ├── TouchTextField.qml │ └── images │ ├── BackArrow.png │ ├── Circle.png │ ├── Clear.png │ ├── Pointer.png │ ├── Pointer_pressed.png │ ├── darkclose.png │ └── magnifier.png ├── src ├── applicationinfo.cpp ├── applicationinfo.h ├── applicationpaths.h ├── cities.cpp ├── cities.h ├── citieslistmodel.cpp ├── citieslistmodel.h ├── citymodel.cpp ├── citymodel.h ├── daymodel.cpp ├── daymodel.h ├── main.cpp ├── src.pri ├── weatherimageprovider.h ├── winrtcharms.cpp └── winrtcharms.h ├── translations ├── QuickForecast_bn.ts ├── QuickForecast_da.ts ├── QuickForecast_de.ts ├── QuickForecast_es.ts ├── QuickForecast_fi.ts ├── QuickForecast_fr.ts ├── QuickForecast_hi.ts ├── QuickForecast_hu.ts ├── QuickForecast_it.ts ├── QuickForecast_nb.ts ├── QuickForecast_nl.ts ├── QuickForecast_pl.ts ├── QuickForecast_ro.ts ├── QuickForecast_ru.ts ├── QuickForecast_zh.ts └── README └── weatherapp.pro /.gitignore: -------------------------------------------------------------------------------- 1 | Makefile 2 | WeatherApp 3 | 4 | *.dll 5 | *.exe 6 | *.o 7 | *.so 8 | *.pro.user 9 | *.qrc 10 | *.wa 11 | *.settings 12 | 13 | *.qm 14 | 15 | moc_*.cpp 16 | qrc_*.cpp 17 | 18 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /android/res/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/android/res/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /android/res/drawable-ldpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/android/res/drawable-ldpi/icon.png -------------------------------------------------------------------------------- /android/res/drawable-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/android/res/drawable-mdpi/icon.png -------------------------------------------------------------------------------- /app-icons/AppIcon_100px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/app-icons/AppIcon_100px.png -------------------------------------------------------------------------------- /app-icons/AppIcon_100x100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/app-icons/AppIcon_100x100.png -------------------------------------------------------------------------------- /app-icons/AppIcon_1024px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/app-icons/AppIcon_1024px.png -------------------------------------------------------------------------------- /app-icons/AppIcon_114px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/app-icons/AppIcon_114px.png -------------------------------------------------------------------------------- /app-icons/AppIcon_120px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/app-icons/AppIcon_120px.png -------------------------------------------------------------------------------- /app-icons/AppIcon_134x202.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/app-icons/AppIcon_134x202.png -------------------------------------------------------------------------------- /app-icons/AppIcon_144px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/app-icons/AppIcon_144px.png -------------------------------------------------------------------------------- /app-icons/AppIcon_150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/app-icons/AppIcon_150x150.png -------------------------------------------------------------------------------- /app-icons/AppIcon_152px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/app-icons/AppIcon_152px.png -------------------------------------------------------------------------------- /app-icons/AppIcon_29px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/app-icons/AppIcon_29px.png -------------------------------------------------------------------------------- /app-icons/AppIcon_30x30.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/app-icons/AppIcon_30x30.png -------------------------------------------------------------------------------- /app-icons/AppIcon_36px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/app-icons/AppIcon_36px.png -------------------------------------------------------------------------------- /app-icons/AppIcon_40px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/app-icons/AppIcon_40px.png -------------------------------------------------------------------------------- /app-icons/AppIcon_48px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/app-icons/AppIcon_48px.png -------------------------------------------------------------------------------- /app-icons/AppIcon_50px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/app-icons/AppIcon_50px.png -------------------------------------------------------------------------------- /app-icons/AppIcon_50x50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/app-icons/AppIcon_50x50.png -------------------------------------------------------------------------------- /app-icons/AppIcon_512px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/app-icons/AppIcon_512px.png -------------------------------------------------------------------------------- /app-icons/AppIcon_57px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/app-icons/AppIcon_57px.png -------------------------------------------------------------------------------- /app-icons/AppIcon_58px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/app-icons/AppIcon_58px.png -------------------------------------------------------------------------------- /app-icons/AppIcon_620x300.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/app-icons/AppIcon_620x300.png -------------------------------------------------------------------------------- /app-icons/AppIcon_71x110.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/app-icons/AppIcon_71x110.png -------------------------------------------------------------------------------- /app-icons/AppIcon_72px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/app-icons/AppIcon_72px.png -------------------------------------------------------------------------------- /app-icons/AppIcon_76px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/app-icons/AppIcon_76px.png -------------------------------------------------------------------------------- /app-icons/AppIcon_80px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/app-icons/AppIcon_80px.png -------------------------------------------------------------------------------- /fonts/OpenSans-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/fonts/OpenSans-Bold.ttf -------------------------------------------------------------------------------- /fonts/OpenSans-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/fonts/OpenSans-Regular.ttf -------------------------------------------------------------------------------- /fonts/OpenSans-Semibold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/fonts/OpenSans-Semibold.ttf -------------------------------------------------------------------------------- /ios/Images.xcassets/AppIcon.appiconset/AppIcon_100px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/ios/Images.xcassets/AppIcon.appiconset/AppIcon_100px.png -------------------------------------------------------------------------------- /ios/Images.xcassets/AppIcon.appiconset/AppIcon_114px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/ios/Images.xcassets/AppIcon.appiconset/AppIcon_114px.png -------------------------------------------------------------------------------- /ios/Images.xcassets/AppIcon.appiconset/AppIcon_120px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/ios/Images.xcassets/AppIcon.appiconset/AppIcon_120px.png -------------------------------------------------------------------------------- /ios/Images.xcassets/AppIcon.appiconset/AppIcon_144px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/ios/Images.xcassets/AppIcon.appiconset/AppIcon_144px.png -------------------------------------------------------------------------------- /ios/Images.xcassets/AppIcon.appiconset/AppIcon_152px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/ios/Images.xcassets/AppIcon.appiconset/AppIcon_152px.png -------------------------------------------------------------------------------- /ios/Images.xcassets/AppIcon.appiconset/AppIcon_29px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/ios/Images.xcassets/AppIcon.appiconset/AppIcon_29px.png -------------------------------------------------------------------------------- /ios/Images.xcassets/AppIcon.appiconset/AppIcon_40px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/ios/Images.xcassets/AppIcon.appiconset/AppIcon_40px.png -------------------------------------------------------------------------------- /ios/Images.xcassets/AppIcon.appiconset/AppIcon_50px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/ios/Images.xcassets/AppIcon.appiconset/AppIcon_50px.png -------------------------------------------------------------------------------- /ios/Images.xcassets/AppIcon.appiconset/AppIcon_57px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/ios/Images.xcassets/AppIcon.appiconset/AppIcon_57px.png -------------------------------------------------------------------------------- /ios/Images.xcassets/AppIcon.appiconset/AppIcon_58px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/ios/Images.xcassets/AppIcon.appiconset/AppIcon_58px.png -------------------------------------------------------------------------------- /ios/Images.xcassets/AppIcon.appiconset/AppIcon_72px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/ios/Images.xcassets/AppIcon.appiconset/AppIcon_72px.png -------------------------------------------------------------------------------- /ios/Images.xcassets/AppIcon.appiconset/AppIcon_76px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/ios/Images.xcassets/AppIcon.appiconset/AppIcon_76px.png -------------------------------------------------------------------------------- /ios/Images.xcassets/AppIcon.appiconset/AppIcon_80px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/ios/Images.xcassets/AppIcon.appiconset/AppIcon_80px.png -------------------------------------------------------------------------------- /ios/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "size" : "29x29", 5 | "idiom" : "iphone", 6 | "filename" : "AppIcon_29px.png", 7 | "scale" : "1x" 8 | }, 9 | { 10 | "size" : "29x29", 11 | "idiom" : "iphone", 12 | "filename" : "AppIcon_58px.png", 13 | "scale" : "2x" 14 | }, 15 | { 16 | "size" : "40x40", 17 | "idiom" : "iphone", 18 | "filename" : "AppIcon_80px.png", 19 | "scale" : "2x" 20 | }, 21 | { 22 | "size" : "57x57", 23 | "idiom" : "iphone", 24 | "filename" : "AppIcon_57px.png", 25 | "scale" : "1x" 26 | }, 27 | { 28 | "size" : "57x57", 29 | "idiom" : "iphone", 30 | "filename" : "AppIcon_114px.png", 31 | "scale" : "2x" 32 | }, 33 | { 34 | "size" : "60x60", 35 | "idiom" : "iphone", 36 | "filename" : "AppIcon_120px.png", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "size" : "29x29", 41 | "idiom" : "ipad", 42 | "filename" : "AppIcon_29px.png", 43 | "scale" : "1x" 44 | }, 45 | { 46 | "size" : "29x29", 47 | "idiom" : "ipad", 48 | "filename" : "AppIcon_58px.png", 49 | "scale" : "2x" 50 | }, 51 | { 52 | "size" : "40x40", 53 | "idiom" : "ipad", 54 | "filename" : "AppIcon_40px.png", 55 | "scale" : "1x" 56 | }, 57 | { 58 | "size" : "40x40", 59 | "idiom" : "ipad", 60 | "filename" : "AppIcon_80px.png", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "size" : "50x50", 65 | "idiom" : "ipad", 66 | "filename" : "AppIcon_50px.png", 67 | "scale" : "1x" 68 | }, 69 | { 70 | "size" : "50x50", 71 | "idiom" : "ipad", 72 | "filename" : "AppIcon_100px.png", 73 | "scale" : "2x" 74 | }, 75 | { 76 | "size" : "72x72", 77 | "idiom" : "ipad", 78 | "filename" : "AppIcon_72px.png", 79 | "scale" : "1x" 80 | }, 81 | { 82 | "size" : "72x72", 83 | "idiom" : "ipad", 84 | "filename" : "AppIcon_144px.png", 85 | "scale" : "2x" 86 | }, 87 | { 88 | "size" : "76x76", 89 | "idiom" : "ipad", 90 | "filename" : "AppIcon_76px.png", 91 | "scale" : "1x" 92 | }, 93 | { 94 | "size" : "76x76", 95 | "idiom" : "ipad", 96 | "filename" : "AppIcon_152px.png", 97 | "scale" : "2x" 98 | } 99 | ], 100 | "info" : { 101 | "version" : 1, 102 | "author" : "xcode" 103 | } 104 | } -------------------------------------------------------------------------------- /ios/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "filename" : "iphone_7_R3.5.png", 9 | "scale" : "2x" 10 | }, 11 | { 12 | "extent" : "full-screen", 13 | "idiom" : "iphone", 14 | "subtype" : "retina4", 15 | "filename" : "iphone_7_R4.png", 16 | "minimum-system-version" : "7.0", 17 | "orientation" : "portrait", 18 | "scale" : "2x" 19 | }, 20 | { 21 | "orientation" : "portrait", 22 | "idiom" : "ipad", 23 | "extent" : "full-screen", 24 | "minimum-system-version" : "7.0", 25 | "filename" : "ipad_7_Port.png", 26 | "scale" : "1x" 27 | }, 28 | { 29 | "orientation" : "landscape", 30 | "idiom" : "ipad", 31 | "extent" : "full-screen", 32 | "minimum-system-version" : "7.0", 33 | "filename" : "ipad_7_Land.png", 34 | "scale" : "1x" 35 | }, 36 | { 37 | "orientation" : "portrait", 38 | "idiom" : "ipad", 39 | "extent" : "full-screen", 40 | "minimum-system-version" : "7.0", 41 | "filename" : "ipad_7_R_Port.png", 42 | "scale" : "2x" 43 | }, 44 | { 45 | "orientation" : "landscape", 46 | "idiom" : "ipad", 47 | "extent" : "full-screen", 48 | "minimum-system-version" : "7.0", 49 | "filename" : "ipad_7_R_Land.png", 50 | "scale" : "2x" 51 | }, 52 | { 53 | "orientation" : "portrait", 54 | "idiom" : "iphone", 55 | "extent" : "full-screen", 56 | "filename" : "iphone_6.1.png", 57 | "scale" : "1x" 58 | }, 59 | { 60 | "orientation" : "portrait", 61 | "idiom" : "iphone", 62 | "extent" : "full-screen", 63 | "filename" : "iphone_7_R3.5.png", 64 | "scale" : "2x" 65 | }, 66 | { 67 | "orientation" : "portrait", 68 | "idiom" : "iphone", 69 | "extent" : "full-screen", 70 | "filename" : "iphone_7_R4.png", 71 | "subtype" : "retina4", 72 | "scale" : "2x" 73 | }, 74 | { 75 | "orientation" : "portrait", 76 | "idiom" : "ipad", 77 | "extent" : "to-status-bar", 78 | "filename" : "NoSB_ipad_7_Port.png", 79 | "scale" : "1x" 80 | }, 81 | { 82 | "orientation" : "landscape", 83 | "idiom" : "ipad", 84 | "extent" : "to-status-bar", 85 | "filename" : "NoSB_ipad_7_Land.png", 86 | "scale" : "1x" 87 | }, 88 | { 89 | "orientation" : "portrait", 90 | "idiom" : "ipad", 91 | "extent" : "to-status-bar", 92 | "filename" : "NoSB_ipad_7_R_Port.png", 93 | "scale" : "2x" 94 | }, 95 | { 96 | "orientation" : "landscape", 97 | "idiom" : "ipad", 98 | "extent" : "to-status-bar", 99 | "filename" : "NoSB_ipad_7_R_Land.png", 100 | "scale" : "2x" 101 | } 102 | ], 103 | "info" : { 104 | "version" : 1, 105 | "author" : "xcode" 106 | } 107 | } -------------------------------------------------------------------------------- /ios/Images.xcassets/LaunchImage.launchimage/NoSB_ipad_7_Land.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/ios/Images.xcassets/LaunchImage.launchimage/NoSB_ipad_7_Land.png -------------------------------------------------------------------------------- /ios/Images.xcassets/LaunchImage.launchimage/NoSB_ipad_7_Port.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/ios/Images.xcassets/LaunchImage.launchimage/NoSB_ipad_7_Port.png -------------------------------------------------------------------------------- /ios/Images.xcassets/LaunchImage.launchimage/NoSB_ipad_7_R_Land.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/ios/Images.xcassets/LaunchImage.launchimage/NoSB_ipad_7_R_Land.png -------------------------------------------------------------------------------- /ios/Images.xcassets/LaunchImage.launchimage/NoSB_ipad_7_R_Port.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/ios/Images.xcassets/LaunchImage.launchimage/NoSB_ipad_7_R_Port.png -------------------------------------------------------------------------------- /ios/Images.xcassets/LaunchImage.launchimage/ipad_7_Land.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/ios/Images.xcassets/LaunchImage.launchimage/ipad_7_Land.png -------------------------------------------------------------------------------- /ios/Images.xcassets/LaunchImage.launchimage/ipad_7_Port.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/ios/Images.xcassets/LaunchImage.launchimage/ipad_7_Port.png -------------------------------------------------------------------------------- /ios/Images.xcassets/LaunchImage.launchimage/ipad_7_R_Land.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/ios/Images.xcassets/LaunchImage.launchimage/ipad_7_R_Land.png -------------------------------------------------------------------------------- /ios/Images.xcassets/LaunchImage.launchimage/ipad_7_R_Port.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/ios/Images.xcassets/LaunchImage.launchimage/ipad_7_R_Port.png -------------------------------------------------------------------------------- /ios/Images.xcassets/LaunchImage.launchimage/iphone_6.1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/ios/Images.xcassets/LaunchImage.launchimage/iphone_6.1.png -------------------------------------------------------------------------------- /ios/Images.xcassets/LaunchImage.launchimage/iphone_7_R3.5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/ios/Images.xcassets/LaunchImage.launchimage/iphone_7_R3.5.png -------------------------------------------------------------------------------- /ios/Images.xcassets/LaunchImage.launchimage/iphone_7_R4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/ios/Images.xcassets/LaunchImage.launchimage/iphone_7_R4.png -------------------------------------------------------------------------------- /ios/iosInfo.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDisplayName 6 | QuickForecast 7 | CFBundleExecutable 8 | QuickForecast 9 | CFBundleGetInfoString 10 | Created by Qt/QMake 11 | CFBundleIcons 12 | 13 | CFBundleIcons~ipad 14 | 15 | CFBundleIdentifier 16 | com.digia.qt.iosteam.WeatherApp 17 | CFBundleName 18 | Quick Forecast 19 | CFBundlePackageType 20 | APPL 21 | CFBundleShortVersionString 22 | 1.4 23 | CFBundleSignature 24 | ???? 25 | CFBundleVersion 26 | 1.4 27 | LSRequiresIPhoneOS 28 | 29 | NOTE 30 | This file was generated by Qt/QMake. 31 | UIAppFonts 32 | 33 | fonts/OpenSans-Bold.ttf 34 | fonts/OpenSans-Semibold.ttf 35 | fonts/OpenSans-Regular.ttf 36 | 37 | UIStatusBarHidden 38 | 39 | UIStatusBarHidden~ipad 40 | 41 | UISupportedInterfaceOrientations 42 | 43 | UIInterfaceOrientationPortrait 44 | 45 | UISupportedInterfaceOrientations~ipad 46 | 47 | UIInterfaceOrientationPortrait 48 | UIInterfaceOrientationPortraitUpsideDown 49 | UIInterfaceOrientationLandscapeLeft 50 | UIInterfaceOrientationLandscapeRight 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /ios/readme.txt: -------------------------------------------------------------------------------- 1 | * In order to use the images assets: 2 | 3 | - After running qmake, open the Xcode project 4 | - In the General tab of the project, go down to App Icons section 5 | - Click for Source "use Asset Catalog" 6 | - Validate by selecting Migrate 7 | - In the pro file directory, replace Images.xcassets under QuickForecast 8 | by the one under ios. 9 | 10 | => The icons and launch images are ready to be used 11 | 12 | * Default image 13 | 14 | In Xcode, in the "Bundle Resources" section, remove the default launch 15 | image. It is not needed. 16 | -------------------------------------------------------------------------------- /qml/main.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). 4 | ** Contact: http://www.qt-project.org/legal 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names 21 | ** of its contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | import QtQuick 2.1 42 | import QtQuick.Controls 1.0 43 | import QtQuick.Controls.Styles 1.0 44 | import org.qtproject.demo.weather 1.0 45 | 46 | ApplicationWindow { 47 | id: root 48 | height: 700 49 | width: 1200 50 | title: "Quick Forecast" 51 | 52 | property string statusBarMessage 53 | 54 | property Component citiesPage: CitiesPage { 55 | onUpdateStatusBar: statusBarMessage = message 56 | onNextPage: if (!isLocked) { 57 | pageView.push(longTermPage) 58 | clearSearchBox() 59 | } 60 | } 61 | property Component longTermPage: LongTermPage { 62 | onUpdateStatusBar: statusBarMessage = message 63 | onNextPage: if (!isLocked) { 64 | pageView.push(oneDayPage) 65 | } 66 | onPreviousPage: { 67 | ApplicationInfo.currentIndexDay = -1 68 | pageView.pop() 69 | } 70 | } 71 | property Component oneDayPage: OneDayPage { 72 | onUpdateStatusBar: statusBarMessage = message 73 | onPreviousPage: if (!isLocked) { 74 | pageView.pop() 75 | } 76 | } 77 | 78 | StackView { 79 | id: pageView 80 | anchors.fill: parent 81 | focus: true 82 | Keys.onReleased: { 83 | if (event.key === Qt.Key_Back || 84 | (event.key === Qt.Key_Left && (event.modifiers & Qt.AltModifier))) { 85 | if (pageView.depth > 1) { 86 | event.accepted = true 87 | if (!currentItem.isLocked) 88 | currentItem.previousPage() 89 | } else { 90 | if (!currentItem.hasNoSearchText) { 91 | event.accepted = true 92 | currentItem.clearSearchBox() 93 | } 94 | } 95 | } 96 | } 97 | 98 | initialItem: citiesPage 99 | delegate: StackViewDelegate { 100 | pushTransition: StackViewTransition { 101 | function transitionFinished(properties) 102 | { 103 | properties.exitItem.opacity = 1 104 | } 105 | PropertyAnimation { 106 | target: enterItem 107 | property: "x" 108 | from: target.width 109 | to: 0 110 | duration: 500 111 | easing.type: Easing.OutSine 112 | } 113 | PropertyAnimation { 114 | target: exitItem 115 | property: "x" 116 | from: 0 117 | to: -target.width 118 | duration: 500 119 | easing.type: Easing.OutSine 120 | } 121 | } 122 | popTransition: StackViewTransition { 123 | function transitionFinished(properties) 124 | { 125 | properties.exitItem.opacity = 1 126 | } 127 | PropertyAnimation { 128 | target: enterItem 129 | property: "x" 130 | from: -target.width 131 | to: 0 132 | duration: 500 133 | easing.type: Easing.OutSine 134 | } 135 | PropertyAnimation { 136 | target: exitItem 137 | property: "x" 138 | from: 0 139 | to: target.width 140 | duration: 500 141 | easing.type: Easing.OutSine 142 | 143 | } 144 | } 145 | property Component replaceTransition: pushTransition 146 | } 147 | } 148 | 149 | statusBar: StatusBar { 150 | id: statusbar 151 | width: parent.width 152 | opacity: label.text !== "" ? 1 : 0 153 | property real statusBarHeight: 65 * ApplicationInfo.ratio 154 | height: label.text !== "" ? statusBarHeight : 0 155 | 156 | Behavior on height { NumberAnimation {easing.type: Easing.OutSine}} 157 | Behavior on opacity { NumberAnimation {}} 158 | 159 | style: StatusBarStyle { 160 | padding { left: 0; right: 0 ; top: 0 ; bottom: 0} 161 | property Component background: Rectangle { 162 | implicitHeight: 65 * ApplicationInfo.ratio 163 | implicitWidth: root.width 164 | color: ApplicationInfo.colors.smokeGray 165 | Rectangle { 166 | width: parent.width 167 | height: 1 168 | color: Qt.darker(parent.color, 1.5) 169 | } 170 | Rectangle { 171 | y: 1 172 | width: parent.width 173 | height: 1 174 | color: "white" 175 | } 176 | } 177 | } 178 | TouchLabel { 179 | id: label 180 | y: 32 * ApplicationInfo.ratio - height/2 181 | width: parent.width // The text will only wrap if an explicit width has been set 182 | text: statusBarMessage 183 | textFormat: Text.RichText 184 | onLinkActivated: Qt.openUrlExternally(link) 185 | wrapMode: Text.Wrap 186 | pixelSize: 18 187 | letterSpacing: -0.15 188 | color: ApplicationInfo.colors.mediumGray 189 | verticalAlignment: Text.AlignVCenter 190 | horizontalAlignment: Text.AlignHCenter 191 | function decreaseFontSizeOnNarrowScreen() { 192 | if (label.implicitHeight > statusbar.statusBarHeight) 193 | pixelSize = Math.floor(pixelSize * statusbar.statusBarHeight/label.implicitHeight) 194 | } 195 | onTextChanged: { 196 | if (text === "") 197 | pixelSize = 18 198 | else 199 | decreaseFontSizeOnNarrowScreen() 200 | } 201 | onWidthChanged: decreaseFontSizeOnNarrowScreen() 202 | } 203 | } 204 | } 205 | -------------------------------------------------------------------------------- /qml/models/WeatherModel.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). 4 | ** Contact: http://www.qt-project.org/legal 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names 21 | ** of its contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | import QtQuick 2.1 42 | import QtQuick.XmlListModel 2.0 43 | import org.qtproject.demo.weather 1.0 44 | import "../js/utils.js" as Utils 45 | 46 | Item { 47 | id: modelitem 48 | signal error(string errorMessage) 49 | signal showLongTerm() 50 | 51 | property var loadedCityModel 52 | property string lastLoadedCity 53 | 54 | function getLongTermModel(model) 55 | { 56 | if (model.sourceXml !== lastLoadedCity || 57 | standardmodel.xml !== model.contentXml || 58 | model.daysCount() === 0) { 59 | if (!!model) model.clear() 60 | if (standardmodel.xml !== model.contentXml) { 61 | standardmodel.xml = model.contentXml 62 | } else { 63 | if (!!standardmodel.get(0)) { 64 | // no error on last loading 65 | model.copyright = standardmodel.get(0).copyright 66 | currentCityForecastModel.reload() 67 | } else { 68 | error("The saved xml file cannot be parsed") 69 | } 70 | } 71 | loadedCityModel = model 72 | } else { 73 | showLongTerm() 74 | } 75 | lastLoadedCity = model.sourceXml 76 | } 77 | 78 | XmlListModel { 79 | id: standardmodel 80 | property var city 81 | query: "/weatherdata" 82 | XmlRole { name: "copyright"; query: "credit/link/@text/string()"} 83 | onStatusChanged : { 84 | if (status === XmlListModel.Ready && count > 0) { 85 | var item = get(0) 86 | loadedCityModel.copyright = item.copyright 87 | currentCityForecastModel.xml = xml 88 | } else if ( status === XmlListModel.Error) { 89 | error(errorString()) 90 | } else if (status === XmlListModel.Ready && count == 0) { 91 | error(qsTr("Can't parse the xml file")) 92 | } 93 | } 94 | } 95 | 96 | XmlListModel { 97 | id: currentCityForecastModel 98 | query: "/weatherdata/forecast/tabular/time" 99 | XmlRole { name: "from"; query: "@from/string()" } 100 | XmlRole { name: "to"; query: "@to/string()" } 101 | XmlRole { name: "period"; query: "@period/string()" } 102 | XmlRole { name: "symbolcode"; query: "symbol/@var/string()" } 103 | XmlRole { name: "windType"; query: "windSpeed/@name/string()" } 104 | XmlRole { name: "windDirectionName"; query: "windDirection/@name/string()" } 105 | XmlRole { name: "windDirectionDeg"; query: "windDirection/@deg/string()" } 106 | XmlRole { name: "windSpeed"; query: "windSpeed/@mps/string()" } 107 | XmlRole { name: "temperature"; query: "temperature/@value/string()" } 108 | XmlRole { name: "rain"; query: "precipitation/@value/string()" } 109 | 110 | onStatusChanged: { 111 | if (status === XmlListModel.Ready && count > 0) { 112 | for (var i=0; i -1) 124 | processCity(foundIndex) 125 | } 126 | clearSearchBox() 127 | } 128 | function processCity(index) 129 | { 130 | if (!isLocked) { 131 | page1.selected = index 132 | ApplicationInfo.currentCityModel = availableCities.getCityModel(index) 133 | nextPage() 134 | } 135 | } 136 | 137 | Cities { id: availableCities } 138 | 139 | Connections { 140 | target: Qt.application 141 | onStateChanged: if (Qt.application.state === Qt.ApplicationSuspended) availableCities.saveCities() 142 | } 143 | 144 | Stack.onStatusChanged: { 145 | if (Stack.status === Stack.Activating) 146 | updateStatusBar("") 147 | } 148 | } 149 | -------------------------------------------------------------------------------- /qml/pages/LongTermDayItem.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). 4 | ** Contact: http://www.qt-project.org/legal 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names 21 | ** of its contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | import QtQuick 2.1 42 | import QtQuick.Layouts 1.0 43 | import "../js/utils.js" as Utils 44 | import org.qtproject.demo.weather 1.0 45 | import QtQml.Models 2.1 46 | 47 | ObjectModel { 48 | TouchLabel { 49 | id: shortDay 50 | property bool useShortFormat: true 51 | text: Utils.getDay(0, dayModel, useShortFormat) 52 | font.weight: Font.DemiBold 53 | Layout.alignment: Qt.AlignBaseline 54 | font.capitalization: Font.Capitalize 55 | 56 | Accessible.ignored: true 57 | 58 | Rectangle { 59 | color: mouse.pressed ? ApplicationInfo.colors.smokeGray : ApplicationInfo.colors.white 60 | width: parent.parent.width + 2* ApplicationInfo.hMargin 61 | height: rowHeight 62 | y: -parent.y + separator1.y 63 | z: -1 64 | x: -ApplicationInfo.hMargin 65 | Accessible.role: Accessible.Button 66 | Accessible.name: qsTr("%1 %2 - temperature low: %3, high: %4, wind: %5 %6").arg(Utils.getDay(0, dayModel)).arg(Utils.getShortDate(dayModel.date)).arg(lowTemp.text).arg(highTemp.text).arg(windSpeed.text).arg(Utils.expandAbbreviation("m/s")) 67 | Accessible.description: qsTr("press for details") 68 | Accessible.onPressAction: { 69 | ApplicationInfo.currentIndexDay = index 70 | nextPage() 71 | } 72 | 73 | MouseArea { 74 | id: mouse 75 | anchors.fill: parent 76 | onClicked: { 77 | parent.Accessible.pressAction() 78 | } 79 | } 80 | Rectangle { 81 | width: parent.width 82 | height: 1 83 | anchors.top: parent.top 84 | visible: index > 0 85 | color: ApplicationInfo.colors.paleGray 86 | } 87 | } 88 | } 89 | TouchLabel { 90 | text: Utils.getShortDate(dayModel.date) 91 | pixelSize: 20 92 | letterSpacing: -0.15 93 | Layout.alignment: Qt.AlignBaseline 94 | Accessible.ignored: true 95 | } 96 | Separator { 97 | id: separator1 98 | implicitWidth: 5 99 | implicitHeight: 5 100 | Layout.preferredHeight: rowHeight // sets the row height 101 | Layout.fillHeight: false 102 | Layout.minimumHeight: 5 103 | Layout.minimumWidth: 5 104 | } 105 | Image { 106 | source: Utils.getWeatherUrl(dayModel.afternoonIndex, dayModel) 107 | property int weatherIconSize: 80 * ApplicationInfo.ratio 108 | Layout.preferredHeight: weatherIconSize 109 | Layout.preferredWidth: weatherIconSize 110 | onStatusChanged: if (status === Image.Error) updateStatusBar(ApplicationInfo.constants.errorLoadingImage + ": " + source) 111 | } 112 | Separator { 113 | implicitWidth: 5 114 | implicitHeight: 5 115 | Layout.fillHeight: false 116 | Layout.minimumHeight: 5 117 | Layout.minimumWidth: 5 118 | } 119 | TouchLabel { 120 | id: lowTemp 121 | property string temp: Utils.getMinTemp(dayModel) 122 | text: Utils.getTempFormat(temp) 123 | color: temp < 0 ? ApplicationInfo.colors.blue : ApplicationInfo.colors.doubleDarkGray 124 | Layout.alignment: Qt.AlignBaseline 125 | Accessible.ignored: true 126 | } 127 | Rectangle { 128 | id: separator2 129 | Layout.preferredWidth: 1 130 | Layout.preferredHeight: rowHeight / 5 131 | color: ApplicationInfo.colors.lightGray 132 | } 133 | TouchLabel { 134 | id: highTemp 135 | property int temp: Utils.getMaxTemp(dayModel) 136 | text: Utils.getTempFormat(temp) 137 | horizontalAlignment: Qt.AlignRight 138 | color: temp < 0 ? ApplicationInfo.colors.blue : ApplicationInfo.colors.doubleDarkGray 139 | Layout.alignment: Qt.AlignBaseline 140 | Accessible.ignored: true 141 | } 142 | Separator { 143 | implicitWidth: 5 144 | implicitHeight: 5 145 | Layout.minimumHeight: 5 146 | Layout.minimumWidth: 5 147 | visible: !isNarrow 148 | } 149 | Image { 150 | property int windIconSize: 32 * ApplicationInfo.ratio 151 | source: Utils.getWindUrl(dayModel.afternoonIndex, dayModel) 152 | Layout.preferredHeight: windIconSize 153 | Layout.preferredWidth: windIconSize 154 | onStatusChanged: if (status === Image.Error) updateStatusBar(ApplicationInfo.constants.errorLoadingImage + ": " + source) 155 | visible: !isNarrow 156 | } 157 | TouchLabel { 158 | id: windSpeed 159 | text: Utils.getWindSpeed(dayModel.afternoonIndex, dayModel) 160 | pixelSize: 24 161 | Layout.alignment: Qt.AlignBaseline 162 | visible: !isNarrow 163 | Accessible.ignored: true 164 | } 165 | TouchLabel { 166 | id: windSpeedUnit 167 | //: The wind speed unit, meters per second or miles per hour 168 | text: Utils.isMetricSystem() ? qsTr("m/s") : qsTr("mph") 169 | pixelSize: 18 170 | Layout.alignment: Qt.AlignBaseline 171 | visible: !isNarrow 172 | Accessible.ignored: true 173 | } 174 | } 175 | -------------------------------------------------------------------------------- /qml/pages/LongTermPage.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). 4 | ** Contact: http://www.qt-project.org/legal 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names 21 | ** of its contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | import QtQuick 2.1 42 | import QtQuick.Controls 1.1 43 | import QtQuick.Layouts 1.0 44 | import org.qtproject.demo.weather 1.0 45 | 46 | BasicPage { 47 | id: page2 48 | title1: ApplicationInfo.currentCityModel.cityNameDisplay 49 | title2: ApplicationInfo.currentCityModel.countryName 50 | title3: qsTr("10 Day Forecast") 51 | 52 | property bool cityLoaded: false 53 | 54 | property string sourceLink: ApplicationInfo.currentCityModel.sourceXml.replace(/\/forecast.xml$/, "") 55 | 56 | onCityLoadedChanged: updateStatusBar(ApplicationInfo.currentCityModel.copyright + " (source)") 57 | 58 | pageComponent: Item { 59 | TouchScrollView { 60 | id: scrollview 61 | anchors.fill: parent 62 | flickableItem.interactive: true 63 | flickableItem.flickableDirection: Flickable.VerticalFlick 64 | Item { 65 | id: item 66 | width: scrollview.width 67 | implicitHeight: grid.implicitHeight 68 | property int rowHeight: ApplicationInfo.constants.rowDelegateHeight + 1 69 | GridLayout { 70 | id: grid 71 | Accessible.role: Accessible.List 72 | anchors.left: parent.left 73 | anchors.right: parent.right 74 | anchors.leftMargin: ApplicationInfo.hMargin 75 | anchors.rightMargin: ApplicationInfo.hMargin 76 | property bool isNarrowScreen: false 77 | property int itemsInModelCount: r1.count && !!r1.itemAt(0) ? r1.itemAt(0).count : 0 78 | 79 | function checkIfNarrowScreen() { 80 | if (itemsInModelCount !== 0 && ApplicationInfo.isPortraitMode && !isNarrowScreen && grid.implicitWidth > grid.width) { 81 | isNarrowScreen = true 82 | columns = itemsInModelCount - 4 83 | } 84 | } 85 | 86 | onWidthChanged: checkIfNarrowScreen() 87 | onImplicitWidthChanged: checkIfNarrowScreen() 88 | Connections { 89 | target: ApplicationInfo 90 | onIsPortraitModeChanged: { 91 | if (grid.itemsInModelCount !== 0) { 92 | if (!ApplicationInfo.isPortraitMode) { 93 | grid.isNarrowScreen = false 94 | grid.columns = grid.itemsInModelCount 95 | } 96 | } 97 | } 98 | } 99 | 100 | flow: GridLayout.LeftToRight 101 | rowSpacing: 0 102 | columnSpacing: 6 * ApplicationInfo.ratio 103 | 104 | columns: grid.itemsInModelCount 105 | Repeater { 106 | id: r1 107 | model: cityLoaded ? ApplicationInfo.currentCityModel.daysCount() : null 108 | Repeater { 109 | model: LongTermDayItem {id: longday} 110 | property int dayIndex: r1.model !== null ? index : 0 111 | property int last: dayIndex === r1.count 112 | property var dayModel: ApplicationInfo.currentCityModel.getDayModel(dayIndex) 113 | property int rowHeight: item.rowHeight 114 | property bool isNarrow: grid.isNarrowScreen 115 | } 116 | } 117 | } 118 | } 119 | } 120 | 121 | Rectangle { 122 | anchors.fill: parent 123 | opacity: cityLoaded ? 0 : 1 124 | Behavior on opacity { NumberAnimation{}} 125 | TouchLabel { 126 | id: label 127 | opacity: cityLoaded ? 0 : 1 128 | Behavior on opacity { NumberAnimation{} } 129 | anchors.centerIn: parent 130 | text: qsTr("Loading data...") 131 | horizontalAlignment: Text.AlignCenter 132 | verticalAlignment: Text.AlignTop 133 | pixelSize: 28 134 | color: ApplicationInfo.colors.mediumGray 135 | height: label.implicitHeight + 80 * ApplicationInfo.ratio 136 | BusyIndicator { 137 | opacity: 0.8 138 | anchors.horizontalCenter: parent.horizontalCenter 139 | anchors.bottom: parent.bottom 140 | height: implicitHeight * ApplicationInfo.ratio 141 | width: implicitWidth * ApplicationInfo.ratio 142 | } 143 | } 144 | } 145 | } 146 | 147 | Connections { 148 | id: cityModelConnection 149 | target: ApplicationInfo.currentCityModel 150 | onError: { 151 | cityLoaded = false 152 | previousPage() 153 | updateStatusBar(errorMessage) 154 | } 155 | onContentXmlChanged: weathermodel.getLongTermModel(ApplicationInfo.currentCityModel) 156 | } 157 | 158 | WeatherModel { 159 | id: weathermodel 160 | onShowLongTerm: { 161 | cityLoaded = true 162 | } 163 | onError: { 164 | cityLoaded = false 165 | lastLoadedCity = "" 166 | previousPage() 167 | updateStatusBar(qsTr("Problem loading the data: ") + errorMessage) 168 | } 169 | } 170 | 171 | Stack.onStatusChanged: if (Stack.status === Stack.Active) 172 | ApplicationInfo.currentCityModel.loadData() 173 | } 174 | -------------------------------------------------------------------------------- /qml/pages/OneDayPage.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). 4 | ** Contact: http://www.qt-project.org/legal 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names 21 | ** of its contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | import QtQuick 2.1 42 | import QtQuick.Layouts 1.0 43 | import QtQuick.Controls 1.0 44 | import org.qtproject.demo.weather 1.0 45 | import "../js/utils.js" as Utils 46 | 47 | BasicPage { 48 | id : page3 49 | title1: ApplicationInfo.currentCityModel.cityNameDisplay 50 | title2: ApplicationInfo.currentCityModel.countryName 51 | 52 | property QtObject dayModel: ApplicationInfo.currentCityModel.getDayModel(ApplicationInfo.currentIndexDay) 53 | 54 | onDayModelChanged: if (!!dayModel) { 55 | if (ApplicationInfo.currentIndexDay === 0) 56 | title3 = qsTr("Today") 57 | else if (ApplicationInfo.currentIndexDay === 1) 58 | title3 = qsTr("Tomorrow") 59 | else 60 | title3 = Utils.getDay(0, dayModel) + " " + Utils.getLongDate(dayModel.date) 61 | } 62 | 63 | pageComponent: GridLayout { 64 | id: splitview 65 | flow: !ApplicationInfo.isPortraitMode ? GridLayout.LeftToRight : GridLayout.TopToBottom 66 | property bool singleItem: sliderItem.slider.minimumValue === sliderItem.slider.maximumValue 67 | property bool init: false 68 | 69 | Connections { 70 | target: page3 71 | onHeightChanged: adjustHeight() 72 | } 73 | 74 | function adjustHeight() { 75 | if (!init) { 76 | var adjust = (splitview.implicitHeight > splitview.height) ? Math.floor(splitview.height*10/splitview.implicitHeight)/10 : 1 77 | if (adjust < 1 && adjust > 0) { 78 | init = true 79 | zoom.adjustementNeeded = adjust 80 | sliderItem.adjustementNeeded = adjust 81 | } 82 | } 83 | } 84 | 85 | Separator {} 86 | OneDayZoomItem { 87 | id: zoom 88 | slider: sliderItem.slider 89 | model: page3.dayModel 90 | singleItem: splitview.singleItem 91 | } 92 | Separator { 93 | implicitHeight: 10 * ApplicationInfo.ratio 94 | implicitWidth: 10 * ApplicationInfo.ratio 95 | visible: !singleItem && !init 96 | } 97 | OneDaySliderItem { 98 | id: sliderItem 99 | visible: !singleItem 100 | model: page3.dayModel 101 | } 102 | Separator {} 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /qml/pages/Separator.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). 4 | ** Contact: http://www.qt-project.org/legal 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names 21 | ** of its contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | import QtQuick 2.1 42 | import QtQuick.Layouts 1.0 43 | import org.qtproject.demo.weather 1.0 44 | 45 | Item { 46 | implicitHeight: ApplicationInfo.hMargin 47 | implicitWidth: ApplicationInfo.hMargin 48 | Layout.minimumHeight: 0 49 | Layout.minimumWidth: 0 50 | Layout.fillHeight: true 51 | Layout.fillWidth: true 52 | } 53 | -------------------------------------------------------------------------------- /qml/touch/ListViewDelegate.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). 4 | ** Contact: http://www.qt-project.org/legal 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names 21 | ** of its contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | import QtQuick 2.1 42 | import QtQuick.Layouts 1.0 43 | import org.qtproject.demo.weather 1.0 44 | 45 | Rectangle { 46 | id: rect 47 | height: ApplicationInfo.constants.rowDelegateHeight 48 | width: parent.width 49 | signal clicked 50 | signal deleteCity 51 | 52 | property bool isSearchView: false 53 | 54 | color: mouseNext.pressed ? ApplicationInfo.colors.smokeGray : ApplicationInfo.colors.white 55 | Accessible.role: Accessible.ListItem 56 | 57 | MouseArea { 58 | id: mouseNext 59 | anchors.left: parent.left 60 | width: parent.width - 80 * ApplicationInfo.ratio - ApplicationInfo.hMargin 61 | height: parent.height 62 | onClicked: rect.clicked() 63 | Accessible.role: Accessible.Button 64 | Accessible.name: loader.item.accessibleName 65 | Accessible.onPressAction: { 66 | rect.clicked() 67 | } 68 | } 69 | GridLayout { 70 | id: _grid 71 | anchors.fill: parent 72 | flow: Qt.LeftToRight 73 | rowSpacing: 4 * ApplicationInfo.ratio 74 | columnSpacing: 0 75 | columns: 2 76 | Rectangle { 77 | Layout.preferredWidth: ApplicationInfo.hMargin 78 | Layout.fillHeight: true 79 | opacity: 0 80 | } 81 | Loader { 82 | id: loader 83 | sourceComponent: isSearchView ? searchViewRow : cityViewRow 84 | Layout.fillHeight: true 85 | Layout.fillWidth: true 86 | } 87 | Rectangle { 88 | id: separator 89 | Layout.fillWidth: true 90 | Layout.fillHeight: true 91 | Layout.columnSpan: 2 92 | } 93 | } 94 | Rectangle { 95 | z: 1 96 | height: 1 97 | anchors.bottom: parent.bottom 98 | width: parent.width 99 | color: ApplicationInfo.colors.paleGray 100 | } 101 | 102 | property Component searchViewRow: RowLayout { 103 | spacing: 0 104 | property string accessibleName: country 105 | TouchLabel { 106 | color: ApplicationInfo.colors.mediumGray 107 | id: countryLabel 108 | text: country 109 | pixelSize: 28 110 | Layout.alignment: Qt.AlignBaseline 111 | Layout.fillWidth: true 112 | Layout.maximumWidth: rect.width - 2 * ApplicationInfo.hMargin 113 | Accessible.ignored: true 114 | } 115 | Rectangle { 116 | Layout.preferredWidth: ApplicationInfo.hMargin 117 | Layout.fillHeight: true 118 | opacity: 0 119 | } 120 | } 121 | 122 | property Component cityViewRow: RowLayout { 123 | spacing: 0 124 | property string accessibleName: city.text + " - " + countryLabel.text 125 | TouchLabel { 126 | id: city 127 | text: name 128 | font.weight: Font.DemiBold 129 | Layout.maximumWidth: maximumWidth * 2 130 | Layout.alignment: Qt.AlignBaseline 131 | Accessible.ignored: true 132 | } 133 | Item { 134 | implicitWidth: 12 * ApplicationInfo.ratio 135 | Layout.minimumWidth: implicitWidth 136 | } 137 | TouchLabel { 138 | color: ApplicationInfo.colors.mediumGray 139 | id: countryLabel 140 | text: country 141 | pixelSize: 28 142 | Layout.alignment: Qt.AlignBaseline | Qt.AlignLeft 143 | Layout.fillWidth: true 144 | Layout.minimumWidth: 0 145 | Accessible.ignored: true 146 | } 147 | MouseArea { 148 | id: deleteMouse 149 | implicitWidth: ApplicationInfo.constants.rowDelegateHeight 150 | implicitHeight: implicitWidth 151 | Layout.minimumWidth: implicitWidth 152 | onClicked: if (!isSearchView) rect.deleteCity() 153 | Accessible.name: qsTr("Remove %1").arg(city.text) 154 | Accessible.role: Accessible.Button 155 | Accessible.onPressAction: { if (!isSearchView) rect.deleteCity() } 156 | Image { 157 | id: imageRemove 158 | anchors.centerIn: parent 159 | source: ApplicationInfo.getImagePath("darkclose.png") 160 | width: 31 * ApplicationInfo.ratio 161 | height: 31 * ApplicationInfo.ratio 162 | } 163 | Rectangle { 164 | anchors.fill: parent 165 | anchors.margins: 8 * ApplicationInfo.ratio 166 | color: ApplicationInfo.colors.smokeGray 167 | opacity: deleteMouse.pressed ? 1 : 0 168 | z: -1 169 | radius: 8 170 | } 171 | } 172 | } 173 | } 174 | -------------------------------------------------------------------------------- /qml/touch/TouchLabel.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). 4 | ** Contact: http://www.qt-project.org/legal 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names 21 | ** of its contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | import QtQuick 2.1 42 | import QtQuick.Controls 1.0 43 | import QtQuick.Layouts 1.0 44 | import org.qtproject.demo.weather 1.0 45 | 46 | Label { 47 | id: label 48 | property int pixelSize: 34 49 | property real letterSpacing: -0.25 50 | 51 | font.family: "Open Sans" 52 | font.pixelSize: pixelSize * ApplicationInfo.ratio * 1.1 // increasing fonts 53 | font.letterSpacing: letterSpacing * ApplicationInfo.ratio 54 | color: ApplicationInfo.colors.doubleDarkGray 55 | verticalAlignment: Text.AlignBottom 56 | horizontalAlignment: Text.AlignLeft 57 | elide: Text.ElideRight 58 | linkColor: ApplicationInfo.colors.blue 59 | renderType: ApplicationInfo.isMobile ? Text.QtRendering : Text.NativeRendering 60 | 61 | function expectedTextWidth(value) 62 | { 63 | dayText.text = value 64 | return dayText.width 65 | } 66 | 67 | property int maximumWidth: (ApplicationInfo.constants.isMobile ? ApplicationInfo.applicationWidth : 1120) / 4 68 | Layout.minimumWidth: Math.min(Layout.maximumWidth, implicitWidth + 1) 69 | 70 | Text { 71 | id: dayText 72 | visible: false 73 | font.family: label.font.family 74 | font.pixelSize: label.font.pixelSize 75 | font.letterSpacing: label.font.letterSpacing 76 | wrapMode: label.wrapMode 77 | elide: label.elide 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /qml/touch/TouchScrollView.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). 4 | ** Contact: http://www.qt-project.org/legal 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names 21 | ** of its contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | import QtQuick 2.1 42 | import QtQuick.Controls 1.0 43 | import QtQuick.Controls.Styles 1.0 44 | import org.qtproject.demo.weather 1.0 45 | 46 | ScrollView { 47 | frameVisible: false 48 | style: ScrollViewStyle { 49 | property int handleWidth: 20 * ApplicationInfo.ratio 50 | transientScrollBars: true 51 | padding{ top: 4 ; bottom: 4 ; right: 4} 52 | property bool hovered: false 53 | } 54 | Rectangle { 55 | anchors.fill: parent 56 | color: ApplicationInfo.colors.white 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /qml/touch/TouchSlider.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). 4 | ** Contact: http://www.qt-project.org/legal 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names 21 | ** of its contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | import QtQuick 2.1 42 | import QtQuick.Controls 1.0 43 | import QtQuick.Controls.Styles 1.0 44 | import org.qtproject.demo.weather 1.0 45 | 46 | Slider { 47 | id: slider 48 | property real sliderHandleHeight: 0. 49 | property real sliderHandleWidth: 0. 50 | implicitHeight: sliderHandleHeight + ApplicationInfo.ratio * 25 51 | style: SliderStyle { 52 | groove: Rectangle { 53 | Rectangle { 54 | id: beforeHandle 55 | width: styleData.handlePosition 56 | height: 20 * ApplicationInfo.ratio 57 | color: ApplicationInfo.colors.blue 58 | radius: 90 59 | z: -1 60 | } 61 | Rectangle { 62 | id: afterHandle 63 | anchors.left: beforeHandle.right 64 | anchors.right: parent.right 65 | height: 20 * ApplicationInfo.ratio 66 | color: ApplicationInfo.colors.darkGray 67 | radius: 90 68 | z: -1 69 | } 70 | } 71 | handle: Item { 72 | width: sliderHandleWidth 73 | height: sliderHandleHeight 74 | Image { 75 | anchors.centerIn: parent 76 | source: ApplicationInfo.getImagePath(control.pressed ? "Pointer_pressed.png" : "Pointer.png") 77 | width: sliderHandleWidth + 16 * ApplicationInfo.ratio 78 | height: sliderHandleHeight + 16 * ApplicationInfo.ratio 79 | } 80 | } 81 | } 82 | } 83 | -------------------------------------------------------------------------------- /qml/touch/TouchTextField.qml: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). 4 | ** Contact: http://www.qt-project.org/legal 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names 21 | ** of its contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | import QtQuick 2.1 42 | import QtQuick.Controls 1.0 43 | import QtQuick.Controls.Styles 1.0 44 | import org.qtproject.demo.weather 1.0 45 | 46 | TextField { 47 | id: textfield 48 | signal clearButtonClicked 49 | implicitWidth: parent.width 50 | property bool isEmpty: true 51 | style: TextFieldStyle { 52 | renderType: ApplicationInfo.isMobile ? Text.QtRendering : Text.NativeRendering 53 | background : 54 | Rectangle { 55 | radius: 8 56 | border.width: 1 57 | border.color: Qt.darker(ApplicationInfo.colors.blue, 1.6) 58 | color: ApplicationInfo.colors.white 59 | gradient: Gradient { 60 | GradientStop { position: 0 ; color: "#ddd"} 61 | GradientStop { position: 0.05 ; color: "#fff"} 62 | } 63 | 64 | implicitHeight: 60 * ApplicationInfo.ratio 65 | opacity: 1 66 | } 67 | padding.left : (12 + 50) * ApplicationInfo.ratio 68 | padding.right: (12 + 50) * ApplicationInfo.ratio 69 | font.pixelSize: 28 * ApplicationInfo.ratio 70 | font.family: "Open Sans" 71 | font.letterSpacing: -0.25 * ApplicationInfo.ratio 72 | selectedTextColor : ApplicationInfo.colors.lightGray 73 | selectionColor : ApplicationInfo.colors.darkBlue 74 | textColor : ApplicationInfo.colors.mediumGray 75 | } 76 | 77 | Item { 78 | id: item 79 | anchors.left: parent.left 80 | anchors.top: parent.top 81 | height: parent.height 82 | width: parent.height 83 | Image { 84 | opacity: 0.9 85 | anchors.centerIn: item 86 | height: iconSize 87 | width: iconSize 88 | source: ApplicationInfo.getImagePath("magnifier.png") 89 | property int iconSize: 50 * ApplicationInfo.ratio 90 | } 91 | } 92 | 93 | onTextChanged: isEmpty = (text === "") 94 | inputMethodHints: Qt.ImhNoPredictiveText 95 | MouseArea { 96 | z: 2 97 | opacity: !textfield.isEmpty ? 1 : 0 98 | Behavior on opacity {NumberAnimation{}} 99 | anchors.right: parent.right 100 | anchors.rightMargin: 4 * ApplicationInfo.ratio 101 | anchors.top: parent.top 102 | height: parent.height 103 | width: parent.height 104 | Accessible.role: Accessible.Button 105 | Accessible.name: qsTr("Clear") 106 | Accessible.onPressAction: { 107 | textfield.clearButtonClicked() 108 | } 109 | 110 | Image { 111 | anchors.centerIn: parent 112 | source: ApplicationInfo.getImagePath("Clear.png") 113 | property int iconSize: 40 * ApplicationInfo.ratio 114 | opacity: parent.pressed ? 1 : 0.9 115 | width: iconSize 116 | height: iconSize 117 | } 118 | onClicked: textfield.clearButtonClicked() 119 | } 120 | } 121 | 122 | -------------------------------------------------------------------------------- /qml/touch/images/BackArrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/qml/touch/images/BackArrow.png -------------------------------------------------------------------------------- /qml/touch/images/Circle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/qml/touch/images/Circle.png -------------------------------------------------------------------------------- /qml/touch/images/Clear.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/qml/touch/images/Clear.png -------------------------------------------------------------------------------- /qml/touch/images/Pointer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/qml/touch/images/Pointer.png -------------------------------------------------------------------------------- /qml/touch/images/Pointer_pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/qml/touch/images/Pointer_pressed.png -------------------------------------------------------------------------------- /qml/touch/images/darkclose.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/qml/touch/images/darkclose.png -------------------------------------------------------------------------------- /qml/touch/images/magnifier.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/qt-labs/weather-app/e2c92d9d1e978aacc6a541e175dbd9931ca3470f/qml/touch/images/magnifier.png -------------------------------------------------------------------------------- /src/applicationinfo.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). 4 | ** Contact: http://www.qt-project.org/legal 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names 21 | ** of its contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | #ifndef APPLICATIONINFO_H 41 | #define APPLICATIONINFO_H 42 | 43 | #include 44 | #include 45 | 46 | QT_BEGIN_NAMESPACE 47 | class QNetworkAccessManager; 48 | class QNetworkReply; 49 | QT_END_NAMESPACE 50 | 51 | class WeatherImageProvider; 52 | 53 | #include "citymodel.h" 54 | #include "citieslistmodel.h" 55 | 56 | class ApplicationInfo : public QObject 57 | { 58 | Q_OBJECT 59 | Q_PROPERTY(int applicationWidth READ applicationWidth WRITE setApplicationWidth NOTIFY applicationWidthChanged) 60 | Q_PROPERTY(bool isMobile READ isMobile CONSTANT) 61 | Q_PROPERTY(QObject *colors READ colors CONSTANT) 62 | Q_PROPERTY(QObject *constants READ constants CONSTANT) 63 | Q_PROPERTY(bool isPortraitMode READ isPortraitMode WRITE setIsPortraitMode NOTIFY portraitModeChanged) 64 | Q_PROPERTY(int currentIndexDay READ currentIndexDay WRITE setCurrentIndexDay NOTIFY currentIndexDayChanged) 65 | Q_PROPERTY(CityModel *currentCityModel READ currentCityModel WRITE setCurrentCityModel NOTIFY currentCityModelChanged) 66 | Q_PROPERTY(CitiesListModel *foundCities READ foundCities NOTIFY foundCitiesChanged) 67 | Q_PROPERTY(qreal ratio READ ratio CONSTANT) 68 | Q_PROPERTY(qreal hMargin READ hMargin NOTIFY hMarginChanged) 69 | Q_PROPERTY(qreal sliderHandleWidth READ sliderHandleWidth CONSTANT) 70 | Q_PROPERTY(qreal sliderHandleHeight READ sliderHandleHeight CONSTANT) 71 | Q_PROPERTY(qreal sliderGapWidth READ sliderGapWidth CONSTANT) 72 | 73 | public: 74 | ApplicationInfo(WeatherImageProvider *provider); 75 | 76 | bool isMobile() const { return m_isMobile; } 77 | QQmlPropertyMap *colors() const { return m_colors; } 78 | QQmlPropertyMap *constants() const { return m_constants; } 79 | 80 | CityModel *currentCityModel() const { return m_currentCityModel; } 81 | void setCurrentCityModel(CityModel *model); 82 | 83 | int applicationWidth() const { return m_applicationWidth; } 84 | void setApplicationWidth(const int newWidth); 85 | 86 | int currentIndexDay() const { return m_currentIndexDay; } 87 | void setCurrentIndexDay(const int index); 88 | 89 | bool isPortraitMode() const { return m_isPortraitMode; } 90 | void setIsPortraitMode(const bool newMode); 91 | 92 | CitiesListModel *foundCities() { return m_citiesFound; } 93 | 94 | qreal hMargin() const { return m_hMargin; } 95 | qreal ratio() const { return m_ratio; } 96 | qreal sliderHandleHeight() { return m_sliderHandleHeight; } 97 | qreal sliderGapWidth() { return m_sliderGapWidth; } 98 | qreal sliderHandleWidth() { return m_sliderHandleWidth; } 99 | 100 | Q_INVOKABLE QString getImagePath(const QString image); 101 | Q_INVOKABLE void queryCities(const QString input); 102 | 103 | protected slots: 104 | void notifyPortraitMode(Qt::ScreenOrientation); 105 | 106 | private slots: 107 | void replyFinished(QNetworkReply *reply); 108 | 109 | protected: 110 | qreal getSizeWithRatio(const qreal height) { return ratio() * height; } 111 | 112 | signals: 113 | void applicationWidthChanged(); 114 | void portraitModeChanged(); 115 | void hMarginChanged(); 116 | void currentCityModelChanged(); 117 | void currentIndexDayChanged(); 118 | void foundCitiesChanged(); 119 | void waitForCitiesQueryReply(const QString message); 120 | void errorOnQueryCities(const QString errorMessage); 121 | 122 | private: 123 | int m_applicationWidth; 124 | QQmlPropertyMap *m_colors; 125 | QQmlPropertyMap *m_constants; 126 | CityModel *m_currentCityModel; 127 | bool m_isPortraitMode; 128 | int m_currentIndexDay; 129 | QNetworkAccessManager *manager; 130 | CitiesListModel *m_citiesFound; 131 | bool m_isMobile; 132 | qreal m_ratio; 133 | qreal m_hMargin; 134 | qreal m_sliderHandleHeight, m_sliderHandleWidth, m_sliderGapWidth; 135 | WeatherImageProvider *imageProvider; 136 | }; 137 | 138 | #endif // APPLICATIONINFO_H 139 | -------------------------------------------------------------------------------- /src/applicationpaths.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). 4 | ** Contact: http://www.qt-project.org/legal 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names 21 | ** of its contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | #ifndef APPLICATIONPATHS_H 42 | #define APPLICATIONPATHS_H 43 | 44 | #include 45 | #include 46 | #include 47 | #include 48 | 49 | class ApplicationPaths 50 | { 51 | public: 52 | inline static QString settingsPath() 53 | { 54 | return getPath(QStandardPaths::DataLocation); 55 | } 56 | inline static QString dowloadedFilesPath() 57 | { 58 | return getPath(QStandardPaths::CacheLocation); 59 | } 60 | protected: 61 | 62 | inline static QString getPath(QStandardPaths::StandardLocation location) 63 | { 64 | QString path = QStandardPaths::standardLocations(location).value(0); 65 | QDir dir(path); 66 | if (!dir.exists()) 67 | dir.mkpath(path); 68 | if (!path.isEmpty() && !path.endsWith("/")) 69 | path += "/"; 70 | return path; 71 | } 72 | }; 73 | 74 | #endif // APPLICATIONPATHS_H 75 | -------------------------------------------------------------------------------- /src/cities.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). 4 | ** Contact: http://www.qt-project.org/legal 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names 21 | ** of its contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | 48 | #include "cities.h" 49 | #include "citymodel.h" 50 | #include "applicationpaths.h" 51 | #include 52 | 53 | Cities::Cities(QObject *parent) : 54 | QAbstractListModel(parent) 55 | { 56 | m_citiesFileName = QString("%1cities.settings").arg(ApplicationPaths::settingsPath()); 57 | readCities(); 58 | } 59 | 60 | Cities::~Cities() 61 | { 62 | saveCities(); 63 | } 64 | 65 | CityModel* Cities::getCityModel(int index) 66 | { 67 | Q_ASSERT(index > -1); 68 | Q_ASSERT(index < m_cityMap.count()); 69 | return m_cityMap.at(index).second; 70 | } 71 | 72 | void Cities::removeCityModel(int index) 73 | { 74 | if (index < m_cityMap.count() && index >=0 ) 75 | { 76 | beginRemoveRows(QModelIndex(), index, index); 77 | CityModel *modelToDelete = m_cityMap.at(index).second; 78 | modelToDelete->cleanAll(); 79 | modelToDelete->deleteLater(); 80 | m_cityMap.removeAt(index); 81 | endRemoveRows(); 82 | } 83 | } 84 | 85 | int Cities::addCityModel(CityModel *model) 86 | { 87 | CityModelPair pair = qMakePair(model->sourceXml(), model); 88 | int modelIndex = m_cityMap.indexOf(pair); 89 | if (modelIndex == -1) { 90 | m_cityMap.prepend(pair); 91 | connect(model, SIGNAL(contentXmlChanged()), this, SIGNAL(cityModelReady())); 92 | if (m_cityMap.count() > 15) 93 | removeCityModel(m_cityMap.count() - 1); 94 | return 0; 95 | } 96 | return modelIndex; 97 | } 98 | 99 | void Cities::readCities() 100 | { 101 | QFile file(m_citiesFileName); 102 | if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) 103 | return; 104 | QTextStream in(&file); 105 | while (!in.atEnd()) { 106 | QString sourceXml = in.readLine().trimmed(); 107 | processSourceXml(sourceXml); 108 | } 109 | file.close(); 110 | } 111 | 112 | int Cities::processSourceXml(const QString &sourceXml) 113 | { 114 | // Dont add save town/identical sourceXml twice 115 | for (int i = 0; i setSourceXml(sourceXml)) 121 | return addCityModel(model); 122 | 123 | model->deleteLater(); 124 | return -1; 125 | } 126 | 127 | void Cities::saveCities() 128 | { 129 | QFile file(m_citiesFileName); 130 | if (!file.open(QIODevice::WriteOnly | QIODevice::Text)) 131 | return; 132 | QTextStream out(&file); 133 | for (int index = m_cityMap.count()-1; index >= 0; index--) 134 | out << m_cityMap.at(index).first << endl; 135 | file.close(); 136 | } 137 | 138 | QVariant Cities::data(const QModelIndex & index, int role) const 139 | { 140 | CityModel *model = m_cityMap.at(index.row()).second; 141 | if (model) { 142 | switch (role) { 143 | case CityNameRole: 144 | return model->cityNameDisplay().replace("_", " "); 145 | case CountryRole: 146 | return model->countryName().replace("_", " "); 147 | } 148 | } 149 | return QVariant(); 150 | } 151 | 152 | int Cities::rowCount(const QModelIndex & /*parent*/) const 153 | { 154 | return m_cityMap.count(); 155 | } 156 | 157 | QHash Cities::roleNames() const 158 | { 159 | QHash rn; 160 | rn[CityNameRole] = "name"; 161 | rn[CountryRole] = "country"; 162 | return rn; 163 | } 164 | -------------------------------------------------------------------------------- /src/cities.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). 4 | ** Contact: http://www.qt-project.org/legal 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names 21 | ** of its contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | #ifndef CITIES_H 42 | #define CITIES_H 43 | 44 | #include 45 | #include 46 | #include 47 | #include 48 | 49 | class CityModel; 50 | 51 | typedef QPair CityModelPair; 52 | 53 | class Cities : public QAbstractListModel 54 | { 55 | Q_OBJECT 56 | public: 57 | enum { 58 | CityNameRole = Qt::UserRole + 1, 59 | CountryRole = Qt::UserRole + 2 60 | }; 61 | 62 | Cities(QObject *parent = 0); 63 | ~Cities(); 64 | 65 | Q_INVOKABLE CityModel* getCityModel(const int index); 66 | Q_INVOKABLE void removeCityModel(const int index); 67 | int addCityModel(CityModel *model); 68 | Q_INVOKABLE int processSourceXml(const QString &sourceXml); 69 | 70 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; 71 | QHash roleNames() const; 72 | int rowCount(const QModelIndex & parent = QModelIndex()) const; 73 | Q_INVOKABLE void saveCities(); 74 | 75 | protected: 76 | void readCities(); 77 | 78 | signals: 79 | void cityModelReady(); 80 | void modelChanged(const int index); 81 | 82 | private: 83 | QString m_wantedCity; 84 | QString m_citiesFileName; 85 | QString m_cachePath; 86 | QList m_cityMap; 87 | }; 88 | 89 | QML_DECLARE_TYPE(Cities) 90 | 91 | #endif // CITIES_H 92 | -------------------------------------------------------------------------------- /src/citieslistmodel.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). 4 | ** Contact: http://www.qt-project.org/legal 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names 21 | ** of its contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | #include "citieslistmodel.h" 42 | #include 43 | 44 | CitiesListModel::CitiesListModel(QObject *parent) : 45 | QAbstractListModel(parent), m_isEmpty(true) 46 | { 47 | } 48 | 49 | QVariant CitiesListModel::data(const QModelIndex & index, int role) const 50 | { 51 | Q_ASSERT(index.row() < m_foundCities.count()); 52 | if (role == CountryRole) 53 | return QString(m_foundCities.at(index.row()).first).replace("_", " "); 54 | else 55 | return QVariant(""); 56 | } 57 | 58 | int CitiesListModel::rowCount(const QModelIndex & /*parent*/) const 59 | { 60 | return m_foundCities.count(); 61 | } 62 | 63 | QString CitiesListModel::getCitySourceXml(const int index) 64 | { 65 | Q_ASSERT(index > -1); 66 | Q_ASSERT(index < m_foundCities.count()); 67 | CityXmlPair pair = m_foundCities.at(index); 68 | // In order to use yr.no weather data service, refer to their terms 69 | // and conditions of use. http://om.yr.no/verdata/free-weather-data/ 70 | return QString("http://www.yr.no%1forecast.xml").arg(pair.second); 71 | } 72 | 73 | void CitiesListModel::addCities(QStringList listCities) 74 | { 75 | clear(); 76 | QList temp; 77 | if (!listCities.empty()) { 78 | for (int i = 0; i < listCities.count(); i++) 79 | { 80 | QRegExp regExp2; 81 | regExp2.setPattern("^\"(.*)\",\"(.*)\",\"(.*)\",\"(.*)\"$"); 82 | regExp2.exactMatch(listCities.at(i)); 83 | QString cityName = regExp2.capturedTexts().at(1); 84 | QString countryName = regExp2.capturedTexts().at(3); 85 | QString xml = regExp2.capturedTexts().at(2); 86 | QRegExp regExp3; 87 | regExp3.setPattern("^/place/.*/.*/.*/$"); 88 | if (countryName.isEmpty() || countryName.contains("Municipality") || !regExp3.exactMatch(xml)) 89 | continue; // We want cities forecast only 90 | QString name = cityName + " - " + countryName; 91 | temp.append(qMakePair(name, xml)); 92 | } 93 | } 94 | 95 | if (!temp.isEmpty()) { 96 | beginInsertRows(QModelIndex(), 0, temp.count() - 1); 97 | m_foundCities.append(temp); 98 | m_isEmpty = false; 99 | } else { 100 | beginInsertRows(QModelIndex(), 0, 0); 101 | m_foundCities.append(qMakePair(tr("no city found"), QString(""))); 102 | } 103 | 104 | endInsertRows(); 105 | } 106 | 107 | void CitiesListModel::clear() 108 | { 109 | m_isEmpty = true; 110 | if (m_foundCities.count() > 0) { 111 | beginRemoveRows(QModelIndex(), 0, m_foundCities.count() - 1); 112 | m_foundCities.clear(); 113 | endRemoveRows(); 114 | } 115 | } 116 | 117 | QHash CitiesListModel::roleNames() const 118 | { 119 | QHash rn; 120 | rn[CountryRole] = "country"; 121 | rn[NameRole] = "name"; // needed to use in delegate that read both roles (country and name) 122 | return rn; 123 | } 124 | 125 | -------------------------------------------------------------------------------- /src/citieslistmodel.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). 4 | ** Contact: http://www.qt-project.org/legal 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names 21 | ** of its contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | #ifndef CITIESLISTMODEL_H 42 | #define CITIESLISTMODEL_H 43 | 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | 50 | typedef QPair CityXmlPair; 51 | 52 | class CitiesListModel : public QAbstractListModel 53 | { 54 | Q_OBJECT 55 | Q_PROPERTY(bool isEmpty READ isEmpty NOTIFY isEmptyChanged) 56 | public: 57 | enum { 58 | NameRole = Qt::UserRole + 1, 59 | CountryRole = Qt::UserRole + 2 60 | }; 61 | CitiesListModel(QObject *parent = 0); 62 | 63 | Q_INVOKABLE QString getCitySourceXml(const int index); 64 | void addCities(QStringList listCities = QStringList()); 65 | 66 | bool isEmpty() const { return m_isEmpty; } 67 | 68 | void clear(); 69 | QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; 70 | Q_INVOKABLE int rowCount(const QModelIndex & parent = QModelIndex()) const; 71 | QHash roleNames() const; 72 | 73 | signals: 74 | void isEmptyChanged(); 75 | 76 | private: 77 | QList m_foundCities; 78 | bool m_isEmpty; 79 | }; 80 | 81 | QML_DECLARE_TYPE(CitiesListModel) 82 | 83 | #endif // CITIESLISTMODEL_H 84 | -------------------------------------------------------------------------------- /src/citymodel.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). 4 | ** Contact: http://www.qt-project.org/legal 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names 21 | ** of its contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | #ifndef CITYMODEL_H 42 | #define CITYMODEL_H 43 | 44 | #include 45 | #include 46 | #include 47 | #include 48 | 49 | #include "daymodel.h" 50 | 51 | QT_BEGIN_NAMESPACE 52 | class QNetworkAccessManager; 53 | class QNetworkReply; 54 | QT_END_NAMESPACE 55 | 56 | class CityModel : public QObject 57 | { 58 | Q_OBJECT 59 | Q_ENUMS(Status) 60 | Q_PROPERTY(QString copyright READ copyright WRITE setCopyright NOTIFY copyrightChanged) 61 | Q_PROPERTY(QString cityNameDisplay READ cityNameDisplay NOTIFY cityNameDisplayChanged) 62 | Q_PROPERTY(QString countryName READ countryName NOTIFY countryNameChanged) 63 | Q_PROPERTY(QString sourceXml READ sourceXml NOTIFY sourceXmlChanged) 64 | Q_PROPERTY(QString contentXml READ contentXml NOTIFY contentXmlChanged) 65 | 66 | public: 67 | enum { 68 | CityNameDisplayRole = Qt::UserRole + 1 69 | }; 70 | 71 | CityModel(QObject *parent = 0); 72 | 73 | void setError(const QString msg); 74 | 75 | QString copyright() const { return m_copyright;} 76 | void setCopyright(const QString copyright); 77 | 78 | QString cityNameDisplay() const; 79 | void setCityNameDisplay(QString name); 80 | 81 | QString countryName() const; 82 | void setCountryName(const QString name); 83 | 84 | QString sourceXml() const { return m_sourceXml; } 85 | bool setSourceXml(const QString xml); 86 | 87 | QString contentXml() const { return m_contentXml; } 88 | 89 | QVariant data(const QModelIndex &index, int role) const; 90 | QHash roleNames() const; 91 | 92 | Q_INVOKABLE int daysCount() const { return m_citydata.count(); } 93 | Q_INVOKABLE void loadData(); 94 | Q_INVOKABLE void clear(); 95 | Q_INVOKABLE void addDayModel(DayModel *newDayModel); 96 | Q_INVOKABLE DayModel* getDayModel(QString dayName); 97 | Q_INVOKABLE DayModel* getDayModel(int indexDay); 98 | 99 | void cleanAll(); 100 | 101 | void downloadImage(const QString imageUrl); 102 | 103 | private: 104 | void refreshData(); 105 | bool dataExpired(qint64 timeStamp); 106 | QString getImageFileName(const QString url); 107 | 108 | private Q_SLOTS: 109 | void replyFinished(QNetworkReply*); 110 | void readXml(); 111 | void addImages(const QStringList images); 112 | 113 | Q_SIGNALS: 114 | void copyrightChanged(); 115 | void countryNameChanged(); 116 | void error(const QString errorMessage); 117 | void sourceXmlChanged(); 118 | void contentXmlChanged(); 119 | void cityNameDisplayChanged(); 120 | void fileNameChanged(); 121 | void ready(); 122 | 123 | private: 124 | QString m_copyright; 125 | QString m_countryName, m_contentXml; 126 | qreal m_timeStamp; 127 | QList m_citydata; 128 | QNetworkAccessManager *manager; 129 | QString m_filename; 130 | QString m_url; 131 | QString m_sourceXml; 132 | QString m_cityNameDisplay; 133 | }; 134 | 135 | QML_DECLARE_TYPE(CityModel) 136 | 137 | #endif // CITYMODEL_H 138 | -------------------------------------------------------------------------------- /src/daymodel.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). 4 | ** Contact: http://www.qt-project.org/legal 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names 21 | ** of its contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | 47 | #include "daymodel.h" 48 | #include "applicationpaths.h" 49 | #include 50 | 51 | DayModel::DayModel() 52 | : QObject(), m_afternoonindex(0) { 53 | } 54 | 55 | QVariant DayModel::data(const QModelIndex &index, int role) const 56 | { 57 | if (role == FromRole) 58 | return m_data.at(index.row()).from; 59 | if (role == WeatherUrlRole) 60 | return m_data.at(index.row()).weatherUrl; 61 | if (role == ToRole) 62 | return m_data.at(index.row()).to; 63 | if (role == TemperatureRole) 64 | return m_data.at(index.row()).temperature; 65 | if (role == WindSpeedRole) 66 | return m_data.at(index.row()).windSpeed; 67 | if (role == WindUrlRole) 68 | return m_data.at(index.row()).windUrl; 69 | if (role == WindDirectionNameRole) 70 | return m_data.at(index.row()).windDirectionName; 71 | if (role == RainRole) 72 | return m_data.at(index.row()).rain; 73 | return QVariant(); 74 | } 75 | 76 | QHash DayModel::roleNames() const 77 | { 78 | QHash rn; 79 | rn[FromRole] = "from"; 80 | rn[WeatherUrlRole] = "weatherUrl"; 81 | rn[ToRole] = "to"; 82 | rn[TemperatureRole] = "temperature"; 83 | rn[WindSpeedRole] = "windSpeed"; 84 | rn[WindUrlRole] = "windUrl"; 85 | rn[WindDirectionNameRole] = "windDirectionName"; 86 | rn[RainRole] = "rain"; 87 | return rn; 88 | } 89 | 90 | void DayModel::clear() 91 | { 92 | m_date = QString(); 93 | m_afternoonindex = 0; 94 | m_data.clear(); 95 | } 96 | 97 | void DayModel::addRow(const QString &weatherUrl, const QString &from, const QString &to, const QString &temperature, const QString &windSpeed, const QString &windDirectionName, const QString &windUrl, const QString &rain) { 98 | QStringList m_images; 99 | DayModelStructure temp; 100 | temp.from = from; 101 | temp.weatherUrl = weatherUrl; 102 | m_images.append(weatherUrl); 103 | QString largeWeatherIconUrl = weatherUrl; 104 | m_images.append(largeWeatherIconUrl.replace("b100", "b200")); 105 | temp.to = to; 106 | temp.temperature = temperature; 107 | temp.windSpeed = windSpeed; 108 | temp.windUrl = windUrl; 109 | temp.windDirectionName = windDirectionName; 110 | m_images.append(windUrl); 111 | temp.rain = rain; 112 | m_data.append(temp); 113 | emit addedImages(m_images); 114 | } 115 | 116 | QUrl DayModel::getCachedImageFile(const QString &url) 117 | { 118 | bool isLargeImage = url.contains("b200"); 119 | QString baseFilename = url.right(url.length() - url.lastIndexOf("/") - 1); 120 | QString filename = baseFilename; 121 | if (isLargeImage) 122 | filename.prepend("large_"); 123 | filename = QString("%1%2").arg(ApplicationPaths::dowloadedFilesPath()).arg(filename); 124 | baseFilename = QString("%1%2").arg(ApplicationPaths::dowloadedFilesPath()).arg(baseFilename);; 125 | QFile file(filename); 126 | if (file.exists()) { 127 | return QUrl(QString("image://weatherImages/%1").arg(filename)); 128 | } else { 129 | QFile standardSize(baseFilename); 130 | // Some large icons are not available anymore on yr.no 131 | if (isLargeImage && standardSize.exists()) 132 | return QUrl(QString("image://weatherImages/%1").arg(baseFilename)); 133 | else 134 | return QUrl(url); 135 | } 136 | } 137 | 138 | QString DayModel::getDayDetails(int index, const QString &prop) const 139 | { 140 | if (index == -1) 141 | index = 0; 142 | if (index < m_data.count()) { 143 | DayModelStructure temp = m_data.at(index); 144 | if (prop == "from") 145 | return temp.from; 146 | if (prop == "weatherUrl") 147 | return temp.weatherUrl; 148 | if (prop == "to") 149 | return temp.to; 150 | if (prop == "temperature") 151 | return temp.temperature; 152 | if (prop == "windSpeed") 153 | return temp.windSpeed; 154 | if (prop == "windDirectionName") 155 | return temp.windDirectionName; 156 | if (prop == "windUrl") 157 | return temp.windUrl; 158 | if (prop == "rain") 159 | return temp.rain; 160 | } 161 | return QString(); 162 | } 163 | -------------------------------------------------------------------------------- /src/daymodel.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). 4 | ** Contact: http://www.qt-project.org/legal 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names 21 | ** of its contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | #ifndef DAYMODEL_H 42 | #define DAYMODEL_H 43 | 44 | #include 45 | 46 | #include 47 | #include 48 | #include 49 | 50 | QT_BEGIN_NAMESPACE 51 | class QNetworkAccessManager; 52 | class QNetworkReply; 53 | QT_END_NAMESPACE 54 | 55 | class DayModel : public QObject 56 | { 57 | Q_OBJECT 58 | Q_PROPERTY(QString date READ getDate WRITE setDate NOTIFY dateChanged) 59 | Q_PROPERTY(int afternoonIndex READ getAfternoonIndex WRITE setAfternoonIndex NOTIFY afternoonIndexChanged) 60 | 61 | public: 62 | 63 | struct DayModelStructure { 64 | QString from; 65 | QString weatherUrl; 66 | QString to; 67 | QString temperature; 68 | QString windSpeed; 69 | QString windDirectionName; 70 | QString windUrl; 71 | QString rain; 72 | }; 73 | 74 | enum { 75 | WeatherUrlRole = Qt::UserRole + 1, 76 | FromRole = Qt::UserRole + 2, 77 | ToRole = Qt::UserRole + 3, 78 | TemperatureRole = Qt::UserRole + 4, 79 | WindSpeedRole = Qt::UserRole + 5, 80 | WindDirectionNameRole = Qt::UserRole + 6, 81 | WindUrlRole = Qt::UserRole + 7, 82 | RainRole = Qt::UserRole + 8 83 | }; 84 | 85 | DayModel(); 86 | 87 | QString getDate() const { return m_date;} 88 | void setDate(const QString &date) { m_date = date; } 89 | 90 | int getAfternoonIndex() const { return m_afternoonindex;} 91 | void setAfternoonIndex(int index) { m_afternoonindex = index; } 92 | 93 | void clear(); 94 | 95 | QVariant data(const QModelIndex &index, int role) const; 96 | QHash roleNames() const; 97 | 98 | Q_INVOKABLE void addRow(const QString &weatherUrl, const QString &from, const QString &to, const QString &temperature, const QString &windSpeed, const QString &windDirectionName, const QString &windUrl, const QString &rain); 99 | Q_INVOKABLE QString getDayDetails(int index, const QString &prop) const; 100 | Q_INVOKABLE int periodCount() const { return m_data.count(); } 101 | 102 | Q_INVOKABLE QUrl getCachedImageFile(const QString &url); 103 | 104 | Q_SIGNALS: 105 | void dateChanged(); 106 | void afternoonIndexChanged(); 107 | void addedImages(const QStringList &images); 108 | 109 | private: 110 | QString m_date; 111 | int m_afternoonindex; 112 | QList m_data; 113 | }; 114 | 115 | QML_DECLARE_TYPE(DayModel) 116 | 117 | #endif // DAYMODEL_H 118 | -------------------------------------------------------------------------------- /src/main.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). 4 | ** Contact: http://www.qt-project.org/legal 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names 21 | ** of its contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | 49 | #if defined(Q_OS_WINRT) && !defined(Q_OS_WINPHONE) 50 | # include "winrtcharms.h" 51 | # include 52 | #endif // Q_OS_WINRT && !Q_OS_WINPHONE 53 | 54 | #include "daymodel.h" 55 | #include "citymodel.h" 56 | #include "cities.h" 57 | #include "applicationinfo.h" 58 | #include "weatherimageprovider.h" 59 | 60 | static const struct { 61 | const char *type; 62 | int major, minor; 63 | } qmldir_touch [] = { 64 | { "TouchSlider", 1, 0 }, 65 | { "TouchScrollView", 1, 0 }, 66 | { "TouchLabel", 1, 0 }, 67 | { "TouchTextField", 1, 0 }, 68 | { "ListViewDelegate", 1, 0 }, 69 | { "ListViewDelegateLoading", 1, 0 }, 70 | }; 71 | 72 | static const struct { 73 | const char *type; 74 | int major, minor; 75 | } qmldir_models [] = { 76 | { "WeatherModel", 1, 0 }, 77 | }; 78 | 79 | static const struct { 80 | const char *type; 81 | int major, minor; 82 | } qmldir_pages [] = { 83 | { "CitiesPage", 1, 0 }, 84 | { "LongTermPage", 1, 0 }, 85 | { "OneDayPage", 1, 0 }, 86 | }; 87 | 88 | static QObject *systeminfo_provider(QQmlEngine *engine, QJSEngine *scriptEngine) 89 | { 90 | Q_UNUSED(engine) 91 | Q_UNUSED(scriptEngine) 92 | WeatherImageProvider *provider = new WeatherImageProvider(); 93 | engine->addImageProvider(QLatin1String("weatherImages"), provider); 94 | return new ApplicationInfo(provider); 95 | } 96 | 97 | int main(int argc, char *argv[]) 98 | { 99 | QGuiApplication app(argc, argv); 100 | app.setOrganizationName("Digia"); 101 | app.setApplicationName("QuickForecast"); 102 | 103 | QTranslator qtTranslator; 104 | qtTranslator.load("QuickForecast_" + QLocale::system().name(), ":/translations/"); 105 | app.installTranslator(&qtTranslator); 106 | 107 | #if defined(Q_OS_WINRT) && !defined(Q_OS_WINPHONE) 108 | // WinRT requires that we install a privacy policy link to the Charms bar when the network is 109 | // used, so create a Charms menu item and connect a slot to handle it 110 | WinRTSettingsCharm settingsCharm; 111 | settingsCharm.addItem(QGuiApplication::tr("Privacy Policy")); 112 | QObject::connect(&settingsCharm, &WinRTSettingsCharm::itemClicked, [](const QString &) { 113 | QDesktopServices::openUrl(QUrl("http://qt.digia.com/Digia-Legal-Notice--Privacy-Policy/")); 114 | }); 115 | #endif // Q_OS_WINRT && !Q_OS_WINPHONE 116 | 117 | #ifndef Q_OS_IOS //QTBUG-34490 118 | QFontDatabase::addApplicationFont(":/weatherapp/fonts/OpenSans-Bold.ttf"); 119 | QFontDatabase::addApplicationFont(":/weatherapp/fonts/OpenSans-Semibold.ttf"); 120 | int openSansID = QFontDatabase::addApplicationFont(":/weatherapp/fonts/OpenSans-Regular.ttf"); 121 | QStringList loadedFontFamilies = QFontDatabase::applicationFontFamilies(openSansID); 122 | if (!loadedFontFamilies.empty()) { 123 | QString fontName = loadedFontFamilies.at(0); 124 | QGuiApplication::setFont(QFont(fontName)); 125 | } else { 126 | qWarning("Error: fail to load Open Sans font"); 127 | } 128 | #endif 129 | 130 | const char *uri = "org.qtproject.demo.weather"; 131 | // @uri org.qtproject.demo.weather 132 | qmlRegisterType(uri, 1, 0, "DayModel"); 133 | qmlRegisterType(uri, 1, 0, "CityModel"); 134 | qmlRegisterType(uri, 1, 0, "Cities"); 135 | qmlRegisterType(uri, 1, 0, "CitiesListModel"); 136 | qmlRegisterSingletonType(uri, 1, 0, "ApplicationInfo", systeminfo_provider); 137 | 138 | for (int i = 0; i < int(sizeof(qmldir_touch)/sizeof(qmldir_touch[0])); i++) 139 | qmlRegisterType(QUrl(QString("qrc:/weatherapp/qml/touch/%1.qml").arg(qmldir_touch[i].type)), uri, qmldir_touch[i].major, qmldir_touch[i].minor, qmldir_touch[i].type); 140 | 141 | for (int i = 0; i < int(sizeof(qmldir_models)/sizeof(qmldir_models[0])); i++) 142 | qmlRegisterType(QUrl(QString("qrc:/weatherapp/qml/models/%1.qml").arg(qmldir_models[i].type)), uri, qmldir_models[i].major, qmldir_models[i].minor, qmldir_models[i].type); 143 | 144 | for (int i = 0; i < int(sizeof(qmldir_pages)/sizeof(qmldir_pages[0])); i++) 145 | qmlRegisterType(QUrl(QString("qrc:/weatherapp/qml/pages/%1.qml").arg(qmldir_pages[i].type)), uri, qmldir_pages[i].major, qmldir_pages[i].minor, qmldir_pages[i].type); 146 | 147 | QQmlApplicationEngine engine(QUrl("qrc:/weatherapp/qml/main.qml")); 148 | QObject *topLevel = engine.rootObjects().value(0); 149 | 150 | QQuickWindow *window = qobject_cast(topLevel); 151 | if ( !window ) { 152 | qWarning("Error: Your root item has to be a Window."); 153 | return -1; 154 | } 155 | window->show(); 156 | return app.exec(); 157 | } 158 | -------------------------------------------------------------------------------- /src/src.pri: -------------------------------------------------------------------------------- 1 | SOURCES += \ 2 | $$PWD/main.cpp \ 3 | $$PWD/citymodel.cpp \ 4 | $$PWD/daymodel.cpp \ 5 | $$PWD/cities.cpp \ 6 | $$PWD/applicationinfo.cpp \ 7 | $$PWD/citieslistmodel.cpp 8 | 9 | HEADERS += \ 10 | $$PWD/citymodel.h \ 11 | $$PWD/daymodel.h \ 12 | $$PWD/cities.h \ 13 | $$PWD/applicationinfo.h \ 14 | $$PWD/citieslistmodel.h \ 15 | $$PWD/weatherimageprovider.h \ 16 | $$PWD/applicationpaths.h 17 | 18 | winrt:!winphone { 19 | SOURCES += $$PWD/winrtcharms.cpp 20 | HEADERS += $$PWD/winrtcharms.h 21 | } 22 | -------------------------------------------------------------------------------- /src/weatherimageprovider.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). 4 | ** Contact: http://www.qt-project.org/legal 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names 21 | ** of its contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | #ifndef WEATHERIMAGEPROVIDER_H 42 | #define WEATHERIMAGEPROVIDER_H 43 | 44 | #include 45 | #include 46 | #include 47 | 48 | class WeatherImageProvider : public QQuickImageProvider 49 | { 50 | public: 51 | WeatherImageProvider() 52 | : QQuickImageProvider(QQuickImageProvider::Image) 53 | { 54 | } 55 | 56 | QImage requestImage(const QString &id, QSize *size, const QSize &requestedSize) 57 | { 58 | int width = 50; 59 | int height = 50; 60 | 61 | if (size) 62 | *size = QSize(width, height); 63 | QImage image(requestedSize.width() > 0 ? requestedSize.width() : width, 64 | requestedSize.height() > 0 ? requestedSize.height() : height, 65 | QImage::Format_ARGB32); 66 | image.load(QUrl("file:/" + id).toLocalFile()); 67 | return image; 68 | } 69 | }; 70 | 71 | #endif // WEATHERIMAGEPROVIDER_H 72 | -------------------------------------------------------------------------------- /src/winrtcharms.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). 4 | ** Contact: http://www.qt-project.org/legal 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names 21 | ** of its contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | #include "winrtcharms.h" 42 | 43 | #include 44 | 45 | #include 46 | #include 47 | #include 48 | #include 49 | #include 50 | #include 51 | 52 | using namespace Microsoft::WRL; 53 | using namespace Microsoft::WRL::Wrappers; 54 | using namespace ABI::Windows::Foundation; 55 | using namespace ABI::Windows::Foundation::Collections; 56 | using namespace ABI::Windows::UI::ApplicationSettings; 57 | using namespace ABI::Windows::UI::Popups; 58 | 59 | class WinRTSettingsCharmPrivate 60 | { 61 | public: 62 | WinRTSettingsCharmPrivate(WinRTSettingsCharm *q) 63 | : q_ptr(q) 64 | { 65 | } 66 | 67 | ComPtr settingsPane; 68 | EventRegistrationToken cookie; 69 | QStringList items; 70 | 71 | HRESULT settingsRequested(ISettingsPane *, ISettingsPaneCommandsRequestedEventArgs *args) 72 | { 73 | ComPtr request; 74 | HRESULT hr = args->get_Request(&request); 75 | if (FAILED(hr)) { 76 | qErrnoWarning(hr, "Failed to get settings command request."); 77 | return S_OK; 78 | } 79 | 80 | ComPtr factory; 81 | hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_UI_Popups_UICommand).Get(), 82 | IID_PPV_ARGS(&factory)); 83 | if (FAILED(hr)) { 84 | qErrnoWarning(hr, "Failed to get command factory."); 85 | return S_OK; 86 | } 87 | 88 | ComPtr> commands; 89 | hr = request->get_ApplicationCommands(&commands); 90 | if (FAILED(hr)) { 91 | qErrnoWarning(hr, "Failed to get command list."); 92 | return S_OK; 93 | } 94 | 95 | foreach (const QString &item, items) { 96 | ComPtr command; 97 | HStringReference label(reinterpret_cast(item.utf16()), item.length()); 98 | hr = factory->Create(label.Get(), &command); 99 | if (FAILED(hr)) { 100 | qErrnoWarning(hr, "Failed to create UI command."); 101 | return S_OK; 102 | } 103 | 104 | hr = command->put_Invoked(Callback( 105 | this, &WinRTSettingsCharmPrivate::commandInvoked).Get()); 106 | if (FAILED(hr)) { 107 | qErrnoWarning(hr, "Failed to set command invoked handler."); 108 | return S_OK; 109 | } 110 | 111 | hr = commands->Append(command.Get()); 112 | if (FAILED(hr)) { 113 | qErrnoWarning(hr, "Failed to append privacy policy command."); 114 | return S_OK; 115 | } 116 | } 117 | 118 | return S_OK; 119 | } 120 | 121 | HRESULT commandInvoked(IUICommand *command) 122 | { 123 | Q_Q(WinRTSettingsCharm); 124 | 125 | HString label; 126 | HRESULT hr = command->get_Label(label.GetAddressOf()); 127 | if (FAILED(hr)) { 128 | qErrnoWarning(hr, "Failed to get invoked command label."); 129 | return S_OK; 130 | } 131 | 132 | emit q->itemClicked(QString::fromWCharArray(label.GetRawBuffer(Q_NULLPTR))); 133 | 134 | return S_OK; 135 | } 136 | 137 | private: 138 | WinRTSettingsCharm *q_ptr; 139 | Q_DECLARE_PUBLIC(WinRTSettingsCharm) 140 | }; 141 | 142 | WinRTSettingsCharm::WinRTSettingsCharm() 143 | : d_ptr(new WinRTSettingsCharmPrivate(this)) 144 | { 145 | Q_D(WinRTSettingsCharm); 146 | 147 | ComPtr factory; 148 | HRESULT hr = RoGetActivationFactory(Wrappers::HString::MakeReference(RuntimeClass_Windows_UI_ApplicationSettings_SettingsPane).Get(), 149 | IID_PPV_ARGS(&factory)); 150 | if (FAILED(hr)) { 151 | qErrnoWarning(hr, "Failed to get settings pane factory."); 152 | return; 153 | } 154 | 155 | hr = factory->GetForCurrentView(&d->settingsPane); 156 | if (FAILED(hr)) { 157 | qErrnoWarning(hr, "Failed to get settings pane from factory."); 158 | return; 159 | } 160 | 161 | hr = d->settingsPane->add_CommandsRequested(Callback>( 162 | d, &WinRTSettingsCharmPrivate::settingsRequested).Get(), &d->cookie); 163 | if (FAILED(hr)) { 164 | qErrnoWarning(hr, "Failed to add commands requested callback."); 165 | return; 166 | } 167 | } 168 | 169 | WinRTSettingsCharm::~WinRTSettingsCharm() 170 | { 171 | Q_D(WinRTSettingsCharm); 172 | 173 | if (!d->settingsPane) 174 | return; 175 | 176 | HRESULT hr = d->settingsPane->remove_CommandsRequested(d->cookie); 177 | if (FAILED(hr)) { 178 | qErrnoWarning(hr, "Failed to remove settings pane callback."); 179 | return; 180 | } 181 | } 182 | 183 | QStringList WinRTSettingsCharm::items() const 184 | { 185 | Q_D(const WinRTSettingsCharm); 186 | return d->items; 187 | } 188 | 189 | void WinRTSettingsCharm::addItem(const QString &label) 190 | { 191 | Q_D(WinRTSettingsCharm); 192 | d->items.append(label); 193 | } 194 | 195 | void WinRTSettingsCharm::removeItem(const QString &label) 196 | { 197 | Q_D(WinRTSettingsCharm); 198 | d->items.removeOne(label); 199 | } 200 | -------------------------------------------------------------------------------- /src/winrtcharms.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). 4 | ** Contact: http://www.qt-project.org/legal 5 | ** 6 | ** This file is part of the examples of the Qt Toolkit. 7 | ** 8 | ** $QT_BEGIN_LICENSE:BSD$ 9 | ** You may use this file under the terms of the BSD license as follows: 10 | ** 11 | ** "Redistribution and use in source and binary forms, with or without 12 | ** modification, are permitted provided that the following conditions are 13 | ** met: 14 | ** * Redistributions of source code must retain the above copyright 15 | ** notice, this list of conditions and the following disclaimer. 16 | ** * Redistributions in binary form must reproduce the above copyright 17 | ** notice, this list of conditions and the following disclaimer in 18 | ** the documentation and/or other materials provided with the 19 | ** distribution. 20 | ** * Neither the name of Digia Plc and its Subsidiary(-ies) nor the names 21 | ** of its contributors may be used to endorse or promote products derived 22 | ** from this software without specific prior written permission. 23 | ** 24 | ** 25 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 26 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 27 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 28 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 29 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 30 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 31 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 32 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 33 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 34 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 36 | ** 37 | ** $QT_END_LICENSE$ 38 | ** 39 | ****************************************************************************/ 40 | 41 | #ifndef WINRTCHARMS_H 42 | #define WINRTCHARMS_H 43 | 44 | #include 45 | 46 | class WinRTSettingsCharmPrivate; 47 | class WinRTSettingsCharm : public QObject 48 | { 49 | Q_OBJECT 50 | public: 51 | WinRTSettingsCharm(); 52 | ~WinRTSettingsCharm(); 53 | 54 | QStringList items() const; 55 | void addItem(const QString &label); 56 | void removeItem(const QString &label); 57 | 58 | signals: 59 | void itemClicked(const QString &label); 60 | 61 | private: 62 | QScopedPointer d_ptr; 63 | Q_DECLARE_PRIVATE(WinRTSettingsCharm) 64 | }; 65 | 66 | #endif // WINRTCHARMS_H 67 | -------------------------------------------------------------------------------- /translations/QuickForecast_bn.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ApplicationInfo 6 | 7 | Error loading image - Host not found or unreachable 8 | ইমেজ লোডিং এ ত্রুটি - হোস্ট পাওয়া যাচ্ছে না 9 | 10 | 11 | Waiting for cities, network may be slow... 12 | শহরের অনুসন্ধান চোলছে, নেটওয়ার্ক ধীর হতে পারে ... 13 | 14 | 15 | Network error: %1 16 | নেটওয়ার্ক এ ত্রুটি: %1 17 | 18 | 19 | 20 | BasicPage 21 | 22 | Find City 23 | শহর খুঁজুন 24 | 25 | 26 | 27 | CitiesListModel 28 | 29 | no city found 30 | শহর পাওয়া যাইনি 31 | 32 | 33 | 34 | CitiesPage 35 | 36 | Cities 37 | শহরগুলি 38 | 39 | 40 | No Cities 41 | কোনো শহর নেই 42 | 43 | 44 | 45 | CityModel 46 | 47 | Network error: 48 | নেটওয়ার্ক ত্রুটি: 49 | 50 | 51 | No data at given url 52 | প্রদত্ত URL এ কোন তথ্য নেই 53 | 54 | 55 | 56 | LongTermDayItem 57 | 58 | m/s 59 | মি / সেকেন্ড 60 | 61 | 62 | 63 | LongTermPage 64 | 65 | 10 Day Forecast 66 | ১০ দিনের পূর্বাভাস 67 | 68 | 69 | Loading data... 70 | তথ্য লোড হচ্ছে... 71 | 72 | 73 | Problem loading the data: 74 | তথ্য লোডিং এ সমস্যা: 75 | 76 | 77 | 78 | OneDayPage 79 | 80 | Today 81 | আজ 82 | 83 | 84 | Tomorrow 85 | আগামীকাল 86 | 87 | 88 | 89 | OneDayZoomItem 90 | 91 | Precipitation: 92 | বৃষ্টিপাত: 93 | 94 | 95 | mm 96 | মিমি 97 | 98 | 99 | Wind: 100 | বায়ু: 101 | 102 | 103 | m/s 104 | মি / সেকেন্ড 105 | 106 | 107 | 108 | WeatherModel 109 | 110 | Can't parse the xml file 111 | XML ফাইল বিশ্লেষণ করতে পারা যাছে না 112 | 113 | 114 | 115 | utils 116 | 117 | °C 118 | ° সেঃ 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /translations/QuickForecast_da.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ApplicationInfo 6 | 7 | Error loading image - Host not found or unreachable 8 | Fejl under indlæsning af billede - Addressen er ikke fundet eller er utilgængelig 9 | 10 | 11 | Waiting for cities, network may be slow... 12 | Venter på byer, netværket kan være langsomt... 13 | 14 | 15 | Network error: %1 16 | Netværks fejl: %1 17 | 18 | 19 | 20 | BasicPage 21 | 22 | Find City 23 | Find by 24 | 25 | 26 | 27 | CitiesListModel 28 | 29 | no city found 30 | Ingen by fundet 31 | 32 | 33 | 34 | CitiesPage 35 | 36 | Cities 37 | Byer 38 | 39 | 40 | No Cities 41 | Ingen byer 42 | 43 | 44 | 45 | CityModel 46 | 47 | Network error: 48 | Netværks fejl: 49 | 50 | 51 | No data at given url 52 | Ingen data ved angivne URL 53 | 54 | 55 | 56 | LongTermDayItem 57 | 58 | m/s 59 | m/s 60 | 61 | 62 | 63 | LongTermPage 64 | 65 | 10 Day Forecast 66 | 10 dags prognose 67 | 68 | 69 | Loading data... 70 | Indlæser data... 71 | 72 | 73 | Problem loading the data: 74 | Fejl under indlæsning af data: 75 | 76 | 77 | 78 | OneDayPage 79 | 80 | Today 81 | I dag 82 | 83 | 84 | Tomorrow 85 | I morgen 86 | 87 | 88 | 89 | OneDayZoomItem 90 | 91 | Precipitation: 92 | Nedbør: 93 | 94 | 95 | mm 96 | mm 97 | 98 | 99 | Wind: 100 | Vindstyrke: 101 | 102 | 103 | m/s 104 | m/s 105 | 106 | 107 | 108 | WeatherModel 109 | 110 | Can't parse the xml file 111 | Kan ikke afkode XML-filen 112 | 113 | 114 | 115 | utils 116 | 117 | °C 118 | °C 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /translations/QuickForecast_de.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ApplicationInfo 6 | 7 | Error loading image - Host not found or unreachable 8 | Fehler beim Laden des Bildes - Server nicht gefunden oder unerreichbar 9 | 10 | 11 | Waiting for cities, network may be slow... 12 | Lade Städte, das Netzwerk ist möglicherweise langsam... 13 | 14 | 15 | Network error: %1 16 | Netzwerkfehler: %1 17 | 18 | 19 | 20 | BasicPage 21 | 22 | Find City 23 | Stadt suchen 24 | 25 | 26 | 27 | CitiesListModel 28 | 29 | no city found 30 | Stadt nicht gefunden 31 | 32 | 33 | 34 | CitiesPage 35 | 36 | Cities 37 | Städte 38 | 39 | 40 | No Cities 41 | Keine Städte 42 | 43 | 44 | 45 | CityModel 46 | 47 | Network error: 48 | Netzwerkfehler: 49 | 50 | 51 | No data at given url 52 | Keine Daten unter der angegebenen URL gefunden 53 | 54 | 55 | 56 | LongTermDayItem 57 | 58 | m/s 59 | m/s 60 | 61 | 62 | 63 | LongTermPage 64 | 65 | 10 Day Forecast 66 | 10 Tage Vorhersage 67 | 68 | 69 | Loading data... 70 | Daten werden geladen... 71 | 72 | 73 | Problem loading the data: 74 | Problem beim Laden: 75 | 76 | 77 | 78 | OneDayPage 79 | 80 | Today 81 | Heute 82 | 83 | 84 | Tomorrow 85 | Morgen 86 | 87 | 88 | 89 | OneDayZoomItem 90 | 91 | °C 92 | °C 93 | 94 | 95 | Precipitation: 96 | Niederschlag: 97 | 98 | 99 | mm 100 | mm 101 | 102 | 103 | Wind: 104 | Wind: 105 | 106 | 107 | m/s 108 | m/s 109 | 110 | 111 | Temperature for this part of the day 112 | Temperatur für diesen Teil des Tages 113 | 114 | 115 | 116 | WeatherModel 117 | 118 | Can't parse the xml file 119 | Die XML-Datei konnte nicht eingelesen werden 120 | 121 | 122 | 123 | main 124 | 125 | Quick Forecast 126 | Quick Forecast 127 | 128 | 129 | 130 | utils 131 | 132 | °C 133 | °C 134 | 135 | 136 | meters per second 137 | Meter pro Sekunde 138 | 139 | 140 | miles per hour 141 | Meilen pro Stunde 142 | 143 | 144 | millimeters 145 | Millimeter 146 | 147 | 148 | inches 149 | Inch 150 | 151 | 152 | 153 | -------------------------------------------------------------------------------- /translations/QuickForecast_es.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ApplicationInfo 6 | 7 | Error loading image - Host not found or unreachable 8 | Error al cargar imagen - Servidor no encontrado o no disponible 9 | 10 | 11 | Waiting for cities, network may be slow... 12 | Esperando ciudades, la red puede presentar lentitud... 13 | 14 | 15 | Network error: %1 16 | Error de red: %1 17 | 18 | 19 | 20 | BasicPage 21 | 22 | Find City 23 | Buscar ciudad 24 | 25 | 26 | 27 | CitiesListModel 28 | 29 | no city found 30 | ciudad no encontrada 31 | 32 | 33 | 34 | CitiesPage 35 | 36 | Cities 37 | Ciudades 38 | 39 | 40 | No Cities 41 | Sin ciudades 42 | 43 | 44 | 45 | CityModel 46 | 47 | Network error: 48 | Error de red: 49 | 50 | 51 | No data at given url 52 | No hay datos para la url dada 53 | 54 | 55 | 56 | LongTermDayItem 57 | 58 | m/s 59 | m/s 60 | 61 | 62 | 63 | LongTermPage 64 | 65 | 10 Day Forecast 66 | Pronóstico para 10 días 67 | 68 | 69 | Loading data... 70 | Cargando datos... 71 | 72 | 73 | Problem loading the data: 74 | Problema al cargar datos: 75 | 76 | 77 | 78 | OneDayPage 79 | 80 | Today 81 | Hoy 82 | 83 | 84 | Tomorrow 85 | Mañana 86 | 87 | 88 | 89 | OneDayZoomItem 90 | 91 | Precipitation: 92 | Precipitación: 93 | 94 | 95 | mm 96 | mm 97 | 98 | 99 | Wind: 100 | Viento: 101 | 102 | 103 | m/s 104 | m/s 105 | 106 | 107 | 108 | WeatherModel 109 | 110 | Can't parse the xml file 111 | Imposible analizar archivo xml 112 | 113 | 114 | 115 | utils 116 | 117 | °C 118 | °C 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /translations/QuickForecast_fi.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ApplicationInfo 6 | 7 | Error loading image - Host not found or unreachable 8 | Kuvaa ei voida ladata - palvelinta ei löydetä tai tavoiteta 9 | 10 | 11 | Waiting for cities, network may be slow... 12 | Odotetaan kaupunkien tietoja, verkko saattaa toimia hitaasti... 13 | 14 | 15 | Network error: %1 16 | Verkkovirhe: %1 17 | 18 | 19 | 20 | BasicPage 21 | 22 | Find City 23 | Etsi kaupunkeja 24 | 25 | 26 | 27 | CitiesListModel 28 | 29 | no city found 30 | kaupunkeja ei löydy 31 | 32 | 33 | 34 | CitiesPage 35 | 36 | Cities 37 | Kaupungit 38 | 39 | 40 | No Cities 41 | Ei kaupunkeja 42 | 43 | 44 | 45 | CityModel 46 | 47 | Network error: 48 | Verkkovirhe: 49 | 50 | 51 | No data at given url 52 | Osoitteesta ei löydy tietoja 53 | 54 | 55 | 56 | LongTermDayItem 57 | 58 | m/s 59 | m/s 60 | 61 | 62 | 63 | LongTermPage 64 | 65 | 10 Day Forecast 66 | 10 päivän ennuste 67 | 68 | 69 | Loading data... 70 | Ladataan tietoja... 71 | 72 | 73 | Problem loading the data: 74 | Tietoja ei voida ladata: 75 | 76 | 77 | 78 | OneDayPage 79 | 80 | Today 81 | Tänään 82 | 83 | 84 | Tomorrow 85 | Huomenna 86 | 87 | 88 | 89 | OneDayZoomItem 90 | 91 | °C 92 | °C 93 | 94 | 95 | Precipitation: 96 | Sademäärä: 97 | 98 | 99 | mm 100 | mm 101 | 102 | 103 | Wind: 104 | Tuulen voimakkuus: 105 | 106 | 107 | m/s 108 | m/s 109 | 110 | 111 | 112 | WeatherModel 113 | 114 | Can't parse the xml file 115 | XML-tiedostoa ei voida jäsentää 116 | 117 | 118 | 119 | main 120 | 121 | Quick Forecast 122 | Quick Forecast 123 | 124 | 125 | 126 | utils 127 | 128 | °C 129 | °C 130 | 131 | 132 | 133 | -------------------------------------------------------------------------------- /translations/QuickForecast_fr.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ApplicationInfo 6 | 7 | Error loading image - Host not found or unreachable 8 | Erreur de chargement de l'image - Le serveur ne peut pas être localisé 9 | 10 | 11 | Waiting for cities, network may be slow... 12 | Patientez pendant le chargement des villes, la connection peut être lente... 13 | 14 | 15 | Network error: %1 16 | Erreur réseau : %1 17 | 18 | 19 | 20 | BasicPage 21 | 22 | Find City 23 | Rechercher une ville 24 | 25 | 26 | 27 | CitiesListModel 28 | 29 | no city found 30 | aucune ville n'a été trouvée 31 | 32 | 33 | 34 | CitiesPage 35 | 36 | Cities 37 | Villes 38 | 39 | 40 | No Cities 41 | Aucune ville 42 | 43 | 44 | 45 | CityModel 46 | 47 | Network error: 48 | Erreur réseau : 49 | 50 | 51 | No data at given url 52 | Aucune donnée pour cette url 53 | 54 | 55 | 56 | LongTermDayItem 57 | 58 | m/s 59 | m/s 60 | 61 | 62 | 63 | LongTermPage 64 | 65 | 10 Day Forecast 66 | Prévisions à dix jours 67 | 68 | 69 | Loading data... 70 | Chargement des données... 71 | 72 | 73 | Problem loading the data: 74 | Problème lors du chargement des données : 75 | 76 | 77 | 78 | OneDayPage 79 | 80 | Today 81 | Aujourd'hui 82 | 83 | 84 | Tomorrow 85 | Demain 86 | 87 | 88 | 89 | OneDayZoomItem 90 | 91 | Precipitation: 92 | Précipitations : 93 | 94 | 95 | mm 96 | mm 97 | 98 | 99 | Wind: 100 | Vent : 101 | 102 | 103 | m/s 104 | m/s 105 | 106 | 107 | 108 | WeatherModel 109 | 110 | Can't parse the xml file 111 | Impossible d'analyser le fichier xml 112 | 113 | 114 | 115 | utils 116 | 117 | °C 118 | °C 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /translations/QuickForecast_hi.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ApplicationInfo 6 | 7 | Error loading image - Host not found or unreachable 8 | छवि लोड करने में गलती - होस्ट नहीं पाया गया या संपर्क से बाहर 9 | 10 | 11 | Waiting for cities, network may be slow... 12 | शहर की डेटा के लिए प्रतीक्षा कर रहा है,नेटवर्क धीमा हो सकता है ... 13 | 14 | 15 | Network error: %1 16 | नेटवर्क में गलती : %1 17 | 18 | 19 | 20 | BasicPage 21 | 22 | Find City 23 | शहर पाता लगाऊ 24 | 25 | 26 | 27 | CitiesListModel 28 | 29 | no city found 30 | इस नाम से कोई शहर नहीं मिला 31 | 32 | 33 | 34 | CitiesPage 35 | 36 | Cities 37 | शहरों 38 | 39 | 40 | No Cities 41 | कोई शहर नहीं 42 | 43 | 44 | 45 | CityModel 46 | 47 | Network error: 48 | नेटवर्क में गलती : 49 | 50 | 51 | No data at given url 52 | दिए गए यूआरएल पर कोई डेटा नहीं 53 | 54 | 55 | 56 | LongTermDayItem 57 | 58 | m/s 59 | मीटर प्रति सेकंड 60 | 61 | 62 | 63 | LongTermPage 64 | 65 | 10 Day Forecast 66 | १० दिनों का पूर्वानुमान 67 | 68 | 69 | Loading data... 70 | डेटा लोड हो रहा है... 71 | 72 | 73 | Problem loading the data: 74 | डेटा लोड करने में समस्या / रूकावट: 75 | 76 | 77 | 78 | OneDayPage 79 | 80 | Today 81 | आज 82 | 83 | 84 | Tomorrow 85 | कल 86 | 87 | 88 | 89 | OneDayZoomItem 90 | 91 | Precipitation: 92 | वर्षा: 93 | 94 | 95 | mm 96 | मिमी 97 | 98 | 99 | Wind: 100 | हवा: 101 | 102 | 103 | m/s 104 | मीटर प्रति सेकंड 105 | 106 | 107 | 108 | WeatherModel 109 | 110 | Can't parse the xml file 111 | एक्सएमएल फाइल विश्लेषण में कठिनायी 112 | 113 | 114 | 115 | utils 116 | 117 | °C 118 | °C 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /translations/QuickForecast_hu.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ApplicationInfo 6 | 7 | Error loading image - Host not found or unreachable 8 | Hiba a kép betöltése közben - A kiszolgáló nem érhető el 9 | 10 | 11 | Waiting for cities, network may be slow... 12 | Várakozás, lassú hálózat... 13 | 14 | 15 | Network error: %1 16 | Hálózati hiba: %1 17 | 18 | 19 | 20 | BasicPage 21 | 22 | Find City 23 | Város Keresése 24 | 25 | 26 | 27 | CitiesListModel 28 | 29 | no city found 30 | város nem található 31 | 32 | 33 | 34 | CitiesPage 35 | 36 | Cities 37 | Városok 38 | 39 | 40 | No Cities 41 | Nincsenek városok 42 | 43 | 44 | 45 | CityModel 46 | 47 | Network error: 48 | Hálózati hiba: 49 | 50 | 51 | No data at given url 52 | Nincs adat az adott címen 53 | 54 | 55 | 56 | LongTermDayItem 57 | 58 | m/s 59 | m/s 60 | 61 | 62 | 63 | LongTermPage 64 | 65 | 10 Day Forecast 66 | 10 Napos Előrejelzés 67 | 68 | 69 | Loading data... 70 | Betöltés... 71 | 72 | 73 | Problem loading the data: 74 | Hiba az adatok betöltésénél: 75 | 76 | 77 | 78 | OneDayPage 79 | 80 | Today 81 | Ma 82 | 83 | 84 | Tomorrow 85 | Holnap 86 | 87 | 88 | 89 | OneDayZoomItem 90 | 91 | Precipitation: 92 | Csapadék: 93 | 94 | 95 | mm 96 | mm 97 | 98 | 99 | Wind: 100 | Szél: 101 | 102 | 103 | m/s 104 | m/s 105 | 106 | 107 | 108 | WeatherModel 109 | 110 | Can't parse the xml file 111 | Érvénytelen xml file 112 | 113 | 114 | 115 | utils 116 | 117 | °C 118 | °C 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /translations/QuickForecast_it.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ApplicationInfo 6 | 7 | Error loading image - Host not found or unreachable 8 | Errore di caricamento immagine - Server irrangiungibile 9 | 10 | 11 | Waiting for cities, network may be slow... 12 | In attesa delle cittá, la connessione potrebbe essere lenta... 13 | 14 | 15 | Network error: %1 16 | Errore di connessione: %1 17 | 18 | 19 | 20 | BasicPage 21 | 22 | Find City 23 | Cerca città 24 | 25 | 26 | 27 | CitiesListModel 28 | 29 | no city found 30 | nessuna città trovata 31 | 32 | 33 | 34 | CitiesPage 35 | 36 | Cities 37 | Città 38 | 39 | 40 | No Cities 41 | Nessuna Città 42 | 43 | 44 | 45 | CityModel 46 | 47 | Network error: 48 | Errore di connessione: 49 | 50 | 51 | No data at given url 52 | Dati non trovati al link fornito 53 | 54 | 55 | 56 | LongTermDayItem 57 | 58 | m/s 59 | m/s 60 | 61 | 62 | 63 | LongTermPage 64 | 65 | 10 Day Forecast 66 | Previsioni per 10 giorni 67 | 68 | 69 | Loading data... 70 | Caricamento dati... 71 | 72 | 73 | Problem loading the data: 74 | Problema caricando i dati: 75 | 76 | 77 | 78 | OneDayPage 79 | 80 | Today 81 | Oggi 82 | 83 | 84 | Tomorrow 85 | Domani 86 | 87 | 88 | 89 | OneDayZoomItem 90 | 91 | Precipitation: 92 | Precipitazioni: 93 | 94 | 95 | mm 96 | mm 97 | 98 | 99 | Wind: 100 | Vento: 101 | 102 | 103 | m/s 104 | m/s 105 | 106 | 107 | 108 | WeatherModel 109 | 110 | Can't parse the xml file 111 | Parsing del file xml fallito 112 | 113 | 114 | 115 | utils 116 | 117 | °C 118 | °C 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /translations/QuickForecast_nb.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ApplicationInfo 6 | 7 | Error loading image - Host not found or unreachable 8 | Feil ved opplasting av bildet - Server ikke funnet eller kan ikke nås 9 | 10 | 11 | Waiting for cities, network may be slow... 12 | Henter byer, nettverk sannsynligvis tregt... 13 | 14 | 15 | Network error: %1 16 | Nettverksfeil: %1 17 | 18 | 19 | 20 | BasicPage 21 | 22 | Back 23 | Tilbake 24 | 25 | 26 | Find City 27 | Søk by 28 | 29 | 30 | 31 | CitiesListModel 32 | 33 | no city found 34 | Fant ingen byer 35 | 36 | 37 | 38 | CitiesPage 39 | 40 | Cities 41 | Byer 42 | 43 | 44 | No Cities 45 | Ingen byer 46 | 47 | 48 | 49 | CityModel 50 | 51 | Network error: 52 | Nettverksfeil: 53 | 54 | 55 | No data at given url 56 | Ingen data på den spesifiserte URL-en 57 | 58 | 59 | 60 | ListViewDelegate 61 | 62 | Remove %1 63 | Fjern %1 64 | 65 | 66 | 67 | LongTermDayItem 68 | 69 | %1 %2 - temperature low: %3, high: %4, wind: %5 %6 70 | %1 %2 - minimumstemperatur: %3, maksimumstemperatur: %4, vind: %5 %6 71 | 72 | 73 | press for details 74 | trykk for detaljer 75 | 76 | 77 | m/s 78 | The wind speed unit, meters per second or miles per hour 79 | m/s 80 | 81 | 82 | 83 | LongTermPage 84 | 85 | 10 Day Forecast 86 | 10 dagers varsel 87 | 88 | 89 | Loading data... 90 | Henter data... 91 | 92 | 93 | Problem loading the data: 94 | Problem ved opplasting av data: 95 | 96 | 97 | 98 | OneDayPage 99 | 100 | Today 101 | I dag 102 | 103 | 104 | Tomorrow 105 | I morgen 106 | 107 | 108 | 109 | OneDayZoomItem 110 | 111 | °C 112 | °C 113 | 114 | 115 | Precipitation: 116 | Nedbør: 117 | 118 | 119 | mm 120 | The rain level unit, millimeters or inches 121 | mm 122 | 123 | 124 | Wind: 125 | Vind: 126 | 127 | 128 | m/s 129 | The wind speed unit, meters per second or miles per hour 130 | m/s 131 | 132 | 133 | 134 | QGuiApplication 135 | 136 | Privacy Policy 137 | Retningslinjer for personvern 138 | 139 | 140 | 141 | WeatherModel 142 | 143 | Can't parse the xml file 144 | XML-filen kan ikke leses 145 | 146 | 147 | 148 | main 149 | 150 | Quick Forecast 151 | Quick Forecast 152 | 153 | 154 | 155 | utils 156 | 157 | °C 158 | °C 159 | 160 | 161 | 162 | -------------------------------------------------------------------------------- /translations/QuickForecast_nl.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ApplicationInfo 6 | 7 | Error loading image - Host not found or unreachable 8 | Fout bij laden afbeelding - Server niet gevonden of onbereikbaar 9 | 10 | 11 | Waiting for cities, network may be slow... 12 | Laden steden, netwerk waarschijnlijk traag... 13 | 14 | 15 | Network error: %1 16 | Netwerkfout: %1 17 | 18 | 19 | 20 | BasicPage 21 | 22 | Find City 23 | Zoek stad 24 | 25 | 26 | 27 | CitiesListModel 28 | 29 | no city found 30 | Stad niet gevonden 31 | 32 | 33 | 34 | CitiesPage 35 | 36 | Cities 37 | Steden 38 | 39 | 40 | No Cities 41 | Geen steden 42 | 43 | 44 | 45 | CityModel 46 | 47 | Network error: 48 | Netwerkfout: 49 | 50 | 51 | No data at given url 52 | Geen data op de aangegeven URL 53 | 54 | 55 | 56 | LongTermDayItem 57 | 58 | m/s 59 | m/s 60 | 61 | 62 | 63 | LongTermPage 64 | 65 | 10 Day Forecast 66 | Verwachtingen komende 10 dagen 67 | 68 | 69 | Loading data... 70 | Data wordt geladen... 71 | 72 | 73 | Problem loading the data: 74 | Problem bij laden data: 75 | 76 | 77 | 78 | OneDayPage 79 | 80 | Today 81 | Vandaag 82 | 83 | 84 | Tomorrow 85 | Morgen 86 | 87 | 88 | 89 | OneDayZoomItem 90 | 91 | °C 92 | °C 93 | 94 | 95 | Precipitation: 96 | Neerslag: 97 | 98 | 99 | mm 100 | mm 101 | 102 | 103 | Wind: 104 | Wind: 105 | 106 | 107 | m/s 108 | m/s 109 | 110 | 111 | 112 | WeatherModel 113 | 114 | Can't parse the xml file 115 | Het XML-bestand kan niet verwerkt worden 116 | 117 | 118 | 119 | utils 120 | 121 | °C 122 | °C 123 | 124 | 125 | 126 | -------------------------------------------------------------------------------- /translations/QuickForecast_pl.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ApplicationInfo 6 | 7 | Error loading image - Host not found or unreachable 8 | Błąd wczytywania obrazka - Nie znaleziono hosta lub jest on nieosiągalny 9 | 10 | 11 | Waiting for cities, network may be slow... 12 | Oczekiwanie na miasta, połączenie sieciowe może być powolne... 13 | 14 | 15 | Network error: %1 16 | Błąd sieciowy: %1 17 | 18 | 19 | 20 | BasicPage 21 | 22 | Find City 23 | Znajdź Miasto 24 | 25 | 26 | 27 | CitiesListModel 28 | 29 | no city found 30 | nie znaleziono miasta 31 | 32 | 33 | 34 | CitiesPage 35 | 36 | Cities 37 | Miasta 38 | 39 | 40 | No Cities 41 | Brak Miast 42 | 43 | 44 | 45 | CityModel 46 | 47 | Network error: 48 | Błąd sieciowy: 49 | 50 | 51 | No data at given url 52 | Brak danych pod wskazanym url 53 | 54 | 55 | 56 | LongTermDayItem 57 | 58 | m/s 59 | m/s 60 | 61 | 62 | 63 | LongTermPage 64 | 65 | 10 Days Forecast 66 | Prognoza na 10 dni 67 | 68 | 69 | Loading data... 70 | Ładowanie danych... 71 | 72 | 73 | Problem loading the data: 74 | Problem z ładowaniem danych: 75 | 76 | 77 | 78 | OneDayPage 79 | 80 | Today 81 | Dziś 82 | 83 | 84 | Tomorrow 85 | Jutro 86 | 87 | 88 | 89 | OneDayZoomItem 90 | 91 | Precipitation: 92 | Opady: 93 | 94 | 95 | mm 96 | mm 97 | 98 | 99 | Wind: 100 | Wiatr: 101 | 102 | 103 | m/s 104 | m/s 105 | 106 | 107 | 108 | WeatherModel 109 | 110 | Can't parse the xml file 111 | Błąd parsowania pliku xml 112 | 113 | 114 | 115 | utils 116 | 117 | °C 118 | °C 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /translations/QuickForecast_ro.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ApplicationInfo 6 | 7 | Error loading image - Host not found or unreachable 8 | Eroare incărcare imagine - gazdă inexistentă sau indisponibilă 9 | 10 | 11 | Waiting for cities, network may be slow... 12 | Aşteptare oraşe, conexiune lentă... 13 | 14 | 15 | Network error: %1 16 | Eroare de reţea: %1 17 | 18 | 19 | 20 | BasicPage 21 | 22 | Find City 23 | Găseşte oraş 24 | 25 | 26 | 27 | CitiesListModel 28 | 29 | no city found 30 | Niciun oraş găsit 31 | 32 | 33 | 34 | CitiesPage 35 | 36 | Cities 37 | Oraşe 38 | 39 | 40 | No Cities 41 | Niciun oraş 42 | 43 | 44 | 45 | CityModel 46 | 47 | Network error: 48 | Eroare de reţea: 49 | 50 | 51 | No data at given url 52 | Date inexistente la url-ul indicat 53 | 54 | 55 | 56 | LongTermDayItem 57 | 58 | m/s 59 | m/s 60 | 61 | 62 | 63 | LongTermPage 64 | 65 | 10 Day Forecast 66 | Prognoza pe 10 zile 67 | 68 | 69 | Loading data... 70 | Datele se incarcă... 71 | 72 | 73 | Problem loading the data: 74 | Eroare incărcare date: 75 | 76 | 77 | 78 | OneDayPage 79 | 80 | Today 81 | Azi 82 | 83 | 84 | Tomorrow 85 | Mâine 86 | 87 | 88 | 89 | OneDayZoomItem 90 | 91 | Precipitation: 92 | Precipitaţii: 93 | 94 | 95 | mm 96 | mm 97 | 98 | 99 | Wind: 100 | Vânt: 101 | 102 | 103 | m/s 104 | m/s 105 | 106 | 107 | 108 | WeatherModel 109 | 110 | Can't parse the xml file 111 | Fişierul xml nu poate fi parsat 112 | 113 | 114 | 115 | utils 116 | 117 | °C 118 | °C 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /translations/QuickForecast_ru.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ApplicationInfo 6 | 7 | Error loading image - Host not found or unreachable 8 | Ошибка при загрузке изображения – сервер не найден или недоступен 9 | 10 | 11 | Waiting for cities, network may be slow... 12 | Загрузка списка городов… 13 | 14 | 15 | Network error: %1 16 | Ошибка соединения: %1 17 | 18 | 19 | 20 | BasicPage 21 | 22 | Find City 23 | Найти город 24 | 25 | 26 | 27 | CitiesListModel 28 | 29 | no city found 30 | города не найдены 31 | 32 | 33 | 34 | CitiesPage 35 | 36 | Cities 37 | Города 38 | 39 | 40 | No Cities 41 | Нет городов 42 | 43 | 44 | 45 | CityModel 46 | 47 | Network error: 48 | Ошибка соединения: 49 | 50 | 51 | No data at given url 52 | Нет данных по указанной ссылке 53 | 54 | 55 | 56 | LongTermDayItem 57 | 58 | m/s 59 | м/с 60 | 61 | 62 | 63 | LongTermPage 64 | 65 | 10 Day Forecast 66 | Прогноз погоды на 10 дней 67 | 68 | 69 | Loading data... 70 | Загрузка данных… 71 | 72 | 73 | Problem loading the data: 74 | При загрузке данных возникла ошибка: 75 | 76 | 77 | 78 | OneDayPage 79 | 80 | Today 81 | Сегодня 82 | 83 | 84 | Tomorrow 85 | Завтра 86 | 87 | 88 | 89 | OneDayZoomItem 90 | 91 | Precipitation: 92 | Осадки: 93 | 94 | 95 | mm 96 | мм 97 | 98 | 99 | Wind: 100 | Ветер: 101 | 102 | 103 | m/s 104 | м/с 105 | 106 | 107 | 108 | WeatherModel 109 | 110 | Can't parse the xml file 111 | Не удалось разобрать XML-файл 112 | 113 | 114 | 115 | utils 116 | 117 | °C 118 | °C 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /translations/QuickForecast_zh.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ApplicationInfo 6 | 7 | Error loading image - Host not found or unreachable 8 | 加载图片错误 - 主机没有找到或者不可访问 9 | 10 | 11 | Waiting for cities, network may be slow... 12 | 正在等待城市信息,网络也许有点慢... 13 | 14 | 15 | Network error: %1 16 | 网络错误:%1 17 | 18 | 19 | 20 | BasicPage 21 | 22 | Find City 23 | 查找城市 24 | 25 | 26 | 27 | CitiesListModel 28 | 29 | no city found 30 | 没有找到城市 31 | 32 | 33 | 34 | CitiesPage 35 | 36 | Cities 37 | 城市 38 | 39 | 40 | No Cities 41 | 没有城市 42 | 43 | 44 | 45 | CityModel 46 | 47 | Network error: 48 | 网络错误: 49 | 50 | 51 | No data at given url 52 | 给定的URL中没有数据 53 | 54 | 55 | 56 | LongTermDayItem 57 | 58 | m/s 59 | 米/秒 60 | 61 | 62 | 63 | LongTermPage 64 | 65 | 10 Day Forecast 66 | 10天预报 67 | 68 | 69 | Loading data... 70 | 正在加载数据... 71 | 72 | 73 | Problem loading the data: 74 | 加载数据出现问题: 75 | 76 | 77 | 78 | OneDayPage 79 | 80 | Today 81 | 今天 82 | 83 | 84 | Tomorrow 85 | 明天 86 | 87 | 88 | 89 | OneDayZoomItem 90 | 91 | Precipitation: 92 | 降雨量: 93 | 94 | 95 | mm 96 | 毫米 97 | 98 | 99 | Wind: 100 | 风速: 101 | 102 | 103 | m/s 104 | 米/秒 105 | 106 | 107 | 108 | WeatherModel 109 | 110 | Can't parse the xml file 111 | 无法解析XML文件 112 | 113 | 114 | 115 | utils 116 | 117 | °C 118 | °C 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /translations/README: -------------------------------------------------------------------------------- 1 | How To add translations to Quick Forecast 2 | ========================================== 3 | 4 | The "translations" folder contains QuickForecast TS files. 5 | 6 | The available languages are found in the LANGUAGES line of weatherapp.pro. 7 | 8 | # Add a new language 9 | 10 | 1 - Run "make ts-untranslated" 11 | 2 - Rename QuickForecast_unstranslated.ts with the expected language 12 | 3 - Add your language to the LANGUAGES line in weatherapp.pro 13 | (don't qualify it with a country unless you expect country-specific variants) 14 | 4 - Open QuickForecast_.ts in Qt Linguist, set the target language and translate 15 | 16 | # Update an existing language 17 | 18 | 1 - Run "make ts- to update the specific TS file 19 | (Alternatively run "make ts-all" to update TS files for all LANGUAGES) 20 | 2 - Open QuickForecast_.ts in Qt Linguist and translate 21 | 22 | # Create a commit 23 | 24 | 1 - Discard the modifications to any .ts files except yours 25 | 2 - Run "make commit-ts" (To keep the changes smaller, the commit-ts target also 26 | strips out the line number information from the TS files) 27 | 3 - If needed, amend the commit with the modified weatherapp.pro file 28 | 29 | # QM files 30 | The QM files are automatically generated for the available TS files when running 31 | qmake on weatherapp.pro. 32 | 33 | For more info on how to use Qt Linguist and add support for translation in a Qt application, visit: 34 | https://qt-project.org/doc/qt-5/qtlinguist-index.html 35 | -------------------------------------------------------------------------------- /weatherapp.pro: -------------------------------------------------------------------------------- 1 | cache() 2 | 3 | TEMPLATE = app 4 | QT += qml quick gui network xmlpatterns 5 | TARGET = QuickForecast 6 | 7 | include(src/src.pri) 8 | 9 | APP_FILES = \ 10 | $$PWD/qml/main.qml \ 11 | $$PWD/qml/pages/BasicPage.qml \ 12 | $$PWD/qml/pages/CitiesPage.qml \ 13 | $$PWD/qml/pages/OneDayPage.qml \ 14 | $$PWD/qml/pages/LongTermPage.qml \ 15 | $$PWD/qml/pages/LongTermDayItem.qml \ 16 | $$PWD/qml/pages/OneDayZoomItem.qml \ 17 | $$PWD/qml/pages/OneDaySliderItem.qml \ 18 | $$PWD/qml/pages/Separator.qml \ 19 | $$PWD/qml/models/WeatherModel.qml \ 20 | $$PWD/qml/js/utils.js 21 | 22 | # Touch Styled Controls 23 | APP_FILES += \ 24 | $$PWD/qml/touch/TouchLabel.qml \ 25 | $$PWD/qml/touch/TouchScrollView.qml \ 26 | $$PWD/qml/touch/TouchSlider.qml \ 27 | $$PWD/qml/touch/TouchTextField.qml \ 28 | $$PWD/qml/touch/ListViewDelegate.qml \ 29 | $$PWD/qml/touch/images/BackArrow.png \ 30 | $$PWD/qml/touch/images/Pointer.png \ 31 | $$PWD/qml/touch/images/Pointer_pressed.png \ 32 | $$PWD/qml/touch/images/Circle.png \ 33 | $$PWD/qml/touch/images/darkclose.png \ 34 | $$PWD/qml/touch/images/magnifier.png \ 35 | $$PWD/qml/touch/images/Clear.png 36 | 37 | # Fonts 38 | APP_FILES += \ 39 | $$PWD/fonts/OpenSans-Bold.ttf \ 40 | $$PWD/fonts/OpenSans-Semibold.ttf \ 41 | $$PWD/fonts/OpenSans-Regular.ttf 42 | 43 | OTHER_FILES += $$APP_FILES $$PWD/translations/README 44 | 45 | # var, prepend, append 46 | defineReplace(prependAll) { 47 | for(a,$$1):result += $$2$${a}$$3 48 | return($$result) 49 | } 50 | 51 | # Supported languages 52 | LANGUAGES = bn da de es fi fr hi hu it nb nl pl ro ru zh 53 | 54 | # Available translations 55 | TRANSLATIONS = $$prependAll(LANGUAGES, $$PWD/translations/QuickForecast_, .ts) 56 | 57 | # Used to embed the qm files in resources 58 | TRANSLATIONS_FILES = 59 | 60 | # run LRELEASE to generate the qm files 61 | qtPrepareTool(LRELEASE, lrelease) 62 | for(tsfile, TRANSLATIONS) { 63 | qmfile = $$shadowed($$tsfile) 64 | qmfile ~= s,\\.ts$,.qm, 65 | qmdir = $$dirname(qmfile) 66 | !exists($$qmdir) { 67 | mkpath($$qmdir)|error("Aborting.") 68 | } 69 | command = $$LRELEASE -removeidentical $$tsfile -qm $$qmfile 70 | system($$command)|error("Failed to run: $$command") 71 | TRANSLATIONS_FILES += $$qmfile 72 | } 73 | 74 | # Create the resource file 75 | GENERATED_RESOURCE_FILE = $$OUT_PWD/weatherapp.qrc 76 | 77 | RESOURCE_CONTENT = \ 78 | "" \ 79 | "" 80 | 81 | for(resourcefile, APP_FILES) { 82 | resourcefileabsolutepath = $$absolute_path($$resourcefile) 83 | relativepath_in = $$relative_path($$resourcefileabsolutepath, $$_PRO_FILE_PWD_) 84 | relativepath_out = $$relative_path($$resourcefileabsolutepath, $$OUT_PWD) 85 | RESOURCE_CONTENT += "$$relativepath_out" 86 | } 87 | 88 | for(translationfile, TRANSLATIONS_FILES) { 89 | relativepath_out = $$relative_path($$translationfile, $$OUT_PWD) 90 | RESOURCE_CONTENT += "$$relativepath_out" 91 | } 92 | 93 | RESOURCE_CONTENT += \ 94 | "" \ 95 | "" 96 | 97 | write_file($$GENERATED_RESOURCE_FILE, RESOURCE_CONTENT)|error("Aborting.") 98 | 99 | RESOURCES += $$GENERATED_RESOURCE_FILE 100 | 101 | ios { 102 | FONTS.files = $$PWD/fonts/OpenSans-Bold.ttf $$PWD/fonts/OpenSans-Semibold.ttf $$PWD/fonts/OpenSans-Regular.ttf 103 | FONTS.path = fonts 104 | QMAKE_BUNDLE_DATA += FONTS 105 | QMAKE_INFO_PLIST = ios/iosInfo.plist 106 | } 107 | 108 | android: ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android 109 | 110 | winrt { 111 | WINRT_MANIFEST.logo_large = app-icons/AppIcon_150x150.png 112 | WINRT_MANIFEST.logo_small = app-icons/AppIcon_30x30.png 113 | WINRT_MANIFEST.logo_store = app-icons/AppIcon_50x50.png 114 | WINRT_MANIFEST.logo_splash = app-icons/AppIcon_620x300.png 115 | WINRT_MANIFEST.background = $${LITERAL_HASH}00a2ff 116 | WINRT_MANIFEST.publisher = "Digia Plc" 117 | winphone:equals(WINSDK_VER, 8.0) { 118 | WINRT_MANIFEST.capabilities += ID_CAP_NETWORKING 119 | WINRT_MANIFEST.logo_medium = app-icons/AppIcon_100x100.png 120 | WINRT_MANIFEST.tile_iconic_small = app-icons/AppIcon_71x110.png 121 | WINRT_MANIFEST.tile_iconic_medium = app-icons/AppIcon_134x202.png 122 | build_pass:FONTS = $$PWD/fonts/OpenSans-Bold.ttf $$PWD/fonts/OpenSans-Semibold.ttf $$PWD/fonts/OpenSans-Regular.ttf 123 | } else { 124 | WINRT_MANIFEST.capabilities += internetClient 125 | } 126 | CONFIG += windeployqt 127 | WINDEPLOYQT_OPTIONS = -no-svg -qmldir $$shell_quote($$system_path($$_PRO_FILE_PWD_)) 128 | } 129 | 130 | # TRANSLATIONS - Create extra targets for convenience 131 | 132 | wd = $$replace(PWD, /, $$QMAKE_DIR_SEP) 133 | 134 | # LUPDATE - Make new targets for each and all languages 135 | qtPrepareTool(LUPDATE, lupdate) 136 | LUPDATE += -locations relative -no-ui-lines 137 | TSFILES = $$files($$PWD/translations/QuickForecast_*.ts) $$PWD/translations/QuickForecast_untranslated.ts 138 | for(file, TSFILES) { 139 | lang = $$replace(file, .*_([^/]*)\\.ts, \\1) 140 | v = ts-$${lang}.commands 141 | $$v = cd $$wd && $$LUPDATE $$SOURCES $$APP_FILES -ts $$file 142 | QMAKE_EXTRA_TARGETS += ts-$$lang 143 | } 144 | ts-all.commands = cd $$PWD && $$LUPDATE $$SOURCES $$APP_FILES -ts $$TSFILES 145 | QMAKE_EXTRA_TARGETS += ts-all 146 | 147 | # COMMIT - Make a new target for lconvert and committing the ts files 148 | # lconvert is used to remove the strings location in the ts files 149 | # and thus save space. 150 | qtPrepareTool(LCONVERT, lconvert) 151 | LCONVERT += -locations none 152 | isEqual(QMAKE_DIR_SEP, /) { 153 | commit-ts.commands = \ 154 | cd $$wd; \ 155 | git add -N translations/*_??.ts && \ 156 | for f in `git diff-files --name-only translations/*_??.ts`; do \ 157 | $$LCONVERT -i \$\$f -o \$\$f; \ 158 | done; \ 159 | git add translations/*_??.ts && git commit 160 | } else { 161 | commit-ts.commands = \ 162 | cd $$wd && \ 163 | git add -N translations/*_??.ts && \ 164 | for /f usebackq %%f in (`git diff-files --name-only -- translations/*_??.ts`) do \ 165 | $$LCONVERT -i %%f -o %%f $$escape_expand(\\n\\t) \ 166 | cd $$wd && git add translations/*_??.ts && git commit 167 | } 168 | QMAKE_EXTRA_TARGETS += commit-ts 169 | 170 | --------------------------------------------------------------------------------