mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 06:15:26 +00:00
Cleanup: introduce copy_qstring() function
strdup(qPrintable(s)) and copy_string(qPrintable(s)) were such common occurrences that they seem worthy of a short helper-function. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
b72cc1f317
commit
d1572a8d95
19 changed files with 116 additions and 108 deletions
|
@ -2,6 +2,7 @@
|
|||
/* implements Android specific functions */
|
||||
#include "dive.h"
|
||||
#include "display.h"
|
||||
#include "qthelper.h"
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <dirent.h>
|
||||
|
@ -52,7 +53,7 @@ static const char *system_default_path_append(const char *append)
|
|||
if (append)
|
||||
path += QString("/%1").arg(append);
|
||||
|
||||
return strdup(qPrintable(path));
|
||||
return copy_qstring(path);
|
||||
}
|
||||
|
||||
const char *system_default_directory(void)
|
||||
|
|
|
@ -95,7 +95,7 @@ void ReverseGeoLookupThread::run()
|
|||
ds->taxonomy.category[ri].category = j;
|
||||
ds->taxonomy.category[ri].origin = taxonomy_origin::GEOCODED;
|
||||
free((void *)ds->taxonomy.category[ri].value);
|
||||
ds->taxonomy.category[ri].value = copy_string(qPrintable(firstData[taxonomy_api_names[j]].toString()));
|
||||
ds->taxonomy.category[ri].value = copy_qstring(firstData[taxonomy_api_names[j]].toString());
|
||||
ri++;
|
||||
}
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ void ReverseGeoLookupThread::run()
|
|||
if (idx < TC_NR_CATEGORIES) {
|
||||
ds->taxonomy.category[idx].category = TC_OCEAN;
|
||||
ds->taxonomy.category[idx].origin = taxonomy_origin::GEOCODED;
|
||||
ds->taxonomy.category[idx].value = copy_string(qPrintable(oceanName["name"].toString()));
|
||||
ds->taxonomy.category[idx].value = copy_qstring(oceanName["name"].toString());
|
||||
if (idx == ds->taxonomy.nr)
|
||||
ds->taxonomy.nr++;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "downloadfromdcthread.h"
|
||||
#include "core/libdivecomputer.h"
|
||||
#include "core/qthelper.h"
|
||||
#include "core/subsurface-qt/SettingsObjectWrapper.h"
|
||||
#include <QDebug>
|
||||
#include <QRegularExpression>
|
||||
|
@ -281,12 +282,12 @@ int DCDeviceData::diveId() const
|
|||
|
||||
void DCDeviceData::setVendor(const QString& vendor)
|
||||
{
|
||||
data.vendor = strdup(qPrintable(vendor));
|
||||
data.vendor = copy_qstring(vendor);
|
||||
}
|
||||
|
||||
void DCDeviceData::setProduct(const QString& product)
|
||||
{
|
||||
data.product = strdup(qPrintable(product));
|
||||
data.product = copy_qstring(product);
|
||||
}
|
||||
|
||||
void DCDeviceData::setDevName(const QString& devName)
|
||||
|
@ -303,11 +304,11 @@ void DCDeviceData::setDevName(const QString& devName)
|
|||
QString back = devName.mid(idx1 + 1, idx2 - idx1 - 1);
|
||||
QString newDevName = back.indexOf(':') >= 0 ? back : front;
|
||||
qWarning() << "Found invalid bluetooth device" << devName << "corrected to" << newDevName << ".";
|
||||
data.devname = strdup(qPrintable(newDevName));
|
||||
data.devname = copy_qstring(newDevName);
|
||||
return;
|
||||
}
|
||||
}
|
||||
data.devname = strdup(qPrintable(devName));
|
||||
data.devname = copy_qstring(devName);
|
||||
}
|
||||
|
||||
void DCDeviceData::setDevBluetoothName(const QString& name)
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
#ifndef PREFSMACROS_H
|
||||
#define PREFSMACROS_H
|
||||
|
||||
#include "core/qthelper.h"
|
||||
|
||||
#define SB(V, B) s.setValue(V, (int)(B->isChecked() ? 1 : 0))
|
||||
|
||||
#define GET_UNIT(name, field, f, t) \
|
||||
|
@ -60,11 +62,11 @@
|
|||
else \
|
||||
prefs.field = defval
|
||||
|
||||
#define GET_TXT(name, field) \
|
||||
v = s.value(QString(name)); \
|
||||
if (v.isValid()) \
|
||||
prefs.field = strdup(qPrintable(v.toString())); \
|
||||
else \
|
||||
#define GET_TXT(name, field) \
|
||||
v = s.value(QString(name)); \
|
||||
if (v.isValid()) \
|
||||
prefs.field = copy_qstring(v.toString()); \
|
||||
else \
|
||||
prefs.field = copy_string(default_prefs.field)
|
||||
|
||||
#define SAVE_OR_REMOVE_SPECIAL(_setting, _default, _compare, _value) \
|
||||
|
|
|
@ -99,7 +99,7 @@ extern "C" const char *printGPSCoords(int lat, int lon)
|
|||
} else {
|
||||
result.sprintf("%f %f", (double) lat / 1000000.0, (double) lon / 1000000.0);
|
||||
}
|
||||
return strdup(qPrintable(result));
|
||||
return copy_qstring(result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -387,13 +387,13 @@ extern "C" char *move_away(const char *old_path)
|
|||
#endif
|
||||
return strdup("");
|
||||
}
|
||||
return strdup(qPrintable(newPath));
|
||||
return copy_qstring(newPath);
|
||||
}
|
||||
|
||||
extern "C" char *get_file_name(const char *fileName)
|
||||
{
|
||||
QFileInfo fileInfo(fileName);
|
||||
return strdup(fileInfo.fileName().toUtf8());
|
||||
return copy_qstring(fileInfo.fileName());
|
||||
}
|
||||
|
||||
extern "C" void copy_image_and_overwrite(const char *cfileName, const char *path, const char *cnewName)
|
||||
|
@ -473,7 +473,7 @@ extern "C" const char *subsurface_user_agent()
|
|||
{
|
||||
static QString uA = getUserAgent();
|
||||
|
||||
return strdup(qPrintable(uA));
|
||||
return copy_qstring(uA);
|
||||
}
|
||||
|
||||
/* TOOD: Move this to SettingsObjectWrapper, and also fix this complexity.
|
||||
|
@ -504,7 +504,7 @@ QString uiLanguage(QLocale *callerLoc)
|
|||
uiLang = languages[2];
|
||||
else
|
||||
uiLang = languages[0];
|
||||
prefs.locale.lang_locale = copy_string(qPrintable(uiLang));
|
||||
prefs.locale.lang_locale = copy_qstring(uiLang);
|
||||
GET_BOOL("time_format_override", time_format_override);
|
||||
GET_BOOL("date_format_override", date_format_override);
|
||||
GET_TXT("time_format", time_format);
|
||||
|
@ -540,11 +540,11 @@ QString uiLanguage(QLocale *callerLoc)
|
|||
dateFormat.replace("'en' 'den' d:'e'", " d");
|
||||
if (!prefs.date_format_override || empty_string(prefs.date_format)) {
|
||||
free((void *)prefs.date_format);
|
||||
prefs.date_format = strdup(qPrintable(dateFormat));
|
||||
prefs.date_format = copy_qstring(dateFormat);
|
||||
}
|
||||
if (!prefs.date_format_override || empty_string(prefs.date_format_short)) {
|
||||
free((void *)prefs.date_format_short);
|
||||
prefs.date_format_short = strdup(qPrintable(shortDateFormat));
|
||||
prefs.date_format_short = copy_qstring(shortDateFormat);
|
||||
}
|
||||
}
|
||||
if (!prefs.time_format_override || empty_string(prefs.time_format)) {
|
||||
|
@ -552,7 +552,7 @@ QString uiLanguage(QLocale *callerLoc)
|
|||
timeFormat.replace("(t)", "").replace(" t", "").replace("t", "").replace("hh", "h").replace("HH", "H").replace("'kl'.", "");
|
||||
timeFormat.replace(".ss", "").replace(":ss", "").replace("ss", "");
|
||||
free((void *)prefs.time_format);
|
||||
prefs.time_format = strdup(qPrintable(timeFormat));
|
||||
prefs.time_format = copy_qstring(timeFormat);
|
||||
}
|
||||
return uiLang;
|
||||
}
|
||||
|
@ -998,7 +998,7 @@ QString get_short_dive_date_string(timestamp_t when)
|
|||
const char *get_dive_date_c_string(timestamp_t when)
|
||||
{
|
||||
QString text = get_dive_date_string(when);
|
||||
return strdup(qPrintable(text));
|
||||
return copy_qstring(text);
|
||||
}
|
||||
|
||||
extern "C" const char *get_current_date()
|
||||
|
@ -1008,7 +1008,7 @@ extern "C" const char *get_current_date()
|
|||
|
||||
current_date = loc.toString(ts, QString(prefs.date_format_short));
|
||||
|
||||
return strdup(qPrintable(current_date));
|
||||
return copy_qstring(current_date);
|
||||
}
|
||||
|
||||
bool is_same_day(timestamp_t trip_when, timestamp_t dive_when)
|
||||
|
@ -1098,7 +1098,7 @@ const QString hashfile_name()
|
|||
|
||||
extern "C" char *hashfile_name_string()
|
||||
{
|
||||
return strdup(qPrintable(hashfile_name()));
|
||||
return copy_qstring(hashfile_name());
|
||||
}
|
||||
|
||||
void read_hashes()
|
||||
|
@ -1247,7 +1247,7 @@ void learnImages(const QDir dir, int max_recursions)
|
|||
|
||||
extern "C" const char *local_file_path(struct picture *picture)
|
||||
{
|
||||
return strdup(qPrintable(localFilePath(picture->filename)));
|
||||
return copy_qstring(localFilePath(picture->filename));
|
||||
}
|
||||
|
||||
extern "C" bool picture_exists(struct picture *picture)
|
||||
|
@ -1266,7 +1266,7 @@ const QString picturedir()
|
|||
|
||||
extern "C" char *picturedir_string()
|
||||
{
|
||||
return strdup(qPrintable(picturedir()));
|
||||
return copy_qstring(picturedir());
|
||||
}
|
||||
|
||||
/* when we get a picture from git storage (local or remote) and can't find the picture
|
||||
|
@ -1446,7 +1446,7 @@ int getCloudURL(QString &filename)
|
|||
return report_error("Please configure Cloud storage email and password in the preferences");
|
||||
if (email != prefs.cloud_storage_email_encoded) {
|
||||
free((void *)prefs.cloud_storage_email_encoded);
|
||||
prefs.cloud_storage_email_encoded = strdup(qPrintable(email));
|
||||
prefs.cloud_storage_email_encoded = copy_qstring(email);
|
||||
}
|
||||
filename = QString(QString(prefs.cloud_git_url) + "/%1[%1]").arg(email);
|
||||
if (verbose)
|
||||
|
@ -1458,7 +1458,7 @@ extern "C" char *cloud_url()
|
|||
{
|
||||
QString filename;
|
||||
getCloudURL(filename);
|
||||
return strdup(qPrintable(filename));
|
||||
return copy_qstring(filename);
|
||||
}
|
||||
|
||||
extern "C" bool getProxyString(char **buffer)
|
||||
|
@ -1471,7 +1471,7 @@ extern "C" bool getProxyString(char **buffer)
|
|||
else
|
||||
proxy = QString("http://%1:%2").arg(prefs.proxy_host).arg(prefs.proxy_port);
|
||||
if (buffer)
|
||||
*buffer = strdup(qPrintable(proxy));
|
||||
*buffer = copy_qstring(proxy);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
@ -1558,7 +1558,7 @@ int parse_seabear_header(const char *filename, char **params, int pnr)
|
|||
while ((parseLine = f.readLine().trimmed()).length() > 0 && !f.atEnd()) {
|
||||
if (parseLine.contains("//DIVE NR: ")) {
|
||||
params[pnr++] = strdup("diveNro");
|
||||
params[pnr++] = strdup(qPrintable(parseLine.replace(QString::fromLatin1("//DIVE NR: "), QString::fromLatin1(""))));
|
||||
params[pnr++] = copy_qstring(parseLine.replace(QString::fromLatin1("//DIVE NR: "), QString::fromLatin1("")));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1573,7 +1573,7 @@ int parse_seabear_header(const char *filename, char **params, int pnr)
|
|||
while ((parseLine = f.readLine().trimmed()).length() > 0 && !f.atEnd()) {
|
||||
if (parseLine.contains("//Hardware Version: ")) {
|
||||
params[pnr++] = strdup("hw");
|
||||
params[pnr++] = strdup(qPrintable(parseLine.replace(QString::fromLatin1("//Hardware Version: "), QString::fromLatin1("\"Seabear ")).trimmed().append("\"")));
|
||||
params[pnr++] = copy_qstring(parseLine.replace(QString::fromLatin1("//Hardware Version: "), QString::fromLatin1("\"Seabear ")).trimmed().append("\""));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1586,7 +1586,7 @@ int parse_seabear_header(const char *filename, char **params, int pnr)
|
|||
while ((parseLine = f.readLine().trimmed()).length() > 0 && !f.atEnd()) {
|
||||
if (parseLine.contains("//Log interval: ")) {
|
||||
params[pnr++] = strdup("delta");
|
||||
params[pnr++] = strdup(qPrintable(parseLine.remove(QString::fromLatin1("//Log interval: ")).trimmed().remove(QString::fromLatin1(" s"))));
|
||||
params[pnr++] = copy_qstring(parseLine.remove(QString::fromLatin1("//Log interval: ")).trimmed().remove(QString::fromLatin1(" s")));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1601,7 +1601,7 @@ int parse_seabear_header(const char *filename, char **params, int pnr)
|
|||
QString needle = "//Mode: ";
|
||||
if (parseLine.contains(needle)) {
|
||||
params[pnr++] = strdup("diveMode");
|
||||
params[pnr++] = strdup(qPrintable(parseLine.replace(needle, QString::fromLatin1("")).prepend("\"").append("\"")));
|
||||
params[pnr++] = copy_qstring(parseLine.replace(needle, QString::fromLatin1("")).prepend("\"").append("\""));
|
||||
}
|
||||
}
|
||||
f.seek(0);
|
||||
|
@ -1614,7 +1614,7 @@ int parse_seabear_header(const char *filename, char **params, int pnr)
|
|||
QString needle = "//Firmware Version: ";
|
||||
if (parseLine.contains(needle)) {
|
||||
params[pnr++] = strdup("Firmware");
|
||||
params[pnr++] = strdup(qPrintable(parseLine.replace(needle, QString::fromLatin1("")).prepend("\"").append("\"")));
|
||||
params[pnr++] = copy_qstring(parseLine.replace(needle, QString::fromLatin1("")).prepend("\"").append("\""));
|
||||
}
|
||||
}
|
||||
f.seek(0);
|
||||
|
@ -1623,7 +1623,7 @@ int parse_seabear_header(const char *filename, char **params, int pnr)
|
|||
QString needle = "//Serial number: ";
|
||||
if (parseLine.contains(needle)) {
|
||||
params[pnr++] = strdup("Serial");
|
||||
params[pnr++] = strdup(qPrintable(parseLine.replace(needle, QString::fromLatin1("")).prepend("\"").append("\"")));
|
||||
params[pnr++] = copy_qstring(parseLine.replace(needle, QString::fromLatin1("")).prepend("\"").append("\""));
|
||||
}
|
||||
}
|
||||
f.seek(0);
|
||||
|
@ -1632,7 +1632,7 @@ int parse_seabear_header(const char *filename, char **params, int pnr)
|
|||
QString needle = "//GF: ";
|
||||
if (parseLine.contains(needle)) {
|
||||
params[pnr++] = strdup("GF");
|
||||
params[pnr++] = strdup(qPrintable(parseLine.replace(needle, QString::fromLatin1("")).prepend("\"").append("\"")));
|
||||
params[pnr++] = copy_qstring(parseLine.replace(needle, QString::fromLatin1("")).prepend("\"").append("\""));
|
||||
}
|
||||
}
|
||||
f.seek(0);
|
||||
|
@ -2143,3 +2143,8 @@ extern "C" void put_vformat_loc(struct membuffer *b, const char *fmt, va_list ar
|
|||
memcpy(b->buffer + b->len, data, utf8_size);
|
||||
b->len += utf8_size;
|
||||
}
|
||||
|
||||
char *copy_qstring(const QString &s)
|
||||
{
|
||||
return strdup(qPrintable(s));
|
||||
}
|
||||
|
|
|
@ -54,9 +54,9 @@ void init_proxy();
|
|||
QString getUUID();
|
||||
QStringList imageExtensionFilters();
|
||||
char *intdup(int index);
|
||||
char *copy_qstring(const QString &);
|
||||
__printf(1, 2) QString asprintf_loc(const char *cformat, ...);
|
||||
__printf(1, 0) QString vasprintf_loc(const char *cformat, va_list ap);
|
||||
|
||||
#endif
|
||||
|
||||
// 3) Functions visible to C and C++
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
#include <QDate>
|
||||
#include <QNetworkProxy>
|
||||
|
||||
#include "core/dive.h" // TODO: remove copy_string from dive.h
|
||||
#include "core/helpers.h"
|
||||
|
||||
DiveComputerSettings::DiveComputerSettings(QObject *parent):
|
||||
|
@ -48,7 +47,7 @@ void DiveComputerSettings::setVendor(const QString& vendor)
|
|||
s.beginGroup(group);
|
||||
s.setValue("dive_computer_vendor", vendor);
|
||||
free((void *)prefs.dive_computer.vendor);
|
||||
prefs.dive_computer.vendor = copy_string(qPrintable(vendor));
|
||||
prefs.dive_computer.vendor = copy_qstring(vendor);
|
||||
}
|
||||
|
||||
void DiveComputerSettings::setProduct(const QString& product)
|
||||
|
@ -60,7 +59,7 @@ void DiveComputerSettings::setProduct(const QString& product)
|
|||
s.beginGroup(group);
|
||||
s.setValue("dive_computer_product", product);
|
||||
free((void *)prefs.dive_computer.product);
|
||||
prefs.dive_computer.product = copy_string(qPrintable(product));
|
||||
prefs.dive_computer.product = copy_qstring(product);
|
||||
}
|
||||
|
||||
void DiveComputerSettings::setDevice(const QString& device)
|
||||
|
@ -72,7 +71,7 @@ void DiveComputerSettings::setDevice(const QString& device)
|
|||
s.beginGroup(group);
|
||||
s.setValue("dive_computer_device", device);
|
||||
free((void *)prefs.dive_computer.device);
|
||||
prefs.dive_computer.device = copy_string(qPrintable(device));
|
||||
prefs.dive_computer.device = copy_qstring(device);
|
||||
}
|
||||
|
||||
void DiveComputerSettings::setDeviceName(const QString& device_name)
|
||||
|
@ -84,7 +83,7 @@ void DiveComputerSettings::setDeviceName(const QString& device_name)
|
|||
s.beginGroup(group);
|
||||
s.setValue("dive_computer_device_name", device_name);
|
||||
free((void *)prefs.dive_computer.device_name);
|
||||
prefs.dive_computer.device_name = copy_string(qPrintable(device_name));
|
||||
prefs.dive_computer.device_name = copy_qstring(device_name);
|
||||
}
|
||||
|
||||
void DiveComputerSettings::setDownloadMode(int mode)
|
||||
|
@ -145,7 +144,7 @@ void UpdateManagerSettings::setLastVersionUsed(const QString& value)
|
|||
s.beginGroup(group);
|
||||
s.setValue("LastVersionUsed", value);
|
||||
free((void *)prefs.update_manager.last_version_used);
|
||||
prefs.update_manager.last_version_used = copy_string(qPrintable(value));
|
||||
prefs.update_manager.last_version_used = copy_qstring(value);
|
||||
emit lastVersionUsedChanged(value);
|
||||
}
|
||||
|
||||
|
@ -158,7 +157,7 @@ void UpdateManagerSettings::setNextCheck(const QDate& date)
|
|||
s.beginGroup(group);
|
||||
s.setValue("NextCheck", date);
|
||||
free((void *)prefs.update_manager.next_check);
|
||||
prefs.update_manager.next_check = copy_string(qPrintable(date.toString("dd/MM/yyyy")));
|
||||
prefs.update_manager.next_check = copy_qstring(date.toString("dd/MM/yyyy"));
|
||||
emit nextCheckChanged(date);
|
||||
}
|
||||
|
||||
|
@ -765,7 +764,7 @@ void FacebookSettings::setAccessToken (const QString& value)
|
|||
s.setValue("ConnectToken", value);
|
||||
#endif
|
||||
free((void *)prefs.facebook.access_token);
|
||||
prefs.facebook.access_token = copy_string(qPrintable(value));
|
||||
prefs.facebook.access_token = copy_qstring(value);
|
||||
emit accessTokenChanged(value);
|
||||
}
|
||||
|
||||
|
@ -780,7 +779,7 @@ void FacebookSettings::setUserId(const QString& value)
|
|||
s.setValue("UserId", value);
|
||||
#endif
|
||||
free((void *)prefs.facebook.user_id);
|
||||
prefs.facebook.user_id = copy_string(qPrintable(value));
|
||||
prefs.facebook.user_id = copy_qstring(value);
|
||||
emit userIdChanged(value);
|
||||
}
|
||||
|
||||
|
@ -795,7 +794,7 @@ void FacebookSettings::setAlbumId(const QString& value)
|
|||
s.setValue("AlbumId", value);
|
||||
#endif
|
||||
free((void *)prefs.facebook.album_id);
|
||||
prefs.facebook.album_id = copy_string(qPrintable(value));
|
||||
prefs.facebook.album_id = copy_qstring(value);
|
||||
emit albumIdChanged(value);
|
||||
}
|
||||
|
||||
|
@ -908,7 +907,7 @@ void ProxySettings::setHost(const QString& value)
|
|||
s.beginGroup(group);
|
||||
s.setValue("proxy_host", value);
|
||||
free((void *)prefs.proxy_host);
|
||||
prefs.proxy_host = copy_string(qPrintable(value));
|
||||
prefs.proxy_host = copy_qstring(value);
|
||||
emit hostChanged(value);
|
||||
}
|
||||
|
||||
|
@ -942,7 +941,7 @@ void ProxySettings::setUser(const QString& value)
|
|||
s.beginGroup(group);
|
||||
s.setValue("proxy_user", value);
|
||||
free((void *)prefs.proxy_user);
|
||||
prefs.proxy_user = copy_string(qPrintable(value));
|
||||
prefs.proxy_user = copy_qstring(value);
|
||||
emit userChanged(value);
|
||||
}
|
||||
|
||||
|
@ -954,7 +953,7 @@ void ProxySettings::setPass(const QString& value)
|
|||
s.beginGroup(group);
|
||||
s.setValue("proxy_pass", value);
|
||||
free((void *)prefs.proxy_pass);
|
||||
prefs.proxy_pass = copy_string(qPrintable(value));
|
||||
prefs.proxy_pass = copy_qstring(value);
|
||||
emit passChanged(value);
|
||||
}
|
||||
|
||||
|
@ -1022,7 +1021,7 @@ void CloudStorageSettings::setPassword(const QString& value)
|
|||
s.beginGroup(group);
|
||||
s.setValue("password", value);
|
||||
free((void *)prefs.cloud_storage_password);
|
||||
prefs.cloud_storage_password = copy_string(qPrintable(value));
|
||||
prefs.cloud_storage_password = copy_qstring(value);
|
||||
emit passwordChanged(value);
|
||||
}
|
||||
|
||||
|
@ -1032,7 +1031,7 @@ void CloudStorageSettings::setNewPassword(const QString& value)
|
|||
return;
|
||||
/*TODO: This looks like wrong, but 'new password' is not saved on disk, why it's on prefs? */
|
||||
free((void *)prefs.cloud_storage_newpassword);
|
||||
prefs.cloud_storage_newpassword = copy_string(qPrintable(value));
|
||||
prefs.cloud_storage_newpassword = copy_qstring(value);
|
||||
emit newPasswordChanged(value);
|
||||
}
|
||||
|
||||
|
@ -1044,7 +1043,7 @@ void CloudStorageSettings::setEmail(const QString& value)
|
|||
s.beginGroup(group);
|
||||
s.setValue("email", value);
|
||||
free((void *)prefs.cloud_storage_email);
|
||||
prefs.cloud_storage_email = copy_string(qPrintable(value));
|
||||
prefs.cloud_storage_email = copy_qstring(value);
|
||||
emit emailChanged(value);
|
||||
}
|
||||
|
||||
|
@ -1056,7 +1055,7 @@ void CloudStorageSettings::setUserId(const QString& value)
|
|||
QSettings s;
|
||||
s.setValue("subsurface_webservice_uid", value);
|
||||
free((void *)prefs.userid);
|
||||
prefs.userid = copy_string(qPrintable(value));
|
||||
prefs.userid = copy_qstring(value);
|
||||
emit userIdChanged(value);
|
||||
}
|
||||
|
||||
|
@ -1066,7 +1065,7 @@ void CloudStorageSettings::setEmailEncoded(const QString& value)
|
|||
return;
|
||||
/*TODO: This looks like wrong, but 'email encoded' is not saved on disk, why it's on prefs? */
|
||||
free((void *)prefs.cloud_storage_email_encoded);
|
||||
prefs.cloud_storage_email_encoded = copy_string(qPrintable(value));
|
||||
prefs.cloud_storage_email_encoded = copy_qstring(value);
|
||||
emit emailEncodedChanged(value);
|
||||
}
|
||||
|
||||
|
@ -1119,8 +1118,8 @@ void CloudStorageSettings::setBaseUrl(const QString& value)
|
|||
QSettings s;
|
||||
s.beginGroup(group);
|
||||
s.setValue("cloud_base_url", value);
|
||||
prefs.cloud_base_url = copy_string(qPrintable(value));
|
||||
prefs.cloud_git_url = copy_string(qPrintable(QString(prefs.cloud_base_url) + "/git"));
|
||||
prefs.cloud_base_url = copy_qstring(value);
|
||||
prefs.cloud_git_url = copy_qstring(QString(prefs.cloud_base_url) + "/git");
|
||||
}
|
||||
|
||||
void CloudStorageSettings::setGitUrl(const QString& value)
|
||||
|
@ -1796,7 +1795,7 @@ void GeneralSettingsObjectWrapper::setDefaultFilename(const QString& value)
|
|||
s.beginGroup(group);
|
||||
s.setValue("default_filename", value);
|
||||
free((void *)prefs.default_filename);
|
||||
prefs.default_filename = copy_string(qPrintable(value));
|
||||
prefs.default_filename = copy_qstring(value);
|
||||
emit defaultFilenameChanged(value);
|
||||
}
|
||||
|
||||
|
@ -1809,7 +1808,7 @@ void GeneralSettingsObjectWrapper::setDefaultCylinder(const QString& value)
|
|||
s.beginGroup(group);
|
||||
s.setValue("default_cylinder", value);
|
||||
free((void *)prefs.default_cylinder);
|
||||
prefs.default_cylinder = copy_string(qPrintable(value));
|
||||
prefs.default_cylinder = copy_qstring(value);
|
||||
emit defaultCylinderChanged(value);
|
||||
}
|
||||
|
||||
|
@ -1916,7 +1915,7 @@ void DisplaySettingsObjectWrapper::setDivelistFont(const QString& value)
|
|||
|
||||
if (!subsurface_ignore_font(qPrintable(newValue))) {
|
||||
free((void *)prefs.divelist_font);
|
||||
prefs.divelist_font = strdup(qPrintable(newValue));
|
||||
prefs.divelist_font = copy_qstring(newValue);
|
||||
qApp->setFont(QFont(newValue));
|
||||
}
|
||||
emit divelistFontChanged(newValue);
|
||||
|
@ -2013,7 +2012,7 @@ void LanguageSettingsObjectWrapper::setLangLocale(const QString &value)
|
|||
s.beginGroup(group);
|
||||
s.setValue("UiLangLocale", value);
|
||||
free((void *)prefs.locale.lang_locale);
|
||||
prefs.locale.lang_locale = copy_string(qPrintable(value));
|
||||
prefs.locale.lang_locale = copy_qstring(value);
|
||||
emit langLocaleChanged(value);
|
||||
}
|
||||
|
||||
|
@ -2025,7 +2024,7 @@ void LanguageSettingsObjectWrapper::setLanguage(const QString& value)
|
|||
s.beginGroup(group);
|
||||
s.setValue("UiLanguage", value);
|
||||
free((void *)prefs.locale.language);
|
||||
prefs.locale.language = copy_string(qPrintable(value));
|
||||
prefs.locale.language = copy_qstring(value);
|
||||
emit languageChanged(value);
|
||||
}
|
||||
|
||||
|
@ -2037,7 +2036,7 @@ void LanguageSettingsObjectWrapper::setTimeFormat(const QString& value)
|
|||
s.beginGroup(group);
|
||||
s.setValue("time_format", value);
|
||||
free((void *)prefs.time_format);
|
||||
prefs.time_format = copy_string(qPrintable(value));
|
||||
prefs.time_format = copy_qstring(value);
|
||||
emit timeFormatChanged(value);
|
||||
}
|
||||
|
||||
|
@ -2050,7 +2049,7 @@ void LanguageSettingsObjectWrapper::setDateFormat(const QString& value)
|
|||
s.beginGroup(group);
|
||||
s.setValue("date_format", value);
|
||||
free((void *)prefs.date_format);
|
||||
prefs.date_format = copy_string(qPrintable(value));
|
||||
prefs.date_format = copy_qstring(value);
|
||||
emit dateFormatChanged(value);
|
||||
}
|
||||
|
||||
|
@ -2063,7 +2062,7 @@ void LanguageSettingsObjectWrapper::setDateFormatShort(const QString& value)
|
|||
s.beginGroup(group);
|
||||
s.setValue("date_format_short", value);
|
||||
free((void *)prefs.date_format_short);
|
||||
prefs.date_format_short = copy_string(qPrintable(value));
|
||||
prefs.date_format_short = copy_qstring(value);
|
||||
emit dateFormatShortChanged(value);
|
||||
}
|
||||
|
||||
|
@ -2269,7 +2268,7 @@ void SettingsObjectWrapper::load()
|
|||
defaultFont = QFont(prefs.divelist_font);
|
||||
} else {
|
||||
free((void *)prefs.divelist_font);
|
||||
prefs.divelist_font = strdup(qPrintable(fontName));
|
||||
prefs.divelist_font = copy_qstring(fontName);
|
||||
}
|
||||
defaultFont.setPointSizeF(prefs.font_size);
|
||||
qApp->setFont(defaultFont);
|
||||
|
@ -2306,7 +2305,7 @@ void SettingsObjectWrapper::load()
|
|||
// creating the git url here is simply a convenience when C code wants
|
||||
// to compare against that git URL - it's always derived from the base URL
|
||||
GET_TXT("cloud_base_url", cloud_base_url);
|
||||
prefs.cloud_git_url = strdup(qPrintable(QString(prefs.cloud_base_url) + "/git"));
|
||||
prefs.cloud_git_url = copy_qstring(QString(prefs.cloud_base_url) + "/git");
|
||||
s.endGroup();
|
||||
|
||||
// Subsurface webservice id is stored outside of the groups
|
||||
|
@ -2368,7 +2367,7 @@ void SettingsObjectWrapper::load()
|
|||
prefs.update_manager.dont_check_exists = s.contains("DontCheckForUpdates");
|
||||
GET_BOOL("DontCheckForUpdates", update_manager.dont_check_for_updates);
|
||||
GET_TXT("LastVersionUsed", update_manager.last_version_used);
|
||||
prefs.update_manager.next_check = copy_string(qPrintable(s.value("NextCheck").toDate().toString("dd/MM/yyyy")));
|
||||
prefs.update_manager.next_check = copy_qstring(s.value("NextCheck").toDate().toString("dd/MM/yyyy"));
|
||||
s.endGroup();
|
||||
|
||||
s.beginGroup("Language");
|
||||
|
|
|
@ -910,9 +910,9 @@ void ConfigureDiveComputerDialog::getDeviceData()
|
|||
#else
|
||||
QString device = ui.device->currentText();
|
||||
#endif
|
||||
device_data.devname = strdup(qPrintable(device));
|
||||
device_data.vendor = strdup(qPrintable(selected_vendor));
|
||||
device_data.product = strdup(qPrintable(selected_product));
|
||||
device_data.devname = copy_qstring(device);
|
||||
device_data.vendor = copy_qstring(selected_vendor);
|
||||
device_data.product = copy_qstring(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(qPrintable(logFile));
|
||||
logfile_name = copy_qstring(logFile);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -949,7 +949,7 @@ void DiveListView::matchImagesToDives(QStringList fileNames)
|
|||
for_each_dive (j, dive) {
|
||||
if (!dive->selected)
|
||||
continue;
|
||||
dive_create_picture(dive, copy_string(qPrintable(fileName)), shiftDialog.amount(), shiftDialog.matchAll());
|
||||
dive_create_picture(dive, copy_qstring(fileName), shiftDialog.amount(), shiftDialog.matchAll());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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(qPrintable(hw));
|
||||
params[pnr++] = copy_qstring(hw);
|
||||
} else if (ui->knownImports->currentText().length() > 0) {
|
||||
params[pnr++] = strdup("hw");
|
||||
params[pnr++] = strdup(qPrintable(ui->knownImports->currentText().prepend("\"").append("\"")));
|
||||
params[pnr++] = copy_qstring(ui->knownImports->currentText().prepend("\"").append("\""));
|
||||
}
|
||||
params[pnr++] = NULL;
|
||||
|
||||
|
|
|
@ -297,7 +297,7 @@ void DownloadFromDCWidget::on_downloadCancelRetryButton_clicked()
|
|||
#endif
|
||||
if (data->vendor() == "Uemis") {
|
||||
char *colon;
|
||||
char *devname = strdup(qPrintable(ui.device->currentText()));
|
||||
char *devname = copy_qstring(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(qPrintable(logFile));
|
||||
logfile_name = copy_qstring(logFile);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -388,7 +388,7 @@ void DownloadFromDCWidget::pickDumpFile()
|
|||
filename, tr("Dump files") + " (*.bin)");
|
||||
if (!dumpFile.isEmpty()) {
|
||||
free(dumpfile_name);
|
||||
dumpfile_name = copy_string(qPrintable(dumpFile));
|
||||
dumpfile_name = copy_qstring(dumpFile);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ void LocationInformationWidget::acceptChanges()
|
|||
{
|
||||
char *uiString;
|
||||
struct dive_site *currentDs;
|
||||
uiString = copy_string(qPrintable(ui.diveSiteName->text()));
|
||||
uiString = copy_qstring(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(qPrintable(ui.diveSiteDescription->text()));
|
||||
uiString = copy_qstring(ui.diveSiteDescription->text());
|
||||
if (!same_string(uiString, currentDs->description)) {
|
||||
free(currentDs->description);
|
||||
currentDs->description = uiString;
|
||||
} else {
|
||||
free(uiString);
|
||||
}
|
||||
uiString = copy_string(qPrintable(ui.diveSiteCountry->text()));
|
||||
uiString = copy_qstring(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(qPrintable(ui.diveSiteNotes->document()->toPlainText()));
|
||||
uiString = copy_qstring(ui.diveSiteNotes->document()->toPlainText());
|
||||
if (!same_string(uiString, currentDs->notes)) {
|
||||
free(currentDs->notes);
|
||||
currentDs->notes = uiString;
|
||||
|
|
|
@ -935,7 +935,7 @@ void MainWindow::updateVariations(QString variations)
|
|||
{
|
||||
QString notes = QString(displayed_dive.notes);
|
||||
free(displayed_dive.notes);
|
||||
displayed_dive.notes = strdup(qPrintable(notes.replace("VARIATIONS", variations)));
|
||||
displayed_dive.notes = copy_qstring(notes.replace("VARIATIONS", variations));
|
||||
plannerDetails()->divePlanOutput()->setHtml(displayed_dive.notes);
|
||||
}
|
||||
|
||||
|
@ -1652,7 +1652,7 @@ int MainWindow::file_save_as(void)
|
|||
filename.remove(prefs.cloud_git_url);
|
||||
filename.remove(0, filename.indexOf("[") + 1);
|
||||
filename.replace("]", ".ssrf");
|
||||
default_filename = strdup(qPrintable(filename));
|
||||
default_filename = copy_qstring(filename);
|
||||
}
|
||||
// create a file dialog that allows us to save to a new file
|
||||
QFileDialog selection_dialog(this, tr("Save file as"), default_filename,
|
||||
|
|
|
@ -745,7 +745,7 @@ uint32_t MainTab::updateDiveSite(uint32_t pickedUuid, int divenr)
|
|||
if(createdNewDive) {
|
||||
copy_dive_site(origDs, newDs);
|
||||
free(newDs->name);
|
||||
newDs->name = copy_string(qPrintable(ui.location->text().constData()));
|
||||
newDs->name = copy_qstring(ui.location->text());
|
||||
newDs->uuid = pickedUuid;
|
||||
qDebug() << "Creating and copying dive site";
|
||||
} else if (newDs->latitude.udeg == 0 && newDs->longitude.udeg == 0) {
|
||||
|
@ -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(qPrintable(text));
|
||||
displayed_dive.buddy = copy_qstring(text);
|
||||
markChangedWidget(ui.buddy);
|
||||
}
|
||||
|
||||
|
@ -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(qPrintable(text));
|
||||
displayed_dive.divemaster = copy_qstring(text);
|
||||
markChangedWidget(ui.divemaster);
|
||||
}
|
||||
|
||||
|
@ -1303,7 +1303,7 @@ void MainTab::saveTaggedStrings()
|
|||
}
|
||||
}
|
||||
free(mydive->buddy);
|
||||
mydive->buddy = copy_string(qPrintable(newString));
|
||||
mydive->buddy = copy_qstring(newString);
|
||||
);
|
||||
addedList.clear();
|
||||
removedList.clear();
|
||||
|
@ -1325,7 +1325,7 @@ void MainTab::saveTaggedStrings()
|
|||
}
|
||||
}
|
||||
free(mydive->divemaster);
|
||||
mydive->divemaster = copy_string(qPrintable(newString));
|
||||
mydive->divemaster = copy_qstring(newString);
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1397,7 +1397,7 @@ void MainTab::on_diveTripLocation_textEdited(const QString& text)
|
|||
{
|
||||
if (currentTrip) {
|
||||
free(displayedTrip.location);
|
||||
displayedTrip.location = strdup(qPrintable(text));
|
||||
displayedTrip.location = copy_qstring(text);
|
||||
markChangedWidget(ui.diveTripLocation);
|
||||
}
|
||||
}
|
||||
|
@ -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(qPrintable(text));
|
||||
displayed_dive.suit = copy_qstring(text);
|
||||
markChangedWidget(ui.suit);
|
||||
}
|
||||
|
||||
|
@ -1419,15 +1419,15 @@ void MainTab::on_notes_textChanged()
|
|||
if (same_string(displayedTrip.notes, qPrintable(ui.notes->toPlainText())))
|
||||
return;
|
||||
free(displayedTrip.notes);
|
||||
displayedTrip.notes = strdup(qPrintable(ui.notes->toPlainText()));
|
||||
displayedTrip.notes = copy_qstring(ui.notes->toPlainText());
|
||||
} else {
|
||||
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(qPrintable(ui.notes->toHtml()));
|
||||
displayed_dive.notes = copy_qstring(ui.notes->toHtml());
|
||||
else
|
||||
displayed_dive.notes = strdup(qPrintable(ui.notes->toPlainText()));
|
||||
displayed_dive.notes = copy_qstring(ui.notes->toPlainText());
|
||||
}
|
||||
markChangedWidget(ui.notes);
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ QMLManager::QMLManager() : m_locationServiceEnabled(false),
|
|||
connect(qobject_cast<QApplication *>(QApplication::instance()), &QApplication::applicationStateChanged, this, &QMLManager::applicationStateChanged);
|
||||
|
||||
QString libdcLogFileName = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation).first() + "/libdivecomputer.log";
|
||||
logfile_name = strdup(qPrintable(libdcLogFileName));
|
||||
logfile_name = copy_qstring(libdcLogFileName);
|
||||
#if defined(Q_OS_ANDROID)
|
||||
appLogFileName = QStandardPaths::standardLocations(QStandardPaths::GenericDataLocation).first() + "/subsurface.log";
|
||||
appLogFile.setFileName(appLogFileName);
|
||||
|
@ -416,7 +416,7 @@ void QMLManager::saveCloudCredentials()
|
|||
s.sync();
|
||||
if (!same_string(prefs.cloud_storage_email, qPrintable(m_cloudUserName))) {
|
||||
free((void *)prefs.cloud_storage_email);
|
||||
prefs.cloud_storage_email = strdup(qPrintable(m_cloudUserName));
|
||||
prefs.cloud_storage_email = copy_qstring(m_cloudUserName);
|
||||
cloudCredentialsChanged = true;
|
||||
}
|
||||
|
||||
|
@ -429,7 +429,7 @@ void QMLManager::saveCloudCredentials()
|
|||
|
||||
if (!same_string(prefs.cloud_storage_password, qPrintable(m_cloudPassword))) {
|
||||
free((void *)prefs.cloud_storage_password);
|
||||
prefs.cloud_storage_password = strdup(qPrintable(m_cloudPassword));
|
||||
prefs.cloud_storage_password = copy_qstring(m_cloudPassword);
|
||||
}
|
||||
if (m_cloudUserName.isEmpty() || m_cloudPassword.isEmpty()) {
|
||||
setStartPageText(RED_FONT + tr("Please enter valid cloud credentials.") + END_FONT);
|
||||
|
@ -577,7 +577,7 @@ void QMLManager::retrieveUserid()
|
|||
if (!userid.isEmpty()) {
|
||||
// overwrite the existing userid
|
||||
free((void *)prefs.userid);
|
||||
prefs.userid = strdup(qPrintable(userid));
|
||||
prefs.userid = copy_qstring(userid);
|
||||
QSettings s;
|
||||
s.setValue("subsurface_webservice_uid", prefs.userid);
|
||||
s.sync();
|
||||
|
@ -1020,14 +1020,14 @@ void QMLManager::commitChanges(QString diveId, QString date, QString location, Q
|
|||
}
|
||||
|
||||
}
|
||||
d->cylinder[0].type.description = strdup(qPrintable(cylinder));
|
||||
d->cylinder[0].type.description = copy_qstring(cylinder);
|
||||
d->cylinder[0].type.size.mliter = size;
|
||||
d->cylinder[0].type.workingpressure.mbar = wp;
|
||||
}
|
||||
if (myDive->suit() != suit) {
|
||||
diveChanged = true;
|
||||
free(d->suit);
|
||||
d->suit = strdup(qPrintable(suit));
|
||||
d->suit = copy_qstring(suit);
|
||||
}
|
||||
if (myDive->buddy() != buddy) {
|
||||
if (buddy.contains(",")){
|
||||
|
@ -1035,12 +1035,12 @@ void QMLManager::commitChanges(QString diveId, QString date, QString location, Q
|
|||
}
|
||||
diveChanged = true;
|
||||
free(d->buddy);
|
||||
d->buddy = strdup(qPrintable(buddy));
|
||||
d->buddy = copy_qstring(buddy);
|
||||
}
|
||||
if (myDive->divemaster() != diveMaster) {
|
||||
diveChanged = true;
|
||||
free(d->divemaster);
|
||||
d->divemaster = strdup(qPrintable(diveMaster));
|
||||
d->divemaster = copy_qstring(diveMaster);
|
||||
}
|
||||
if (myDive->rating() != rating) {
|
||||
diveChanged = true;
|
||||
|
@ -1053,7 +1053,7 @@ void QMLManager::commitChanges(QString diveId, QString date, QString location, Q
|
|||
if (myDive->notes() != notes) {
|
||||
diveChanged = true;
|
||||
free(d->notes);
|
||||
d->notes = strdup(qPrintable(notes));
|
||||
d->notes = copy_qstring(notes);
|
||||
}
|
||||
// now that we have it all figured out, let's see what we need
|
||||
// to update
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include "core/units.h"
|
||||
#include "qt-models/divelocationmodel.h"
|
||||
#include "core/dive.h"
|
||||
#include "core/qthelper.h"
|
||||
#include <QDebug>
|
||||
#include <QLineEdit>
|
||||
#include <QIcon>
|
||||
|
@ -149,7 +149,7 @@ bool LocationInformationModel::setData(const QModelIndex &index, const QVariant
|
|||
|
||||
struct dive_site *ds = get_dive_site(index.row());
|
||||
free(ds->name);
|
||||
ds->name = copy_string(qPrintable(value.toString()));
|
||||
ds->name = copy_qstring(value.toString());
|
||||
emit dataChanged(index, index);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -160,7 +160,7 @@ void DivePlannerPointsModel::setupCylinders()
|
|||
}
|
||||
if (cylinder_none(&displayed_dive.cylinder[0])) {
|
||||
// roughly an AL80
|
||||
displayed_dive.cylinder[0].type.description = strdup(qPrintable(tr("unknown")));
|
||||
displayed_dive.cylinder[0].type.description = copy_qstring(tr("unknown"));
|
||||
displayed_dive.cylinder[0].type.size.mliter = 11100;
|
||||
displayed_dive.cylinder[0].type.workingpressure.mbar = 207000;
|
||||
}
|
||||
|
@ -1123,7 +1123,7 @@ void DivePlannerPointsModel::createPlan(bool replanCopy)
|
|||
// Deal with line breaks
|
||||
oldnotes.replace("\n", "<br>");
|
||||
oldnotes.append(displayed_dive.notes);
|
||||
displayed_dive.notes = strdup(qPrintable(oldnotes));
|
||||
displayed_dive.notes = copy_qstring(oldnotes);
|
||||
// If we save as new create a copy of the dive here
|
||||
if (replanCopy) {
|
||||
struct dive *copy = alloc_dive();
|
||||
|
|
|
@ -114,7 +114,7 @@ bool WeightModel::setData(const QModelIndex &index, const QVariant &value, int r
|
|||
}
|
||||
}
|
||||
if (ws_info[i].name == NULL) // didn't find a match
|
||||
ws->description = strdup(qPrintable(vString));
|
||||
ws->description = copy_qstring(vString);
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ void TestGitStorage::initTestCase()
|
|||
QString gitUrl(prefs.cloud_base_url);
|
||||
if (gitUrl.right(1) != "/")
|
||||
gitUrl += "/";
|
||||
prefs.cloud_git_url = strdup(qPrintable(gitUrl + "git"));
|
||||
prefs.cloud_git_url = copy_qstring(gitUrl + "git");
|
||||
s.endGroup();
|
||||
prefs.cloud_storage_email_encoded = strdup("ssrftest@hohndel.org");
|
||||
prefs.cloud_storage_password = strdup("geheim");
|
||||
|
|
Loading…
Add table
Reference in a new issue