Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
P
PI2 View
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PI2
PI2 View
Commits
714728eb
Commit
714728eb
authored
Feb 01, 2019
by
Martin Kröning
🦀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename durationLabel to timeLabel
Fixes
#2
.
parent
f3f887b3
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
19 additions
and
19 deletions
+19
-19
pi2-demo/include/MapAppAPIWrapper.hpp
pi2-demo/include/MapAppAPIWrapper.hpp
+1
-1
pi2-demo/src/Map.cpp
pi2-demo/src/Map.cpp
+1
-1
pi2-demo/src/MapAppAPIWrapper.cpp
pi2-demo/src/MapAppAPIWrapper.cpp
+2
-2
pi2-view/data/pi2-view.glade
pi2-view/data/pi2-view.glade
+2
-2
pi2-view/include/MapApp.hpp
pi2-view/include/MapApp.hpp
+2
-2
pi2-view/include/pi2-view.h
pi2-view/include/pi2-view.h
+2
-2
pi2-view/src/MapApp.cpp
pi2-view/src/MapApp.cpp
+7
-7
pi2-view/src/pi2-view.cpp
pi2-view/src/pi2-view.cpp
+2
-2
No files found.
pi2-demo/include/MapAppAPIWrapper.hpp
View file @
714728eb
...
@@ -18,7 +18,7 @@ public:
...
@@ -18,7 +18,7 @@ public:
void
addOrReplaceCar
(
std
::
string_view
vehicleName
,
std
::
string_view
laneName
,
void
addOrReplaceCar
(
std
::
string_view
vehicleName
,
std
::
string_view
laneName
,
double
positionOnLane
,
double
speed
,
double
positionOnLane
,
double
speed
,
double
remainingFuel
);
double
remainingFuel
);
void
set
DurationLabel
(
std
::
chrono
::
minutes
minutes
);
void
set
TimeLabel
(
std
::
chrono
::
minutes
time
);
private:
private:
MapApp
*
mapApp
;
MapApp
*
mapApp
;
...
...
pi2-demo/src/Map.cpp
View file @
714728eb
...
@@ -40,7 +40,7 @@ void Map::simulate(const std::chrono::seconds duration,
...
@@ -40,7 +40,7 @@ void Map::simulate(const std::chrono::seconds duration,
junction
->
processVehicles
(
time
);
junction
->
processVehicles
(
time
);
junction
->
drawVehicles
(
mapApp
);
junction
->
drawVehicles
(
mapApp
);
}
}
mapApp
.
set
Duration
Label
(
std
::
chrono
::
minutes
(
static_cast
<
int
>
(
time
*
60
)));
mapApp
.
set
Time
Label
(
std
::
chrono
::
minutes
(
static_cast
<
int
>
(
time
*
60
)));
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
nanoseconds
(
std
::
this_thread
::
sleep_for
(
std
::
chrono
::
nanoseconds
(
static_cast
<
size_t
>
(
std
::
nano
::
den
/
frequency
)));
static_cast
<
size_t
>
(
std
::
nano
::
den
/
frequency
)));
}
}
...
...
pi2-demo/src/MapAppAPIWrapper.cpp
View file @
714728eb
...
@@ -39,6 +39,6 @@ void MapAppAPIWrapper::addOrReplaceCar(std::string_view vehicleName,
...
@@ -39,6 +39,6 @@ void MapAppAPIWrapper::addOrReplaceCar(std::string_view vehicleName,
positionOnLane
,
speed
,
remainingFuel
);
positionOnLane
,
speed
,
remainingFuel
);
}
}
void
MapAppAPIWrapper
::
set
DurationLabel
(
const
std
::
chrono
::
minutes
minutes
)
{
void
MapAppAPIWrapper
::
set
TimeLabel
(
const
std
::
chrono
::
minutes
time
)
{
mapAppSet
DurationLabel
(
mapApp
,
minutes
.
count
());
mapAppSet
TimeLabel
(
mapApp
,
time
.
count
());
}
}
pi2-view/data/pi2-view.glade
View file @
714728eb
...
@@ -52,7 +52,7 @@
...
@@ -52,7 +52,7 @@
<property
name=
"visible"
>
True
</property>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"halign"
>
end
</property>
<property
name=
"halign"
>
end
</property>
<property
name=
"label"
translatable=
"yes"
>
Duration
:
</property>
<property
name=
"label"
translatable=
"yes"
>
Time
:
</property>
</object>
</object>
<packing>
<packing>
<property
name=
"left_attach"
>
0
</property>
<property
name=
"left_attach"
>
0
</property>
...
@@ -60,7 +60,7 @@
...
@@ -60,7 +60,7 @@
</packing>
</packing>
</child>
</child>
<child>
<child>
<object
class=
"GtkLabel"
id=
"
duration
Label"
>
<object
class=
"GtkLabel"
id=
"
time
Label"
>
<property
name=
"visible"
>
True
</property>
<property
name=
"visible"
>
True
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"can_focus"
>
False
</property>
<property
name=
"label"
translatable=
"yes"
>
00:00
</property>
<property
name=
"label"
translatable=
"yes"
>
00:00
</property>
...
...
pi2-view/include/MapApp.hpp
View file @
714728eb
...
@@ -33,7 +33,7 @@ public:
...
@@ -33,7 +33,7 @@ public:
void
addOrReplaceCar
(
const
std
::
string
&
vehicleName
,
void
addOrReplaceCar
(
const
std
::
string
&
vehicleName
,
const
std
::
string
&
laneName
,
double
positionOnLane
,
const
std
::
string
&
laneName
,
double
positionOnLane
,
double
speed
,
double
remainingFuel
);
double
speed
,
double
remainingFuel
);
void
set
DurationLabel
(
std
::
chrono
::
minutes
minutes
);
void
set
TimeLabel
(
std
::
chrono
::
minutes
time
);
private:
private:
static
const
std
::
vector
<
std
::
string
>
zoomLevels
;
static
const
std
::
vector
<
std
::
string
>
zoomLevels
;
...
@@ -51,7 +51,7 @@ private:
...
@@ -51,7 +51,7 @@ private:
MapArea
mapArea
;
MapArea
mapArea
;
Gtk
::
Window
win
;
Gtk
::
Window
win
;
Gtk
::
ListBox
*
listBox
;
Gtk
::
ListBox
*
listBox
;
Gtk
::
Label
*
duration
Label
;
Gtk
::
Label
*
time
Label
;
Gtk
::
Label
*
laneLabel
;
Gtk
::
Label
*
laneLabel
;
Gtk
::
Label
*
lanePositionPercentageLabel
;
Gtk
::
Label
*
lanePositionPercentageLabel
;
Gtk
::
Label
*
speedLabel
;
Gtk
::
Label
*
speedLabel
;
...
...
pi2-view/include/pi2-view.h
View file @
714728eb
...
@@ -66,9 +66,9 @@ void mapAppAddOrReplaceCar(MapApp *mapApp, const char *vehicleName,
...
@@ -66,9 +66,9 @@ void mapAppAddOrReplaceCar(MapApp *mapApp, const char *vehicleName,
double
speed
,
double
remainingFuel
);
double
speed
,
double
remainingFuel
);
/**
/**
* Sets the
duration
label of \p mapApp to \p minutes
* Sets the
time
label of \p mapApp to \p minutes
*/
*/
void
mapAppSet
Duration
Label
(
MapApp
*
mapApp
,
int64_t
minutes
);
void
mapAppSet
Time
Label
(
MapApp
*
mapApp
,
int64_t
minutes
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
...
...
pi2-view/src/MapApp.cpp
View file @
714728eb
...
@@ -31,7 +31,7 @@ const std::vector<std::string> MapApp::zoomLevels = {"60%", "80%", "100%"};
...
@@ -31,7 +31,7 @@ const std::vector<std::string> MapApp::zoomLevels = {"60%", "80%", "100%"};
MapApp
::
MapApp
(
std
::
string
windowTitle
)
MapApp
::
MapApp
(
std
::
string
windowTitle
)
:
app
(
Gtk
::
Application
::
create
()),
:
app
(
Gtk
::
Application
::
create
()),
mapArea
(
junctions
,
roads
,
nameVehicleMap
),
listBox
(
nullptr
),
mapArea
(
junctions
,
roads
,
nameVehicleMap
),
listBox
(
nullptr
),
duration
Label
(
nullptr
),
laneLabel
(
nullptr
),
time
Label
(
nullptr
),
laneLabel
(
nullptr
),
lanePositionPercentageLabel
(
nullptr
),
speedLabel
(
nullptr
),
lanePositionPercentageLabel
(
nullptr
),
speedLabel
(
nullptr
),
remainingFuelLabel
(
nullptr
),
zoomComboBoxText
(
nullptr
)
{
remainingFuelLabel
(
nullptr
),
zoomComboBoxText
(
nullptr
)
{
win
.
set_title
(
std
::
move
(
windowTitle
));
win
.
set_title
(
std
::
move
(
windowTitle
));
...
@@ -46,7 +46,7 @@ MapApp::MapApp(std::string windowTitle)
...
@@ -46,7 +46,7 @@ MapApp::MapApp(std::string windowTitle)
builder
->
get_widget
(
"listBox"
,
listBox
);
builder
->
get_widget
(
"listBox"
,
listBox
);
builder
->
get_widget
(
"
durationLabel"
,
duration
Label
);
builder
->
get_widget
(
"
timeLabel"
,
time
Label
);
builder
->
get_widget
(
"laneLabel"
,
laneLabel
);
builder
->
get_widget
(
"laneLabel"
,
laneLabel
);
builder
->
get_widget
(
"lanePositionPercentageLabel"
,
builder
->
get_widget
(
"lanePositionPercentageLabel"
,
lanePositionPercentageLabel
);
lanePositionPercentageLabel
);
...
@@ -140,15 +140,15 @@ void MapApp::refreshVehicleLabels(const DrawableVehicle &vehicle) {
...
@@ -140,15 +140,15 @@ void MapApp::refreshVehicleLabels(const DrawableVehicle &vehicle) {
remainingFuelLabel
->
set_text
(
remainingFuelBuffer
.
str
());
remainingFuelLabel
->
set_text
(
remainingFuelBuffer
.
str
());
}
}
void
MapApp
::
set
Duration
Label
(
const
std
::
chrono
::
minutes
minutes
)
{
void
MapApp
::
set
Time
Label
(
const
std
::
chrono
::
minutes
minutes
)
{
std
::
ostringstream
duration
Buffer
;
std
::
ostringstream
time
Buffer
;
duration
Buffer
time
Buffer
<<
std
::
setfill
(
'0'
)
<<
std
::
setw
(
2
)
<<
std
::
setfill
(
'0'
)
<<
std
::
setw
(
2
)
<<
std
::
chrono
::
duration_cast
<
std
::
chrono
::
hours
>
(
minutes
).
count
()
<<
':'
<<
std
::
chrono
::
duration_cast
<
std
::
chrono
::
hours
>
(
minutes
).
count
()
<<
':'
<<
std
::
setw
(
2
)
<<
minutes
.
count
()
%
60
;
<<
std
::
setw
(
2
)
<<
minutes
.
count
()
%
60
;
Glib
::
signal_idle
().
connect_once
(
Glib
::
signal_idle
().
connect_once
(
[
this
,
durationString
=
duration
Buffer
.
str
()]()
mutable
{
[
this
,
timeString
=
time
Buffer
.
str
()]()
mutable
{
durationLabel
->
set_text
(
std
::
move
(
duration
String
));
timeLabel
->
set_text
(
std
::
move
(
time
String
));
},
},
Glib
::
PRIORITY_HIGH_IDLE
+
20
);
Glib
::
PRIORITY_HIGH_IDLE
+
20
);
}
}
...
...
pi2-view/src/pi2-view.cpp
View file @
714728eb
...
@@ -49,6 +49,6 @@ void mapAppAddOrReplaceCar(MapApp *mapApp, gsl::czstring<> vehicleName,
...
@@ -49,6 +49,6 @@ void mapAppAddOrReplaceCar(MapApp *mapApp, gsl::czstring<> vehicleName,
remainingFuel
);
remainingFuel
);
}
}
void
mapAppSet
Duration
Label
(
MapApp
*
mapApp
,
int64_t
minutes
)
{
void
mapAppSet
Time
Label
(
MapApp
*
mapApp
,
int64_t
minutes
)
{
mapApp
->
set
Duration
Label
(
std
::
chrono
::
minutes
(
minutes
));
mapApp
->
set
Time
Label
(
std
::
chrono
::
minutes
(
minutes
));
}
}
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