diff options
author | Don Bright <hugh.m.bright@gmail.com> | 2013-09-20 05:19:09 (GMT) |
---|---|---|
committer | Don Bright <hugh.m.bright@gmail.com> | 2013-09-20 05:19:09 (GMT) |
commit | 3eda281be13dfe9eb8fcbc9fb82e75e74d107e01 (patch) | |
tree | 724d309fa18aaa329bdf84757066e1254f842437 /src/mainwin.cc | |
parent | 2e21f3deff585731d5377490cde87eeccd917445 (diff) |
allow openscad binary to be compiled with or without QT. use non-QT for tests.
Diffstat (limited to 'src/mainwin.cc')
-rw-r--r-- | src/mainwin.cc | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/mainwin.cc b/src/mainwin.cc index fd1c552..ea7da66 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -27,7 +27,6 @@ #include "PolySetCache.h" #include "ModuleCache.h" #include "MainWindow.h" -#include "openscad.h" // examplesdir #include "parsersettings.h" #include "Preferences.h" #include "printutils.h" @@ -103,8 +102,6 @@ #include "boosty.h" -extern QString examplesdir; - // Global application state unsigned int GuiLocker::gui_locked = 0; @@ -156,7 +153,7 @@ settings_valueList(const QString &key, const QList<int> &defaultList = QList<int } -MainWindow::MainWindow(const QString &filename) +MainWindow::MainWindow(const QString &filename, const QString &examplesdir) : root_inst("group"), progresswidget(NULL) { setupUi(this); @@ -169,6 +166,7 @@ MainWindow::MainWindow(const QString &filename) top_ctx.registerBuiltin(); + this->qexamplesdir = examplesdir; this->openglbox = NULL; root_module = NULL; absolute_root_node = NULL; @@ -253,10 +251,9 @@ MainWindow::MainWindow(const QString &filename) this->menuOpenRecent->addAction(this->fileActionClearRecent); connect(this->fileActionClearRecent, SIGNAL(triggered()), this, SLOT(clearRecentFiles())); - - if (!examplesdir.isEmpty()) { + if (!qexamplesdir.isEmpty()) { bool found_example = false; - QStringList examples = QDir(examplesdir).entryList(QStringList("*.scad"), + QStringList examples = QDir(qexamplesdir).entryList(QStringList("*.scad"), QDir::Files | QDir::Readable, QDir::Name); foreach (const QString &ex, examples) { this->menuExamples->addAction(ex, this, SLOT(actionOpenExample())); @@ -985,7 +982,7 @@ void MainWindow::actionOpenExample() { QAction *action = qobject_cast<QAction *>(sender()); if (action) { - openFile(examplesdir + QDir::separator() + action->text()); + openFile(qexamplesdir + QDir::separator() + action->text()); } } |