mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Hook up adding a weightsystem
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
5c2ce0ac20
commit
04e59a0e1c
5 changed files with 34 additions and 10 deletions
|
@ -83,6 +83,23 @@ void MainTab::on_delCylinder_clicked()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainTab::on_addWeight_clicked()
|
||||||
|
{
|
||||||
|
/* this needs a dialog - right now we just fill in a dummy */
|
||||||
|
weightsystem_t *newWeightsystem = (weightsystem_t *) malloc(sizeof(weightsystem_t));
|
||||||
|
newWeightsystem->description = "Just testing";
|
||||||
|
newWeightsystem->weight.grams = 15000;
|
||||||
|
weightModel->add(newWeightsystem);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainTab::on_editWeight_clicked()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainTab::on_delWeight_clicked()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void MainTab::reload()
|
void MainTab::reload()
|
||||||
{
|
{
|
||||||
cylindersModel->update();
|
cylindersModel->update();
|
||||||
|
|
|
@ -31,6 +31,9 @@ public Q_SLOTS:
|
||||||
void on_addCylinder_clicked();
|
void on_addCylinder_clicked();
|
||||||
void on_editCylinder_clicked();
|
void on_editCylinder_clicked();
|
||||||
void on_delCylinder_clicked();
|
void on_delCylinder_clicked();
|
||||||
|
void on_addWeight_clicked();
|
||||||
|
void on_editWeight_clicked();
|
||||||
|
void on_delWeight_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainTab *ui;
|
Ui::MainTab *ui;
|
||||||
|
|
|
@ -152,14 +152,14 @@
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton_4">
|
<widget class="QPushButton" name="editWeight">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Edit</string>
|
<string>Edit</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton_5">
|
<widget class="QPushButton" name="addWeight">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Add</string>
|
<string>Add</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -179,7 +179,7 @@
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="pushButton_6">
|
<widget class="QPushButton" name="delWeight">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Delete</string>
|
<string>Delete</string>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
@ -186,13 +186,15 @@ QVariant WeightModel::headerData(int section, Qt::Orientation orientation, int r
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(section) {
|
if (role == Qt::DisplayRole) {
|
||||||
case TYPE:
|
switch(section) {
|
||||||
ret = tr("Type");
|
case TYPE:
|
||||||
break;
|
ret = tr("Type");
|
||||||
case WEIGHT:
|
break;
|
||||||
ret = tr("Weight");
|
case WEIGHT:
|
||||||
break;
|
ret = tr("Weight");
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,8 @@ private:
|
||||||
/* Encapsulation of the Weight Model, that represents
|
/* Encapsulation of the Weight Model, that represents
|
||||||
* the current weights on a dive. */
|
* the current weights on a dive. */
|
||||||
class WeightModel : public QAbstractTableModel {
|
class WeightModel : public QAbstractTableModel {
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
enum Column {TYPE, WEIGHT};
|
enum Column {TYPE, WEIGHT};
|
||||||
/*reimp*/ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
/*reimp*/ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
||||||
/*reimp*/ int columnCount(const QModelIndex& parent = QModelIndex()) const;
|
/*reimp*/ int columnCount(const QModelIndex& parent = QModelIndex()) const;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue