-
Notifications
You must be signed in to change notification settings - Fork 22
/
MainWindow.cpp
58 lines (52 loc) · 1.89 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
#include "MainWindow.h"
#include "ui_MainWindow.h"
#include "GLCanvas.h"
#include "Dialog/NewCubeDialog.h"
#include "Dialog/NewCylinderDialog.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
connect(ui->actionCreate_Cube, SIGNAL(triggered(bool)), this, SLOT(onCreateNewCube(bool)));
connect(ui->actionCreate_Cylinder, SIGNAL(triggered(bool)), this, SLOT(onCreateNewCylinder(bool)));
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::onCreateNewCube(bool)
{
NewCubeDialog *newCubeDialog=new NewCubeDialog(this);
if (newCubeDialog->exec() == QDialog::Accepted)
{
Scene::scene->newCube(newCubeDialog->getX(), newCubeDialog->getY(), newCubeDialog->getZ(),
newCubeDialog->getLength(), newCubeDialog->getWidth(), newCubeDialog->getHeight(),
newCubeDialog->getSegmentX(), newCubeDialog->getSegmentY(), newCubeDialog->getSegmentZ());
}
newCubeDialog->deleteLater();
}
void MainWindow::onCreateNewCylinder(bool)
{
NewCylinderDialog *newCylinderDialog = new NewCylinderDialog(this);
if (newCylinderDialog->exec() == QDialog::Accepted)
{
AxisMode axis = AxisMode::axisZ;
switch(newCylinderDialog->getAxis())
{
case 0:
axis = AxisMode::axisX;
break;
case 1:
axis = AxisMode::axisY;
break;
case 2:
default:
axis = AxisMode::axisZ;
}
Scene::scene->newCylinder(newCylinderDialog->getX(), newCylinderDialog->getY(), newCylinderDialog->getZ(),
newCylinderDialog->getRadius(), newCylinderDialog->getHeight(), axis._value,
newCylinderDialog->getSegmentA(), newCylinderDialog->getSegmentR(), newCylinderDialog->getSegmentH());
}
newCylinderDialog->deleteLater();
}