2016-12-24 15:03:37 +00:00
|
|
|
#include "..\Header\MainWindow.h"
|
|
|
|
#include "..\Header\OglViewerWidget.h"
|
|
|
|
#include <QSurfaceFormat>
|
2016-12-31 15:18:35 +00:00
|
|
|
#include <QMessageBox>
|
|
|
|
#include <QFileDialog>
|
|
|
|
|
|
|
|
#define WINDOW_NAME "Mesh Viewer"
|
2016-12-24 15:03:37 +00:00
|
|
|
|
|
|
|
MainWindow::MainWindow(QWidget *parent)
|
|
|
|
: QMainWindow(parent)
|
|
|
|
, ui(new Ui::MainWindowClass)
|
|
|
|
{
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
2016-12-31 15:18:35 +00:00
|
|
|
setWindowTitle(WINDOW_NAME);
|
|
|
|
setWindowIcon(QIcon(":/images/icon.ico"));
|
|
|
|
|
|
|
|
ui->statusBar->showMessage("pre-alpha");
|
|
|
|
|
|
|
|
ui->mainToolBar->addAction("Open File", this, &MainWindow::openFile);
|
|
|
|
ui->mainToolBar->addAction("About File", this, &MainWindow::aboutFile);
|
|
|
|
ui->mainToolBar->addAction("Help", this, &MainWindow::aboutTool);
|
|
|
|
|
2016-12-24 15:03:37 +00:00
|
|
|
QSurfaceFormat format;
|
|
|
|
format.setDepthBufferSize(24);
|
|
|
|
QSurfaceFormat::setDefaultFormat(format);
|
|
|
|
|
2016-12-31 11:31:38 +00:00
|
|
|
setCentralWidget(new OglViewerWidget(this));
|
2016-12-24 15:03:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
MainWindow::~MainWindow()
|
|
|
|
{
|
|
|
|
delete ui;
|
2016-12-31 15:18:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::openFile()
|
|
|
|
{
|
2017-01-03 13:35:09 +00:00
|
|
|
QString fileName = QFileDialog::getOpenFileName(this, "Open File", "", "Mesh (*.msh)");
|
add exe icon,
signal-slot for openFile,
resetView on openFile,
cleanup when open a new file,
triangulate quad poly now correctly, more not working, bug from previous version,
next:
fix 5,6,.. triangulation,
triClothMan, IC Helmet, still buggy,
2017-01-02 11:21:32 +00:00
|
|
|
emit loadFile(fileName.toStdString().c_str());
|
2016-12-31 15:18:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::aboutFile()
|
|
|
|
{
|
|
|
|
QMessageBox* dialog = new QMessageBox(QMessageBox::Information,
|
|
|
|
WINDOW_NAME,
|
|
|
|
"When i find some time, i'll add some information about\nthe file in the detailed text",
|
|
|
|
QMessageBox::StandardButton::Close,
|
|
|
|
this,
|
|
|
|
Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);
|
|
|
|
dialog->setDetailedText("This is the cool detailed text\n");
|
|
|
|
dialog->exec();
|
|
|
|
}
|
|
|
|
|
|
|
|
void MainWindow::aboutTool()
|
|
|
|
{
|
|
|
|
QMessageBox* dialog = new QMessageBox(QMessageBox::Question,
|
|
|
|
WINDOW_NAME,
|
|
|
|
"This is the Pre-Alpha version of my Mesh Viewer\nCheck the detailed information",
|
|
|
|
QMessageBox::StandardButton::Close,
|
|
|
|
this,
|
|
|
|
Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);
|
|
|
|
dialog->setDetailedText("left mouse - rotate\nright mouse - move\nscroll - zoom\nspace - reset view\nesc - close");
|
|
|
|
dialog->exec();
|
2016-12-24 15:03:37 +00:00
|
|
|
}
|