Commit 4fd021f2 authored by Martin Kröning's avatar Martin Kröning

Rework interface

Move the infoBox to the left
parent a0e73151
......@@ -11,29 +11,6 @@
<object class="GtkBox" id="box">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkScrolledWindow" id="scrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<property name="propagate_natural_width">True</property>
<property name="propagate_natural_height">True</property>
<child>
<object class="GtkViewport" id="viewport">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
......@@ -47,109 +24,98 @@
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="row_spacing">5</property>
<property name="column_spacing">5</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Time: </property>
<property name="halign">start</property>
<property name="label" translatable="yes">Scale:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="timeLabel">
<object class="GtkComboBoxText" id="zoomComboBoxText">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">00:00</property>
<attributes>
<attribute name="font-desc" value="Monospace 10"/>
</attributes>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry">
<property name="can_focus">True</property>
<property name="width_chars">5</property>
<property name="input_purpose">digits</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
<property name="width">2</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Remaining fuel: </property>
<property name="halign">start</property>
<property name="label" translatable="yes">Time: </property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">6</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="remainingFuelLabel">
<object class="GtkLabel" id="timeLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">0.00</property>
<property name="halign">start</property>
<property name="label" translatable="yes">00:00</property>
<attributes>
<attribute name="font-desc" value="Monospace 10"/>
</attributes>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">6</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<object class="GtkSeparator">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes"> l</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">6</property>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Speed: </property>
<property name="halign">start</property>
<property name="label" translatable="yes">Drives on: </property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">5</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="speedLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">0.00</property>
<attributes>
<attribute name="font-desc" value="Monospace 10"/>
</attributes>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">5</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<object class="GtkLabel" id="laneLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes"> km/h</property>
<property name="label" translatable="yes">lane</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">5</property>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
......@@ -157,10 +123,10 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes"> %</property>
<property name="label" translatable="yes">Position on Lane: </property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
</packing>
</child>
......@@ -168,8 +134,8 @@
<object class="GtkLabel" id="lanePositionPercentageLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">00</property>
<property name="halign">start</property>
<property name="label" translatable="yes"> 0 %</property>
<attributes>
<attribute name="font-desc" value="Monospace 10"/>
</attributes>
......@@ -183,81 +149,54 @@
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Position on Lane: </property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Drives on: </property>
<property name="halign">start</property>
<property name="label" translatable="yes">Speed: </property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="laneLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">lane</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
<property name="width">2</property>
<property name="top_attach">5</property>
</packing>
</child>
<child>
<object class="GtkComboBoxText" id="zoomComboBoxText">
<object class="GtkLabel" id="speedLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">5</property>
<property name="margin_right">5</property>
<property name="margin_top">5</property>
<property name="margin_bottom">5</property>
<property name="has_entry">True</property>
<child internal-child="entry">
<object class="GtkEntry">
<property name="can_focus">True</property>
<property name="width_chars">5</property>
</object>
</child>
<property name="halign">start</property>
<property name="label" translatable="yes">0.00 km/h</property>
<attributes>
<attribute name="font-desc" value="Monospace 10"/>
</attributes>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
<property name="width">2</property>
<property name="top_attach">5</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">end</property>
<property name="label" translatable="yes">Scale:</property>
<property name="halign">start</property>
<property name="label" translatable="yes">Remaining fuel: </property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="top_attach">6</property>
</packing>
</child>
<child>
<object class="GtkSeparator">
<object class="GtkLabel" id="remainingFuelLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">0.00 l</property>
<attributes>
<attribute name="font-desc" value="Monospace 10"/>
</attributes>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
<property name="width">3</property>
<property name="left_attach">1</property>
<property name="top_attach">6</property>
</packing>
</child>
</object>
......@@ -282,6 +221,29 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<property name="propagate_natural_width">True</property>
<property name="propagate_natural_height">True</property>
<child>
<object class="GtkViewport" id="viewport">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
......
......@@ -131,26 +131,26 @@ void MapApp::refreshVehicleLabels(const DrawableVehicle &vehicle) {
laneLabel->set_text(vehicle.getLaneName());
std::ostringstream lanePisitionPercentageBuffer;
lanePisitionPercentageBuffer << std::setfill('0') << std::setw(2)
<< std::round(vehicle.getPositionOnLane() * 100);
lanePisitionPercentageBuffer
<< std::setw(3) << std::round(vehicle.getPositionOnLane() * 100) << " %";
lanePositionPercentageLabel->set_text(lanePisitionPercentageBuffer.str());
std::ostringstream speedBuffer;
speedBuffer << std::setprecision(3) << vehicle.getSpeed();
speedBuffer << std::fixed << std::setprecision(1) << vehicle.getSpeed()
<< " km/h";
speedLabel->set_text(speedBuffer.str());
std::ostringstream remainingFuelBuffer;
remainingFuelBuffer << std::showpoint << std::setprecision(3)
<< vehicle.getRemainingFuel();
remainingFuelBuffer << std::fixed << std::setprecision(1)
<< vehicle.getRemainingFuel() << " l";
remainingFuelLabel->set_text(remainingFuelBuffer.str());
}
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;
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, timeString = timeBuffer.str()]() mutable {
timeLabel->set_text(std::move(timeString));
......
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