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