And some code cleanup.

On Tue, Jul 15, 2014 at 3:54 PM, Tomaz Canabrava <[email protected]> wrote:
> some blockers should just go away.
From 0852387d83df253a7287aaf6240bbb40e217f1ff Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Tue, 15 Jul 2014 20:27:32 -0300
Subject: [PATCH 4/5] Use QObject::tr instead of OurClasses::tr for functions

This will make more easy to move code around in the future.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 qt-ui/models.cpp                | 16 ++++++++--------
 qt-ui/subsurfacewebservices.cpp |  8 ++++----
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/qt-ui/models.cpp b/qt-ui/models.cpp
index a0bb97a..4defd72 100644
--- a/qt-ui/models.cpp
+++ b/qt-ui/models.cpp
@@ -455,8 +455,8 @@ weight_t string_to_weight(const char *str)
 	const char *end;
 	double value = strtod_flags(str, &end, 0);
 	QString rest = QString(end).trimmed();
-	QString local_kg = WeightModel::tr("kg");
-	QString local_lbs = WeightModel::tr("lbs");
+	QString local_kg = QObject::tr("kg");
+	QString local_lbs = QObject::tr("lbs");
 	weight_t weight;
 
 	if (rest.startsWith("kg") || rest.startsWith(local_kg))
@@ -480,8 +480,8 @@ depth_t string_to_depth(const char *str)
 	const char *end;
 	double value = strtod_flags(str, &end, 0);
 	QString rest = QString(end).trimmed();
-	QString local_ft = WeightModel::tr("ft");
-	QString local_m = WeightModel::tr("m");
+	QString local_ft = QObject::tr("ft");
+	QString local_m = QObject::tr("m");
 	depth_t depth;
 
 	if (rest.startsWith("m") || rest.startsWith(local_m))
@@ -504,8 +504,8 @@ pressure_t string_to_pressure(const char *str)
 	const char *end;
 	double value = strtod_flags(str, &end, 0);
 	QString rest = QString(end).trimmed();
-	QString local_psi = CylindersModel::tr("psi");
-	QString local_bar = CylindersModel::tr("bar");
+	QString local_psi = QObject::tr("psi");
+	QString local_bar = QObject::tr("bar");
 	pressure_t pressure;
 
 	if (rest.startsWith("bar") || rest.startsWith(local_bar))
@@ -529,8 +529,8 @@ volume_t string_to_volume(const char *str, pressure_t workp)
 	const char *end;
 	double value = strtod_flags(str, &end, 0);
 	QString rest = QString(end).trimmed();
-	QString local_l = CylindersModel::tr("l");
-	QString local_cuft = CylindersModel::tr("cuft");
+	QString local_l = QObject::tr("l");
+	QString local_cuft = QObject::tr("cuft");
 	volume_t volume;
 
 	if (rest.startsWith("l") || rest.startsWith("ℓ") || rest.startsWith(local_l))
diff --git a/qt-ui/subsurfacewebservices.cpp b/qt-ui/subsurfacewebservices.cpp
index 219d10d..0514d89 100644
--- a/qt-ui/subsurfacewebservices.cpp
+++ b/qt-ui/subsurfacewebservices.cpp
@@ -517,7 +517,7 @@ static DiveListResult parseDiveLogsDeDiveList(const QByteArray &xmlData)
 	 * </DiveDateReader>
 	 */
 	QXmlStreamReader reader(xmlData);
-	const QString invalidXmlError = DivelogsDeWebServices::tr("Invalid response from server");
+	const QString invalidXmlError = QObject::tr("Invalid response from server");
 	bool seenDiveDates = false;
 	DiveListResult result;
 	result.idCount = 0;
@@ -525,7 +525,7 @@ static DiveListResult parseDiveLogsDeDiveList(const QByteArray &xmlData)
 	if (reader.readNextStartElement() && reader.name() != "DiveDateReader") {
 		result.errorCondition = invalidXmlError;
 		result.errorDetails =
-			DivelogsDeWebServices::tr("Expected XML tag 'DiveDateReader', got instead '%1")
+			QObject::tr("Expected XML tag 'DiveDateReader', got instead '%1")
 				.arg(reader.name().toString());
 		goto out;
 	}
@@ -571,14 +571,14 @@ static DiveListResult parseDiveLogsDeDiveList(const QByteArray &xmlData)
 
 	if (!seenDiveDates) {
 		result.errorCondition = invalidXmlError;
-		result.errorDetails = DivelogsDeWebServices::tr("Expected XML tag 'DiveDates' not found");
+		result.errorDetails = QObject::tr("Expected XML tag 'DiveDates' not found");
 	}
 
 out:
 	if (reader.hasError()) {
 		// if there was an XML error, overwrite the result or other error conditions
 		result.errorCondition = invalidXmlError;
-		result.errorDetails = DivelogsDeWebServices::tr("Malformed XML response. Line %1: %2")
+		result.errorDetails = QObject::tr("Malformed XML response. Line %1: %2")
 						.arg(reader.lineNumber())
 						.arg(reader.errorString());
 	}
-- 
2.0.1

From cb525393a73d2638d2f73322b39f4f2ac0475137 Mon Sep 17 00:00:00 2001
From: Tomaz Canabrava <[email protected]>
Date: Tue, 15 Jul 2014 20:34:57 -0300
Subject: [PATCH 5/5] Remove uneeded function

This method was being unused, rip it off.

Signed-off-by: Tomaz Canabrava <[email protected]>
---
 qt-ui/maintab.cpp | 5 -----
 qt-ui/maintab.h   | 1 -
 2 files changed, 6 deletions(-)

diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index 050cf32..2e5aaf0 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -1079,11 +1079,6 @@ void MainTab::updateGpsCoordinates(const struct dive *dive)
 	}
 }
 
-QString MainTab::trHemisphere(const char *orig)
-{
-	return tr(orig);
-}
-
 void MainTab::escDetected()
 {
 	if (editMode != NONE)
diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h
index 3500e7e..8f690b5 100644
--- a/qt-ui/maintab.h
+++ b/qt-ui/maintab.h
@@ -84,7 +84,6 @@ slots:
 	void enableEdition(EditMode newEditMode = NONE);
 	void toggleTriggeredColumn();
 	void updateTextLabels(bool showUnits = true);
-	QString trHemisphere(const char *orig);
 	void escDetected(void);
 	void photoDoubleClicked(const QString filePath);
 
-- 
2.0.1

_______________________________________________
subsurface mailing list
[email protected]
http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to