diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-05-01 14:49:17 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-05-01 14:49:17 -0700 |
commit | 482bea84c2f218f515b3b16556197379623a8028 (patch) | |
tree | e8192233b60bacf2f53cab913b451417d613aa35 /qt-ui/maintab.cpp | |
parent | 04e59a0e1cdb32c5091fc4bc0d692f00821ab849 (diff) | |
download | subsurface-482bea84c2f218f515b3b16556197379623a8028.tar.gz |
Don't add cylinders and weightsystems past the MAX
We actually should disable the 'Add' button, I guess.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/maintab.cpp')
-rw-r--r-- | qt-ui/maintab.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp index f8c69ed9c..4174ce5dd 100644 --- a/qt-ui/maintab.cpp +++ b/qt-ui/maintab.cpp @@ -61,6 +61,9 @@ void MainTab::clearStats() void MainTab::on_addCylinder_clicked() { + if (cylindersModel->rowCount() >= MAX_CYLINDERS) + return; + AddCylinderDialog dialog(this); cylinder_t *newCylinder = (cylinder_t*) malloc(sizeof(cylinder_t)); newCylinder->type.description = ""; @@ -85,6 +88,9 @@ void MainTab::on_delCylinder_clicked() void MainTab::on_addWeight_clicked() { + if (weightModel->rowCount() >= MAX_WEIGHTSYSTEMS) + return; + /* 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"; |