Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Plasma Workspace
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
List
Boards
Labels
Service Desk
Milestones
Merge Requests
62
Merge Requests
62
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Plasma
Plasma Workspace
Commits
fb7b5c93
Commit
fb7b5c93
authored
Jan 04, 2018
by
Friedrich W. H. Kossebau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[weather] Use range-based for loops
parent
971134a4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
16 deletions
+17
-16
dataengines/weather/ions/bbcukmet/ion_bbcukmet.cpp
dataengines/weather/ions/bbcukmet/ion_bbcukmet.cpp
+5
-5
dataengines/weather/ions/envcan/ion_envcan.cpp
dataengines/weather/ions/envcan/ion_envcan.cpp
+2
-2
dataengines/weather/ions/noaa/ion_noaa.cpp
dataengines/weather/ions/noaa/ion_noaa.cpp
+3
-3
dataengines/weather/ions/wetter.com/ion_wettercom.cpp
dataengines/weather/ions/wetter.com/ion_wettercom.cpp
+5
-5
dataengines/weather/weatherengine.cpp
dataengines/weather/weatherengine.cpp
+2
-1
No files found.
dataengines/weather/ions/bbcukmet/ion_bbcukmet.cpp
View file @
fb7b5c93
...
...
@@ -281,7 +281,7 @@ bool UKMETIon::updateIonSource(const QString& source)
// Gets specific city XML data
void
UKMETIon
::
getXMLData
(
const
QString
&
source
)
{
for
each
(
const
QString
&
fetching
,
m_obsJobList
)
{
for
(
const
QString
&
fetching
:
qAsConst
(
m_obsJobList
)
)
{
if
(
fetching
==
source
)
{
// already getting this source and awaiting the data
return
;
...
...
@@ -354,9 +354,9 @@ void UKMETIon::readSearchHTMLData(const QString& source, const QByteArray& html)
QJsonObject
jsonDocumentObject
=
QJsonDocument
::
fromJson
(
html
).
object
();
if
(
!
jsonDocumentObject
.
isEmpty
())
{
QJsonArray
results
=
jsonDocumentObject
.
value
(
QStringLiteral
(
"results"
)).
toArray
();
const
QJsonArray
results
=
jsonDocumentObject
.
value
(
QStringLiteral
(
"results"
)).
toArray
();
for
each
(
const
QJsonValue
&
resultValue
,
results
)
{
for
(
const
QJsonValue
&
resultValue
:
results
)
{
QJsonObject
result
=
resultValue
.
toObject
();
const
QString
id
=
result
.
value
(
QStringLiteral
(
"id"
)).
toString
();
const
QString
fullName
=
result
.
value
(
QStringLiteral
(
"fullName"
)).
toString
();
...
...
@@ -827,7 +827,7 @@ void UKMETIon::validate(const QString& source)
}
QString
placeList
;
for
each
(
const
QString
&
place
,
m_locations
)
{
for
(
const
QString
&
place
:
qAsConst
(
m_locations
)
)
{
const
QString
p
=
place
.
section
(
QLatin1Char
(
'|'
),
1
,
1
);
placeList
.
append
(
QStringLiteral
(
"|place|"
)
+
p
+
QStringLiteral
(
"|extra|"
)
+
m_place
[
place
].
XMLurl
);
}
...
...
@@ -933,7 +933,7 @@ void UKMETIon::updateWeather(const QString& source)
data
.
insert
(
QStringLiteral
(
"Total Weather Days"
),
forecasts
.
size
());
int
i
=
0
;
for
each
(
const
WeatherData
::
ForecastInfo
*
forecastInfo
,
forecasts
)
{
for
(
const
WeatherData
::
ForecastInfo
*
forecastInfo
:
forecasts
)
{
QString
period
=
forecastInfo
->
period
;
period
.
replace
(
QStringLiteral
(
"Saturday"
),
i18nc
(
"Short for Saturday"
,
"Sat"
));
period
.
replace
(
QStringLiteral
(
"Sunday"
),
i18nc
(
"Short for Sunday"
,
"Sun"
));
...
...
dataengines/weather/ions/envcan/ion_envcan.cpp
View file @
fb7b5c93
...
...
@@ -525,7 +525,7 @@ void EnvCanadaIon::getXMLSetup()
// Gets specific city XML data
void
EnvCanadaIon
::
getXMLData
(
const
QString
&
source
)
{
for
each
(
const
QString
&
fetching
,
m_jobList
)
{
for
(
const
QString
&
fetching
:
qAsConst
(
m_jobList
)
)
{
if
(
fetching
==
source
)
{
// already getting this source and awaiting the data
return
;
...
...
@@ -1536,7 +1536,7 @@ void EnvCanadaIon::updateWeather(const QString& source)
data
.
insert
(
QStringLiteral
(
"Total Weather Days"
),
forecasts
.
size
());
int
i
=
0
;
for
each
(
const
WeatherData
::
ForecastInfo
*
forecastInfo
,
forecasts
)
{
for
(
const
WeatherData
::
ForecastInfo
*
forecastInfo
:
forecasts
)
{
QString
forecastPeriod
=
forecastInfo
->
forecastPeriod
;
if
(
forecastPeriod
.
isEmpty
())
{
...
...
dataengines/weather/ions/noaa/ion_noaa.cpp
View file @
fb7b5c93
...
...
@@ -192,7 +192,7 @@ void NOAAIon::getXMLSetup() const
// Gets specific city XML data
void
NOAAIon
::
getXMLData
(
const
QString
&
source
)
{
for
each
(
const
QString
&
fetching
,
m_jobList
)
{
for
(
const
QString
&
fetching
:
qAsConst
(
m_jobList
)
)
{
if
(
fetching
==
source
)
{
// already getting this source and awaiting the data
return
;
...
...
@@ -265,7 +265,7 @@ void NOAAIon::setup_slotJobFinished(KJob *job)
const
bool
success
=
readXMLSetup
();
setInitialized
(
success
);
for
each
(
const
QString
&
source
,
m_sourcesToReset
)
{
for
(
const
QString
&
source
:
qAsConst
(
m_sourcesToReset
)
)
{
updateSourceEvent
(
source
);
}
}
...
...
@@ -604,7 +604,7 @@ void NOAAIon::updateWeather(const QString& source)
data
.
insert
(
QStringLiteral
(
"Total Weather Days"
),
weatherData
.
forecasts
.
size
());
int
i
=
0
;
for
each
(
const
WeatherData
::
Forecast
&
forecast
,
weatherData
.
forecasts
)
{
for
(
const
WeatherData
::
Forecast
&
forecast
:
weatherData
.
forecasts
)
{
ConditionIcons
icon
=
getConditionIcon
(
forecast
.
summary
.
toLower
(),
true
);
QString
iconName
=
getWeatherIcon
(
icon
);
...
...
dataengines/weather/ions/wetter.com/ion_wettercom.cpp
View file @
fb7b5c93
...
...
@@ -431,7 +431,7 @@ void WetterComIon::validate(const QString& source, bool parseError)
}
QString
placeList
;
for
each
(
const
QString
&
place
,
m_locations
)
{
for
(
const
QString
&
place
:
qAsConst
(
m_locations
)
)
{
// Extra data format: placeCode;displayName
placeList
.
append
(
QLatin1String
(
"|place|"
)
+
place
+
QLatin1String
(
"|extra|"
)
+
m_place
[
place
].
placeCode
+
QLatin1Char
(
';'
)
+
m_place
[
place
].
displayName
);
...
...
@@ -458,7 +458,7 @@ void WetterComIon::validate(const QString& source, bool parseError)
void
WetterComIon
::
fetchForecast
(
const
QString
&
source
)
{
for
each
(
const
QString
&
fetching
,
m_forecastJobList
)
{
for
(
const
QString
&
fetching
:
qAsConst
(
m_forecastJobList
)
)
{
if
(
fetching
==
source
)
{
// already fetching!
return
;
...
...
@@ -701,7 +701,7 @@ void WetterComIon::updateWeather(const QString& source, bool parseError)
data
.
insert
(
QStringLiteral
(
"Temperature Unit"
),
KUnitConversion
::
Celsius
);
int
i
=
0
;
for
each
(
WeatherData
::
ForecastPeriod
*
forecastPeriod
,
weatherData
.
forecasts
)
{
for
(
const
WeatherData
::
ForecastPeriod
*
forecastPeriod
:
weatherData
.
forecasts
)
{
if
(
i
>
0
)
{
WeatherData
::
ForecastInfo
weather
=
forecastPeriod
->
getWeather
();
...
...
@@ -803,7 +803,7 @@ WeatherData::ForecastInfo WeatherData::ForecastPeriod::getWeather() const
int
WeatherData
::
ForecastPeriod
::
getMaxTemp
(
const
QVector
<
WeatherData
::
ForecastInfo
*>&
forecastInfos
)
const
{
int
result
=
-
273
;
for
each
(
const
WeatherData
::
ForecastInfo
*
forecast
,
forecastInfos
)
{
for
(
const
WeatherData
::
ForecastInfo
*
forecast
:
forecastInfos
)
{
result
=
std
::
max
(
result
,
forecast
->
tempHigh
);
}
...
...
@@ -813,7 +813,7 @@ int WeatherData::ForecastPeriod::getMaxTemp(const QVector<WeatherData::ForecastI
int
WeatherData
::
ForecastPeriod
::
getMinTemp
(
const
QVector
<
WeatherData
::
ForecastInfo
*>&
forecastInfos
)
const
{
int
result
=
100
;
for
each
(
const
WeatherData
::
ForecastInfo
*
forecast
,
forecastInfos
)
{
for
(
const
WeatherData
::
ForecastInfo
*
forecast
:
forecastInfos
)
{
result
=
std
::
min
(
result
,
forecast
->
tempLow
);
}
...
...
dataengines/weather/weatherengine.cpp
View file @
fb7b5c93
...
...
@@ -61,7 +61,8 @@ void WeatherEngine::updateIonList(const QStringList &changedResources)
{
if
(
changedResources
.
isEmpty
()
||
changedResources
.
contains
(
QStringLiteral
(
"services"
)))
{
removeAllData
(
QStringLiteral
(
"ions"
));
foreach
(
const
KPluginInfo
&
info
,
Plasma
::
PluginLoader
::
self
()
->
listEngineInfo
(
QStringLiteral
(
"weatherengine"
)))
{
const
auto
infos
=
Plasma
::
PluginLoader
::
self
()
->
listEngineInfo
(
QStringLiteral
(
"weatherengine"
));
for
(
const
KPluginInfo
&
info
:
infos
)
{
const
QString
data
=
info
.
name
()
+
QLatin1Char
(
'|'
)
+
info
.
pluginName
();
setData
(
QStringLiteral
(
"ions"
),
info
.
pluginName
(),
data
);
}
...
...
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