77 lines
2.2 KiB
C++
77 lines
2.2 KiB
C++
// mainwindow.cpp
|
|
//
|
|
// last-edit-by: J.A. de Jong
|
|
//
|
|
// Description:
|
|
//
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#include "mainwindow.h"
|
|
#include "tasmet_config.h"
|
|
#include "ui_mainwindow.h"
|
|
#include <QString>
|
|
#include <QSettings>
|
|
#include <QWidget>
|
|
#include <QDoubleValidator>
|
|
#include <QIntValidator>
|
|
#include "gas.h"
|
|
#include "tasmet_tracer.h"
|
|
#include "add_duct_dialog.h"
|
|
|
|
TaSMETMainWindow::TaSMETMainWindow():
|
|
window(new Ui::MainWindow())
|
|
{
|
|
|
|
window->setupUi(this);
|
|
|
|
// Restore settings
|
|
QSettings settings(company,appname);
|
|
restoreGeometry(settings.value("geometry").toByteArray());
|
|
restoreState(settings.value("windowState").toByteArray());
|
|
|
|
for(const SystemType& t: SystemType_vec){
|
|
window->systemtype->addItem(SystemTypeToString(t));
|
|
}
|
|
for(const GasType& t: GasType_vec){
|
|
window->gastype->addItem(GasTypeToString(t));
|
|
}
|
|
for(const SegmentType& t: SegmentType_vec){
|
|
window->segmenttype->addItem(SegmentTypeToString(t));
|
|
}
|
|
|
|
window->T0->setText(QString::number(constants::default_T0));
|
|
window->T0->setValidator(new QDoubleValidator(constants::min_T0,
|
|
constants::max_T0,
|
|
constants::field_decimals));
|
|
|
|
window->p0->setText(QString::number(constants::default_p0));
|
|
window->p0->setValidator(new QDoubleValidator(constants::min_p0,
|
|
constants::max_p0,
|
|
constants::field_decimals));
|
|
|
|
|
|
|
|
}
|
|
TaSMETMainWindow::~TaSMETMainWindow(){
|
|
delete window;
|
|
}
|
|
void TaSMETMainWindow::closeEvent(QCloseEvent *event) {
|
|
|
|
// Save window configuration to settings
|
|
QSettings settings(company,appname);
|
|
settings.setValue("geometry", saveGeometry());
|
|
settings.setValue("windowState", saveState());
|
|
|
|
// Forward close event to parent
|
|
QMainWindow::closeEvent(event);
|
|
|
|
}
|
|
void TaSMETMainWindow::on_addsegment_clicked() {
|
|
|
|
AddDuctDialog dialog(0,"hola",this);
|
|
|
|
int rv = dialog.exec();
|
|
|
|
}
|
|
//////////////////////////////////////////////////////////////////////
|