diff --git a/exe/fstl.ico b/exe/fstl.ico new file mode 100644 index 0000000..2e2d891 Binary files /dev/null and b/exe/fstl.ico differ diff --git a/exe/fstl.rc b/exe/fstl.rc new file mode 100644 index 0000000..3620f29 --- /dev/null +++ b/exe/fstl.rc @@ -0,0 +1 @@ +IDI_ICON1 ICON DISCARDABLE "fstl.ico" diff --git a/qt/fstl.pro b/qt/fstl.pro index 950c376..7a0f449 100644 --- a/qt/fstl.pro +++ b/qt/fstl.pro @@ -32,6 +32,15 @@ RESOURCES += \ qt.qrc \ ../gl/gl.qrc -QMAKE_INFO_PLIST = ../app/Info.plist +macx { + QMAKE_INFO_PLIST = ../app/Info.plist + ICON = ../app/fstl.icns +} -ICON = ../app/fstl.icns +win32 { + RC_FILE = ../exe/fstl.rc +} + +static { + CONFIG += static +} diff --git a/src/backdrop.cpp b/src/backdrop.cpp index 7975f72..13d0aa3 100644 --- a/src/backdrop.cpp +++ b/src/backdrop.cpp @@ -2,6 +2,8 @@ Backdrop::Backdrop() { + initializeGLFunctions(); + shader.addShaderFromSourceFile(QGLShader::Vertex, ":/gl/quad.vert"); shader.addShaderFromSourceFile(QGLShader::Fragment, ":/gl/quad.frag"); shader.link(); diff --git a/src/backdrop.h b/src/backdrop.h index 53e0074..a2398c8 100644 --- a/src/backdrop.h +++ b/src/backdrop.h @@ -1,10 +1,11 @@ #ifndef BACKDROP_H #define BACKDROP_H +#include #include #include -class Backdrop +class Backdrop : protected QGLFunctions { public: Backdrop(); diff --git a/src/canvas.cpp b/src/canvas.cpp index 4c31c6c..03f9376 100644 --- a/src/canvas.cpp +++ b/src/canvas.cpp @@ -41,8 +41,16 @@ void Canvas::set_status(const QString &s) update(); } +void Canvas::clear_status() +{ + status = ""; + update(); +} + void Canvas::initializeGL() { + initializeGLFunctions(); + mesh_shader.addShaderFromSourceFile(QGLShader::Vertex, ":/gl/mesh.vert"); mesh_shader.addShaderFromSourceFile(QGLShader::Fragment, ":/gl/mesh.frag"); mesh_shader.link(); diff --git a/src/canvas.h b/src/canvas.h index 6507dca..64a8dd5 100644 --- a/src/canvas.h +++ b/src/canvas.h @@ -3,6 +3,7 @@ #include #include +#include #include #include @@ -10,7 +11,7 @@ class GLMesh; class Mesh; class Backdrop; -class Canvas : public QGLWidget +class Canvas : public QGLWidget, protected QGLFunctions { Q_OBJECT @@ -23,6 +24,7 @@ public: public slots: void set_status(const QString& s); + void clear_status(); void load_mesh(Mesh* m); diff --git a/src/glmesh.cpp b/src/glmesh.cpp index 8e0cab3..7053809 100644 --- a/src/glmesh.cpp +++ b/src/glmesh.cpp @@ -4,6 +4,8 @@ GLMesh::GLMesh(const Mesh* const mesh) : vertices(QGLBuffer::VertexBuffer), indices(QGLBuffer::IndexBuffer) { + initializeGLFunctions(); + vertices.create(); indices.create(); diff --git a/src/glmesh.h b/src/glmesh.h index 01bf921..74a193f 100644 --- a/src/glmesh.h +++ b/src/glmesh.h @@ -2,10 +2,11 @@ #define GLMESH_H #include +#include class Mesh; -class GLMesh +class GLMesh : protected QGLFunctions { public: GLMesh(const Mesh* const mesh); diff --git a/src/window.cpp b/src/window.cpp index 203fff9..15ffb03 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -69,6 +69,16 @@ void Window::on_about() " style=\"color: #93a1a1;\">matt.j.keeter@gmail.com

"); } +void Window::enable_open() +{ + open_action->setEnabled(true); +} + +void Window::disable_open() +{ + open_action->setEnabled(false); +} + bool Window::load_stl(const QString& filename) { if (!open_action->isEnabled()) return false; @@ -77,7 +87,7 @@ bool Window::load_stl(const QString& filename) Loader* loader = new Loader(this, filename); connect(loader, &Loader::started, - [=](){ open_action->setEnabled(false); }); + this, &Window::disable_open); connect(loader, &Loader::got_mesh, canvas, &Canvas::load_mesh); @@ -85,14 +95,14 @@ bool Window::load_stl(const QString& filename) connect(loader, &Loader::finished, loader, &Loader::deleteLater); connect(loader, &Loader::finished, - [=](){ open_action->setEnabled(true); }); + this, &Window::enable_open); connect(loader, &Loader::finished, - [=](){ canvas->set_status(""); }); + canvas, &Canvas::clear_status); if (filename[0] != ':') { connect(loader, &Loader::loaded_file, - this, &Window::setWindowTitle); + this, &Window::setWindowTitle); } loader->start(); diff --git a/src/window.h b/src/window.h index 866e103..22c35cb 100644 --- a/src/window.h +++ b/src/window.h @@ -16,6 +16,9 @@ public slots: void on_open(); void on_about(); + void enable_open(); + void disable_open(); + private: QAction* const open_action; QAction* const about_action;