[PATCH] Tweaks to maintab

amit.k.chaudhuri at gmail.com amit.k.chaudhuri at gmail.com
Fri May 10 15:56:05 PDT 2013


From: Amit Chaudhuri <amit.k.chaudhuri at gmail.com>

Align statistics tab labels as per infotab.

Amend helper function to show degree symbol for temp measurements.

Change order of member initialisation list to match order of decl
(ProfileGraphicsView::ProfileGraphicsView)

Signed-off-by: Amit Chaudhuri <amit.k.chaudhuri at gmail.com>
---
 profile.c                 |    2 +-
 qt-gui.cpp                |    6 ++++--
 qt-ui/maintab.cpp         |   14 ++++++++++++++
 qt-ui/profilegraphics.cpp |    2 +-
 4 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/profile.c b/profile.c
index ed5d018..276641b 100644
--- a/profile.c
+++ b/profile.c
@@ -263,7 +263,7 @@ int get_cylinder_pressure_range(struct graphics_context *gc)
 		return FALSE;
 
 	while (gc->pi.endtempcoord <= SCALEY(gc, gc->pi.minpressure - (gc->topy) * 0.1))
-		gc->bottomy -=  gc->topy * 0.1;
+		gc->bottomy -=  gc->topy * 0.1 * gc->maxy/abs(gc->maxy);
 
 	return TRUE;
 }
diff --git a/qt-gui.cpp b/qt-gui.cpp
index d70e003..e3a8ad5 100644
--- a/qt-gui.cpp
+++ b/qt-gui.cpp
@@ -171,10 +171,12 @@ QString get_temperature_string(temperature_t temp, bool showunit)
 {
 	if (prefs.units.temperature == units::CELSIUS) {
 		double celsius = mkelvin_to_C(temp.mkelvin);
-		return QString("%1%2").arg(celsius, 0, 'f', 1).arg(showunit ? _("C") : "");
+		return QString("%1%2%3").arg(celsius, 0, 'f', 1).arg(showunit ? (UTF8_DEGREE): "")
+								.arg(showunit ? _("C") : "");
 	} else {
 		double fahrenheit = mkelvin_to_F(temp.mkelvin);
-		return QString("%1%2").arg(fahrenheit, 0, 'f', 1).arg(showunit ? _("F") : "");
+		return QString("%1%2%3").arg(fahrenheit, 0, 'f', 1).arg(showunit ? (UTF8_DEGREE): "")
+								.arg(showunit ? _("F") : "");
 	}
 }
 
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index e1ac7c2..edacf45 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -29,6 +29,12 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
 		if (label)
 			label->setAlignment(Qt::AlignHCenter);
 	}
+	QList<QObject *> statisticsTabWidgets = ui->statisticsTab->children();
+	Q_FOREACH( QObject* obj, statisticsTabWidgets ){
+		QLabel* label = qobject_cast<QLabel *>(obj);
+		if (label)
+			label->setAlignment(Qt::AlignHCenter);
+	}
 }
 
 void MainTab::clearEquipment()
@@ -95,6 +101,7 @@ void MainTab::updateDiveInfo(int dive)
 	UPDATE_TEXT(d, suit);
 	UPDATE_TEXT(d, divemaster);
 	UPDATE_TEXT(d, buddy);
+	/* infoTab */
 	if (d) {
 		ui->rating->setCurrentStars(d->rating);
 		ui->maximumDepthText->setText(get_depth_string(d->maxdepth, TRUE));
@@ -128,6 +135,13 @@ void MainTab::updateDiveInfo(int dive)
 		ui->gasUsedText->setText(QString());
 		ui->airPressureText->setText(QString());
 	}
+	/* statisticsTab*/
+	/* we can access the stats_selection struct but how to we ensure the relevant dives are selected
+	 * if we don't use the gtk widget to drive this?
+	 * Maybe call process_selected_dives? Or re-write to query our Qt list view.
+	 */
+	qDebug("max temp %u",stats_selection.max_temp);
+	qDebug("min temp %u",stats_selection.min_temp);
 }
 
 void MainTab::on_addCylinder_clicked()
diff --git a/qt-ui/profilegraphics.cpp b/qt-ui/profilegraphics.cpp
index 6e699fe..c6a2669 100644
--- a/qt-ui/profilegraphics.cpp
+++ b/qt-ui/profilegraphics.cpp
@@ -114,7 +114,7 @@ extern struct ev_select *ev_namelist;
 extern int evn_allocated;
 extern int evn_used;
 
-ProfileGraphicsView::ProfileGraphicsView(QWidget* parent) : QGraphicsView(parent) , dive(0), toolTip(0)
+ProfileGraphicsView::ProfileGraphicsView(QWidget* parent) : QGraphicsView(parent), toolTip(0) , dive(0)
 {
 	gc.printer = false;
 	setScene(new QGraphicsScene());
-- 
1.7.10.4



More information about the subsurface mailing list