Commit 0e6b6246 authored by Jan Möbius's avatar Jan Möbius

Added filter Menu to loggerwidget to enable/disable openmesh error output

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@10693 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 47fe02c1
......@@ -97,6 +97,7 @@
* * Core/Gui/ToolBoxes/ToolBoxOnTheRight Toolbox on the right or on the left (bool)\n
* * Core/Gui/TaskSwitcher/Hide Show or Hide the task switcher(bool)\n
* * Core/Gui/LogWindow/LogWindowMode Log Window Mode .. 0 InScene, 1 Window, 2 Hidden (int)\n
* * Core/Gui/LogWindow/OpenMeshErrors Log OpenMesh Errors? (bool)\n
* * Core/Gui/splash This setting controls if the splash screen is shown at startup(bool)\n
* * Core/Gui/fullscreen Show OpenFlipper in Fullscreen Mode(bool)\n
* * Core/Projection/FOVY Field of view for projection matrix in perspective mode(double)\n
......
......@@ -49,6 +49,8 @@
#include <iostream>
#include <math.h>
#include <OpenMesh/Core/System/omstream.hh>
LoggerWidget::LoggerWidget( QWidget *parent)
: QWidget(parent),
newData_(true)
......@@ -65,7 +67,10 @@ LoggerWidget::LoggerWidget( QWidget *parent)
list_->setSelectionMode(QAbstractItemView::ExtendedSelection);
QString path = OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator();
// ============================
// Context Menu
// ============================
context_ = new QMenu(tr("Log Viewer"));
QAction* copyAction = new QAction(QIcon(path + "edit-copy.png"), tr("Copy"),0);
......@@ -80,6 +85,31 @@ LoggerWidget::LoggerWidget( QWidget *parent)
context_->addSeparator();
context_->addAction(selectAction);
// ============================
// Filters Menu
// ============================
filterMenu_ = new QMenu(tr("Log Viewer"));
QAction* openMeshFilterAction = new QAction(QIcon(path + "edit-copy.png"), tr("Enable OpenMesh error messages"),0);
openMeshFilterAction->setCheckable(true);
if ( OpenFlipperSettings().value("Core/Gui/LogWindow/OpenMeshErrors",true).toBool() ) {
openMeshFilterAction->setChecked( true );
omerr().enable();
} else {
openMeshFilterAction->setChecked( false );
omerr().disable();
}
filterMenu_->addAction(openMeshFilterAction);
connect (openMeshFilterAction, SIGNAL(toggled(bool)), this, SLOT(slotOpenMeshERR(bool)));
// ============================
// Scrollbar
// ============================
scrollBar_ = new QScrollBar(Qt::Vertical);
blockNext_ = false;
......@@ -106,6 +136,9 @@ LoggerWidget::LoggerWidget( QWidget *parent)
errorButton_ = new QPushButton(QIcon(path + "status_red.png"),tr("Errors"));
errorButton_->setCheckable(true);
errorButton_->setAutoExclusive(true);
filterButton_ = new QPushButton(QIcon(path + "status_red.png"),tr("Filters"));
filterButton_->setCheckable(true);
allButton_->setChecked(true);
......@@ -113,6 +146,7 @@ LoggerWidget::LoggerWidget( QWidget *parent)
connect(infoButton_, SIGNAL(clicked()), this, SLOT(updateList()));
connect(warnButton_, SIGNAL(clicked()), this, SLOT(updateList()));
connect(errorButton_, SIGNAL(clicked()), this, SLOT(updateList()));
connect(filterButton_,SIGNAL(clicked()), this, SLOT(slotFilterMenu()));
clearButton_ = new QPushButton(QIcon(path + "edit-clear.png"),tr("Clear Messages"));
connect(clearButton_, SIGNAL(clicked()), list_, SLOT(clear()));
......@@ -122,6 +156,8 @@ LoggerWidget::LoggerWidget( QWidget *parent)
hlayout->addWidget( warnButton_ );
hlayout->addWidget( errorButton_ );
hlayout->addStretch();
hlayout->addWidget( filterButton_ );
hlayout->addStretch();
hlayout->addWidget( clearButton_ );
hlayout->setSpacing(0);
......@@ -316,9 +352,10 @@ void LoggerWidget::keyPressEvent (QKeyEvent * _event ) {
/// show context menu
void LoggerWidget::contextMenuEvent ( QContextMenuEvent * event ){
QPoint p = list_->mapToGlobal( list_->pos() );
QPoint p = list_->mapToGlobal( event->pos() );
context_->popup( p );
context_->popup( event->globalPos() );
}
//-------------------------------------------------------------------------------------
......@@ -335,3 +372,23 @@ void LoggerWidget::copySelected (){
clipboard->setText(str);
}
//-------------------------------------------------------------------------------------
void LoggerWidget::slotFilterMenu() {
filterMenu_->popup( list_->mapToGlobal(filterButton_->pos()) );
}
//-------------------------------------------------------------------------------------
void LoggerWidget::slotOpenMeshERR(bool _state) {
if ( _state ) {
omerr().enable();
} else {
omerr().disable();
}
OpenFlipperSettings().setValue("Core/Gui/LogWindow/OpenMeshErrors",_state);
}
......@@ -104,10 +104,14 @@ class LoggerWidget : public QWidget
QPushButton* warnButton_;
QPushButton* errorButton_;
QPushButton* filterButton_;
QPushButton* clearButton_;
QMenu* context_;
QMenu* filterMenu_;
QTimer loggerUpdateTimer_;
// true if new data is available
......@@ -126,6 +130,12 @@ class LoggerWidget : public QWidget
/// Called when we want to scroll to the bottom
void slotScrollUpdate();
/// Called when OpenMesh error checkbox is changed
void slotOpenMeshERR(bool _state);
/// Called when filter button is pressed
void slotFilterMenu();
};
#endif //LOGGERWIDGET_HH
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment