Skip to content
This repository has been archived by the owner on Jul 22, 2021. It is now read-only.

Starting from clean slate for the UI #23

Merged
merged 39 commits into from
Jan 4, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
acf367a
Starting from clean slate
DylanVanAssche Dec 22, 2017
5765f25
FirstPage Connection selector
DylanVanAssche Dec 22, 2017
35b8e4c
Enforce gitignore for .pro.user files
DylanVanAssche Dec 22, 2017
7f3805c
FirstPage almost finished
DylanVanAssche Dec 23, 2017
14a15cc
Added GPLv3 license header to all files
DylanVanAssche Dec 23, 2017
8e4709a
Reformatted project file
DylanVanAssche Dec 23, 2017
7880bff
SettingsPage
DylanVanAssche Dec 23, 2017
5da190f
StationSelectorPage
DylanVanAssche Dec 25, 2017
cc44d52
Searching partly works, keyboard loses focus somewhere
DylanVanAssche Dec 25, 2017
c9f7576
Fixed small UI bugs
DylanVanAssche Dec 25, 2017
63c09e4
Bumped version already
DylanVanAssche Dec 25, 2017
465f459
Fixed StationSelectorPage focus loss
DylanVanAssche Dec 26, 2017
e90259a
Small UI bug
DylanVanAssche Dec 26, 2017
3d15f45
improved searching and reduced station map zoom
DylanVanAssche Dec 26, 2017
5f9eb69
Fixed liveboard arrival parsing
DylanVanAssche Dec 26, 2017
b243795
Initial LiveboardPage
DylanVanAssche Dec 26, 2017
a31ccba
Improved LiveBoardPage
DylanVanAssche Dec 26, 2017
e27e5b1
Fixed small bugs + improved LiveboardDelegate
DylanVanAssche Dec 27, 2017
2229b03
Fixed small parsing bugs
DylanVanAssche Dec 27, 2017
68a5636
Moved API instant to harbour-berail file to avoid multiple API instances
DylanVanAssche Dec 27, 2017
4d381a4
Unified GlassButton + initial TripPage
DylanVanAssche Dec 27, 2017
c7ba259
RPM build file delete
DylanVanAssche Dec 27, 2017
e580bbf
TripPage first steps
DylanVanAssche Dec 28, 2017
7c38fba
TripPage improvements
DylanVanAssche Dec 28, 2017
976d23d
First steps to display Vias in TripPage
DylanVanAssche Dec 29, 2017
dfbbef4
Show occupancy level and vias in TripPage
DylanVanAssche Dec 31, 2017
076fc5a
Use SVG images for occupancy
DylanVanAssche Dec 31, 2017
1548a8c
Reformatted GlassButton and GlassStationButton
DylanVanAssche Dec 31, 2017
728f506
Recent connections added
DylanVanAssche Jan 1, 2018
8791908
Touchhint Liveboard + fixed Disturbances text trunication
DylanVanAssche Jan 1, 2018
505887f
Fixed sorting for stations
DylanVanAssche Jan 2, 2018
3d2f9b2
Several bugfixes, improved error handling, init network recovery
DylanVanAssche Jan 3, 2018
990fe6c
Bugfixes, splitted Stop into subclasses
DylanVanAssche Jan 3, 2018
7cf987d
Added network recovery using DBus
DylanVanAssche Jan 3, 2018
be59bd7
Alert the user when via is missed
DylanVanAssche Jan 3, 2018
3d6fe2b
Added beta version of the 'walking' parameter
DylanVanAssche Jan 3, 2018
d2f3b18
Vehicle from Liveboard
DylanVanAssche Jan 4, 2018
02f56c9
Fixed several imports in RELEASE mode
DylanVanAssche Jan 4, 2018
a7d4845
Removed .pro.user file
DylanVanAssche Jan 4, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
FirstPage almost finished
  • Loading branch information
DylanVanAssche committed Dec 23, 2017
commit 7f3805c777dd64a12589ab3e3cf0613ac77cbba7
15 changes: 11 additions & 4 deletions harbour-berail.pro
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ SOURCES += src/harbour-berail.cpp \
src/models/vehiclelistmodel.cpp \
src/models/stationlistmodel.cpp \
src/models/connectionlistmodel.cpp \
src/models/vialistmodel.cpp
src/models/vialistmodel.cpp \
src/models/announcements.cpp \
src/models/remarks.cpp

OTHER_FILES += qml/harbour-berail.qml \
qml/cover/CoverPage.qml \
Expand All @@ -61,7 +63,9 @@ SAILFISHAPP_ICONS = 86x86 108x108 128x128 256x256

# to disable building translations every time, comment out the
# following CONFIG line
CONFIG += sailfishapp_i18n
CONFIG += sailfishapp_i18n \
sailfishapp_i18n_idbased \
sailfishapp_i18n_unfinished

# German translation is enabled as an example. If you aren't
# planning to localize your app, remember to comment out the
Expand Down Expand Up @@ -97,7 +101,8 @@ DISTFILES += \
qml/pages/js/disturbances.js \
qml/pages/components/DisturbancesView.qml \
qml/pages/DisturbancesPage.qml \
qml/pages/SettingsPage.qml
qml/pages/SettingsPage.qml \
translations/harbour-berail-en.ts

RESOURCES += \
qml/resources/resources.qrc
Expand All @@ -120,4 +125,6 @@ HEADERS += \
src/models/vehiclelistmodel.h \
src/models/stationlistmodel.h \
src/models/connectionlistmodel.h \
src/models/vialistmodel.h
src/models/vialistmodel.h \
src/models/announcements.h \
src/models/remarks.h
2 changes: 1 addition & 1 deletion harbour-berail.pro.user
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.2.1, 2017-12-22T19:55:29. -->
<!-- Written by QtCreator 4.2.1, 2017-12-23T12:55:50. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
Expand Down
40 changes: 40 additions & 0 deletions qml/components/AlertListDelegate.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* This file is part of BeRail.
*
* BeRail is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Foobar is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with BeRail. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.0
import Sailfish.Silica 1.0

ListItem {
width: ListView.view.width
contentHeight: column.height*1.1
enabled: model.hasLink
onClicked: enabled? Qt.openUrlExternally(model.link): undefined

Column {
id: column
width: parent.width
anchors.centerIn: parent
spacing: Theme.paddingSmall

SectionHeader {
text: model.title
}

TextLabel {
text: model.text
}
}
}
65 changes: 47 additions & 18 deletions qml/components/ConnectionSelectorDelegate.qml
Original file line number Diff line number Diff line change
@@ -1,12 +1,34 @@
/*
* This file is part of BeRail.
*
* BeRail is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Foobar is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with BeRail. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.0
import QtQml 2.2
import Sailfish.Silica 1.0
import "../components"

Column {
width: parent.width
property var currentDate: new Date()
spacing: Theme.paddingLarge

property date currentDate: new Date()
//% "From"
property string _fromText: qsTrId("berail-from")
//% "To"
property string _toText: qsTrId("berail-to")
property bool readyToPlan: settings.favouriteStations? from.iconText.length > 0 && to.iconText.length > 0: false
signal _changeStations()

on_ChangeStations: {
Expand All @@ -18,7 +40,6 @@ Column {
PageHeader {
// USE SFOS module to automatically retrieve app name TODO
title: "BeRail"
//: Description about BeRail being the official iRail app
//% "The official iRail app"
description: qsTrId("berail-official-irail-app")
}
Expand All @@ -27,7 +48,7 @@ Column {
width: parent.width

Column {
width: parent.width
width: parent.width - Theme.itemSizeMedium

GlassButton {
id: from
Expand All @@ -49,7 +70,7 @@ Column {
BackgroundItem {
width: Theme.itemSizeMedium
height: parent.height
enabled: from.iconText.length > 0 && to.iconText.length > 0
enabled: readyToPlan
opacity: enabled? fadeInValue: fadeOutValue
Behavior on opacity { FadeAnimator{} }
onClicked: _changeStations()
Expand All @@ -73,18 +94,19 @@ Column {
width: parent.width/1.75
//% "Date"
label: qsTrId("berail-date")
value: currentDate.getDate() + "/" + currentDate.getMonth() + "/" + currentDate.getFullYear().toString().substring(2,2)
value: currentDate.toLocaleDateString(Qt.locale(), Locale.ShortFormat)
onClicked: {
var dialog = pageStack.push(Qt.resolvedUrl("Sailfish.Silica.DatePickerDialog"), {
var dialog = pageStack.push(Qt.resolvedUrl("DateSelectorDialog.qml"), {
date: currentDate
})

dialog.accepted.connect(function() {
console.debug("Selected date: " + dialog.dateText)
var newDate = new Date(dialog.dateText)
currentDate.setDate(newDate.getDate())
currentDate.setMonth(newDate.setMonth())
currentDate.setFullYear(newDate.setFullYear())
console.debug("Selected date: " + dialog.date)
var newDate = dialog.date // Date dialog doesn't report JS Date object
newDate.setHours(currentDate.getHours())
newDate.setMinutes(currentDate.getMinutes())
newDate.setSeconds(currentDate.getSeconds())
currentDate = newDate;
})
}
}
Expand All @@ -94,20 +116,21 @@ Column {
width: parent.width - date.width
//% "Time"
label: qsTrId("berail-time")
value: currentDate.getHours() + ":" + currentDate.getMinutes()
value: currentDate.toLocaleTimeString(Qt.locale(), Locale.ShortFormat).substring(0,5) // Remove unused seconds

onClicked: {
var dialog = pageStack.push("Sailfish.Silica.TimePickerDialog", {
var dialog = pageStack.push("TimeSelectorDialog.qml", {
hour: currentDate.getHours(),
minute: currentDate.getMinutes()
})

dialog.accepted.connect(function() {
console.debug("Selected time: " + dialog.timeText)
var newTime = new Date(dialog.timeText)
currentDate.setHours(newTime.getHours())
currentDate.setMinutes(newTime.getMinutes())
currentDate.setSeconds(newTime.getSeconds())
console.debug("Selected time: " + dialog.time)
var newDate = dialog.time
newDate.setDate(currentDate.getDate())
newDate.setMonth(currentDate.getMonth())
newDate.setFullYear(currentDate.getFullYear())
currentDate = newDate;
})
}
}
Expand All @@ -126,4 +149,10 @@ Column {
date: date.value
})
}

// Spacer
Item {
width: parent.width
height: Theme.paddingSmall
}
}
66 changes: 66 additions & 0 deletions qml/components/DateSelectorDialog.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
* This file is part of BeRail.
*
* BeRail is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Foobar is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with BeRail. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.0
import Sailfish.Silica 1.0

Dialog {
id: datePickerDialog
property date _selectedDate: new Date()
property date date: new Date()

Column {
width: parent.width
spacing: datePickerDialog.isPortrait? Theme.paddingLarge: 0

DialogHeader {}

Label {
anchors.horizontalCenter: parent.horizontalCenter
text: _selectedDate.toLocaleDateString(Qt.locale(), Locale.LongFormat)
font.pixelSize: Theme.fontSizeLarge
}

DatePicker {
id: datePicker
anchors.horizontalCenter: parent.horizontalCenter
date: datePickerDialog.date
onDateChanged: _selectedDate = date
}
}

DockedPanel {
width: parent.width
height: button.height + Theme.paddingLarge
dock: Dock.Bottom
open: datePickerDialog.isPortrait

Button {
id: button
anchors.centerIn: parent
//% "Today"
text: qsTrId("berail-today")
onClicked:
{
datePicker.date = new Date()
}
}
}

onAccepted: {
date = _selectedDate
}
}
101 changes: 101 additions & 0 deletions qml/components/TimeSelectorClockItem.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
/*
* This file is part of BeRail.
*
* BeRail is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Foobar is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with BeRail. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.0
import Sailfish.Silica 1.0
import Nemo.Configuration 1.0

Row {
//: "translate as non-empty if am/pm indicator starts the 12h time pattern"
//% ""
property string startWithAp: qsTrId("components-la-time_start_with_ap")
property date time

layoutDirection: (startWithAp !== "" && startWithAp !== "components-la-time_start_with_ap") ? Qt.RightToLeft
: Qt.LeftToRight

Text {
id: timeText
color: Theme.primaryColor
font { pixelSize: Theme.fontSizeHuge; family: Theme.fontFamilyHeading }
text: {
if (timeFormatConfig.value === "24") {
return Format.formatDate(time, Format.TimeValueTwentyFourHours)
}
else
{
// this is retarded, yay for qt and js time formatting options
var hours = time.getHours()
if (hours === 0) {
hours = 12
}
else if (hours > 12) {
hours -= 12
}

//: Pattern for 12h time, h, hh, m, mm are supported, everything else left as is. escaping with ' not supported
//% "h:mm"
var result = qsTrId("components-la-12h_time_pattern_without_ap")
var zero = 0

if (result.indexOf("hh") !== -1) {
var hourString = ""
if (hours < 10) {
hourString = zero.toLocaleString()
}
hourString += hours.toLocaleString()
result = result.replace("hh", hourString)
}
else {
result = result.replace("h", hours.toLocaleString())
}

var minutes = time.getMinutes()
if (result.indexOf("mm") !== -1) {
var minuteString = ""
if (minutes < 10) {
minuteString = zero.toLocaleString()
}
minuteString += minutes.toLocaleString()
result = result.replace("mm", minuteString)
}
else {
result = result.replace("m", minutes.toLocaleString())
}

return result
}
}
}

Text {
anchors.baseline: timeText.baseline
visible: timeFormatConfig.value !== "24"
opacity: 0.4
color: Theme.primaryColor
font { pixelSize: timeText.font.pixelSize / 2.5; family: Theme.fontFamily; weight: Font.Bold }
text: time.getHours() < 12
//% "AM"
? qsTrId("jolla-clock-la-am")
//% "PM"
: qsTrId("jolla-clock-la-pm")
}

ConfigurationValue {
id: timeFormatConfig
key: "/sailfish/i18n/lc_timeformat24h"
}
}
Loading