mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
04e59a0e1c
commit
482bea84c2
2 changed files with 8 additions and 0 deletions
|
@ -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";
|
||||
|
|
|
@ -98,6 +98,7 @@ void CylindersModel::add(cylinder_t* cyl)
|
|||
{
|
||||
if (usedRows[current_dive] >= MAX_CYLINDERS) {
|
||||
free(cyl);
|
||||
return;
|
||||
}
|
||||
|
||||
int row = usedRows[current_dive];
|
||||
|
@ -203,6 +204,7 @@ void WeightModel::add(weightsystem_t* weight)
|
|||
{
|
||||
if (usedRows[current_dive] >= MAX_WEIGHTSYSTEMS) {
|
||||
free(weight);
|
||||
return;
|
||||
}
|
||||
|
||||
int row = usedRows[current_dive];
|
||||
|
|
Loading…
Add table
Reference in a new issue