-
Notifications
You must be signed in to change notification settings - Fork 1
/
mlpdialog.cpp
41 lines (36 loc) · 1016 Bytes
/
mlpdialog.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
#include "mlpdialog.h"
#include "ui_mlpdialog.h"
MLPDialog::MLPDialog(QWidget *parent, QMLP *mlp) :
QMainWindow(parent),
ui(new Ui::MLPDialog),
_mlp(mlp)
{
ui->setupUi(this);
connect(ui->Load, &QPushButton::clicked, this, &MLPDialog::load);
connect(ui->Save, &QPushButton::clicked, this, &MLPDialog::save);
connect(ui->Reset, &QPushButton::clicked, this, &MLPDialog::reset);
}
MLPDialog::~MLPDialog()
{
delete ui;
}
void MLPDialog::enable(bool state)
{
ui->Load->setEnabled(state);
ui->Save->setEnabled(state);
ui->Reset->setEnabled(state);
}
void MLPDialog::load()
{
QFile f(QFileDialog::getOpenFileName(this, "Open...", "", "mlp (*.mlp)"));
*_mlp = QMLP::load(&f);
QMessageBox msgBox;
msgBox.setText("MLP and examples loaded.");
msgBox.exec();
emit MLPLoaded();
}
void MLPDialog::save()
{
QFile f(QFileDialog::getSaveFileName(this, "Save as...", "", "mlp (*.mlp)"));
QMLP::save(&f, *_mlp);
}