Commit 8d718324 authored by Jan Möbius's avatar Jan Möbius

Scripting function and gui change for OpenMesh log output control

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@10694 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 0e6b6246
......@@ -279,6 +279,8 @@ Core::init() {
connect(coreWidget_, SIGNAL(showPlugins()) , this, SLOT(slotShowPlugins()));
connect(coreWidget_, SIGNAL(call(QString,bool&)), this, SLOT(slotCall(QString,bool&)));
connect( coreWidget_->logWidget_->openMeshFilterAction_,SIGNAL(toggled(bool)), this, SLOT(enableOpenMeshErrorLog(bool)) );
QRect rect = QApplication::desktop()->screenGeometry();
......@@ -930,6 +932,29 @@ void Core::loggerState(int _state) {
//-----------------------------------------------------------------------------
void Core::enableOpenMeshErrorLog(bool _state) {
std::cerr << "Script" << std::endl;
// Set the state on openmesh stream
if ( _state ) {
omerr().enable();
} else {
omerr().disable();
}
if ( OpenFlipper::Options::gui() ) {
// store in application settings
OpenFlipperSettings().setValue("Core/Gui/LogWindow/OpenMeshErrors",_state);
coreWidget_->logWidget_->openMeshFilterAction_->blockSignals(true);
coreWidget_->logWidget_->openMeshFilterAction_->setChecked(_state);
coreWidget_->logWidget_->openMeshFilterAction_->blockSignals(false);
}
}
//-----------------------------------------------------------------------------
void Core::showToolbox( bool _state ) {
if ( OpenFlipper::Options::gui() )
coreWidget_->showToolbox(_state);
......@@ -1358,6 +1383,7 @@ void Core::setDescriptions(){
QStringList(tr("Show?")) ,
QStringList());
emit setSlotDescription("loggerState(int)", tr("Change the logger window state"), QStringList(tr("Change the logger window state")), QStringList());
emit setSlotDescription("enableOpenMeshErrorLog(bool)", tr("Enable or disable OpenMesh error logging"), QStringList(tr("OpenMesh error logging enabled")), QStringList());
emit setSlotDescription("showToolbox(bool)", tr("Show or hide toolbox"), QStringList(tr("Show or hide the toolbox")), QStringList());
emit setSlotDescription("multiViewMode(int)", tr("Switch MultiView Mode"),
QStringList(tr("Mode")), QStringList(tr("0: One Viewer\n 1: Grid \n 2: Horizontal split")));
......
......@@ -475,6 +475,9 @@ public slots:
/// Change the logging window state
void loggerState(int _state);
/// Enable or disable OpenMesh error logging
void enableOpenMeshErrorLog(bool _state);
/// Show or hide toolbox
void showToolbox( bool _state );
......
......@@ -91,21 +91,19 @@ LoggerWidget::LoggerWidget( QWidget *parent)
// ============================
filterMenu_ = new QMenu(tr("Log Viewer"));
QAction* openMeshFilterAction = new QAction(QIcon(path + "edit-copy.png"), tr("Enable OpenMesh error messages"),0);
openMeshFilterAction->setCheckable(true);
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 );
openMeshFilterAction_->setChecked( true );
omerr().enable();
} else {
openMeshFilterAction->setChecked( false );
openMeshFilterAction_->setChecked( false );
omerr().disable();
}
filterMenu_->addAction(openMeshFilterAction);
connect (openMeshFilterAction, SIGNAL(toggled(bool)), this, SLOT(slotOpenMeshERR(bool)));
filterMenu_->addAction(openMeshFilterAction_);
// ============================
// Scrollbar
......@@ -379,16 +377,3 @@ 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);
}
......@@ -117,6 +117,10 @@ class LoggerWidget : public QWidget
// true if new data is available
bool newData_;
public:
// Action for OpenMesh filters
QAction* openMeshFilterAction_;
private slots:
/// update the list if a button was pressed
void updateList();
......@@ -131,9 +135,6 @@ 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();
};
......
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