From: Matt Keeter Date: Fri, 7 Mar 2014 17:45:07 +0000 (-0600) Subject: Set window title to filename X-Git-Tag: v0.9.0~34 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=26d21d85a2c6e2b17fbcbf799d0c23865553b3cc;p=fstl Set window title to filename --- diff --git a/src/loader.cpp b/src/loader.cpp index 8666161..4131d02 100644 --- a/src/loader.cpp +++ b/src/loader.cpp @@ -9,4 +9,5 @@ Loader::Loader(QObject* parent, const QString& filename) void Loader::run() { emit got_mesh(Mesh::load_stl(filename)); + emit loaded_file(filename); } diff --git a/src/loader.h b/src/loader.h index 29508f0..350985c 100644 --- a/src/loader.h +++ b/src/loader.h @@ -13,6 +13,7 @@ public: void run(); signals: + void loaded_file(QString filename); void got_mesh(Mesh* m); private: diff --git a/src/window.cpp b/src/window.cpp index 6b12563..1b3530b 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -77,13 +77,16 @@ void Window::disable_open_action() void Window::load_stl(const QString &filename) { - disable_open_action(); Loader* loader = new Loader(this, filename); + connect(loader, SIGNAL(started()), + this, SLOT(disable_open_action())); 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())); + connect(loader, SIGNAL(loaded_file(QString)), + this, SLOT(setWindowTitle(QString))); loader->start(); }