"Fossies" - the Fresh Open Source Software Archive

Member "fet-5.48.0/src/interface/modifyconstraintstudentsmaxgapsperweekform.cpp" (12 Feb 2020, 2753 Bytes) of package /linux/privat/fet-5.48.0.tar.bz2:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "modifyconstraintstudentsmaxgapsperweekform.cpp" see the Fossies "Dox" file reference documentation.

    1 /***************************************************************************
    2                           modifyconstraintstudentsmaxgapsperweekform.cpp  -  description
    3                              -------------------
    4     begin                : Feb 11, 2005
    5     copyright            : (C) 2005 by Lalescu Liviu
    6     email                : Please see https://lalescu.ro/liviu/ for details about contacting Liviu Lalescu (in particular, you can find here the e-mail address)
    7  ***************************************************************************/
    8 
    9 /***************************************************************************
   10  *                                                                         *
   11  *   This program is free software: you can redistribute it and/or modify  *
   12  *   it under the terms of the GNU Affero General Public License as        *
   13  *   published by the Free Software Foundation, either version 3 of the    *
   14  *   License, or (at your option) any later version.                       *
   15  *                                                                         *
   16  ***************************************************************************/
   17 
   18 #include <QMessageBox>
   19 
   20 #include "modifyconstraintstudentsmaxgapsperweekform.h"
   21 #include "timeconstraint.h"
   22 
   23 ModifyConstraintStudentsMaxGapsPerWeekForm::ModifyConstraintStudentsMaxGapsPerWeekForm(QWidget* parent, ConstraintStudentsMaxGapsPerWeek* ctr): QDialog(parent)
   24 {
   25     setupUi(this);
   26 
   27     okPushButton->setDefault(true);
   28 
   29     connect(okPushButton, SIGNAL(clicked()), this, SLOT(ok()));
   30     connect(cancelPushButton, SIGNAL(clicked()), this, SLOT(cancel()));
   31 
   32     centerWidgetOnScreen(this);
   33     restoreFETDialogGeometry(this);
   34         
   35     this->_ctr=ctr;
   36     
   37     weightLineEdit->setText(CustomFETString::number(ctr->weightPercentage));
   38     
   39     maxGapsSpinBox->setMinimum(0);
   40     maxGapsSpinBox->setMaximum(gt.rules.nHoursPerDay*gt.rules.nDaysPerWeek);
   41     maxGapsSpinBox->setValue(ctr->maxGaps);
   42 }
   43 
   44 ModifyConstraintStudentsMaxGapsPerWeekForm::~ModifyConstraintStudentsMaxGapsPerWeekForm()
   45 {
   46     saveFETDialogGeometry(this);
   47 }
   48 
   49 void ModifyConstraintStudentsMaxGapsPerWeekForm::ok()
   50 {
   51     double weight;
   52     QString tmp=weightLineEdit->text();
   53     weight_sscanf(tmp, "%lf", &weight);
   54     if(weight<0.0 || weight>100.0){
   55         QMessageBox::warning(this, tr("FET information"),
   56             tr("Invalid weight (percentage)"));
   57         return;
   58     }
   59     if(weight!=100.0){
   60         QMessageBox::warning(this, tr("FET information"),
   61             tr("Invalid weight (percentage) - it must be 100%"));
   62         return;
   63     }
   64 
   65     this->_ctr->weightPercentage=weight;
   66     
   67     this->_ctr->maxGaps=maxGapsSpinBox->value();
   68 
   69     gt.rules.internalStructureComputed=false;
   70     setRulesModifiedAndOtherThings(&gt.rules);
   71     
   72     this->close();
   73 }
   74 
   75 void ModifyConstraintStudentsMaxGapsPerWeekForm::cancel()
   76 {
   77     this->close();
   78 }