-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconnection.cpp
50 lines (32 loc) · 932 Bytes
/
connection.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "connection.h"
Connection::Connection()
{
mainMode="";
subMode="";
connectionType="";
destinationName="";
}
int Connection::getMinutesToDeparture(QDateTime aktCas)
{
int output= -expectedDepartureTime.secsTo(aktCas)/60 ;
return output;
}
QString Connection::expectedDepartureTimeQString()
{
return expectedDepartureTime.toString(Qt::ISODate);
}
QString Connection::scheduledDepartureTimeQString()
{
return scheduledDepartureTime.toString(Qt::ISODate);
}
QVector<Connection> Connection::orderConnectionsByExpectedDeparture(QVector<Connection> vstup)
{
qDebug()<<Q_FUNC_INFO;
std::sort(vstup.begin(),vstup.end(),Connection::compareConnections );
return vstup;
}
bool Connection::compareConnections(const Connection &d1, const Connection &d2)
{
// return d1.smer < d2.smer; // sort by namefile
return d1.expectedDepartureTime <d2.expectedDepartureTime;
}