From a0b2a7bdaabe51905556e2daecd3f18e5275eae7 Mon Sep 17 00:00:00 2001 From: Paolo Cignoni cignoni Date: Mon, 2 Jan 2006 18:54:52 +0000 Subject: [PATCH] added multilevel logging support --- src/meshlab/customDialog.cpp | 32 +++++++++++++++++------------- src/meshlab/glarea.cpp | 17 ++++++++-------- src/meshlab/glarea.h | 7 +++++++ src/meshlab/mainwindow_RunTime.cpp | 8 ++++++-- 4 files changed, 39 insertions(+), 25 deletions(-) diff --git a/src/meshlab/customDialog.cpp b/src/meshlab/customDialog.cpp index 971c13b11..aca0b3745 100644 --- a/src/meshlab/customDialog.cpp +++ b/src/meshlab/customDialog.cpp @@ -23,6 +23,9 @@ /**************************************************************************** History $Log$ +Revision 1.5 2006/01/02 18:54:52 glvertex +added multilevel logging support + Revision 1.4 2006/01/02 17:39:18 glvertex Added info types in a combobox @@ -50,20 +53,8 @@ CustomDialog::CustomDialog(QWidget * parent) connect(ui.pushButtonBottomBg,SIGNAL(clicked()),this,SLOT(setBkgBottomColor())); connect(ui.pushButtonTopBg,SIGNAL(clicked()),this,SLOT(setBkgTopColor())); connect(ui.pushButtonLogArea,SIGNAL(clicked()),this,SLOT(setLogAreaColor())); + connect(ui.comboBoxInfoType,SIGNAL(editTextChanged()),this,SLOT(setLogLevel())); setFixedSize(260,155); -} - - -void CustomDialog::loadCurrentSetting(const Color4b& bb,const Color4b& bt,const Color4b& l) -{ - bkgBottomColor=bb; - bkgTopColor=bt; - logAreaColor=l; - - // Changes the palette in the labels - QPalette pbb(QColor(bb.V(0),bb.V(1),bb.V(2))); - QPalette pbt(QColor(bt.V(0),bt.V(1),bt.V(2))); - QPalette pl(QColor(l.V(0),l.V(1),l.V(2))); //Error=0, Warning=1, Info=2, Debug=3, Direct=4, OnlyFileLog=5, OnlyConsole=6 ui.comboBoxInfoType->addItem("Any"); @@ -75,13 +66,26 @@ void CustomDialog::loadCurrentSetting(const Color4b& bb,const Color4b& bt,const //ui.comboBoxInfoType->addItem("Only file"); //ui.comboBoxInfoType->addItem("Only Console"); +} + + +void CustomDialog::loadCurrentSetting(const Color4b& bb,const Color4b& bt,const Color4b& l,short logLevel) +{ + bkgBottomColor=bb; + bkgTopColor=bt; + logAreaColor=l; + + // Changes the palette in the labels + QPalette pbb(QColor(bb.V(0),bb.V(1),bb.V(2))); + QPalette pbt(QColor(bt.V(0),bt.V(1),bt.V(2))); + QPalette pl(QColor(l.V(0),l.V(1),l.V(2))); + ui.comboBoxInfoType->setCurrentIndex(logLevel+1); ui.labelBottmBg->setPalette(pbb); ui.labelTopBg->setPalette(pbt); ui.labelLogArea->setPalette(pl); } - void CustomDialog::setBkgBottomColor() { QColor bb=QColorDialog::getColor(QColor(255,255,255,255),this); diff --git a/src/meshlab/glarea.cpp b/src/meshlab/glarea.cpp index 892a8fbd4..df9456d26 100644 --- a/src/meshlab/glarea.cpp +++ b/src/meshlab/glarea.cpp @@ -24,6 +24,9 @@ History $Log$ +Revision 1.60 2006/01/02 18:54:52 glvertex +added multilevel logging support + Revision 1.59 2005/12/22 20:01:23 glvertex - Added support for more than one shader - Some methods renamed @@ -262,6 +265,8 @@ GLArea::GLArea(QWidget *parent) trackBallVisible = true; currentSharder = NULL; time.start(); + + currLogLevel = -1; } @@ -277,14 +282,8 @@ void GLArea::displayModelInfo() renderText(currentWidth-currentWidth*0.15,currentHeight-30,strTriangle); } - -QSize GLArea::minimumSizeHint() const { - return QSize(400,300); -} - -QSize GLArea::sizeHint() const { - return QSize(400,300); -} +QSize GLArea::minimumSizeHint() const {return QSize(400,300);} +QSize GLArea::sizeHint() const {return QSize(400,300);} void GLArea::initializeGL() @@ -509,7 +508,7 @@ void GLArea::paintGL() // Now print out the infos glColor4f(1,1,1,1); if(logVisible) - log.glDraw(this,0,3); + log.glDraw(this,currLogLevel,3); displayModelInfo(); diff --git a/src/meshlab/glarea.h b/src/meshlab/glarea.h index 5ffd891f6..5b165c936 100644 --- a/src/meshlab/glarea.h +++ b/src/meshlab/glarea.h @@ -24,6 +24,9 @@ History $Log$ +Revision 1.41 2006/01/02 18:54:52 glvertex +added multilevel logging support + Revision 1.40 2006/01/02 16:14:07 glvertex Added setFileName and getFileName methods @@ -262,6 +265,7 @@ public: MeshModel *mm; vcg::Trackball trackball; GLLogStream log; + short currLogLevel; int currentWidth; int currentHeight; @@ -270,6 +274,9 @@ public: QString getFileName() {return fileName;} void setFileName(QString name) {fileName = name;} + + short getLogLevel() {return currLogLevel;} + void setLogLevel(short lvl) {currLogLevel = lvl;} RenderMode & getCurrentRenderMode() {return rm;} const ColorSetting& getCustomSetting() const {return cs;} diff --git a/src/meshlab/mainwindow_RunTime.cpp b/src/meshlab/mainwindow_RunTime.cpp index 68bf8bee2..5079553d1 100644 --- a/src/meshlab/mainwindow_RunTime.cpp +++ b/src/meshlab/mainwindow_RunTime.cpp @@ -24,6 +24,9 @@ History $Log$ +Revision 1.62 2006/01/02 18:54:52 glvertex +added multilevel logging support + Revision 1.61 2006/01/02 17:19:19 glvertex Changed include directive to new .ui filenames @@ -844,14 +847,15 @@ void MainWindow::setCustomize() { CustomDialog dialog(this); ColorSetting cs=GLA()->getCustomSetting(); - dialog.loadCurrentSetting(cs.bColorBottom,cs.bColorTop,cs.lColor); + dialog.loadCurrentSetting(cs.bColorBottom,cs.bColorTop,cs.lColor,GLA()->getLogLevel()); if (dialog.exec()==QDialog::Accepted) { // If press Ok set the selected colors in glArea cs.bColorBottom=dialog.getBkgBottomColor(); cs.bColorTop=dialog.getBkgTopColor(); cs.lColor=dialog.getLogAreaColor(); - GLA()->setCustomSetting(cs); + GLA()->setCustomSetting(cs); + GLA()->setLogLevel(dialog.getLogLevel()); } }