diff --git a/.gitignore b/.gitignore index da1d64b..2e56fc1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.user +*.autosave build/ diff --git a/Position.qml b/Position.qml new file mode 100644 index 0000000..17ff812 --- /dev/null +++ b/Position.qml @@ -0,0 +1,35 @@ +import QtPositioning 5.2 +import QtQuick 2.3 + +Rectangle { + id: root + + PositionSource { + id: positionSource + onPositionChanged: { } + Component.onCompleted: { positionSource.update() } + + } + + XmlListModel { + id: listModel + property variant coordinate + + source: "http://api.geonames.org/findNearbyPlaceName?" + + "lat=" + coordinate.latitude + + "&lng=" + coordinate.longitude + query: "/geonames/geoname" + + + XmlRole { name: "toponymName"; query: "toponymName/string()" } + XmlRole { name: "name"; query: "name/string()" } + XmlRole { name: "lat"; query: "lat/string()" } + XmlRole { name: "lng"; query: "lng/string()" } + XmlRole { name: "geonameId"; query: "geonameId/string()" } + XmlRole { name: "countryCode"; query: "countryCode/string()" } + XmlRole { name: "countryName"; query: "countryName/string()" } + XmlRole { name: "distance"; query: "distance/string()" } + } + +} + diff --git a/QmlMirror.pro b/QmlMirror.pro index 290edbd..a35355b 100644 --- a/QmlMirror.pro +++ b/QmlMirror.pro @@ -6,5 +6,5 @@ SUBDIRS = weatherinfo SOURCES = QmlMirror.qml \ Clock.qml \ Weather.qml \ - Transport.qml - + Transport.qml \ + Position.qml diff --git a/QmlMirror.qml b/QmlMirror.qml index f9240be..c0d8402 100644 --- a/QmlMirror.qml +++ b/QmlMirror.qml @@ -15,12 +15,16 @@ ApplicationWindow { height: 240 } - Weather { + Rectangle { id: weatherId + width: 360 + height: 400 anchors.top: parent.top anchors.right: parent.right - width: 360 - height: 240 + Weather { + width: 360 + height: 400 + } } Transport { @@ -28,7 +32,7 @@ ApplicationWindow { anchors.top: weatherId.bottom anchors.right: parent.right width: 360 - height: 480 + height: 400 color: "black" } diff --git a/Transport.qml b/Transport.qml index 4a9c5ea..4cc5657 100644 --- a/Transport.qml +++ b/Transport.qml @@ -4,9 +4,10 @@ import QtQuick.Controls 1.3 import QtQuick.Controls.Styles 1.2 Rectangle { + id: root color: "black" width: 360 - height: 480 + height: 400 ListModel { id: lineModel @@ -47,7 +48,7 @@ Rectangle { headerDelegate: Rectangle { height: textItem.implicitHeight * 1.2 - width: textItem.implicitWidth +// width: textItem.implicitWidth color: "black" Text { id: textItem @@ -64,9 +65,9 @@ Rectangle { anchors.right: parent.right anchors.top: parent.top anchors.bottom: parent.bottom - anchors.bottomMargin: 1 - anchors.topMargin: 1 - width: 1 + anchors.bottomMargin: 0 + anchors.topMargin: 0 + width:1 color: "black" } } @@ -85,22 +86,22 @@ Rectangle { TableViewColumn { role: "number" title: "No" - width: parent.width / 6 + width: root.width / 6 } TableViewColumn { role: "destination" title: "Destination" - width: (parent.width / 6) * 3 + width: (root.width / 6) * 3 } TableViewColumn { role: "arriving" title: "Arriving" - width: parent.width / 6 + width: root.width / 6 } TableViewColumn { role: "next" title: "Next" - width: (parent.width / 6)-2 + width: (root.width / 6)-2 } } } diff --git a/Weather.qml b/Weather.qml index 2b0b239..3b1d07e 100644 --- a/Weather.qml +++ b/Weather.qml @@ -3,8 +3,6 @@ import net.frozentux.weatherinfo 1.0 Rectangle { - width: 360 - height: 600 color: "black" WeatherInfo { diff --git a/weatherinfo/WeatherInfo.qml b/weatherinfo/WeatherInfo.qml index 7aca3a7..4fa42aa 100644 --- a/weatherinfo/WeatherInfo.qml +++ b/weatherinfo/WeatherInfo.qml @@ -42,11 +42,12 @@ import QtQuick 2.0 import net.frozentux.weatherinfo 1.0 //! [0] -Item { +Rectangle { id: window //! [0] - width: 360 - height: 640 + width: parent.width + height: parent.height + color: "black" state: "loading" @@ -97,7 +98,6 @@ Item { } -//! [3] BigForecastIcon { id: current @@ -107,13 +107,9 @@ Item { weatherIcon: (model.hasValidWeather ? model.weather.weatherIcon : "01d") -//! [3] topText: (model.hasValidWeather ? model.weather.temperature : "??") - bottomText: (model.hasValidWeather - ? model.weather.weatherDescription - : "No weather data") MouseArea { anchors.fill: parent @@ -121,9 +117,7 @@ Item { model.refreshWeather() } } -//! [4] } -//! [4] Row { id: iconRow diff --git a/weatherinfo/components/BigForecastIcon.qml b/weatherinfo/components/BigForecastIcon.qml index bbd7d84..c225e71 100644 --- a/weatherinfo/components/BigForecastIcon.qml +++ b/weatherinfo/components/BigForecastIcon.qml @@ -44,7 +44,6 @@ Item { id: current property string topText: "20*" - property string bottomText: "Mostly cloudy" property string weatherIcon: "01d" property real smallSide: (current.width < current.height ? current.width : current.height) @@ -69,17 +68,4 @@ Item { height: current.smallSide } - Text { - text: current.bottomText - color: "white" - font.pointSize: 23 - wrapMode: Text.WordWrap - width: parent.width - horizontalAlignment: Text.AlignRight - anchors { - bottom: current.bottom - right: current.right - rightMargin: 5 - } - } } diff --git a/weatherinfo/weatherinfo.pro b/weatherinfo/weatherinfo.pro index 3154cbb..a1110b4 100644 --- a/weatherinfo/weatherinfo.pro +++ b/weatherinfo/weatherinfo.pro @@ -12,9 +12,11 @@ SOURCES += appmodel.cpp \ HEADERS += appmodel.h \ weatherplugin.h +target.path = $$[QT_INSTALL_QML]/net/frozentux/weatherinfo + qmldirfile.path = $$[QT_INSTALL_QML]/net/frozentux/weatherinfo qmldirfile.files = qmldir -INSTALLS += qmldirfile +INSTALLS += qmldirfile target RESOURCES += \ images.qrc