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>
|
|
|
|
#include "../libdivecomputer.h"
|
2013-05-20 19:43:33 +00:00
|
|
|
|
|
|
|
namespace Ui{
|
|
|
|
class DownloadFromDiveComputer;
|
|
|
|
}
|
|
|
|
struct device_data_t;
|
|
|
|
|
|
|
|
class DownloadThread : public QThread{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2013-05-23 04:25:05 +00:00
|
|
|
explicit DownloadThread(device_data_t* data);
|
|
|
|
virtual void run();
|
2013-05-20 19:43:33 +00:00
|
|
|
private:
|
|
|
|
device_data_t *data;
|
|
|
|
};
|
|
|
|
|
|
|
|
class InterfaceThread : public QThread{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
InterfaceThread(QObject *parent, device_data_t *data) ;
|
2013-05-23 04:25:05 +00:00
|
|
|
virtual void run();
|
2013-05-20 19:43:33 +00:00
|
|
|
|
2013-06-19 17:20:16 +00:00
|
|
|
signals:
|
2013-05-20 19:43:33 +00:00
|
|
|
void updateInterface(int value);
|
|
|
|
private:
|
|
|
|
device_data_t *data;
|
|
|
|
};
|
|
|
|
|
2013-05-20 20:58:06 +00:00
|
|
|
class QStringListModel;
|
2013-05-20 19:43:33 +00:00
|
|
|
class DownloadFromDCWidget : public QDialog{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2013-05-23 04:25:05 +00:00
|
|
|
explicit DownloadFromDCWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
|
2013-05-30 08:58:59 +00:00
|
|
|
static DownloadFromDCWidget *instance();
|
2013-05-20 19:43:33 +00:00
|
|
|
public slots:
|
|
|
|
void on_ok_clicked();
|
|
|
|
void on_cancel_clicked();
|
2013-05-30 08:58:59 +00:00
|
|
|
void runDialog();
|
2013-05-30 09:21:08 +00:00
|
|
|
void stoppedDownloading();
|
2013-05-20 20:58:06 +00:00
|
|
|
void on_vendor_currentIndexChanged(const QString& vendor);
|
2013-05-20 19:43:33 +00:00
|
|
|
private:
|
|
|
|
Ui::DownloadFromDiveComputer *ui;
|
|
|
|
InterfaceThread *thread;
|
2013-05-20 20:02:17 +00:00
|
|
|
bool downloading;
|
2013-05-20 20:58:06 +00:00
|
|
|
|
|
|
|
QStringList vendorList;
|
|
|
|
QHash<QString, QStringList> productList;
|
2013-05-21 04:55:56 +00:00
|
|
|
QMap<QString, dc_descriptor_t *> descriptorLookup;
|
|
|
|
device_data_t data;
|
2013-05-20 20:58:06 +00:00
|
|
|
|
|
|
|
QStringListModel *vendorModel;
|
|
|
|
QStringListModel *productModel;
|
|
|
|
void fill_computer_list();
|
2013-05-30 08:58:59 +00:00
|
|
|
public:
|
|
|
|
bool preferDownloaded();
|
2013-05-20 19:43:33 +00:00
|
|
|
};
|
|
|
|
|
2013-05-21 04:55:56 +00:00
|
|
|
#endif
|