Cleaned up weatherinfo and removed some visible stuff
Cleaned up the Transport module Started adding a Position module
This commit is contained in:
parent
7f3d543711
commit
021547f3df
9 changed files with 63 additions and 42 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,2 +1,3 @@
|
|||
*.user
|
||||
*.autosave
|
||||
build/
|
||||
|
|
35
Position.qml
Normal file
35
Position.qml
Normal file
|
@ -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()" }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -6,5 +6,5 @@ SUBDIRS = weatherinfo
|
|||
SOURCES = QmlMirror.qml \
|
||||
Clock.qml \
|
||||
Weather.qml \
|
||||
Transport.qml
|
||||
|
||||
Transport.qml \
|
||||
Position.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"
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,8 +3,6 @@ import net.frozentux.weatherinfo 1.0
|
|||
|
||||
|
||||
Rectangle {
|
||||
width: 360
|
||||
height: 600
|
||||
color: "black"
|
||||
WeatherInfo {
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue