mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Whitespace cleanup
Plus removal of a few qDebug() calls I introduced earlier. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
4559a26e31
commit
b2f4896f3c
7 changed files with 394 additions and 410 deletions
|
@ -9,8 +9,7 @@
|
|||
#include <QStringList>
|
||||
#include <QXmlStreamWriter>
|
||||
|
||||
ConfigureDiveComputer::ConfigureDiveComputer() :
|
||||
readThread(0),
|
||||
ConfigureDiveComputer::ConfigureDiveComputer() : readThread(0),
|
||||
writeThread(0),
|
||||
resetThread(0),
|
||||
firmwareThread(0)
|
||||
|
@ -72,32 +71,27 @@ bool ConfigureDiveComputer::saveXMLBackup(QString fileName, DeviceDetails *detai
|
|||
.arg(QString::number(details->gas1().oxygen),
|
||||
QString::number(details->gas1().helium),
|
||||
QString::number(details->gas1().type),
|
||||
QString::number(details->gas1().depth)
|
||||
);
|
||||
QString::number(details->gas1().depth));
|
||||
QString gas2 = QString("%1,%2,%3,%4")
|
||||
.arg(QString::number(details->gas2().oxygen),
|
||||
QString::number(details->gas2().helium),
|
||||
QString::number(details->gas2().type),
|
||||
QString::number(details->gas2().depth)
|
||||
);
|
||||
QString::number(details->gas2().depth));
|
||||
QString gas3 = QString("%1,%2,%3,%4")
|
||||
.arg(QString::number(details->gas3().oxygen),
|
||||
QString::number(details->gas3().helium),
|
||||
QString::number(details->gas3().type),
|
||||
QString::number(details->gas3().depth)
|
||||
);
|
||||
QString::number(details->gas3().depth));
|
||||
QString gas4 = QString("%1,%2,%3,%4")
|
||||
.arg(QString::number(details->gas4().oxygen),
|
||||
QString::number(details->gas4().helium),
|
||||
QString::number(details->gas4().type),
|
||||
QString::number(details->gas4().depth)
|
||||
);
|
||||
QString::number(details->gas4().depth));
|
||||
QString gas5 = QString("%1,%2,%3,%4")
|
||||
.arg(QString::number(details->gas5().oxygen),
|
||||
QString::number(details->gas5().helium),
|
||||
QString::number(details->gas5().type),
|
||||
QString::number(details->gas5().depth)
|
||||
);
|
||||
QString::number(details->gas5().depth));
|
||||
writer.writeTextElement("Gas1", gas1);
|
||||
writer.writeTextElement("Gas2", gas2);
|
||||
writer.writeTextElement("Gas3", gas3);
|
||||
|
@ -109,32 +103,27 @@ bool ConfigureDiveComputer::saveXMLBackup(QString fileName, DeviceDetails *detai
|
|||
.arg(QString::number(details->dil1().oxygen),
|
||||
QString::number(details->dil1().helium),
|
||||
QString::number(details->dil1().type),
|
||||
QString::number(details->dil1().depth)
|
||||
);
|
||||
QString::number(details->dil1().depth));
|
||||
QString dil2 = QString("%1,%2,%3,%4")
|
||||
.arg(QString::number(details->dil2().oxygen),
|
||||
QString::number(details->dil2().helium),
|
||||
QString::number(details->dil2().type),
|
||||
QString::number(details->dil2().depth)
|
||||
);
|
||||
QString::number(details->dil2().depth));
|
||||
QString dil3 = QString("%1,%2,%3,%4")
|
||||
.arg(QString::number(details->dil3().oxygen),
|
||||
QString::number(details->dil3().helium),
|
||||
QString::number(details->dil3().type),
|
||||
QString::number(details->dil3().depth)
|
||||
);
|
||||
QString::number(details->dil3().depth));
|
||||
QString dil4 = QString("%1,%2,%3,%4")
|
||||
.arg(QString::number(details->dil4().oxygen),
|
||||
QString::number(details->dil4().helium),
|
||||
QString::number(details->dil4().type),
|
||||
QString::number(details->dil4().depth)
|
||||
);
|
||||
QString::number(details->dil4().depth));
|
||||
QString dil5 = QString("%1,%2,%3,%4")
|
||||
.arg(QString::number(details->dil5().oxygen),
|
||||
QString::number(details->dil5().helium),
|
||||
QString::number(details->dil5().type),
|
||||
QString::number(details->dil5().depth)
|
||||
);
|
||||
QString::number(details->dil5().depth));
|
||||
writer.writeTextElement("Dil1", dil1);
|
||||
writer.writeTextElement("Dil2", dil2);
|
||||
writer.writeTextElement("Dil3", dil3);
|
||||
|
@ -144,24 +133,19 @@ bool ConfigureDiveComputer::saveXMLBackup(QString fileName, DeviceDetails *detai
|
|||
//Add set point values
|
||||
QString sp1 = QString("%1,%2")
|
||||
.arg(QString::number(details->sp1().sp),
|
||||
QString::number(details->sp1().depth)
|
||||
);
|
||||
QString::number(details->sp1().depth));
|
||||
QString sp2 = QString("%1,%2")
|
||||
.arg(QString::number(details->sp2().sp),
|
||||
QString::number(details->sp2().depth)
|
||||
);
|
||||
QString::number(details->sp2().depth));
|
||||
QString sp3 = QString("%1,%2")
|
||||
.arg(QString::number(details->sp3().sp),
|
||||
QString::number(details->sp3().depth)
|
||||
);
|
||||
QString::number(details->sp3().depth));
|
||||
QString sp4 = QString("%1,%2")
|
||||
.arg(QString::number(details->sp4().sp),
|
||||
QString::number(details->sp4().depth)
|
||||
);
|
||||
QString::number(details->sp4().depth));
|
||||
QString sp5 = QString("%1,%2")
|
||||
.arg(QString::number(details->sp5().sp),
|
||||
QString::number(details->sp5().depth)
|
||||
);
|
||||
QString::number(details->sp5().depth));
|
||||
writer.writeTextElement("SetPoint1", sp1);
|
||||
writer.writeTextElement("SetPoint2", sp2);
|
||||
writer.writeTextElement("SetPoint3", sp3);
|
||||
|
@ -513,7 +497,6 @@ bool ConfigureDiveComputer::restoreXMLBackup(QString fileName, DeviceDetails *de
|
|||
void ConfigureDiveComputer::startFirmwareUpdate(QString fileName, device_data_t *data)
|
||||
{
|
||||
setState(FWUPDATE);
|
||||
|
||||
if (firmwareThread)
|
||||
firmwareThread->deleteLater();
|
||||
|
||||
|
@ -521,7 +504,6 @@ void ConfigureDiveComputer::startFirmwareUpdate(QString fileName, device_data_t
|
|||
connect(firmwareThread, SIGNAL(finished()),
|
||||
this, SLOT(firmwareThreadFinished()), Qt::QueuedConnection);
|
||||
connect(firmwareThread, SIGNAL(error(QString)), this, SLOT(setError(QString)));
|
||||
|
||||
firmwareThread->start();
|
||||
}
|
||||
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
|
||||
#include "libxml/xmlreader.h"
|
||||
|
||||
class ConfigureDiveComputer : public QObject
|
||||
{
|
||||
class ConfigureDiveComputer : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ConfigureDiveComputer();
|
||||
|
@ -50,7 +49,8 @@ private:
|
|||
ResetSettingsThread *resetThread;
|
||||
FirmwareUpdateThread *firmwareThread;
|
||||
void setState(states newState);
|
||||
private slots:
|
||||
private
|
||||
slots:
|
||||
void readThreadFinished();
|
||||
void writeThreadFinished();
|
||||
void resetThreadFinished();
|
||||
|
|
|
@ -106,17 +106,17 @@ static dc_status_t local_hw_ostc_device_clock(void *ignored, dc_datetime_t *time
|
|||
}
|
||||
#endif
|
||||
|
||||
ReadSettingsThread::ReadSettingsThread(QObject *parent, device_data_t *data)
|
||||
: QThread(parent), m_data(data)
|
||||
ReadSettingsThread::ReadSettingsThread(QObject *parent, device_data_t *data) : QThread(parent), m_data(data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static int read_ostc_cf(unsigned char data[], unsigned char cf) {
|
||||
static int read_ostc_cf(unsigned char data[], unsigned char cf)
|
||||
{
|
||||
return data[128 + (cf % 32) * 4 + 3] << 8 ^ data[128 + (cf % 32) * 4 + 2];
|
||||
}
|
||||
|
||||
static void write_ostc_cf(unsigned char data[], unsigned char cf, unsigned char max_CF, unsigned int value) {
|
||||
static void write_ostc_cf(unsigned char data[], unsigned char cf, unsigned char max_CF, unsigned int value)
|
||||
{
|
||||
// Only write settings supported by this firmware.
|
||||
if (cf > max_CF)
|
||||
return;
|
||||
|
@ -818,8 +818,7 @@ unsupported_dc_error:
|
|||
}
|
||||
}
|
||||
|
||||
WriteSettingsThread::WriteSettingsThread(QObject *parent, device_data_t *data)
|
||||
: QThread(parent), m_data(data)
|
||||
WriteSettingsThread::WriteSettingsThread(QObject *parent, device_data_t *data) : QThread(parent), m_data(data)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1112,11 +1111,11 @@ void WriteSettingsThread::run()
|
|||
data[33] = 4;
|
||||
else if (gas5.type == 2)
|
||||
data[33] = 5;
|
||||
else {
|
||||
else
|
||||
// FIXME: No gas was First?
|
||||
// Set gas 1 to first
|
||||
data[33] = 1;
|
||||
}
|
||||
|
||||
data[34] = m_deviceDetails->decoType();
|
||||
//Byte36:
|
||||
//Use O2 Sensor Module in CC Modes (0= OFF, 1= ON) (Only available in old OSTC1 - unused for OSTC Mk.2/2N)
|
||||
|
@ -1165,9 +1164,9 @@ void WriteSettingsThread::run()
|
|||
// Byte66-90:
|
||||
// (25Bytes): Custom Text for Surfacemode (Real text must end with "}")
|
||||
// Example: OSTC Dive Computer} (19 Characters incl. "}") Bytes 85-90 will be ignored.
|
||||
if (m_deviceDetails->customText() == "")
|
||||
if (m_deviceDetails->customText() == "") {
|
||||
data[64] = 0;
|
||||
else {
|
||||
} else {
|
||||
data[64] = 1;
|
||||
// Copy the string to the right place in the memory, padded with 0x20 (" ")
|
||||
strncpy((char *)data + 65, QString("%1").arg(m_deviceDetails->customText(), -23, QChar(' ')).toUtf8().data(), 23);
|
||||
|
@ -1239,11 +1238,11 @@ void WriteSettingsThread::run()
|
|||
data[115] = 4;
|
||||
else if (dil5.type == 2)
|
||||
data[115] = 5;
|
||||
else {
|
||||
else
|
||||
// FIXME: No first diluent?
|
||||
// Set gas 1 to fist
|
||||
data[115] = 1;
|
||||
}
|
||||
|
||||
// Byte117-128:
|
||||
// not used/reserved
|
||||
// Byte129-256:
|
||||
|
@ -1357,29 +1356,30 @@ void WriteSettingsThread::run()
|
|||
lastError = tr("This feature is not yet available for the selected dive computer.");
|
||||
emit error(lastError);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
lastError = tr("Could not a establish connection to the dive computer.");
|
||||
emit error(lastError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FirmwareUpdateThread::FirmwareUpdateThread(QObject *parent, device_data_t *data, QString fileName)
|
||||
: QThread(parent), m_data(data), m_fileName(fileName)
|
||||
FirmwareUpdateThread::FirmwareUpdateThread(QObject *parent, device_data_t *data, QString fileName) : QThread(parent), m_data(data), m_fileName(fileName)
|
||||
{
|
||||
}
|
||||
|
||||
void FirmwareUpdateThread::run()
|
||||
{
|
||||
qDebug() << "in FirmwareUpdateThread::run";
|
||||
bool supported = false;
|
||||
dc_status_t rc;
|
||||
rc = dc_device_open(&m_data->device, m_data->context, m_data->descriptor, m_data->devname);
|
||||
qDebug() << "got" << rc << "as return for dc_device_open of" << m_data->devname;
|
||||
if (rc == DC_STATUS_SUCCESS) {
|
||||
switch (dc_device_get_type(m_data->device)) {
|
||||
#if DC_VERSION_CHECK(0, 5, 0)
|
||||
case DC_FAMILY_HW_OSTC3:
|
||||
supported = true;
|
||||
qDebug() << "it's an OSTC3, let's do it!";
|
||||
rc = hw_ostc3_device_fwupdate(m_data->device, m_fileName.toUtf8().data());
|
||||
break;
|
||||
case DC_FAMILY_HW_OSTC:
|
||||
|
@ -1399,16 +1399,14 @@ void FirmwareUpdateThread::run()
|
|||
} else if (rc != DC_STATUS_SUCCESS) {
|
||||
lastError = tr("Firmware update failed!");
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
lastError = tr("Could not a establish connection to the dive computer.");
|
||||
emit error(lastError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ResetSettingsThread::ResetSettingsThread(QObject *parent, device_data_t *data)
|
||||
: QThread(parent), m_data(data)
|
||||
ResetSettingsThread::ResetSettingsThread(QObject *parent, device_data_t *data) : QThread(parent), m_data(data)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1430,8 +1428,7 @@ void ResetSettingsThread::run()
|
|||
lastError = tr("This feature is not yet available for the selected dive computer.");
|
||||
emit error(lastError);
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
lastError = tr("Could not a establish connection to the dive computer.");
|
||||
emit error(lastError);
|
||||
}
|
||||
|
|
|
@ -8,8 +8,7 @@
|
|||
#include <QDateTime>
|
||||
#include "devicedetails.h"
|
||||
|
||||
class ReadSettingsThread : public QThread
|
||||
{
|
||||
class ReadSettingsThread : public QThread {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ReadSettingsThread(QObject *parent, device_data_t *data);
|
||||
|
@ -19,12 +18,12 @@ public:
|
|||
signals:
|
||||
void error(QString err);
|
||||
void devicedetails(DeviceDetails *newDeviceDetails);
|
||||
|
||||
private:
|
||||
device_data_t *m_data;
|
||||
};
|
||||
|
||||
class WriteSettingsThread : public QThread
|
||||
{
|
||||
class WriteSettingsThread : public QThread {
|
||||
Q_OBJECT
|
||||
public:
|
||||
WriteSettingsThread(QObject *parent, device_data_t *data);
|
||||
|
@ -34,13 +33,13 @@ public:
|
|||
QString lastError;
|
||||
signals:
|
||||
void error(QString err);
|
||||
|
||||
private:
|
||||
device_data_t *m_data;
|
||||
DeviceDetails *m_deviceDetails;
|
||||
};
|
||||
|
||||
class FirmwareUpdateThread : public QThread
|
||||
{
|
||||
class FirmwareUpdateThread : public QThread {
|
||||
Q_OBJECT
|
||||
public:
|
||||
FirmwareUpdateThread(QObject *parent, device_data_t *data, QString fileName);
|
||||
|
@ -50,13 +49,13 @@ signals:
|
|||
void progress(int percent);
|
||||
void message(QString msg);
|
||||
void error(QString err);
|
||||
|
||||
private:
|
||||
device_data_t *m_data;
|
||||
QString m_fileName;
|
||||
};
|
||||
|
||||
class ResetSettingsThread : public QThread
|
||||
{
|
||||
class ResetSettingsThread : public QThread {
|
||||
Q_OBJECT
|
||||
public:
|
||||
ResetSettingsThread(QObject *parent, device_data_t *data);
|
||||
|
@ -66,6 +65,7 @@ signals:
|
|||
void progress(int percent);
|
||||
void message(QString msg);
|
||||
void error(QString err);
|
||||
|
||||
private:
|
||||
device_data_t *m_data;
|
||||
};
|
||||
|
|
11
profile.c
11
profile.c
|
@ -831,7 +831,9 @@ void calculate_deco_information(struct dive *dive, struct divecomputer *dc, stru
|
|||
|
||||
entry->ambpressure = (double)depth_to_mbar(entry->depth, dive) / 1000.0;
|
||||
entry->gfline = MAX((double)prefs.gflow, (entry->ambpressure - surface_pressure) / (gf_low_pressure_this_dive - surface_pressure) *
|
||||
(prefs.gflow - prefs.gfhigh) + prefs.gfhigh) * (100.0 - AMB_PERCENTAGE) / 100.0 + AMB_PERCENTAGE;
|
||||
(prefs.gflow - prefs.gfhigh) +
|
||||
prefs.gfhigh) *
|
||||
(100.0 - AMB_PERCENTAGE) / 100.0 + AMB_PERCENTAGE;
|
||||
if (t0 != t1 && t1 - t0 < time_stepsize)
|
||||
time_stepsize = t1 - t0;
|
||||
for (j = t0 + time_stepsize; j <= t1; j += time_stepsize) {
|
||||
|
@ -888,7 +890,8 @@ void calculate_deco_information(struct dive *dive, struct divecomputer *dc, stru
|
|||
* calculates the po2 value from the sensor data. Several rules are applied, depending on how many o2 sensors
|
||||
* there are and the differences among the readings from these sensors.
|
||||
*/
|
||||
static int calculate_ccr_po2(struct plot_data *entry, struct divecomputer *dc) {
|
||||
static int calculate_ccr_po2(struct plot_data *entry, struct divecomputer *dc)
|
||||
{
|
||||
int sump = 0, minp = 999999, maxp = -999999;
|
||||
int diff_limit = 100; // The limit beyond which O2 sensor differences are considered significant (default = 100 mbar)
|
||||
int i, np = 0;
|
||||
|
@ -1010,9 +1013,9 @@ static void debug_print_profiledata(struct plot_info *pi)
|
|||
FILE *f1;
|
||||
struct plot_data *entry;
|
||||
int i;
|
||||
if (!(f1 = fopen("debug_print_profiledata.dat", "w")))
|
||||
if (!(f1 = fopen("debug_print_profiledata.dat", "w"))) {
|
||||
printf("File open error for: debug_print_profiledata.dat\n");
|
||||
else {
|
||||
} else {
|
||||
fprintf(f1, "id t1 gas gasint t2 t3 dil dilint t4 t5 setpoint sensor1 sensor2 sensor3 t6 po2 fo2\n");
|
||||
for (i = 0; i < pi->nr; i++) {
|
||||
entry = pi->entry + i;
|
||||
|
|
|
@ -37,8 +37,12 @@ struct mydescriptor {
|
|||
unsigned int model;
|
||||
};
|
||||
|
||||
GasSpinBoxItemDelegate::GasSpinBoxItemDelegate(QObject *parent, column_type type) : QStyledItemDelegate(parent), type(type) { }
|
||||
GasSpinBoxItemDelegate::~GasSpinBoxItemDelegate() { }
|
||||
GasSpinBoxItemDelegate::GasSpinBoxItemDelegate(QObject *parent, column_type type) : QStyledItemDelegate(parent), type(type)
|
||||
{
|
||||
}
|
||||
GasSpinBoxItemDelegate::~GasSpinBoxItemDelegate()
|
||||
{
|
||||
}
|
||||
|
||||
QWidget *GasSpinBoxItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
|
@ -73,8 +77,12 @@ void GasSpinBoxItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *m
|
|||
QStyledItemDelegate::setModelData(editor, model, index);
|
||||
}
|
||||
|
||||
GasTypeComboBoxItemDelegate::GasTypeComboBoxItemDelegate(QObject *parent, computer_type type) : QStyledItemDelegate(parent), type(type) { }
|
||||
GasTypeComboBoxItemDelegate::~GasTypeComboBoxItemDelegate() { }
|
||||
GasTypeComboBoxItemDelegate::GasTypeComboBoxItemDelegate(QObject *parent, computer_type type) : QStyledItemDelegate(parent), type(type)
|
||||
{
|
||||
}
|
||||
GasTypeComboBoxItemDelegate::~GasTypeComboBoxItemDelegate()
|
||||
{
|
||||
}
|
||||
|
||||
QWidget *GasTypeComboBoxItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||
{
|
||||
|
@ -109,8 +117,7 @@ void GasTypeComboBoxItemDelegate::setModelData(QWidget *editor, QAbstractItemMod
|
|||
QStyledItemDelegate::setModelData(editor, model, index);
|
||||
}
|
||||
|
||||
ConfigureDiveComputerDialog::ConfigureDiveComputerDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ConfigureDiveComputerDialog::ConfigureDiveComputerDialog(QWidget *parent) : QDialog(parent),
|
||||
config(0),
|
||||
deviceDetails(0)
|
||||
{
|
||||
|
@ -233,7 +240,8 @@ void OstcFirmwareCheck::checkLatest(QWidget *_parent, device_data_t *data)
|
|||
if (!latestFirmwareAvailable.isEmpty() && latestFirmwareAvailable != firmware) {
|
||||
QMessageBox response(parent);
|
||||
QString message = tr("You should update the firmware on your dive computer: you have version %1 but the latest stable version is %2")
|
||||
.arg(firmware).arg(latestFirmwareAvailable);
|
||||
.arg(firmware)
|
||||
.arg(latestFirmwareAvailable);
|
||||
response.addButton(tr("Not now"), QMessageBox::RejectRole);
|
||||
response.addButton(tr("Update firmware"), QMessageBox::AcceptRole);
|
||||
response.setText(message);
|
||||
|
@ -275,7 +283,9 @@ void OstcFirmwareCheck::saveOstcFirmware(QNetworkReply *reply)
|
|||
file.open(QIODevice::WriteOnly);
|
||||
file.write(firmwareData);
|
||||
file.close();
|
||||
qDebug() << "file closed";
|
||||
ConfigureDiveComputer *config = new ConfigureDiveComputer();
|
||||
qDebug() << "created config object, calling the firwmware uploader";
|
||||
config->startFirmwareUpdate(storeFirmware, &devData);
|
||||
}
|
||||
|
||||
|
@ -1007,21 +1017,18 @@ void ConfigureDiveComputerDialog::on_backupButton_clicked()
|
|||
QFileInfo fi(filename);
|
||||
filename = fi.absolutePath().append(QDir::separator()).append("Backup.xml");
|
||||
QString backupPath = QFileDialog::getSaveFileName(this, tr("Backup dive computer settings"),
|
||||
filename, tr("Backup files (*.xml)")
|
||||
);
|
||||
filename, tr("Backup files (*.xml)"));
|
||||
if (!backupPath.isEmpty()) {
|
||||
populateDeviceDetails();
|
||||
getDeviceData();
|
||||
if (!config->saveXMLBackup(backupPath, deviceDetails, &device_data)) {
|
||||
QMessageBox::critical(this, tr("XML backup error"),
|
||||
tr("An error occurred while saving the backup file.\n%1")
|
||||
.arg(config->lastError)
|
||||
);
|
||||
.arg(config->lastError));
|
||||
} else {
|
||||
QMessageBox::information(this, tr("Backup succeeded"),
|
||||
tr("Your settings have been saved to: %1")
|
||||
.arg(backupPath)
|
||||
);
|
||||
.arg(backupPath));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1032,21 +1039,18 @@ void ConfigureDiveComputerDialog::on_restoreBackupButton_clicked()
|
|||
QFileInfo fi(filename);
|
||||
filename = fi.absolutePath().append(QDir::separator()).append("Backup.xml");
|
||||
QString restorePath = QFileDialog::getOpenFileName(this, tr("Restore dive computer settings"),
|
||||
filename, tr("Backup files (*.xml)")
|
||||
);
|
||||
filename, tr("Backup files (*.xml)"));
|
||||
if (!restorePath.isEmpty()) {
|
||||
if (!config->restoreXMLBackup(restorePath, deviceDetails)) {
|
||||
QMessageBox::critical(this, tr("XML restore error"),
|
||||
tr("An error occurred while restoring the backup file.\n%1")
|
||||
.arg(config->lastError)
|
||||
);
|
||||
.arg(config->lastError));
|
||||
} else {
|
||||
reloadValues();
|
||||
//getDeviceData();
|
||||
//config->saveDeviceDetails(deviceDetails, &device_data);
|
||||
QMessageBox::information(this, tr("Restore succeeded"),
|
||||
tr("Your settings have been restored successfully.")
|
||||
);
|
||||
tr("Your settings have been restored successfully."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1057,8 +1061,7 @@ void ConfigureDiveComputerDialog::on_updateFirmwareButton_clicked()
|
|||
QFileInfo fi(filename);
|
||||
filename = fi.absolutePath();
|
||||
QString firmwarePath = QFileDialog::getOpenFileName(this, tr("Select firmware file"),
|
||||
filename, tr("All files (*.*)")
|
||||
);
|
||||
filename, tr("All files (*.*)"));
|
||||
if (!firmwarePath.isEmpty()) {
|
||||
getDeviceData();
|
||||
config->startFirmwareUpdate(firmwarePath, &device_data);
|
||||
|
@ -1066,7 +1069,6 @@ void ConfigureDiveComputerDialog::on_updateFirmwareButton_clicked()
|
|||
}
|
||||
|
||||
|
||||
|
||||
void ConfigureDiveComputerDialog::on_DiveComputerList_currentRowChanged(int currentRow)
|
||||
{
|
||||
// Disable the buttons to do operations on this data
|
||||
|
|
|
@ -9,8 +9,7 @@
|
|||
#include <QStyledItemDelegate>
|
||||
#include <QNetworkAccessManager>
|
||||
|
||||
class GasSpinBoxItemDelegate : public QStyledItemDelegate
|
||||
{
|
||||
class GasSpinBoxItemDelegate : public QStyledItemDelegate {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
@ -25,12 +24,12 @@ public:
|
|||
virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||
virtual void setEditorData(QWidget *editor, const QModelIndex &index) const;
|
||||
virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
|
||||
|
||||
private:
|
||||
column_type type;
|
||||
};
|
||||
|
||||
class GasTypeComboBoxItemDelegate : public QStyledItemDelegate
|
||||
{
|
||||
class GasTypeComboBoxItemDelegate : public QStyledItemDelegate {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
|
@ -45,19 +44,20 @@ public:
|
|||
virtual QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const;
|
||||
virtual void setEditorData(QWidget *editor, const QModelIndex &index) const;
|
||||
virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const;
|
||||
|
||||
private:
|
||||
computer_type type;
|
||||
};
|
||||
|
||||
class ConfigureDiveComputerDialog : public QDialog
|
||||
{
|
||||
class ConfigureDiveComputerDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ConfigureDiveComputerDialog(QWidget *parent = 0);
|
||||
~ConfigureDiveComputerDialog();
|
||||
|
||||
private slots:
|
||||
private
|
||||
slots:
|
||||
void readSettings();
|
||||
void resetSettings();
|
||||
void configMessage(QString msg);
|
||||
|
@ -102,8 +102,7 @@ private:
|
|||
QString selected_product;
|
||||
};
|
||||
|
||||
class OstcFirmwareCheck : QObject
|
||||
{
|
||||
class OstcFirmwareCheck : QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit OstcFirmwareCheck(QString product);
|
||||
|
@ -112,6 +111,7 @@ public
|
|||
slots:
|
||||
void parseOstcFwVersion(QNetworkReply *reply);
|
||||
void saveOstcFirmware(QNetworkReply *reply);
|
||||
|
||||
private:
|
||||
void upgradeFirmware();
|
||||
device_data_t devData;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue