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
Libraries
KPublicTransport
Commits
f41d088f
Commit
f41d088f
authored
Sep 03, 2021
by
Volker Krause
Browse files
Further unify the GBFS job state handling
Gets us closer to adding a third state for checking for a new version.
parent
e9c55413
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/lib/gbfs/gbfsjob.cpp
View file @
f41d088f
...
...
@@ -130,14 +130,7 @@ void GBFSJob::processFeeds(bool sysInfoOnly)
switch
(
type
)
{
case
GBFS
::
SystemInformation
:
if
(
!
sysInfoOnly
)
{
break
;
}
if
(
!
m_store
.
isValid
()
||
!
m_store
.
hasCurrentData
(
GBFS
::
SystemInformation
))
{
auto
reply
=
m_nam
->
get
(
QNetworkRequest
(
url
));
connect
(
reply
,
&
QNetworkReply
::
finished
,
this
,
[
this
,
reply
,
type
]()
{
fetchFinished
(
reply
,
type
);
});
++
m_pendingJobs
;
}
else
{
qDebug
()
<<
"reusing cached system information"
;
continue
;
}
break
;
case
GBFS
::
StationInformation
:
...
...
@@ -147,16 +140,7 @@ void GBFSJob::processFeeds(bool sysInfoOnly)
case
GBFS
::
VehicleTypes
:
case
GBFS
::
GeofencingZones
:
if
(
sysInfoOnly
)
{
break
;
}
if
(
!
m_store
.
hasCurrentData
(
type
))
{
qDebug
()
<<
"fetching"
<<
name
;
auto
reply
=
m_nam
->
get
(
QNetworkRequest
(
url
));
connect
(
reply
,
&
QNetworkReply
::
finished
,
this
,
[
this
,
reply
,
type
]()
{
fetchFinished
(
reply
,
type
);
});
++
m_pendingJobs
;
}
else
{
qDebug
()
<<
"reusing cached"
<<
name
;
parseData
(
m_store
.
loadData
(
type
),
type
);
continue
;
}
break
;
case
GBFS
::
Discovery
:
...
...
@@ -165,17 +149,26 @@ void GBFSJob::processFeeds(bool sysInfoOnly)
case
GBFS
::
SystemRegions
:
case
GBFS
::
SystemPricingPlans
:
case
GBFS
::
SystemAlerts
:
break
;
continue
;
default:
qDebug
()
<<
"Unhandled feed:"
<<
name
<<
url
;
continue
;
}
if
(
!
m_store
.
isValid
()
||
!
m_store
.
hasCurrentData
(
type
))
{
qDebug
()
<<
"fetching"
<<
name
;
auto
reply
=
m_nam
->
get
(
QNetworkRequest
(
url
));
connect
(
reply
,
&
QNetworkReply
::
finished
,
this
,
[
this
,
reply
,
type
]()
{
fetchFinished
(
reply
,
type
);
});
++
m_pendingJobs
;
}
else
{
qDebug
()
<<
"reusing cached"
<<
name
;
parseData
(
m_store
.
loadData
(
type
),
type
);
}
}
if
(
m_pendingJobs
==
0
)
{
if
(
!
sysInfoOnly
)
{
finalize
();
}
else
{
processFeeds
(
false
);
}
}
}
...
...
Write
Preview
Supports
Markdown
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