2013-04-14 03:44:02 +00:00
|
|
|
/*
|
|
|
|
* models.h
|
|
|
|
*
|
|
|
|
* header file for the equipment models of Subsurface
|
|
|
|
*
|
|
|
|
*/
|
2013-04-13 13:17:59 +00:00
|
|
|
#ifndef MODELS_H
|
|
|
|
#define MODELS_H
|
|
|
|
|
|
|
|
#include <QAbstractTableModel>
|
2013-05-02 02:51:34 +00:00
|
|
|
#include <QCoreApplication>
|
2013-05-23 18:33:20 +00:00
|
|
|
#include <QStringList>
|
2013-11-14 19:39:35 +00:00
|
|
|
#include <QStringListModel>
|
2014-09-17 19:18:37 +00:00
|
|
|
#include <QSortFilterProxyModel>
|
2013-05-02 02:51:34 +00:00
|
|
|
|
2014-10-15 13:30:50 +00:00
|
|
|
#include "metrics.h"
|
|
|
|
|
2013-04-13 13:17:59 +00:00
|
|
|
#include "../dive.h"
|
2013-04-27 15:27:27 +00:00
|
|
|
#include "../divelist.h"
|
2014-05-12 16:53:26 +00:00
|
|
|
#include "../divecomputer.h"
|
2013-05-02 02:51:34 +00:00
|
|
|
|
2013-10-11 13:50:40 +00:00
|
|
|
// Encapsulates Boilerplate.
|
2014-02-28 04:09:57 +00:00
|
|
|
class CleanerTableModel : public QAbstractTableModel {
|
2013-10-11 13:50:40 +00:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2014-01-15 17:52:42 +00:00
|
|
|
explicit CleanerTableModel(QObject *parent = 0);
|
2014-02-28 04:09:57 +00:00
|
|
|
virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
2013-10-15 11:37:31 +00:00
|
|
|
virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
2014-02-28 04:09:57 +00:00
|
|
|
|
2013-10-11 13:50:40 +00:00
|
|
|
protected:
|
2014-02-28 04:09:57 +00:00
|
|
|
void setHeaderDataStrings(const QStringList &headers);
|
|
|
|
|
2013-10-11 13:50:40 +00:00
|
|
|
private:
|
|
|
|
QStringList headers;
|
|
|
|
};
|
|
|
|
|
2013-04-15 18:04:35 +00:00
|
|
|
/* Encapsulates the tank_info global variable
|
2013-05-14 07:28:30 +00:00
|
|
|
* to show on Qt's Model View System.*/
|
2013-10-11 14:42:33 +00:00
|
|
|
class TankInfoModel : public CleanerTableModel {
|
2014-02-28 04:09:57 +00:00
|
|
|
Q_OBJECT
|
2013-04-15 18:04:35 +00:00
|
|
|
public:
|
2014-02-28 04:09:57 +00:00
|
|
|
static TankInfoModel *instance();
|
2013-05-23 18:33:20 +00:00
|
|
|
|
2014-02-28 04:09:57 +00:00
|
|
|
enum Column {
|
|
|
|
DESCRIPTION,
|
|
|
|
ML,
|
|
|
|
BAR
|
|
|
|
};
|
2013-04-15 18:04:35 +00:00
|
|
|
TankInfoModel();
|
|
|
|
|
2014-02-28 04:09:57 +00:00
|
|
|
/*reimp*/ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
|
|
|
/*reimp*/ int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
|
|
|
/*reimp*/ bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex());
|
|
|
|
/*reimp*/ bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
|
|
|
|
const QString &biggerString() const;
|
2013-04-15 18:04:35 +00:00
|
|
|
void clear();
|
2014-02-28 04:09:57 +00:00
|
|
|
public
|
|
|
|
slots:
|
2013-04-15 18:04:35 +00:00
|
|
|
void update();
|
2014-02-28 04:09:57 +00:00
|
|
|
|
2013-04-15 18:04:35 +00:00
|
|
|
private:
|
|
|
|
int rows;
|
2013-06-16 16:28:59 +00:00
|
|
|
QString biggerEntry;
|
2013-04-15 18:04:35 +00:00
|
|
|
};
|
|
|
|
|
2013-05-24 01:40:16 +00:00
|
|
|
/* Encapsulate ws_info */
|
2013-10-11 14:13:16 +00:00
|
|
|
class WSInfoModel : public CleanerTableModel {
|
2014-02-28 04:09:57 +00:00
|
|
|
Q_OBJECT
|
2013-05-24 01:40:16 +00:00
|
|
|
public:
|
2014-02-28 04:09:57 +00:00
|
|
|
static WSInfoModel *instance();
|
2013-05-24 01:40:16 +00:00
|
|
|
|
2014-02-28 04:09:57 +00:00
|
|
|
enum Column {
|
|
|
|
DESCRIPTION,
|
|
|
|
GR
|
|
|
|
};
|
2013-05-24 01:40:16 +00:00
|
|
|
WSInfoModel();
|
|
|
|
|
2014-02-28 04:09:57 +00:00
|
|
|
/*reimp*/ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
|
|
|
/*reimp*/ int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
|
|
|
/*reimp*/ bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex());
|
|
|
|
/*reimp*/ bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
|
|
|
|
const QString &biggerString() const;
|
2013-05-24 01:40:16 +00:00
|
|
|
void clear();
|
|
|
|
void update();
|
2013-09-10 18:42:26 +00:00
|
|
|
void updateInfo();
|
2014-02-28 04:09:57 +00:00
|
|
|
|
2013-05-24 01:40:16 +00:00
|
|
|
private:
|
|
|
|
int rows;
|
2013-06-16 16:28:59 +00:00
|
|
|
QString biggerEntry;
|
2013-05-24 01:40:16 +00:00
|
|
|
};
|
|
|
|
|
2014-10-19 14:15:20 +00:00
|
|
|
/* Retrieve the trash icon pixmap, common to most table models */
|
|
|
|
const QPixmap &trashIcon();
|
|
|
|
|
2013-04-22 01:12:36 +00:00
|
|
|
/* Encapsulation of the Cylinder Model, that presents the
|
|
|
|
* Current cylinders that are used on a dive. */
|
2013-10-11 13:50:40 +00:00
|
|
|
class CylindersModel : public CleanerTableModel {
|
2014-02-28 04:09:57 +00:00
|
|
|
Q_OBJECT
|
2013-04-13 13:17:59 +00:00
|
|
|
public:
|
2014-02-28 04:09:57 +00:00
|
|
|
enum Column {
|
|
|
|
REMOVE,
|
|
|
|
TYPE,
|
|
|
|
SIZE,
|
|
|
|
WORKINGPRESS,
|
|
|
|
START,
|
|
|
|
END,
|
|
|
|
O2,
|
|
|
|
HE,
|
2014-03-22 14:13:58 +00:00
|
|
|
DEPTH,
|
2014-11-17 14:03:37 +00:00
|
|
|
USE,
|
2014-03-22 14:13:58 +00:00
|
|
|
COLUMNS
|
2014-02-28 04:09:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
explicit CylindersModel(QObject *parent = 0);
|
2013-11-09 22:06:26 +00:00
|
|
|
static CylindersModel *instance();
|
2014-02-28 04:09:57 +00:00
|
|
|
/*reimp*/ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
|
|
|
/*reimp*/ int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
|
|
|
/*reimp*/ Qt::ItemFlags flags(const QModelIndex &index) const;
|
|
|
|
/*reimp*/ bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
|
2013-04-13 13:17:59 +00:00
|
|
|
|
2014-02-28 04:09:57 +00:00
|
|
|
void passInData(const QModelIndex &index, const QVariant &value);
|
2013-05-22 17:52:38 +00:00
|
|
|
void add();
|
2013-04-13 13:17:59 +00:00
|
|
|
void clear();
|
2014-07-03 05:38:08 +00:00
|
|
|
void updateDive();
|
2014-05-08 21:36:45 +00:00
|
|
|
void copyFromDive(struct dive *d);
|
2014-02-28 04:09:57 +00:00
|
|
|
cylinder_t *cylinderAt(const QModelIndex &index);
|
2013-09-25 17:23:51 +00:00
|
|
|
bool changed;
|
2013-07-18 13:24:02 +00:00
|
|
|
|
2014-02-28 04:09:57 +00:00
|
|
|
public
|
|
|
|
slots:
|
|
|
|
void remove(const QModelIndex &index);
|
2013-05-21 12:33:55 +00:00
|
|
|
|
2013-04-13 13:17:59 +00:00
|
|
|
private:
|
2013-05-21 12:33:55 +00:00
|
|
|
int rows;
|
2013-04-13 13:17:59 +00:00
|
|
|
};
|
|
|
|
|
2013-04-22 01:12:36 +00:00
|
|
|
/* Encapsulation of the Weight Model, that represents
|
|
|
|
* the current weights on a dive. */
|
2013-10-11 14:04:27 +00:00
|
|
|
class WeightModel : public CleanerTableModel {
|
2014-02-28 04:09:57 +00:00
|
|
|
Q_OBJECT
|
2013-05-01 21:30:34 +00:00
|
|
|
public:
|
2014-02-28 04:09:57 +00:00
|
|
|
enum Column {
|
|
|
|
REMOVE,
|
|
|
|
TYPE,
|
|
|
|
WEIGHT
|
|
|
|
};
|
2013-05-24 01:40:16 +00:00
|
|
|
|
|
|
|
explicit WeightModel(QObject *parent = 0);
|
2014-02-28 04:09:57 +00:00
|
|
|
/*reimp*/ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
|
|
|
/*reimp*/ int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
|
|
|
/*reimp*/ Qt::ItemFlags flags(const QModelIndex &index) const;
|
|
|
|
/*reimp*/ bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
|
2013-04-13 13:17:59 +00:00
|
|
|
|
2014-02-28 04:09:57 +00:00
|
|
|
void passInData(const QModelIndex &index, const QVariant &value);
|
2013-05-22 17:52:38 +00:00
|
|
|
void add();
|
2013-04-13 13:17:59 +00:00
|
|
|
void clear();
|
2014-07-03 05:38:08 +00:00
|
|
|
void updateDive();
|
2014-02-28 04:09:57 +00:00
|
|
|
weightsystem_t *weightSystemAt(const QModelIndex &index);
|
2013-09-25 17:23:51 +00:00
|
|
|
bool changed;
|
2013-07-18 14:53:47 +00:00
|
|
|
|
2014-02-28 04:09:57 +00:00
|
|
|
public
|
|
|
|
slots:
|
|
|
|
void remove(const QModelIndex &index);
|
2013-05-21 12:59:41 +00:00
|
|
|
|
2013-04-13 13:17:59 +00:00
|
|
|
private:
|
2013-05-21 12:59:41 +00:00
|
|
|
int rows;
|
2013-04-13 13:17:59 +00:00
|
|
|
};
|
|
|
|
|
2014-11-06 19:24:38 +00:00
|
|
|
/* extra data model for additional dive computer data */
|
|
|
|
class ExtraDataModel : public CleanerTableModel {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
enum Column {
|
|
|
|
KEY,
|
|
|
|
VALUE
|
|
|
|
};
|
|
|
|
explicit ExtraDataModel(QObject *parent = 0);
|
|
|
|
/*reimp*/ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
|
|
|
/*reimp*/ int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
|
|
|
|
|
|
|
void clear();
|
|
|
|
void updateDive();
|
2014-11-13 20:51:23 +00:00
|
|
|
|
2014-11-06 19:24:38 +00:00
|
|
|
private:
|
|
|
|
int rows;
|
|
|
|
};
|
|
|
|
|
2013-04-22 01:12:36 +00:00
|
|
|
/*! An AbstractItemModel for recording dive trip information such as a list of dives.
|
|
|
|
*
|
|
|
|
*/
|
2013-05-02 02:51:34 +00:00
|
|
|
|
2013-06-17 21:59:50 +00:00
|
|
|
struct TreeItem {
|
2014-02-28 04:09:57 +00:00
|
|
|
Q_DECLARE_TR_FUNCTIONS(TreeItemDT);
|
|
|
|
|
2013-04-22 01:12:36 +00:00
|
|
|
public:
|
2013-06-17 21:59:50 +00:00
|
|
|
virtual ~TreeItem();
|
2013-06-18 20:29:37 +00:00
|
|
|
TreeItem();
|
2014-02-28 04:09:57 +00:00
|
|
|
virtual QVariant data(int column, int role) const;
|
|
|
|
virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
|
2013-11-19 00:33:01 +00:00
|
|
|
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
|
|
|
|
|
2013-05-02 02:51:34 +00:00
|
|
|
int row() const;
|
2014-02-28 04:09:57 +00:00
|
|
|
QList<TreeItem *> children;
|
2013-06-17 21:59:50 +00:00
|
|
|
TreeItem *parent;
|
2013-05-02 02:51:34 +00:00
|
|
|
};
|
2013-04-22 01:12:36 +00:00
|
|
|
|
2013-07-11 09:40:08 +00:00
|
|
|
struct DiveItem : public TreeItem {
|
2014-02-28 04:09:57 +00:00
|
|
|
enum Column {
|
|
|
|
NR,
|
|
|
|
DATE,
|
|
|
|
RATING,
|
|
|
|
DEPTH,
|
|
|
|
DURATION,
|
|
|
|
TEMPERATURE,
|
|
|
|
TOTALWEIGHT,
|
|
|
|
SUIT,
|
|
|
|
CYLINDER,
|
2014-07-20 13:07:56 +00:00
|
|
|
GAS,
|
2014-02-28 04:09:57 +00:00
|
|
|
SAC,
|
|
|
|
OTU,
|
|
|
|
MAXCNS,
|
|
|
|
LOCATION,
|
|
|
|
COLUMNS
|
|
|
|
};
|
2013-07-11 09:40:08 +00:00
|
|
|
|
|
|
|
virtual QVariant data(int column, int role) const;
|
2014-01-07 03:57:20 +00:00
|
|
|
int diveId;
|
2014-02-28 04:09:57 +00:00
|
|
|
virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
|
|
|
|
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
|
2013-07-11 09:41:50 +00:00
|
|
|
QString displayDate() const;
|
2013-07-11 09:40:08 +00:00
|
|
|
QString displayDuration() const;
|
|
|
|
QString displayDepth() const;
|
2014-07-12 04:59:21 +00:00
|
|
|
QString displayDepthWithUnit() const;
|
2013-07-11 09:40:08 +00:00
|
|
|
QString displayTemperature() const;
|
|
|
|
QString displayWeight() const;
|
|
|
|
QString displaySac() const;
|
|
|
|
int weight() const;
|
|
|
|
};
|
|
|
|
|
2013-05-02 02:51:34 +00:00
|
|
|
struct TripItem;
|
|
|
|
|
2014-02-28 04:09:57 +00:00
|
|
|
class TreeModel : public QAbstractItemModel {
|
2013-05-02 02:51:34 +00:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2013-06-17 21:59:50 +00:00
|
|
|
TreeModel(QObject *parent = 0);
|
|
|
|
virtual ~TreeModel();
|
2014-02-28 04:09:57 +00:00
|
|
|
virtual QVariant data(const QModelIndex &index, int role) const;
|
2013-05-02 02:51:34 +00:00
|
|
|
/*reimp*/ int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
2013-04-22 01:12:36 +00:00
|
|
|
/*reimp*/ int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
|
|
|
/*reimp*/ QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
|
|
|
|
/*reimp*/ QModelIndex parent(const QModelIndex &child) const;
|
|
|
|
|
2013-06-17 21:59:50 +00:00
|
|
|
protected:
|
|
|
|
int columns;
|
|
|
|
TreeItem *rootItem;
|
|
|
|
};
|
|
|
|
|
|
|
|
class DiveTripModel : public TreeModel {
|
2013-06-17 22:41:05 +00:00
|
|
|
Q_OBJECT
|
2013-06-17 21:59:50 +00:00
|
|
|
public:
|
2014-02-28 04:09:57 +00:00
|
|
|
enum Column {
|
|
|
|
NR,
|
|
|
|
DATE,
|
|
|
|
RATING,
|
|
|
|
DEPTH,
|
|
|
|
DURATION,
|
|
|
|
TEMPERATURE,
|
|
|
|
TOTALWEIGHT,
|
|
|
|
SUIT,
|
|
|
|
CYLINDER,
|
2014-07-20 13:07:56 +00:00
|
|
|
GAS,
|
2014-02-28 04:09:57 +00:00
|
|
|
SAC,
|
|
|
|
OTU,
|
|
|
|
MAXCNS,
|
|
|
|
LOCATION,
|
|
|
|
COLUMNS
|
|
|
|
};
|
|
|
|
|
|
|
|
enum ExtraRoles {
|
|
|
|
STAR_ROLE = Qt::UserRole + 1,
|
|
|
|
DIVE_ROLE,
|
|
|
|
TRIP_ROLE,
|
|
|
|
SORT_ROLE,
|
|
|
|
DIVE_IDX
|
|
|
|
};
|
|
|
|
enum Layout {
|
|
|
|
TREE,
|
|
|
|
LIST,
|
|
|
|
CURRENT
|
|
|
|
};
|
2013-06-17 21:59:50 +00:00
|
|
|
|
|
|
|
Qt::ItemFlags flags(const QModelIndex &index) const;
|
2013-10-15 11:37:31 +00:00
|
|
|
virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
2014-02-28 04:09:57 +00:00
|
|
|
virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
|
|
|
|
DiveTripModel(QObject *parent = 0);
|
2013-05-28 19:56:58 +00:00
|
|
|
Layout layout() const;
|
|
|
|
void setLayout(Layout layout);
|
2014-02-28 04:09:57 +00:00
|
|
|
|
2013-04-22 01:12:36 +00:00
|
|
|
private:
|
2013-05-02 02:51:34 +00:00
|
|
|
void setupModelData();
|
2014-02-28 04:09:57 +00:00
|
|
|
QMap<dive_trip_t *, TripItem *> trips;
|
2013-05-28 19:56:58 +00:00
|
|
|
Layout currentLayout;
|
2013-04-22 01:12:36 +00:00
|
|
|
};
|
|
|
|
|
2014-02-28 04:09:57 +00:00
|
|
|
class DiveComputerModel : public CleanerTableModel {
|
2013-06-07 14:43:45 +00:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2014-02-28 04:09:57 +00:00
|
|
|
enum {
|
|
|
|
REMOVE,
|
|
|
|
MODEL,
|
|
|
|
ID,
|
|
|
|
NICKNAME
|
|
|
|
};
|
2013-06-17 22:58:26 +00:00
|
|
|
DiveComputerModel(QMultiMap<QString, DiveComputerNode> &dcMap, QObject *parent = 0);
|
2014-02-28 04:09:57 +00:00
|
|
|
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
|
|
|
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
|
|
|
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
|
|
|
|
virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
|
2013-06-07 14:43:45 +00:00
|
|
|
void update();
|
2013-06-17 22:58:26 +00:00
|
|
|
void keepWorkingList();
|
|
|
|
void dropWorkingList();
|
2013-06-17 21:59:50 +00:00
|
|
|
|
2014-02-28 04:09:57 +00:00
|
|
|
public
|
|
|
|
slots:
|
|
|
|
void remove(const QModelIndex &index);
|
|
|
|
|
2013-06-07 14:43:45 +00:00
|
|
|
private:
|
|
|
|
int numRows;
|
2013-06-17 22:58:26 +00:00
|
|
|
QMultiMap<QString, DiveComputerNode> dcWorkingMap;
|
2013-06-07 14:43:45 +00:00
|
|
|
};
|
|
|
|
|
2013-06-17 22:41:05 +00:00
|
|
|
class YearlyStatisticsModel : public TreeModel {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2014-02-28 04:09:57 +00:00
|
|
|
enum {
|
|
|
|
YEAR,
|
|
|
|
DIVES,
|
|
|
|
TOTAL_TIME,
|
|
|
|
AVERAGE_TIME,
|
|
|
|
SHORTEST_TIME,
|
|
|
|
LONGEST_TIME,
|
|
|
|
AVG_DEPTH,
|
|
|
|
MIN_DEPTH,
|
|
|
|
MAX_DEPTH,
|
|
|
|
AVG_SAC,
|
|
|
|
MIN_SAC,
|
|
|
|
MAX_SAC,
|
|
|
|
AVG_TEMP,
|
|
|
|
MIN_TEMP,
|
|
|
|
MAX_TEMP,
|
|
|
|
COLUMNS
|
|
|
|
};
|
2013-06-17 22:41:05 +00:00
|
|
|
|
|
|
|
virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
2014-02-28 04:09:57 +00:00
|
|
|
YearlyStatisticsModel(QObject *parent = 0);
|
2013-06-18 00:05:17 +00:00
|
|
|
void update_yearly_stats();
|
2013-06-17 22:41:05 +00:00
|
|
|
};
|
2013-07-25 09:52:20 +00:00
|
|
|
|
|
|
|
/* TablePrintModel:
|
|
|
|
* for now we use a blank table model with row items TablePrintItem.
|
|
|
|
* these are pretty much the same as DiveItem, but have color
|
|
|
|
* properties, as well. perhaps later one a more unified model has to be
|
|
|
|
* considered, but the current TablePrintModel idea has to be extended
|
|
|
|
* to support variadic column lists and column list orders that can
|
|
|
|
* be controlled by the user.
|
|
|
|
*/
|
|
|
|
struct TablePrintItem {
|
|
|
|
QString number;
|
|
|
|
QString date;
|
|
|
|
QString depth;
|
|
|
|
QString duration;
|
|
|
|
QString divemaster;
|
|
|
|
QString buddy;
|
|
|
|
QString location;
|
|
|
|
unsigned int colorBackground;
|
|
|
|
};
|
|
|
|
|
2014-02-28 04:09:57 +00:00
|
|
|
class TablePrintModel : public QAbstractTableModel {
|
2013-07-25 09:52:20 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
private:
|
|
|
|
QList<struct TablePrintItem *> list;
|
|
|
|
|
|
|
|
public:
|
|
|
|
~TablePrintModel();
|
|
|
|
TablePrintModel();
|
|
|
|
|
|
|
|
int rows, columns;
|
|
|
|
void insertRow(int index = -1);
|
|
|
|
void callReset();
|
|
|
|
|
2014-02-28 04:09:57 +00:00
|
|
|
QVariant data(const QModelIndex &index, int role) const;
|
2013-07-25 09:52:20 +00:00
|
|
|
bool setData(const QModelIndex &index, const QVariant &value, int role);
|
|
|
|
int rowCount(const QModelIndex &parent) const;
|
|
|
|
int columnCount(const QModelIndex &parent) const;
|
|
|
|
};
|
|
|
|
|
2013-10-03 14:50:40 +00:00
|
|
|
/* ProfilePrintModel:
|
|
|
|
* this model is used when printing a data table under a profile. it requires
|
|
|
|
* some exact usage of setSpan(..) on the target QTableView widget.
|
|
|
|
*/
|
2014-02-28 04:09:57 +00:00
|
|
|
class ProfilePrintModel : public QAbstractTableModel {
|
2013-10-03 14:50:40 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
private:
|
2014-01-07 03:57:20 +00:00
|
|
|
int diveId;
|
2014-07-12 04:30:40 +00:00
|
|
|
double fontSize;
|
2013-10-03 14:50:40 +00:00
|
|
|
|
|
|
|
public:
|
|
|
|
ProfilePrintModel(QObject *parent = 0);
|
|
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
|
|
|
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
|
|
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
|
|
|
void setDive(struct dive *divePtr);
|
2014-07-12 04:30:40 +00:00
|
|
|
void setFontsize(double size);
|
2013-10-03 14:50:40 +00:00
|
|
|
};
|
|
|
|
|
2014-02-28 04:09:57 +00:00
|
|
|
class GasSelectionModel : public QStringListModel {
|
2013-11-14 19:39:35 +00:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2014-02-28 04:09:57 +00:00
|
|
|
static GasSelectionModel *instance();
|
|
|
|
Qt::ItemFlags flags(const QModelIndex &index) const;
|
|
|
|
virtual QVariant data(const QModelIndex &index, int role) const;
|
|
|
|
public
|
|
|
|
slots:
|
2013-11-14 19:39:35 +00:00
|
|
|
void repopulate();
|
|
|
|
};
|
|
|
|
|
2013-12-06 16:29:38 +00:00
|
|
|
|
|
|
|
class LanguageModel : public QAbstractListModel {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2014-02-28 04:09:57 +00:00
|
|
|
static LanguageModel *instance();
|
|
|
|
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
|
|
|
|
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
|
|
|
|
2013-12-06 16:29:38 +00:00
|
|
|
private:
|
2014-02-28 04:09:57 +00:00
|
|
|
LanguageModel(QObject *parent = 0);
|
2013-12-06 16:29:38 +00:00
|
|
|
|
|
|
|
QStringList languages;
|
|
|
|
};
|
2014-09-17 18:45:18 +00:00
|
|
|
|
2014-02-11 18:14:46 +00:00
|
|
|
#endif // MODELS_H
|