So why would we need those explicit conversions?

/D
---
>From my phone

Michael Andreen <h...@ruin.nu> wrote:

>Fixes #371
>
>Signed-off-by: Michael Andreen <h...@ruin.nu>
>---
>I haven't been able to test it on windows, hopefully I didn't miss any strings.
> qt-ui/maintab.cpp | 20 ++++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
>diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
>index 82e5d2e..3ae8d5b 100644
>--- a/qt-ui/maintab.cpp
>+++ b/qt-ui/maintab.cpp
>@@ -264,7 +264,7 @@ void MainTab::enableEdition(EditMode newEditMode)
>                       notesBackup[mydive].datetime = 
> QDateTime::fromTime_t(mydive->when).toUTC().toString();
>                       char buf[1024];
>                       taglist_get_tagstring(mydive->tag_list, buf, 1024);
>-                      notesBackup[mydive].tags = QString(buf);
>+                      notesBackup[mydive].tags = QString::fromUtf8(buf);
> 
>                       // maybe this is a place for memset?
>                       for (int i = 0; i < MAX_CYLINDERS; i++) {
>@@ -342,7 +342,7 @@ void MainTab::clearStats()
>       if (!d || !d->field)                            \
>               ui.field->setText("");                  \
>       else                                            \
>-              ui.field->setText(d->field)
>+              ui.field->setText(QString::fromUtf8(d->field))
> 
> #define UPDATE_TEMP(d, field)                         \
>       if (!d || d->field.mkelvin == 0)                \
>@@ -411,9 +411,9 @@ void MainTab::updateDiveInfo(int dive)
>                       // rename the remaining fields and fill data from 
> selected trip
>                       dive_trip_t *currentTrip = 
> *mainWindow()->dive_list()->selectedTrips().begin();
>                       ui.LocationLabel->setText(tr("Trip Location"));
>-                      ui.location->setText(currentTrip->location);
>+                      
>ui.location->setText(QString::fromUtf8(currentTrip->location));
>                       ui.NotesLabel->setText(tr("Trip Notes"));
>-                      ui.notes->setText(currentTrip->notes);
>+                      
>ui.notes->setText(QString::fromUtf8(currentTrip->notes));
>               } else {
>                       setTabText(0, tr("Dive Notes"));
>                       // make all the fields visible writeable
>@@ -517,7 +517,7 @@ void MainTab::updateDiveInfo(int dive)
> 
>               char buf[1024];
>               taglist_get_tagstring(d->tag_list, buf, 1024);
>-              ui.tagWidget->setText(QString(buf));
>+              ui.tagWidget->setText(QString::fromUtf8(buf));
> 
>               multiEditEquipmentPlaceholder = *d;
>               cylindersModel->setDive(&multiEditEquipmentPlaceholder);
>@@ -687,12 +687,12 @@ void MainTab::resetPallete()
> }
> 
> #define EDIT_TEXT2(what, text) \
>-      textByteArray = text.toLocal8Bit(); \
>+      textByteArray = text.toUtf8(); \
>       free(what);\
>       what = strdup(textByteArray.data());
> 
> #define EDIT_TEXT(what, text) \
>-      QByteArray textByteArray = text.toLocal8Bit(); \
>+      QByteArray textByteArray = text.toUtf8(); \
>       free(what);\
>       what = strdup(textByteArray.data());
> 
>@@ -854,7 +854,7 @@ void MainTab::saveTags()
>               QString tag;
>               taglist_clear(mydive->tag_list);
>               foreach (tag, ui.tagWidget->getBlockStringList())
>-                      taglist_add_tag(mydive->tag_list, tag.toAscii().data());
>+                      taglist_add_tag(mydive->tag_list, tag.toUtf8().data());
>       );
> }
> 
>@@ -976,8 +976,8 @@ QString MainTab::printGPSCoords(int lat, int lon)
>       ilatmin = (lat % 1000000) * 60;
>       ilonmin = (lon % 1000000) * 60;
>       result.sprintf("%s%u%s %2d.%05d\' , %s%u%s %2d.%05d\'",
>-                     lath.toLocal8Bit().data(), latdeg, UTF8_DEGREE, ilatmin 
>/ 1000000, (ilatmin % 1000000) / 10,
>-                     lonh.toLocal8Bit().data(), londeg, UTF8_DEGREE, ilonmin 
>/ 1000000, (ilonmin % 1000000) / 10);
>+                     lath.toUtf8().data(), latdeg, UTF8_DEGREE, ilatmin / 
>1000000, (ilatmin % 1000000) / 10,
>+                     lonh.toUtf8().data(), londeg, UTF8_DEGREE, ilonmin / 
>1000000, (ilonmin % 1000000) / 10);
>       return result;
> }
> 
>-- 
>1.8.3.2
>
>
_______________________________________________
subsurface mailing list
subsurface@hohndel.org
http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to