Layout improvements to the dive plan

Changed to html.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Robert C. Helling 2014-06-03 09:35:19 +02:00 committed by Dirk Hohndel
parent b249370ffe
commit 2785d7bc3e
4 changed files with 18 additions and 15 deletions

View file

@ -520,18 +520,18 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool
return; return;
if (show_disclaimer) if (show_disclaimer)
disclaimer = translate("gettextFromC", "DISCLAIMER / WARNING: THIS IS A NEW IMPLEMENTATION OF THE BUHLMANN " disclaimer = translate("gettextFromC", "<b>DISCLAIMER / WARNING: THIS IS A NEW IMPLEMENTATION OF THE BUHLMANN "
"ALGORITHM AND A DIVE PLANNER IMPLEMENTION BASED ON THAT WHICH HAS " "ALGORITHM AND A DIVE PLANNER IMPLEMENTION BASED ON THAT WHICH HAS "
"RECEIVED ONLY A LIMITED AMOUNT OF TESTING. WE STRONGLY RECOMMEND NOT TO " "RECEIVED ONLY A LIMITED AMOUNT OF TESTING. WE STRONGLY RECOMMEND NOT TO "
"PLAN DIVES SIMPLY BASED ON THE RESULTS GIVEN HERE."); "PLAN DIVES SIMPLY BASED ON THE RESULTS GIVEN HERE.</b>");
len = snprintf(buffer, sizeof(buffer), len = snprintf(buffer, sizeof(buffer),
translate("gettextFromC", "%s\nSubsurface dive plan\nbased on GFlow = %d and GFhigh = %d\n\ndepth"), translate("gettextFromC", "%s<br>Subsurface dive plan\nbased on GFlow = %d and GFhigh = %d<br><br>depth"),
disclaimer, diveplan->gflow, diveplan->gfhigh); disclaimer, diveplan->gflow, diveplan->gfhigh);
if (plan_display_runtime) if (plan_display_runtime)
len += snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", " runtime")); len += snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", " runtime"));
if (plan_display_duration) if (plan_display_duration)
len += snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", " stop time")); len += snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", " duration"));
len += snprintf(buffer + len, sizeof(buffer) - len, " gas\n"); len += snprintf(buffer + len, sizeof(buffer) - len, " gas<br>");
do { do {
struct gasmix gasmix, newgasmix; struct gasmix gasmix, newgasmix;
const char *depth_unit; const char *depth_unit;
@ -562,28 +562,28 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool
gasidx = get_gasidx(dive, &gasmix); gasidx = get_gasidx(dive, &gasmix);
len = strlen(buffer); len = strlen(buffer);
if (dp->depth != lastdepth) { if (dp->depth != lastdepth) {
if (plan_display_transitions) if (plan_display_transitions && plan_verbatim)
snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", "Transition to %.*f %s in %d:%02d min - runtime %d:%02u on %s\n"), snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", "Transition to %.*f %s in %d:%02d min - runtime %d:%02u on %s\n"),
decimals, depthvalue, depth_unit, decimals, depthvalue, depth_unit,
FRACTION(dp->time - lasttime, 60), FRACTION(dp->time - lasttime, 60),
FRACTION(dp->time, 60), FRACTION(dp->time, 60),
gasname(&gasmix)); gasname(&gasmix));
else else
if (dp->entered) { if (dp->entered || plan_display_transitions) {
len += snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", "%3.0f%s"), depthvalue, depth_unit); len += snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", "%3.0f%s"), depthvalue, depth_unit);
if (plan_display_runtime) if (plan_display_runtime)
len += snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", " %3dmin "), (dp->time + 30) / 60); len += snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", " %3dmin "), (dp->time + 30) / 60);
if (plan_display_duration) if (plan_display_duration)
len += snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", " %3dmin "), (dp->time - lasttime + 30) / 60); len += snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", " %3dmin "), (dp->time - lasttime + 30) / 60);
if (gaschange) { if (gaschange) {
len += snprintf(buffer + len, sizeof(buffer) - len, " %s", gasname(&newgasmix)); len += snprintf(buffer + len, sizeof(buffer) - len, " <b>%s</b>", gasname(&newgasmix));
gaschange = false; gaschange = false;
} }
len += snprintf(buffer + len, sizeof(buffer) - len, "\n"); len += snprintf(buffer + len, sizeof(buffer) - len, "<br>");
} }
} else { } else {
if (plan_verbatim) { if (plan_verbatim) {
snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", "Stay at %.*f %s for %d:%02d min - runtime %d:%02u on %s\n"), snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", "Stay at %.*f %s for %d:%02d min - runtime %d:%02u on %s<br>"),
decimals, depthvalue, depth_unit, decimals, depthvalue, depth_unit,
FRACTION(dp->time - lasttime, 60), FRACTION(dp->time - lasttime, 60),
FRACTION(dp->time, 60), FRACTION(dp->time, 60),
@ -595,16 +595,16 @@ static void add_plan_to_notes(struct diveplan *diveplan, struct dive *dive, bool
if (plan_display_duration) if (plan_display_duration)
len += snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", " %3dmin "), (dp->time - lasttime + 30) / 60); len += snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", " %3dmin "), (dp->time - lasttime + 30) / 60);
if (gaschange) { if (gaschange) {
len += snprintf(buffer + len, sizeof(buffer) - len, " %s", gasname(&newgasmix)); len += snprintf(buffer + len, sizeof(buffer) - len, " <b>%s</b>", gasname(&newgasmix));
gaschange = false; gaschange = false;
} }
len += snprintf(buffer + len, sizeof(buffer) - len, "\n"); len += snprintf(buffer + len, sizeof(buffer) - len, "<br>");
} }
} }
if (nextdp && gasmix_distance(&gasmix, &newgasmix)) { if (nextdp && gasmix_distance(&gasmix, &newgasmix)) {
// gas switch at this waypoint // gas switch at this waypoint
if (plan_verbatim) if (plan_verbatim)
snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", "Switch gas to %s\n"), gasname(&newgasmix)); snprintf(buffer + len, sizeof(buffer) - len, translate("gettextFromC", "Switch gas to %s<br>"), gasname(&newgasmix));
else else
gaschange = true; gaschange = true;
gasmix = newgasmix; gasmix = newgasmix;

View file

@ -195,7 +195,7 @@
<string>In dive plan, show duration (relative time) of stops</string> <string>In dive plan, show duration (relative time) of stops</string>
</property> </property>
<property name="text"> <property name="text">
<string>display stop duration</string> <string>display segment duration</string>
</property> </property>
</widget> </widget>
</item> </item>

View file

@ -416,7 +416,7 @@ void MainWindow::planCreated()
void MainWindow::setPlanNotes(const char *notes) void MainWindow::setPlanNotes(const char *notes)
{ {
ui.divePlanOutput->setText(notes); ui.divePlanOutput->setHtml(notes);
} }
void MainWindow::on_actionDivePlanner_triggered() void MainWindow::on_actionDivePlanner_triggered()

View file

@ -548,6 +548,9 @@
<property name="styleSheet"> <property name="styleSheet">
<string notr="true">font: 13pt &quot;Courier&quot;;</string> <string notr="true">font: 13pt &quot;Courier&quot;;</string>
</property> </property>
<property name="readOnly">
<bool>true</bool>
</property>
<property name="html"> <property name="html">
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt; <string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt; &lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;