Back to index

fet  5.18.0
settingstimetablehtmllevelform.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 "timetable_defs.h"
00019 
00020 #include "settingstimetablehtmllevelform.h"
00021 
00022 extern QApplication* pqapplication;
00023 
00024 #include <QMessageBox>
00025 
00026 SettingsTimetableHtmlLevelForm::SettingsTimetableHtmlLevelForm(QWidget* parent): QDialog(parent)
00027 {
00028        setupUi(this);
00029        
00030        okPushButton->setDefault(true);
00031        
00032        connect(okPushButton, SIGNAL(clicked()), this, SLOT(ok()));
00033        connect(cancelPushButton, SIGNAL(clicked()), this, SLOT(cancel()));
00034        
00035        centerWidgetOnScreen(this);
00036        restoreFETDialogGeometry(this);
00037               
00038        if(TIMETABLE_HTML_LEVEL==0)
00039               level0RadioButton->setChecked(true);
00040        else if(TIMETABLE_HTML_LEVEL==1)
00041               level1RadioButton->setChecked(true);
00042        else if(TIMETABLE_HTML_LEVEL==2)
00043               level2RadioButton->setChecked(true);
00044        else if(TIMETABLE_HTML_LEVEL==3)
00045               level3RadioButton->setChecked(true);
00046        else if(TIMETABLE_HTML_LEVEL==4)
00047               level4RadioButton->setChecked(true);
00048        else if(TIMETABLE_HTML_LEVEL==5)
00049               level5RadioButton->setChecked(true);
00050        else if(TIMETABLE_HTML_LEVEL==6)
00051               level6RadioButton->setChecked(true);
00052 }
00053 
00054 SettingsTimetableHtmlLevelForm::~SettingsTimetableHtmlLevelForm()
00055 {
00056        saveFETDialogGeometry(this);
00057 }
00058 
00059 void SettingsTimetableHtmlLevelForm::ok()
00060 {
00061        int level=-1;
00062        if(level0RadioButton->isChecked())
00063               level=0;
00064        else if(level1RadioButton->isChecked())
00065               level=1;
00066        else if(level2RadioButton->isChecked())
00067               level=2;
00068        else if(level3RadioButton->isChecked())
00069               level=3;
00070        else if(level4RadioButton->isChecked())
00071               level=4;
00072        else if(level5RadioButton->isChecked())
00073               level=5;
00074        else if(level6RadioButton->isChecked())
00075               level=6;
00076        else{
00077               QMessageBox::warning(this, tr("FET warning"), tr("No level selected"));
00078               return;
00079        }
00080        
00081        assert(level>=0);
00082 
00083        if(level>=3){
00084               int t=QMessageBox::information(this, tr("FET information"), tr("This level might generate very large timetables, maybe 1 MB per file"
00085                " and 20 MB for all files of a timetable or even more."
00086                " Are you sure you have enough disk space?"),
00087                QMessageBox::Yes, QMessageBox::Cancel);
00088                                                                        
00089               if(t==QMessageBox::Cancel)
00090                      return;
00091        }
00092        
00093        TIMETABLE_HTML_LEVEL=level;
00094        
00095        this->close();
00096 }
00097 
00098 void SettingsTimetableHtmlLevelForm::cancel()
00099 {
00100        this->close();
00101 }