/
mainwindow.cpp
71 lines (57 loc) · 2.05 KB
/
mainwindow.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include <QtGui>
#include "mainwindow.h"
#include "renderarea.h"
MainWindow::MainWindow(QWidget *parent) :
QWidget(parent)
{
renderArea = new RenderArea;
qEdit1 = new QLineEdit(tr("Path..."));
//qEdit1->text(tr("Path..."));
qLabel1 = new QLabel(tr("&Input file:"));
qLabel1->setBuddy(qEdit1);
qButton1 = new QPushButton(tr("&Browse"));
connect(qButton1, SIGNAL(clicked()), this, SLOT(browse()));
QGridLayout *mainLayout = new QGridLayout;
mainLayout->setColumnStretch(0, 1);
mainLayout->setColumnStretch(3, 1);
mainLayout->setRowMinimumHeight(1, 6);
mainLayout->addWidget(qLabel1, 2, 1, Qt::AlignRight);
mainLayout->addWidget(qEdit1, 2, 2, Qt::AlignRight);
mainLayout->addWidget(qButton1, 2, 3, Qt::AlignRight);
mainLayout->addWidget(renderArea, 3, 0, 1, 4);
setLayout(mainLayout);
setWindowTitle(tr("L6V14_oapsois"));
this->setMinimumHeight(100);
this->setMinimumWidth(300);
mLogic = new MLogic();
}
MainWindow::~MainWindow()
{
delete renderArea;
delete qEdit1;
delete qLabel1;
delete qButton1;
}
void MainWindow::browse()
{
QString filepath = QFileDialog::getOpenFileName(this,tr("Select input datafile"),QDir::currentPath());
if (!filepath.isEmpty()) {
qEdit1->setText(filepath);
std::string str = std::string(filepath.toAscii().data());
const char * stuff = str.c_str();
mLogic->SetFN(stuff);
mLogic->eval();
n=mLogic->GetN();
m=mLogic->GetM();
gridt=mLogic->GetGridT();
//this->resize(n*50,m*50+75);
this->setFixedSize(m*50+25,n*50+75);
renderArea->setSize(n,m);
renderArea->setGridT(n,m,gridt);
renderArea->setEPath(n,m,mLogic->GetEPath());
renderArea->setParams(n,m,mLogic->GetParams());
renderArea->repaint();
//B->eval(A->GetXArray(),A->GetYArray(),A->GetN(),A->GetTriangles(),stuff,
// A->GetTArray(),A->GetX(),A->GetY(),A->GetResultTemp());
}
}