]> git.sur5r.net Git - fstl/commitdiff
Disable open when load is in progress
authorMatt Keeter <matt.j.keeter@gmail.com>
Fri, 7 Mar 2014 17:30:18 +0000 (11:30 -0600)
committerMatt Keeter <matt.j.keeter@gmail.com>
Fri, 7 Mar 2014 17:30:18 +0000 (11:30 -0600)
src/window.cpp
src/window.h

index 9d0644924c1dcf30e9d6a0c1bc5cc7cd5672afd8..5c5e1c3332bb02f556361746b88d98f53ef22250 100644 (file)
@@ -17,12 +17,12 @@ Window::Window(QWidget *parent) :
     canvas = new Canvas(format, this);
     setCentralWidget(canvas);
 
-    QAction* open_action = new QAction("Open", this);
+    open_action = new QAction("Open", this);
     open_action->setShortcut(QKeySequence::Open);
     QObject::connect(open_action, SIGNAL(triggered()),
                      this, SLOT(on_open()));
 
-    QAction* quit_action = new QAction("Quit", this);
+    quit_action = new QAction("Quit", this);
     quit_action->setShortcut(QKeySequence::Quit);
     QObject::connect(quit_action, SIGNAL(triggered()),
                      this, SLOT(close()));
@@ -44,12 +44,29 @@ void Window::on_open()
     }
 }
 
+
+void Window::enable_open_action()
+{
+    open_action->setEnabled(true);
+}
+
+
+void Window::disable_open_action()
+{
+
+    open_action->setEnabled(false);
+}
+
+
 void Window::load_stl(const QString &filename)
 {
+    disable_open_action();
     Loader* loader = new Loader(this, filename);
     connect(loader, SIGNAL(got_mesh(Mesh*)),
             canvas, SLOT(load_mesh(Mesh*)));
     connect(loader, SIGNAL(finished()),
             loader, SLOT(deleteLater()));
+    connect(loader, SIGNAL(finished()),
+            this, SLOT(enable_open_action()));
     loader->start();
 }
index be43084a00e4f5afbcc13c226c99ae47f378ee5a..eefaece9e8bb7f334c3fb41093ad8a41c9b864ba 100644 (file)
@@ -14,8 +14,13 @@ public:
 
 public slots:
     void on_open();
+    void disable_open_action();
+    void enable_open_action();
 
 private:
+    QAction* open_action;
+    QAction* quit_action;
+
     Canvas* canvas;
 };