mirror of https://github.com/vitalif/openscad
Allow the hiding of the opengl2.0 warning on startup.
There are two basic changes. The first is a checkbox within the warning screen that allows you to hide it on subsequent program boots. The second is a checkbox under Edit/Preferences/Advanced to show/hide the message.stl_dim
parent
8289982efc
commit
7d4ba81068
|
@ -40,6 +40,7 @@ Preferences::Preferences(QWidget *parent) : QMainWindow(parent)
|
||||||
this->defaultmap["3dview/colorscheme"] = this->colorSchemeChooser->currentItem()->text();
|
this->defaultmap["3dview/colorscheme"] = this->colorSchemeChooser->currentItem()->text();
|
||||||
this->defaultmap["editor/fontfamily"] = this->fontChooser->currentText();
|
this->defaultmap["editor/fontfamily"] = this->fontChooser->currentText();
|
||||||
this->defaultmap["editor/fontsize"] = this->fontSize->currentText().toUInt();
|
this->defaultmap["editor/fontsize"] = this->fontSize->currentText().toUInt();
|
||||||
|
this->defaultmap["editor/opengl20_warning_show"] = true;
|
||||||
|
|
||||||
// Toolbar
|
// Toolbar
|
||||||
QActionGroup *group = new QActionGroup(this);
|
QActionGroup *group = new QActionGroup(this);
|
||||||
|
@ -97,7 +98,8 @@ Preferences::Preferences(QWidget *parent) : QMainWindow(parent)
|
||||||
this, SLOT(fontFamilyChanged(const QString &)));
|
this, SLOT(fontFamilyChanged(const QString &)));
|
||||||
connect(this->fontSize, SIGNAL(editTextChanged(const QString &)),
|
connect(this->fontSize, SIGNAL(editTextChanged(const QString &)),
|
||||||
this, SLOT(fontSizeChanged(const QString &)));
|
this, SLOT(fontSizeChanged(const QString &)));
|
||||||
|
connect(this->OpenGL20WarningCheckbox, SIGNAL(clicked(bool)),
|
||||||
|
this, SLOT(OpenGL20WarningChanged(bool)));
|
||||||
updateGUI();
|
updateGUI();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,6 +150,13 @@ void Preferences::fontSizeChanged(const QString &size)
|
||||||
emit fontChanged(getValue("editor/fontfamily").toString(), intsize);
|
emit fontChanged(getValue("editor/fontfamily").toString(), intsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Preferences::OpenGL20WarningChanged(bool state)
|
||||||
|
{
|
||||||
|
QSettings settings;
|
||||||
|
settings.setValue("editor/opengl20_warning_show",state);
|
||||||
|
}
|
||||||
|
|
||||||
void Preferences::keyPressEvent(QKeyEvent *e)
|
void Preferences::keyPressEvent(QKeyEvent *e)
|
||||||
{
|
{
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
|
@ -185,6 +194,7 @@ QVariant Preferences::getValue(const QString &key) const
|
||||||
|
|
||||||
void Preferences::updateGUI()
|
void Preferences::updateGUI()
|
||||||
{
|
{
|
||||||
|
QSettings settings;
|
||||||
QList<QListWidgetItem *> found =
|
QList<QListWidgetItem *> found =
|
||||||
this->colorSchemeChooser->findItems(getValue("3dview/colorscheme").toString(),
|
this->colorSchemeChooser->findItems(getValue("3dview/colorscheme").toString(),
|
||||||
Qt::MatchExactly);
|
Qt::MatchExactly);
|
||||||
|
@ -204,6 +214,9 @@ void Preferences::updateGUI()
|
||||||
else {
|
else {
|
||||||
this->fontSize->setEditText(fontsize);
|
this->fontSize->setEditText(fontsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool opengl20_warning_show = getValue("editor/opengl20_warning_show").toBool();
|
||||||
|
this->OpenGL20WarningCheckbox->setChecked(opengl20_warning_show);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Preferences::apply() const
|
void Preferences::apply() const
|
||||||
|
@ -211,4 +224,3 @@ void Preferences::apply() const
|
||||||
emit fontChanged(getValue("editor/fontfamily").toString(), getValue("editor/fontsize").toUInt());
|
emit fontChanged(getValue("editor/fontfamily").toString(), getValue("editor/fontsize").toUInt());
|
||||||
emit requestRedraw();
|
emit requestRedraw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ public slots:
|
||||||
void colorSchemeChanged();
|
void colorSchemeChanged();
|
||||||
void fontFamilyChanged(const QString &);
|
void fontFamilyChanged(const QString &);
|
||||||
void fontSizeChanged(const QString &);
|
void fontSizeChanged(const QString &);
|
||||||
|
void OpenGL20WarningChanged(bool);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void requestRedraw() const;
|
void requestRedraw() const;
|
||||||
|
|
|
@ -179,71 +179,29 @@
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer_2">
|
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>120</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_2">
|
<widget class="QCheckBox" name="OpenGL20WarningCheckbox">
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>advanced</string>
|
<string>Show OpenGL 2.0 warning && rendering info</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="horizontalSpacer_3">
|
<spacer name="verticalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>40</width>
|
<width>20</width>
|
||||||
<height>20</height>
|
<height>40</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer_3">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>120</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
|
@ -29,9 +29,15 @@
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QWheelEvent>
|
#include <QWheelEvent>
|
||||||
|
#include <QCheckBox>
|
||||||
|
#include <QDialogButtonBox>
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QSettings>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
#include <QTextEdit>
|
||||||
|
#include <QVBoxLayout>
|
||||||
#include "mathc99.h"
|
#include "mathc99.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
@ -180,7 +186,10 @@ void GLView::initializeGL()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
opencsg_support = false;
|
opencsg_support = false;
|
||||||
QTimer::singleShot(0, this, SLOT(display_opengl20_warning()));
|
QSettings settings;
|
||||||
|
if (settings.value("editor/opengl20_warning_show").toBool()) {
|
||||||
|
QTimer::singleShot(0, this, SLOT(display_opengl20_warning()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif /* ENABLE_OPENCSG */
|
#endif /* ENABLE_OPENCSG */
|
||||||
}
|
}
|
||||||
|
@ -188,6 +197,9 @@ void GLView::initializeGL()
|
||||||
#ifdef ENABLE_OPENCSG
|
#ifdef ENABLE_OPENCSG
|
||||||
void GLView::display_opengl20_warning()
|
void GLView::display_opengl20_warning()
|
||||||
{
|
{
|
||||||
|
// data
|
||||||
|
QString title = QString("GLEW: GL_VERSION_2_0 is not supported!");
|
||||||
|
|
||||||
QString rendererinfo;
|
QString rendererinfo;
|
||||||
rendererinfo.sprintf("GLEW version %s\n"
|
rendererinfo.sprintf("GLEW version %s\n"
|
||||||
"%s (%s)\n"
|
"%s (%s)\n"
|
||||||
|
@ -196,11 +208,43 @@ void GLView::display_opengl20_warning()
|
||||||
glGetString(GL_RENDERER), glGetString(GL_VENDOR),
|
glGetString(GL_RENDERER), glGetString(GL_VENDOR),
|
||||||
glGetString(GL_VERSION));
|
glGetString(GL_VERSION));
|
||||||
|
|
||||||
QMessageBox::warning(NULL, "GLEW: GL_VERSION_2_0 is not supported!",
|
QString message = QString("Warning: No support for OpenGL 2.0 found! OpenCSG View has been disabled.\n\n"
|
||||||
QString("Warning: No support for OpenGL 2.0 found! OpenCSG View has been disabled.\n\n"
|
|
||||||
"It is highly recommended to use OpenSCAD on a system with OpenGL 2.0 "
|
"It is highly recommended to use OpenSCAD on a system with OpenGL 2.0 "
|
||||||
"support. Please check if OpenGL 2.0 drivers are available for your "
|
"support. Please check if OpenGL 2.0 drivers are available for your "
|
||||||
"graphics hardware.\n\n%1").arg(rendererinfo));
|
"graphics hardware. Your renderer information is as follows:\n\n%1").arg(rendererinfo);
|
||||||
|
|
||||||
|
QString note = QString("Uncheck to hide this message in the future");
|
||||||
|
|
||||||
|
// presentation
|
||||||
|
QDialog *dialog = new QDialog(this);
|
||||||
|
dialog->setSizeGripEnabled(true);
|
||||||
|
dialog->setWindowTitle(title);
|
||||||
|
dialog->resize(500,300);
|
||||||
|
|
||||||
|
QVBoxLayout *layout = new QVBoxLayout(dialog);
|
||||||
|
dialog->setLayout(layout);
|
||||||
|
|
||||||
|
QTextEdit *textEdit = new QTextEdit(dialog);
|
||||||
|
textEdit->setPlainText(message);
|
||||||
|
layout->addWidget(textEdit);
|
||||||
|
|
||||||
|
QCheckBox *checkbox = new QCheckBox(note,dialog);
|
||||||
|
checkbox->setCheckState(Qt::Checked);
|
||||||
|
layout->addWidget(checkbox);
|
||||||
|
|
||||||
|
QDialogButtonBox *buttonbox =
|
||||||
|
new QDialogButtonBox( QDialogButtonBox::Ok, Qt::Horizontal,dialog);
|
||||||
|
layout->addWidget(buttonbox);
|
||||||
|
buttonbox->button(QDialogButtonBox::Ok)->setFocus();
|
||||||
|
buttonbox->button(QDialogButtonBox::Ok)->setDefault(true);
|
||||||
|
|
||||||
|
// action
|
||||||
|
connect(buttonbox, SIGNAL(accepted()), dialog, SLOT(accept()));
|
||||||
|
connect(checkbox, SIGNAL(clicked(bool)),
|
||||||
|
Preferences::inst()->OpenGL20WarningCheckbox, SLOT(setChecked(bool)));
|
||||||
|
connect(checkbox, SIGNAL(clicked(bool)),
|
||||||
|
Preferences::inst(), SLOT(OpenGL20WarningChanged(bool)));
|
||||||
|
dialog->exec();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue