Commit 6e88eec4 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[CHANGE] - long loading modules (WMTemplate) now do not block the GUI anymore...

[CHANGE] - long loading modules (WMTemplate) now do not block the GUI anymore if applied using the compatibles buttons -> adopted compatibles toolbar to use the new combiner classes for adding modules.
parent 9adbcd69
......@@ -14,6 +14,7 @@ SET(GUI_QT4_MOC_HDRS
WMainWindow.h
WQtNavGLWidget.h
guiElements/WQtPushButton.h
guiElements/WQtApplyModulePushButton.h
datasetbrowser/WPropertyWidget.h
datasetbrowser/WPropertyBoolWidget.h
datasetbrowser/WPropertyIntWidget.h
......
......@@ -42,6 +42,7 @@
#include "../events/WRoiAssocEvent.h"
#include "../events/WModuleReadyEvent.h"
#include "../events/WEventTypes.h"
#include "../guiElements/WQtApplyModulePushButton.h"
#include "WQtNumberEdit.h"
#include "WQtNumberEditDouble.h"
#include "WQtTextureSorter.h"
......@@ -462,20 +463,14 @@ void WQtDatasetBrowser::createCompatibleButtons( boost::shared_ptr< WModule >mod
const std::string tmpName = ( *iter )->getTargetPrototype()->getName();
if( std::find( m_moduleWhiteList.begin(), m_moduleWhiteList.end(), tmpName ) == m_moduleWhiteList.end() )
{
continue; //do nothing for modules that are not in white list
continue; // do nothing for modules that are not in white list
}
}
QString buttonText = "";
if( m_showToolBarText )
{
buttonText = ( *iter )->getTargetPrototype()->getName().c_str();
}
WQtPushButton* button = m_mainWindow->getCompatiblesToolBar()->addPushButton( QString( ( *iter )->getTargetPrototype()->getName().c_str() ),
m_mainWindow->getIconManager()->getIcon( ( *iter )->getTargetPrototype()->getName().c_str() ), buttonText );
button->setToolTip( ( *iter )->getTargetPrototype()->getName().c_str() );
//connect( button, SIGNAL( pushButtonPressed( QString ) ), m_mainWindow, SLOT( slotActivateModule( QString ) ) );
WQtApplyModulePushButton* button = new WQtApplyModulePushButton( m_mainWindow->getCompatiblesToolBar(), m_mainWindow->getIconManager(),
*iter, m_showToolBarText
);
m_mainWindow->getCompatiblesToolBar()->addWidget( button );
}
}
......
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#include <string>
#include "WQtApplyModulePushButton.h"
WQtApplyModulePushButton::WQtApplyModulePushButton( QWidget* parent, WIconManager* iconManager,
boost::shared_ptr< WApplyPrototypeCombiner > combiner, bool useText ):
QPushButton( parent ),
m_combiner( combiner )
{
setIcon( iconManager->getIcon( combiner->getTargetPrototype()->getName().c_str() ) );
setToolTip( combiner->getTargetPrototype()->getName().c_str() );
if ( useText )
{
setText( combiner->getTargetPrototype()->getName().c_str() );
}
// we need to use released signal here, as the pushed signal also gets emitted on newly created buttons which are under the mouse pointer with
// pressed left button.
connect( this, SIGNAL( released() ), this, SLOT( emitPressed() ) );
}
WQtApplyModulePushButton::~WQtApplyModulePushButton()
{
}
void WQtApplyModulePushButton::emitPressed()
{
m_combiner->run();
}
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef WQTAPPLYMODULEPUSHBUTTON_H
#define WQTAPPLYMODULEPUSHBUTTON_H
#include <string>
#include <boost/shared_ptr.hpp>
#include <QtGui/QPushButton>
#include "../WIconManager.h"
#include "../../../kernel/combiner/WApplyPrototypeCombiner.h"
/**
* Implements a QPushButton with a boost signal for convenience.
*/
class WQtApplyModulePushButton : public QPushButton
{
Q_OBJECT
public:
/**
* Constructor creating a module application button.
*
* \param parent the parent
* \param iconManager the icon manager to use
* \param combiner the combiner that is represented by this button
* \param useText true if a text should be shown.
*/
WQtApplyModulePushButton( QWidget* parent, WIconManager* iconManager,
boost::shared_ptr< WApplyPrototypeCombiner > combiner, bool useText = true );
/**
* destructor
*/
virtual ~WQtApplyModulePushButton();
protected:
/**
* The combiner used in this button.
*/
boost::shared_ptr< WApplyPrototypeCombiner > m_combiner;
private:
public slots:
/**
* Slot getting called when the button got pressed. It applies the combiner.
*/
void emitPressed();
};
#endif // WQTAPPLYMODULEPUSHBUTTON_H
......@@ -269,7 +269,6 @@ std::set< boost::shared_ptr< WApplyPrototypeCombiner > > WModuleFactory::getComp
if( ( *cons.begin() )->connectable( *pcons.begin() ) && ( *pcons.begin() )->connectable( *cons.begin() ) )
{
// it is compatible -> add to list
compatibles.insert( boost::shared_ptr< WApplyPrototypeCombiner >(
new WApplyPrototypeCombiner( module, ( *cons.begin() )->getName(), *listIter, ( *pcons.begin() )->getName() ) )
);
......
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