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()
|
||||
{
|
||||
cylindersModel->update();
|
||||
|
|
|
@ -31,6 +31,9 @@ public Q_SLOTS:
|
|||
void on_addCylinder_clicked();
|
||||
void on_editCylinder_clicked();
|
||||
void on_delCylinder_clicked();
|
||||
void on_addWeight_clicked();
|
||||
void on_editWeight_clicked();
|
||||
void on_delWeight_clicked();
|
||||
|
||||
private:
|
||||
Ui::MainTab *ui;
|
||||
|
|
|
@ -152,14 +152,14 @@
|
|||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_4">
|
||||
<widget class="QPushButton" name="editWeight">
|
||||
<property name="text">
|
||||
<string>Edit</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_5">
|
||||
<widget class="QPushButton" name="addWeight">
|
||||
<property name="text">
|
||||
<string>Add</string>
|
||||
</property>
|
||||
|
@ -179,7 +179,7 @@
|
|||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_6">
|
||||
<widget class="QPushButton" name="delWeight">
|
||||
<property name="text">
|
||||
<string>Delete</string>
|
||||
</property>
|
||||
|
|
|
@ -186,13 +186,15 @@ QVariant WeightModel::headerData(int section, Qt::Orientation orientation, int r
|
|||
return ret;
|
||||
}
|
||||
|
||||
switch(section) {
|
||||
case TYPE:
|
||||
ret = tr("Type");
|
||||
break;
|
||||
case WEIGHT:
|
||||
ret = tr("Weight");
|
||||
break;
|
||||
if (role == Qt::DisplayRole) {
|
||||
switch(section) {
|
||||
case TYPE:
|
||||
ret = tr("Type");
|
||||
break;
|
||||
case WEIGHT:
|
||||
ret = tr("Weight");
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -56,6 +56,8 @@ private:
|
|||
/* Encapsulation of the Weight Model, that represents
|
||||
* the current weights on a dive. */
|
||||
class WeightModel : public QAbstractTableModel {
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum Column {TYPE, WEIGHT};
|
||||
/*reimp*/ QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
||||
/*reimp*/ int columnCount(const QModelIndex& parent = QModelIndex()) const;
|
||||
|
|
Loading…
Add table
Reference in a new issue