Back to index

fet  5.18.0
institutionnameform.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) 2005 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 #include "timetable.h"
00020 #include "fet.h"
00021 
00022 #include "institutionnameform.h"
00023 
00024 #include <QMessageBox>
00025 
00026 extern Timetable gt;
00027 
00028 extern bool simulation_running;
00029 
00030 InstitutionNameForm::InstitutionNameForm(QWidget* parent): QDialog(parent)
00031 {
00032        setupUi(this);
00033        
00034        okPushButton->setDefault(true);
00035 
00036        connect(cancelPushButton, SIGNAL(clicked()), this, SLOT(cancel()));
00037        connect(okPushButton, SIGNAL(clicked()), this, SLOT(ok()));
00038 
00039        centerWidgetOnScreen(this);
00040        restoreFETDialogGeometry(this);
00041        
00042        institutionNameLineEdit->setText(gt.rules.institutionName);
00043        institutionNameLineEdit->selectAll();
00044        institutionNameLineEdit->setFocus();
00045 }
00046 
00047 InstitutionNameForm::~InstitutionNameForm()
00048 {
00049        saveFETDialogGeometry(this);
00050 }
00051 
00052 void InstitutionNameForm::ok()
00053 {
00054        if(!simulation_running)
00055               gt.rules.setInstitutionName(institutionNameLineEdit->text());
00056        else{
00057               QMessageBox::information(this, tr("FET information"),
00058                      tr("Cannot update institution name during simulation\n"
00059                      "Please stop simulation before this"));
00060               return;
00061        }
00062 
00063        this->close();
00064 }
00065 
00066 void InstitutionNameForm::cancel()
00067 {
00068        this->close();
00069 }