mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Started the real code on the Qt Interface.
1 - Open File already open files, it tries to not break the Gtk version, but some methods on the GTK version still need to be called inside Qt because the code is too tight-coupled. 2 - Close file already close files, same comments for the open file dialog applies here. 3 - The code for adding new cylinders in the cylinder dialog is done, already works and it's integrated with the system. There's a need to implement the edit and delete now, but it will be easyer since I'm starting to not get lost on the code. 4 - Some functions that were used to convert unities have been moved to convert.h ( can be changed later, put there because it's easyer to find something that converts in a convert.h =p ) because they were static functions that operated in the GTK version but I need those functions in the Qt version too. [Dirk Hohndel: lots and lots of whitespace and coding style changes] Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
76f71b4ca0
commit
92397a2bad
14 changed files with 823 additions and 14 deletions
44
qt-ui/models.h
Normal file
44
qt-ui/models.h
Normal file
|
@ -0,0 +1,44 @@
|
|||
#ifndef MODELS_H
|
||||
#define MODELS_H
|
||||
|
||||
#include <QAbstractTableModel>
|
||||
#include "../dive.h"
|
||||
|
||||
class CylindersModel : public QAbstractTableModel {
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum {TYPE, SIZE, MAXPRESS, START, END, O2, HE};
|
||||
|
||||
explicit CylindersModel(QObject* parent = 0);
|
||||
/*reimp*/ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
||||
/*reimp*/ int columnCount(const QModelIndex& parent = QModelIndex()) const;
|
||||
/*reimp*/ QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
|
||||
/*reimp*/ int rowCount(const QModelIndex& parent = QModelIndex()) const;
|
||||
|
||||
void add(cylinder_t *cyl);
|
||||
void clear();
|
||||
void update();
|
||||
private:
|
||||
dive *currentDive;
|
||||
|
||||
/* Since the dive doesn`t stores the number of cylinders that
|
||||
* it has ( max 8 ) and since I don`t want to make a
|
||||
* model-for-each-dive, let`s hack this here instead. */
|
||||
QMap<dive*, int> usedRows;
|
||||
};
|
||||
|
||||
class WeightModel : public QAbstractTableModel {
|
||||
enum{TYPE, WEIGHT};
|
||||
/*reimp*/ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
||||
/*reimp*/ int columnCount(const QModelIndex& parent = QModelIndex()) const;
|
||||
/*reimp*/ QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
|
||||
/*reimp*/ int rowCount(const QModelIndex& parent = QModelIndex()) const;
|
||||
|
||||
void add(weight_t *weight);
|
||||
void clear();
|
||||
void update();
|
||||
private:
|
||||
int rows;
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue