mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-27 20:58:47 +00:00
ccdd92aeb7
This is a messy commit, because the "qPref" system relies heavily on QString, which means lots of conversions between the two worlds. Ultimately, I plan to base the preferences system on std::string and only convert to QString when pushing through Qt's property system or when writing into Qt's settings. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
37 lines
1.2 KiB
C++
37 lines
1.2 KiB
C++
// SPDX-License-Identifier: GPL-2.0
|
|
#include "qt-models/diveimportedmodel.h"
|
|
|
|
void cliDownloader(const std::string &vendor, const std::string &product, const std::string &device)
|
|
{
|
|
DiveImportedModel diveImportedModel;
|
|
DiveImportedModel::connect(&diveImportedModel, &DiveImportedModel::downloadFinished, [] {
|
|
// do something useful at the end of the download
|
|
printf("Finished\n");
|
|
});
|
|
|
|
auto data = diveImportedModel.thread.data();
|
|
data->setVendor(QString::fromStdString(vendor));
|
|
data->setProduct(QString::fromStdString(product));
|
|
data->setBluetoothMode(false);
|
|
if (data->vendor() == "Uemis") {
|
|
QString devname = QString::fromStdString(device);
|
|
int colon = devname.indexOf(QStringLiteral(":\\ (UEMISSDA)"));
|
|
if (colon >= 0) {
|
|
devname.truncate(colon + 2);
|
|
fprintf(stderr, "shortened devname to \"%s\"", qPrintable(devname));
|
|
}
|
|
data->setDevName(devname);
|
|
} else {
|
|
data->setDevName(QString::fromStdString(device));
|
|
}
|
|
|
|
// some assumptions - should all be configurable
|
|
data->setForceDownload(false);
|
|
data->setSaveLog(true);
|
|
data->setSaveDump(false);
|
|
data->setSyncTime(false);
|
|
|
|
diveImportedModel.startDownload();
|
|
diveImportedModel.waitForDownload();
|
|
diveImportedModel.recordDives();
|
|
}
|