2013-12-29 18:11:20 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#ifndef DIVELOGIMPORTDIALOG_H
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#define DIVELOGIMPORTDIALOG_H
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include <QDialog>
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-06 14:32:03 -02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <QAbstractListModel>
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-06 14:54:58 -02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <QListView>
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-06 15:14:14 -02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <QDragLeaveEvent>
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-06 15:56:08 -02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <QTableView>
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-06 16:01:21 -02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <QAbstractTableModel>
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-07 15:04:15 -02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include <QStyledItemDelegate>
							 | 
						
					
						
							
								
									
										
										
										
											2014-06-26 14:01:31 -03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-09-02 20:52:34 -03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#include "subsurface-core/dive.h"
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#include "subsurface-core/divelist.h"
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-29 18:11:20 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2014-05-22 11:40:22 -07:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								namespace Ui {
							 | 
						
					
						
							
								
									
										
										
										
											2014-02-27 20:09:57 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									class DiveLogImportDialog;
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-29 18:11:20 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								}
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-06 14:32:03 -02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								class ColumnNameProvider : public QAbstractListModel {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									Q_OBJECT
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								public:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									ColumnNameProvider(QObject *parent);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bool insertRows(int row, int count, const QModelIndex &parent);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bool removeRows(int row, int count, const QModelIndex &parent);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bool setData(const QModelIndex &index, const QVariant &value, int role);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									QVariant data(const QModelIndex &index, int role) const;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									int rowCount(const QModelIndex &parent) const;
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-07 12:27:20 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									int mymatch(QString value) const;
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-06 14:32:03 -02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								private:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									QStringList columnNames;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-06 16:01:21 -02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								class ColumnNameResult : public QAbstractTableModel {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									Q_OBJECT
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								public:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									ColumnNameResult(QObject *parent);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bool setData(const QModelIndex &index, const QVariant &value, int role);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									QVariant data(const QModelIndex &index, int role) const;
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-06 16:30:59 -02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									int rowCount(const QModelIndex &parent = QModelIndex()) const;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									int columnCount(const QModelIndex &parent = QModelIndex()) const;
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-06 16:05:06 -02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void setColumnValues(QList<QStringList> columns);
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-06 18:12:48 -02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									QStringList result() const;
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-07 15:40:10 -02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void swapValues(int firstIndex, int secondIndex);
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-06 16:01:21 -02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								private:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									QList<QStringList> columnValues;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									QStringList columnNames;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-06 14:54:58 -02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								class ColumnNameView : public QListView {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									Q_OBJECT
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								public:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									ColumnNameView(QWidget *parent);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								protected:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void mousePressEvent(QMouseEvent *press);
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-06 22:24:46 -02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void dragLeaveEvent(QDragLeaveEvent *leave);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void dragEnterEvent(QDragEnterEvent *event);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void dragMoveEvent(QDragMoveEvent *event);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void dropEvent(QDropEvent *event);
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-06 15:14:14 -02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								private:
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-06 14:54:58 -02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-06 15:56:08 -02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								class ColumnDropCSVView : public QTableView {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									Q_OBJECT
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								public:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									ColumnDropCSVView(QWidget *parent);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								protected:
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-06 21:49:48 -02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void mousePressEvent(QMouseEvent *press);
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-06 15:56:08 -02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void dragLeaveEvent(QDragLeaveEvent *leave);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void dragEnterEvent(QDragEnterEvent *event);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void dragMoveEvent(QDragMoveEvent *event);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void dropEvent(QDropEvent *event);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								private:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									QStringList columns;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2014-02-27 20:09:57 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								class DiveLogImportDialog : public QDialog {
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-29 18:11:20 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									Q_OBJECT
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								public:
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-06 16:11:27 -02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									explicit DiveLogImportDialog(QStringList fn, QWidget *parent = 0);
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-29 18:11:20 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									~DiveLogImportDialog();
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-07 17:02:42 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									enum whatChanged { INITIAL, SEPARATOR, KNOWNTYPES };
							 | 
						
					
						
							
								
									
										
										
										
											2014-02-27 20:09:57 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								private
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								slots:
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-29 18:11:20 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void on_buttonBox_accepted();
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-07 17:02:42 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									void loadFileContentsSeperatorSelected(int value);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void loadFileContentsKnownTypesSelected(int value);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void loadFileContents(int value, enum whatChanged triggeredBy);
							 | 
						
					
						
							
								
									
										
										
										
											2015-08-27 17:36:23 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									int setup_csv_params(QStringList r, char **params, int pnr);
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-07 17:02:42 -08:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2014-01-14 15:58:20 -02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								private:
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-29 18:11:20 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									bool selector;
							 | 
						
					
						
							
								
									
										
										
										
											2014-01-07 22:01:28 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									QStringList fileNames;
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-29 18:11:20 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									Ui::DiveLogImportDialog *ui;
							 | 
						
					
						
							
								
									
										
										
										
											2014-01-16 22:50:16 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									QList<int> specialCSV;
							 | 
						
					
						
							
								
									
										
										
										
											2014-12-25 15:25:29 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									int column;
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-06 16:21:50 -02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									ColumnNameResult *resultModel;
							 | 
						
					
						
							
								
									
										
										
										
											2015-03-22 17:13:47 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									QString delta;
							 | 
						
					
						
							
								
									
										
										
										
											2015-07-27 16:13:29 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
									QString hw;
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-29 18:11:20 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									struct CSVAppConfig {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										QString name;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										int time;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										int depth;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										int temperature;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										int po2;
							 | 
						
					
						
							
								
									
										
										
										
											2015-06-27 23:38:10 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										int sensor1;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										int sensor2;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
										int sensor3;
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-29 18:11:20 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										int cns;
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-09 22:13:37 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										int ndl;
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-09 22:13:38 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										int tts;
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-29 18:11:20 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										int stopdepth;
							 | 
						
					
						
							
								
									
										
										
										
											2014-07-10 20:54:18 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										int pressure;
							 | 
						
					
						
							
								
									
										
										
										
											2015-07-21 16:37:42 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
										int setpoint;
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-29 18:11:20 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
										QString separator;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-07-22 18:06:30 +03:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								#define CSVAPPS 8
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-29 18:11:20 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
									static const CSVAppConfig CSVApps[CSVAPPS];
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2015-01-07 15:04:15 -02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								class TagDragDelegate : public QStyledItemDelegate {
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									Q_OBJECT
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								public:
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									TagDragDelegate(QObject *parent);
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									QSize	sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
									void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								};
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2013-12-29 18:11:20 +02:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								#endif // DIVELOGIMPORTDIALOG_H
							 |