-
Notifications
You must be signed in to change notification settings - Fork 1
/
mainwindow.cpp
93 lines (72 loc) · 2.86 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#include "mainwindow.h"
MainWindow::MainWindow()
{
glwidget = new GLWidget();
setWindowTitle("Contour Chaining for Stroke Stylization" );
//set screen size
QRect screenSize = QApplication::desktop()->screenGeometry();
setGeometry(100, 100, screenSize.width()-200, screenSize.height()-200);
splitter = new QSplitter();
splitter->addWidget(glwidget);
splitter->addWidget(glwidget->w);
setCentralWidget(splitter);
// glutDisplayFunc( myGlutDisplay );
// GLUI_Master.set_glutReshapeFunc( myGlutReshape );
// GLUI_Master.set_glutKeyboardFunc( myGlutKeyboard );
// GLUI_Master.set_glutSpecialFunc( NULL );
// GLUI_Master.set_glutMouseFunc( myGlutMouse );
// glutMotionFunc( myGlutMotion );
// glutPassiveMotionFunc( myGlutPassiveMotion);
// ilInit();
// iluInit();
// ilutRenderer(ILUT_OPENGL);
/*** Create the side subwindow ***/
// glui = GLUI_Master.create_glui_subwindow( main_window,
// GLUI_SUBWINDOW_RIGHT );
// glutInitDisplayMode( GLUT_RGB | GLUT_DOUBLE);
// glutInitWindowPosition( 50, 50 );
// glutInitWindowSize( 1000, 800 );
/**** Link windows to GLUI, and register idle callback ******/
// glui->set_main_gfx_window( main_window );
/**** We register the idle callback with GLUI, *not* with GLUT ****/
// GLUI_Master.set_glutIdleFunc( myGlutIdle );
CreateMenus();
}
void MainWindow::CreateMenus()
{
openObjAct = new QAction(tr("&Open OBJ"), this);
openObjAct->setShortcuts(QKeySequence::Open);
openObjAct->setStatusTip(tr("Open an OBJ file"));
connect(openObjAct, &QAction::triggered, this, &MainWindow::openObj);
openBrushObjAct = new QAction(tr("&Open Brush OBJ"), this);
openBrushObjAct->setShortcuts(QKeySequence::Open);
openBrushObjAct->setStatusTip(tr("Open an OBJ file to be used as brush geometry"));
connect(openBrushObjAct, &QAction::triggered, this, &MainWindow::openBrushObj);
exitAct = new QAction(tr("E&xit"), this);
exitAct->setShortcuts(QKeySequence::Quit);
exitAct->setStatusTip(tr("Open an OBJ file"));
connect(exitAct, &QAction::triggered, this, &MainWindow::exit);
fileMenu = menuBar()->addMenu(tr("&File"));
fileMenu->addAction(openObjAct);
fileMenu->addAction(openBrushObjAct);
fileMenu->addSeparator();
fileMenu->addAction(exitAct);
}
void MainWindow::openObj()
{
QString fileName = QFileDialog::getOpenFileName(this, tr("Open OBJ file"), "", tr("Wavefront OBJ (*.obj);;All Files (*)"));
if (!fileName.isNull()) {
glwidget->LoadOBJ(fileName);
}
}
void MainWindow::openBrushObj()
{
QString fileName = QFileDialog::getOpenFileName(this, tr("Open Brush OBJ file"), "", tr("Wavefront OBJ (*.obj);;All Files (*)"));
if (!fileName.isNull()) {
glwidget->LoadBrushOBJ(fileName);
}
}
void MainWindow::exit()
{
QApplication::quit();
}