Back to index

fet  5.18.0
Public Member Functions | Private Slots | Private Attributes
ChooseFieldsDialog Class Reference

#include <import.h>

List of all members.

Public Member Functions

 ChooseFieldsDialog (QWidget *parent)
 ~ChooseFieldsDialog ()

Private Slots

void chooseFieldsDialogClose ()
void chooseFieldsDialogUpdateRadio1 ()
void chooseFieldsDialogUpdateRadio2 ()
void chooseFieldsDialogUpdateRadio3 ()
void chooseFieldsDialogUpdateRadio3b ()
void chooseFieldsDialogUpdateLine3Text ()

Private Attributes

QGroupBox * fieldGroupBox [NUMBER_OF_FIELDS]
QRadioButton * fieldRadio1 [NUMBER_OF_FIELDS]
QRadioButton * fieldRadio2 [NUMBER_OF_FIELDS]
QRadioButton * fieldRadio3 [NUMBER_OF_FIELDS]
QRadioButton * fieldRadio3b [NUMBER_OF_FIELDS]
QComboBox * fieldLine2CB [NUMBER_OF_FIELDS]
QLineEdit * fieldLine3Text [NUMBER_OF_FIELDS]
QSpinBox * fieldLine3bSpinBox [NUMBER_OF_FIELDS]
QPushButton * pb
QPushButton * cancelpb
QHBoxLayout * buttonsLayout
QString _settingsName

Detailed Description

Definition at line 100 of file import.h.


Constructor & Destructor Documentation

Definition at line 127 of file import.cpp.

                                                     : QDialog(parent)
{
       assert(fields.size()>0);

       this->setWindowTitle(tr("FET - Import from CSV file"));
       QGridLayout* chooseFieldsMainLayout=new QGridLayout(this);

       QVBoxLayout* fieldBox[NUMBER_OF_FIELDS];
       QHBoxLayout* fieldLine1[NUMBER_OF_FIELDS];
       QHBoxLayout* fieldLine2[NUMBER_OF_FIELDS];
       QHBoxLayout* fieldLine3[NUMBER_OF_FIELDS];
       QHBoxLayout* fieldLine3b[NUMBER_OF_FIELDS];

       int gridRow=0;
       int gridColumn=0;
       for(int i=1; i<NUMBER_OF_FIELDS; i++){
              assert(fieldNumber[i]==DO_NOT_IMPORT || fieldNumber[i]==IMPORT_DEFAULT_ITEM);
              fieldGroupBox[i] = new QGroupBox(Import::tr("Please specify the %1 field:").arg(fieldName[i]));
              fieldBox[i] = new QVBoxLayout();
              fieldRadio1[i] = new QRadioButton(Import::tr("Don't import \"%1\".").arg(fieldName[i]));
              fieldRadio2[i] = new QRadioButton(Import::tr("Import this field from CSV:"));
              
              //trick to keep the translation active, maybe we need it in the future
              QString s=Import::tr("Set always the same name:");
              Q_UNUSED(s);
              
              //fieldRadio3[i] = new QRadioButton(Import::tr("Set always the same name:"));
              fieldRadio3[i] = new QRadioButton(Import::tr("Set always the same value:")); //modified by Liviu on 18 March 2009
              fieldRadio3b[i] = new QRadioButton(Import::tr("Set always the same value:"));

              fieldLine1[i] = new QHBoxLayout();
              fieldLine1[i]->addWidget(fieldRadio1[i]);
              fieldBox[i]->addLayout(fieldLine1[i]);
              
              fieldLine2CB[i] = new QComboBox();
              fieldLine2CB[i]->setMaximumWidth(220);                  //max
              fieldLine2CB[i]->insertItems(0,fields);
              fieldLine2[i] = new QHBoxLayout();
              fieldLine2[i]->addWidget(fieldRadio2[i]);
              fieldLine2[i]->addWidget(fieldLine2CB[i]);
              fieldBox[i]->addLayout(fieldLine2[i]);
              fieldRadio2[i]->setChecked(true);

              fieldLine3Text[i] = new QLineEdit(Import::tr("Please modify this text."));
//            fieldLine3Text[i]->setMaximumWidth(220);         //max
              fieldLine3[i] = new QHBoxLayout();
              fieldLine3[i]->addWidget(fieldRadio3[i]);
              
              //Added by Liviu - 18 March 2009, so that the dialog looks nice when dialog is maximized
              
              //TODO: add this line or not???
              fieldLine3[i]->addStretch();
              //fieldLine3Text[i]->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Maximum);
              
              fieldLine3[i]->addWidget(fieldLine3Text[i]);
              fieldBox[i]->addLayout(fieldLine3[i]);

              fieldLine3bSpinBox[i] = new QSpinBox();
              fieldLine3bSpinBox[i]->setMaximumWidth(220);            //max
              fieldLine3b[i] = new QHBoxLayout();
              fieldLine3b[i]->addWidget(fieldRadio3b[i]);
              fieldLine3b[i]->addWidget(fieldLine3bSpinBox[i]);
              fieldBox[i]->addLayout(fieldLine3b[i]);

              fieldGroupBox[i]->setLayout(fieldBox[i]);
              chooseFieldsMainLayout->addWidget(fieldGroupBox[i], gridRow, gridColumn);
              if(fieldNumber[i]==DO_NOT_IMPORT)
                     fieldGroupBox[i]->hide();
              else {
                     if(gridColumn==1){
                            gridColumn=0;
                            gridRow++;
                     } else
                            gridColumn++;
              }

              if(i==FIELD_YEAR_NAME || i==FIELD_TEACHER_NAME)
                     fieldRadio1[i]->hide();
              if(i==FIELD_ROOM_CAPACITY){
                     fieldRadio1[i]->hide();
                     fieldLine3bSpinBox[i]->setMaximum(MAX_ROOM_CAPACITY);
                     fieldLine3bSpinBox[i]->setMinimum(0);
                     fieldLine3bSpinBox[i]->setValue(MAX_ROOM_CAPACITY);
                     fieldRadio3b[i]->setChecked(true);
                     fieldRadio3[i]->hide();
                     fieldLine3Text[i]->hide();
              } else if(i==FIELD_YEAR_NUMBER_OF_STUDENTS || i==FIELD_GROUP_NUMBER_OF_STUDENTS || i==FIELD_SUBGROUP_NUMBER_OF_STUDENTS){
                     fieldRadio1[i]->hide();
                     fieldLine3bSpinBox[i]->setMaximum(MAX_TOTAL_SUBGROUPS);
                     fieldLine3bSpinBox[i]->setMinimum(0);
                     fieldLine3bSpinBox[i]->setValue(0);
                     fieldRadio3b[i]->setChecked(true);
                     fieldRadio3[i]->hide();
                     fieldLine3Text[i]->hide();
              } else {
                     fieldRadio3b[i]->hide();
                     fieldLine3bSpinBox[i]->hide();
              }
              if(i==FIELD_SUBJECT_NAME){
                     fieldRadio1[i]->hide();
                     fieldRadio3[i]->hide();
                     fieldLine3Text[i]->hide();
              }
              if(i==FIELD_ACTIVITY_TAG_NAME){
                     fieldRadio1[i]->hide();
                     fieldRadio3[i]->hide();
                     fieldLine3Text[i]->hide();
              }
              if(i==FIELD_ROOM_NAME){
                     fieldRadio3[i]->hide();
                     fieldLine3Text[i]->hide();
              }
              
              if(i==FIELD_TOTAL_DURATION){
                     fieldRadio1[i]->hide();
                     fieldLine3Text[i]->setText("1");
              }
              if(i==FIELD_SPLIT_DURATION){
                     fieldRadio1[i]->hide();
                     fieldLine3Text[i]->setText("1");
              }
              if(i==FIELD_MIN_DAYS){
                     fieldRadio1[i]->hide();
                     fieldLine3Text[i]->setText("1");
              }
              if(i==FIELD_MIN_DAYS_WEIGHT){
                     fieldRadio1[i]->hide();
                     fieldLine3Text[i]->setText("95");
              }
              if(i==FIELD_MIN_DAYS_CONSECUTIVE){
                     fieldRadio1[i]->hide();
                     fieldLine3Text[i]->setText("1");
              }
       }

       gridRow++;
       /*
       pb=new QPushButton(tr("OK"));
       chooseFieldsMainLayout->addWidget(pb,gridRow,1);
       cancelpb=new QPushButton(tr("Cancel"));
       chooseFieldsMainLayout->addWidget(cancelpb,gridRow,2);*/
       pb=new QPushButton(tr("OK"));
       cancelpb=new QPushButton(tr("Cancel"));
       buttonsLayout=new QHBoxLayout();
       buttonsLayout->addStretch();
       buttonsLayout->addWidget(pb);
       buttonsLayout->addWidget(cancelpb);
       chooseFieldsMainLayout->addLayout(buttonsLayout,gridRow,1);

       chooseFieldsDialogUpdateRadio1();
       chooseFieldsDialogUpdateRadio2();
       chooseFieldsDialogUpdateRadio3();
       chooseFieldsDialogUpdateRadio3b();

       //connect(pb, SIGNAL(clicked()), this, SLOT(accept()));
       connect(pb, SIGNAL(clicked()), this, SLOT(chooseFieldsDialogClose()));
       connect(cancelpb, SIGNAL(clicked()), this, SLOT(reject()));
       for(int i=1; i<NUMBER_OF_FIELDS; i++){
              connect(fieldRadio1[i], SIGNAL(toggled(bool)), this, SLOT(chooseFieldsDialogUpdateRadio1()));
              connect(fieldRadio2[i], SIGNAL(toggled(bool)), this, SLOT(chooseFieldsDialogUpdateRadio2()));
              connect(fieldRadio3[i], SIGNAL(toggled(bool)), this, SLOT(chooseFieldsDialogUpdateRadio3()));
              connect(fieldRadio3b[i], SIGNAL(toggled(bool)), this, SLOT(chooseFieldsDialogUpdateRadio3b()));
              connect(fieldLine3Text[i], SIGNAL(textChanged(QString)), this, SLOT(chooseFieldsDialogUpdateLine3Text()));
       }
       
       pb->setDefault(true);
       pb->setFocus();
       
       //_settingsName=settingsName;
       //restoreFETDialogGeometry(this, _settingsName);
}

Here is the call graph for this function:

Definition at line 299 of file import.cpp.

{
       //saveFETDialogGeometry(this, _settingsName);
}

Member Function Documentation

Definition at line 401 of file import.cpp.

                                                {
       for(int i=1; i<NUMBER_OF_FIELDS; i++){
              if(fieldNumber[i]!=DO_NOT_IMPORT){
                     if(fieldRadio1[i]->isChecked()){
                            fieldNumber[i]=DO_NOT_IMPORT;
                     }
                     if(fieldRadio2[i]->isChecked()){
                            fieldNumber[i]=fieldLine2CB[i]->currentIndex();
                            assert(fieldNumber[i]<fields.size());
                            assert(fieldNumber[i]>=0);
                     }
                     if(fieldRadio3[i]->isChecked()){
                            fieldNumber[i]=IMPORT_DEFAULT_ITEM;
                            //fieldName[i]=fieldLine3CB[i]->currentText();
                            fieldDefaultItem[i]=fieldLine3Text[i]->displayText();
                     }
                     if(fieldRadio3b[i]->isChecked()){
                            fieldNumber[i]=IMPORT_DEFAULT_ITEM;
                            fieldDefaultItem[i]=fieldLine3bSpinBox[i]->cleanText();
                     }
              }
       }
       
       this->accept();
}

Here is the caller graph for this function:

Definition at line 387 of file import.cpp.

                                                          {
       bool textOK=true;
       for(int i=1; i<NUMBER_OF_FIELDS; i++){
              if(fieldLine3Text[i]->displayText()=="")
                     textOK=false;
       }
       //by Liviu - always enabled
       if(1 || textOK)
              pb->setDisabled(false);
       else
              pb->setDisabled(true);
}

Here is the caller graph for this function:

Definition at line 304 of file import.cpp.

                                                       {
       if(fieldRadio1[FIELD_GROUP_NAME]->isChecked()){
              fieldRadio1[FIELD_GROUP_NUMBER_OF_STUDENTS]->setChecked(true);
              fieldRadio1[FIELD_SUBGROUP_NAME]->setChecked(true);
              fieldRadio1[FIELD_SUBGROUP_NUMBER_OF_STUDENTS]->setChecked(true);
              fieldGroupBox[FIELD_GROUP_NUMBER_OF_STUDENTS]->setDisabled(true);
              fieldGroupBox[FIELD_SUBGROUP_NUMBER_OF_STUDENTS]->setDisabled(true);
              fieldGroupBox[FIELD_SUBGROUP_NAME]->setDisabled(true);
       }
       if(fieldRadio1[FIELD_SUBGROUP_NAME]->isChecked()){
              fieldRadio1[FIELD_SUBGROUP_NUMBER_OF_STUDENTS]->setChecked(true);
              fieldGroupBox[FIELD_SUBGROUP_NUMBER_OF_STUDENTS]->setDisabled(true);
       }
       if(fieldRadio1[FIELD_ROOM_NAME]->isChecked()){
              fieldRadio1[FIELD_ROOM_CAPACITY]->setChecked(true);
              fieldGroupBox[FIELD_ROOM_CAPACITY]->setDisabled(true);
       }
       if(fieldRadio1[FIELD_BUILDING_NAME]->isChecked()&&fieldRadio1[FIELD_ROOM_NAME]->isChecked()){
              pb->setDisabled(true);
       }
       if((fieldRadio1[FIELD_BUILDING_NAME]->isChecked()&&!fieldRadio1[FIELD_ROOM_NAME]->isChecked()&&fieldLine3Text[FIELD_BUILDING_NAME]->displayText()!="")
              ||(!fieldRadio1[FIELD_BUILDING_NAME]->isChecked()&&fieldRadio1[FIELD_ROOM_NAME]->isChecked()&&fieldLine3Text[FIELD_BUILDING_NAME]->displayText()!="")){
              pb->setDisabled(false);
       }
}

Here is the caller graph for this function:

Definition at line 331 of file import.cpp.

Here is the caller graph for this function:

Definition at line 350 of file import.cpp.

Here is the caller graph for this function:

Definition at line 368 of file import.cpp.

Here is the caller graph for this function:


Member Data Documentation

Definition at line 120 of file import.h.

QHBoxLayout* ChooseFieldsDialog::buttonsLayout [private]

Definition at line 118 of file import.h.

QPushButton* ChooseFieldsDialog::cancelpb [private]

Definition at line 117 of file import.h.

Definition at line 108 of file import.h.

Definition at line 113 of file import.h.

Definition at line 115 of file import.h.

Definition at line 114 of file import.h.

Definition at line 109 of file import.h.

Definition at line 110 of file import.h.

Definition at line 111 of file import.h.

Definition at line 112 of file import.h.

QPushButton* ChooseFieldsDialog::pb [private]

Definition at line 116 of file import.h.


The documentation for this class was generated from the following files: