X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=src%2Fwindow.cpp;h=2d809bfb0610c8a3924213148528d9693c377c22;hb=9cc3bd82e832f5d49911048d6dc053e177922abf;hp=6b125636027a33836aa0ef234972abf964113cc3;hpb=a396e030e8c05f35422ae5d9046149a26553f77c;p=fstl
diff --git a/src/window.cpp b/src/window.cpp
index 6b12563..2d809bf 100644
--- a/src/window.cpp
+++ b/src/window.cpp
@@ -7,10 +7,18 @@
#include "loader.h"
Window::Window(QWidget *parent) :
- QMainWindow(parent)
+ QMainWindow(parent),
+ open_action(new QAction("Open", this)),
+ about_action(new QAction("About", this)),
+ quit_action(new QAction("Quit", this))
+
{
setWindowTitle("fstl");
+ QFile styleFile(":/qt/style.qss");
+ styleFile.open( QFile::ReadOnly );
+ setStyleSheet(styleFile.readAll());
+
QGLFormat format;
format.setVersion(2, 1);
format.setSampleBuffers(true);
@@ -18,19 +26,16 @@ Window::Window(QWidget *parent) :
canvas = new Canvas(format, this);
setCentralWidget(canvas);
- open_action = new QAction("Open", this);
open_action->setShortcut(QKeySequence::Open);
- QObject::connect(open_action, SIGNAL(triggered()),
- this, SLOT(on_open()));
+ QObject::connect(open_action, &QAction::triggered,
+ this, &Window::on_open);
- quit_action = new QAction("Quit", this);
quit_action->setShortcut(QKeySequence::Quit);
- QObject::connect(quit_action, SIGNAL(triggered()),
- this, SLOT(close()));
+ QObject::connect(quit_action, &QAction::triggered,
+ this, &Window::close);
- about_action = new QAction("About", this);
- QObject::connect(about_action, SIGNAL(triggered()),
- this, SLOT(on_about()));
+ QObject::connect(about_action, &QAction::triggered,
+ this, &Window::on_about);
auto file_menu = menuBar()->addMenu("File");
file_menu->addAction(open_action);
@@ -54,36 +59,72 @@ void Window::on_open()
void Window::on_about()
{
- QMessageBox::about(this, "About fstl", "fstl
"
- "A fast viewer for .stl
files.
"
- "https://github.com/mkeeter/fstl
"
- "© 2014 Matthew Keeter
"
- "matt.j.keeter@gmail.com
");
+ QMessageBox::about(this, "",
+ "
fstl
" + "A fast viewer for .stl
files.
"
+ "https://github.com/mkeeter/fstl
© 2014 Matthew Keeter
"
+ "matt.j.keeter@gmail.com
.stl
file.stl
and retry");
}
+void Window::on_bad_stl()
+{
+ QMessageBox::critical(this, "Error",
+ "Error:.stl
file is invalid or corrupted.