"Fossies" - the Fresh Open Source Software Archive

Member "fet-5.48.0/src/interface/modifystudentssubgroupform.cpp" (12 Feb 2020, 3313 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 "modifystudentssubgroupform.cpp" see the Fossies "Dox" file reference documentation.

    1 /***************************************************************************
    2                           modifystudentssubgroupform.cpp  -  description
    3                              -------------------
    4     begin                : Feb 8, 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 "modifystudentssubgroupform.h"
   21 
   22 ModifyStudentsSubgroupForm::ModifyStudentsSubgroupForm(QWidget* parent, const QString& yearName, const QString& groupName, const QString& initialSubgroupName, int initialNumberOfStudents): QDialog(parent)
   23 {
   24     setupUi(this);
   25 
   26     okPushButton->setDefault(true);
   27 
   28     connect(okPushButton, SIGNAL(clicked()), this, SLOT(ok()));
   29     connect(cancelPushButton, SIGNAL(clicked()), this, SLOT(cancel()));
   30 
   31     centerWidgetOnScreen(this);
   32     restoreFETDialogGeometry(this);
   33     
   34     numberSpinBox->setMaximum(MAX_ROOM_CAPACITY);
   35     numberSpinBox->setMinimum(0);
   36     numberSpinBox->setValue(0);
   37 
   38 //  this->_yearName=yearName;
   39 //  this->_groupName=groupName;
   40     this->_initialSubgroupName=initialSubgroupName;
   41     
   42     numberSpinBox->setValue(initialNumberOfStudents);
   43     
   44     yearNameLineEdit->setText(yearName);
   45     groupNameLineEdit->setText(groupName);
   46     nameLineEdit->setText(initialSubgroupName);
   47     nameLineEdit->selectAll();
   48     nameLineEdit->setFocus();
   49 }
   50 
   51 ModifyStudentsSubgroupForm::~ModifyStudentsSubgroupForm()
   52 {
   53     saveFETDialogGeometry(this);
   54 }
   55 
   56 void ModifyStudentsSubgroupForm::cancel()
   57 {
   58     this->close();
   59 }
   60 
   61 void ModifyStudentsSubgroupForm::ok()
   62 {
   63     if(nameLineEdit->text().isEmpty()){
   64         QMessageBox::information(this, tr("FET information"), tr("Incorrect name"));
   65         return;
   66     }
   67     QString subgroupName=nameLineEdit->text();
   68     //QString yearName=yearNameLineEdit->text();
   69     //QString groupName=groupNameLineEdit->text();
   70     
   71     if(this->_initialSubgroupName!=subgroupName && gt.rules.searchStudentsSet(subgroupName)!=NULL){
   72         QMessageBox::information(this, tr("FET information"),
   73          tr("Name exists. If you would like to make more groups to contain a subgroup (overlapping groups),"
   74          " please remove current subgroup (FET will unfortunately remove all related activities and constraints)"
   75          " and add a new subgroup with desired name in current group."
   76          " I know this is a not an elegant procedure, I'll try to fix that in the future."));
   77         
   78         nameLineEdit->selectAll();
   79         nameLineEdit->setFocus();
   80 
   81         return;
   82     }
   83 
   84     bool t=gt.rules.modifyStudentsSet(this->_initialSubgroupName, subgroupName, numberSpinBox->value());
   85     assert(t);
   86     
   87     this->close();
   88 }