re-simplify library info window. start to unify glview.save()

felipesanches-svg
don bright 2013-02-21 05:49:19 -06:00
parent e3ecf26d45
commit 88c071c5ed
6 changed files with 23 additions and 21 deletions

View File

@ -87,7 +87,7 @@ private:
void loadViewSettings();
void loadDesignSettings();
class QDialog *openglbox;
class QMessageBox *openglbox;
private slots:
void actionNew();

View File

@ -147,7 +147,7 @@ bool OffscreenView::save(std::ostream &output)
return save_framebuffer(this->ctx, output);
}
const std::string &OffscreenView::getRendererInfo()
std::string OffscreenView::getRendererInfo()
{
std::stringstream out;

View File

@ -24,9 +24,9 @@ public:
void setupPerspective();
void setupOrtho(bool offset=false);
void paintGL();
bool save(const char *filename);
bool save(std::ostream &output);
const std::string &getRendererInfo();
bool save(const char *filename); //
bool save(std::ostream &output); // not implemented in qgl?
std::string getRendererInfo(); //
GLint shaderinfo[11]; //

View File

@ -35,7 +35,8 @@ public:
void setShowCrosshairs(bool enabled) { this->showcrosshairs = enabled; }
bool orthoMode() const { return this->orthomode; }
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:
QLabel *statusLabel;

View File

@ -1452,20 +1452,17 @@ void MainWindow::actionExportCSG()
void MainWindow::actionExportImage()
{
QImage img = this->qglview->grabFrameBuffer();
setCurrentOutput();
QString img_filename = QFileDialog::getSaveFileName(this,
"Export Image", "", "PNG Files (*.png)");
if (img_filename.isEmpty()) {
PRINT("No filename specified. Image export aborted.");
clearCurrentOutput();
return;
} else {
qglview->save(img_filename.toStdString().c_str());
}
img.save(img_filename, "PNG");
clearCurrentOutput();
return;
}
void MainWindow::actionFlushCaches()
@ -1745,16 +1742,13 @@ void MainWindow::helpLibrary()
qVersion());
if (!this->openglbox) {
this->openglbox = new QDialog( this );
QVBoxLayout *ql = new QVBoxLayout( openglbox );
QTextEdit *qte = new QTextEdit( openglbox );
ql->addWidget( qte );
this->openglbox = new QMessageBox(QMessageBox::Information,
"OpenGL Info", "Detailed Library Info",
QMessageBox::Ok, this);
this->openglbox->setMinimumSize( QSize(400,200) );
}
QTextEdit *qte = openglbox->findChild<QTextEdit *>();
qte->setText(libinfo + QString(this->qglview->getRendererInfo().c_str()));
qte->setReadOnly( true );
openglbox->setMinimumSize( QSize(400,200) );
openglbox->show();
this->openglbox->setDetailedText(libinfo + QString(qglview->getRendererInfo().c_str()));
this->openglbox->show();
}
/*!

View File

@ -637,3 +637,10 @@ void QGLView::mouseReleaseEvent(QMouseEvent*)
mouse_drag_active = false;
releaseMouse();
}
bool QGLView::save(const char *filename)
{
QImage img = grabFrameBuffer();
return img.save(filename, "PNG");
}