mirror of https://github.com/vitalif/openscad
re-simplify library info window. start to unify glview.save()
parent
e3ecf26d45
commit
88c071c5ed
|
@ -87,7 +87,7 @@ private:
|
||||||
void loadViewSettings();
|
void loadViewSettings();
|
||||||
void loadDesignSettings();
|
void loadDesignSettings();
|
||||||
|
|
||||||
class QDialog *openglbox;
|
class QMessageBox *openglbox;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void actionNew();
|
void actionNew();
|
||||||
|
|
|
@ -147,7 +147,7 @@ bool OffscreenView::save(std::ostream &output)
|
||||||
return save_framebuffer(this->ctx, output);
|
return save_framebuffer(this->ctx, output);
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string &OffscreenView::getRendererInfo()
|
std::string OffscreenView::getRendererInfo()
|
||||||
{
|
{
|
||||||
std::stringstream out;
|
std::stringstream out;
|
||||||
|
|
||||||
|
|
|
@ -24,9 +24,9 @@ public:
|
||||||
void setupPerspective();
|
void setupPerspective();
|
||||||
void setupOrtho(bool offset=false);
|
void setupOrtho(bool offset=false);
|
||||||
void paintGL();
|
void paintGL();
|
||||||
bool save(const char *filename);
|
bool save(const char *filename); //
|
||||||
bool save(std::ostream &output);
|
bool save(std::ostream &output); // not implemented in qgl?
|
||||||
const std::string &getRendererInfo();
|
std::string getRendererInfo(); //
|
||||||
|
|
||||||
GLint shaderinfo[11]; //
|
GLint shaderinfo[11]; //
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,8 @@ public:
|
||||||
void setShowCrosshairs(bool enabled) { this->showcrosshairs = enabled; }
|
void setShowCrosshairs(bool enabled) { this->showcrosshairs = enabled; }
|
||||||
bool orthoMode() const { return this->orthomode; }
|
bool orthoMode() const { return this->orthomode; }
|
||||||
void setOrthoMode(bool enabled) { this->orthomode = enabled; }
|
void setOrthoMode(bool enabled) { this->orthomode = enabled; }
|
||||||
const std::string &getRendererInfo() const { return this->rendererInfo; }
|
std::string getRendererInfo() const { return this->rendererInfo; }
|
||||||
|
bool save(const char *filename);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QLabel *statusLabel;
|
QLabel *statusLabel;
|
||||||
|
|
|
@ -1452,20 +1452,17 @@ void MainWindow::actionExportCSG()
|
||||||
|
|
||||||
void MainWindow::actionExportImage()
|
void MainWindow::actionExportImage()
|
||||||
{
|
{
|
||||||
QImage img = this->qglview->grabFrameBuffer();
|
|
||||||
setCurrentOutput();
|
setCurrentOutput();
|
||||||
|
|
||||||
QString img_filename = QFileDialog::getSaveFileName(this,
|
QString img_filename = QFileDialog::getSaveFileName(this,
|
||||||
"Export Image", "", "PNG Files (*.png)");
|
"Export Image", "", "PNG Files (*.png)");
|
||||||
if (img_filename.isEmpty()) {
|
if (img_filename.isEmpty()) {
|
||||||
PRINT("No filename specified. Image export aborted.");
|
PRINT("No filename specified. Image export aborted.");
|
||||||
clearCurrentOutput();
|
} else {
|
||||||
return;
|
qglview->save(img_filename.toStdString().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
img.save(img_filename, "PNG");
|
|
||||||
|
|
||||||
clearCurrentOutput();
|
clearCurrentOutput();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::actionFlushCaches()
|
void MainWindow::actionFlushCaches()
|
||||||
|
@ -1745,16 +1742,13 @@ void MainWindow::helpLibrary()
|
||||||
qVersion());
|
qVersion());
|
||||||
|
|
||||||
if (!this->openglbox) {
|
if (!this->openglbox) {
|
||||||
this->openglbox = new QDialog( this );
|
this->openglbox = new QMessageBox(QMessageBox::Information,
|
||||||
QVBoxLayout *ql = new QVBoxLayout( openglbox );
|
"OpenGL Info", "Detailed Library Info",
|
||||||
QTextEdit *qte = new QTextEdit( openglbox );
|
QMessageBox::Ok, this);
|
||||||
ql->addWidget( qte );
|
this->openglbox->setMinimumSize( QSize(400,200) );
|
||||||
}
|
}
|
||||||
QTextEdit *qte = openglbox->findChild<QTextEdit *>();
|
this->openglbox->setDetailedText(libinfo + QString(qglview->getRendererInfo().c_str()));
|
||||||
qte->setText(libinfo + QString(this->qglview->getRendererInfo().c_str()));
|
this->openglbox->show();
|
||||||
qte->setReadOnly( true );
|
|
||||||
openglbox->setMinimumSize( QSize(400,200) );
|
|
||||||
openglbox->show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|
|
@ -637,3 +637,10 @@ void QGLView::mouseReleaseEvent(QMouseEvent*)
|
||||||
mouse_drag_active = false;
|
mouse_drag_active = false;
|
||||||
releaseMouse();
|
releaseMouse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool QGLView::save(const char *filename)
|
||||||
|
{
|
||||||
|
QImage img = grabFrameBuffer();
|
||||||
|
return img.save(filename, "PNG");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue