Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma Mobile
KWeather
Commits
291b2f0c
Commit
291b2f0c
authored
Aug 02, 2021
by
Nicolas Fella
Committed by
Devin Lin
Aug 02, 2021
Browse files
Factor sunrise card into separate QML file
The one in flat and dynamic view are almost identical
parent
ca5b9804
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/qml/DynamicLocationForecast.qml
View file @
291b2f0c
...
...
@@ -416,10 +416,11 @@ Kirigami.ScrollablePage {
}
}
// sunrise/sunset card
Kirigami.Card
{
SunriseCard
{
Layout.fillWidth
:
true
textColor
:
weatherLocation
.
cardTextColor
background
:
Kirigami.ShadowedRectangle
{
color
:
weatherLocation
.
cardBackgroundColor
radius
:
Kirigami
.
Units
.
smallSpacing
...
...
@@ -429,82 +430,6 @@ Kirigami.ScrollablePage {
shadow.color
:
Qt
.
rgba
(
0.0
,
0.0
,
0.0
,
0.15
)
shadow.yOffset
:
Kirigami
.
Units
.
devicePixelRatio
*
2
}
contentItem
:
Item
{
implicitHeight
:
sunsetColumn
.
height
Column
{
id
:
sunsetColumn
spacing
:
Kirigami
.
Units
.
largeSpacing
*
2
// Sunrise
RowLayout
{
spacing
:
Kirigami
.
Units
.
largeSpacing
Kirigami.Icon
{
source
:
"
go-up
"
Layout.minimumHeight
:
Kirigami
.
Theme
.
defaultFont
.
pointSize
*
2
Layout.minimumWidth
:
Layout
.
minimumHeight
*
1.5
color
:
weatherLocation
.
iconColor
}
Column
{
spacing
:
Kirigami
.
Units
.
smallSpacing
Label
{
font.weight
:
Font
.
Bold
text
:
i18n
(
"
Sunrise
"
)
color
:
weatherLocation
.
cardTextColor
}
Label
{
text
:
Qt
.
formatTime
(
currentDay
.
sunrise
.
sunRise
,
Locale
.
ShortFormat
)
color
:
weatherLocation
.
cardTextColor
}
}
}
// Sunset
RowLayout
{
spacing
:
Kirigami
.
Units
.
largeSpacing
Kirigami.Icon
{
source
:
"
go-down
"
Layout.minimumHeight
:
Kirigami
.
Theme
.
defaultFont
.
pointSize
*
2
Layout.minimumWidth
:
Layout
.
minimumHeight
*
1.5
color
:
weatherLocation
.
iconColor
}
Column
{
spacing
:
Kirigami
.
Units
.
smallSpacing
Label
{
font.weight
:
Font
.
Bold
text
:
i18n
(
"
Sunset
"
)
color
:
weatherLocation
.
cardTextColor
}
Label
{
text
:
Qt
.
formatTime
(
currentDay
.
sunrise
.
sunSet
,
Locale
.
ShortFormat
)
color
:
weatherLocation
.
cardTextColor
}
}
}
// Moon phase
RowLayout
{
spacing
:
Kirigami
.
Units
.
largeSpacing
Kirigami.Icon
{
source
:
"
weather-clear-night
"
Layout.minimumHeight
:
Kirigami
.
Theme
.
defaultFont
.
pointSize
*
2
Layout.minimumWidth
:
Layout
.
minimumHeight
*
1.5
}
Column
{
spacing
:
Kirigami
.
Units
.
smallSpacing
Label
{
font.weight
:
Font
.
Bold
text
:
i18n
(
"
Moon Phase
"
)
color
:
weatherLocation
.
cardTextColor
}
Label
{
text
:
currentDay
.
sunrise
.
moonPhaseString
color
:
weatherLocation
.
cardTextColor
}
}
}
}
}
}
}
}
...
...
src/qml/FlatLocationForecast.qml
View file @
291b2f0c
...
...
@@ -342,87 +342,9 @@ Kirigami.ScrollablePage {
}
}
// sunrise/sunset card
Kirigami.Card
{
SunriseCard
{
Layout.fillWidth
:
true
Layout.topMargin
:
Kirigami
.
Units
.
largeSpacing
*
2
contentItem
:
Item
{
implicitHeight
:
sunsetColumn
.
height
Column
{
id
:
sunsetColumn
spacing
:
Kirigami
.
Units
.
largeSpacing
// Sunrise
RowLayout
{
spacing
:
Kirigami
.
Units
.
largeSpacing
Kirigami.Icon
{
source
:
"
go-up
"
Layout.minimumHeight
:
Kirigami
.
Theme
.
defaultFont
.
pointSize
*
2
Layout.minimumWidth
:
Layout
.
minimumHeight
*
1.5
}
Column
{
spacing
:
Kirigami
.
Units
.
smallSpacing
Label
{
font.weight
:
Font
.
Bold
text
:
i18n
(
"
Sunrise
"
)
}
Label
{
text
:
Qt
.
formatTime
(
currentDay
.
sunrise
.
sunRise
,
Locale
.
ShortFormat
)
}
}
}
Kirigami.Separator
{
Layout.fillWidth
:
true
}
// Sunset
RowLayout
{
spacing
:
Kirigami
.
Units
.
largeSpacing
Kirigami.Icon
{
source
:
"
go-down
"
Layout.minimumHeight
:
Kirigami
.
Theme
.
defaultFont
.
pointSize
*
2
Layout.minimumWidth
:
Layout
.
minimumHeight
*
1.5
}
Column
{
spacing
:
Kirigami
.
Units
.
smallSpacing
Label
{
font.weight
:
Font
.
Bold
text
:
i18n
(
"
Sunset
"
)
}
Label
{
text
:
Qt
.
formatTime
(
currentDay
.
sunrise
.
sunSet
,
Locale
.
ShortFormat
)
}
}
}
Kirigami.Separator
{
Layout.fillWidth
:
true
}
// Moon phase
RowLayout
{
spacing
:
Kirigami
.
Units
.
largeSpacing
Kirigami.Icon
{
source
:
"
weather-clear-night
"
Layout.minimumHeight
:
Kirigami
.
Theme
.
defaultFont
.
pointSize
*
2
Layout.minimumWidth
:
Layout
.
minimumHeight
*
1.5
}
Column
{
spacing
:
Kirigami
.
Units
.
smallSpacing
Label
{
font.weight
:
Font
.
Bold
text
:
i18n
(
"
Moon Phase
"
)
}
Label
{
text
:
currentDay
.
sunrise
.
moonPhaseString
}
}
}
}
}
}
}
}
...
...
src/qml/SunriseCard.qml
0 → 100644
View file @
291b2f0c
/*
* Copyright 2020 Han Young <hanyoung@protonmail.com>
* Copyright 2020 Devin Lin <espidev@gmail.com>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
import
QtQuick
2.12
import
QtQuick
.
Controls
2.4
import
QtQuick
.
Layouts
1.2
import
QtCharts
2.3
import
org
.
kde
.
kirigami
2.13
as
Kirigami
import
kweather
1.0
import
"
backgrounds
"
Kirigami.Card
{
id
:
root
property
var
textColor
:
Kirigami
.
Theme
.
textColor
contentItem
:
Item
{
implicitHeight
:
sunsetColumn
.
height
Column
{
id
:
sunsetColumn
spacing
:
Kirigami
.
Units
.
largeSpacing
*
2
// Sunrise
RowLayout
{
spacing
:
Kirigami
.
Units
.
largeSpacing
Kirigami.Icon
{
source
:
"
go-up
"
Layout.minimumHeight
:
Kirigami
.
Theme
.
defaultFont
.
pointSize
*
2
Layout.minimumWidth
:
Layout
.
minimumHeight
*
1.5
color
:
weatherLocation
.
iconColor
}
Column
{
spacing
:
Kirigami
.
Units
.
smallSpacing
Label
{
font.weight
:
Font
.
Bold
text
:
i18n
(
"
Sunrise
"
)
color
:
root
.
textColor
}
Label
{
text
:
Qt
.
formatTime
(
currentDay
.
sunrise
.
sunRise
,
Locale
.
ShortFormat
)
color
:
root
.
textColor
}
}
}
// Sunset
RowLayout
{
spacing
:
Kirigami
.
Units
.
largeSpacing
Kirigami.Icon
{
source
:
"
go-down
"
Layout.minimumHeight
:
Kirigami
.
Theme
.
defaultFont
.
pointSize
*
2
Layout.minimumWidth
:
Layout
.
minimumHeight
*
1.5
color
:
weatherLocation
.
iconColor
}
Column
{
spacing
:
Kirigami
.
Units
.
smallSpacing
Label
{
font.weight
:
Font
.
Bold
text
:
i18n
(
"
Sunset
"
)
color
:
root
.
textColor
}
Label
{
text
:
Qt
.
formatTime
(
currentDay
.
sunrise
.
sunSet
,
Locale
.
ShortFormat
)
color
:
root
.
textColor
}
}
}
// Moon phase
RowLayout
{
spacing
:
Kirigami
.
Units
.
largeSpacing
Kirigami.Icon
{
source
:
"
weather-clear-night
"
Layout.minimumHeight
:
Kirigami
.
Theme
.
defaultFont
.
pointSize
*
2
Layout.minimumWidth
:
Layout
.
minimumHeight
*
1.5
}
Column
{
spacing
:
Kirigami
.
Units
.
smallSpacing
Label
{
font.weight
:
Font
.
Bold
text
:
i18n
(
"
Moon Phase
"
)
color
:
root
.
textColor
}
Label
{
text
:
currentDay
.
sunrise
.
moonPhaseString
color
:
root
.
textColor
}
}
}
}
}
}
src/resources.qrc
View file @
291b2f0c
...
...
@@ -21,6 +21,7 @@
<file>qml/AboutPage.qml</file>
<file>qml/PopupDialog.qml</file>
<file>qml/TemperatureChartCard.qml</file>
<file>qml/SunriseCard.qml</file>
<file>qml/backgrounds/ClearDay.qml</file>
<file>qml/backgrounds/ClearNight.qml</file>
<file>qml/backgrounds/CloudyDay.qml</file>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment