summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/configuredivecomputerdialog.cpp8
-rw-r--r--desktop-widgets/divelistview.cpp2
-rw-r--r--desktop-widgets/divelogexportdialog.cpp16
-rw-r--r--desktop-widgets/divelogimportdialog.cpp16
-rw-r--r--desktop-widgets/downloadfromdivecomputer.cpp6
-rw-r--r--desktop-widgets/locationinformation.cpp8
-rw-r--r--desktop-widgets/mainwindow.cpp10
-rw-r--r--desktop-widgets/modeldelegates.cpp2
-rw-r--r--desktop-widgets/simplewidgets.cpp6
-rw-r--r--desktop-widgets/subsurfacewebservices.cpp2
-rw-r--r--desktop-widgets/tab-widgets/maintab.cpp24
-rw-r--r--desktop-widgets/templatelayout.cpp2
12 files changed, 51 insertions, 51 deletions
diff --git a/desktop-widgets/configuredivecomputerdialog.cpp b/desktop-widgets/configuredivecomputerdialog.cpp
index b615b453a..165f4d0d9 100644
--- a/desktop-widgets/configuredivecomputerdialog.cpp
+++ b/desktop-widgets/configuredivecomputerdialog.cpp
@@ -910,9 +910,9 @@ void ConfigureDiveComputerDialog::getDeviceData()
#else
QString device = ui.device->currentText();
#endif
- device_data.devname = strdup(device.toUtf8().data());
- device_data.vendor = strdup(selected_vendor.toUtf8().data());
- device_data.product = strdup(selected_product.toUtf8().data());
+ device_data.devname = strdup(qPrintable(device));
+ device_data.vendor = strdup(qPrintable(selected_vendor));
+ device_data.product = strdup(qPrintable(selected_product));
device_data.descriptor = descriptorLookup.value(selected_vendor + selected_product);
device_data.deviceid = device_data.diveid = 0;
@@ -1479,7 +1479,7 @@ void ConfigureDiveComputerDialog::pickLogFile()
filename, tr("Log files") + " (*.log)");
if (!logFile.isEmpty()) {
free(logfile_name);
- logfile_name = strdup(logFile.toUtf8().data());
+ logfile_name = strdup(qPrintable(logFile));
}
}
diff --git a/desktop-widgets/divelistview.cpp b/desktop-widgets/divelistview.cpp
index b32493a5d..ce9f2e47d 100644
--- a/desktop-widgets/divelistview.cpp
+++ b/desktop-widgets/divelistview.cpp
@@ -949,7 +949,7 @@ void DiveListView::matchImagesToDives(QStringList fileNames)
for_each_dive (j, dive) {
if (!dive->selected)
continue;
- dive_create_picture(dive, copy_string(fileName.toUtf8().data()), shiftDialog.amount(), shiftDialog.matchAll());
+ dive_create_picture(dive, copy_string(qPrintable(fileName)), shiftDialog.amount(), shiftDialog.matchAll());
}
}
diff --git a/desktop-widgets/divelogexportdialog.cpp b/desktop-widgets/divelogexportdialog.cpp
index 2af8d1b80..078e5d0d1 100644
--- a/desktop-widgets/divelogexportdialog.cpp
+++ b/desktop-widgets/divelogexportdialog.cpp
@@ -154,7 +154,7 @@ void DiveLogExportDialog::on_buttonBox_accepted()
filename = QFileDialog::getSaveFileName(this, tr("Export world map"), lastDir,
tr("HTML files") + " (*.html)");
if (!filename.isNull() && !filename.isEmpty())
- export_worldmap_HTML(filename.toUtf8().data(), ui->exportSelected->isChecked());
+ export_worldmap_HTML(qPrintable(filename), ui->exportSelected->isChecked());
} else if (ui->exportSubsurfaceXML->isChecked()) {
filename = QFileDialog::getSaveFileName(this, tr("Export Subsurface XML"), lastDir,
tr("Subsurface files") + " (*.ssrf *.xml)");
@@ -167,11 +167,11 @@ void DiveLogExportDialog::on_buttonBox_accepted()
} else if (ui->exportImageDepths->isChecked()) {
filename = QFileDialog::getSaveFileName(this, tr("Save image depths"), lastDir);
if (!filename.isNull() && !filename.isEmpty())
- export_depths(filename.toUtf8().data(), ui->exportSelected->isChecked());
+ export_depths(qPrintable(filename), ui->exportSelected->isChecked());
} else if (ui->exportTeX->isChecked()) {
filename = QFileDialog::getSaveFileName(this, tr("Export to TeX file"), lastDir, tr("TeX files") + " (*.tex)");
if (!filename.isNull() && !filename.isEmpty())
- export_TeX(filename.toUtf8().data(), ui->exportSelected->isChecked());
+ export_TeX(qPrintable(filename), ui->exportSelected->isChecked());
}
break;
case 1:
@@ -226,7 +226,7 @@ void DiveLogExportDialog::export_depths(const char *filename, const bool selecte
f = subsurface_fopen(filename, "w+");
if (!f) {
- report_error(tr("Can't open file %s").toUtf8().data(), filename);
+ report_error(qPrintable(tr("Can't open file %s")), filename);
} else {
flush_buffer(&buf, f); /*check for writing errors? */
fclose(f);
@@ -325,7 +325,7 @@ void DiveLogExportDialog::export_TeX(const char *filename, const bool selected_o
site ? put_format(&buf, "\\def\\gpslat{%f}\n", site->latitude.udeg / 1000000.0) : put_format(&buf, "\\def\\gpslat{}\n");
site ? put_format(&buf, "\\def\\gpslon{%f}\n", site->longitude.udeg / 1000000.0) : put_format(&buf, "\\def\\gpslon{}\n");
put_format(&buf, "\\def\\computer{%s}\n", dive->dc.model);
- put_format(&buf, "\\def\\country{%s}\n", country.toUtf8().data());
+ put_format(&buf, "\\def\\country{%s}\n", qPrintable(country));
put_format(&buf, "\\def\\time{%u:%02u}\n", FRACTION(dive->duration.seconds, 60));
put_format(&buf, "\n%% Dive Profile Details:\n");
@@ -337,8 +337,8 @@ void DiveLogExportDialog::export_TeX(const char *filename, const bool selected_o
dive->meandepth.mm ? put_format(&buf, "\\def\\meandepth{%.1f\\depthunit}\n", get_depth_units(dive->meandepth.mm, NULL, &unit)) : put_format(&buf, "\\def\\meandepth{}\n");
put_format(&buf, "\\def\\type{%s}\n", dive->tag_list ? dive->tag_list->tag->name : "");
- put_format(&buf, "\\def\\viz{%s}\n", viz.toUtf8().data());
- put_format(&buf, "\\def\\rating{%s}\n", rating.toUtf8().data());
+ put_format(&buf, "\\def\\viz{%s}\n", qPrintable(viz));
+ put_format(&buf, "\\def\\rating{%s}\n", qPrintable(rating));
put_format(&buf, "\\def\\plot{\\includegraphics[width=9cm,height=4cm]{profile%d}}\n", dive->number);
put_format(&buf, "\\def\\comment{%s}\n", dive->notes ? dive->notes : "");
put_format(&buf, "\\def\\buddy{%s}\n", dive->buddy ? dive->buddy : "");
@@ -408,7 +408,7 @@ void DiveLogExportDialog::export_TeX(const char *filename, const bool selected_o
f = subsurface_fopen(filename, "w+");
if (!f) {
- report_error(tr("Can't open file %s").toUtf8().data(), filename);
+ report_error(qPrintable(tr("Can't open file %s")), filename);
} else {
flush_buffer(&buf, f); /*check for writing errors? */
fclose(f);
diff --git a/desktop-widgets/divelogimportdialog.cpp b/desktop-widgets/divelogimportdialog.cpp
index aa1359b9b..091de35e0 100644
--- a/desktop-widgets/divelogimportdialog.cpp
+++ b/desktop-widgets/divelogimportdialog.cpp
@@ -788,10 +788,10 @@ int DiveLogImportDialog::setup_csv_params(QStringList r, char **params, int pnr)
params[pnr++] = intdup(ui->CSVUnits->currentIndex());
if (hw.length()) {
params[pnr++] = strdup("hw");
- params[pnr++] = strdup(hw.toUtf8().data());
+ params[pnr++] = strdup(qPrintable(hw));
} else if (ui->knownImports->currentText().length() > 0) {
params[pnr++] = strdup("hw");
- params[pnr++] = strdup(ui->knownImports->currentText().prepend("\"").append("\"").toUtf8().data());
+ params[pnr++] = strdup(qPrintable(ui->knownImports->currentText().prepend("\"").append("\"")));
}
params[pnr++] = NULL;
@@ -850,7 +850,7 @@ void DiveLogImportDialog::on_buttonBox_accepted()
for (int i = 0; i < fileNames.size(); ++i) {
if (ui->knownImports->currentText() == "Seabear CSV") {
- parse_seabear_log(fileNames[i].toUtf8().data());
+ parse_seabear_log(qPrintable(fileNames[i]));
} else {
char *params[49];
@@ -866,8 +866,8 @@ void DiveLogImportDialog::on_buttonBox_accepted()
params[pnr++] = strdup("1" + apdRe.cap(2).toLatin1());
}
pnr = setup_csv_params(r, params, pnr);
- parse_csv_file(fileNames[i].toUtf8().data(), params, pnr - 1,
- specialCSV.contains(ui->knownImports->currentIndex()) ? CSVApps[ui->knownImports->currentIndex()].name.toUtf8().data() : "csv");
+ parse_csv_file(qPrintable(fileNames[i]), params, pnr - 1,
+ specialCSV.contains(ui->knownImports->currentIndex()) ? qPrintable(CSVApps[ui->knownImports->currentIndex()].name) : "csv");
}
}
} else {
@@ -927,7 +927,7 @@ void DiveLogImportDialog::on_buttonBox_accepted()
params[pnr++] = intdup(r.indexOf(tr("Water temp.")));
params[pnr++] = NULL;
- parse_manual_file(fileNames[i].toUtf8().data(), params, pnr - 1);
+ parse_manual_file(qPrintable(fileNames[i]), params, pnr - 1);
} else {
char *params[51];
int pnr = 0;
@@ -942,8 +942,8 @@ void DiveLogImportDialog::on_buttonBox_accepted()
params[pnr++] = strdup("1" + apdRe.cap(2).toLatin1());
}
pnr = setup_csv_params(r, params, pnr);
- parse_csv_file(fileNames[i].toUtf8().data(), params, pnr - 1,
- specialCSV.contains(ui->knownImports->currentIndex()) ? CSVApps[ui->knownImports->currentIndex()].name.toUtf8().data() : "csv");
+ parse_csv_file(qPrintable(fileNames[i]), params, pnr - 1,
+ specialCSV.contains(ui->knownImports->currentIndex()) ? qPrintable(CSVApps[ui->knownImports->currentIndex()].name) : "csv");
}
}
}
diff --git a/desktop-widgets/downloadfromdivecomputer.cpp b/desktop-widgets/downloadfromdivecomputer.cpp
index ba1196826..c2bf7740e 100644
--- a/desktop-widgets/downloadfromdivecomputer.cpp
+++ b/desktop-widgets/downloadfromdivecomputer.cpp
@@ -297,7 +297,7 @@ void DownloadFromDCWidget::on_downloadCancelRetryButton_clicked()
#endif
if (data->vendor() == "Uemis") {
char *colon;
- char *devname = strdup(ui.device->currentText().toUtf8().data());
+ char *devname = strdup(qPrintable(ui.device->currentText()));
if ((colon = strstr(devname, ":\\ (UEMISSDA)")) != NULL) {
*(colon + 2) = '\0';
@@ -362,7 +362,7 @@ void DownloadFromDCWidget::pickLogFile()
filename, tr("Log files") + " (*.log)");
if (!logFile.isEmpty()) {
free(logfile_name);
- logfile_name = copy_string(logFile.toUtf8().data());
+ logfile_name = copy_string(qPrintable(logFile));
}
}
@@ -388,7 +388,7 @@ void DownloadFromDCWidget::pickDumpFile()
filename, tr("Dump files") + " (*.bin)");
if (!dumpFile.isEmpty()) {
free(dumpfile_name);
- dumpfile_name = copy_string(dumpFile.toUtf8().data());
+ dumpfile_name = copy_string(qPrintable(dumpFile));
}
}
diff --git a/desktop-widgets/locationinformation.cpp b/desktop-widgets/locationinformation.cpp
index f968fd8fa..7818bc29e 100644
--- a/desktop-widgets/locationinformation.cpp
+++ b/desktop-widgets/locationinformation.cpp
@@ -158,7 +158,7 @@ void LocationInformationWidget::acceptChanges()
{
char *uiString;
struct dive_site *currentDs;
- uiString = copy_string(ui.diveSiteName->text().toUtf8().data());
+ uiString = copy_string(qPrintable(ui.diveSiteName->text()));
if (get_dive_site_by_uuid(displayed_dive_site.uuid) != NULL) {
currentDs = get_dive_site_by_uuid(displayed_dive_site.uuid);
} else {
@@ -175,14 +175,14 @@ void LocationInformationWidget::acceptChanges()
} else {
free(uiString);
}
- uiString = copy_string(ui.diveSiteDescription->text().toUtf8().data());
+ uiString = copy_string(qPrintable(ui.diveSiteDescription->text()));
if (!same_string(uiString, currentDs->description)) {
free(currentDs->description);
currentDs->description = uiString;
} else {
free(uiString);
}
- uiString = copy_string(ui.diveSiteCountry->text().toUtf8().data());
+ uiString = copy_string(qPrintable(ui.diveSiteCountry->text()));
// if the user entered a different contriy, first update the taxonomy
// for the displayed dive site; this below will get copied into the currentDs
if (!same_string(uiString, taxonomy_get_country(&displayed_dive_site.taxonomy)) &&
@@ -193,7 +193,7 @@ void LocationInformationWidget::acceptChanges()
// now update the currentDs (which we then later copy back ontop of displayed_dive_site
copy_dive_site_taxonomy(&displayed_dive_site, currentDs);
- uiString = copy_string(ui.diveSiteNotes->document()->toPlainText().toUtf8().data());
+ uiString = copy_string(qPrintable(ui.diveSiteNotes->document()->toPlainText()));
if (!same_string(uiString, currentDs->notes)) {
free(currentDs->notes);
currentDs->notes = uiString;
diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp
index ac6289f34..990629154 100644
--- a/desktop-widgets/mainwindow.cpp
+++ b/desktop-widgets/mainwindow.cpp
@@ -623,12 +623,12 @@ void MainWindow::on_actionCloudstoragesave_triggered()
information()->acceptChanges();
showProgressBar();
- int error = save_dives(filename.toUtf8().data());
+ int error = save_dives(qPrintable(filename));
hideProgressBar();
if (error)
return;
- setCurrentFile(filename.toUtf8().data());
+ setCurrentFile(qPrintable(filename));
mark_divelist_changed(false);
}
@@ -935,7 +935,7 @@ void MainWindow::updateVariations(QString variations)
{
QString notes = QString(displayed_dive.notes);
free(displayed_dive.notes);
- displayed_dive.notes = strdup(notes.replace("VARIATIONS", variations).toUtf8().data());
+ displayed_dive.notes = strdup(qPrintable(notes.replace("VARIATIONS", variations)));
plannerDetails()->divePlanOutput()->setHtml(displayed_dive.notes);
}
@@ -1683,10 +1683,10 @@ int MainWindow::file_save_as(void)
if (information()->isEditing())
information()->acceptChanges();
- if (save_dives(filename.toUtf8().data()))
+ if (save_dives(qPrintable(filename)))
return -1;
- setCurrentFile(filename.toUtf8().data());
+ setCurrentFile(qPrintable(filename));
mark_divelist_changed(false);
addRecentFile(filename, true);
return 0;
diff --git a/desktop-widgets/modeldelegates.cpp b/desktop-widgets/modeldelegates.cpp
index bdeaf9138..871033ebb 100644
--- a/desktop-widgets/modeldelegates.cpp
+++ b/desktop-widgets/modeldelegates.cpp
@@ -324,7 +324,7 @@ void TankUseDelegate::setEditorData(QWidget * editor, const QModelIndex & index)
{
QComboBox *comboBox = qobject_cast<QComboBox*>(editor);
QString indexString = index.data().toString();
- comboBox->setCurrentIndex(cylinderuse_from_text(indexString.toUtf8().data()));
+ comboBox->setCurrentIndex(cylinderuse_from_text(qPrintable(indexString)));
}
void TankUseDelegate::setModelData(QWidget * editor, QAbstractItemModel * model, const QModelIndex & index) const
diff --git a/desktop-widgets/simplewidgets.cpp b/desktop-widgets/simplewidgets.cpp
index 446a3a468..48e30036a 100644
--- a/desktop-widgets/simplewidgets.cpp
+++ b/desktop-widgets/simplewidgets.cpp
@@ -319,7 +319,7 @@ void ShiftImageTimesDialog::syncCameraClicked()
scene->addPixmap(picture.scaled(ui.DCImage->size()));
ui.DCImage->setScene(scene);
- dcImageEpoch = picture_get_timestamp(fileNames.at(0).toUtf8().data());
+ dcImageEpoch = picture_get_timestamp(qPrintable(fileNames.at(0)));
QDateTime dcDateTime = QDateTime::fromTime_t(dcImageEpoch, Qt::UTC);
ui.dcTime->setDateTime(dcDateTime);
connect(ui.dcTime, SIGNAL(dateTimeChanged(const QDateTime &)), this, SLOT(dcDateTimeChanged(const QDateTime &)));
@@ -393,11 +393,11 @@ void ShiftImageTimesDialog::updateInvalid()
ui.invalidFilesText->append(tr("\nFiles with inappropriate date/time") + ":");
Q_FOREACH (const QString &fileName, fileNames) {
- if (picture_check_valid(fileName.toUtf8().data(), m_amount))
+ if (picture_check_valid(qPrintable(fileName), m_amount))
continue;
// We've found invalid image
- timestamp = picture_get_timestamp(fileName.toUtf8().data());
+ timestamp = picture_get_timestamp(qPrintable(fileName));
time_first.setTime_t(timestamp + m_amount);
if (timestamp == 0)
ui.invalidFilesText->append(fileName + " - " + tr("No Exif date/time found"));
diff --git a/desktop-widgets/subsurfacewebservices.cpp b/desktop-widgets/subsurfacewebservices.cpp
index 2db35b88a..d9ccb190c 100644
--- a/desktop-widgets/subsurfacewebservices.cpp
+++ b/desktop-widgets/subsurfacewebservices.cpp
@@ -335,7 +335,7 @@ void SubsurfaceWebServices::buttonClicked(QAbstractButton *button)
bool d_eq_f = (qDialogUid == qFileUid);
if (!d_eq_f || s_eq_d)
s.setValue("subsurface_webservice_uid", qDialogUid);
- set_userid(qDialogUid.toLocal8Bit().data());
+ set_userid(qPrintable(qDialogUid));
}
s.sync();
hide();
diff --git a/desktop-widgets/tab-widgets/maintab.cpp b/desktop-widgets/tab-widgets/maintab.cpp
index 553eac77c..3a1f80cea 100644
--- a/desktop-widgets/tab-widgets/maintab.cpp
+++ b/desktop-widgets/tab-widgets/maintab.cpp
@@ -1082,7 +1082,7 @@ void MainTab::on_buddy_textChanged()
if (editMode == IGNORE || acceptingEdit == true)
return;
- if (same_string(displayed_dive.buddy, ui.buddy->toPlainText().toUtf8().data()))
+ if (same_string(displayed_dive.buddy, qPrintable(ui.buddy->toPlainText())))
return;
QStringList text_list = ui.buddy->toPlainText().split(",", QString::SkipEmptyParts);
@@ -1090,7 +1090,7 @@ void MainTab::on_buddy_textChanged()
text_list[i] = text_list[i].trimmed();
QString text = text_list.join(", ");
free(displayed_dive.buddy);
- displayed_dive.buddy = strdup(text.toUtf8().data());
+ displayed_dive.buddy = strdup(qPrintable(text));
markChangedWidget(ui.buddy);
}
@@ -1099,7 +1099,7 @@ void MainTab::on_divemaster_textChanged()
if (editMode == IGNORE || acceptingEdit == true)
return;
- if (same_string(displayed_dive.divemaster, ui.divemaster->toPlainText().toUtf8().data()))
+ if (same_string(displayed_dive.divemaster, qPrintable(ui.divemaster->toPlainText())))
return;
QStringList text_list = ui.divemaster->toPlainText().split(",", QString::SkipEmptyParts);
@@ -1107,7 +1107,7 @@ void MainTab::on_divemaster_textChanged()
text_list[i] = text_list[i].trimmed();
QString text = text_list.join(", ");
free(displayed_dive.divemaster);
- displayed_dive.divemaster = strdup(text.toUtf8().data());
+ displayed_dive.divemaster = strdup(qPrintable(text));
markChangedWidget(ui.divemaster);
}
@@ -1241,7 +1241,7 @@ void MainTab::saveTags()
taglist_free(displayed_dive.tag_list);
displayed_dive.tag_list = NULL;
Q_FOREACH (const QString& tag, ui.tagWidget->getBlockStringList())
- taglist_add_tag(&displayed_dive.tag_list, tag.toUtf8().data());
+ taglist_add_tag(&displayed_dive.tag_list, qPrintable(tag));
taglist_cleanup(&displayed_dive.tag_list);
// figure out which tags were added and which tags were removed
@@ -1352,7 +1352,7 @@ void MainTab::on_tagWidget_textChanged()
return;
taglist_get_tagstring(displayed_dive.tag_list, buf, 1024);
- if (same_string(buf, ui.tagWidget->toPlainText().toUtf8().data()))
+ if (same_string(buf, qPrintable(ui.tagWidget->toPlainText())))
return;
markChangedWidget(ui.tagWidget);
@@ -1407,7 +1407,7 @@ void MainTab::on_suit_textChanged(const QString &text)
if (editMode == IGNORE || acceptingEdit == true)
return;
free(displayed_dive.suit);
- displayed_dive.suit = strdup(text.toUtf8().data());
+ displayed_dive.suit = strdup(qPrintable(text));
markChangedWidget(ui.suit);
}
@@ -1416,18 +1416,18 @@ void MainTab::on_notes_textChanged()
if (editMode == IGNORE || acceptingEdit == true)
return;
if (currentTrip) {
- if (same_string(displayedTrip.notes, ui.notes->toPlainText().toUtf8().data()))
+ if (same_string(displayedTrip.notes, qPrintable(ui.notes->toPlainText())))
return;
free(displayedTrip.notes);
- displayedTrip.notes = strdup(ui.notes->toPlainText().toUtf8().data());
+ displayedTrip.notes = strdup(qPrintable(ui.notes->toPlainText()));
} else {
- if (same_string(displayed_dive.notes, ui.notes->toPlainText().toUtf8().data()))
+ if (same_string(displayed_dive.notes, qPrintable(ui.notes->toPlainText())))
return;
free(displayed_dive.notes);
if (ui.notes->toHtml().indexOf("<table") != -1)
- displayed_dive.notes = strdup(ui.notes->toHtml().toUtf8().data());
+ displayed_dive.notes = strdup(qPrintable(ui.notes->toHtml()));
else
- displayed_dive.notes = strdup(ui.notes->toPlainText().toUtf8().data());
+ displayed_dive.notes = strdup(qPrintable(ui.notes->toPlainText()));
}
markChangedWidget(ui.notes);
}
diff --git a/desktop-widgets/templatelayout.cpp b/desktop-widgets/templatelayout.cpp
index 6c5a19fdd..9831bc934 100644
--- a/desktop-widgets/templatelayout.cpp
+++ b/desktop-widgets/templatelayout.cpp
@@ -250,7 +250,7 @@ void TemplateLayout::writeTemplate(QString template_name, QString grantlee_templ
{
QFile qfile(getPrintingTemplatePathUser() + QDir::separator() + template_name);
if (qfile.open(QFile::ReadWrite | QFile::Text)) {
- qfile.write(grantlee_template.toUtf8().data());
+ qfile.write(qPrintable(grantlee_template));
qfile.resize(qfile.pos());
qfile.close();
}