-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmainwindow.cpp
54 lines (47 loc) · 1.28 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
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QFileDialog>
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_loadButton_clicked()
{
QString fileName = QFileDialog::getOpenFileName(this,tr("Open Keyframe"),"",tr("Keyframe (*.txt);;All Files (*)"));
if(fileName.isEmpty())
return;
const char *str;;
QByteArray ba;
ba = fileName.toLatin1();
str = ba.data();
ui->openGLWidget->loadAnglesFromFile(str);
}
void MainWindow::on_recordFrameButton_clicked()
{
ui->openGLWidget->recordActiveScene(ui->intervalBox->value());
}
void MainWindow::on_saveButton_clicked()
{
QString fileName = QFileDialog::getSaveFileName(this,tr("Save frames"),"",tr("Frame Collection (*.txt);;All Files (*)"));
if(fileName.isEmpty())
return;
const char *str;;
QByteArray ba;
ba = fileName.toLatin1();
str = ba.data();
std::ofstream of;
of.open(str);
of << ui->openGLWidget->dump();
of.close();
}
void MainWindow::on_changeFrameButton_clicked()
{
int nn = ui->changeFrameEdit->text().toInt();
ui->openGLWidget->changeActiveFrame(nn);
}