summaryrefslogtreecommitdiff
path: root/src/Preferences.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/Preferences.cc')
-rw-r--r--src/Preferences.cc108
1 files changed, 60 insertions, 48 deletions
diff --git a/src/Preferences.cc b/src/Preferences.cc
index d240a9f..59f8d23 100644
--- a/src/Preferences.cc
+++ b/src/Preferences.cc
@@ -36,11 +36,21 @@ Preferences::Preferences(QWidget *parent) : QMainWindow(parent)
{
setupUi(this);
+ // Editor pane
+ QFontDatabase db;
+ foreach(int size, db.standardSizes()) {
+ this->fontSize->addItem(QString::number(size));
+ if (size == 12) {
+ this->fontSize->setCurrentIndex(this->fontSize->count()-1);
+ }
+ }
+
// Setup default settings
this->defaultmap["3dview/colorscheme"] = this->colorSchemeChooser->currentItem()->text();
this->defaultmap["editor/fontfamily"] = this->fontChooser->currentText();
this->defaultmap["editor/fontsize"] = this->fontSize->currentText().toUInt();
- this->defaultmap["editor/opengl20_warning_show"] = true;
+ this->defaultmap["advanced/opencsg_show_warning"] = true;
+ this->defaultmap["advanced/enable_opencsg_opengl1x"] = false;
// Toolbar
QActionGroup *group = new QActionGroup(this);
@@ -53,44 +63,38 @@ Preferences::Preferences(QWidget *parent) : QMainWindow(parent)
this->actionTriggered(this->prefsAction3DView);
// 3D View pane
- this->colorschemes["Cornfield"][BACKGROUND_COLOR] = QColor(0xff, 0xff, 0xe5);
- this->colorschemes["Cornfield"][OPENCSG_FACE_FRONT_COLOR] = QColor(0xf9, 0xd7, 0x2c);
- this->colorschemes["Cornfield"][OPENCSG_FACE_BACK_COLOR] = QColor(0x9d, 0xcb, 0x51);
- this->colorschemes["Cornfield"][CGAL_FACE_FRONT_COLOR] = QColor(0xf9, 0xd7, 0x2c);
- this->colorschemes["Cornfield"][CGAL_FACE_BACK_COLOR] = QColor(0x9d, 0xcb, 0x51);
- this->colorschemes["Cornfield"][CGAL_FACE_2D_COLOR] = QColor(0x00, 0xbf, 0x99);
- this->colorschemes["Cornfield"][CGAL_EDGE_FRONT_COLOR] = QColor(0xff, 0x00, 0x00);
- this->colorschemes["Cornfield"][CGAL_EDGE_BACK_COLOR] = QColor(0xff, 0x00, 0x00);
- this->colorschemes["Cornfield"][CGAL_EDGE_2D_COLOR] = QColor(0xff, 0x00, 0x00);
- this->colorschemes["Cornfield"][CROSSHAIR_COLOR] = QColor(0x80, 0x00, 0x00);
-
- this->colorschemes["Metallic"][BACKGROUND_COLOR] = QColor(0xaa, 0xaa, 0xff);
- this->colorschemes["Metallic"][OPENCSG_FACE_FRONT_COLOR] = QColor(0xdd, 0xdd, 0xff);
- this->colorschemes["Metallic"][OPENCSG_FACE_BACK_COLOR] = QColor(0xdd, 0x22, 0xdd);
- this->colorschemes["Metallic"][CGAL_FACE_FRONT_COLOR] = QColor(0xdd, 0xdd, 0xff);
- this->colorschemes["Metallic"][CGAL_FACE_BACK_COLOR] = QColor(0xdd, 0x22, 0xdd);
- this->colorschemes["Metallic"][CGAL_FACE_2D_COLOR] = QColor(0x00, 0xbf, 0x99);
- this->colorschemes["Metallic"][CGAL_EDGE_FRONT_COLOR] = QColor(0xff, 0x00, 0x00);
- this->colorschemes["Metallic"][CGAL_EDGE_BACK_COLOR] = QColor(0xff, 0x00, 0x00);
- this->colorschemes["Metallic"][CGAL_EDGE_2D_COLOR] = QColor(0xff, 0x00, 0x00);
- this->colorschemes["Metallic"][CROSSHAIR_COLOR] = QColor(0x80, 0x00, 0x00);
-
- this->colorschemes["Sunset"][BACKGROUND_COLOR] = QColor(0xaa, 0x44, 0x44);
- this->colorschemes["Sunset"][OPENCSG_FACE_FRONT_COLOR] = QColor(0xff, 0xaa, 0xaa);
- this->colorschemes["Sunset"][OPENCSG_FACE_BACK_COLOR] = QColor(0x88, 0x22, 0x33);
- this->colorschemes["Sunset"][CGAL_FACE_FRONT_COLOR] = QColor(0xff, 0xaa, 0xaa);
- this->colorschemes["Sunset"][CGAL_FACE_BACK_COLOR] = QColor(0x88, 0x22, 0x33);
- this->colorschemes["Sunset"][CGAL_FACE_2D_COLOR] = QColor(0x00, 0xbf, 0x99);
- this->colorschemes["Sunset"][CGAL_EDGE_FRONT_COLOR] = QColor(0xff, 0x00, 0x00);
- this->colorschemes["Sunset"][CGAL_EDGE_BACK_COLOR] = QColor(0xff, 0x00, 0x00);
- this->colorschemes["Sunset"][CGAL_EDGE_2D_COLOR] = QColor(0xff, 0x00, 0x00);
- this->colorschemes["Sunset"][CROSSHAIR_COLOR] = QColor(0x80, 0x00, 0x00);
-
- // Editor pane
- QFontDatabase db;
- foreach(int size, db.standardSizes()) {
- this->fontSize->addItem(QString::number(size));
- }
+ this->colorschemes["Cornfield"][RenderSettings::BACKGROUND_COLOR] = QColor(0xff, 0xff, 0xe5);
+ this->colorschemes["Cornfield"][RenderSettings::OPENCSG_FACE_FRONT_COLOR] = QColor(0xf9, 0xd7, 0x2c);
+ this->colorschemes["Cornfield"][RenderSettings::OPENCSG_FACE_BACK_COLOR] = QColor(0x9d, 0xcb, 0x51);
+ this->colorschemes["Cornfield"][RenderSettings::CGAL_FACE_FRONT_COLOR] = QColor(0xf9, 0xd7, 0x2c);
+ this->colorschemes["Cornfield"][RenderSettings::CGAL_FACE_BACK_COLOR] = QColor(0x9d, 0xcb, 0x51);
+ this->colorschemes["Cornfield"][RenderSettings::CGAL_FACE_2D_COLOR] = QColor(0x00, 0xbf, 0x99);
+ this->colorschemes["Cornfield"][RenderSettings::CGAL_EDGE_FRONT_COLOR] = QColor(0xff, 0x00, 0x00);
+ this->colorschemes["Cornfield"][RenderSettings::CGAL_EDGE_BACK_COLOR] = QColor(0xff, 0x00, 0x00);
+ this->colorschemes["Cornfield"][RenderSettings::CGAL_EDGE_2D_COLOR] = QColor(0xff, 0x00, 0x00);
+ this->colorschemes["Cornfield"][RenderSettings::CROSSHAIR_COLOR] = QColor(0x80, 0x00, 0x00);
+
+ this->colorschemes["Metallic"][RenderSettings::BACKGROUND_COLOR] = QColor(0xaa, 0xaa, 0xff);
+ this->colorschemes["Metallic"][RenderSettings::OPENCSG_FACE_FRONT_COLOR] = QColor(0xdd, 0xdd, 0xff);
+ this->colorschemes["Metallic"][RenderSettings::OPENCSG_FACE_BACK_COLOR] = QColor(0xdd, 0x22, 0xdd);
+ this->colorschemes["Metallic"][RenderSettings::CGAL_FACE_FRONT_COLOR] = QColor(0xdd, 0xdd, 0xff);
+ this->colorschemes["Metallic"][RenderSettings::CGAL_FACE_BACK_COLOR] = QColor(0xdd, 0x22, 0xdd);
+ this->colorschemes["Metallic"][RenderSettings::CGAL_FACE_2D_COLOR] = QColor(0x00, 0xbf, 0x99);
+ this->colorschemes["Metallic"][RenderSettings::CGAL_EDGE_FRONT_COLOR] = QColor(0xff, 0x00, 0x00);
+ this->colorschemes["Metallic"][RenderSettings::CGAL_EDGE_BACK_COLOR] = QColor(0xff, 0x00, 0x00);
+ this->colorschemes["Metallic"][RenderSettings::CGAL_EDGE_2D_COLOR] = QColor(0xff, 0x00, 0x00);
+ this->colorschemes["Metallic"][RenderSettings::CROSSHAIR_COLOR] = QColor(0x80, 0x00, 0x00);
+
+ this->colorschemes["Sunset"][RenderSettings::BACKGROUND_COLOR] = QColor(0xaa, 0x44, 0x44);
+ this->colorschemes["Sunset"][RenderSettings::OPENCSG_FACE_FRONT_COLOR] = QColor(0xff, 0xaa, 0xaa);
+ this->colorschemes["Sunset"][RenderSettings::OPENCSG_FACE_BACK_COLOR] = QColor(0x88, 0x22, 0x33);
+ this->colorschemes["Sunset"][RenderSettings::CGAL_FACE_FRONT_COLOR] = QColor(0xff, 0xaa, 0xaa);
+ this->colorschemes["Sunset"][RenderSettings::CGAL_FACE_BACK_COLOR] = QColor(0x88, 0x22, 0x33);
+ this->colorschemes["Sunset"][RenderSettings::CGAL_FACE_2D_COLOR] = QColor(0x00, 0xbf, 0x99);
+ this->colorschemes["Sunset"][RenderSettings::CGAL_EDGE_FRONT_COLOR] = QColor(0xff, 0x00, 0x00);
+ this->colorschemes["Sunset"][RenderSettings::CGAL_EDGE_BACK_COLOR] = QColor(0xff, 0x00, 0x00);
+ this->colorschemes["Sunset"][RenderSettings::CGAL_EDGE_2D_COLOR] = QColor(0xff, 0x00, 0x00);
+ this->colorschemes["Sunset"][RenderSettings::CROSSHAIR_COLOR] = QColor(0x80, 0x00, 0x00);
connect(this->colorSchemeChooser, SIGNAL(itemSelectionChanged()),
this, SLOT(colorSchemeChanged()));
@@ -98,9 +102,11 @@ Preferences::Preferences(QWidget *parent) : QMainWindow(parent)
this, SLOT(fontFamilyChanged(const QString &)));
connect(this->fontSize, SIGNAL(editTextChanged(const QString &)),
this, SLOT(fontSizeChanged(const QString &)));
- connect(this->openCSGWarningBox, SIGNAL(clicked(bool)),
+ connect(this->openCSGWarningBox, SIGNAL(toggled(bool)),
this, SLOT(openCSGWarningChanged(bool)));
updateGUI();
+
+ RenderSettings::inst()->setColors(this->colorschemes[getValue("3dview/colorscheme").toString()]);
}
Preferences::~Preferences()
@@ -124,15 +130,13 @@ Preferences::actionTriggered(QAction *action)
void Preferences::colorSchemeChanged()
{
+ QString scheme = this->colorSchemeChooser->currentItem()->text();
QSettings settings;
- settings.setValue("3dview/colorscheme", this->colorSchemeChooser->currentItem()->text());
+ settings.setValue("3dview/colorscheme", scheme);
- emit requestRedraw();
-}
+ RenderSettings::inst()->setColors(this->colorschemes[scheme]);
-const QColor &Preferences::color(RenderColor idx)
-{
- return this->colorschemes[getValue("3dview/colorscheme").toString()][idx];
+ emit requestRedraw();
}
void Preferences::fontFamilyChanged(const QString &family)
@@ -154,7 +158,14 @@ void
Preferences::openCSGWarningChanged(bool state)
{
QSettings settings;
- settings.setValue("editor/opengl20_warning_show",state);
+ settings.setValue("advanced/opencsg_show_warning",state);
+}
+
+void
+Preferences::enableOpenCSGChanged(bool state)
+{
+ QSettings settings;
+ settings.setValue("advanced/enable_opencsg_opengl1x", state);
}
void Preferences::keyPressEvent(QKeyEvent *e)
@@ -215,7 +226,8 @@ void Preferences::updateGUI()
this->fontSize->setEditText(fontsize);
}
- this->openCSGWarningBox->setChecked(getValue("editor/opengl20_warning_show").toBool());
+ this->openCSGWarningBox->setChecked(getValue("advanced/opencsg_show_warning").toBool());
+ this->enableOpenCSGBox->setChecked(getValue("advanced/enable_opencsg_opengl1x").toBool());
}
void Preferences::apply() const
contact: Jan Huwald // Impressum