Merge branch 'win32'

This commit is contained in:
Matt Keeter 2014-03-21 22:02:42 -04:00
commit 3cd76f9306
11 changed files with 48 additions and 9 deletions

BIN
exe/fstl.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 361 KiB

1
exe/fstl.rc Normal file
View file

@ -0,0 +1 @@
IDI_ICON1 ICON DISCARDABLE "fstl.ico"

View file

@ -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
}

View file

@ -2,6 +2,8 @@
Backdrop::Backdrop()
{
initializeGLFunctions();
shader.addShaderFromSourceFile(QGLShader::Vertex, ":/gl/quad.vert");
shader.addShaderFromSourceFile(QGLShader::Fragment, ":/gl/quad.frag");
shader.link();

View file

@ -1,10 +1,11 @@
#ifndef BACKDROP_H
#define BACKDROP_H
#include <QtOpenGL/QGLFunctions>
#include <QtOpenGL/QGLShaderProgram>
#include <QtOpenGL/QGLBuffer>
class Backdrop
class Backdrop : protected QGLFunctions
{
public:
Backdrop();

View file

@ -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();

View file

@ -3,6 +3,7 @@
#include <QWidget>
#include <QtOpenGL/QGLWidget>
#include <QtOpenGL/QGLFunctions>
#include <QtOpenGL/QGLShaderProgram>
#include <QMatrix4x4>
@ -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);

View file

@ -4,6 +4,8 @@
GLMesh::GLMesh(const Mesh* const mesh)
: vertices(QGLBuffer::VertexBuffer), indices(QGLBuffer::IndexBuffer)
{
initializeGLFunctions();
vertices.create();
indices.create();

View file

@ -2,10 +2,11 @@
#define GLMESH_H
#include <QtOpenGL/QGLBuffer>
#include <QtOpenGL/QGLFunctions>
class Mesh;
class GLMesh
class GLMesh : protected QGLFunctions
{
public:
GLMesh(const Mesh* const mesh);

View file

@ -69,6 +69,16 @@ void Window::on_about()
" style=\"color: #93a1a1;\">matt.j.keeter@gmail.com</a></p>");
}
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,9 +95,9 @@ 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] != ':')
{

View file

@ -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;