From 2b06e4be671930bc22feb830f328871a31315d9f Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Mon, 12 May 2014 13:19:57 -0300 Subject: Move printGpsCoords from MainTab to QtHelper Last time I touched this I got a scream from dirk, but then I looked at the code again and the problem that I faced was that I broke translations in a sad way, well, now I broke it again. However, this method shouldn't belong to MainTab ( because of that thingy that I said before and also many others: Separate the logic of your application from the UI specific code ) This generates a string that's going to be used on the Interface, it doesn't display it on the interface. Move it down below makes it easier to test ( I don't need to create an Widget and worry about the parent-relationship with the mainwindow just to test this function, for instance. ) Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- qt-ui/maintab.cpp | 26 -------------------------- qt-ui/maintab.h | 1 - 2 files changed, 27 deletions(-) (limited to 'qt-ui') diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index 234a01c43..172e4e2d7 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -1076,32 +1076,6 @@ void MainTab::editWeightWidget(const QModelIndex &index) ui.weights->edit(index); } -QString MainTab::printGPSCoords(int lat, int lon) -{ - unsigned int latdeg, londeg; - unsigned int latmin, lonmin; - double latsec, lonsec; - QString lath, lonh, result; - - if (!lat && !lon) - return QString(""); - - lath = lat >= 0 ? tr("N") : tr("S"); - lonh = lon >= 0 ? tr("E") : tr("W"); - lat = abs(lat); - lon = abs(lon); - latdeg = lat / 1000000; - londeg = lon / 1000000; - latmin = (lat % 1000000) * 60; - lonmin = (lon % 1000000) * 60; - latsec = (latmin % 1000000) * 60; - lonsec = (lonmin % 1000000) * 60; - result.sprintf("%u%s%02d\'%06.3f\"%s %u%s%02d\'%06.3f\"%s", - latdeg, UTF8_DEGREE, latmin / 1000000, latsec / 1000000, lath.toUtf8().data(), - londeg, UTF8_DEGREE, lonmin / 1000000, lonsec / 1000000, lonh.toUtf8().data()); - return result; -} - void MainTab::updateCoordinatesText(qreal lat, qreal lon) { int ulat = rint(lat * 1000000); diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h index ece2c4009..d201d2a47 100644 --- a/qt-ui/maintab.h +++ b/qt-ui/maintab.h @@ -120,7 +120,6 @@ private: Completers completers; void resetPallete(); void saveTags(); - QString printGPSCoords(int lat, int lon); void updateGpsCoordinates(const struct dive *dive); }; -- cgit v1.2.3-70-g09d2