Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
Itinerary
Commits
33e6bbfa
Commit
33e6bbfa
authored
Dec 27, 2018
by
Volker Krause
Browse files
Connect settings to live data manager
parent
7ab650d1
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/app/livedatamanager.cpp
View file @
33e6bbfa
...
...
@@ -51,7 +51,9 @@ using namespace KItinerary;
LiveDataManager
::
LiveDataManager
(
QObject
*
parent
)
:
QObject
(
parent
)
{
m_ptMgr
.
reset
(
new
KPublicTransport
::
Manager
);
}
LiveDataManager
::~
LiveDataManager
()
=
default
;
...
...
@@ -83,6 +85,16 @@ void LiveDataManager::setPkPassManager(PkPassManager *pkPassMgr)
m_pkPassMgr
=
pkPassMgr
;
}
void
LiveDataManager
::
setPollingEnabled
(
bool
pollingEnabled
)
{
// TODO
}
void
LiveDataManager
::
setAllowInsecureServices
(
bool
allowInsecure
)
{
m_ptMgr
->
setAllowInsecureBackends
(
allowInsecure
);
}
QVariant
LiveDataManager
::
arrival
(
const
QString
&
resId
)
{
return
QVariant
::
fromValue
(
m_arrivals
.
value
(
resId
).
change
);
...
...
@@ -152,10 +164,6 @@ static KPublicTransport::Location locationFromStation(const TrainStation &statio
void
LiveDataManager
::
checkTrainTrip
(
const
TrainTrip
&
trip
,
const
QString
&
resId
)
{
qCDebug
(
Log
)
<<
trip
.
trainName
()
<<
trip
.
trainNumber
()
<<
trip
.
departureTime
();
if
(
!
m_ptMgr
)
{
m_ptMgr
.
reset
(
new
KPublicTransport
::
Manager
);
}
using
namespace
KPublicTransport
;
DepartureRequest
req
(
locationFromStation
(
trip
.
departureStation
()));
...
...
src/app/livedatamanager.h
View file @
33e6bbfa
...
...
@@ -50,6 +50,9 @@ public:
void
setReservationManager
(
ReservationManager
*
resMgr
);
void
setPkPassManager
(
PkPassManager
*
pkPassMgr
);
void
setPollingEnabled
(
bool
pollingEnabled
);
void
setAllowInsecureServices
(
bool
allowInsecure
);
Q_INVOKABLE
QVariant
arrival
(
const
QString
&
resId
);
Q_INVOKABLE
QVariant
departure
(
const
QString
&
resId
);
...
...
src/app/main.cpp
View file @
33e6bbfa
...
...
@@ -138,6 +138,10 @@ int main(int argc, char **argv)
LiveDataManager
liveDataMgr
;
liveDataMgr
.
setPkPassManager
(
&
passMgr
);
liveDataMgr
.
setReservationManager
(
&
resMgr
);
liveDataMgr
.
setPollingEnabled
(
settings
.
queryLiveData
());
liveDataMgr
.
setAllowInsecureServices
(
settings
.
allowInsecureServices
());
QObject
::
connect
(
&
settings
,
&
Settings
::
queryLiveDataChanged
,
&
liveDataMgr
,
&
LiveDataManager
::
setPollingEnabled
);
QObject
::
connect
(
&
settings
,
&
Settings
::
allowInsecureServicesChanged
,
&
liveDataMgr
,
&
LiveDataManager
::
setAllowInsecureServices
);
#ifndef Q_OS_ANDROID
QObject
::
connect
(
&
service
,
&
KDBusService
::
activateRequested
,
[
&
parser
,
&
appController
](
const
QStringList
&
args
,
const
QString
&
workingDir
)
{
...
...
src/app/settings.cpp
View file @
33e6bbfa
...
...
@@ -93,7 +93,7 @@ void Settings::setQueryLiveData(bool queryLiveData)
s
.
beginGroup
(
QLatin1String
(
"Settings"
));
s
.
setValue
(
QLatin1String
(
"QueryLiveData"
),
queryLiveData
);
emit
queryLiveDataChanged
();
emit
queryLiveDataChanged
(
queryLiveData
);
}
...
...
@@ -113,5 +113,5 @@ void Settings::setAllowInsecureServices(bool allowInsecure)
s
.
beginGroup
(
QLatin1String
(
"Settings"
));
s
.
setValue
(
QLatin1String
(
"AllowInsecureServices"
),
allowInsecure
);
emit
allowInsecureServicesChanged
();
emit
allowInsecureServicesChanged
(
allowInsecure
);
}
src/app/settings.h
View file @
33e6bbfa
...
...
@@ -46,8 +46,8 @@ public:
signals:
void
weatherForecastEnabledChanged
(
bool
enabled
);
void
homeCountryIsoCodeChanged
(
const
QString
&
isoCode
);
void
queryLiveDataChanged
();
void
allowInsecureServicesChanged
();
void
queryLiveDataChanged
(
bool
enabled
);
void
allowInsecureServicesChanged
(
bool
allowed
);
private:
QString
m_homeCountry
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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