some buttons added
This commit is contained in:
parent
44e36b8b0d
commit
b58b7c47e5
@ -14,6 +14,8 @@ public:
|
||||
private:
|
||||
Ui::MainWindowClass* ui;
|
||||
int m_curSeverity;
|
||||
void setupWidgets();
|
||||
|
||||
|
||||
private slots:
|
||||
void openFile();
|
||||
|
@ -57,5 +57,8 @@ private:
|
||||
|
||||
private slots:
|
||||
void resetView();
|
||||
|
||||
public slots:
|
||||
void changeDirection(int direction);
|
||||
};
|
||||
|
||||
|
@ -126,7 +126,7 @@ void GeometryEngine::loadTexture(const char* filePath, const char* fileName)
|
||||
img = loadTga((std::string(filePath) + std::string(fileName)).c_str(), loadSuccess);
|
||||
|
||||
//TODO: emit if not successfull
|
||||
if (!loadSuccess)
|
||||
if (loadSuccess)
|
||||
{
|
||||
QString msg = "WARNING: texture not found or corrupted: ";
|
||||
msg += QString(fileName);
|
||||
|
@ -5,6 +5,8 @@
|
||||
#include <QFileDialog>
|
||||
#include <QFile>
|
||||
#include <QPalette>
|
||||
#include <QAction>
|
||||
#include <QSignalMapper>
|
||||
#include "..\Header\FileInterface.h"
|
||||
|
||||
#define WINDOW_NAME "Mesh Viewer"
|
||||
@ -19,15 +21,11 @@ MainWindow::MainWindow(QWidget *parent)
|
||||
setWindowTitle(WINDOW_NAME);
|
||||
setWindowIcon(QIcon(":/images/icon.ico"));
|
||||
|
||||
ui->mainToolBar->addAction("Open File", this, &MainWindow::openFile);
|
||||
ui->mainToolBar->addAction("File Info", this, &MainWindow::aboutFile);
|
||||
ui->mainToolBar->addAction("Help", this, &MainWindow::aboutTool);
|
||||
|
||||
QSurfaceFormat format;
|
||||
format.setDepthBufferSize(24);
|
||||
QSurfaceFormat::setDefaultFormat(format);
|
||||
|
||||
setCentralWidget(new OglViewerWidget(this));
|
||||
setupWidgets();
|
||||
|
||||
ui->statusBar->showMessage("MeshViewer by Anakin", 0);
|
||||
}
|
||||
@ -43,6 +41,54 @@ void MainWindow::openFile()
|
||||
emit loadFile(fileName.toStdString().c_str());
|
||||
}
|
||||
|
||||
void MainWindow::setupWidgets()
|
||||
{
|
||||
OglViewerWidget* viewer = new OglViewerWidget(this);
|
||||
setCentralWidget(viewer);
|
||||
|
||||
QAction *openFile = new QAction("Open file", this);
|
||||
connect(openFile, &QAction::triggered, this, &MainWindow::openFile);
|
||||
ui->mainToolBar->addAction(openFile);
|
||||
|
||||
QSignalMapper* signalMapper = new QSignalMapper(this);
|
||||
|
||||
QAction *x = new QAction("X", this);
|
||||
x->setCheckable(true);
|
||||
x->setChecked(true);
|
||||
ui->mainToolBar->addAction(x);
|
||||
|
||||
QAction *y = new QAction("Y", this);
|
||||
y->setCheckable(true);
|
||||
y->setChecked(true);
|
||||
ui->mainToolBar->addAction(y);
|
||||
|
||||
QAction *z = new QAction("Z", this);
|
||||
z->setCheckable(true);
|
||||
z->setChecked(true);
|
||||
ui->mainToolBar->addAction(z);
|
||||
|
||||
connect(x, SIGNAL(triggered()), signalMapper, SLOT(map()));
|
||||
connect(y, SIGNAL(triggered()), signalMapper, SLOT(map()));
|
||||
connect(z, SIGNAL(triggered()), signalMapper, SLOT(map()));
|
||||
|
||||
signalMapper->setMapping(x, 1);
|
||||
signalMapper->setMapping(y, 2);
|
||||
signalMapper->setMapping(z, 3);
|
||||
|
||||
connect(signalMapper, SIGNAL(mapped(int)), viewer, SLOT(changeDirection(int)));
|
||||
|
||||
|
||||
QAction *fileInfo = new QAction("File info", this);
|
||||
connect(fileInfo, &QAction::triggered, this, &MainWindow::aboutFile);
|
||||
ui->mainToolBar->addAction(fileInfo);
|
||||
|
||||
QAction *help = new QAction("Help", this);
|
||||
connect(help, &QAction::triggered, this, &MainWindow::aboutTool);
|
||||
ui->mainToolBar->addAction(help);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::aboutFile()
|
||||
{
|
||||
QMessageBox* dialog = new QMessageBox(QMessageBox::Information,
|
||||
|
@ -211,3 +211,12 @@ void OglViewerWidget::resetView()
|
||||
m_translation = { 0.0, 0.0, DEFAULT_Z_DISTANCE };
|
||||
update();
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
// public slots
|
||||
|
||||
void OglViewerWidget::changeDirection(int direction)
|
||||
{
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user