2017-04-27 20:26:05 +02:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
2013-05-20 16:43:33 -03:00
|
|
|
#ifndef DOWNLOADFROMDIVECOMPUTER_H
|
|
|
|
#define DOWNLOADFROMDIVECOMPUTER_H
|
2013-05-20 17:58:06 -03:00
|
|
|
|
2013-05-20 16:43:33 -03:00
|
|
|
#include <QDialog>
|
|
|
|
#include <QThread>
|
2013-05-20 17:58:06 -03:00
|
|
|
#include <QHash>
|
2013-05-20 21:55:56 -07:00
|
|
|
#include <QMap>
|
2015-01-08 10:12:11 -02:00
|
|
|
#include <QAbstractTableModel>
|
2019-03-18 15:58:07 +01:00
|
|
|
#include <memory>
|
2014-06-26 14:01:31 -03:00
|
|
|
|
2016-04-04 22:02:03 -07:00
|
|
|
#include "core/libdivecomputer.h"
|
|
|
|
#include "desktop-widgets/configuredivecomputerdialog.h"
|
2017-04-18 19:14:03 +02:00
|
|
|
|
2013-10-03 11:54:24 -07:00
|
|
|
#include "ui_downloadfromdivecomputer.h"
|
2015-07-20 09:35:00 -07:00
|
|
|
|
|
|
|
#if defined(BT_SUPPORT)
|
2015-07-06 16:35:13 +03:00
|
|
|
#include "btdeviceselectiondialog.h"
|
2015-07-20 09:35:00 -07:00
|
|
|
#endif
|
2013-05-20 16:43:33 -03:00
|
|
|
|
2014-06-26 14:01:31 -03:00
|
|
|
class QStringListModel;
|
2017-04-18 17:32:10 +02:00
|
|
|
class DiveImportedModel;
|
2019-09-25 20:49:13 +02:00
|
|
|
class BTDiscovery;
|
2014-06-26 14:01:31 -03:00
|
|
|
|
2014-02-27 20:09:57 -08:00
|
|
|
class DownloadFromDCWidget : public QDialog {
|
2013-05-20 16:43:33 -03:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2020-10-25 14:27:39 -07:00
|
|
|
explicit DownloadFromDCWidget(QWidget *parent = 0);
|
2013-08-25 10:01:59 -03:00
|
|
|
void reject();
|
|
|
|
|
2013-08-25 19:02:30 -03:00
|
|
|
enum states {
|
|
|
|
INITIAL,
|
|
|
|
DOWNLOADING,
|
|
|
|
CANCELLING,
|
2019-08-28 10:21:24 +01:00
|
|
|
ERRORED,
|
2013-08-25 19:02:30 -03:00
|
|
|
DONE,
|
|
|
|
};
|
|
|
|
|
2014-02-27 20:09:57 -08:00
|
|
|
public
|
|
|
|
slots:
|
2015-01-09 15:01:48 -08:00
|
|
|
void on_downloadCancelRetryButton_clicked();
|
2015-01-08 11:31:05 -02:00
|
|
|
void on_ok_clicked();
|
2013-05-20 16:43:33 -03:00
|
|
|
void on_cancel_clicked();
|
2014-02-18 17:20:35 -08:00
|
|
|
void on_search_clicked();
|
2022-02-09 17:25:00 -08:00
|
|
|
void on_vendor_currentTextChanged(const QString &vendor);
|
|
|
|
void on_product_currentTextChanged(const QString &product);
|
2018-09-24 17:31:33 -07:00
|
|
|
void on_device_currentTextChanged(const QString &device);
|
2013-08-25 10:01:59 -03:00
|
|
|
|
2013-08-25 19:02:30 -03:00
|
|
|
void onDownloadThreadFinished();
|
|
|
|
void updateProgressBar();
|
2013-12-24 16:26:00 -08:00
|
|
|
void checkLogFile(int state);
|
|
|
|
void checkDumpFile(int state);
|
|
|
|
void pickDumpFile();
|
|
|
|
void pickLogFile();
|
2018-09-21 12:16:42 -07:00
|
|
|
void DC1Clicked();
|
|
|
|
void DC2Clicked();
|
|
|
|
void DC3Clicked();
|
|
|
|
void DC4Clicked();
|
2018-09-24 07:04:21 -07:00
|
|
|
int deviceIndex(QString deviceText);
|
2018-09-21 12:16:42 -07:00
|
|
|
|
2015-07-20 09:35:00 -07:00
|
|
|
#if defined(BT_SUPPORT)
|
|
|
|
void enableBluetoothMode(int state);
|
2015-07-06 16:18:06 +03:00
|
|
|
void selectRemoteBluetoothDevice();
|
2015-07-06 16:35:13 +03:00
|
|
|
void bluetoothSelectionDialogIsFinished(int result);
|
2015-07-20 09:35:00 -07:00
|
|
|
#endif
|
2013-05-20 16:43:33 -03:00
|
|
|
private:
|
2013-08-25 19:02:30 -03:00
|
|
|
void markChildrenAsDisabled();
|
|
|
|
void markChildrenAsEnabled();
|
2017-11-01 08:01:23 +01:00
|
|
|
void updateDeviceEnabled();
|
2018-09-21 15:41:28 -07:00
|
|
|
void showRememberedDCs();
|
2013-08-25 10:01:59 -03:00
|
|
|
|
2017-11-11 19:40:47 +01:00
|
|
|
QStringListModel vendorModel;
|
|
|
|
QStringListModel productModel;
|
2013-10-03 11:54:25 -07:00
|
|
|
Ui::DownloadFromDiveComputer ui;
|
2013-05-20 17:02:17 -03:00
|
|
|
bool downloading;
|
2013-05-20 17:58:06 -03:00
|
|
|
|
2013-12-08 06:33:46 +01:00
|
|
|
int previousLast;
|
2013-05-20 17:58:06 -03:00
|
|
|
|
2018-08-27 10:32:14 -07:00
|
|
|
void fill_device_list(unsigned int transport);
|
2013-08-25 19:02:30 -03:00
|
|
|
QTimer *timer;
|
2013-12-26 09:18:57 -08:00
|
|
|
bool dumpWarningShown;
|
2019-03-18 15:58:07 +01:00
|
|
|
std::unique_ptr<OstcFirmwareCheck> ostcFirmwareCheck;
|
2015-01-08 10:12:11 -02:00
|
|
|
DiveImportedModel *diveImportedModel;
|
2015-07-20 09:35:00 -07:00
|
|
|
#if defined(BT_SUPPORT)
|
2015-07-06 16:35:13 +03:00
|
|
|
BtDeviceSelectionDialog *btDeviceSelectionDialog;
|
2018-09-24 17:31:33 -07:00
|
|
|
BTDiscovery *btd;
|
2015-07-20 09:35:00 -07:00
|
|
|
#endif
|
2023-04-02 18:28:33 +12:00
|
|
|
void setSyncDiveComputerTime(bool value);
|
2013-08-25 19:02:30 -03:00
|
|
|
|
2013-05-30 17:58:59 +09:00
|
|
|
public:
|
|
|
|
bool preferDownloaded();
|
2013-08-25 19:02:30 -03:00
|
|
|
void updateState(states state);
|
|
|
|
states currentState;
|
2013-05-20 16:43:33 -03:00
|
|
|
};
|
|
|
|
|
2014-02-11 19:14:46 +01:00
|
|
|
#endif // DOWNLOADFROMDIVECOMPUTER_H
|