Back to index

fet  5.18.0
fetmainform.cpp
Go to the documentation of this file.
00001 //
00002 //
00003 // Description: This file is part of FET
00004 //
00005 //
00006 // Author: Lalescu Liviu <Please see http://lalescu.ro/liviu/ for details about contacting Liviu Lalescu (in particular, you can find here the e-mail address)>
00007 // Copyright (C) 2003 Liviu Lalescu <http://lalescu.ro/liviu/>
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 <iostream>
00019 using namespace std;
00020 
00021 #include "centerwidgetonscreen.h"
00022 
00023 #include "timetable_defs.h"
00024 #include "timetable.h"
00025 #include "solution.h"
00026 
00027 #include "fetmainform.h"
00028 
00029 #include "timetablegenerateform.h"
00030 #include "timetablegeneratemultipleform.h"
00031 
00032 #include "timetableviewstudentsform.h"
00033 #include "timetableviewteachersform.h"
00034 #include "timetableviewroomsform.h"
00035 #include "timetableshowconflictsform.h"
00036 #include "timetableprintform.h"
00037 
00038 #include "export.h"
00039 #include "import.h"
00040 
00041 #include "institutionnameform.h"
00042 #include "commentsform.h"
00043 #include "daysform.h"
00044 #include "hoursform.h"
00045 #include "subjectsform.h"
00046 #include "subjectsstatisticsform.h"
00047 #include "activitytagsform.h"
00048 #include "teachersform.h"
00049 #include "teachersstatisticsform.h"
00050 #include "yearsform.h"
00051 #include "splityearform.h"
00052 #include "groupsform.h"
00053 #include "subgroupsform.h"
00054 #include "studentsstatisticsform.h"
00055 #include "activitiesroomsstatisticsform.h"
00056 #include "activitiesform.h"
00057 #include "subactivitiesform.h"
00058 #include "roomsform.h"
00059 #include "buildingsform.h"
00060 #include "alltimeconstraintsform.h"
00061 #include "allspaceconstraintsform.h"
00062 #include "helpaboutform.h"
00063 #include "helpfaqform.h"
00064 #include "helptipsform.h"
00065 #include "helpinstructionsform.h"
00066 
00067 #include "fet.h"
00068 
00069 #include "constraintactivityendsstudentsdayform.h"
00070 #include "constraintactivitiesendstudentsdayform.h"
00071 #include "constrainttwoactivitiesconsecutiveform.h"
00072 #include "constrainttwoactivitiesgroupedform.h"
00073 #include "constraintthreeactivitiesgroupedform.h"
00074 #include "constrainttwoactivitiesorderedform.h"
00075 #include "constraintactivitiespreferredtimeslotsform.h"
00076 #include "constraintactivitiespreferredstartingtimesform.h"
00077 
00078 #include "constraintsubactivitiespreferredtimeslotsform.h"
00079 #include "constraintsubactivitiespreferredstartingtimesform.h"
00080 
00081 #include "constraintactivitiessamestartingtimeform.h"
00082 #include "constraintactivitiessamestartinghourform.h"
00083 #include "constraintactivitiessamestartingdayform.h"
00084 
00085 #include "constraintactivitiesoccupymaxtimeslotsfromselectionform.h"
00086 #include "constraintactivitiesmaxsimultaneousinselectedtimeslotsform.h"
00087 
00088 #include "constraintteachernotavailabletimesform.h"
00089 #include "constraintbasiccompulsorytimeform.h"
00090 #include "constraintbasiccompulsoryspaceform.h"
00091 #include "constraintroomnotavailabletimesform.h"
00092 #include "constraintactivitypreferredroomform.h"
00093 #include "constraintstudentssetnotavailabletimesform.h"
00094 #include "constraintbreaktimesform.h"
00095 #include "constraintteachermaxdaysperweekform.h"
00096 #include "constraintteachersmaxdaysperweekform.h"
00097 
00098 #include "constraintteachermindaysperweekform.h"
00099 #include "constraintteachersmindaysperweekform.h"
00100 
00101 #include "constraintteacherintervalmaxdaysperweekform.h"
00102 #include "constraintteachersintervalmaxdaysperweekform.h"
00103 #include "constraintstudentssetintervalmaxdaysperweekform.h"
00104 #include "constraintstudentsintervalmaxdaysperweekform.h"
00105 
00106 #include "constraintteachermaxhoursdailyform.h"
00107 #include "constraintteachersmaxhoursdailyform.h"
00108 #include "constraintteachermaxhourscontinuouslyform.h"
00109 #include "constraintteachersmaxhourscontinuouslyform.h"
00110 
00111 #include "constraintteacheractivitytagmaxhourscontinuouslyform.h"
00112 #include "constraintteachersactivitytagmaxhourscontinuouslyform.h"
00113 
00114 #include "constraintteacheractivitytagmaxhoursdailyform.h"
00115 #include "constraintteachersactivitytagmaxhoursdailyform.h"
00116 
00117 #include "constraintteacherminhoursdailyform.h"
00118 #include "constraintteachersminhoursdailyform.h"
00119 #include "constraintactivitypreferredstartingtimeform.h"
00120 #include "constraintstudentssetmaxgapsperweekform.h"
00121 #include "constraintstudentsmaxgapsperweekform.h"
00122 
00123 #include "constraintstudentssetmaxgapsperdayform.h"
00124 #include "constraintstudentsmaxgapsperdayform.h"
00125 
00126 #include "constraintteachersmaxgapsperweekform.h"
00127 #include "constraintteachermaxgapsperweekform.h"
00128 #include "constraintteachersmaxgapsperdayform.h"
00129 #include "constraintteachermaxgapsperdayform.h"
00130 #include "constraintstudentsearlymaxbeginningsatsecondhourform.h"
00131 #include "constraintstudentssetearlymaxbeginningsatsecondhourform.h"
00132 #include "constraintstudentssetmaxhoursdailyform.h"
00133 #include "constraintstudentsmaxhoursdailyform.h"
00134 #include "constraintstudentssetmaxhourscontinuouslyform.h"
00135 #include "constraintstudentsmaxhourscontinuouslyform.h"
00136 
00137 #include "constraintstudentssetactivitytagmaxhourscontinuouslyform.h"
00138 #include "constraintstudentsactivitytagmaxhourscontinuouslyform.h"
00139 
00140 #include "constraintstudentssetactivitytagmaxhoursdailyform.h"
00141 #include "constraintstudentsactivitytagmaxhoursdailyform.h"
00142 
00143 #include "constraintstudentssetminhoursdailyform.h"
00144 #include "constraintstudentsminhoursdailyform.h"
00145 #include "constraintactivitiesnotoverlappingform.h"
00146 #include "constraintmindaysbetweenactivitiesform.h"
00147 #include "constraintmaxdaysbetweenactivitiesform.h"
00148 #include "constraintmingapsbetweenactivitiesform.h"
00149 #include "constraintactivitypreferredtimeslotsform.h"
00150 #include "constraintactivitypreferredstartingtimesform.h"
00151 #include "constraintactivitypreferredroomsform.h"
00152 
00153 #include "constraintstudentssethomeroomform.h"
00154 #include "constraintstudentssethomeroomsform.h"
00155 #include "constraintteacherhomeroomform.h"
00156 #include "constraintteacherhomeroomsform.h"
00157 
00158 #include "constraintstudentssetmaxbuildingchangesperdayform.h"
00159 #include "constraintstudentsmaxbuildingchangesperdayform.h"
00160 #include "constraintstudentssetmaxbuildingchangesperweekform.h"
00161 #include "constraintstudentsmaxbuildingchangesperweekform.h"
00162 #include "constraintstudentssetmingapsbetweenbuildingchangesform.h"
00163 #include "constraintstudentsmingapsbetweenbuildingchangesform.h"
00164 
00165 #include "constraintteachermaxbuildingchangesperdayform.h"
00166 #include "constraintteachersmaxbuildingchangesperdayform.h"
00167 #include "constraintteachermaxbuildingchangesperweekform.h"
00168 #include "constraintteachersmaxbuildingchangesperweekform.h"
00169 #include "constraintteachermingapsbetweenbuildingchangesform.h"
00170 #include "constraintteachersmingapsbetweenbuildingchangesform.h"
00171 
00172 #include "constraintsubjectpreferredroomform.h"
00173 #include "constraintsubjectpreferredroomsform.h"
00174 #include "constraintsubjectactivitytagpreferredroomform.h"
00175 #include "constraintsubjectactivitytagpreferredroomsform.h"
00176 
00177 #include "constraintactivitytagpreferredroomform.h"
00178 #include "constraintactivitytagpreferredroomsform.h"
00179 
00180 #include "constraintactivitiesoccupymaxdifferentroomsform.h"
00181 
00182 #include "settingstimetablehtmllevelform.h"
00183 
00184 #include "activityplanningconfirmationform.h"
00185 #include "activityplanningform.h"
00186 
00187 #include "spreadconfirmationform.h"
00188 
00189 #include "removeredundantconfirmationform.h"
00190 #include "removeredundantform.h"
00191 
00192 #include "savetimetableconfirmationform.h"
00193 
00194 #include "lockunlock.h"
00195 #include "advancedlockunlockform.h"
00196 
00197 #include "longtextmessagebox.h"
00198 
00199 #include <QMessageBox>
00200 
00201 #include <QFileDialog>
00202 #include <QString>
00203 #include <QDir>
00204 #include <QTranslator>
00205 #include <QCloseEvent>
00206 #include <QStatusBar>
00207 #include <QMap>
00208 #include <QWidget>
00209 #include <QList>
00210 
00211 #include <QDesktopServices>
00212 #include <QUrl>
00213 #include <QApplication>
00214 #include <QMenu>
00215 #include <QCursor>
00216 #include <QSettings>
00217 
00218 #include <QFileInfo>
00219 #include <QFile>
00220 
00221 #include <QNetworkAccessManager>
00222 #include <QNetworkReply>
00223 
00224 #include <QRegExp>
00225 
00226 //for the icons of not perfect constraints
00227 #include <QIcon>
00228 
00229 #include <QRect>
00230 
00231 QRect mainFormSettingsRect;
00232 int MAIN_FORM_SHORTCUTS_TAB_POSITION;
00233 
00234 #include "spreadmindaysconstraintsfivedaysform.h"
00235 
00236 #include "statisticsexport.h"
00237 
00238 bool simulation_running; //true if the user started an allocation of the timetable
00239 
00240 bool simulation_running_multi;
00241 
00242 bool students_schedule_ready;
00243 bool teachers_schedule_ready;
00244 bool rooms_schedule_ready;
00245 
00246 Solution best_solution;
00247 
00248 QString conflictsString; //the string that contains a log of the broken constraints
00249 QString conflictsStringTitle;
00250 
00251 extern QApplication* pqapplication;
00252 
00253 Rules rules2;
00254 
00255 static int ORIGINAL_WIDTH;
00256 static int ORIGINAL_HEIGHT;
00257 //static int ORIGINAL_X;
00258 //static int ORIGINAL_Y;
00259 
00260 const QString COMPANY=QString("fet");
00261 const QString PROGRAM=QString("fettimetabling");
00262 
00263 bool USE_GUI_COLORS=false;
00264 
00265 bool SHOW_SHORTCUTS_ON_MAIN_WINDOW=true;
00266 
00267 bool ENABLE_ACTIVITY_TAG_MAX_HOURS_DAILY=false;
00268 bool ENABLE_STUDENTS_MAX_GAPS_PER_DAY=false;
00269 
00270 bool SHOW_WARNING_FOR_NOT_PERFECT_CONSTRAINTS=true;
00271 
00272 
00273 bool ENABLE_STUDENTS_MIN_HOURS_DAILY_WITH_ALLOW_EMPTY_DAYS=false;
00274 
00275 bool SHOW_WARNING_FOR_STUDENTS_MIN_HOURS_DAILY_WITH_ALLOW_EMPTY_DAYS=true;
00276 
00277 bool CONFIRM_ACTIVITY_PLANNING=true;
00278 bool CONFIRM_SPREAD_ACTIVITIES=true;
00279 bool CONFIRM_REMOVE_REDUNDANT=true;
00280 bool CONFIRM_SAVE_TIMETABLE=true;
00281 
00282 extern int XX;
00283 extern int YY;
00284 extern const int MM;
00285 
00286 const int STATUS_BAR_MILLISECONDS=2500;
00287 
00288 RandomSeedDialog::RandomSeedDialog(QWidget* parent): QDialog(parent)
00289 {
00290        setWindowTitle(tr("Random seed"));
00291 
00292        labelX=new QLabel(tr("Random seed X component:", "Means the X component of the random seed (random seed has 2 components, X and Y)"));
00293        lineEditX=new QLineEdit(CustomFETString::number(XX));
00294        labelY=new QLabel(tr("Random seed Y component:", "Means the Y component of the random seed (random seed has 2 components, X and Y)"));
00295        lineEditY=new QLineEdit(CustomFETString::number(YY));
00296        okPB=new QPushButton(tr("OK"));
00297        okPB->setDefault(true);
00298        helpPB=new QPushButton(tr("Help"));
00299        cancelPB=new QPushButton(tr("Cancel"));
00300 
00301        valuesLabelX=new QLabel(tr("Allowed minimum %1 to maximum %2").arg(1).arg(MM-1));
00302        valuesLabelY=new QLabel(tr("Allowed minimum %1 to maximum %2").arg(1).arg(MMM-1));
00303        
00304        seedLayoutX=new QGridLayout();
00305        seedLayoutX->addWidget(labelX,0,0);
00306        seedLayoutX->addWidget(lineEditX,0,1);
00307        seedLayoutX->addWidget(valuesLabelX,1,0,1,2);
00308 
00309        seedLayoutY=new QGridLayout();
00310        seedLayoutY->addWidget(labelY,0,0);
00311        seedLayoutY->addWidget(lineEditY,0,1);
00312        seedLayoutY->addWidget(valuesLabelY,1,0,1,2);
00313 
00314        buttonsLayout=new QHBoxLayout();
00315        buttonsLayout->addWidget(helpPB);
00316        buttonsLayout->addWidget(okPB);
00317        buttonsLayout->addWidget(cancelPB);
00318        
00319        mainLayout=new QVBoxLayout(this);
00320        mainLayout->addLayout(seedLayoutX);
00321        mainLayout->addStretch();
00322        mainLayout->addLayout(seedLayoutY);
00323        mainLayout->addStretch();
00324        mainLayout->addLayout(buttonsLayout);
00325        
00326        connect(helpPB, SIGNAL(clicked()), this, SLOT(help()));
00327        connect(okPB, SIGNAL(clicked()), this, SLOT(ok()));
00328        connect(cancelPB, SIGNAL(clicked()), this, SLOT(reject()));
00329        
00330        int w=this->sizeHint().width();
00331        int h=this->sizeHint().height();
00332        if(w<370)
00333               w=370;
00334        if(h<220)
00335               h=220;
00336        this->resize(w, h);
00337        
00338        centerWidgetOnScreen(this);
00339        restoreFETDialogGeometry(this);
00340 }
00341 
00342 RandomSeedDialog::~RandomSeedDialog()
00343 {
00344        saveFETDialogGeometry(this);
00345 }
00346 
00347 void RandomSeedDialog::help()
00348 {
00349        LongTextMessageBox::largeInformation(this, tr("FET information"), 
00350               tr("You can control the random behaviour of FET with this function")+".\n\n"+
00351               tr("The random seed is the state of the random number generator.")+" "+
00352               tr("It has two components, X and Y.")+" "+
00353               tr("X is a value at least %1 and at most %2.").arg(1).arg(MM-1)+" "+
00354               tr("Y is a value at least %1 and at most %2.").arg(1).arg(MMM-1)+" "+
00355               +"\n\n"+tr("The random seed before the generation of a timetable (the X and Y components) is saved on disk in the corresponding timetables directory,"
00356               " so that you can simulate again the same generation after that.")+"\n\n"+
00357               tr("Mode of operation: to obtain the same timetable twice, give the random seed"
00358               " two values (say X=1234, Y=12345), then generate single, then make it again the same values (X=1234 and Y=12345),"
00359               " then generate single again. The timetables will be the same. If you generate multiple instead of single,"
00360               " the first set of timetables will be the same as the second set (if you generate the same number of timetables)"
00361               " but of course timetables inside each set will be different. If you enter the same random seed (X and Y) on different computers"
00362               " (but using the same FET version, see note below)"
00363               " and generate single, the timetables will be the same (if you generate multiple, the sets of timetables will correspond, "
00364               "the first timetable from simulation 1 with first timetable from simulation 2, etc.)")
00365               +"\n\n"
00366               +tr("Note: of course you need exactly the same conditions to duplicate the same simulations (so, you need exactly the same data - activities, constraints, etc.).")
00367               +"\n\n"
00368               +tr("Note: for different versions of FET, the behavior of generation may be totally different, even for the same data and the same random seed (same X and same Y), "
00369               "due to possible changes in the algorithm. You need to consider this as a precaution.")
00370               +"\n\n"
00371               +tr("Note: when you start FET, each time, the random seed X is the number of seconds elapsed since 1 January 1970 and the random seed Y is the next number"
00372               " in the Y series, after the number of seconds elapsed since 1 January 1970")
00373               +". "
00374               +tr("After you generate (even partially), the random seed (X and Y components) will change (each call of the random number generator updates the random seed components to the next numbers"
00375               " in the sequence, and there are many calls to this random generating routine in the generate function)")
00376               +"\n\n"
00377               +tr("This setting is useful for more things, maybe one thing is bug report: send you file along with the random seed at the start of generating"
00378               " (the two components, X and Y, are saved in the timetable directory at the start of generation)")
00379        );
00380 }
00381 
00382 void RandomSeedDialog::ok()
00383 {
00384        int tx=lineEditX->text().toInt();
00385        if(!(tx>=1 && tx<MM)){
00386               QMessageBox::warning(this, tr("FET warning"), tr("The random seed X component must be at least %1 and at most %2").arg(1).arg(MM-1));
00387               return;
00388        }
00389        
00390        int ty=lineEditY->text().toInt();
00391        if(!(ty>=1 && ty<MMM)){
00392               QMessageBox::warning(this, tr("FET warning"), tr("The random seed Y component must be at least %1 and at most %2").arg(1).arg(MMM-1));
00393               return;
00394        }
00395        
00396        accept();
00397 }
00398 
00399 FetMainForm::FetMainForm()
00400 {
00401        setupUi(this);
00402 
00403        QSettings settings(COMPANY, PROGRAM);
00404        int nRec=settings.value(QString("FetMainForm/number-of-recent-files"), 0).toInt();
00405        if(nRec>MAX_RECENT_FILES)
00406               nRec=MAX_RECENT_FILES;
00407        recentFiles.clear();
00408        for(int i=0; i<nRec; i++)
00409               if(settings.contains(QString("FetMainForm/recent-file/")+CustomFETString::number(i+1)))
00410                      recentFiles.append(settings.value(QString("FetMainForm/recent-file/")+CustomFETString::number(i+1)).toString());
00411        
00412        recentSeparatorAction=fileOpenRecentMenu->insertSeparator(fileClearRecentFilesListAction);
00413        for(int i=0; i<MAX_RECENT_FILES; i++){
00414               recentFileActions[i]=new QAction(this);
00415               recentFileActions[i]->setVisible(false);
00416               connect(recentFileActions[i], SIGNAL(triggered()), this, SLOT(openRecentFile()));
00417               
00418               fileOpenRecentMenu->insertAction(recentSeparatorAction, recentFileActions[i]);
00419        }
00420        
00421        updateRecentFileActions();
00422        
00423        //statusBar()->showMessage(tr("FET started", "This is a message written in the status bar, saying that FET was started"), STATUS_BAR_MILLISECONDS);
00424        statusBar()->showMessage("", STATUS_BAR_MILLISECONDS); //to get the correct centralWidget for the logo, so we need status bar existing.
00425        
00426        INPUT_FILENAME_XML=QString("");
00427        setCurrentFile(INPUT_FILENAME_XML);
00428 
00429        //toolBox->setCurrentIndex(0);
00430        tabWidget->setVisible(SHOW_SHORTCUTS_ON_MAIN_WINDOW);
00431        tabWidget->setCurrentIndex(MAIN_FORM_SHORTCUTS_TAB_POSITION);
00432        
00433        shortcutBasicMenu=new QMenu();
00434        shortcutBasicMenu->addMenu(menuInstitution_information);
00435        shortcutBasicMenu->addSeparator(); //added on 19 Dec. 2009
00436        shortcutBasicMenu->addMenu(menuDays_and_hours);
00437        
00438        shortcutAdvancedTimeMenu=new QMenu();
00439        shortcutAdvancedTimeMenu->addAction(spreadActivitiesAction);
00440        shortcutAdvancedTimeMenu->addSeparator();
00441        shortcutAdvancedTimeMenu->addAction(removeRedundantConstraintsAction);
00442        
00443        shortcutDataSpaceMenu=new QMenu();
00444        shortcutDataSpaceMenu->addAction(dataBuildingsAction);
00445        shortcutDataSpaceMenu->addSeparator();
00446        shortcutDataSpaceMenu->addAction(dataRoomsAction);
00447        
00448        shortcutDataAdvancedMenu=new QMenu();
00449        shortcutDataAdvancedMenu->addAction(activityPlanningAction);
00450        shortcutDataAdvancedMenu->addSeparator();
00451        shortcutDataAdvancedMenu->addAction(dataTeachersStatisticsAction);
00452        shortcutDataAdvancedMenu->addAction(dataSubjectsStatisticsAction);
00453        shortcutDataAdvancedMenu->addAction(dataStudentsStatisticsAction);
00454        shortcutDataAdvancedMenu->addSeparator();
00455        shortcutDataAdvancedMenu->addAction(dataActivitiesRoomsStatisticsAction);
00456        
00457        ORIGINAL_WIDTH=width();
00458        ORIGINAL_HEIGHT=height();
00459        //ORIGINAL_X=x();
00460        //ORIGINAL_Y=y();
00461        
00462        QRect rect=mainFormSettingsRect;
00463        if(!rect.isValid()){
00464               forceCenterWidgetOnScreen(this);
00465        }
00466        else{
00467               //this->setWindowFlags(this->windowFlags() | Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint | Qt::WindowMinMaxButtonsHint);
00468               
00469               /*resize(rect.size());
00470               move(rect.topLeft());*/
00471               this->setGeometry(rect);
00472        }
00473 
00474        //new data
00475        if(gt.rules.initialized)
00476               gt.rules.kill();
00477        gt.rules.init();
00478 
00479        gt.rules.modified=true; //to avoid flicker of the main form modified flag
00480 
00481        bool tmp=gt.rules.addTimeConstraint(new ConstraintBasicCompulsoryTime(100));
00482        assert(tmp);
00483        tmp=gt.rules.addSpaceConstraint(new ConstraintBasicCompulsorySpace(100));
00484        assert(tmp);
00485 
00486        gt.rules.modified=true; //force update of the modified flag of the main window
00487        setRulesUnmodifiedAndOtherThings(&gt.rules);
00488 
00489        students_schedule_ready=false;
00490        teachers_schedule_ready=false;
00491        rooms_schedule_ready=false;
00492        
00493        settingsShowShortcutsOnMainWindowAction->setCheckable(true);
00494        settingsShowShortcutsOnMainWindowAction->setChecked(SHOW_SHORTCUTS_ON_MAIN_WINDOW);
00495        
00496        checkForUpdatesAction->setCheckable(true);
00497        checkForUpdatesAction->setChecked(checkForUpdates);
00498        
00499        settingsUseColorsAction->setCheckable(true);
00500        settingsUseColorsAction->setChecked(USE_GUI_COLORS);
00501        
00503        settingsConfirmActivityPlanningAction->setCheckable(true);
00504        settingsConfirmActivityPlanningAction->setChecked(CONFIRM_ACTIVITY_PLANNING);
00505        
00506        settingsConfirmSpreadActivitiesAction->setCheckable(true);
00507        settingsConfirmSpreadActivitiesAction->setChecked(CONFIRM_SPREAD_ACTIVITIES);
00508        
00509        settingsConfirmRemoveRedundantAction->setCheckable(true);
00510        settingsConfirmRemoveRedundantAction->setChecked(CONFIRM_REMOVE_REDUNDANT);
00511        
00512        settingsConfirmSaveTimetableAction->setCheckable(true);
00513        settingsConfirmSaveTimetableAction->setChecked(CONFIRM_SAVE_TIMETABLE);
00515        
00516        timetablesDivideByDaysAction->setCheckable(true);
00517        timetablesDivideByDaysAction->setChecked(DIVIDE_HTML_TIMETABLES_WITH_TIME_AXIS_BY_DAYS);
00518        
00519        if(checkForUpdates){
00520               networkManager=new QNetworkAccessManager(this);
00521               connect(networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));
00522               QUrl url("http://lalescu.ro/liviu/fet/crtversion/crtversion.txt");
00523               cout<<"New version checking host: "<<qPrintable(url.host())<<endl;
00524               cout<<"New version checking path: "<<qPrintable(url.path())<<endl;
00525               networkManager->get(QNetworkRequest(url));
00526        }
00527        
00528        settingsPrintNotAvailableSlotsAction->setCheckable(true);
00529        settingsPrintNotAvailableSlotsAction->setChecked(PRINT_NOT_AVAILABLE_TIME_SLOTS);
00530 
00531        settingsPrintBreakSlotsAction->setCheckable(true);
00532        settingsPrintBreakSlotsAction->setChecked(PRINT_BREAK_TIME_SLOTS);
00533 
00534        settingsPrintActivitiesWithSameStartingTimeAction->setCheckable(true);
00535        settingsPrintActivitiesWithSameStartingTimeAction->setChecked(PRINT_ACTIVITIES_WITH_SAME_STARTING_TIME);
00536 
00537        //needed to sync the view table forms
00538        LockUnlock::computeLockedUnlockedActivitiesTimeSpace();
00539        LockUnlock::increaseCommunicationSpinBox();
00540        
00541        enableActivityTagMaxHoursDailyAction->setChecked(ENABLE_ACTIVITY_TAG_MAX_HOURS_DAILY);
00542        enableStudentsMaxGapsPerDayAction->setChecked(ENABLE_STUDENTS_MAX_GAPS_PER_DAY);
00543        showWarningForNotPerfectConstraintsAction->setChecked(SHOW_WARNING_FOR_NOT_PERFECT_CONSTRAINTS);
00544 
00545        enableStudentsMinHoursDailyWithAllowEmptyDaysAction->setChecked(ENABLE_STUDENTS_MIN_HOURS_DAILY_WITH_ALLOW_EMPTY_DAYS);
00546        showWarningForStudentsMinHoursDailyWithAllowEmptyDaysAction->setChecked(SHOW_WARNING_FOR_STUDENTS_MIN_HOURS_DAILY_WITH_ALLOW_EMPTY_DAYS);
00547        
00548        connect(enableActivityTagMaxHoursDailyAction, SIGNAL(toggled(bool)), this, SLOT(enableActivityTagMaxHoursDailyToggled(bool)));
00549        connect(enableStudentsMaxGapsPerDayAction, SIGNAL(toggled(bool)), this, SLOT(enableStudentsMaxGapsPerDayToggled(bool)));
00550        connect(showWarningForNotPerfectConstraintsAction, SIGNAL(toggled(bool)), this, SLOT(showWarningForNotPerfectConstraintsToggled(bool)));
00551 
00552        connect(enableStudentsMinHoursDailyWithAllowEmptyDaysAction, SIGNAL(toggled(bool)), this, SLOT(enableStudentsMinHoursDailyWithAllowEmptyDaysToggled(bool)));
00553        connect(showWarningForStudentsMinHoursDailyWithAllowEmptyDaysAction, SIGNAL(toggled(bool)), this, SLOT(showWarningForStudentsMinHoursDailyWithAllowEmptyDaysToggled(bool)));
00554 
00555        dataTimeConstraintsTeacherActivityTagMaxHoursDailyAction->setIconVisibleInMenu(true);
00556        dataTimeConstraintsTeachersActivityTagMaxHoursDailyAction->setIconVisibleInMenu(true);
00557        dataTimeConstraintsStudentsActivityTagMaxHoursDailyAction->setIconVisibleInMenu(true);
00558        dataTimeConstraintsStudentsSetActivityTagMaxHoursDailyAction->setIconVisibleInMenu(true);
00559 
00560        dataTimeConstraintsStudentsSetMaxGapsPerDayAction->setIconVisibleInMenu(true);
00561        dataTimeConstraintsStudentsMaxGapsPerDayAction->setIconVisibleInMenu(true);
00562 
00563        setEnabledIcon(dataTimeConstraintsTeacherActivityTagMaxHoursDailyAction, ENABLE_ACTIVITY_TAG_MAX_HOURS_DAILY);
00564        setEnabledIcon(dataTimeConstraintsTeachersActivityTagMaxHoursDailyAction, ENABLE_ACTIVITY_TAG_MAX_HOURS_DAILY);
00565        setEnabledIcon(dataTimeConstraintsStudentsActivityTagMaxHoursDailyAction, ENABLE_ACTIVITY_TAG_MAX_HOURS_DAILY);
00566        setEnabledIcon(dataTimeConstraintsStudentsSetActivityTagMaxHoursDailyAction, ENABLE_ACTIVITY_TAG_MAX_HOURS_DAILY);
00567 
00568        setEnabledIcon(dataTimeConstraintsStudentsSetMaxGapsPerDayAction, ENABLE_STUDENTS_MAX_GAPS_PER_DAY);
00569        setEnabledIcon(dataTimeConstraintsStudentsMaxGapsPerDayAction, ENABLE_STUDENTS_MAX_GAPS_PER_DAY);
00570 }
00571 
00572 void FetMainForm::setEnabledIcon(QAction* action, bool enabled)
00573 {
00574        static QIcon locked(":/images/locked.png");
00575        static QIcon unlocked(":/images/unlocked.png");
00576        
00577        if(enabled)
00578               action->setIcon(unlocked);
00579        else
00580               action->setIcon(locked);
00581 }
00582 
00583 
00584 void FetMainForm::enableNotPerfectMessage()
00585 {
00586        QString s=tr("Constraint is not enabled. To use this type of constraint you must enable it from the Settings->Advanced menu.");
00587        s+="\n\n";
00588        s+=tr("Explanation:");
00589        s+=" ";
00590        s+=tr("Constraints of this type are good, working, but they are not perfectly optimized.");
00591        s+=" ";
00592        s+=tr("For some situations, the generation of the timetable may take too long or be impossible.");
00593        s+="\n\n";
00594        s+=tr("Use with caution.");
00595 
00596        QMessageBox::information(this, tr("FET information"), s);
00597 }
00598 
00599 void FetMainForm::on_checkForUpdatesAction_toggled()
00600 {
00601        checkForUpdates=checkForUpdatesAction->isChecked();
00602 }
00603 
00604 void FetMainForm::on_settingsUseColorsAction_toggled()
00605 {
00606        USE_GUI_COLORS=settingsUseColorsAction->isChecked();
00607 }
00608 
00610 void FetMainForm::on_settingsConfirmActivityPlanningAction_toggled()
00611 {
00612        CONFIRM_ACTIVITY_PLANNING=settingsConfirmActivityPlanningAction->isChecked();
00613 }
00614 
00615 void FetMainForm::on_settingsConfirmSpreadActivitiesAction_toggled()
00616 {
00617        CONFIRM_SPREAD_ACTIVITIES=settingsConfirmSpreadActivitiesAction->isChecked();
00618 }
00619 
00620 void FetMainForm::on_settingsConfirmRemoveRedundantAction_toggled()
00621 {
00622        CONFIRM_REMOVE_REDUNDANT=settingsConfirmRemoveRedundantAction->isChecked();
00623 }
00624 
00625 void FetMainForm::on_settingsConfirmSaveTimetableAction_toggled()
00626 {
00627        CONFIRM_SAVE_TIMETABLE=settingsConfirmSaveTimetableAction->isChecked();
00628 }
00630 
00631 void FetMainForm::on_settingsShowShortcutsOnMainWindowAction_toggled()
00632 {
00633        SHOW_SHORTCUTS_ON_MAIN_WINDOW=settingsShowShortcutsOnMainWindowAction->isChecked();
00634        tabWidget->setVisible(SHOW_SHORTCUTS_ON_MAIN_WINDOW);
00635 }
00636 
00637 void FetMainForm::on_timetablesDivideByDaysAction_toggled()
00638 {
00639        DIVIDE_HTML_TIMETABLES_WITH_TIME_AXIS_BY_DAYS=timetablesDivideByDaysAction->isChecked();
00640 }
00641 
00642 void FetMainForm::replyFinished(QNetworkReply* networkReply)
00643 {
00644        if(networkReply->error()!=QNetworkReply::NoError){
00645               QString s=QString("");
00646               s+=tr("Could not search for possible updates on Internet - error message is: %1.").arg(networkReply->errorString());
00647               s+=QString("\n\n");
00648               s+=tr("Searching for file %1.").arg("http://lalescu.ro/liviu/fet/crtversion/crtversion.txt");
00649               s+=QString("\n\n");
00650               s+=tr("Possible actions: check your network connection, try again later, try to visit FET homepage: %1, or"
00651                " try to search for the new FET page on the Internet (maybe it has changed).").arg("http://lalescu.ro/liviu/fet/");
00652 
00653               QMessageBox::warning(this, tr("FET warning"), s);
00654        }
00655        else{
00656               QString internetVersion;
00657               QString additionalComments;
00658               
00659               QRegExp regExp("^\\s*(\\S+)(.*)$");
00660               int t=regExp.indexIn(QString(networkReply->readAll()));
00661               if(t!=0){
00662                      QString s=QString("");
00663                      s+=tr("The file %1 from the FET homepage, indicating the current FET version, is incorrect.").arg("http://lalescu.ro/liviu/fet/crtversion/crtversion.txt");
00664                      s+=QString("\n\n");
00665                      s+=tr("Maybe the FET homepage has some temporary problems, so try again later."
00666                       " Or maybe the current structure on FET homepage was changed. You may visit FET homepage: %1, and get latest version or,"
00667                       " if it does not work, try to search for the new FET page on the Internet (maybe it has changed).")
00668                        .arg("http://lalescu.ro/liviu/fet/");
00669 
00670                      QMessageBox::warning(this, tr("FET warning"), s);
00671               }
00672               else{
00673                      internetVersion=regExp.cap(1);
00674                      additionalComments=regExp.cap(2).trimmed();
00675        
00676                      cout<<"Your current version: '";
00677                      cout<<qPrintable(FET_VERSION)<<"'"<<endl;
00678                      cout<<"Latest version: '";
00679                      cout<<qPrintable(internetVersion)<<"'"<<endl;
00680        
00681                      if(internetVersion!=FET_VERSION){
00682                             QString s=tr("Another version: %1, is available on the FET homepage: %2", "%1 is new version, %2 is FET homepage").arg(internetVersion).arg("http://lalescu.ro/liviu/fet/");
00683                             s+=QString("\n\n");
00684                             s+=("You have to manually download and install.")+QString(" ")+tr("You may need to hit Refresh in your web browser.")+QString("\n\n")+tr("Would you like to open the FET homepage now?");
00685                             if(!additionalComments.isEmpty()){
00686                                    s+=QString("\n\n");
00687                                    s+=tr("Additional comments: %1").arg(additionalComments);
00688                             }
00689                      
00690                             QMessageBox::StandardButton button=QMessageBox::information(this, tr("FET information"), s, QMessageBox::Yes|QMessageBox::No);
00691                             
00692                             if(button==QMessageBox::Yes){
00693                                    bool tds=QDesktopServices::openUrl(QUrl("http://lalescu.ro/liviu/fet/"));
00694                                    if(!tds){
00695                                           QMessageBox::warning(this, tr("FET warning"), tr("Could not start the default Internet browser (trying to open the link %1)."
00696                                                  " Maybe you can try to manually start your browser and open this link.").arg("http://lalescu.ro/liviu/fet/"));
00697                                    }
00698                             }
00699                      }
00700               }
00701        }
00702 
00703        networkReply->deleteLater();
00704 }
00705 
00706 void FetMainForm::closeOtherWindows()
00707 {
00708        QList<QWidget*> tlwl=qApp->topLevelWidgets();
00709        
00710        foreach(QWidget* wi, tlwl)
00711               if(wi->isVisible() && wi!=this)
00712                      wi->close();
00713 }
00714 
00715 void FetMainForm::closeEvent(QCloseEvent* event)
00716 {
00717        //QRect rect(x(), y(), width(), height());
00718        QRect rect=this->geometry();
00719        mainFormSettingsRect=rect;
00720        
00721        MAIN_FORM_SHORTCUTS_TAB_POSITION=tabWidget->currentIndex();
00722        
00723        if(gt.rules.modified){
00724               QMessageBox::StandardButton res=QMessageBox::question( this, tr("FET - exiting"),
00725                tr("Your data file has been modified - do you want to save it?"), QMessageBox::Yes|QMessageBox::No|QMessageBox::Cancel);
00726 
00727               if(res==QMessageBox::Yes){
00728                      bool t=this->fileSave();
00729                      if(!t){
00730                             event->ignore();
00731                      }
00732                      else{
00733                             closeOtherWindows();
00734                             event->accept();
00735                      }
00736               }
00737               else if(res==QMessageBox::No){
00738                      closeOtherWindows();
00739                      event->accept();
00740               }
00741               else{
00742                      assert(res==QMessageBox::Cancel);
00743                      event->ignore();
00744               }
00745        }
00746        else{
00747               closeOtherWindows();
00748               event->accept();
00749        }
00750 }
00751 
00752 FetMainForm::~FetMainForm()
00753 {
00754        QSettings settings(COMPANY, PROGRAM);
00755        settings.setValue(QString("FetMainForm/number-of-recent-files"), recentFiles.count());
00756        settings.remove(QString("FetMainForm/recent-file"));
00757        for(int i=0; i<recentFiles.count(); i++)
00758               settings.setValue(QString("FetMainForm/recent-file/")+CustomFETString::number(i+1), recentFiles.at(i));
00759 
00760        shortcutBasicMenu->clear();
00761        delete shortcutBasicMenu;
00762 
00763        shortcutAdvancedTimeMenu->clear();
00764        delete shortcutAdvancedTimeMenu;
00765 
00766        shortcutDataSpaceMenu->clear();
00767        delete shortcutDataSpaceMenu;
00768 
00769        shortcutDataAdvancedMenu->clear();
00770        delete shortcutDataAdvancedMenu;
00771 }
00772 
00773 void FetMainForm::on_fileExitAction_activated()
00774 {
00775        if(simulation_running){
00776               QMessageBox::information(this, tr("FET information"),
00777                      tr("Allocation in course.\nPlease stop simulation before this."));
00778               return;
00779        }
00780 
00781        close();
00782 }
00783 
00784 QString FetMainForm::strippedName(const QString& fullFileName)
00785 {
00786        return QFileInfo(fullFileName).fileName();
00787 }
00788 
00789 void FetMainForm::setCurrentFile(const QString& fileName)
00790 {
00791        QString currentFile=fileName;
00792        QString shownName=QString("Untitled");
00793        
00794        if(!currentFile.isEmpty()){
00795               shownName=strippedName(currentFile);
00796               recentFiles.removeAll(currentFile);
00797               recentFiles.prepend(currentFile);
00798               if(recentFiles.count()>MAX_RECENT_FILES){
00799                      assert(recentFiles.count()==MAX_RECENT_FILES+1);
00800                      assert(!recentFiles.isEmpty());
00801                      recentFiles.removeLast();
00802               }
00803               updateRecentFileActions();
00804        }
00805        
00806        setWindowTitle(tr("%1[*] - FET", "The title of the main window, %1 is the name of the current file. "
00807         "Please keep the string [*] unmodified (three characters) - it is used to make the difference between modified files and unmodified files.")
00808         .arg(shownName));
00809 }
00810 
00811 void FetMainForm::updateRecentFileActions()
00812 {
00813        QMutableStringListIterator i(recentFiles);
00814        while(i.hasNext()){
00815               if(!QFile::exists(i.next()))
00816                      i.remove();
00817        }
00818        
00819        for(int j=0; j<MAX_RECENT_FILES; j++){
00820               if(j<recentFiles.count()){
00821                      QString text=strippedName(recentFiles[j]);
00822                      recentFileActions[j]->setText(text);
00823                      recentFileActions[j]->setData(recentFiles[j]);
00824                      recentFileActions[j]->setVisible(true);
00825               }
00826               else{
00827                      recentFileActions[j]->setVisible(false);
00828               }
00829        }
00830        
00831        recentSeparatorAction->setVisible(!recentFiles.isEmpty());
00832 }
00833 
00834 void FetMainForm::on_fileClearRecentFilesListAction_activated()
00835 {
00836        if(simulation_running){
00837               QMessageBox::information(this, tr("FET information"),
00838                      tr("Allocation in course.\nPlease stop simulation before this."));
00839               return;
00840        }
00841 
00842        recentFiles.clear();
00843        updateRecentFileActions();
00844 }
00845 
00846 void FetMainForm::on_fileNewAction_activated()
00847 {
00848        if(simulation_running){
00849               QMessageBox::information(this, tr("FET information"),
00850                      tr("Allocation in course.\nPlease stop simulation before this."));
00851               return;
00852        }
00853 
00854        int confirm=0;
00855        
00856        if(gt.rules.modified){
00857               switch( QMessageBox::question(
00858                this,
00859                tr("FET application"),
00860                tr("Your current data file has been modified. Are you sure you want to reset to new empty data?"),
00861                QMessageBox::Yes|QMessageBox::No
00862                ) ){
00863               case QMessageBox::Yes: // Yes
00864                      confirm=1;
00865                      break;
00866               case QMessageBox::No: // No
00867                      confirm=0;
00868                      break;
00869               default:
00870                      assert(0);
00871                      break;
00872               }
00873        }
00874        else
00875               confirm=1;
00876        
00877        if(confirm){
00878               INPUT_FILENAME_XML=QString("");
00879               setCurrentFile(INPUT_FILENAME_XML);
00880        
00881               if(gt.rules.initialized)
00882                      gt.rules.kill();
00883               gt.rules.init();
00884               
00885               gt.rules.modified=true; //to avoid flicker of the main form modified flag
00886 
00887               bool tmp=gt.rules.addTimeConstraint(new ConstraintBasicCompulsoryTime(100));
00888               assert(tmp);
00889               tmp=gt.rules.addSpaceConstraint(new ConstraintBasicCompulsorySpace(100));
00890               assert(tmp);
00891               
00892               gt.rules.modified=true; //force update of the modified flag of the main window
00893               setRulesUnmodifiedAndOtherThings(&gt.rules);
00894 
00895               students_schedule_ready=false;
00896               teachers_schedule_ready=false;
00897               rooms_schedule_ready=false;
00898 
00899               LockUnlock::computeLockedUnlockedActivitiesTimeSpace();
00900               LockUnlock::increaseCommunicationSpinBox();
00901 
00902               statusBar()->showMessage(tr("New file generated"), STATUS_BAR_MILLISECONDS);
00903        }
00904 }
00905 
00906 void FetMainForm::openRecentFile()
00907 {
00908        QAction* action=qobject_cast<QAction*>(sender());
00909        if(action)
00910               openFile(action->data().toString());
00911 }
00912 
00913 void FetMainForm::on_fileOpenAction_activated()
00914 {
00915        openFile(QString());
00916 }
00917 
00918 void FetMainForm::openFile(const QString& fileName)
00919 {
00920        if(simulation_running){
00921               QMessageBox::information(this, tr("FET information"),
00922                      tr("Allocation in course.\nPlease stop simulation before this."));
00923               return;
00924        }
00925 
00926        int confirm=0;
00927        
00928        if(gt.rules.modified){
00929               switch( QMessageBox::question(
00930                this,
00931                tr("FET application"),
00932                tr("Your current data file has been modified. Are you sure you want to open another data file?"),
00933                QMessageBox::Yes|QMessageBox::No
00934                ) ){
00935               case QMessageBox::Yes: // Yes
00936                      confirm=1;
00937                      break;
00938               case QMessageBox::No: // No
00939                      confirm=0;
00940                      break;
00941               default:
00942                      assert(0);
00943                      break;
00944               }
00945        }
00946        else
00947               confirm=1;
00948        
00949        if(confirm){
00950               QString s=fileName;
00951               
00952               if(s.isNull()){
00953                      s = QFileDialog::getOpenFileName(this, tr("Choose a file to open"),
00954                       WORKING_DIRECTORY, 
00955                       tr("FET XML files", "Instructions for translators: FET XML is a type of file format (using text mode). "
00956                       "So this field means files in the FET XML format")+" (*.fet)"+";;"+tr("All files")+" (*)");
00957 
00958                      if(s.isNull())
00959                             return;
00960               }
00961 
00962               int tmp2=s.lastIndexOf(FILE_SEP);
00963               QString s2=s.right(s.length()-tmp2-1);
00964                      
00965               if(s2.indexOf("\"") >= 0){
00966                      QMessageBox::warning(this, tr("FET information"), 
00967                       tr("Please do not use quotation marks \" in filename, the html css code does not work."
00968                        " File was not loaded. Please rename it, removing not allowed characters and open it after that with FET."));
00969                      return;
00970               }             
00971               if(s2.indexOf(";") >= 0){
00972                      QMessageBox::warning(this, tr("FET information"), 
00973                       tr("Please do not use semicolon ; in filename, the html css code does not work."
00974                        " File was not loaded. Please rename it, removing not allowed characters and open it after that with FET."));
00975                      return;
00976               }
00977               if(s2.indexOf("#") >= 0){
00978                      QMessageBox::warning(this, tr("FET information"), 
00979                       tr("Please do not use # in filename, the html css code does not work."
00980                        " File was not loaded. Please rename it, removing not allowed characters and open it after that with FET."));
00981                      return;
00982               }
00983               /*if(s2.indexOf("(") >= 0 || s2.indexOf(")")>=0){
00984                      QMessageBox::information(this, tr("FET information"), tr("Please do not use parentheses () in filename, the html css code does not work"));
00985                      return;
00986               }*/
00987               else{
00988                      //QCursor orig=this->cursor();
00989                      //this->setCursor(Qt::WaitCursor);
00990                      statusBar()->showMessage(tr("Loading...", "This is a message in the status bar, that we are loading the file"), 0);
00991                      pqapplication->processEvents();
00992               
00993                      bool before=gt.rules.modified;
00994                      gt.rules.modified=true; //to avoid flicker of the main form modified flag
00995 
00996                      if(gt.rules.read(this, s)){
00997                             students_schedule_ready=false;
00998                             teachers_schedule_ready=false;
00999                             rooms_schedule_ready=false;
01000 
01001                             INPUT_FILENAME_XML = s;
01002                             
01003                             LockUnlock::computeLockedUnlockedActivitiesTimeSpace();
01004                             LockUnlock::increaseCommunicationSpinBox();
01005 
01006                             statusBar()->showMessage(tr("File opened"), STATUS_BAR_MILLISECONDS);
01007                             
01008                             gt.rules.modified=true; //force update of the modified flag of the main window
01009                             setRulesUnmodifiedAndOtherThings(&gt.rules);
01010                             
01011                             setCurrentFile(INPUT_FILENAME_XML);
01012                      }
01013                      else{
01014                             gt.rules.modified=before;
01015                      
01016                             statusBar()->showMessage("", STATUS_BAR_MILLISECONDS);
01017                             
01018                             //QMessageBox::information(this, tr("FET information"), tr("Invalid file"));
01019 
01020                             setCurrentFile(INPUT_FILENAME_XML);
01021                      }
01022                      
01023                      //this->setCursor(orig);
01024               }
01025               //get the directory
01026               int tmp=s.lastIndexOf(FILE_SEP);
01027               WORKING_DIRECTORY=s.left(tmp);
01028        }
01029 }
01030 
01031 bool FetMainForm::fileSaveAs()
01032 {
01033        QString predefFileName=INPUT_FILENAME_XML;
01034        if(predefFileName.isEmpty())
01035               predefFileName=WORKING_DIRECTORY+FILE_SEP+QString("untitled.fet");
01036 
01037        QString s = QFileDialog::getSaveFileName(this, tr("Choose a filename to save under"),
01038               predefFileName, tr("FET XML files", "Instructions for translators: FET XML is a type of file format (using text mode). "
01039               "So this field means files in the FET XML format")+" (*.fet)"+";;"+tr("All files")+" (*)",
01040               0, QFileDialog::DontConfirmOverwrite);
01041        if(s==QString())
01042               return false;
01043 
01044        int tmp2=s.lastIndexOf(FILE_SEP);
01045        QString s2=s.right(s.length()-tmp2-1);
01046                      
01047        if(s2.indexOf("\"") >= 0){
01048               QMessageBox::warning(this, tr("FET information"), tr("Please do not use quotation marks \" in filename, the html css code does not work"));
01049               return false;
01050        }
01051        if(s2.indexOf(";") >= 0){
01052               QMessageBox::warning(this, tr("FET information"), tr("Please do not use semicolon ; in filename, the html css code does not work"));
01053               return false;
01054        }
01055        if(s2.indexOf("#") >= 0){
01056               QMessageBox::warning(this, tr("FET information"), tr("Please do not use # in filename, the html css code does not work"));
01057               return false;
01058        }
01059        
01060        if(s.right(4)!=".fet")
01061               s+=".fet";
01062 
01063        int tmp=s.lastIndexOf(FILE_SEP);
01064        WORKING_DIRECTORY=s.left(tmp);
01065 
01066        if(QFile::exists(s))
01067               if(QMessageBox::warning( this, tr("FET"),
01068                tr("File %1 exists - are you sure you want to overwrite it?").arg(s),
01069                QMessageBox::Yes|QMessageBox::No) == QMessageBox::No)
01070                      return false;
01071                      
01072        INPUT_FILENAME_XML = s;
01073        gt.rules.write(this, INPUT_FILENAME_XML);
01074        
01075        gt.rules.modified=true; //force update of the modified flag of the main window
01076        setRulesUnmodifiedAndOtherThings(&gt.rules);
01077        
01078        setCurrentFile(INPUT_FILENAME_XML);
01079        
01080        statusBar()->showMessage(tr("File saved"), STATUS_BAR_MILLISECONDS);
01081        
01082        return true;
01083 }
01084 
01085 void FetMainForm::on_fileSaveAsAction_activated()
01086 {
01087        fileSaveAs();
01088 }
01089 
01090 // Start of code contributed by Volker Dirr
01091 void FetMainForm::on_fileImportCSVRoomsBuildingsAction_activated(){
01092        if(simulation_running){
01093               QMessageBox::information(this, tr("FET information"),
01094                      tr("Allocation in course.\nPlease stop simulation before this."));
01095               return;
01096        }
01097        Import::importCSVRoomsAndBuildings(this);
01098 }
01099 
01100 void FetMainForm::on_fileImportCSVSubjectsAction_activated(){
01101        if(simulation_running){
01102               QMessageBox::information(this, tr("FET information"),
01103                      tr("Allocation in course.\nPlease stop simulation before this."));
01104               return;
01105        }
01106        Import::importCSVSubjects(this);
01107 }
01108 
01109 void FetMainForm::on_fileImportCSVTeachersAction_activated(){
01110        if(simulation_running){
01111               QMessageBox::information(this, tr("FET information"),
01112                      tr("Allocation in course.\nPlease stop simulation before this."));
01113               return;
01114        }
01115        Import::importCSVTeachers(this);
01116 }
01117 
01118 void FetMainForm::on_fileImportCSVActivitiesAction_activated(){
01119        if(simulation_running){
01120               QMessageBox::information(this, tr("FET information"),
01121                      tr("Allocation in course.\nPlease stop simulation before this."));
01122               return;
01123        }
01124        Import::importCSVActivities(this);
01125 
01126        //TODO: if the import takes care of locked activities, then we need
01127        //to do:
01128        //LockUnlock::computeLockedUnlockedActivitiesTimeSpace();
01129        //LockUnlock::increaseCommunicationSpinBox();
01130        //after the importing
01131 }
01132 
01133 void FetMainForm::on_fileImportCSVActivityTagsAction_activated(){
01134        if(simulation_running){
01135               QMessageBox::information(this, tr("FET information"),
01136                      tr("Allocation in course.\nPlease stop simulation before this."));
01137               return;
01138        }
01139        Import::importCSVActivityTags(this);
01140 }
01141 
01142 void FetMainForm::on_fileImportCSVYearsGroupsSubgroupsAction_activated(){
01143        if(simulation_running){
01144               QMessageBox::information(this, tr("FET information"),
01145                      tr("Allocation in course.\nPlease stop simulation before this."));
01146               return;
01147        }
01148        Import::importCSVStudents(this);
01149 }
01150 
01151 void FetMainForm::on_fileExportCSVAction_activated(){
01152        if(simulation_running){
01153               QMessageBox::information(this, tr("FET information"),
01154                      tr("Allocation in course.\nPlease stop simulation before this."));
01155               return;
01156        }
01157        Export::exportCSV(this);
01158 }
01159 // End of code contributed by Volker Dirr
01160 
01161 void FetMainForm::on_timetableSaveTimetableAsAction_activated()
01162 {
01163        if(!students_schedule_ready || !teachers_schedule_ready || !rooms_schedule_ready){
01164               QMessageBox::warning(this, tr("FET - Warning"), tr("You have not yet generated a timetable - please generate firstly"));
01165               return;
01166        }
01167 
01168        Solution* tc=&best_solution;
01169        
01170        for(int ai=0; ai<gt.rules.nInternalActivities; ai++){
01171               //Activity* act=&gt.rules.internalActivitiesList[ai];
01172               int time=tc->times[ai];
01173               if(time==UNALLOCATED_TIME){
01174                      QMessageBox::warning(this, tr("FET - Warning"), tr("It seems that you have an incomplete timetable."
01175                       " Saving of timetable does not work for incomplete timetables. Please generate a complete timetable"));
01176                       //.arg(act->id));
01177                      return;       
01178               }
01179               
01180               int ri=tc->rooms[ai];
01181               if(ri==UNALLOCATED_SPACE){
01182                      QMessageBox::warning(this, tr("FET - Warning"), tr("It seems that you have an incomplete timetable."
01183                       " Saving of timetable does not work for incomplete timetables. Please generate a complete timetable"));
01184                       //.arg(act->id));
01185                      return;       
01186               }
01187        }
01188 
01189        bool ok_to_continue;
01190        SaveTimetableConfirmationForm* pc_form=NULL;
01191        if(CONFIRM_SAVE_TIMETABLE){
01192               int confirm;
01193               
01194               pc_form=new SaveTimetableConfirmationForm(this);
01195               setParentAndOtherThings(pc_form, this);
01196               confirm=pc_form->exec();
01197               
01198               if(confirm==QDialog::Accepted){
01199                      if(pc_form->dontShowAgain)
01200                             settingsConfirmSaveTimetableAction->setChecked(false);
01201                      
01202                      ok_to_continue=true;
01203               }
01204               else
01205                      ok_to_continue=false;
01206        }
01207        else
01208               ok_to_continue=true;
01209               
01210        if(ok_to_continue){
01211               QWidget* parent=pc_form;
01212               if(parent==NULL)
01213                      parent=this;
01214 
01215               QString s;
01216 
01217               for(;;){
01218                      s = QFileDialog::getSaveFileName(parent, tr("Choose a filename for data and timetable"),
01219                             INPUT_FILENAME_XML, tr("FET XML files", "Instructions for translators: FET XML is a type of file format (using text mode). "
01220                             "So this field means files in the FET XML format")+" (*.fet)"+";;"+tr("All files")+" (*)",
01221                             0, QFileDialog::DontConfirmOverwrite);
01222                      if(s==QString())
01223                             return;
01224 
01225                      int tmp2=s.lastIndexOf(FILE_SEP);
01226                      QString s2=s.right(s.length()-tmp2-1);
01227                             
01228                      if(s2.indexOf("\"") >= 0){
01229                             QMessageBox::warning(parent, tr("FET information"), tr("Please do not use quotation marks \" in filename, the html css code does not work"));
01230                             return;
01231                      }
01232                      if(s2.indexOf(";") >= 0){
01233                             QMessageBox::warning(parent, tr("FET information"), tr("Please do not use semicolon ; in filename, the html css code does not work"));
01234                             return;
01235                      }
01236                      if(s2.indexOf("#") >= 0){
01237                             QMessageBox::warning(parent, tr("FET information"), tr("Please do not use # in filename, the html css code does not work"));
01238                             return;
01239                      }
01240                      
01241                      if(s.right(4)!=".fet")
01242                             s+=".fet";
01243 
01244                      int tmp=s.lastIndexOf(FILE_SEP);
01245                      WORKING_DIRECTORY=s.left(tmp);
01246 
01247                      if(QFile::exists(s)){
01248                             QString t=tr("File exists");
01249                             t+="\n\n";
01250                             t+=tr("For safety (so you don't lose work), it is not allowed to overwrite an existing file with"
01251                                    " locking and saving a current data+timetable");
01252                             t+="\n\n";
01253                             t+=tr("Please choose a non-existing name");
01254               
01255                             QMessageBox::warning( parent, tr("FET warning"), t);
01256                      }
01257                      else
01258                             break;
01259               }
01260                      
01261               rules2.initialized=true;
01262               
01263               rules2.institutionName=gt.rules.institutionName;
01264               rules2.comments=gt.rules.comments;
01265               
01266               rules2.nHoursPerDay=gt.rules.nHoursPerDay;
01267               for(int i=0; i<gt.rules.nHoursPerDay; i++)
01268                      rules2.hoursOfTheDay[i]=gt.rules.hoursOfTheDay[i];
01269 
01270               rules2.nDaysPerWeek=gt.rules.nDaysPerWeek;
01271               for(int i=0; i<gt.rules.nDaysPerWeek; i++)
01272                      rules2.daysOfTheWeek[i]=gt.rules.daysOfTheWeek[i];
01273                      
01274               rules2.yearsList=gt.rules.yearsList;
01275               
01276               rules2.teachersList=gt.rules.teachersList;
01277               
01278               rules2.subjectsList=gt.rules.subjectsList;
01279               
01280               rules2.activityTagsList=gt.rules.activityTagsList;
01281 
01282               rules2.activitiesList=gt.rules.activitiesList;
01283 
01284               rules2.buildingsList=gt.rules.buildingsList;
01285 
01286               rules2.roomsList=gt.rules.roomsList;
01287 
01288               rules2.timeConstraintsList=gt.rules.timeConstraintsList;
01289               
01290               rules2.spaceConstraintsList=gt.rules.spaceConstraintsList;
01291 
01292               //add locking constraints
01293               TimeConstraintsList lockTimeConstraintsList;
01294               SpaceConstraintsList lockSpaceConstraintsList;
01295 
01296               //bool report=true;
01297               
01298               int addedTime=0, duplicatesTime=0;
01299               int addedSpace=0, duplicatesSpace=0;
01300               
01301               QString constraintsString=QString("");
01302 
01303               //lock selected activities
01304               for(int ai=0; ai<gt.rules.nInternalActivities; ai++){
01305                      Activity* act=&gt.rules.internalActivitiesList[ai];
01306                      int time=tc->times[ai];
01307                      if(time>=0 && time<gt.rules.nDaysPerWeek*gt.rules.nHoursPerDay){
01308                             int hour=time/gt.rules.nDaysPerWeek;
01309                             int day=time%gt.rules.nDaysPerWeek;
01310 
01311                             ConstraintActivityPreferredStartingTime* ctr=new ConstraintActivityPreferredStartingTime(100.0, act->id, day, hour, false); //permanently locked is false
01312                             bool t=rules2.addTimeConstraint(ctr);
01313                                                  
01314                             if(t){
01315                                    addedTime++;
01316                                    lockTimeConstraintsList.append(ctr);
01317                             }
01318                             else
01319                                    duplicatesTime++;
01320 
01321                             QString s;
01322 
01323                             if(t)
01324                                    s=tr("Added to the saved file:", "It refers to a constraint")+QString("\n")+ctr->getDetailedDescription(gt.rules);
01325                             else{
01326                                    s=tr("NOT added to the saved file (already existing):", "It refers to a constraint")+QString("\n")+ctr->getDetailedDescription(gt.rules);
01327                                    delete ctr;
01328                             }
01329                             
01330                             constraintsString+=QString("\n");
01331                             constraintsString+=s;
01332                      }
01333                                           
01334                      int ri=tc->rooms[ai];
01335                      if(ri!=UNALLOCATED_SPACE && ri!=UNSPECIFIED_ROOM && ri>=0 && ri<gt.rules.nInternalRooms){
01336                             ConstraintActivityPreferredRoom* ctr=new ConstraintActivityPreferredRoom(100, act->id, (gt.rules.internalRoomsList[ri])->name, false); //false means not permanently locked
01337                             bool t=rules2.addSpaceConstraint(ctr);
01338 
01339                             QString s;
01340                                                  
01341                             if(t){
01342                                    addedSpace++;
01343                                    lockSpaceConstraintsList.append(ctr);
01344                             }
01345                             else
01346                                    duplicatesSpace++;
01347 
01348                             if(t)
01349                                    s=tr("Added to the saved file:", "It refers to a constraint")+QString("\n")+ctr->getDetailedDescription(gt.rules);
01350                             else{
01351                                    s=tr("NOT added to the saved file (already existing):", "It refers to a constraint")+QString("\n")+ctr->getDetailedDescription(gt.rules);
01352                                    delete ctr;
01353                             }
01354                             
01355                             constraintsString+=QString("\n");
01356                             constraintsString+=s;
01357                      }
01358               }
01359 
01360               LongTextMessageBox::largeInformation(parent, tr("FET information"), tr("Added %1 locking time constraints and %2 locking space constraints to saved file,"
01361               " ignored %3 activities which were already fixed in time and %4 activities which were already fixed in space.").arg(addedTime).arg(addedSpace).arg(duplicatesTime).arg(duplicatesSpace)
01362               +QString("\n\n")+tr("Detailed information about each locking constraint which was added or not (if already existing) to the saved file:")+QString("\n")+constraintsString
01363               +QString("\n")+tr("Your current data file remained untouched (no locking constraints were added), so you can save it also, or generate different timetables."));
01364                      
01365               bool result=rules2.write(parent, s);
01366               
01367               Q_UNUSED(result);
01368               
01369               while(!lockTimeConstraintsList.isEmpty())
01370                      delete lockTimeConstraintsList.takeFirst();
01371               while(!lockSpaceConstraintsList.isEmpty())
01372                      delete lockSpaceConstraintsList.takeFirst();
01373 
01374               rules2.nHoursPerDay=0;
01375               rules2.nDaysPerWeek=0;
01376 
01377               rules2.yearsList.clear();
01378               
01379               rules2.teachersList.clear();
01380               
01381               rules2.subjectsList.clear();
01382               
01383               rules2.activityTagsList.clear();
01384 
01385               rules2.activitiesList.clear();
01386 
01387               rules2.buildingsList.clear();
01388 
01389               rules2.roomsList.clear();
01390 
01391               rules2.timeConstraintsList.clear();
01392               
01393               rules2.spaceConstraintsList.clear();
01394        }
01395        
01396        if(pc_form!=NULL)
01397               delete pc_form;
01398 }
01399 
01400 bool FetMainForm::fileSave()
01401 {
01402        if(INPUT_FILENAME_XML.isEmpty())
01403               return fileSaveAs();
01404        else{
01405               gt.rules.write(this, INPUT_FILENAME_XML);
01406 
01407               gt.rules.modified=true; //force update of the modified flag of the main window
01408               setRulesUnmodifiedAndOtherThings(&gt.rules);
01409               
01410               setCurrentFile(INPUT_FILENAME_XML);
01411 
01412               statusBar()->showMessage(tr("File saved"), STATUS_BAR_MILLISECONDS);
01413               return true;
01414        }
01415 }
01416 
01417 void FetMainForm::on_fileSaveAction_activated()
01418 {
01419        fileSave();
01420 }
01421 
01422 void FetMainForm::on_dataInstitutionNameAction_activated()
01423 {
01424        if(simulation_running){
01425               QMessageBox::information(this, tr("FET information"),
01426                      tr("Allocation in course.\nPlease stop simulation before this."));
01427               return;
01428        }
01429 
01430        InstitutionNameForm form(this);
01431        setParentAndOtherThings(&form, this);
01432        form.exec();
01433 }
01434 
01435 void FetMainForm::on_dataCommentsAction_activated()
01436 {
01437        if(simulation_running){
01438               QMessageBox::information(this, tr("FET information"),
01439                      tr("Allocation in course.\nPlease stop simulation before this."));
01440               return;
01441        }
01442 
01443        CommentsForm form(this);
01444        setParentAndOtherThings(&form, this);
01445        form.exec();
01446 }
01447 
01448 void FetMainForm::on_dataDaysAction_activated()
01449 {
01450        if(simulation_running){
01451               QMessageBox::information(this, tr("FET information"),
01452                      tr("Allocation in course.\nPlease stop simulation before this."));
01453               return;
01454        }
01455 
01456        DaysForm form(this);
01457        setParentAndOtherThings(&form, this);
01458        form.exec();
01459 }
01460 
01461 void FetMainForm::on_dataHoursAction_activated()
01462 {
01463        if(simulation_running){
01464               QMessageBox::information(this, tr("FET information"),
01465                      tr("Allocation in course.\nPlease stop simulation before this."));
01466               return;
01467        }
01468 
01469        HoursForm form(this);
01470        setParentAndOtherThings(&form, this);
01471        form.exec();
01472 }
01473 
01474 void FetMainForm::on_dataTeachersAction_activated()
01475 {
01476        if(simulation_running){
01477               QMessageBox::information(this, tr("FET information"),
01478                      tr("Allocation in course.\nPlease stop simulation before this."));
01479               return;
01480        }
01481 
01482        TeachersForm form(this);
01483        setParentAndOtherThings(&form, this);
01484        form.exec();
01485 }
01486 
01487 void FetMainForm::on_dataTeachersStatisticsAction_activated()
01488 {
01489        TeachersStatisticsForm form(this);
01490        setParentAndOtherThings(&form, this);
01491        form.exec();
01492 }
01493 
01494 void FetMainForm::on_dataSubjectsAction_activated()
01495 {
01496        if(simulation_running){
01497               QMessageBox::information(this, tr("FET information"),
01498                      tr("Allocation in course.\nPlease stop simulation before this."));
01499               return;
01500        }
01501 
01502        SubjectsForm form(this);
01503        setParentAndOtherThings(&form, this);
01504        form.exec();
01505 }
01506 
01507 void FetMainForm::on_dataSubjectsStatisticsAction_activated()
01508 {
01509        SubjectsStatisticsForm form(this);
01510        setParentAndOtherThings(&form, this);
01511        form.exec();
01512 }
01513 
01514 void FetMainForm::on_dataActivityTagsAction_activated()
01515 {
01516        if(simulation_running){
01517               QMessageBox::information(this, tr("FET information"),
01518                      tr("Allocation in course.\nPlease stop simulation before this."));
01519               return;
01520        }
01521 
01522        ActivityTagsForm form(this);
01523        setParentAndOtherThings(&form, this);
01524        form.exec();
01525 }
01526 
01527 void FetMainForm::on_dataYearsAction_activated()
01528 {
01529        if(simulation_running){
01530               QMessageBox::information(this, tr("FET information"),
01531                      tr("Allocation in course.\nPlease stop simulation before this."));
01532               return;
01533        }
01534 
01535        YearsForm form(this);
01536        setParentAndOtherThings(&form, this);
01537        form.exec();
01538 }
01539 
01540 void FetMainForm::on_dataGroupsAction_activated()
01541 {
01542        if(simulation_running){
01543               QMessageBox::information(this, tr("FET information"),
01544                      tr("Allocation in course.\nPlease stop simulation before this."));
01545               return;
01546        }
01547 
01548        GroupsForm form(this);
01549        setParentAndOtherThings(&form, this);
01550        form.exec();
01551 }
01552 
01553 void FetMainForm::on_dataSubgroupsAction_activated()
01554 {
01555        if(simulation_running){
01556               QMessageBox::information(this, tr("FET information"),
01557                      tr("Allocation in course.\nPlease stop simulation before this."));
01558               return;
01559        }
01560 
01561        SubgroupsForm form(this);
01562        setParentAndOtherThings(&form, this);
01563        form.exec();
01564 }
01565 
01566 void FetMainForm::on_dataStudentsStatisticsAction_activated()
01567 {
01568        StudentsStatisticsForm form(this);
01569        setParentAndOtherThings(&form, this);
01570        form.exec();
01571 }
01572 
01573 void FetMainForm::on_dataActivitiesRoomsStatisticsAction_activated()
01574 {
01575        ActivitiesRoomsStatisticsForm form(this);
01576        setParentAndOtherThings(&form, this);
01577        form.exec();
01578 }
01579 
01580 void FetMainForm::on_helpSettingsAction_activated()
01581 {
01582        QString s;
01583        
01584        s+=tr("Probably some settings which are more difficult to understand are these ones:");
01585        s+="\n\n";
01586        s+=tr("Option 'Divide html timetables with time-axis by days':"
01587        " This means simply that the html timetables of type 'time horizontal' or 'time vertical' (see the generated html timetables)"
01588        " should be or not divided according to the days.");
01589        s+=" ";
01590        s+=tr("If the 'time horizontal' or 'time vertical' html timetables are too large for you, then you might need to select this option");
01591        
01592        s+="\n\n";
01593        s+=tr("Option 'Print activities with same starting time in timetables': selecting it means that the html timetables will contain for"
01594         " each slot all the activities which have the same starting time (fact specified by your constraints) as the activity(ies) which are normally shown in this slot."
01595         " If you don't use constraints activities same starting time, this option has no effect for you.");
01596         
01597        s+="\n\n";
01598        s+=tr("Seed of random number generator: please read the help in the dialog of this option");
01599        
01600        s+="\n\n";
01601        s+=tr("Interface - use colors: the places with colors in FET interface are in:");
01602        s+="\n";
01603        s+=" -";
01604        s+=tr("add/modify constraints break, not available, preferred starting times or time slots (the table cells will have green or red colors).");
01605        s+="\n";
01606        s+=" -";
01607        s+=tr("activities and subactivities dialogs, the inactive activities will have a distinctive background color");
01608        s+="\n";
01609        s+=" -";
01610        s+=tr("all time constraints and all space constraints dialogs, the inactive constraints will have a distinctive background color");
01611        
01612        s+="\n\n";
01613        s+=tr("Enable activity tag max hours daily:");
01614        s+="\n";
01615        s+=tr("This will enable the menu for 4 constraints: teacher(s) or students (set) activity tag max hours daily. These 4 constraints are good, but not perfect and"
01616               " may bring slow down of generation or impossible timetables if used unproperly. Select only if you know what you're doing.");
01617        s+="\n\n";
01618        s+=tr("Enable students max gaps per day:");
01619        s+="\n";
01620        s+=tr("This will enable the menu for 2 constraints: students (set) max gaps per day. These 2 constraints are good, but not perfect and"
01621               " may bring slow down of generation or impossible timetables if used unproperly. Select only if you know what you're doing.");
01622               
01623        s+="\n\n";
01624        s+=tr("Warn if using not perfect constraints:", "this is a warning if user uses not perfect constraints");
01625        s+="\n";
01626        s+=tr("If you use a not perfect constraint (activity tag max hours daily or students max gaps per day), you'll get a warning before generating"
01627               ". Uncheck this option to get rid of that warning (it is recommended to keep the warning).");
01628        
01629        s+="\n\n";
01630        s+=tr("Enable students min hours daily with empty days:");
01631        s+="\n";
01632        s+=tr("This will enable you to modify the students min hours daily constraints, to allow empty days. It is IMPERATIVE (for performance reasons) to allow empty days for students min hours daily only"
01633               " if your institution allows empty days for students and if a solution with empty days is possible. Select only if you know what you're doing.");
01634               
01635        s+="\n\n";
01636        s+=tr("Warn if using students min hours daily with empty days:", "this is a warning if user has constraints min hours daily for students with allowed empty days");
01637        s+="\n";
01638        s+=tr("If you use constraints students min hours daily with allowed empty days, you'll get a warning before generating"
01639               ". Uncheck this option to get rid of that warning (it is recommended to keep the warning).");
01640               
01641        s+="\n\n";
01642        
01643        s+=tr("Confirmations: unselect the corresponding check boxes if you want to skip introduction and confirmation to various advanced dialogs.");
01644        
01645        LongTextMessageBox::largeInformation(this, tr("FET information"), s);
01646 }
01647 
01648 void FetMainForm::on_dataHelpOnStatisticsAction_activated()
01649 {
01650        QString s;
01651        
01652        s+=tr("You will find in the statistics only active activities count. The inactive ones are not counted.");
01653        
01654        s+="\n\n";
01655        
01656        s+=tr("Statistics for students might be the most difficult to understand."
01657         " If you are using divisions of years: probably the most relevant statistics"
01658         " are the ones for each subgroup (so you may check only subgroups check box)."
01659         " You may see more hours for the years or groups, but these are not significant, please ignore them,"
01660         " because each year or group will count also activities of all contained subgroups."
01661         "\n\n"
01662         "Each subgroup should have a number of hours per week close to the average of"
01663         " all subgroups and close to the normal number of working hours of each students set."
01664         " If a subgroup has a much lower value, maybe you used incorrectly"
01665         " the years/groups/subgroups for activities."
01666         "\n\n"
01667         "Please read FAQ for detailed description"
01668         " on how divisions work. The key is that the subgroups are independent and represent the smallest unit of students."
01669         " Each subgroup receives the activities of the parent year and parent group and of itself."
01670         "\n\n"
01671         "Having a subgroup with too little working hours per week means that you inputted activities in a wrong manner,"
01672         " and also that some constraints like no gaps, early or min hours daily for this subgroup"
01673         " are interpreted in a wrong manner (if subgroup has only 2 activities, then these must"
01674         " be placed in the first hours, which is too hard and wrong)."
01675         );
01676        
01677        s+="\n\n";
01678        s+=tr("Students' statistics form contains a check box named '%1'"
01679         ". This has effect only if you have overlapping groups/years, and means that FET will show the complete tree structure"
01680         ", even if that means that some subgroups/groups will appear twice or more in the table, with the same information."
01681         " For instance, if you have year Y1, groups G1 and G2, subgroups S1, S2, S3, with structure: Y1 (G1 (S1, S2), G2 (S1, S3)),"
01682         " S1 will appear twice in the table").arg(tr("Show duplicates"));
01683 
01684        s+="\n\n";
01685        s+=tr("Activities rooms statistics: this menu will show the activities which may be scheduled in an unspecified room,"
01686         " if they are referred to by space constraints with weight under 100.0%, and the activities which will certainly be scheduled in an"
01687         " unspecified room, if they are not referred to by any space constraints. Remember that home rooms constraints are effective only"
01688         " on activities which have only the exact specified teacher or students set (activities with more teachers or students"
01689         " sets are not affected by home rooms constraints, you need to have preferred rooms constraints for such activities to ensure"
01690         " they will not end up in an unspecified room).");
01691        
01692        LongTextMessageBox::largeInformation(this, tr("FET - information about statistics"), s);
01693 }
01694 
01695 void FetMainForm::on_dataActivitiesAction_activated()
01696 {
01697        if(simulation_running){
01698               QMessageBox::information(this, tr("FET information"),
01699                      tr("Allocation in course.\nPlease stop simulation before this."));
01700               return;
01701        }
01702 
01703        ActivitiesForm form(this, "", "", "", "");
01704        setParentAndOtherThings(&form, this);
01705        form.exec();
01706 }
01707 
01708 void FetMainForm::on_dataSubactivitiesAction_activated()
01709 {
01710        if(simulation_running){
01711               QMessageBox::information(this, tr("FET information"),
01712                      tr("Allocation in course.\nPlease stop simulation before this."));
01713               return;
01714        }
01715 
01716        SubactivitiesForm form(this, "", "", "", "");
01717        setParentAndOtherThings(&form, this);
01718        form.exec();
01719 }
01720 
01721 void FetMainForm::on_dataRoomsAction_activated()
01722 {
01723        if(simulation_running){
01724               QMessageBox::information(this, tr("FET information"),
01725                      tr("Allocation in course.\nPlease stop simulation before this."));
01726               return;
01727        }
01728 
01729        RoomsForm form(this);
01730        setParentAndOtherThings(&form, this);
01731        form.exec();
01732 }
01733 
01734 void FetMainForm::on_dataBuildingsAction_activated()
01735 {
01736        if(simulation_running){
01737               QMessageBox::information(this, tr("FET information"),
01738                      tr("Allocation in course.\nPlease stop simulation before this."));
01739               return;
01740        }
01741 
01742        BuildingsForm form(this);
01743        setParentAndOtherThings(&form, this);
01744        form.exec();
01745 }
01746 
01747 void FetMainForm::on_dataAllTimeConstraintsAction_activated()
01748 {
01749        if(simulation_running){
01750               QMessageBox::information(this, tr("FET information"),
01751                      tr("Allocation in course.\nPlease stop simulation before this."));
01752               return;
01753        }
01754 
01755        AllTimeConstraintsForm form(this);
01756        setParentAndOtherThings(&form, this);
01757        form.exec();
01758 }
01759 
01760 void FetMainForm::on_dataAllSpaceConstraintsAction_activated()
01761 {
01762        if(simulation_running){
01763               QMessageBox::information(this, tr("FET information"),
01764                      tr("Allocation in course.\nPlease stop simulation before this."));
01765               return;
01766        }
01767 
01768        AllSpaceConstraintsForm form(this);
01769        setParentAndOtherThings(&form, this);
01770        form.exec();
01771 }
01772 
01773 void FetMainForm::on_dataTimeConstraintsTwoActivitiesConsecutiveAction_activated()
01774 {
01775        if(simulation_running){
01776               QMessageBox::information(this, tr("FET information"),
01777                      tr("Allocation in course.\nPlease stop simulation before this."));
01778               return;
01779        }
01780 
01781        ConstraintTwoActivitiesConsecutiveForm form(this);
01782        setParentAndOtherThings(&form, this);
01783        form.exec();
01784 }
01785 
01786 void FetMainForm::on_dataTimeConstraintsTwoActivitiesGroupedAction_activated()
01787 {
01788        if(simulation_running){
01789               QMessageBox::information(this, tr("FET information"),
01790                      tr("Allocation in course.\nPlease stop simulation before this."));
01791               return;
01792        }
01793 
01794        ConstraintTwoActivitiesGroupedForm form(this);
01795        setParentAndOtherThings(&form, this);
01796        form.exec();
01797 }
01798 
01799 void FetMainForm::on_dataTimeConstraintsThreeActivitiesGroupedAction_activated()
01800 {
01801        if(simulation_running){
01802               QMessageBox::information(this, tr("FET information"),
01803                      tr("Allocation in course.\nPlease stop simulation before this."));
01804               return;
01805        }
01806 
01807        ConstraintThreeActivitiesGroupedForm form(this);
01808        setParentAndOtherThings(&form, this);
01809        form.exec();
01810 }
01811 
01812 void FetMainForm::on_dataTimeConstraintsTwoActivitiesOrderedAction_activated()
01813 {
01814        if(simulation_running){
01815               QMessageBox::information(this, tr("FET information"),
01816                      tr("Allocation in course.\nPlease stop simulation before this."));
01817               return;
01818        }
01819 
01820        ConstraintTwoActivitiesOrderedForm form(this);
01821        setParentAndOtherThings(&form, this);
01822        form.exec();
01823 }
01824 
01825 void FetMainForm::on_dataTimeConstraintsActivitiesPreferredTimeSlotsAction_activated()
01826 {
01827        if(simulation_running){
01828               QMessageBox::information(this, tr("FET information"),
01829                      tr("Allocation in course.\nPlease stop simulation before this."));
01830               return;
01831        }
01832 
01833        ConstraintActivitiesPreferredTimeSlotsForm form(this);
01834        setParentAndOtherThings(&form, this);
01835        form.exec();
01836 }
01837 
01838 void FetMainForm::on_dataTimeConstraintsActivitiesPreferredStartingTimesAction_activated()
01839 {
01840        if(simulation_running){
01841               QMessageBox::information(this, tr("FET information"),
01842                      tr("Allocation in course.\nPlease stop simulation before this."));
01843               return;
01844        }
01845 
01846        ConstraintActivitiesPreferredStartingTimesForm form(this);
01847        setParentAndOtherThings(&form, this);
01848        form.exec();
01849 }
01850 
01851 void FetMainForm::on_dataTimeConstraintsSubactivitiesPreferredTimeSlotsAction_activated()
01852 {
01853        if(simulation_running){
01854               QMessageBox::information(this, tr("FET information"),
01855                      tr("Allocation in course.\nPlease stop simulation before this."));
01856               return;
01857        }
01858 
01859        ConstraintSubactivitiesPreferredTimeSlotsForm form(this);
01860        setParentAndOtherThings(&form, this);
01861        form.exec();
01862 }
01863 
01864 void FetMainForm::on_dataTimeConstraintsSubactivitiesPreferredStartingTimesAction_activated()
01865 {
01866        if(simulation_running){
01867               QMessageBox::information(this, tr("FET information"),
01868                      tr("Allocation in course.\nPlease stop simulation before this."));
01869               return;
01870        }
01871 
01872        ConstraintSubactivitiesPreferredStartingTimesForm form(this);
01873        setParentAndOtherThings(&form, this);
01874        form.exec();
01875 }
01876 
01877 void FetMainForm::on_dataTimeConstraintsActivityEndsStudentsDayAction_activated()
01878 {
01879        if(simulation_running){
01880               QMessageBox::information(this, tr("FET information"),
01881                      tr("Allocation in course.\nPlease stop simulation before this."));
01882               return;
01883        }
01884 
01885        ConstraintActivityEndsStudentsDayForm form(this);
01886        setParentAndOtherThings(&form, this);
01887        form.exec();
01888 }
01889 
01890 void FetMainForm::on_dataTimeConstraintsActivitiesEndStudentsDayAction_activated()
01891 {
01892        if(simulation_running){
01893               QMessageBox::information(this, tr("FET information"),
01894                      tr("Allocation in course.\nPlease stop simulation before this."));
01895               return;
01896        }
01897 
01898        ConstraintActivitiesEndStudentsDayForm form(this);
01899        setParentAndOtherThings(&form, this);
01900        form.exec();
01901 }
01902 
01903 void FetMainForm::on_dataTimeConstraintsActivitiesSameStartingTimeAction_activated()
01904 {
01905        if(simulation_running){
01906               QMessageBox::information(this, tr("FET information"),
01907                      tr("Allocation in course.\nPlease stop simulation before this."));
01908               return;
01909        }
01910 
01911        ConstraintActivitiesSameStartingTimeForm form(this);
01912        setParentAndOtherThings(&form, this);
01913        form.exec();
01914 }
01915 
01916 void FetMainForm::on_dataTimeConstraintsActivitiesSameStartingHourAction_activated()
01917 {
01918        if(simulation_running){
01919               QMessageBox::information(this, tr("FET information"),
01920                      tr("Allocation in course.\nPlease stop simulation before this."));
01921               return;
01922        }
01923 
01924        ConstraintActivitiesSameStartingHourForm form(this);
01925        setParentAndOtherThings(&form, this);
01926        form.exec();
01927 }
01928 
01929 void FetMainForm::on_dataTimeConstraintsActivitiesSameStartingDayAction_activated()
01930 {
01931        if(simulation_running){
01932               QMessageBox::information(this, tr("FET information"),
01933                      tr("Allocation in course.\nPlease stop simulation before this."));
01934               return;
01935        }
01936 
01937        ConstraintActivitiesSameStartingDayForm form(this);
01938        setParentAndOtherThings(&form, this);
01939        form.exec();
01940 }
01941 
01942 void FetMainForm::on_dataTimeConstraintsActivitiesOccupyMaxTimeSlotsFromSelectionAction_activated()
01943 {
01944        if(simulation_running){
01945               QMessageBox::information(this, tr("FET information"),
01946                      tr("Allocation in course.\nPlease stop simulation before this."));
01947               return;
01948        }
01949 
01950        ConstraintActivitiesOccupyMaxTimeSlotsFromSelectionForm form(this);
01951        setParentAndOtherThings(&form, this);
01952        form.exec();
01953 }
01954 
01955 void FetMainForm::on_dataTimeConstraintsActivitiesMaxSimultaneousInSelectedTimeSlotsAction_activated()
01956 {
01957        if(simulation_running){
01958               QMessageBox::information(this, tr("FET information"),
01959                      tr("Allocation in course.\nPlease stop simulation before this."));
01960               return;
01961        }
01962 
01963        ConstraintActivitiesMaxSimultaneousInSelectedTimeSlotsForm form(this);
01964        setParentAndOtherThings(&form, this);
01965        form.exec();
01966 }
01967 
01968 void FetMainForm::on_dataTimeConstraintsTeacherNotAvailableTimesAction_activated()
01969 {
01970        if(simulation_running){
01971               QMessageBox::information(this, tr("FET information"),
01972                      tr("Allocation in course.\nPlease stop simulation before this."));
01973               return;
01974        }
01975 
01976        ConstraintTeacherNotAvailableTimesForm form(this);
01977        setParentAndOtherThings(&form, this);
01978        form.exec();
01979 }
01980 
01981 void FetMainForm::on_dataTimeConstraintsBasicCompulsoryTimeAction_activated()
01982 {
01983        if(simulation_running){
01984               QMessageBox::information(this, tr("FET information"),
01985                      tr("Allocation in course.\nPlease stop simulation before this."));
01986               return;
01987        }
01988 
01989        ConstraintBasicCompulsoryTimeForm form(this);
01990        setParentAndOtherThings(&form, this);
01991        form.exec();
01992 }
01993 
01994 void FetMainForm::on_dataSpaceConstraintsBasicCompulsorySpaceAction_activated()
01995 {
01996        if(simulation_running){
01997               QMessageBox::information(this, tr("FET information"),
01998                      tr("Allocation in course.\nPlease stop simulation before this."));
01999               return;
02000        }
02001 
02002        ConstraintBasicCompulsorySpaceForm form(this);
02003        setParentAndOtherThings(&form, this);
02004        form.exec();
02005 }
02006 
02007 void FetMainForm::on_dataSpaceConstraintsRoomNotAvailableTimesAction_activated()
02008 {
02009        if(simulation_running){
02010               QMessageBox::information(this, tr("FET information"),
02011                      tr("Allocation in course.\nPlease stop simulation before this."));
02012               return;
02013        }
02014 
02015        ConstraintRoomNotAvailableTimesForm form(this);
02016        setParentAndOtherThings(&form, this);
02017        form.exec();
02018 }
02019 
02020 void FetMainForm::on_dataSpaceConstraintsActivityPreferredRoomAction_activated()
02021 {
02022        if(simulation_running){
02023               QMessageBox::information(this, tr("FET information"),
02024                      tr("Allocation in course.\nPlease stop simulation before this."));
02025               return;
02026        }
02027 
02028        ConstraintActivityPreferredRoomForm form(this);
02029        setParentAndOtherThings(&form, this);
02030        form.exec();
02031 }
02032 
02033 void FetMainForm::on_dataSpaceConstraintsActivityPreferredRoomsAction_activated()
02034 {
02035        if(simulation_running){
02036               QMessageBox::information(this, tr("FET information"),
02037                      tr("Allocation in course.\nPlease stop simulation before this."));
02038               return;
02039        }
02040 
02041        ConstraintActivityPreferredRoomsForm form(this);
02042        setParentAndOtherThings(&form, this);
02043        form.exec();
02044 }
02045 
02046 void FetMainForm::on_dataSpaceConstraintsSubjectPreferredRoomAction_activated()
02047 {
02048        if(simulation_running){
02049               QMessageBox::information(this, tr("FET information"),
02050                      tr("Allocation in course.\nPlease stop simulation before this."));
02051               return;
02052        }
02053 
02054        ConstraintSubjectPreferredRoomForm form(this);
02055        setParentAndOtherThings(&form, this);
02056        form.exec();
02057 }
02058 
02059 void FetMainForm::on_dataSpaceConstraintsSubjectPreferredRoomsAction_activated()
02060 {
02061        if(simulation_running){
02062               QMessageBox::information(this, tr("FET information"),
02063                      tr("Allocation in course.\nPlease stop simulation before this."));
02064               return;
02065        }
02066 
02067        ConstraintSubjectPreferredRoomsForm form(this);
02068        setParentAndOtherThings(&form, this);
02069        form.exec();
02070 }
02071 
02072 void FetMainForm::on_dataSpaceConstraintsSubjectActivityTagPreferredRoomAction_activated()
02073 {
02074        if(simulation_running){
02075               QMessageBox::information(this, tr("FET information"),
02076                      tr("Allocation in course.\nPlease stop simulation before this."));
02077               return;
02078        }
02079 
02080        ConstraintSubjectActivityTagPreferredRoomForm form(this);
02081        setParentAndOtherThings(&form, this);
02082        form.exec();
02083 }
02084 
02085 void FetMainForm::on_dataSpaceConstraintsSubjectActivityTagPreferredRoomsAction_activated()
02086 {
02087        if(simulation_running){
02088               QMessageBox::information(this, tr("FET information"),
02089                      tr("Allocation in course.\nPlease stop simulation before this."));
02090               return;
02091        }
02092 
02093        ConstraintSubjectActivityTagPreferredRoomsForm form(this);
02094        setParentAndOtherThings(&form, this);
02095        form.exec();
02096 }
02097 
02099 void FetMainForm::on_dataSpaceConstraintsActivityTagPreferredRoomAction_activated()
02100 {
02101        if(simulation_running){
02102               QMessageBox::information(this, tr("FET information"),
02103                      tr("Allocation in course.\nPlease stop simulation before this."));
02104               return;
02105        }
02106 
02107        ConstraintActivityTagPreferredRoomForm form(this);
02108        setParentAndOtherThings(&form, this);
02109        form.exec();
02110 }
02111 
02112 void FetMainForm::on_dataSpaceConstraintsActivityTagPreferredRoomsAction_activated()
02113 {
02114        if(simulation_running){
02115               QMessageBox::information(this, tr("FET information"),
02116                      tr("Allocation in course.\nPlease stop simulation before this."));
02117               return;
02118        }
02119 
02120        ConstraintActivityTagPreferredRoomsForm form(this);
02121        setParentAndOtherThings(&form, this);
02122        form.exec();
02123 }
02125 
02126 void FetMainForm::on_dataSpaceConstraintsStudentsSetHomeRoomAction_activated()
02127 {
02128        if(simulation_running){
02129               QMessageBox::information(this, tr("FET information"),
02130                      tr("Allocation in course.\nPlease stop simulation before this."));
02131               return;
02132        }
02133 
02134        ConstraintStudentsSetHomeRoomForm form(this);
02135        setParentAndOtherThings(&form, this);
02136        form.exec();
02137 }
02138 
02139 void FetMainForm::on_dataSpaceConstraintsStudentsSetHomeRoomsAction_activated()
02140 {
02141        if(simulation_running){
02142               QMessageBox::information(this, tr("FET information"),
02143                      tr("Allocation in course.\nPlease stop simulation before this."));
02144               return;
02145        }
02146 
02147        ConstraintStudentsSetHomeRoomsForm form(this);
02148        setParentAndOtherThings(&form, this);
02149        form.exec();
02150 }
02151 
02152 
02153 void FetMainForm::on_dataSpaceConstraintsStudentsSetMaxBuildingChangesPerDayAction_activated()
02154 {
02155        if(simulation_running){
02156               QMessageBox::information(this, tr("FET information"),
02157                      tr("Allocation in course.\nPlease stop simulation before this."));
02158               return;
02159        }
02160 
02161        ConstraintStudentsSetMaxBuildingChangesPerDayForm form(this);
02162        setParentAndOtherThings(&form, this);
02163        form.exec();
02164 }
02165 
02166 void FetMainForm::on_dataSpaceConstraintsStudentsMaxBuildingChangesPerDayAction_activated()
02167 {
02168        if(simulation_running){
02169               QMessageBox::information(this, tr("FET information"),
02170                      tr("Allocation in course.\nPlease stop simulation before this."));
02171               return;
02172        }
02173 
02174        ConstraintStudentsMaxBuildingChangesPerDayForm form(this);
02175        setParentAndOtherThings(&form, this);
02176        form.exec();
02177 }
02178 
02179 void FetMainForm::on_dataSpaceConstraintsStudentsSetMaxBuildingChangesPerWeekAction_activated()
02180 {
02181        if(simulation_running){
02182               QMessageBox::information(this, tr("FET information"),
02183                      tr("Allocation in course.\nPlease stop simulation before this."));
02184               return;
02185        }
02186 
02187        ConstraintStudentsSetMaxBuildingChangesPerWeekForm form(this);
02188        setParentAndOtherThings(&form, this);
02189        form.exec();
02190 }
02191 
02192 void FetMainForm::on_dataSpaceConstraintsStudentsMaxBuildingChangesPerWeekAction_activated()
02193 {
02194        if(simulation_running){
02195               QMessageBox::information(this, tr("FET information"),
02196                      tr("Allocation in course.\nPlease stop simulation before this."));
02197               return;
02198        }
02199 
02200        ConstraintStudentsMaxBuildingChangesPerWeekForm form(this);
02201        setParentAndOtherThings(&form, this);
02202        form.exec();
02203 }
02204 
02205 void FetMainForm::on_dataSpaceConstraintsStudentsSetMinGapsBetweenBuildingChangesAction_activated()
02206 {
02207        if(simulation_running){
02208               QMessageBox::information(this, tr("FET information"),
02209                      tr("Allocation in course.\nPlease stop simulation before this."));
02210               return;
02211        }
02212 
02213        ConstraintStudentsSetMinGapsBetweenBuildingChangesForm form(this);
02214        setParentAndOtherThings(&form, this);
02215        form.exec();
02216 }
02217 
02218 void FetMainForm::on_dataSpaceConstraintsStudentsMinGapsBetweenBuildingChangesAction_activated()
02219 {
02220        if(simulation_running){
02221               QMessageBox::information(this, tr("FET information"),
02222                      tr("Allocation in course.\nPlease stop simulation before this."));
02223               return;
02224        }
02225 
02226        ConstraintStudentsMinGapsBetweenBuildingChangesForm form(this);
02227        setParentAndOtherThings(&form, this);
02228        form.exec();
02229 }
02230 
02231 void FetMainForm::on_dataSpaceConstraintsTeacherMaxBuildingChangesPerDayAction_activated()
02232 {
02233        if(simulation_running){
02234               QMessageBox::information(this, tr("FET information"),
02235                      tr("Allocation in course.\nPlease stop simulation before this."));
02236               return;
02237        }
02238 
02239        ConstraintTeacherMaxBuildingChangesPerDayForm form(this);
02240        setParentAndOtherThings(&form, this);
02241        form.exec();
02242 }
02243 void FetMainForm::on_dataSpaceConstraintsTeachersMaxBuildingChangesPerDayAction_activated()
02244 {
02245        if(simulation_running){
02246               QMessageBox::information(this, tr("FET information"),
02247                      tr("Allocation in course.\nPlease stop simulation before this."));
02248               return;
02249        }
02250 
02251        ConstraintTeachersMaxBuildingChangesPerDayForm form(this);
02252        setParentAndOtherThings(&form, this);
02253        form.exec();
02254 }
02255 
02256 void FetMainForm::on_dataSpaceConstraintsTeacherMaxBuildingChangesPerWeekAction_activated()
02257 {
02258        if(simulation_running){
02259               QMessageBox::information(this, tr("FET information"),
02260                      tr("Allocation in course.\nPlease stop simulation before this."));
02261               return;
02262        }
02263 
02264        ConstraintTeacherMaxBuildingChangesPerWeekForm form(this);
02265        setParentAndOtherThings(&form, this);
02266        form.exec();
02267 }
02268 
02269 void FetMainForm::on_dataSpaceConstraintsTeachersMaxBuildingChangesPerWeekAction_activated()
02270 {
02271        if(simulation_running){
02272               QMessageBox::information(this, tr("FET information"),
02273                      tr("Allocation in course.\nPlease stop simulation before this."));
02274               return;
02275        }
02276 
02277        ConstraintTeachersMaxBuildingChangesPerWeekForm form(this);
02278        setParentAndOtherThings(&form, this);
02279        form.exec();
02280 }
02281 
02282 void FetMainForm::on_dataSpaceConstraintsTeacherMinGapsBetweenBuildingChangesAction_activated()
02283 {
02284        if(simulation_running){
02285               QMessageBox::information(this, tr("FET information"),
02286                      tr("Allocation in course.\nPlease stop simulation before this."));
02287               return;
02288        }
02289 
02290        ConstraintTeacherMinGapsBetweenBuildingChangesForm form(this);
02291        setParentAndOtherThings(&form, this);
02292        form.exec();
02293 }
02294 
02295 void FetMainForm::on_dataSpaceConstraintsTeachersMinGapsBetweenBuildingChangesAction_activated()
02296 {
02297        if(simulation_running){
02298               QMessageBox::information(this, tr("FET information"),
02299                      tr("Allocation in course.\nPlease stop simulation before this."));
02300               return;
02301        }
02302 
02303        ConstraintTeachersMinGapsBetweenBuildingChangesForm form(this);
02304        setParentAndOtherThings(&form, this);
02305        form.exec();
02306 }
02307 
02308 void FetMainForm::on_dataSpaceConstraintsTeacherHomeRoomAction_activated()
02309 {
02310        if(simulation_running){
02311               QMessageBox::information(this, tr("FET information"),
02312                      tr("Allocation in course.\nPlease stop simulation before this."));
02313               return;
02314        }
02315 
02316        ConstraintTeacherHomeRoomForm form(this);
02317        setParentAndOtherThings(&form, this);
02318        form.exec();
02319 }
02320 
02321 void FetMainForm::on_dataSpaceConstraintsTeacherHomeRoomsAction_activated()
02322 {
02323        if(simulation_running){
02324               QMessageBox::information(this, tr("FET information"),
02325                      tr("Allocation in course.\nPlease stop simulation before this."));
02326               return;
02327        }
02328 
02329        ConstraintTeacherHomeRoomsForm form(this);
02330        setParentAndOtherThings(&form, this);
02331        form.exec();
02332 }
02333 
02334 void FetMainForm::on_dataTimeConstraintsStudentsSetNotAvailableTimesAction_activated()
02335 {
02336        if(simulation_running){
02337               QMessageBox::information(this, tr("FET information"),
02338                      tr("Allocation in course.\nPlease stop simulation before this."));
02339               return;
02340        }
02341 
02342        ConstraintStudentsSetNotAvailableTimesForm form(this);
02343        setParentAndOtherThings(&form, this);
02344        form.exec();
02345 }
02346 
02347 void FetMainForm::on_dataTimeConstraintsBreakTimesAction_activated()
02348 {
02349        if(simulation_running){
02350               QMessageBox::information(this, tr("FET information"),
02351                      tr("Allocation in course.\nPlease stop simulation before this."));
02352               return;
02353        }
02354 
02355        ConstraintBreakTimesForm form(this);
02356        setParentAndOtherThings(&form, this);
02357        form.exec();
02358 }
02359 
02360 void FetMainForm::on_dataTimeConstraintsTeacherMaxDaysPerWeekAction_activated()
02361 {
02362        if(simulation_running){
02363               QMessageBox::information(this, tr("FET information"),
02364                      tr("Allocation in course.\nPlease stop simulation before this."));
02365               return;
02366        }
02367 
02368        ConstraintTeacherMaxDaysPerWeekForm form(this);
02369        setParentAndOtherThings(&form, this);
02370        form.exec();
02371 }
02372 
02373 void FetMainForm::on_dataTimeConstraintsTeachersMaxDaysPerWeekAction_activated()
02374 {
02375        if(simulation_running){
02376               QMessageBox::information(this, tr("FET information"),
02377                      tr("Allocation in course.\nPlease stop simulation before this."));
02378               return;
02379        }
02380 
02381        ConstraintTeachersMaxDaysPerWeekForm form(this);
02382        setParentAndOtherThings(&form, this);
02383        form.exec();
02384 }
02385 
02386 void FetMainForm::on_dataTimeConstraintsTeacherMinDaysPerWeekAction_activated()
02387 {
02388        if(simulation_running){
02389               QMessageBox::information(this, tr("FET information"),
02390                      tr("Allocation in course.\nPlease stop simulation before this."));
02391               return;
02392        }
02393 
02394        ConstraintTeacherMinDaysPerWeekForm form(this);
02395        setParentAndOtherThings(&form, this);
02396        form.exec();
02397 }
02398 
02399 void FetMainForm::on_dataTimeConstraintsTeachersMinDaysPerWeekAction_activated()
02400 {
02401        if(simulation_running){
02402               QMessageBox::information(this, tr("FET information"),
02403                      tr("Allocation in course.\nPlease stop simulation before this."));
02404               return;
02405        }
02406 
02407        ConstraintTeachersMinDaysPerWeekForm form(this);
02408        setParentAndOtherThings(&form, this);
02409        form.exec();
02410 }
02411 
02412 void FetMainForm::on_dataTimeConstraintsTeacherIntervalMaxDaysPerWeekAction_activated()
02413 {
02414        if(simulation_running){
02415               QMessageBox::information(this, tr("FET information"),
02416                      tr("Allocation in course.\nPlease stop simulation before this."));
02417               return;
02418        }
02419 
02420        ConstraintTeacherIntervalMaxDaysPerWeekForm form(this);
02421        setParentAndOtherThings(&form, this);
02422        form.exec();
02423 }
02424 
02425 void FetMainForm::on_dataTimeConstraintsTeachersIntervalMaxDaysPerWeekAction_activated()
02426 {
02427        if(simulation_running){
02428               QMessageBox::information(this, tr("FET information"),
02429                      tr("Allocation in course.\nPlease stop simulation before this."));
02430               return;
02431        }
02432 
02433        ConstraintTeachersIntervalMaxDaysPerWeekForm form(this);
02434        setParentAndOtherThings(&form, this);
02435        form.exec();
02436 }
02437 
02438 void FetMainForm::on_dataTimeConstraintsStudentsSetIntervalMaxDaysPerWeekAction_activated()
02439 {
02440        if(simulation_running){
02441               QMessageBox::information(this, tr("FET information"),
02442                      tr("Allocation in course.\nPlease stop simulation before this."));
02443               return;
02444        }
02445 
02446        ConstraintStudentsSetIntervalMaxDaysPerWeekForm form(this);
02447        setParentAndOtherThings(&form, this);
02448        form.exec();
02449 }
02450 
02451 void FetMainForm::on_dataTimeConstraintsStudentsIntervalMaxDaysPerWeekAction_activated()
02452 {
02453        if(simulation_running){
02454               QMessageBox::information(this, tr("FET information"),
02455                      tr("Allocation in course.\nPlease stop simulation before this."));
02456               return;
02457        }
02458 
02459        ConstraintStudentsIntervalMaxDaysPerWeekForm form(this);
02460        setParentAndOtherThings(&form, this);
02461        form.exec();
02462 }
02463 
02464 void FetMainForm::on_dataTimeConstraintsTeachersMaxHoursDailyAction_activated()
02465 {
02466        if(simulation_running){
02467               QMessageBox::information(this, tr("FET information"),
02468                      tr("Allocation in course.\nPlease stop simulation before this."));
02469               return;
02470        }
02471 
02472        ConstraintTeachersMaxHoursDailyForm form(this);
02473        setParentAndOtherThings(&form, this);
02474        form.exec();
02475 }
02476 
02477 void FetMainForm::on_dataTimeConstraintsTeacherMaxHoursDailyAction_activated()
02478 {
02479        if(simulation_running){
02480               QMessageBox::information(this, tr("FET information"),
02481                      tr("Allocation in course.\nPlease stop simulation before this."));
02482               return;
02483        }
02484 
02485        ConstraintTeacherMaxHoursDailyForm form(this);
02486        setParentAndOtherThings(&form, this);
02487        form.exec();
02488 }
02489 
02490 void FetMainForm::on_dataTimeConstraintsTeachersMaxHoursContinuouslyAction_activated()
02491 {
02492        if(simulation_running){
02493               QMessageBox::information(this, tr("FET information"),
02494                      tr("Allocation in course.\nPlease stop simulation before this."));
02495               return;
02496        }
02497 
02498        ConstraintTeachersMaxHoursContinuouslyForm form(this);
02499        setParentAndOtherThings(&form, this);
02500        form.exec();
02501 }
02502 
02503 void FetMainForm::on_dataTimeConstraintsTeacherMaxHoursContinuouslyAction_activated()
02504 {
02505        if(simulation_running){
02506               QMessageBox::information(this, tr("FET information"),
02507                      tr("Allocation in course.\nPlease stop simulation before this."));
02508               return;
02509        }
02510 
02511        ConstraintTeacherMaxHoursContinuouslyForm form(this);
02512        setParentAndOtherThings(&form, this);
02513        form.exec();
02514 }
02515 
02516 void FetMainForm::on_dataTimeConstraintsTeachersActivityTagMaxHoursContinuouslyAction_activated()
02517 {
02518        if(simulation_running){
02519               QMessageBox::information(this, tr("FET information"),
02520                      tr("Allocation in course.\nPlease stop simulation before this."));
02521               return;
02522        }
02523 
02524        ConstraintTeachersActivityTagMaxHoursContinuouslyForm form(this);
02525        setParentAndOtherThings(&form, this);
02526        form.exec();
02527 }
02528 
02529 void FetMainForm::on_dataTimeConstraintsTeacherActivityTagMaxHoursContinuouslyAction_activated()
02530 {
02531        if(simulation_running){
02532               QMessageBox::information(this, tr("FET information"),
02533                      tr("Allocation in course.\nPlease stop simulation before this."));
02534               return;
02535        }
02536 
02537        ConstraintTeacherActivityTagMaxHoursContinuouslyForm form(this);
02538        setParentAndOtherThings(&form, this);
02539        form.exec();
02540 }
02541 
02542 void FetMainForm::on_dataTimeConstraintsTeachersActivityTagMaxHoursDailyAction_activated()
02543 {
02544        if(simulation_running){
02545               QMessageBox::information(this, tr("FET information"),
02546                      tr("Allocation in course.\nPlease stop simulation before this."));
02547               return;
02548        }
02549        
02550        if(!ENABLE_ACTIVITY_TAG_MAX_HOURS_DAILY){
02551               enableNotPerfectMessage();
02552               return;
02553        }
02554 
02555        ConstraintTeachersActivityTagMaxHoursDailyForm form(this);
02556        setParentAndOtherThings(&form, this);
02557        form.exec();
02558 }
02559 
02560 void FetMainForm::on_dataTimeConstraintsTeacherActivityTagMaxHoursDailyAction_activated()
02561 {
02562        if(simulation_running){
02563               QMessageBox::information(this, tr("FET information"),
02564                      tr("Allocation in course.\nPlease stop simulation before this."));
02565               return;
02566        }
02567 
02568        if(!ENABLE_ACTIVITY_TAG_MAX_HOURS_DAILY){
02569               enableNotPerfectMessage();
02570               return;
02571        }
02572 
02573        ConstraintTeacherActivityTagMaxHoursDailyForm form(this);
02574        setParentAndOtherThings(&form, this);
02575        form.exec();
02576 }
02577 
02578 void FetMainForm::on_dataTimeConstraintsTeachersMinHoursDailyAction_activated()
02579 {
02580        if(simulation_running){
02581               QMessageBox::information(this, tr("FET information"),
02582                      tr("Allocation in course.\nPlease stop simulation before this."));
02583               return;
02584        }
02585 
02586        ConstraintTeachersMinHoursDailyForm form(this);
02587        setParentAndOtherThings(&form, this);
02588        form.exec();
02589 }
02590 
02591 void FetMainForm::on_dataTimeConstraintsTeacherMinHoursDailyAction_activated()
02592 {
02593        if(simulation_running){
02594               QMessageBox::information(this, tr("FET information"),
02595                      tr("Allocation in course.\nPlease stop simulation before this."));
02596               return;
02597        }
02598 
02599        ConstraintTeacherMinHoursDailyForm form(this);
02600        setParentAndOtherThings(&form, this);
02601        form.exec();
02602 }
02603 
02604 void FetMainForm::on_dataTimeConstraintsActivityPreferredStartingTimeAction_activated()
02605 {
02606        if(simulation_running){
02607               QMessageBox::information(this, tr("FET information"),
02608                      tr("Allocation in course.\nPlease stop simulation before this."));
02609               return;
02610        }
02611 
02612        ConstraintActivityPreferredStartingTimeForm form(this);
02613        setParentAndOtherThings(&form, this);
02614        form.exec();
02615 }
02616 
02617 void FetMainForm::on_dataTimeConstraintsStudentsSetMaxGapsPerWeekAction_activated()
02618 {
02619        if(simulation_running){
02620               QMessageBox::information(this, tr("FET information"),
02621                      tr("Allocation in course.\nPlease stop simulation before this."));
02622               return;
02623        }
02624 
02625        ConstraintStudentsSetMaxGapsPerWeekForm form(this);
02626        setParentAndOtherThings(&form, this);
02627        form.exec();
02628 }
02629 
02630 void FetMainForm::on_dataTimeConstraintsStudentsMaxGapsPerWeekAction_activated()
02631 {
02632        if(simulation_running){
02633               QMessageBox::information(this, tr("FET information"),
02634                      tr("Allocation in course.\nPlease stop simulation before this."));
02635               return;
02636        }
02637 
02638        ConstraintStudentsMaxGapsPerWeekForm form(this);
02639        setParentAndOtherThings(&form, this);
02640        form.exec();
02641 }
02642 
02643 void FetMainForm::on_dataTimeConstraintsStudentsSetMaxGapsPerDayAction_activated()
02644 {
02645        if(simulation_running){
02646               QMessageBox::information(this, tr("FET information"),
02647                      tr("Allocation in course.\nPlease stop simulation before this."));
02648               return;
02649        }
02650 
02651        if(!ENABLE_STUDENTS_MAX_GAPS_PER_DAY){
02652               enableNotPerfectMessage();
02653               return;
02654        }
02655 
02656        ConstraintStudentsSetMaxGapsPerDayForm form(this);
02657        setParentAndOtherThings(&form, this);
02658        form.exec();
02659 }
02660 
02661 void FetMainForm::on_dataTimeConstraintsStudentsMaxGapsPerDayAction_activated()
02662 {
02663        if(simulation_running){
02664               QMessageBox::information(this, tr("FET information"),
02665                      tr("Allocation in course.\nPlease stop simulation before this."));
02666               return;
02667        }
02668        
02669        if(!ENABLE_STUDENTS_MAX_GAPS_PER_DAY){
02670               enableNotPerfectMessage();
02671               return;
02672        }
02673 
02674        ConstraintStudentsMaxGapsPerDayForm form(this);
02675        setParentAndOtherThings(&form, this);
02676        form.exec();
02677 }
02678 
02679 void FetMainForm::on_dataTimeConstraintsTeachersMaxGapsPerWeekAction_activated()
02680 {
02681        if(simulation_running){
02682               QMessageBox::information(this, tr("FET information"),
02683                      tr("Allocation in course.\nPlease stop simulation before this."));
02684               return;
02685        }
02686 
02687        ConstraintTeachersMaxGapsPerWeekForm form(this);
02688        setParentAndOtherThings(&form, this);
02689        form.exec();
02690 }
02691 
02692 void FetMainForm::on_dataTimeConstraintsTeacherMaxGapsPerWeekAction_activated()
02693 {
02694        if(simulation_running){
02695               QMessageBox::information(this, tr("FET information"),
02696                      tr("Allocation in course.\nPlease stop simulation before this."));
02697               return;
02698        }
02699 
02700        ConstraintTeacherMaxGapsPerWeekForm form(this);
02701        setParentAndOtherThings(&form, this);
02702        form.exec();
02703 }
02704 
02705 void FetMainForm::on_dataTimeConstraintsTeachersMaxGapsPerDayAction_activated()
02706 {
02707        if(simulation_running){
02708               QMessageBox::information(this, tr("FET information"),
02709                      tr("Allocation in course.\nPlease stop simulation before this."));
02710               return;
02711        }
02712 
02713        ConstraintTeachersMaxGapsPerDayForm form(this);
02714        setParentAndOtherThings(&form, this);
02715        form.exec();
02716 }
02717 
02718 void FetMainForm::on_dataTimeConstraintsTeacherMaxGapsPerDayAction_activated()
02719 {
02720        if(simulation_running){
02721               QMessageBox::information(this, tr("FET information"),
02722                      tr("Allocation in course.\nPlease stop simulation before this."));
02723               return;
02724        }
02725 
02726        ConstraintTeacherMaxGapsPerDayForm form(this);
02727        setParentAndOtherThings(&form, this);
02728        form.exec();
02729 }
02730 
02731 void FetMainForm::on_dataTimeConstraintsStudentsEarlyMaxBeginningsAtSecondHourAction_activated()
02732 {
02733        if(simulation_running){
02734               QMessageBox::information(this, tr("FET information"),
02735                      tr("Allocation in course.\nPlease stop simulation before this."));
02736               return;
02737        }
02738 
02739        ConstraintStudentsEarlyMaxBeginningsAtSecondHourForm form(this);
02740        setParentAndOtherThings(&form, this);
02741        form.exec();
02742 }
02743 
02744 void FetMainForm::on_dataTimeConstraintsStudentsSetEarlyMaxBeginningsAtSecondHourAction_activated()
02745 {
02746        if(simulation_running){
02747               QMessageBox::information(this, tr("FET information"),
02748                      tr("Allocation in course.\nPlease stop simulation before this."));
02749               return;
02750        }
02751 
02752        ConstraintStudentsSetEarlyMaxBeginningsAtSecondHourForm form(this);
02753        setParentAndOtherThings(&form, this);
02754        form.exec();
02755 }
02756 
02757 void FetMainForm::on_dataTimeConstraintsStudentsSetMaxHoursDailyAction_activated()
02758 {
02759        if(simulation_running){
02760               QMessageBox::information(this, tr("FET information"),
02761                      tr("Allocation in course.\nPlease stop simulation before this."));
02762               return;
02763        }
02764 
02765        ConstraintStudentsSetMaxHoursDailyForm form(this);
02766        setParentAndOtherThings(&form, this);
02767        form.exec();
02768 }
02769 
02770 void FetMainForm::on_dataTimeConstraintsStudentsMaxHoursDailyAction_activated()
02771 {
02772        if(simulation_running){
02773               QMessageBox::information(this, tr("FET information"),
02774                      tr("Allocation in course.\nPlease stop simulation before this."));
02775               return;
02776        }
02777 
02778        ConstraintStudentsMaxHoursDailyForm form(this);
02779        setParentAndOtherThings(&form, this);
02780        form.exec();
02781 }
02782 
02783 void FetMainForm::on_dataTimeConstraintsStudentsSetMaxHoursContinuouslyAction_activated()
02784 {
02785        if(simulation_running){
02786               QMessageBox::information(this, tr("FET information"),
02787                      tr("Allocation in course.\nPlease stop simulation before this."));
02788               return;
02789        }
02790 
02791        ConstraintStudentsSetMaxHoursContinuouslyForm form(this);
02792        setParentAndOtherThings(&form, this);
02793        form.exec();
02794 }
02795 
02796 void FetMainForm::on_dataTimeConstraintsStudentsMaxHoursContinuouslyAction_activated()
02797 {
02798        if(simulation_running){
02799               QMessageBox::information(this, tr("FET information"),
02800                      tr("Allocation in course.\nPlease stop simulation before this."));
02801               return;
02802        }
02803 
02804        ConstraintStudentsMaxHoursContinuouslyForm form(this);
02805        setParentAndOtherThings(&form, this);
02806        form.exec();
02807 }
02808 
02809 void FetMainForm::on_dataTimeConstraintsStudentsSetActivityTagMaxHoursContinuouslyAction_activated()
02810 {
02811        if(simulation_running){
02812               QMessageBox::information(this, tr("FET information"),
02813                      tr("Allocation in course.\nPlease stop simulation before this."));
02814               return;
02815        }
02816 
02817        ConstraintStudentsSetActivityTagMaxHoursContinuouslyForm form(this);
02818        setParentAndOtherThings(&form, this);
02819        form.exec();
02820 }
02821 
02822 void FetMainForm::on_dataTimeConstraintsStudentsActivityTagMaxHoursContinuouslyAction_activated()
02823 {
02824        if(simulation_running){
02825               QMessageBox::information(this, tr("FET information"),
02826                      tr("Allocation in course.\nPlease stop simulation before this."));
02827               return;
02828        }
02829 
02830        ConstraintStudentsActivityTagMaxHoursContinuouslyForm form(this);
02831        setParentAndOtherThings(&form, this);
02832        form.exec();
02833 }
02834 
02835 void FetMainForm::on_dataTimeConstraintsStudentsSetActivityTagMaxHoursDailyAction_activated()
02836 {
02837        if(simulation_running){
02838               QMessageBox::information(this, tr("FET information"),
02839                      tr("Allocation in course.\nPlease stop simulation before this."));
02840               return;
02841        }
02842 
02843        if(!ENABLE_ACTIVITY_TAG_MAX_HOURS_DAILY){
02844               enableNotPerfectMessage();
02845               return;
02846        }
02847 
02848        ConstraintStudentsSetActivityTagMaxHoursDailyForm form(this);
02849        setParentAndOtherThings(&form, this);
02850        form.exec();
02851 }
02852 
02853 void FetMainForm::on_dataTimeConstraintsStudentsActivityTagMaxHoursDailyAction_activated()
02854 {
02855        if(simulation_running){
02856               QMessageBox::information(this, tr("FET information"),
02857                      tr("Allocation in course.\nPlease stop simulation before this."));
02858               return;
02859        }
02860 
02861        if(!ENABLE_ACTIVITY_TAG_MAX_HOURS_DAILY){
02862               enableNotPerfectMessage();
02863               return;
02864        }
02865 
02866        ConstraintStudentsActivityTagMaxHoursDailyForm form(this);
02867        setParentAndOtherThings(&form, this);
02868        form.exec();
02869 }
02870 
02871 void FetMainForm::on_dataTimeConstraintsStudentsSetMinHoursDailyAction_activated()
02872 {
02873        if(simulation_running){
02874               QMessageBox::information(this, tr("FET information"),
02875                      tr("Allocation in course.\nPlease stop simulation before this."));
02876               return;
02877        }
02878 
02879        ConstraintStudentsSetMinHoursDailyForm form(this);
02880        setParentAndOtherThings(&form, this);
02881        form.exec();
02882 }
02883 
02884 void FetMainForm::on_dataTimeConstraintsStudentsMinHoursDailyAction_activated()
02885 {
02886        if(simulation_running){
02887               QMessageBox::information(this, tr("FET information"),
02888                      tr("Allocation in course.\nPlease stop simulation before this."));
02889               return;
02890        }
02891 
02892        ConstraintStudentsMinHoursDailyForm form(this);
02893        setParentAndOtherThings(&form, this);
02894        form.exec();
02895 }
02896 
02897 void FetMainForm::on_dataTimeConstraintsActivitiesNotOverlappingAction_activated()
02898 {
02899        if(simulation_running){
02900               QMessageBox::information(this, tr("FET information"),
02901                      tr("Allocation in course.\nPlease stop simulation before this."));
02902               return;
02903        }
02904 
02905        ConstraintActivitiesNotOverlappingForm form(this);
02906        setParentAndOtherThings(&form, this);
02907        form.exec();
02908 }
02909 
02910 void FetMainForm::on_dataTimeConstraintsMinDaysBetweenActivitiesAction_activated()
02911 {
02912        if(simulation_running){
02913               QMessageBox::information(this, tr("FET information"),
02914                      tr("Allocation in course.\nPlease stop simulation before this."));
02915               return;
02916        }
02917 
02918        ConstraintMinDaysBetweenActivitiesForm form(this);
02919        setParentAndOtherThings(&form, this);
02920        form.exec();
02921 }
02922 
02923 void FetMainForm::on_dataTimeConstraintsMaxDaysBetweenActivitiesAction_activated()
02924 {
02925        if(simulation_running){
02926               QMessageBox::information(this, tr("FET information"),
02927                      tr("Allocation in course.\nPlease stop simulation before this."));
02928               return;
02929        }
02930 
02931        ConstraintMaxDaysBetweenActivitiesForm form(this);
02932        setParentAndOtherThings(&form, this);
02933        form.exec();
02934 }
02935 
02936 void FetMainForm::on_dataTimeConstraintsMinGapsBetweenActivitiesAction_activated()
02937 {
02938        if(simulation_running){
02939               QMessageBox::information(this, tr("FET information"),
02940                      tr("Allocation in course.\nPlease stop simulation before this."));
02941               return;
02942        }
02943 
02944        ConstraintMinGapsBetweenActivitiesForm form(this);
02945        setParentAndOtherThings(&form, this);
02946        form.exec();
02947 }
02948 
02949 void FetMainForm::on_dataTimeConstraintsActivityPreferredTimeSlotsAction_activated()
02950 {
02951        if(simulation_running){
02952               QMessageBox::information(this, tr("FET information"),
02953                      tr("Allocation in course.\nPlease stop simulation before this."));
02954               return;
02955        }
02956 
02957        ConstraintActivityPreferredTimeSlotsForm form(this);
02958        setParentAndOtherThings(&form, this);
02959        form.exec();
02960 }
02961 
02962 void FetMainForm::on_dataTimeConstraintsActivityPreferredStartingTimesAction_activated()
02963 {
02964        if(simulation_running){
02965               QMessageBox::information(this, tr("FET information"),
02966                      tr("Allocation in course.\nPlease stop simulation before this."));
02967               return;
02968        }
02969 
02970        ConstraintActivityPreferredStartingTimesForm form(this);
02971        setParentAndOtherThings(&form, this);
02972        form.exec();
02973 }
02974 
02975 //2012-04-29
02976 void FetMainForm::on_dataSpaceConstraintsActivitiesOccupyMaxDifferentRoomsAction_activated()
02977 {
02978        if(simulation_running){
02979               QMessageBox::information(this, tr("FET information"),
02980                      tr("Allocation in course.\nPlease stop simulation before this."));
02981               return;
02982        }
02983 
02984        ConstraintActivitiesOccupyMaxDifferentRoomsForm form(this);
02985        setParentAndOtherThings(&form, this);
02986        form.exec();
02987 }
02988 
02989 void FetMainForm::on_helpAboutAction_activated()
02990 {
02991        HelpAboutForm* form=new HelpAboutForm(this);
02992        form->setWindowFlags(Qt::Window);
02993        form->setAttribute(Qt::WA_DeleteOnClose);
02994        forceCenterWidgetOnScreen(form);
02995        restoreFETDialogGeometry(form);
02996        form->show();
02997 }
02998 
02999 void FetMainForm::on_helpHomepageAction_activated()
03000 {
03001        bool tds=QDesktopServices::openUrl(QUrl("http://lalescu.ro/liviu/fet/"));
03002 
03003        if(!tds){
03004               QMessageBox::warning(this, tr("FET warning"), tr("Could not start the default Internet browser (trying to open the link %1)."
03005               " Maybe you can try to manually start your browser and open this link.").arg("http://lalescu.ro/liviu/fet/"));
03006        }
03007 }
03008 
03009 void FetMainForm::on_helpContentsAction_activated()
03010 {
03011        bool tds=QDesktopServices::openUrl(QUrl("http://lalescu.ro/liviu/fet/doc/"));
03012 
03013        if(!tds){
03014               QMessageBox::warning(this, tr("FET warning"), tr("Could not start the default Internet browser (trying to open the link %1)."
03015               " Maybe you can try to manually start your browser and open this link.").arg("http://lalescu.ro/liviu/fet/doc/"));
03016        }
03017 }
03018 
03019 void FetMainForm::on_helpForumAction_activated()
03020 {
03021        bool tds=QDesktopServices::openUrl(QUrl("http://lalescu.ro/liviu/fet/forum/"));
03022 
03023        if(!tds){
03024               QMessageBox::warning(this, tr("FET warning"), tr("Could not start the default Internet browser (trying to open the link %1)."
03025               " Maybe you can try to manually start your browser and open this link.").arg("http://lalescu.ro/liviu/fet/forum/"));
03026        }
03027 }
03028 
03029 void FetMainForm::on_helpAddressesAction_activated()
03030 {
03031        QString s="";
03032        s+=tr("In case the Help/Online menus do not function, please write down these addresses and open them in an Internet browser:");
03033        s+="\n\n";
03034        s+=tr("FET homepage: %1", "%1 is FET homepage, begins with http://...").arg("http://lalescu.ro/liviu/fet/");
03035        s+="\n";
03036        s+=tr("Documentation (online help contents): %1", "%1 is web page of FET Doc(umentation), which is the contents of the online help, it begins with http://...").arg("http://lalescu.ro/liviu/fet/doc/");
03037        s+="\n";
03038        s+=tr("Forum: %1", "%1 is web page of FET forum, begins with http://...").arg("http://lalescu.ro/liviu/fet/forum/");
03039        s+="\n\n";
03040        s+=tr("Additionally, you may find on the FET homepage other contact information.");
03041        s+="\n\n";
03042        s+=tr("In case these addresses do not function, maybe the FET webpage has temporary problems, so try again later. Or maybe the FET webpage has changed, so search for the new page on the Internet.");
03043 
03044        LongTextMessageBox::largeInformation(this, tr("FET web addresses"), s);
03045 }
03046 
03047 void FetMainForm::on_helpFAQAction_activated()
03048 {
03049        HelpFaqForm* form=new HelpFaqForm(this);
03050        form->setWindowFlags(Qt::Window);
03051        form->setAttribute(Qt::WA_DeleteOnClose);
03052        forceCenterWidgetOnScreen(form);
03053        restoreFETDialogGeometry(form);
03054        form->show();
03055 }
03056 
03057 void FetMainForm::on_helpTipsAction_activated()
03058 {
03059        HelpTipsForm* form=new HelpTipsForm(this);
03060        form->setWindowFlags(Qt::Window);
03061        form->setAttribute(Qt::WA_DeleteOnClose);
03062        forceCenterWidgetOnScreen(form);
03063        restoreFETDialogGeometry(form);
03064        form->show();
03065 }
03066 
03067 void FetMainForm::on_helpInstructionsAction_activated()
03068 {
03069        HelpInstructionsForm* form=new HelpInstructionsForm(this);
03070        form->setWindowFlags(Qt::Window);
03071        form->setAttribute(Qt::WA_DeleteOnClose);
03072        forceCenterWidgetOnScreen(form);
03073        restoreFETDialogGeometry(form);
03074        form->show();
03075 }
03076 
03077 void FetMainForm::on_timetableGenerateAction_activated()
03078 {
03079        if(simulation_running){
03080               QMessageBox::information(this, tr("FET information"),
03081                      tr("Allocation in course.\nPlease stop simulation before this."));
03082               return;
03083        }
03084 
03085        int count=0;
03086        for(int i=0; i<gt.rules.activitiesList.size(); i++){
03087               Activity* act=gt.rules.activitiesList[i];
03088               if(act->active)
03089                      count++;
03090        }
03091        if(count<1){
03092               QMessageBox::information(this, tr("FET information"), tr("Please input at least one active activity before generating"));
03093               return;
03094        }
03095        TimetableGenerateForm form(this);
03096        setParentAndOtherThings(&form, this);
03097        form.exec();
03098        
03099        LockUnlock::increaseCommunicationSpinBox();
03100 }
03101 
03102 void FetMainForm::on_timetableGenerateMultipleAction_activated()
03103 {
03104        if(simulation_running){
03105               QMessageBox::information(this, tr("FET information"),
03106                      tr("Allocation in course.\nPlease stop simulation before this."));
03107               return;
03108        }
03109 
03110        if(INPUT_FILENAME_XML.isEmpty()){
03111               QMessageBox::information(this, tr("FET information"),
03112                      tr("Your current data has no name. Please save it as a file with a certain name before proceeding."));
03113               return;
03114        }
03115 
03116        int count=0;
03117        for(int i=0; i<gt.rules.activitiesList.size(); i++){
03118               Activity* act=gt.rules.activitiesList[i];
03119               if(act->active)
03120                      count++;
03121        }
03122        if(count<1){
03123               QMessageBox::information(this, tr("FET information"), tr("Please input at least one active activity before generating multiple"));
03124               return;
03125        }
03126        TimetableGenerateMultipleForm form(this);
03127        setParentAndOtherThings(&form, this);
03128        form.exec();
03129 
03130        LockUnlock::increaseCommunicationSpinBox();
03131 }
03132 
03133 void FetMainForm::on_timetableViewStudentsAction_activated()
03134 {
03135        if(!(students_schedule_ready && teachers_schedule_ready && rooms_schedule_ready)){
03136               QMessageBox::information(this, tr("FET information"), tr("Please generate, firstly"));
03137               return;
03138        }
03139 
03140        if(gt.rules.nInternalRooms!=gt.rules.roomsList.count()){
03141               QMessageBox::warning(this, tr("FET warning"), tr("Cannot display the timetable, because you added or removed some rooms. Please regenerate the timetable and then view it"));
03142               return;
03143        }
03144 
03145        TimetableViewStudentsForm *form=new TimetableViewStudentsForm(this);
03146        form->setWindowFlags(Qt::Window);
03147        form->setAttribute(Qt::WA_DeleteOnClose);
03148        forceCenterWidgetOnScreen(form);
03149        restoreFETDialogGeometry(form);
03150        form->show();
03151        form->resizeRowsAfterShow();
03152 }
03153 
03154 void FetMainForm::on_timetableViewTeachersAction_activated()
03155 {
03156        if(!(students_schedule_ready && teachers_schedule_ready && rooms_schedule_ready)){
03157               QMessageBox::information(this, tr("FET information"), tr("Please generate, firstly"));
03158               return;
03159        }
03160 
03161        if(gt.rules.nInternalRooms!=gt.rules.roomsList.count()){
03162               QMessageBox::warning(this, tr("FET warning"), tr("Cannot display the timetable, because you added or removed some rooms. Please regenerate the timetable and then view it"));
03163               return;
03164        }
03165        if(gt.rules.nInternalTeachers!=gt.rules.teachersList.count()){
03166               QMessageBox::warning(this, tr("FET warning"), tr("Cannot display the timetable, because you added or removed some teachers. Please regenerate the timetable and then view it"));
03167               return;
03168        }
03169        
03170        TimetableViewTeachersForm *form=new TimetableViewTeachersForm(this);
03171        form->setWindowFlags(Qt::Window);
03172        form->setAttribute(Qt::WA_DeleteOnClose);
03173        forceCenterWidgetOnScreen(form);
03174        restoreFETDialogGeometry(form);
03175        form->show();
03176        form->resizeRowsAfterShow();
03177 }
03178 
03179 void FetMainForm::on_timetableShowConflictsAction_activated()
03180 {
03181        if(!(students_schedule_ready && teachers_schedule_ready && rooms_schedule_ready)){
03182               QMessageBox::information(this, tr("FET information"), tr("Please generate, firstly"));
03183               return;
03184        }
03185 
03186        TimetableShowConflictsForm *form=new TimetableShowConflictsForm(this);
03187        form->setWindowFlags(Qt::Window);
03188        form->setAttribute(Qt::WA_DeleteOnClose);
03189        forceCenterWidgetOnScreen(form);
03190        restoreFETDialogGeometry(form);
03191        form->show();
03192 }
03193 
03194 void FetMainForm::on_timetableViewRoomsAction_activated()
03195 {
03196        if(!(students_schedule_ready && teachers_schedule_ready && rooms_schedule_ready)){
03197               QMessageBox::information(this, tr("FET information"), tr("Please generate, firstly"));
03198               return;
03199        }
03200 
03201        if(gt.rules.nInternalRooms!=gt.rules.roomsList.count()){
03202               QMessageBox::warning(this, tr("FET warning"), tr("Cannot display the timetable, because you added or removed some rooms. Please regenerate the timetable and then view it"));
03203               return;
03204        }
03205 
03206        TimetableViewRoomsForm* form=new TimetableViewRoomsForm(this);
03207        form->setWindowFlags(Qt::Window);
03208        form->setAttribute(Qt::WA_DeleteOnClose);
03209        forceCenterWidgetOnScreen(form);
03210        restoreFETDialogGeometry(form);
03211        form->show();
03212        form->resizeRowsAfterShow();
03213 }
03214 
03215 void FetMainForm::on_timetablePrintAction_activated()
03216 {
03217        if(!(students_schedule_ready && teachers_schedule_ready && rooms_schedule_ready)){
03218               QMessageBox::information(this, tr("FET information"), tr("Please generate, firstly"));
03219               return;
03220        }
03221 
03222        if(gt.rules.nInternalRooms!=gt.rules.roomsList.count()){
03223               QMessageBox::warning(this, tr("FET warning"), tr("Cannot display the timetable, because you added or removed some rooms. Please regenerate the timetable and then view it"));
03224               return;
03225        }
03226        if(gt.rules.nInternalTeachers!=gt.rules.teachersList.count()){
03227               QMessageBox::warning(this, tr("FET warning"), tr("Cannot display the timetable, because you added or removed some teachers. Please regenerate the timetable and then view it"));
03228               return;
03229        }
03230        
03231        StartTimetablePrint::startTimetablePrint(this);
03232 }
03233 
03234 void FetMainForm::on_timetableLockAllActivitiesAction_activated()
03235 {
03236        if(!(students_schedule_ready && teachers_schedule_ready && rooms_schedule_ready)){
03237               QMessageBox::information(this, tr("FET information"), tr("Please generate, firstly"));
03238               return;
03239        }
03240 
03241        AdvancedLockUnlockForm::lockAll(this);
03242 }
03243 
03244 void FetMainForm::on_timetableUnlockAllActivitiesAction_activated()
03245 {
03246        if(!(students_schedule_ready && teachers_schedule_ready && rooms_schedule_ready)){
03247               QMessageBox::information(this, tr("FET information"), tr("Please generate, firstly"));
03248               return;
03249        }
03250 
03251        AdvancedLockUnlockForm::unlockAll(this);
03252 }
03253 
03254 void FetMainForm::on_timetableLockActivitiesDayAction_activated()
03255 {
03256        if(!(students_schedule_ready && teachers_schedule_ready && rooms_schedule_ready)){
03257               QMessageBox::information(this, tr("FET information"), tr("Please generate, firstly"));
03258               return;
03259        }
03260 
03261        AdvancedLockUnlockForm::lockDay(this);
03262 }
03263 
03264 void FetMainForm::on_timetableUnlockActivitiesDayAction_activated()
03265 {
03266        if(!(students_schedule_ready && teachers_schedule_ready && rooms_schedule_ready)){
03267               QMessageBox::information(this, tr("FET information"), tr("Please generate, firstly"));
03268               return;
03269        }
03270 
03271        AdvancedLockUnlockForm::unlockDay(this);
03272 }
03273 
03274 void FetMainForm::on_timetableLockActivitiesEndStudentsDayAction_activated()
03275 {
03276        if(!(students_schedule_ready && teachers_schedule_ready && rooms_schedule_ready)){
03277               QMessageBox::information(this, tr("FET information"), tr("Please generate, firstly"));
03278               return;
03279        }
03280 
03281        AdvancedLockUnlockForm::lockEndStudentsDay(this);
03282 }
03283 
03284 void FetMainForm::on_timetableUnlockActivitiesEndStudentsDayAction_activated()
03285 {
03286        if(!(students_schedule_ready && teachers_schedule_ready && rooms_schedule_ready)){
03287               QMessageBox::information(this, tr("FET information"), tr("Please generate, firstly"));
03288               return;
03289        }
03290 
03291        AdvancedLockUnlockForm::unlockEndStudentsDay(this);
03292 }
03293 
03294 void FetMainForm::on_languageAction_activated()
03295 {
03296        QDialog dialog(this);
03297        dialog.setWindowTitle(tr("Please select FET language"));
03298        
03299        QVBoxLayout* taMainLayout=new QVBoxLayout(&dialog);
03300 
03301        QPushButton* tapb1=new QPushButton(tr("Cancel"));
03302        QPushButton* tapb2=new QPushButton(tr("OK"));
03303                             
03304        QHBoxLayout* buttons=new QHBoxLayout();
03305        buttons->addStretch();
03306        buttons->addWidget(tapb1);
03307        buttons->addWidget(tapb2);
03308        
03309        QComboBox* languagesComboBox=new QComboBox();
03310        
03311        QSize tmp=languagesComboBox->minimumSizeHint();
03312        Q_UNUSED(tmp);
03313        
03314        //this is the other place (out of 2) in which you need to add a new language
03315        QMap<QString, QString> languagesMap;
03316        languagesMap.insert("en_US", tr("US English"));
03317        languagesMap.insert("ar", tr("Arabic"));
03318        languagesMap.insert("ca", tr("Catalan"));
03319        languagesMap.insert("de", tr("German"));
03320        languagesMap.insert("el", tr("Greek"));
03321        languagesMap.insert("es", tr("Spanish"));
03322        languagesMap.insert("fr", tr("French"));
03323        languagesMap.insert("hu", tr("Hungarian"));
03324        languagesMap.insert("id", tr("Indonesian"));
03325        languagesMap.insert("it", tr("Italian"));
03326        languagesMap.insert("lt", tr("Lithuanian"));
03327        languagesMap.insert("mk", tr("Macedonian"));
03328        languagesMap.insert("ms", tr("Malay"));
03329        languagesMap.insert("nl", tr("Dutch"));
03330        languagesMap.insert("pl", tr("Polish"));
03331        languagesMap.insert("ro", tr("Romanian"));
03332        languagesMap.insert("tr", tr("Turkish"));
03333        languagesMap.insert("ru", tr("Russian"));
03334        languagesMap.insert("fa", tr("Persian"));
03335        languagesMap.insert("uk", tr("Ukrainian"));
03336        languagesMap.insert("pt_BR", tr("Brazilian Portuguese"));
03337        languagesMap.insert("da", tr("Danish"));
03338        languagesMap.insert("si", tr("Sinhala"));
03339        languagesMap.insert("sk", tr("Slovak"));
03340        languagesMap.insert("he", tr("Hebrew"));
03341        languagesMap.insert("sr", tr("Serbian"));
03342        languagesMap.insert("gl", tr("Galician"));
03343        languagesMap.insert("vi", tr("Vietnamese"));
03344        languagesMap.insert("uz", tr("Uzbek"));
03345        
03346        //assert(languagesMap.count()==N_LANGUAGES);
03347        
03348        QMapIterator<QString, QString> it(languagesMap);
03349        int i=0;
03350        int j=-1;
03351        int eng=-1;
03352        while(it.hasNext()){
03353               it.next();
03354               languagesComboBox->addItem( it.key() + " (" + it.value() + ")" );
03355               if(it.key()==FET_LANGUAGE)
03356                      j=i;
03357               if(it.key()=="en_US")
03358                      eng=i;
03359               i++;
03360        }
03361        assert(eng>=0);
03362        if(j==-1){
03363               QMessageBox::warning(this, tr("FET warning"), tr("Invalid current language - making it en_US (US English)"));
03364               FET_LANGUAGE="en_US";
03365               j=eng;
03366        }
03367        languagesComboBox->setCurrentIndex(j);
03368        
03369        QLabel* label=new QLabel(tr("Please select FET language"));
03370        
03371        QHBoxLayout* languagesLayout=new QHBoxLayout();
03372        languagesLayout->addWidget(languagesComboBox);
03373        //languagesLayout->addStretch();
03374        
03375        taMainLayout->addStretch();
03376        taMainLayout->addWidget(label);
03377        //taMainLayout->addWidget(languagesComboBox);
03378        taMainLayout->addLayout(languagesLayout);
03379        taMainLayout->addStretch();
03380        taMainLayout->addLayout(buttons);
03381 
03382        QObject::connect(tapb2, SIGNAL(clicked()), &dialog, SLOT(accept()));
03383        QObject::connect(tapb1, SIGNAL(clicked()), &dialog, SLOT(reject()));
03384        
03385        tapb2->setDefault(true);
03386        tapb2->setFocus();
03387        
03388        const QString settingsName=QString("LanguageSelectionForm");
03389 
03390        int w=dialog.sizeHint().width();
03391        if(w<350)
03392               w=350;
03393        int h=dialog.sizeHint().height();
03394        if(h<180)
03395               h=180;
03396        dialog.resize(w,h);
03397        centerWidgetOnScreen(&dialog);
03398        restoreFETDialogGeometry(&dialog, settingsName);
03399        
03400        setParentAndOtherThings(&dialog, this);
03401        bool ok=dialog.exec();
03402        saveFETDialogGeometry(&dialog, settingsName);
03403        if(!ok)
03404               return;
03405               
03406        //QString newLang=languagesComboBox->currentText();
03407        int k=languagesComboBox->currentIndex();
03408        i=0;
03409        bool found=false;
03410        QMapIterator<QString, QString> it2(languagesMap);
03411        while(it2.hasNext()){
03412               it2.next();
03413               if(i==k){
03414                      FET_LANGUAGE=it2.key();
03415                      found=true;
03416               }
03417               i++;
03418        }
03419        if(!found){
03420               QMessageBox::warning(this, tr("FET warning"), tr("Invalid language selected - making it en_US (US English)"));
03421               FET_LANGUAGE="en_US";
03422        }
03423        
03424        setLanguage(*pqapplication, this);
03425        setCurrentFile(INPUT_FILENAME_XML);
03426 
03427        //QMessageBox::information(this, tr("FET information"), tr("Language %1 selected").arg( FET_LANGUAGE+" ("+languagesMap.value(FET_LANGUAGE)+")" )+"\n\n"+
03428        // tr("Please exit and restart FET to activate language change"));
03429 }
03430 
03431 void FetMainForm::on_settingsRestoreDefaultsAction_activated()
03432 {
03433        QString default_working_directory="examples";
03434        QDir d2(default_working_directory);
03435        if(!d2.exists())
03436               default_working_directory=QDir::homePath();
03437        else
03438               default_working_directory=d2.absolutePath();
03439 
03440        QString s=tr("Are you sure you want to reset all settings to defaults?");
03441        s+="\n\n";
03442        
03443        s+=tr("That means:");
03444        s+="\n";
03445 
03446        s+=QString("1. ")+tr("The geometry and any other saved settings of all the windows and dialogs will be reset to default");
03447        s+="\n";
03448 
03449        s+=QString("2. ")+tr("Show shortcut buttons in main window will be %1", "%1 is true or false").arg(tr("true"));
03450        s+="\n";
03451 
03452        s+=QString("3. ")+tr("In the shortcuts tab from the main window, the first section will be selected/shown", "Option refers to the main window tab widget for shortcuts, which currently contains 5 tabs: File, Data, "
03453               "Time, Space, Timetable (so it will select/show File tab).");
03454        s+="\n";
03455 
03456        s+=QString("4. ")+tr("Check for updates at startup will be %1", "%1 is true or false").arg(tr("false"));
03457        s+="\n";
03458 
03459        s+=QString("5. ")+tr("Use colors in FET graphical user interface will be %1", "%1 is true or false").arg(tr("false"));
03460        s+="\n";
03461 
03462        s+=QString("6. ")+tr("Language will be %1 (restart needed to activate language change)", "%1 is the default language").arg(QString("en_US")+QString(" (")+tr("US English")+QString(")"));
03463        s+="\n";
03464 
03465        s+=QString("7. ")+tr("The list of recently used files will be cleared");
03466        s+="\n";
03467        
03468        s+=QString("8. ")+tr("Working directory will be %1", "%1 is the directory").arg(QDir::toNativeSeparators(default_working_directory));
03469        s+="\n";
03470 
03471        s+=QString("9. ")+tr("Output directory will be %1", "%1 is the directory").arg(QDir::toNativeSeparators(QDir::homePath()+FILE_SEP+"fet-results"));
03472        s+="\n";
03473 
03474        s+=QString("10. ")+tr("Import directory will be %1", "%1 is the directory").arg(QDir::toNativeSeparators(QDir::homePath()+FILE_SEP+"fet-results"));
03475        s+="\n";
03476 
03477        s+=QString("11. ")+tr("Html level of the timetables will be %1", "%1 is default html level").arg(2);
03478        s+="\n";
03479 
03480        s+=QString("12. ")+tr("Mark not available slots with -x- in timetables will be %1", "%1 is true or false. Lowercase -x-").arg(tr("true"));
03481        s+="\n";
03482 
03483        s+=QString("13. ")+tr("Mark break slots with -X- in timetables will be %1", "%1 is true or false. Uppercase -X-").arg(tr("true"));
03484        s+="\n";
03485 
03486        s+=QString("14. ")+tr("Divide html timetables with time-axis by days will be %1", "%1 is true or false").arg(tr("false"));
03487        s+="\n";
03488 
03489        s+=QString("15. ")+tr("Print activities with same starting time will be %1", "%1 is true or false").arg(tr("false"));
03490        s+="\n";
03491 
03492        s+=QString("16. ")+tr("Enable activity tag max hours daily will be %1", "%1 is true or false").arg(tr("false"));
03493        s+="\n";
03494 
03495        s+=QString("17. ")+tr("Enable students max gaps per day will be %1", "%1 is true or false").arg(tr("false"));
03496        s+="\n";
03497 
03498        s+=QString("18. ")+tr("Warn if using not perfect constraints will be %1", "%1 is true or false. This is a warning if user uses not perfect constraints").arg(tr("true"));
03499        s+="\n";
03500 
03501        s+=QString("19. ")+tr("Enable constraints students min hours daily with empty days will be %1", "%1 is true or false").arg(tr("false"));
03502        s+="\n";
03503 
03504        s+=QString("20. ")+tr("Warn if using constraints students min hours daily with empty days will be %1", "%1 is true or false. This is a warning if user uses a nonstandard constraint"
03505               " students min hours daily with allowed empty days").arg(tr("true"));
03506        s+="\n";
03507 
03509        s+=QString("21. ")+tr("Confirm activity planning will be %1", "%1 is true or false").arg(tr("true"));
03510        s+="\n";
03511        s+=QString("22. ")+tr("Confirm spread activities over the week will be %1", "%1 is true or false").arg(tr("true"));
03512        s+="\n";
03513        s+=QString("23. ")+tr("Confirm remove redundant constraints will be %1", "%1 is true or false").arg(tr("true"));
03514        s+="\n";
03515        s+=QString("24. ")+tr("Confirm save data and timetable as will be %1", "%1 is true or false").arg(tr("true"));
03516        //s+="\n";
03518 
03519        switch( LongTextMessageBox::largeConfirmation( this, tr("FET confirmation"), s,
03520         tr("&Yes"), tr("&No"), QString(), 0 , 1 ) ) {
03521        case 0: // Yes
03522               break;
03523        case 1: // No
03524               return;
03525        }
03526 
03527        QSettings settings(COMPANY, PROGRAM);
03528        settings.clear();
03529        
03530        recentFiles.clear();
03531        updateRecentFileActions();
03532 
03533        resize(ORIGINAL_WIDTH, ORIGINAL_HEIGHT);
03534        //move(ORIGINAL_X, ORIGINAL_Y);
03535        forceCenterWidgetOnScreen(this);
03536        
03537        FET_LANGUAGE="en_US";
03538        
03539        checkForUpdatesAction->setChecked(false);
03540        checkForUpdates=0;
03541        
03542        SHOW_SHORTCUTS_ON_MAIN_WINDOW=true;
03543        settingsShowShortcutsOnMainWindowAction->setChecked(SHOW_SHORTCUTS_ON_MAIN_WINDOW);
03544        tabWidget->setVisible(SHOW_SHORTCUTS_ON_MAIN_WINDOW);
03545        
03546        tabWidget->setCurrentIndex(0);
03547        
03548        USE_GUI_COLORS=false;
03549        settingsUseColorsAction->setChecked(USE_GUI_COLORS);
03550        
03552        CONFIRM_ACTIVITY_PLANNING=true;
03553        settingsConfirmActivityPlanningAction->setChecked(CONFIRM_ACTIVITY_PLANNING);
03554        
03555        CONFIRM_SPREAD_ACTIVITIES=true;
03556        settingsConfirmSpreadActivitiesAction->setChecked(CONFIRM_SPREAD_ACTIVITIES);
03557        
03558        CONFIRM_REMOVE_REDUNDANT=true;
03559        settingsConfirmRemoveRedundantAction->setChecked(CONFIRM_REMOVE_REDUNDANT);
03560        
03561        CONFIRM_SAVE_TIMETABLE=true;
03562        settingsConfirmSaveTimetableAction->setChecked(CONFIRM_SAVE_TIMETABLE);
03564 
03566        ENABLE_ACTIVITY_TAG_MAX_HOURS_DAILY=false;
03567        enableActivityTagMaxHoursDailyAction->setChecked(ENABLE_ACTIVITY_TAG_MAX_HOURS_DAILY);
03568 
03569        ENABLE_STUDENTS_MAX_GAPS_PER_DAY=false;
03570        enableStudentsMaxGapsPerDayAction->setChecked(ENABLE_STUDENTS_MAX_GAPS_PER_DAY);
03571        
03572        SHOW_WARNING_FOR_NOT_PERFECT_CONSTRAINTS=true;
03573        showWarningForNotPerfectConstraintsAction->setChecked(SHOW_WARNING_FOR_NOT_PERFECT_CONSTRAINTS);
03574        
03575        setEnabledIcon(dataTimeConstraintsTeacherActivityTagMaxHoursDailyAction, ENABLE_ACTIVITY_TAG_MAX_HOURS_DAILY);
03576        setEnabledIcon(dataTimeConstraintsTeachersActivityTagMaxHoursDailyAction, ENABLE_ACTIVITY_TAG_MAX_HOURS_DAILY);
03577        setEnabledIcon(dataTimeConstraintsStudentsActivityTagMaxHoursDailyAction, ENABLE_ACTIVITY_TAG_MAX_HOURS_DAILY);
03578        setEnabledIcon(dataTimeConstraintsStudentsSetActivityTagMaxHoursDailyAction, ENABLE_ACTIVITY_TAG_MAX_HOURS_DAILY);
03579 
03580        setEnabledIcon(dataTimeConstraintsStudentsSetMaxGapsPerDayAction, ENABLE_STUDENTS_MAX_GAPS_PER_DAY);
03581        setEnabledIcon(dataTimeConstraintsStudentsMaxGapsPerDayAction, ENABLE_STUDENTS_MAX_GAPS_PER_DAY);
03582 
03583        ENABLE_STUDENTS_MIN_HOURS_DAILY_WITH_ALLOW_EMPTY_DAYS=false;
03584        enableStudentsMinHoursDailyWithAllowEmptyDaysAction->setChecked(ENABLE_STUDENTS_MIN_HOURS_DAILY_WITH_ALLOW_EMPTY_DAYS);
03585 
03586        SHOW_WARNING_FOR_STUDENTS_MIN_HOURS_DAILY_WITH_ALLOW_EMPTY_DAYS=true;
03587        showWarningForStudentsMinHoursDailyWithAllowEmptyDaysAction->setChecked(SHOW_WARNING_FOR_STUDENTS_MIN_HOURS_DAILY_WITH_ALLOW_EMPTY_DAYS);
03588 
03590        
03591        timetablesDivideByDaysAction->setChecked(false);
03592        DIVIDE_HTML_TIMETABLES_WITH_TIME_AXIS_BY_DAYS=false;
03593        
03594        WORKING_DIRECTORY=default_working_directory;
03595        
03596        OUTPUT_DIR=QDir::homePath()+FILE_SEP+"fet-results";
03597        QDir dir;
03598        if(!dir.exists(OUTPUT_DIR))
03599               dir.mkpath(OUTPUT_DIR);
03600        IMPORT_DIRECTORY=OUTPUT_DIR;
03601        
03602        TIMETABLE_HTML_LEVEL=2;
03603        
03604        settingsPrintNotAvailableSlotsAction->setChecked(true);
03605        PRINT_NOT_AVAILABLE_TIME_SLOTS=true;
03606 
03607        settingsPrintBreakSlotsAction->setChecked(true);
03608        PRINT_BREAK_TIME_SLOTS=true;
03609 
03610        settingsPrintActivitiesWithSameStartingTimeAction->setChecked(false);
03611        PRINT_ACTIVITIES_WITH_SAME_STARTING_TIME=false;
03612 
03613        setLanguage(*pqapplication, this);
03614        setCurrentFile(INPUT_FILENAME_XML);
03615 }
03616 
03617 void FetMainForm::on_settingsTimetableHtmlLevelAction_activated()
03618 {
03619        if(simulation_running){
03620               QMessageBox::information(this, tr("FET information"),
03621                      tr("Allocation in course.\nPlease stop simulation before this."));
03622               return;
03623        }
03624 
03625        SettingsTimetableHtmlLevelForm form(this);
03626        setParentAndOtherThings(&form, this);
03627        form.exec();
03628 }
03629 
03630 void FetMainForm::on_settingsPrintNotAvailableSlotsAction_toggled()
03631 {
03632        PRINT_NOT_AVAILABLE_TIME_SLOTS=settingsPrintNotAvailableSlotsAction->isChecked();
03633 }
03634 
03635 void FetMainForm::on_settingsPrintBreakSlotsAction_toggled()
03636 {
03637        PRINT_BREAK_TIME_SLOTS=settingsPrintBreakSlotsAction->isChecked();
03638 }
03639 
03640 void FetMainForm::on_settingsPrintActivitiesWithSameStartingTimeAction_toggled()
03641 {
03642        PRINT_ACTIVITIES_WITH_SAME_STARTING_TIME=settingsPrintActivitiesWithSameStartingTimeAction->isChecked();
03643 }
03644 
03645 void FetMainForm::on_activityPlanningAction_activated()
03646 {
03647        if(simulation_running){
03648               QMessageBox::information(this, tr("FET information"),
03649                      tr("Allocation in course.\nPlease stop simulation before this."));
03650               return;
03651        }
03652 
03653        if(CONFIRM_ACTIVITY_PLANNING){
03654               int confirm;
03655        
03656               ActivityPlanningConfirmationForm c_form(this);
03657               setParentAndOtherThings(&c_form, this);
03658               confirm=c_form.exec();
03659 
03660               if(confirm==QDialog::Accepted){
03661                      if(c_form.dontShowAgain)
03662                             settingsConfirmActivityPlanningAction->setChecked(false);
03663               
03664                      StartActivityPlanning::startActivityPlanning(&c_form);
03665               }
03666        }
03667        else{
03668               StartActivityPlanning::startActivityPlanning(this);
03669        }
03670 }
03671 
03672 void FetMainForm::on_spreadActivitiesAction_activated()
03673 {
03674        if(simulation_running){
03675               QMessageBox::information(this, tr("FET information"),
03676                      tr("Allocation in course.\nPlease stop simulation before this."));
03677               return;
03678        }
03679        
03680        if(gt.rules.nDaysPerWeek>=7){
03681               QString s;
03682               s=tr("You have more than 6 days per week, so probably you won't need this feature. Do you still want to continue?");
03683               
03684               int cfrm=0;
03685               switch( QMessageBox::question( this, tr("FET question"),
03686                s,
03687                tr("&Continue"), tr("&Cancel"), 0 , 1 ) ) {
03688               case 0: // Yes - continue
03689                      cfrm=1;
03690                      break;
03691               case 1: // No - cancel
03692                      cfrm=0;
03693                      break;
03694               }
03695 
03696               if(!cfrm){
03697                      return;
03698               }
03699        }
03700        
03701        if(gt.rules.nDaysPerWeek<=4){
03702               QString s;
03703               s=tr("You have less than 5 days per week, so probably you won't need this feature. Do you still want to continue?");
03704               
03705               int cfrm=0;
03706               switch( QMessageBox::question( this, tr("FET question"),
03707                s,
03708                tr("&Continue"), tr("&Cancel"), 0 , 1 ) ) {
03709               case 0: // Yes - continue
03710                      cfrm=1;
03711                      break;
03712               case 1: // No - cancel
03713                      cfrm=0;
03714                      break;
03715               }
03716 
03717               if(!cfrm){
03718                      return;
03719               }
03720        }
03721        
03722        if(CONFIRM_SPREAD_ACTIVITIES){
03723               int confirm;
03724        
03725               SpreadConfirmationForm c_form(this);
03726               setParentAndOtherThings(&c_form, this);
03727               confirm=c_form.exec();
03728 
03729               if(confirm==QDialog::Accepted){
03730                      if(c_form.dontShowAgain)
03731                             settingsConfirmSpreadActivitiesAction->setChecked(false);
03732                      
03733                      SpreadMinDaysConstraintsFiveDaysForm form(&c_form);
03734                      setParentAndOtherThings(&form, &c_form);
03735                      form.exec();
03736               }
03737        }
03738        else{
03739               SpreadMinDaysConstraintsFiveDaysForm form(this);
03740               setParentAndOtherThings(&form, this);
03741               form.exec();
03742        }
03743 }
03744 
03745 void FetMainForm::on_statisticsExportToDiskAction_activated()
03746 {
03747        if(simulation_running){
03748               QMessageBox::information(this, tr("FET information"),
03749                      tr("Allocation in course.\nPlease stop simulation before this."));
03750               return;
03751        }
03752 
03753        StatisticsExport::exportStatistics(this);
03754 }
03755 
03756 void FetMainForm::on_removeRedundantConstraintsAction_activated()
03757 {
03758        if(simulation_running){
03759               QMessageBox::information(this, tr("FET information"),
03760                      tr("Allocation in course.\nPlease stop simulation before this."));
03761               return;
03762        }
03763        
03764        if(CONFIRM_REMOVE_REDUNDANT){
03765               int confirm;
03766        
03767               RemoveRedundantConfirmationForm c_form(this);
03768               setParentAndOtherThings(&c_form, this);
03769               confirm=c_form.exec();
03770 
03771               if(confirm==QDialog::Accepted){
03772                      if(c_form.dontShowAgain)
03773                             settingsConfirmRemoveRedundantAction->setChecked(false);
03774 
03775                      RemoveRedundantForm form(&c_form);
03776                      setParentAndOtherThings(&form, &c_form);
03777                      form.exec();
03778               }
03779        }
03780        else{
03781               RemoveRedundantForm form(this);
03782               setParentAndOtherThings(&form, this);
03783               form.exec();
03784        }
03785 }
03786 
03787 void FetMainForm::on_selectOutputDirAction_activated()
03788 {
03789        QString od;
03790        
03791        od = QFileDialog::getExistingDirectory(this, tr("Choose results (output) directory"), OUTPUT_DIR);
03792        
03793        if(!od.isNull()){
03794               QFile test(od+FILE_SEP+"test_write_permissions_3.tmp");
03795               bool existedBefore=test.exists();
03796               bool t=test.open(QIODevice::ReadWrite);
03797               //if(!test.exists())
03798               //     t=false;
03799               if(!t){
03800                      QMessageBox::warning(this, tr("FET warning"), tr("You don't have write permissions in this directory"));
03801                      return;
03802               }
03803               test.close();
03804               if(!existedBefore)
03805                      test.remove();
03806        
03807               OUTPUT_DIR=od;
03808        }
03809 }
03810 
03811 void FetMainForm::on_randomSeedAction_activated()
03812 {
03813        RandomSeedDialog dialog(this);
03814        
03815        setParentAndOtherThings(&dialog, this);
03816        int te=dialog.exec();
03817        
03818        if(te==QDialog::Accepted){
03819               int tx=dialog.lineEditX->text().toInt();
03820               if(!(tx>=1 && tx<MM)){
03821                      assert(0);
03822                      //QMessageBox::warning(this, tr("FET warning"), tr("The random seed X component must be at least %1 and at most %2").arg(1).arg(MM-1));
03823                      //return;
03824               }
03825 
03826               int ty=dialog.lineEditY->text().toInt();
03827               if(!(ty>=1 && ty<MMM)){
03828                      assert(0);
03829                      //QMessageBox::warning(this, tr("FET warning"), tr("The random seed Y component must be at least %1 and at most %2").arg(1).arg(MMM-1));
03830                      //return;
03831               }
03832 
03833               XX=tx;
03834               YY=ty;
03835        }
03836 }
03837 
03838 void FetMainForm::enableActivityTagMaxHoursDailyToggled(bool checked)
03839 {
03840        if(checked==true){
03841               QString s=tr("These kinds of constraints are good, but not perfectly optimized. Adding such constraints may make your"
03842                " timetable solve too slow or even impossible.");
03843               s+=" ";
03844               s+=tr("It is recommended to use such constraints only at the end, after you generated successfully with all the other constraints.");
03845               s+="\n\n";
03846               s+=tr("If your timetable is too difficult, it may be from these kinds of constraints, so you may need to remove them and retry.");
03847               s+="\n\n";
03848               s+=tr("Continue only if you know what you are doing.");
03849        
03850               QMessageBox::StandardButton b=QMessageBox::warning(this, tr("FET warning"), s, QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok);
03851        
03852               if(b!=QMessageBox::Ok){
03853                      disconnect(enableActivityTagMaxHoursDailyAction, SIGNAL(toggled(bool)), this, SLOT(enableActivityTagMaxHoursDailyToggled(bool)));
03854                      enableActivityTagMaxHoursDailyAction->setChecked(false);
03855                      connect(enableActivityTagMaxHoursDailyAction, SIGNAL(toggled(bool)), this, SLOT(enableActivityTagMaxHoursDailyToggled(bool)));
03856                      return;
03857               }
03858        }
03859        
03860        ENABLE_ACTIVITY_TAG_MAX_HOURS_DAILY=checked;
03861 
03862        setEnabledIcon(dataTimeConstraintsTeacherActivityTagMaxHoursDailyAction, ENABLE_ACTIVITY_TAG_MAX_HOURS_DAILY);
03863        setEnabledIcon(dataTimeConstraintsTeachersActivityTagMaxHoursDailyAction, ENABLE_ACTIVITY_TAG_MAX_HOURS_DAILY);
03864        setEnabledIcon(dataTimeConstraintsStudentsActivityTagMaxHoursDailyAction, ENABLE_ACTIVITY_TAG_MAX_HOURS_DAILY);
03865        setEnabledIcon(dataTimeConstraintsStudentsSetActivityTagMaxHoursDailyAction, ENABLE_ACTIVITY_TAG_MAX_HOURS_DAILY);
03866 }
03867 
03868 void FetMainForm::enableStudentsMaxGapsPerDayToggled(bool checked)
03869 {
03870        if(checked==true){
03871               QString s=tr("These kinds of constraints are good, but not perfectly optimized. Adding such constraints may make your"
03872                " timetable solve too slow or even impossible.");
03873               s+=" ";
03874               s+=tr("It is recommended to use such constraints only at the end, after you generated successfully with all the other constraints.");
03875               s+="\n\n";
03876               s+=tr("If your timetable is too difficult, it may be from these kinds of constraints, so you may need to remove them and retry.");
03877               s+="\n\n";
03878               s+=tr("Continue only if you know what you are doing.");
03879        
03880               QMessageBox::StandardButton b=QMessageBox::warning(this, tr("FET warning"), s, QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok);
03881        
03882               if(b!=QMessageBox::Ok){
03883                      disconnect(enableStudentsMaxGapsPerDayAction, SIGNAL(toggled(bool)), this, SLOT(enableStudentsMaxGapsPerDayToggled(bool)));
03884                      enableStudentsMaxGapsPerDayAction->setChecked(false);
03885                      connect(enableStudentsMaxGapsPerDayAction, SIGNAL(toggled(bool)), this, SLOT(enableStudentsMaxGapsPerDayToggled(bool)));
03886                      return;
03887               }
03888        }
03889        
03890        ENABLE_STUDENTS_MAX_GAPS_PER_DAY=checked;
03891        
03892        setEnabledIcon(dataTimeConstraintsStudentsSetMaxGapsPerDayAction, ENABLE_STUDENTS_MAX_GAPS_PER_DAY);
03893        setEnabledIcon(dataTimeConstraintsStudentsMaxGapsPerDayAction, ENABLE_STUDENTS_MAX_GAPS_PER_DAY);
03894 }
03895 
03896 void FetMainForm::showWarningForNotPerfectConstraintsToggled(bool checked)
03897 {
03898        if(checked==false){
03899               QString s=tr("It is recommended to keep this warning active, but if you really want, you can disable it.");
03900               s+="\n\n";
03901               s+=tr("Disable it only if you know what you are doing.");
03902               s+="\n\n";
03903               s+=tr("Are you sure you want to disable it?");
03904        
03905               QMessageBox::StandardButton b=QMessageBox::warning(this, tr("FET warning"), s, QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Yes);
03906        
03907               if(b!=QMessageBox::Yes){
03908                      disconnect(showWarningForNotPerfectConstraintsAction, SIGNAL(toggled(bool)), this, SLOT(showWarningForNotPerfectConstraintsToggled(bool)));
03909                      showWarningForNotPerfectConstraintsAction->setChecked(true);
03910                      connect(showWarningForNotPerfectConstraintsAction, SIGNAL(toggled(bool)), this, SLOT(showWarningForNotPerfectConstraintsToggled(bool)));
03911                      return;
03912               }
03913        }
03914        
03915        SHOW_WARNING_FOR_NOT_PERFECT_CONSTRAINTS=checked;
03916 }
03917 
03918 
03919 void FetMainForm::enableStudentsMinHoursDailyWithAllowEmptyDaysToggled(bool checked)
03920 {
03921        if(checked==true){
03922               QString s=tr("This kind of constraint is good, but only in the right case. Adding such constraints in the wrong circumstance may make your"
03923                " timetable solve too slow or even impossible.");
03924               s+="\n\n";
03925               s+=tr("Please use such constraints only if you are sure that there exists a timetable with empty days for students. If your instution requires"
03926                      " each day for the students to be not empty, or if there does not exist a solution with empty days for students, "
03927                      "it is IMPERATIVE (for performance reasons) that you use the standard constraint which does not allow empty days."
03928                      " Otherwise, the timetable may be impossible to find.");
03929               s+="\n\n";
03930               s+=tr("Continue only if you know what you are doing.");
03931        
03932               QMessageBox::StandardButton b=QMessageBox::warning(this, tr("FET warning"), s, QMessageBox::Ok | QMessageBox::Cancel, QMessageBox::Ok);
03933        
03934               if(b!=QMessageBox::Ok){
03935                      disconnect(enableStudentsMinHoursDailyWithAllowEmptyDaysAction, SIGNAL(toggled(bool)), this, SLOT(enableStudentsMinHoursDailyWithAllowEmptyDaysToggled(bool)));
03936                      enableStudentsMinHoursDailyWithAllowEmptyDaysAction->setChecked(false);
03937                      connect(enableStudentsMinHoursDailyWithAllowEmptyDaysAction, SIGNAL(toggled(bool)), this, SLOT(enableStudentsMinHoursDailyWithAllowEmptyDaysToggled(bool)));
03938                      return;
03939               }
03940        }
03941        
03942        ENABLE_STUDENTS_MIN_HOURS_DAILY_WITH_ALLOW_EMPTY_DAYS=checked;
03943 }
03944 
03945 void FetMainForm::showWarningForStudentsMinHoursDailyWithAllowEmptyDaysToggled(bool checked)
03946 {
03947        if(checked==false){
03948               QString s=tr("It is recommended to keep this warning active, but if you really want, you can disable it.");
03949               s+="\n\n";
03950               s+=tr("Disable it only if you know what you are doing.");
03951               s+="\n\n";
03952               s+=tr("Are you sure you want to disable it?");
03953        
03954               QMessageBox::StandardButton b=QMessageBox::warning(this, tr("FET warning"), s, QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Yes);
03955        
03956               if(b!=QMessageBox::Yes){
03957                      disconnect(showWarningForStudentsMinHoursDailyWithAllowEmptyDaysAction, SIGNAL(toggled(bool)), this, SLOT(showWarningForStudentsMinHoursDailyWithAllowEmptyDaysToggled(bool)));
03958                      showWarningForStudentsMinHoursDailyWithAllowEmptyDaysAction->setChecked(true);
03959                      connect(showWarningForStudentsMinHoursDailyWithAllowEmptyDaysAction, SIGNAL(toggled(bool)), this, SLOT(showWarningForStudentsMinHoursDailyWithAllowEmptyDaysToggled(bool)));
03960                      return;
03961               }
03962        }
03963        
03964        SHOW_WARNING_FOR_STUDENTS_MIN_HOURS_DAILY_WITH_ALLOW_EMPTY_DAYS=checked;
03965 }
03966 
03967 
03968 //time constraints
03969 void FetMainForm::on_shortcutAllTimeConstraintsPushButton_clicked()
03970 {
03971        on_dataAllTimeConstraintsAction_activated();
03972 }
03973 
03974 void FetMainForm::on_shortcutAdvancedTimeConstraintsPushButton_clicked()
03975 {
03976        shortcutAdvancedTimeMenu->popup(QCursor::pos());
03977 }
03978 
03979 void FetMainForm::on_shortcutBreakTimeConstraintsPushButton_clicked()
03980 {
03981        on_dataTimeConstraintsBreakTimesAction_activated();
03982 }
03983 
03984 void FetMainForm::on_shortcutTeachersTimeConstraintsPushButton_clicked()
03985 {
03986        menuTeachers_time_constraints->popup(QCursor::pos());
03987 }
03988 
03989 void FetMainForm::on_shortcutStudentsTimeConstraintsPushButton_clicked()
03990 {
03991        menuStudents_time_constraints->popup(QCursor::pos());
03992 }
03993 
03994 void FetMainForm::on_shortcutActivitiesTimeConstraintsPushButton_clicked()
03995 {
03996        menuActivities_time_constraints->popup(QCursor::pos());
03997 }
03998 
03999 
04000 //space constraints
04001 void FetMainForm::on_shortcutAllSpaceConstraintsPushButton_clicked()
04002 {
04003        on_dataAllSpaceConstraintsAction_activated();
04004 }
04005 
04006 void FetMainForm::on_shortcutRoomsSpaceConstraintsPushButton_clicked()
04007 {
04008        menuRooms_space_constraints->popup(QCursor::pos());
04009 }
04010 
04011 void FetMainForm::on_shortcutTeachersSpaceConstraintsPushButton_clicked()
04012 {
04013        menuTeachers_space_constraints->popup(QCursor::pos());
04014 }
04015 
04016 void FetMainForm::on_shortcutStudentsSpaceConstraintsPushButton_clicked()
04017 {
04018        menuStudents_space_constraints->popup(QCursor::pos());
04019 }
04020 
04021 void FetMainForm::on_shortcutSubjectsSpaceConstraintsPushButton_clicked()
04022 {
04023        menuSubjects_space_constraints->popup(QCursor::pos());
04024 }
04025 
04026 void FetMainForm::on_shortcutActivityTagsSpaceConstraintsPushButton_clicked()
04027 {
04028        menuActivity_tags_space_constraints->popup(QCursor::pos());
04029 }
04030 
04031 void FetMainForm::on_shortcutSubjectsAndActivityTagsSpaceConstraintsPushButton_clicked()
04032 {
04033        menuSubjects_and_activity_tags_space_constraints->popup(QCursor::pos());
04034 }
04035 
04036 void FetMainForm::on_shortcutActivitiesSpaceConstraintsPushButton_clicked()
04037 {
04038        menuActivities_space_constraints->popup(QCursor::pos());
04039 }
04040 
04041 //timetable
04042 void FetMainForm::on_shortcutGeneratePushButton_clicked()
04043 {
04044        on_timetableGenerateAction_activated();
04045 }
04046 
04047 void FetMainForm::on_shortcutGenerateMultiplePushButton_clicked()
04048 {
04049        on_timetableGenerateMultipleAction_activated();
04050 }
04051 
04052 void FetMainForm::on_shortcutViewTeachersPushButton_clicked()
04053 {
04054        on_timetableViewTeachersAction_activated();
04055 }
04056 
04057 void FetMainForm::on_shortcutViewStudentsPushButton_clicked()
04058 {
04059        on_timetableViewStudentsAction_activated();
04060 }
04061 
04062 void FetMainForm::on_shortcutViewRoomsPushButton_clicked()
04063 {
04064        on_timetableViewRoomsAction_activated();
04065 }
04066 
04067 void FetMainForm::on_shortcutShowSoftConflictsPushButton_clicked()
04068 {
04069        on_timetableShowConflictsAction_activated();
04070 }
04071 
04072 //data shortcut
04073 void FetMainForm::on_shortcutBasicPushButton_clicked()
04074 {
04075        shortcutBasicMenu->popup(QCursor::pos());
04076 }
04077 
04078 void FetMainForm::on_shortcutSubjectsPushButton_clicked()
04079 {
04080        on_dataSubjectsAction_activated();
04081 }
04082 
04083 void FetMainForm::on_shortcutActivityTagsPushButton_clicked()
04084 {
04085        on_dataActivityTagsAction_activated();
04086 }
04087 
04088 void FetMainForm::on_shortcutTeachersPushButton_clicked()
04089 {
04090        on_dataTeachersAction_activated();
04091 }
04092 
04093 void FetMainForm::on_shortcutStudentsPushButton_clicked()
04094 {
04095        menuStudents->popup(QCursor::pos());
04096 }
04097 
04098 void FetMainForm::on_shortcutActivitiesPushButton_clicked()
04099 {
04100        on_dataActivitiesAction_activated();
04101 }
04102 
04103 void FetMainForm::on_shortcutSubactivitiesPushButton_clicked()
04104 {
04105        on_dataSubactivitiesAction_activated();
04106 }
04107 
04108 void FetMainForm::on_shortcutDataSpacePushButton_clicked()
04109 {
04110        shortcutDataSpaceMenu->popup(QCursor::pos());
04111 }
04112 
04113 void FetMainForm::on_shortcutDataAdvancedPushButton_clicked()
04114 {
04115        shortcutDataAdvancedMenu->popup(QCursor::pos());
04116 }
04117 
04118 //file shortcut
04119 void FetMainForm::on_shortcutNewPushButton_clicked()
04120 {
04121        on_fileNewAction_activated();
04122 }
04123 
04124 void FetMainForm::on_shortcutOpenPushButton_clicked()
04125 {
04126        on_fileOpenAction_activated();
04127 }
04128 
04129 void FetMainForm::on_shortcutOpenRecentPushButton_clicked()
04130 {
04131        fileOpenRecentMenu->popup(QCursor::pos());
04132 }
04133 
04134 void FetMainForm::on_shortcutSavePushButton_clicked()
04135 {
04136        on_fileSaveAction_activated();
04137 }
04138 
04139 void FetMainForm::on_shortcutSaveAsPushButton_clicked()
04140 {
04141        on_fileSaveAsAction_activated();
04142 }