diff --git a/QtMeshViewer/Resources/Resources.qrc b/QtMeshViewer/Resources/Resources.qrc index 7d86385..71e7c0b 100644 --- a/QtMeshViewer/Resources/Resources.qrc +++ b/QtMeshViewer/Resources/Resources.qrc @@ -20,6 +20,11 @@ Z.png screenshot.png wireframe.png - light.png + light_off.png + light_on.png + solid.png + X_disabled.png + Y_disabled.png + Z_disabled.png diff --git a/QtMeshViewer/Resources/StyleSheet.txt b/QtMeshViewer/Resources/StyleSheet.txt index 717dd21..8c7d7b8 100644 --- a/QtMeshViewer/Resources/StyleSheet.txt +++ b/QtMeshViewer/Resources/StyleSheet.txt @@ -1,21 +1,81 @@ -QToolButton#test123 { - color: #000000; +QToolButton { + image: url(:/images/toolbar/placeholder.png); + border-style: none; + padding: 2px; + width: 22px; + height: 22px; } QToolButton:checked { - background-color: #ffffff; - border-style: inset; - border-width: 1px; - border-radius: 5px; - border-color: #b3b3b3; - min-height: 25px + image: url(:/images/toolbar/placeholder.png); + border-style: none; + padding: 2px; + width: 22px; + height: 22px; } QToolButton:hover { border-style: solid; + padding: 1px; border-width: 1px; border-radius: 5px; border-color: #a4daff; min-height: 25px } +QToolButton#openFile { + image: url(:/images/toolbar/open.png); +} + +QToolButton#screenshot { + image: url(:/images/toolbar/screenshot.png); +} + +QToolButton#x { + image: url(:/images/toolbar/X_disabled.png); +} + +QToolButton#x:checked { + image: url(:/images/toolbar/X.png); +} + +QToolButton#y { + image: url(:/images/toolbar/Y_disabled.png); +} + +QToolButton#y:checked { + image: url(:/images/toolbar/Y.png); +} + +QToolButton#z { + image: url(:/images/toolbar/Z_disabled.png); +} + +QToolButton#z:checked { + image: url(:/images/toolbar/Z.png); +} + +QToolButton#wireframe { + image: url(:/images/toolbar/solid.png); +} + +QToolButton#wireframe:checked { + image: url(:/images/toolbar/wireframe.png); +} + +QToolButton#light { + image: url(:/images/toolbar/light_off.png); +} + +QToolButton#light:checked { + image: url(:/images/toolbar/light_on.png); +} + +QToolButton#fileInfo { + image: url(:/images/toolbar/info.png); +} + +QToolButton#help { + image: url(:/images/toolbar/about.png); +} + diff --git a/QtMeshViewer/Resources/X.png b/QtMeshViewer/Resources/X.png index 1faf6ac..8e2fcd7 100644 Binary files a/QtMeshViewer/Resources/X.png and b/QtMeshViewer/Resources/X.png differ diff --git a/QtMeshViewer/Resources/X_disabled.png b/QtMeshViewer/Resources/X_disabled.png new file mode 100644 index 0000000..af3b2e2 Binary files /dev/null and b/QtMeshViewer/Resources/X_disabled.png differ diff --git a/QtMeshViewer/Resources/Y.png b/QtMeshViewer/Resources/Y.png index f702556..1533ff4 100644 Binary files a/QtMeshViewer/Resources/Y.png and b/QtMeshViewer/Resources/Y.png differ diff --git a/QtMeshViewer/Resources/Y_disabled.png b/QtMeshViewer/Resources/Y_disabled.png new file mode 100644 index 0000000..1aa555e Binary files /dev/null and b/QtMeshViewer/Resources/Y_disabled.png differ diff --git a/QtMeshViewer/Resources/Z.png b/QtMeshViewer/Resources/Z.png index 6e3483e..f8d721c 100644 Binary files a/QtMeshViewer/Resources/Z.png and b/QtMeshViewer/Resources/Z.png differ diff --git a/QtMeshViewer/Resources/Z_disabled.png b/QtMeshViewer/Resources/Z_disabled.png new file mode 100644 index 0000000..9b443f9 Binary files /dev/null and b/QtMeshViewer/Resources/Z_disabled.png differ diff --git a/QtMeshViewer/Resources/about.png b/QtMeshViewer/Resources/about.png index 5a97eff..983e632 100644 Binary files a/QtMeshViewer/Resources/about.png and b/QtMeshViewer/Resources/about.png differ diff --git a/QtMeshViewer/Resources/info.png b/QtMeshViewer/Resources/info.png index 56af5b3..c9f43ca 100644 Binary files a/QtMeshViewer/Resources/info.png and b/QtMeshViewer/Resources/info.png differ diff --git a/QtMeshViewer/Resources/light.png b/QtMeshViewer/Resources/light.png deleted file mode 100644 index 16f93e6..0000000 Binary files a/QtMeshViewer/Resources/light.png and /dev/null differ diff --git a/QtMeshViewer/Resources/light_off.png b/QtMeshViewer/Resources/light_off.png new file mode 100644 index 0000000..8a232a2 Binary files /dev/null and b/QtMeshViewer/Resources/light_off.png differ diff --git a/QtMeshViewer/Resources/light_on.png b/QtMeshViewer/Resources/light_on.png new file mode 100644 index 0000000..35bfe41 Binary files /dev/null and b/QtMeshViewer/Resources/light_on.png differ diff --git a/QtMeshViewer/Resources/open.png b/QtMeshViewer/Resources/open.png index dc8662e..e74c135 100644 Binary files a/QtMeshViewer/Resources/open.png and b/QtMeshViewer/Resources/open.png differ diff --git a/QtMeshViewer/Resources/placeholder.png b/QtMeshViewer/Resources/placeholder.png index 9e73a63..7650fee 100644 Binary files a/QtMeshViewer/Resources/placeholder.png and b/QtMeshViewer/Resources/placeholder.png differ diff --git a/QtMeshViewer/Resources/screenshot.png b/QtMeshViewer/Resources/screenshot.png index 8ff5c8e..5976fa1 100644 Binary files a/QtMeshViewer/Resources/screenshot.png and b/QtMeshViewer/Resources/screenshot.png differ diff --git a/QtMeshViewer/Resources/solid.png b/QtMeshViewer/Resources/solid.png new file mode 100644 index 0000000..774d1fc Binary files /dev/null and b/QtMeshViewer/Resources/solid.png differ diff --git a/QtMeshViewer/Resources/wireframe.png b/QtMeshViewer/Resources/wireframe.png index 191b7fe..79db698 100644 Binary files a/QtMeshViewer/Resources/wireframe.png and b/QtMeshViewer/Resources/wireframe.png differ diff --git a/QtMeshViewer/Source/MainWindow.cpp b/QtMeshViewer/Source/MainWindow.cpp index bc322b8..eb8974c 100644 --- a/QtMeshViewer/Source/MainWindow.cpp +++ b/QtMeshViewer/Source/MainWindow.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include "..\Header\FileInterface.h" #define WINDOW_NAME "Mesh Viewer" @@ -32,7 +33,7 @@ MainWindow::MainWindow(QWidget *parent) setupWidgets(); - ui->statusBar->showMessage("MeshViewer by Anakin", 0); + printMessage("MeshViewer by Anakin", 0); m_fileInfo += "Filename: -\nMaterials: -\nVertices: -\nTriangle: -No file is open"; @@ -61,36 +62,46 @@ void MainWindow::setupWidgets() setCentralWidget(viewer); connect(viewer, &OglViewerWidget::sendMessage, this, &MainWindow::printMessage); - QAction *openFile = new QAction(QIcon(":/images/toolbar/open.png"), "Open file", this); - connect(openFile, &QAction::triggered, this, &MainWindow::openFile); - ui->mainToolBar->addAction(openFile); + QToolButton *openFile = new QToolButton(this); + openFile->setObjectName("openFile"); + openFile->setToolTip("open file"); + connect(openFile, &QToolButton::pressed, this, &MainWindow::openFile); + ui->mainToolBar->addWidget(openFile); - QAction *screenShot = new QAction(QIcon(":/images/toolbar/screenshot.png"), "Screenshot", this); - connect(screenShot, &QAction::triggered, this, &MainWindow::takeScreenShot); - ui->mainToolBar->addAction(screenShot); + QToolButton *screenshot = new QToolButton(this); + screenshot->setObjectName("screenshot"); + screenshot->setToolTip("take screenshot"); + connect(screenshot, &QToolButton::pressed, this, &MainWindow::takeScreenShot); + ui->mainToolBar->addWidget(screenshot); ui->mainToolBar->addSeparator(); QSignalMapper* signalMapper = new QSignalMapper(this); - QAction *x = new QAction(QIcon(":/images/toolbar/X.png"), "X", this); + QToolButton *x = new QToolButton(this); + x->setObjectName("x"); + x->setToolTip("x-direction"); x->setCheckable(true); x->setChecked(true); - ui->mainToolBar->addAction(x); + ui->mainToolBar->addWidget(x); - QAction *y = new QAction(QIcon(":/images/toolbar/Y.png"), "Y", this); + QToolButton *y = new QToolButton(this); + y->setObjectName("y"); + y->setToolTip("y-direction"); y->setCheckable(true); y->setChecked(true); - ui->mainToolBar->addAction(y); + ui->mainToolBar->addWidget(y); - QAction *z = new QAction(QIcon(":/images/toolbar/Z.png"), "Z", this); + QToolButton *z = new QToolButton(this); + z->setObjectName("z"); + z->setToolTip("z-direction"); z->setCheckable(true); z->setChecked(true); - ui->mainToolBar->addAction(z); + ui->mainToolBar->addWidget(z); - connect(x, SIGNAL(triggered()), signalMapper, SLOT(map())); - connect(y, SIGNAL(triggered()), signalMapper, SLOT(map())); - connect(z, SIGNAL(triggered()), signalMapper, SLOT(map())); + connect(x, SIGNAL(pressed()), signalMapper, SLOT(map())); + connect(y, SIGNAL(pressed()), signalMapper, SLOT(map())); + connect(z, SIGNAL(pressed()), signalMapper, SLOT(map())); signalMapper->setMapping(x, 1); signalMapper->setMapping(y, 2); @@ -100,32 +111,35 @@ void MainWindow::setupWidgets() ui->mainToolBar->addSeparator(); - QAction *wireframe = new QAction(QIcon(":/images/toolbar/wireframe.png"), "Wireframe", this); + QToolButton *wireframe = new QToolButton(this); + wireframe->setObjectName("wireframe"); + wireframe->setToolTip("wireframe"); wireframe->setCheckable(true); wireframe->setChecked(false); - connect(wireframe, &QAction::triggered, viewer, &OglViewerWidget::toggleWireframe); - ui->mainToolBar->addAction(wireframe); + connect(wireframe, &QToolButton::pressed, viewer, &OglViewerWidget::toggleWireframe); + ui->mainToolBar->addWidget(wireframe); - QAction *light = new QAction(QIcon(":/images/toolbar/light.png"), "Light", this); + QToolButton *light = new QToolButton(this); + light->setObjectName("light"); + light->setToolTip("toggle light"); light->setCheckable(true); light->setChecked(false); - connect(light, &QAction::triggered, viewer, &OglViewerWidget::toggleLight); - ui->mainToolBar->addAction(light); + connect(light, &QToolButton::pressed, viewer, &OglViewerWidget::toggleLight); + ui->mainToolBar->addWidget(light); ui->mainToolBar->addSeparator(); - QAction *fileInfo = new QAction(QIcon(":/images/toolbar/info.png"), "File info", this); - connect(fileInfo, &QAction::triggered, this, &MainWindow::aboutFile); - ui->mainToolBar->addAction(fileInfo); + QToolButton *fileInfo = new QToolButton(this); + fileInfo->setObjectName("fileInfo"); + fileInfo->setToolTip("file info"); + connect(fileInfo, &QToolButton::pressed, this, &MainWindow::aboutFile); + ui->mainToolBar->addWidget(fileInfo); - QAction *help = new QAction(QIcon(":/images/toolbar/about.png"), "Help", this); - connect(help, &QAction::triggered, this, &MainWindow::aboutTool); - ui->mainToolBar->addAction(help); - - QAction *test = new QAction(this); - test->setCheckable(true); - test->setObjectName("test123"); - ui->mainToolBar->addAction(test); + QToolButton *help = new QToolButton(this); + help->setObjectName("help"); + help->setToolTip("help"); + connect(help, &QToolButton::pressed, this, &MainWindow::aboutTool); + ui->mainToolBar->addWidget(help); m_output->setObjectName("output"); m_output->setStyleSheet("QLabel#output{color : white; min-width: 400px; min-height: 50px;}"); diff --git a/QtMeshViewer/Source/MshFile.cpp b/QtMeshViewer/Source/MshFile.cpp index 22f11cc..78ff108 100644 --- a/QtMeshViewer/Source/MshFile.cpp +++ b/QtMeshViewer/Source/MshFile.cpp @@ -572,6 +572,7 @@ void MshFile::analyseClthChunks(Model * dataDestination, std::list for (auto& it : chunkList) { // texture name + //TODO: change this if (!strcmp("CTEX", it->name)) { // read the texture name