Back to index

fet  5.18.0
modifyconstraintstudentsmaxhourscontinuouslyform.cpp
Go to the documentation of this file.
00001 /***************************************************************************
00002                           modifyconstraintstudentsmaxhourscontinuouslyform.cpp  -  description
00003                              -------------------
00004     begin                : July 19, 2007
00005     copyright            : (C) 2007 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 "modifyconstraintstudentsmaxhourscontinuouslyform.h"
00023 #include "timeconstraint.h"
00024 
00025 ModifyConstraintStudentsMaxHoursContinuouslyForm::ModifyConstraintStudentsMaxHoursContinuouslyForm(QWidget* parent, ConstraintStudentsMaxHoursContinuously* 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        maxHoursSpinBox->setMinimum(1);
00042        maxHoursSpinBox->setMaximum(gt.rules.nHoursPerDay);
00043        maxHoursSpinBox->setValue(ctr->maxHoursContinuously);
00044 }
00045 
00046 ModifyConstraintStudentsMaxHoursContinuouslyForm::~ModifyConstraintStudentsMaxHoursContinuouslyForm()
00047 {
00048        saveFETDialogGeometry(this);
00049 }
00050 
00051 void ModifyConstraintStudentsMaxHoursContinuouslyForm::constraintChanged()
00052 {
00053 }
00054 
00055 void ModifyConstraintStudentsMaxHoursContinuouslyForm::ok()
00056 {
00057        double weight;
00058        QString tmp=weightLineEdit->text();
00059        weight_sscanf(tmp, "%lf", &weight);
00060        if(weight<0.0 || weight>100.0){
00061               QMessageBox::warning(this, tr("FET information"),
00062                      tr("Invalid weight (percentage)"));
00063               return;
00064        }
00065 
00066        this->_ctr->weightPercentage=weight;
00067        this->_ctr->maxHoursContinuously=maxHoursSpinBox->value();
00068 
00069        gt.rules.internalStructureComputed=false;
00070        setRulesModifiedAndOtherThings(&gt.rules);
00071        
00072        this->close();
00073 }
00074 
00075 void ModifyConstraintStudentsMaxHoursContinuouslyForm::cancel()
00076 {
00077        this->close();
00078 }