summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/MainWindow.h1
-rw-r--r--src/Preferences.cc10
-rw-r--r--src/Preferences.h2
-rw-r--r--src/Preferences.ui95
-rw-r--r--src/mainwin.cc10
5 files changed, 82 insertions, 36 deletions
diff --git a/src/MainWindow.h b/src/MainWindow.h
index 577209f..5546290 100644
--- a/src/MainWindow.h
+++ b/src/MainWindow.h
@@ -69,6 +69,7 @@ private slots:
void setFileName(const QString &filename);
void setFont(const QString &family, uint size);
void showProgress();
+ void openCSGSettingsChanged();
private:
void openFile(const QString &filename);
diff --git a/src/Preferences.cc b/src/Preferences.cc
index 33d71bd..9e1e1f1 100644
--- a/src/Preferences.cc
+++ b/src/Preferences.cc
@@ -70,6 +70,7 @@ Preferences::Preferences(QWidget *parent) : QMainWindow(parent)
this->defaultmap["advanced/polysetCacheSize"] = uint(PolySetCache::instance()->maxSize());
this->defaultmap["advanced/cgalCacheSize"] = uint(CGALCache::instance()->maxSize());
this->defaultmap["advanced/openCSGLimit"] = 2000;
+ this->defaultmap["advanced/forceGoldfeather"] = false;
// Toolbar
@@ -207,6 +208,13 @@ void Preferences::on_opencsgLimitEdit_textChanged(const QString &text)
// FIXME: Set this globally?
}
+void Preferences::on_forceGoldfeatherBox_toggled(bool state)
+{
+ QSettings settings;
+ settings.setValue("advanced/forceGoldfeather", state);
+ emit openCSGSettingsChanged();
+}
+
void Preferences::keyPressEvent(QKeyEvent *e)
{
#ifdef Q_WS_MAC
@@ -271,10 +279,12 @@ void Preferences::updateGUI()
this->cgalCacheSizeEdit->setText(getValue("advanced/cgalCacheSize").toString());
this->polysetCacheSizeEdit->setText(getValue("advanced/polysetCacheSize").toString());
this->opencsgLimitEdit->setText(getValue("advanced/openCSGLimit").toString());
+ this->forceGoldfeatherBox->setChecked(getValue("advanced/forceGoldfeather").toBool());
}
void Preferences::apply() const
{
emit fontChanged(getValue("editor/fontfamily").toString(), getValue("editor/fontsize").toUInt());
emit requestRedraw();
+ emit openCSGSettingsChanged();
}
diff --git a/src/Preferences.h b/src/Preferences.h
index 492a261..5ebce43 100644
--- a/src/Preferences.h
+++ b/src/Preferences.h
@@ -27,10 +27,12 @@ public slots:
void on_cgalCacheSizeEdit_textChanged(const QString &);
void on_polysetCacheSizeEdit_textChanged(const QString &);
void on_opencsgLimitEdit_textChanged(const QString &);
+ void on_forceGoldfeatherBox_toggled(bool);
signals:
void requestRedraw() const;
void fontChanged(const QString &family, uint size) const;
+ void openCSGSettingsChanged() const;
private:
Preferences(QWidget *parent = NULL);
diff --git a/src/Preferences.ui b/src/Preferences.ui
index 8ff2828..9ca8179 100644
--- a/src/Preferences.ui
+++ b/src/Preferences.ui
@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>418</width>
- <height>269</height>
+ <width>531</width>
+ <height>418</height>
</rect>
</property>
<property name="windowTitle">
@@ -176,20 +176,64 @@
<widget class="QWidget" name="pageAdvanced">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
- <widget class="QCheckBox" name="openCSGWarningBox">
- <property name="text">
- <string>Show OpenCSG capability warning</string>
- </property>
- <property name="checked">
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="enableOpenCSGBox">
- <property name="text">
- <string>Enable OpenCSG for OpenGL 1.x</string>
+ <widget class="QGroupBox" name="groupBox">
+ <property name="title">
+ <string>OpenCSG</string>
</property>
+ <layout class="QVBoxLayout" name="verticalLayout_6">
+ <item>
+ <widget class="QCheckBox" name="openCSGWarningBox">
+ <property name="text">
+ <string>Show capability warning</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="enableOpenCSGBox">
+ <property name="text">
+ <string>Enable for OpenGL 1.x</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_4">
+ <item>
+ <widget class="QLabel" name="label_7">
+ <property name="text">
+ <string>Turn off rendering at </string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="opencsgLimitEdit"/>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_8">
+ <property name="text">
+ <string>elements</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="forceGoldfeatherBox">
+ <property name="text">
+ <string>Force Goldfeather</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ <zorder>openCSGWarningBox</zorder>
+ <zorder></zorder>
+ <zorder>enableOpenCSGBox</zorder>
+ <zorder>enableOpenCSGBox</zorder>
+ <zorder></zorder>
+ <zorder>openCSGWarningBox</zorder>
+ <zorder>forceGoldfeatherBox</zorder>
</widget>
</item>
<item>
@@ -235,27 +279,6 @@
</layout>
</item>
<item>
- <layout class="QHBoxLayout" name="horizontalLayout_4">
- <item>
- <widget class="QLabel" name="label_7">
- <property name="text">
- <string>Turn off OpenCSG rendering at </string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLineEdit" name="opencsgLimitEdit"/>
- </item>
- <item>
- <widget class="QLabel" name="label_8">
- <property name="text">
- <string>elements</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
diff --git a/src/mainwin.cc b/src/mainwin.cc
index f8a6f43..a8507c0 100644
--- a/src/mainwin.cc
+++ b/src/mainwin.cc
@@ -41,6 +41,7 @@
#ifdef ENABLE_OPENCSG
#include "CSGTermEvaluator.h"
#include "OpenCSGRenderer.h"
+#include <opencsg.h>
#endif
#include "ProgressWidget.h"
#include "ThrownTogetherRenderer.h"
@@ -347,6 +348,8 @@ MainWindow::MainWindow(const QString &filename)
connect(Preferences::inst(), SIGNAL(requestRedraw()), this->glview, SLOT(updateGL()));
connect(Preferences::inst(), SIGNAL(fontChanged(const QString&,uint)),
this, SLOT(setFont(const QString&,uint)));
+ connect(Preferences::inst(), SIGNAL(openCSGSettingsChanged()),
+ this, SLOT(openCSGSettingsChanged()));
Preferences::inst()->apply();
// make sure it looks nice..
@@ -1786,3 +1789,10 @@ void MainWindow::clearCurrentOutput()
{
set_output_handler(NULL, NULL);
}
+
+void MainWindow::openCSGSettingsChanged()
+{
+#ifdef ENABLE_OPENCSG
+ OpenCSG::setOption(OpenCSG::AlgorithmSetting, Preferences::inst()->getValue("advanced/forceGoldfeather").toBool() ? OpenCSG::Goldfeather : OpenCSG::Automatic);
+#endif
+}
contact: Jan Huwald // Impressum