#
#-------------------------------------------------
-VERSION = 0.5.1
+VERSION = 0.6.0
USE_RESOURCES = 0
QT += network
CONFIG += qt
-#CONFIG += link_pkgconfig
+CONFIG += link_pkgconfig
lessThan(QT_MAJOR_VERSION, 5) {
QT += webkit
resources/harmattan/qml/DelayIndicator.qml \
resources/harmattan/qml/StationScheduleDelegate.qml \
resources/sailfish/qml/main.qml \
+ resources/sailfish/qml/pages/AboutPage.qml \
resources/sailfish/qml/pages/StationListPage.qml \
- resources/sailfish/qml/pages/StationPage.qml
+ resources/sailfish/qml/pages/StationPage.qml \
+ resources/sailfish/qml/pages/components/DelayIndicator.qml \
+ resources/sailfish/qml/pages/components/StationScheduleDelegate.qml
OTHER_FILES += \
resources/sailfish/applications/quandoparte.desktop \
qml.files = resources/sailfish/qml/*.qml \
resources/sailfish/qml/*.js \
resources/sailfish/qml/pages \
+ resources/sailfish/qml/pages/components \
resources/sailfish/qml/cover
qml.path = $$DATADIR/qml
INSTALLS += qml
#include <QtGlobal>
#if (QT_VERSION >= QT_VERSION_CHECK(5, 1, 0))
-#include <QtGui/QGuiApplication>
+#include <QtWidgets/QApplication>
#else
#include <QtGui/QApplication>
#endif
Q_DECL_EXPORT int main(int argc, char *argv[])
{
#if (QT_VERSION >= QT_VERSION_CHECK(5, 1, 0))
- QScopedPointer< QGuiApplication > a(new QGuiApplication(argc, argv));
+ QScopedPointer< QApplication > a(new QApplication(argc, argv));
#elif TARGET_PLATFORM_HARMATTAN
QScopedPointer< QApplication > a(MDeclarativeCache::qApplication(argc, argv));
#else
{
// TODO compile RegExp on change, or find a way to cleanly use
// stationListProxyModel.filterRegExp
- if (searchField.text.length) {
- var r = new RegExp(searchField.text, 'i')
+ if (searchPattern.length) {
+ var r = new RegExp(searchPattern, 'i')
var match = r.exec(s)
- return s.replace(r, '<span style="text-decoration:underline;color:' + color + ';">' +
- match + '</span>')
+ console.log('s is ' + s);
+ if (match) {
+ return s.replace(r, '<font color="' + color + '">' +
+ match + '</font>')
+ } else {
+ return s
+ }
} else {
return s
}
import "StationListPage.js" as Private
Page {
- property variant stationView
id: stationListPage
+ property variant stationView
+ property string searchPattern
Binding {
target: stationListProxyModel
property: "searchPattern"
- value: searchField.text
- }
- Binding {
- target: stationListProxyModel
- property: "sortingMode"
- value: header.currentIndex
- }
- Binding {
- target: stationListView
- property: "section.property"
- value: header.currentIndex === 0 ? "name" : ""
+ value: stationListPage.searchPattern
}
SilicaListView {
id: stationListView
clip: true
width: parent.width
cacheBuffer: 10
- anchors.fill: parent
+ anchors.top: parent.top
+ anchors.bottom: parent.bottom
model: stationListProxyModel
- header: Column {
- ComboBox {
- id: header
- currentIndex: stationListProxyModel.sortingMode
- menu: ContextMenu {
- MenuItem {
- text: qsTr("by Name")
- }
- MenuItem {
- text: qsTr("by Distance")
- }
- MenuItem {
- text: qsTr("Recently Seen")
- }
- }
- label: qsTr("Stations")
+ PullDownMenu {
+ MenuItem {
+ text: qsTr("About Quando Parte")
+ onClicked: pageStack.push(Qt.resolvedUrl("AboutPage.qml"))
+ }
+ MenuItem {
+ text: qsTr("Stations by Name")
+ onClicked: stationListProxyModel.sortingMode = StationListProxyModel.AlphaSorting
+ }
+ MenuItem {
+ text: qsTr("Stations by Distance")
+ onClicked: stationListProxyModel.sortingMode = StationListProxyModel.DistanceSorting
}
- SearchField {
- id: searchField
- placeholderText: qsTr("Search station...")
+ MenuItem {
+ text: qsTr("Stations Recently Seen")
+ onClicked: stationListProxyModel.sortingMode = StationListProxyModel.RecentUsageSorting
}
}
+ header: SearchField {
+ id: searchField
+ placeholderText: qsTr("Search station...")
+ onTextChanged: stationListPage.searchPattern = searchField.text
+ width: stationListPage.width
+ }
+ delegate: BackgroundItem {
+ id: listItem
+ height: Theme.itemSizeSmall
+ width: parent.width
+ Label {
+ id: mainText
+ x: Theme.paddingLarge
+ textFormat: Text.StyledText
+ text: model.name ? Private.highlightSearch(model.name, Theme.highlightColor) : ""
+ }
+ onClicked: Private.loadStation(model.name, model.code)
+ }
section {
criteria: ViewSection.FirstCharacter
- delegate: Item {
- width: parent.width
- height: Theme.itemSizeSmall
- anchors {
- margins: Theme.paddingMedium
- }
- Image {
- anchors {
- left: parent.left
- right: sectionLabel.left
- verticalCenter: parent.verticalCenter
- margins: Theme.paddingMedium
- }
- source: "image://theme/meegotouch-separator-" + (theme.inverted ? "inverted-" : "") + "background-horizontal"
- }
- Label {
- id: sectionLabel
- anchors {
- right: sectionRightMargin.left
- verticalCenter: parent.verticalCenter
- }
- text: section
- }
- Item {
- id: sectionRightMargin
- anchors {
- right: parent.right
- }
- width: Theme.paddingMedium
- height: Theme.paddingMedium
- }
- }
delegate: BackgroundItem {
- id: listItem
height: Theme.itemSizeSmall
width: parent.width
Label {
- id: mainText
- x: Theme.paddingLarge
- text: Private.highlightSearch(model.name, Theme.highlightColor)
+ id: sectionLabel
+ text: section
}
- onClicked: Private.loadStation(model.name, model.code)
}
}
}
- ScrollDecorator {
- id: decorator
- flickable: stationListView
- }
}
break;
}
if (mode == StationListProxyModel::DistanceSorting) {
- positionInfoSource->startUpdates();
+ if (positionInfoSource) {
+ positionInfoSource->startUpdates();
+ }
} else {
-#if 0
- positionInfoSource->stopUpdates();
-#endif
+ if (positionInfoSource) {
+ positionInfoSource->stopUpdates();
+ }
}
invalidate();
sort(0);
return d->delayClass;
}
-void StationScheduleItem::setDelayClass(const int value)
+void StationScheduleItem::setDelayClass(int value)
{
d->delayClass = value;
}
void setDelay(const QString &value);
int delayClass();
- void setDelayClass(const int value);
+ void setDelayClass(int value);
QString &expectedPlatform();
void setExpectedPlatform(const QString &value);
emit layoutAboutToBeChanged();
beginResetModel();
-#if (QT_VERSION <= QT_VERSION_CHECK(5, 0, 0))
QWebPage page;
page.mainFrame()->setContent(htmlReply, "text/html", baseUrl);
QWebElement doc = page.mainFrame()->documentElement();
if (current.isNull())
break;
}
-#endif
endResetModel();
emit layoutChanged();
}