]> git.sur5r.net Git - fstl/blobdiff - src/window.cpp
Make load_stl return a boolean
[fstl] / src / window.cpp
index ebb4b70020731c0f5efdb6f524ebb21d63861738..a3c94d06cea48488abc8b66c67974ce8fee5a196 100644 (file)
@@ -11,7 +11,7 @@ Window::Window(QWidget *parent) :
 {
     setWindowTitle("fstl");
 
-    QFile styleFile( ":/style.qss" );
+    QFile styleFile(":/qt/style.qss");
     styleFile.open( QFile::ReadOnly );
     setStyleSheet(styleFile.readAll());
 
@@ -30,11 +30,11 @@ Window::Window(QWidget *parent) :
     quit_action = new QAction("Quit", this);
     quit_action->setShortcut(QKeySequence::Quit);
     QObject::connect(quit_action, &QAction::triggered,
-                     this, &Window::on_open);
+                     this, &Window::close);
 
     about_action = new QAction("About", this);
     QObject::connect(about_action, &QAction::triggered,
-                     this, &Window::on_open);
+                     this, &Window::on_about);
 
     auto file_menu = menuBar()->addMenu("File");
     file_menu->addAction(open_action);
@@ -68,8 +68,10 @@ void Window::on_about()
         "   style=\"color: #93a1a1;\">matt.j.keeter@gmail.com</a></p>");
 }
 
-void Window::load_stl(const QString &filename)
+bool Window::load_stl(const QString& filename)
 {
+    if (!open_action->isEnabled())  return false;
+
     canvas->set_status("Loading " + filename);
 
     Loader* loader = new Loader(this, filename);
@@ -90,4 +92,5 @@ void Window::load_stl(const QString &filename)
             this, &Window::setWindowTitle);
 
     loader->start();
+    return true;
 }