In der Zeit vom 27.05.19 16 Uhr bis zum 28.05.19 10 Uhr steht die GitLab Instanz der RWTH Aachen nicht zur Verfügung. Es findet ein Umzug des angeschlossenen Storage Systems statt, so dass in der genannten Zeit keine Repositories angelegt, gelöscht oder verändert werden können. Wir bitten um Ihr Verständnis. // In the time from 27.05.19 16 o'clock to 28.05.19 10 o'clock the GitLab instance of the RWTH Aachen is not available. The connected storage system will be moved so that no repositories can be created, deleted or changed during this time. We ask for your understanding.

Commit 714728eb authored by Martin Kröning's avatar Martin Kröning

Rename durationLabel to timeLabel

Fixes #2.
parent f3f887b3
......@@ -18,7 +18,7 @@ public:
void addOrReplaceCar(std::string_view vehicleName, std::string_view laneName,
double positionOnLane, double speed,
double remainingFuel);
void setDurationLabel(std::chrono::minutes minutes);
void setTimeLabel(std::chrono::minutes time);
private:
MapApp *mapApp;
......
......@@ -40,7 +40,7 @@ void Map::simulate(const std::chrono::seconds duration,
junction->processVehicles(time);
junction->drawVehicles(mapApp);
}
mapApp.setDurationLabel(std::chrono::minutes(static_cast<int>(time * 60)));
mapApp.setTimeLabel(std::chrono::minutes(static_cast<int>(time * 60)));
std::this_thread::sleep_for(std::chrono::nanoseconds(
static_cast<size_t>(std::nano::den / frequency)));
}
......
......@@ -39,6 +39,6 @@ void MapAppAPIWrapper::addOrReplaceCar(std::string_view vehicleName,
positionOnLane, speed, remainingFuel);
}
void MapAppAPIWrapper::setDurationLabel(const std::chrono::minutes minutes) {
mapAppSetDurationLabel(mapApp, minutes.count());
void MapAppAPIWrapper::setTimeLabel(const std::chrono::minutes time) {
mapAppSetTimeLabel(mapApp, time.count());
}
......@@ -52,7 +52,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Duration: </property>
<property name="label" translatable="yes">Time: </property>
</object>
<packing>
<property name="left_attach">0</property>
......@@ -60,7 +60,7 @@
</packing>
</child>
<child>
<object class="GtkLabel" id="durationLabel">
<object class="GtkLabel" id="timeLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">00:00</property>
......
......@@ -33,7 +33,7 @@ public:
void addOrReplaceCar(const std::string &vehicleName,
const std::string &laneName, double positionOnLane,
double speed, double remainingFuel);
void setDurationLabel(std::chrono::minutes minutes);
void setTimeLabel(std::chrono::minutes time);
private:
static const std::vector<std::string> zoomLevels;
......@@ -51,7 +51,7 @@ private:
MapArea mapArea;
Gtk::Window win;
Gtk::ListBox *listBox;
Gtk::Label *durationLabel;
Gtk::Label *timeLabel;
Gtk::Label *laneLabel;
Gtk::Label *lanePositionPercentageLabel;
Gtk::Label *speedLabel;
......
......@@ -66,9 +66,9 @@ void mapAppAddOrReplaceCar(MapApp *mapApp, const char *vehicleName,
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 mapAppSetDurationLabel(MapApp *mapApp, int64_t minutes);
void mapAppSetTimeLabel(MapApp *mapApp, int64_t minutes);
#ifdef __cplusplus
}
......
......@@ -31,7 +31,7 @@ const std::vector<std::string> MapApp::zoomLevels = {"60%", "80%", "100%"};
MapApp::MapApp(std::string windowTitle)
: app(Gtk::Application::create()),
mapArea(junctions, roads, nameVehicleMap), listBox(nullptr),
durationLabel(nullptr), laneLabel(nullptr),
timeLabel(nullptr), laneLabel(nullptr),
lanePositionPercentageLabel(nullptr), speedLabel(nullptr),
remainingFuelLabel(nullptr), zoomComboBoxText(nullptr) {
win.set_title(std::move(windowTitle));
......@@ -46,7 +46,7 @@ MapApp::MapApp(std::string windowTitle)
builder->get_widget("listBox", listBox);
builder->get_widget("durationLabel", durationLabel);
builder->get_widget("timeLabel", timeLabel);
builder->get_widget("laneLabel", laneLabel);
builder->get_widget("lanePositionPercentageLabel",
lanePositionPercentageLabel);
......@@ -140,15 +140,15 @@ void MapApp::refreshVehicleLabels(const DrawableVehicle &vehicle) {
remainingFuelLabel->set_text(remainingFuelBuffer.str());
}
void MapApp::setDurationLabel(const std::chrono::minutes minutes) {
std::ostringstream durationBuffer;
durationBuffer
void MapApp::setTimeLabel(const std::chrono::minutes minutes) {
std::ostringstream timeBuffer;
timeBuffer
<< std::setfill('0') << std::setw(2)
<< std::chrono::duration_cast<std::chrono::hours>(minutes).count() << ':'
<< std::setw(2) << minutes.count() % 60;
Glib::signal_idle().connect_once(
[this, durationString = durationBuffer.str()]() mutable {
durationLabel->set_text(std::move(durationString));
[this, timeString = timeBuffer.str()]() mutable {
timeLabel->set_text(std::move(timeString));
},
Glib::PRIORITY_HIGH_IDLE + 20);
}
......
......@@ -49,6 +49,6 @@ void mapAppAddOrReplaceCar(MapApp *mapApp, gsl::czstring<> vehicleName,
remainingFuel);
}
void mapAppSetDurationLabel(MapApp *mapApp, int64_t minutes) {
mapApp->setDurationLabel(std::chrono::minutes(minutes));
void mapAppSetTimeLabel(MapApp *mapApp, int64_t minutes) {
mapApp->setTimeLabel(std::chrono::minutes(minutes));
}
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