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() { ...@@ -279,6 +279,8 @@ Core::init() {
connect(coreWidget_, SIGNAL(showPlugins()) , this, SLOT(slotShowPlugins())); connect(coreWidget_, SIGNAL(showPlugins()) , this, SLOT(slotShowPlugins()));
connect(coreWidget_, SIGNAL(call(QString,bool&)), this, SLOT(slotCall(QString,bool&))); 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(); QRect rect = QApplication::desktop()->screenGeometry();
...@@ -930,6 +932,29 @@ void Core::loggerState(int _state) { ...@@ -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 ) { void Core::showToolbox( bool _state ) {
if ( OpenFlipper::Options::gui() ) if ( OpenFlipper::Options::gui() )
coreWidget_->showToolbox(_state); coreWidget_->showToolbox(_state);
...@@ -1358,6 +1383,7 @@ void Core::setDescriptions(){ ...@@ -1358,6 +1383,7 @@ void Core::setDescriptions(){
QStringList(tr("Show?")) , QStringList(tr("Show?")) ,
QStringList()); QStringList());
emit setSlotDescription("loggerState(int)", tr("Change the logger window state"), QStringList(tr("Change the logger window state")), 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("showToolbox(bool)", tr("Show or hide toolbox"), QStringList(tr("Show or hide the toolbox")), QStringList());
emit setSlotDescription("multiViewMode(int)", tr("Switch MultiView Mode"), emit setSlotDescription("multiViewMode(int)", tr("Switch MultiView Mode"),
QStringList(tr("Mode")), QStringList(tr("0: One Viewer\n 1: Grid \n 2: Horizontal split"))); QStringList(tr("Mode")), QStringList(tr("0: One Viewer\n 1: Grid \n 2: Horizontal split")));
......
...@@ -475,6 +475,9 @@ public slots: ...@@ -475,6 +475,9 @@ public slots:
/// Change the logging window state /// Change the logging window state
void loggerState(int _state); void loggerState(int _state);
/// Enable or disable OpenMesh error logging
void enableOpenMeshErrorLog(bool _state);
/// Show or hide toolbox /// Show or hide toolbox
void showToolbox( bool _state ); void showToolbox( bool _state );
......
...@@ -91,21 +91,19 @@ LoggerWidget::LoggerWidget( QWidget *parent) ...@@ -91,21 +91,19 @@ LoggerWidget::LoggerWidget( QWidget *parent)
// ============================ // ============================
filterMenu_ = new QMenu(tr("Log Viewer")); filterMenu_ = new QMenu(tr("Log Viewer"));
QAction* openMeshFilterAction = new QAction(QIcon(path + "edit-copy.png"), tr("Enable OpenMesh error messages"),0); openMeshFilterAction_ = new QAction(QIcon(path + "edit-copy.png"), tr("Enable OpenMesh error messages"),0);
openMeshFilterAction->setCheckable(true); openMeshFilterAction_->setCheckable(true);
if ( OpenFlipperSettings().value("Core/Gui/LogWindow/OpenMeshErrors",true).toBool() ) { if ( OpenFlipperSettings().value("Core/Gui/LogWindow/OpenMeshErrors",true).toBool() ) {
openMeshFilterAction->setChecked( true ); openMeshFilterAction_->setChecked( true );
omerr().enable(); omerr().enable();
} else { } else {
openMeshFilterAction->setChecked( false ); openMeshFilterAction_->setChecked( false );
omerr().disable(); omerr().disable();
} }
filterMenu_->addAction(openMeshFilterAction); filterMenu_->addAction(openMeshFilterAction_);
connect (openMeshFilterAction, SIGNAL(toggled(bool)), this, SLOT(slotOpenMeshERR(bool)));
// ============================ // ============================
// Scrollbar // Scrollbar
...@@ -379,16 +377,3 @@ void LoggerWidget::slotFilterMenu() { ...@@ -379,16 +377,3 @@ void LoggerWidget::slotFilterMenu() {
filterMenu_->popup( list_->mapToGlobal(filterButton_->pos()) ); 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 ...@@ -117,6 +117,10 @@ class LoggerWidget : public QWidget
// true if new data is available // true if new data is available
bool newData_; bool newData_;
public:
// Action for OpenMesh filters
QAction* openMeshFilterAction_;
private slots: private slots:
/// update the list if a button was pressed /// update the list if a button was pressed
void updateList(); void updateList();
...@@ -131,9 +135,6 @@ class LoggerWidget : public QWidget ...@@ -131,9 +135,6 @@ class LoggerWidget : public QWidget
/// Called when we want to scroll to the bottom /// Called when we want to scroll to the bottom
void slotScrollUpdate(); void slotScrollUpdate();
/// Called when OpenMesh error checkbox is changed
void slotOpenMeshERR(bool _state);
/// Called when filter button is pressed /// Called when filter button is pressed
void slotFilterMenu(); 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