Back to index

fet  5.18.0
modifyconstraintteachersmingapsbetweenbuildingchangesform.cpp
Go to the documentation of this file.
00001 /***************************************************************************
00002                           modifyconstraintteachersmingapsbetweebuildingchangesform.cpp  -  description
00003                              -------------------
00004     begin                : Feb 10, 2005
00005     copyright            : (C) 2005 by Lalescu Liviu
00006     email                : Please see http://lalescu.ro/liviu/ for details about contacting Liviu Lalescu (in particular, you can find here the e-mail address)
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #include <QMessageBox>
00019 
00020 
00021 
00022 #include "modifyconstraintteachersmingapsbetweenbuildingchangesform.h"
00023 #include "spaceconstraint.h"
00024 
00025 ModifyConstraintTeachersMinGapsBetweenBuildingChangesForm::ModifyConstraintTeachersMinGapsBetweenBuildingChangesForm(QWidget* parent, ConstraintTeachersMinGapsBetweenBuildingChanges* ctr): QDialog(parent)
00026 {
00027        setupUi(this);
00028 
00029        okPushButton->setDefault(true);
00030 
00031        connect(okPushButton, SIGNAL(clicked()), this, SLOT(ok()));
00032        connect(cancelPushButton, SIGNAL(clicked()), this, SLOT(cancel()));
00033 
00034        centerWidgetOnScreen(this);
00035        restoreFETDialogGeometry(this);
00036               
00037        this->_ctr=ctr;
00038        
00039        weightLineEdit->setText(CustomFETString::number(ctr->weightPercentage));
00040        
00041        minGapsSpinBox->setMinimum(1);
00042        minGapsSpinBox->setMaximum(gt.rules.nHoursPerDay);
00043        minGapsSpinBox->setValue(ctr->minGapsBetweenBuildingChanges);  
00044               
00045        constraintChanged();
00046 }
00047 
00048 ModifyConstraintTeachersMinGapsBetweenBuildingChangesForm::~ModifyConstraintTeachersMinGapsBetweenBuildingChangesForm()
00049 {
00050        saveFETDialogGeometry(this);
00051 }
00052 
00053 void ModifyConstraintTeachersMinGapsBetweenBuildingChangesForm::constraintChanged()
00054 {
00055 }
00056 
00057 void ModifyConstraintTeachersMinGapsBetweenBuildingChangesForm::ok()
00058 {
00059        double weight;
00060        QString tmp=weightLineEdit->text();
00061        weight_sscanf(tmp, "%lf", &weight);
00062        if(weight<100.0 || weight>100.0){
00063               QMessageBox::warning(this, tr("FET information"),
00064                      tr("Invalid weight (percentage). It has to be 100"));
00065               return;
00066        }
00067 
00068        this->_ctr->weightPercentage=weight;
00069        this->_ctr->minGapsBetweenBuildingChanges=minGapsSpinBox->value();
00070 
00071        gt.rules.internalStructureComputed=false;
00072        setRulesModifiedAndOtherThings(&gt.rules);
00073        
00074        this->close();
00075 }
00076 
00077 void ModifyConstraintTeachersMinGapsBetweenBuildingChangesForm::cancel()
00078 {
00079        this->close();
00080 }