Commit 49f50da3 authored by Martin Kozub's avatar Martin Kozub

Fixed error handling for to and via search fields on search page, added…

Fixed error handling for to and via search fields on search page, added clickable.json config file to simplify builds.
parent 69ef9504
......@@ -5,7 +5,7 @@ Api {
id: api
property var callback: null
onResponseChanged: {
if(callback && response) {
callback({
......@@ -14,7 +14,7 @@ Api {
});
}
else if(callback && !response) {
console.log("server not responing");
console.log("server not responing [" + statusCode + "]");
callback({
statusCode: "OFFLINE"
});
......
......@@ -9,11 +9,11 @@ Item {
id: searchItem
width: parent.width
height: childrenRect.height
property var selectedStop: null
property string value: textField.displayText
property bool running: itemActivity.running
function getData() {
var model = [];
for(var i = 0; i < optionsModel.count; i++) {
......@@ -26,7 +26,7 @@ Item {
value: value
};
}
function setData(data) {
data = data || {};
if(data.value) {
......@@ -45,14 +45,20 @@ Item {
selectedStop = data.selectedStop;
}
}
function abort() {
if(textField.cityOptions) {
textField.cityOptions.abort();
itemActivity.running = false;
}
}
function empty() {
abort();
textField.text = "";
selectedStop = null;
optionsModel.clear();
if(textField.cityOptions) {
textField.cityOptions.abort();
}
}
ColumnLayout {
......@@ -148,7 +154,9 @@ Item {
else {
optionsView.state = "hidden";
if(textField.cityOptions) {
textField.cityOptions.abort();
textField.cityOptions.abort();
selectedStop = null;
optionsModel.clear();
itemActivity.running = false;
}
......
......@@ -116,12 +116,15 @@ Page {
clip: true
function search() {
from.abort();
to.abort();
via.abort();
var fromVal = from.selectedStop ? from.selectedStop : from.value;
var toVal = to.selectedStop ? to.selectedStop : to.value;
var viaVal = advancedSearchSwitch.checked ? (via.selectedStop ? via.selectedStop : via.value) : null;
var selectedTransport = Transport.transportOptions.getSelectedTransport();
if(selectedTransport && fromVal && toVal) {
selectedTransport.abortAll();
......@@ -431,7 +434,7 @@ Page {
z: 9
property var searchFunction: searchPage.search
property var errorMessageComponent: errorMessage.value
property var errorMessageComponent: errorMessage
}
RowLayout {
......@@ -460,7 +463,7 @@ Page {
visible: advancedSearchSwitch.checked
property var searchFunction: searchPage.search
property var errorMessageComponent: errorMessage.value
property var errorMessageComponent: errorMessage
}
RowLayout {
......
......@@ -19,6 +19,7 @@ void Api::replyFinished(QNetworkReply* reply) {
QByteArray bytes = reply->readAll();
int statusCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
setResponse(QString::fromUtf8(bytes.data(), bytes.size()), statusCode);
//QTextStream(stdout) << statusCode << QString::fromUtf8(bytes.data(), bytes.size());
}
void Api::abort() {
......
......@@ -62,9 +62,11 @@ protected:
api_running = false;
api_response = response;
api_statusCode = statusCode;
Q_EMIT runningChanged();
Q_EMIT responseChanged();
Q_EMIT statusCodeChanged();
//QTextStream(stdout) << "statusCodeChanged, " << "api_statusCode: " << api_statusCode << ", api_response: " << api_response;
}
QString api_request;
......
{
"template": "qmake",
"sdk": "ubuntu-sdk-16.04"
}
......@@ -5,8 +5,8 @@ cd "${0%/*}"
# Delete build data
clickable clean
# Build the project
clickable -k 16.04 --arch="armhf" build
clickable build
# Package a .click
clickable -k 16.04 click-build
clickable click-build
# Review the package
click-review build/*.click
{
"template": "qmake",
"sdk": "ubuntu-sdk-16.04"
}
......@@ -9,7 +9,7 @@
"desktop": "Transport/Transport.desktop"
}
},
"version": "1.4.7",
"version": "1.4.9",
"maintainer": "Martin Kozub <zubozrout@gmail.com>",
"framework": "ubuntu-sdk-16.04"
}
......@@ -2,33 +2,34 @@
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-06-05 13:31+0000\n"
"POT-Creation-Date: 2018-06-06 20:17+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: Martin Kozub <zubozrout@gmail.com>, 2017\n"
"Language-Team: Czech (https://www.transifex.com/zubozrout/teams/75311/cs/)\n"
"Language: cs\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: cs\n"
"Plural-Forms: nplurals=4; plural=(n == 1 && n % 1 == 0) ? 0 : (n >= 2 && n <= 4 && n % 1 == 0) ? 1: (n % 1 != 0 ) ? 2 : 3;\n"
"Plural-Forms: nplurals=4; plural=(n == 1 && n % 1 == 0) ? 0 : (n >= 2 && n "
"<= 4 && n % 1 == 0) ? 1: (n % 1 != 0 ) ? 2 : 3;\n"
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/components/ConnectionDetailDelegate.qml:77
msgid "Station name"
msgstr "Název stanice"
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/components/ConnectionDetailDelegate.qml:84
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/pages/SearchPage.qml:497
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/pages/SearchPage.qml:500
msgid "Arrival"
msgstr "Příjezd"
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/components/ConnectionDetailDelegate.qml:91
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/pages/SearchPage.qml:497
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/pages/SearchPage.qml:500
msgid "Departure"
msgstr "Odjezd"
......@@ -121,15 +122,15 @@ msgid "To"
msgstr "Do"
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/components/RecentBottomEdge.qml:239
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/pages/SearchPage.qml:444
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/pages/SearchPage.qml:447
msgid "Via"
msgstr "Přes"
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/components/StopSearch.qml:71
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/components/StopSearch.qml:77
msgid "station name"
msgstr "název stanice"
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/components/StopSearch.qml:144
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/components/StopSearch.qml:150
msgid "Remote station search failed"
msgstr "Vyhledávání stanice skončilo chybou"
......@@ -147,27 +148,26 @@ msgid ""
"Transport is here to allow you searching for Czech and Slovak public "
"transport connections."
msgstr ""
"Transport je zde k tomu aby Vám umožnil vyhledávat česká a slovenská spojení"
" veřejné dopravy."
"Transport je zde k tomu aby Vám umožnil vyhledávat česká a slovenská spojení "
"veřejné dopravy."
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/pages/AboutPage.qml:50
msgid ""
"This application is based upon an API provided by CHAPS s.r.o. company."
msgid "This application is based upon an API provided by CHAPS s.r.o. company."
msgstr "Tato aplikace využívá API poskytnuté společností CHAPS s.r.o."
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/pages/AboutPage.qml:50
msgid ""
"You can find the documentation of the API service here "
"http://docs.crws.apiary.io/"
"You can find the documentation of the API service here http://docs.crws."
"apiary.io/"
msgstr ""
"Dokumentaci k využívanému API můžete najít na adrese "
"http://docs.crws.apiary.io/"
"Dokumentaci k využívanému API můžete najít na adrese http://docs.crws.apiary."
"io/"
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/pages/AboutPage.qml:51
msgid ""
"Feel free to report bugs on the github page but please note many of the "
"existing bugs are know and the reason why they are not fixed yet is the fact"
" I don't have enough time to take care of those just yet."
"existing bugs are know and the reason why they are not fixed yet is the fact "
"I don't have enough time to take care of those just yet."
msgstr ""
"Chyby nahlašujte na stránce projektu na GitHubu. Mějte však na paměti, že o "
"mnoha chybách autor aplikace ví a pouze se k nim neměl čas zatím dostat."
......@@ -179,13 +179,13 @@ msgstr "Podívejte se na stránku projektu na GitLabu."
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/pages/AboutPage.qml:53
msgid ""
"GDPR notice: CHAPS s.r.o. API doesn't collect any personal data but can log "
"searched values combined with IP addresses and a platform string passed with"
" every single query - \"ubuntu\"."
"searched values combined with IP addresses and a platform string passed with "
"every single query - \"ubuntu\"."
msgstr ""
"Upozornění v souvislosti s obecným nařízením o ochraně osobních údajů GDPR: "
"API společnosti CHAPS s.r.o. nesbírá žádné osobní údaje, ale může "
"zaznamenávat vyhledávané údaje v kombinaci s IP adresami a názvem operačního"
" systému, který tato aplikace předává při každém dotazu - \"ubuntu\"."
"zaznamenávat vyhledávané údaje v kombinaci s IP adresami a názvem operačního "
"systému, který tato aplikace předává při každém dotazu - \"ubuntu\"."
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/pages/ConnectionDetailPage.qml:14
msgid "Connection detail"
......@@ -323,19 +323,19 @@ msgstr "Nastavení"
msgid "About"
msgstr "O aplikaci"
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/pages/SearchPage.qml:153
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/pages/SearchPage.qml:156
msgid "Search failed"
msgstr "Vyhledávání se nepovedlo"
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/pages/SearchPage.qml:473
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/pages/SearchPage.qml:476
msgid "Custom date"
msgstr "Vlastní datum"
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/pages/SearchPage.qml:516
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/pages/SearchPage.qml:519
msgid "Abort search"
msgstr "Přerušit vyhledávání"
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/pages/SearchPage.qml:516
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/pages/SearchPage.qml:519
msgid "Search"
msgstr "Hledat"
......
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-06-05 13:31+0000\n"
"POT-Creation-Date: 2018-06-06 20:17+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......@@ -23,12 +23,12 @@ msgid "Station name"
msgstr ""
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/components/ConnectionDetailDelegate.qml:84
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/pages/SearchPage.qml:497
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/pages/SearchPage.qml:500
msgid "Arrival"
msgstr ""
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/components/ConnectionDetailDelegate.qml:91
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/pages/SearchPage.qml:497
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/pages/SearchPage.qml:500
msgid "Departure"
msgstr ""
......@@ -117,15 +117,15 @@ msgid "To"
msgstr ""
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/components/RecentBottomEdge.qml:239
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/pages/SearchPage.qml:444
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/pages/SearchPage.qml:447
msgid "Via"
msgstr ""
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/components/StopSearch.qml:71
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/components/StopSearch.qml:77
msgid "station name"
msgstr ""
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/components/StopSearch.qml:144
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/components/StopSearch.qml:150
msgid "Remote station search failed"
msgstr ""
......@@ -308,19 +308,19 @@ msgstr ""
msgid "About"
msgstr ""
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/pages/SearchPage.qml:153
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/pages/SearchPage.qml:156
msgid "Search failed"
msgstr ""
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/pages/SearchPage.qml:473
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/pages/SearchPage.qml:476
msgid "Custom date"
msgstr ""
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/pages/SearchPage.qml:516
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/pages/SearchPage.qml:519
msgid "Abort search"
msgstr ""
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/pages/SearchPage.qml:516
#: /home/zubozrout/Dokumenty/ubports/transport/Transport/Transport/pages/SearchPage.qml:519
msgid "Search"
msgstr ""
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment