From c9194b914f85a95092d04708ff84a53673ee3392 Mon Sep 17 00:00:00 2001 From: Paolo Cignoni cignoni Date: Wed, 22 Feb 2006 09:12:15 +0000 Subject: [PATCH] Better formatting of shaders' code --- .../meshrender/shaderDialog.cpp | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/src/meshlabplugins/meshrender/shaderDialog.cpp b/src/meshlabplugins/meshrender/shaderDialog.cpp index efee2710b..0ea5a4261 100644 --- a/src/meshlabplugins/meshrender/shaderDialog.cpp +++ b/src/meshlabplugins/meshrender/shaderDialog.cpp @@ -1,4 +1,5 @@ #include "shaderDialog.h" +#include #define DECFACTOR 100000.0f @@ -160,18 +161,22 @@ ShaderDialog::ShaderDialog(ShaderInfo *sInfo, GLArea* gla, RenderMode &rm, QWidg } #endif shadersDir.cd("shaders"); + QFile qf; + QTextStream ts(&qf); + + qf.setFileName(shadersDir.path()+QString("/")+shaderInfo->vpFile); + if (!qf.open(QIODevice::ReadOnly | QIODevice::Text) ) + QMessageBox::critical(this,"Opengl Shader" ,"unable to open file"); + ui.vpTextBrowser->insertPlainText(ts.readAll()); + qf.close(); + + qf.setFileName(shadersDir.path()+QString("/")+shaderInfo->fpFile); + if (!qf.open(QIODevice::ReadOnly | QIODevice::Text) ) + QMessageBox::critical(this,"Opengl Shader" ,"unable to open file"); + ui.fpTextBrowser->insertPlainText(ts.readAll()); + qf.close(); - ui.fpTextBrowser->setSearchPaths(QStringList(shadersDir.absolutePath())); - ui.fpTextBrowser->setSource(QUrl(shaderInfo->fpFile)); - ui.fpTextBrowser->setAutoFormatting(QTextBrowser::AutoNone); - ui.fpTextBrowser->setLineWrapMode(QTextBrowser::WidgetWidth); - - - - ui.vpTextBrowser->setSearchPaths(QStringList(shadersDir.absolutePath())); - ui.vpTextBrowser->setSource(QUrl(shaderInfo->vpFile)); - ui.vpTextBrowser->setAutoFormatting(QTextBrowser::AutoNone); - //End of Vertex and Fragment Program Tabs Section + //End of Vertex and Fragment Program Tabs Section this->setWindowFlags(Qt::WindowStaysOnTopHint);