Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
Utilities
KTrip
Commits
db3f0865
Commit
db3f0865
authored
Aug 07, 2019
by
Nicolas Fella
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add departure query mode
parent
76e159a3
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
37 additions
and
5 deletions
+37
-5
src/formatter.cpp
src/formatter.cpp
+7
-0
src/formatter.h
src/formatter.h
+1
-0
src/qml/ConnectionDetailsPage.qml
src/qml/ConnectionDetailsPage.qml
+0
-1
src/qml/ConnectionsPage.qml
src/qml/ConnectionsPage.qml
+0
-1
src/qml/JourneyQueryPage.qml
src/qml/JourneyQueryPage.qml
+0
-0
src/qml/LocationQueryPage.qml
src/qml/LocationQueryPage.qml
+0
-1
src/qml/main.qml
src/qml/main.qml
+15
-1
src/querycontroller.cpp
src/querycontroller.cpp
+9
-0
src/querycontroller.h
src/querycontroller.h
+2
-0
src/resources.qrc
src/resources.qrc
+3
-1
No files found.
src/formatter.cpp
View file @
db3f0865
...
...
@@ -20,6 +20,8 @@
#include "formatter.h"
#include <QDateTime>
QString
Formatter
::
formatDuration
(
int
seconds
)
{
const
int
minutes
=
seconds
/
60
;
...
...
@@ -31,3 +33,8 @@ QString Formatter::formatDuration(int seconds)
return
QString
::
number
(
hours
)
+
QStringLiteral
(
":"
)
+
minutesString
;
}
QString
Formatter
::
formatTime
(
const
QDateTime
&
time
)
{
return
time
.
toString
(
QStringLiteral
(
"hh:mm"
));
}
src/formatter.h
View file @
db3f0865
...
...
@@ -29,5 +29,6 @@ class Formatter : public QObject
public:
Q_INVOKABLE
QString
formatDuration
(
int
seconds
);
Q_INVOKABLE
QString
formatTime
(
const
QDateTime
&
time
);
};
src/qml/ConnectionDetailsPage.qml
View file @
db3f0865
...
...
@@ -22,7 +22,6 @@ import QtQuick 2.2
import
QtQuick
.
Layouts
1.1
import
QtQuick
.
Controls
2.4
import
org
.
kde
.
kirigami
2.4
as
Kirigami
import
org
.
kde
.
ktrip
0.1
import
org
.
kde
.
kpublictransport
1.0
Kirigami.Page
...
...
src/qml/ConnectionsPage.qml
View file @
db3f0865
...
...
@@ -22,7 +22,6 @@ import QtQuick 2.2
import
QtQuick
.
Layouts
1.1
import
QtQuick
.
Controls
2.4
import
org
.
kde
.
kirigami
2.4
as
Kirigami
import
org
.
kde
.
ktrip
0.1
import
org
.
kde
.
kpublictransport
1.0
as
KPT
Kirigami.Page
...
...
src/qml/
Start
Page.qml
→
src/qml/
JourneyQuery
Page.qml
View file @
db3f0865
File moved
src/qml/LocationQueryPage.qml
View file @
db3f0865
...
...
@@ -22,7 +22,6 @@ import QtQuick 2.2
import
QtQuick
.
Layouts
1.1
import
QtQuick
.
Controls
2.4
import
org
.
kde
.
kirigami
2.8
as
Kirigami
import
org
.
kde
.
ktrip
0.1
import
org
.
kde
.
kpublictransport
1.0
as
KPT
Kirigami.Page
...
...
src/qml/main.qml
View file @
db3f0865
...
...
@@ -27,5 +27,19 @@ Kirigami.ApplicationWindow
width
:
480
height
:
720
pageStack.initialPage
:
Qt
.
resolvedUrl
(
"
StartPage.qml
"
)
pageStack.initialPage
:
Qt
.
resolvedUrl
(
"
JourneyQueryPage.qml
"
)
globalDrawer
:
Kirigami.GlobalDrawer
{
actions
:
[
Kirigami.Action
{
text
:
i18n
(
"
Journey
"
)
onTriggered
:
pageStack
.
initialPage
=
Qt
.
resolvedUrl
(
"
JourneyQueryPage.qml
"
)
},
Kirigami.Action
{
text
:
i18n
(
"
Departures
"
)
onTriggered
:
pageStack
.
initialPage
=
Qt
.
resolvedUrl
(
"
DepartureQueryPage.qml
"
)
}
]
}
k
}
src/querycontroller.cpp
View file @
db3f0865
...
...
@@ -101,3 +101,12 @@ KPublicTransport::LocationRequest QueryController::createLocationRequest(const Q
return
req
;
}
KPublicTransport
::
DepartureRequest
QueryController
::
createDepartureRequest
()
{
KPublicTransport
::
DepartureRequest
req
;
req
.
setStop
(
m_start
);
QDateTime
depTime
=
QDateTime
::
fromString
(
m_departureDate
+
QStringLiteral
(
"T"
)
+
m_departureTime
,
Qt
::
ISODate
);
req
.
setDateTime
(
depTime
);
return
req
;
}
src/querycontroller.h
View file @
db3f0865
...
...
@@ -26,6 +26,7 @@
#include <KPublicTransport/Location>
#include <KPublicTransport/LocationRequest>
#include <KPublicTransport/JourneyRequest>
#include <KPublicTransport/DepartureRequest>
class
QueryController
:
public
QObject
{
...
...
@@ -53,6 +54,7 @@ public:
Q_INVOKABLE
KPublicTransport
::
JourneyRequest
createJourneyRequest
();
Q_INVOKABLE
KPublicTransport
::
LocationRequest
createLocationRequest
(
const
QString
name
);
Q_INVOKABLE
KPublicTransport
::
DepartureRequest
createDepartureRequest
();
Q_SIGNALS:
void
startChanged
();
...
...
src/resources.qrc
View file @
db3f0865
<!DOCTYPE RCC>
<RCC
version=
"1.0"
>
<qresource>
<file>
qml/main.qml
</file>
<file>
qml/
Start
Page.qml
</file>
<file>
qml/
JourneyQuery
Page.qml
</file>
<file>
qml/ConnectionsPage.qml
</file>
<file>
qml/LocationQueryPage.qml
</file>
<file>
qml/ConnectionDetailsPage.qml
</file>
<file>
qml/DatePickerButton.qml
</file>
<file>
qml/TimePickerButton.qml
</file>
<file>
qml/DepartureQueryPage.qml
</file>
<file>
qml/DeparturesPage.qml
</file>
<file>
qtquickcontrols2.conf
</file>
</qresource>
</RCC>
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