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>
|
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
|
|
|
#include "core/downloadfromdcthread.h"
|
|
|
|
|
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;
|
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:
|
2014-02-28 04:09:57 +00:00
|
|
|
explicit DownloadFromDCWidget(QWidget *parent = 0, Qt::WindowFlags f = 0);
|
2013-08-25 13:01:59 +00:00
|
|
|
void reject();
|
|
|
|
|
2013-08-25 22:02:30 +00:00
|
|
|
enum states {
|
|
|
|
INITIAL,
|
|
|
|
DOWNLOADING,
|
|
|
|
CANCELLING,
|
2013-09-01 14:14:54 +00:00
|
|
|
ERROR,
|
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();
|
2014-02-28 04:09:57 +00:00
|
|
|
void on_vendor_currentIndexChanged(const QString &vendor);
|
2014-05-25 22:06:56 +00:00
|
|
|
void on_product_currentIndexChanged(const QString &product);
|
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();
|
|
|
|
|
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 19:17:24 +00:00
|
|
|
void updateRememberedDCs();
|
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;
|
2017-05-19 09:23:11 +00:00
|
|
|
DownloadThread thread;
|
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;
|
2014-12-27 16:31:51 +00:00
|
|
|
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;
|
2015-07-20 16:35:00 +00:00
|
|
|
#endif
|
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
|