tychoGUI  1.0
 All Data Structures Namespaces Files Functions Variables
Public Member Functions | Data Fields | Private Slots | Private Attributes
local_simulation Class Reference

#include <local_simulation.h>

Public Member Functions

 local_simulation (QWidget *parent=0)
 ~local_simulation ()

Data Fields

QStringList parameterfile
QStringList parameterfile_restart

Private Slots

void tycho_exectuable ()
void parameterfile_path ()
void local_simulation_start ()
void local_simulation_restart ()
void local_simulation_stop ()
void readFromStdout ()
void save_log ()
void reset_gui ()
void run_error_gui ()
void open_help ()

Private Attributes

Ui::local_simulationui
QProcess * proc
run_errorpro_run
help_local_simulationmylocal_simulation_help

Detailed Description

Definition at line 14 of file local_simulation.h.


Constructor & Destructor Documentation

local_simulation::local_simulation ( QWidget *  parent = 0)
explicit

Here are the connects on local simulations are defined and called

Definition at line 20 of file local_simulation.cpp.

References Ui_local_simulation::close, Ui_local_simulation::Help, local_simulation_restart(), local_simulation_start(), local_simulation_stop(), open_help(), parameter_file_global, Ui_local_simulation::parameterfile, parameterfile_path(), Ui_local_simulation::parameterfile_text, proc, readFromStdout(), Ui_local_simulation::reset, reset_gui(), Ui_local_simulation::restart, Ui_local_simulation::run, save_log(), Ui_local_simulation::savelog, Ui_local_simulation::setupUi(), Ui_local_simulation::stop, tycho_exe, Ui_local_simulation::tycho_exe, tycho_exectuable(), Ui_local_simulation::tycho_text, and ui.

:
QDialog(parent),
{
ui->setupUi(this);
proc = new QProcess(this);
connect(proc, SIGNAL(readyRead()), this, SLOT(readFromStdout()));
connect(ui->tycho_exe,SIGNAL(clicked()), this, SLOT(tycho_exectuable()));
connect(ui->parameterfile, SIGNAL(clicked()), this, SLOT(parameterfile_path()));
connect(ui->run, SIGNAL(clicked()), this, SLOT(local_simulation_start()));
connect(ui->restart, SIGNAL(clicked()), this, SLOT(local_simulation_restart()));
connect(ui->stop, SIGNAL(clicked()), this, SLOT(local_simulation_stop()));
connect(ui->savelog, SIGNAL(clicked()), this, SLOT(save_log()));
connect(ui->reset, SIGNAL(clicked()), this, SLOT(reset_gui()));
connect(ui->Help, SIGNAL(clicked()), this, SLOT(open_help()));
connect(ui->close, SIGNAL(clicked()), this, SLOT(close()));
QFile file("config_tycho_gui.ini");
if(!file.open(QIODevice::ReadOnly)) {
QMessageBox::information(0, "error", "No config_tycho_gui.ini File found.");
}
QTextStream in(&file);
QString line;
QStringList lines;
while(!in.atEnd()) {
line = in.readLine();
lines.append(line);
}
file.close();
//TYCHO exectubale standard directory found in config_tycho_gui.ini File
tycho_exe = lines.last();
//Automatically enter TYCHO executable and last saved parameterfile
ui->tycho_text->setText(tycho_exe);
}
local_simulation::~local_simulation ( )

Definition at line 64 of file local_simulation.cpp.

References ui.

{
delete ui;
}

Member Function Documentation

void local_simulation::local_simulation_restart ( )
privateslot

Restarting TYCHO with given parameterfile

Definition at line 123 of file local_simulation.cpp.

References parameter_file_global, parameterfile_restart, proc, run_error_gui(), Ui_local_simulation::textBrowser, tycho_exe, and ui.

Referenced by local_simulation().

{
proc->close();
ui->textBrowser->clear();
if (tycho_exe.size()==0){
}
else
{
}
}
void local_simulation::local_simulation_start ( )
privateslot

Starting a local simulation with given executable and parameterfile

Definition at line 100 of file local_simulation.cpp.

References parameter_file_global, parameterfile, proc, run_error_gui(), Ui_local_simulation::textBrowser, tycho_exe, and ui.

Referenced by local_simulation().

{
proc->close();
ui->textBrowser->clear();
parameterfile.clear();
if (tycho_exe.size()==0){
}
else
{
}
}
void local_simulation::local_simulation_stop ( )
privateslot

Stopping a local simulation

Definition at line 146 of file local_simulation.cpp.

References proc.

Referenced by local_simulation().

{
proc->close();
}
void local_simulation::open_help ( )
privateslot

Opens a help window for the local simulatio n

Definition at line 227 of file local_simulation.cpp.

References mylocal_simulation_help.

Referenced by local_simulation().

void local_simulation::parameterfile_path ( )
privateslot

Asking for the parameterfile

Definition at line 85 of file local_simulation.cpp.

References parameter_file_global, Ui_local_simulation::parameterfile_text, and ui.

Referenced by local_simulation().

{
QString parameterfile_QString;
parameterfile_QString = QFileDialog::getOpenFileName(this, tr("The TYCHO Executable"), QString::null);
ui->parameterfile_text->setText(parameterfile_QString);
parameter_file_global=parameterfile_QString;
}
void local_simulation::readFromStdout ( )
privateslot

writes the TYCHO standard out to the textBrowser Widget

Definition at line 155 of file local_simulation.cpp.

References proc, Ui_local_simulation::textBrowser, and ui.

Referenced by local_simulation().

{
ui->textBrowser->append(proc->readAll().constData());
}
void local_simulation::reset_gui ( )
privateslot

Resets the local simulation gui

Definition at line 180 of file local_simulation.cpp.

References parameter_file_global, Ui_local_simulation::parameterfile_text, Ui_local_simulation::textBrowser, tycho_exe, Ui_local_simulation::tycho_text, and ui.

Referenced by local_simulation().

{
QFile file("config_tycho_gui.ini");
if(!file.open(QIODevice::ReadOnly)) {
QMessageBox::information(0, "error", "No config_tycho_gui.ini File found.");
}
//TYCHO exectubale standard directory found in config_tycho_gui.ini File
QTextStream in(&file);
QString line;
QStringList lines;
while(!in.atEnd()) {
line = in.readLine();
lines.append(line);
}
file.close();
//TYCHO exectubale standard directory found in config_tycho_gui.ini File
tycho_exe = lines.last();
//Automatically enter TYCHO executable and last saved parameterfile
ui->tycho_text->setText(tycho_exe);
ui->tycho_text->setText(tycho_exe);
ui->parameterfile_text->setText("");
ui->textBrowser->clear();
}
void local_simulation::run_error_gui ( )
privateslot

Reminder to point to TYCHO executable before starting a local simulation

Definition at line 218 of file local_simulation.cpp.

References pro_run.

Referenced by local_simulation_restart(), and local_simulation_start().

{
pro_run->show();
}
void local_simulation::save_log ( )
privateslot

Let you save the output in a text file

Definition at line 163 of file local_simulation.cpp.

References Ui_local_simulation::textBrowser, and ui.

Referenced by local_simulation().

{
QString txtfile = QFileDialog::getSaveFileName(this, tr("Save TYCHO Simulation Logfile"), ":", tr("logfile (*.txt)"));
QFile file(txtfile);
if (file.open(QFile::WriteOnly | QFile::Truncate)) {
QTextStream out(&file);
out << ui->textBrowser->toPlainText();
}
}
void local_simulation::tycho_exectuable ( )
privateslot

asking for the TYCHO executable

Definition at line 72 of file local_simulation.cpp.

References tycho_exe, Ui_local_simulation::tycho_text, and ui.

Referenced by local_simulation().

{
tycho_exe.clear();
tycho_exe = QFileDialog::getOpenFileName(this, tr("The TYCHO Executable"), QString::null);
ui->tycho_text->setText(tycho_exe);
}

Field Documentation

help_local_simulation* local_simulation::mylocal_simulation_help
private

Definition at line 31 of file local_simulation.h.

Referenced by open_help().

QStringList local_simulation::parameterfile

Definition at line 22 of file local_simulation.h.

Referenced by local_simulation_start().

QStringList local_simulation::parameterfile_restart

Definition at line 23 of file local_simulation.h.

Referenced by local_simulation_restart().

run_error* local_simulation::pro_run
private

Definition at line 29 of file local_simulation.h.

Referenced by run_error_gui().

QProcess* local_simulation::proc
private

Definition at line 27 of file local_simulation.h.

Referenced by local_simulation(), local_simulation_restart(), local_simulation_start(), local_simulation_stop(), and readFromStdout().

Ui::local_simulation* local_simulation::ui
private

Definition at line 26 of file local_simulation.h.

Referenced by local_simulation(), local_simulation_restart(), local_simulation_start(), parameterfile_path(), readFromStdout(), reset_gui(), save_log(), tycho_exectuable(), and ~local_simulation().


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