Back to index

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