64 lines
1.8 KiB
C++
64 lines
1.8 KiB
C++
#include "..\Header\MainWindow.h"
|
|
#include "..\Header\OglViewerWidget.h"
|
|
#include <QSurfaceFormat>
|
|
#include <QMessageBox>
|
|
#include <QFileDialog>
|
|
|
|
#define WINDOW_NAME "Mesh Viewer"
|
|
|
|
MainWindow::MainWindow(QWidget *parent)
|
|
: QMainWindow(parent)
|
|
, ui(new Ui::MainWindowClass)
|
|
{
|
|
ui->setupUi(this);
|
|
|
|
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);
|
|
|
|
QSurfaceFormat format;
|
|
format.setDepthBufferSize(24);
|
|
QSurfaceFormat::setDefaultFormat(format);
|
|
|
|
setCentralWidget(new OglViewerWidget(this));
|
|
}
|
|
|
|
MainWindow::~MainWindow()
|
|
{
|
|
delete ui;
|
|
}
|
|
|
|
void MainWindow::openFile()
|
|
{
|
|
QString fileName = QFileDialog::getOpenFileName(this, "Open File", "../Release/Msh", "Mesh (*.msh)");
|
|
emit loadFile(fileName.toStdString().c_str());
|
|
}
|
|
|
|
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();
|
|
} |