Commit 33064210 authored by Alexander Wiebel's avatar Alexander Wiebel
Browse files

[ADD] modules can have specific icons now

- added icons for marching cubes and nifti writer
parent 7b1be310
......@@ -26,6 +26,7 @@
#include <string>
#include "WIconManager.h"
#include "../../kernel/WModuleFactory.h"
void WIconManager::addIcon( std::string name, const char* const xpm[] )
{
......@@ -37,6 +38,17 @@ void WIconManager::addIcon( std::string name, const char* const xpm[] )
QIcon WIconManager::getIcon( const std::string name )
{
assert( ( m_iconList.count( name ) == 1 ) );
return *m_iconList[name];
QIcon icon;
if( m_iconList.count( name ) != 0 )
{
icon = *m_iconList[name];
}
else if( WModuleFactory::getModuleFactory()->getPrototypeByName( name ) )
{
icon = QIcon( QPixmap( WModuleFactory::getModuleFactory()->getPrototypeByName( name )->getXPMIcon() ) );
}
else
assert( 0 && "No icon with the given name found." );
return icon;
}
......@@ -397,7 +397,7 @@ void WQtDatasetBrowser::createCompatibleButtons( boost::shared_ptr< WModule >mod
for ( std::set< boost::shared_ptr< WModule > >::iterator iter = comps.begin(); iter != comps.end(); ++iter )
{
WQtPushButton* button = m_mainWindow->getCompatiblesToolBar()->addPushButton( QString( ( *iter )->getName().c_str() ),
m_mainWindow->getIconManager()->getIcon( "o" ), QString( ( *iter )->getName().c_str() ) );
m_mainWindow->getIconManager()->getIcon( ( *iter )->getName().c_str() ), QString( ( *iter )->getName().c_str() ) );
connect( button, SIGNAL( pushButtonPressed( QString ) ), m_mainWindow, SLOT( slotActivateModule( QString ) ) );
}
......
......@@ -304,6 +304,48 @@ boost::shared_ptr< WProgressCombiner > WModule::getRootProgressCombiner()
return m_progress;
}
const char** WModule::getXPMIcon() const
{
static const char * o_xpm[] =
{
"16 16 17 1",
" c None",
". c #B6B6B6",
"+ c #B0B0B0",
"@ c #B8B8B8",
"# c #A6A6A6",
"$ c #969696",
"% c #8C8C8C",
"& c #9F9F9F",
"* c #848484",
"= c #6F6F6F",
"- c #636363",
"; c #626262",
"> c #4A4A4A",
", c #3E3E3E",
"' c #2E2E2E",
") c #1F1F1F",
"! c #0D0D0D",
" ",
" ",
" .++. ",
" @#$%%$#@ ",
" @&*=--=*&@ ",
" #*;>,,>;*# ",
" .$=>'))'>=$. ",
" +%-,)!!),-%+ ",
" +%-,)!!),-%+ ",
" .$=>'))'>=$. ",
" #*;>,,>;*# ",
" @&*=--=*&@ ",
" @#$%%$#@ ",
" .++. ",
" ",
" "
};
return o_xpm;
}
void WModule::ready()
{
m_isReady( true );
......
......@@ -201,6 +201,11 @@ public:
*/
virtual boost::shared_ptr< WProgressCombiner > getRootProgressCombiner();
/**
* Get the icon for this module in XPM format.
*/
virtual const char** getXPMIcon() const;
protected:
/**
......
......@@ -31,6 +31,7 @@
#include "WMMarchingCubes.h"
#include "iso_surface.xpm"
#include "marchingCubesCaseTables.h"
#include "../../dataHandler/WTriangleMesh.h"
......@@ -85,6 +86,11 @@ boost::shared_ptr< WModule > WMMarchingCubes::factory() const
return boost::shared_ptr< WModule >( new WMMarchingCubes() );
}
const char** WMMarchingCubes::getXPMIcon() const
{
return iso_surface_xpm;
}
const std::string WMMarchingCubes::getName() const
{
return "Isosurface";
......
......@@ -134,6 +134,11 @@ public:
*/
virtual boost::shared_ptr< WModule > factory() const;
/**
* Get the icon for this module in XPM format.
*/
virtual const char** getXPMIcon() const;
/**
* Generate the triangles for the surface on the given dataSet (inGrid, vals).
* \param inGrid The grid of the data set
......
......@@ -57,6 +57,38 @@ boost::shared_ptr< WModule > WMWriteNIfTI::factory() const
return boost::shared_ptr< WModule >( new WMWriteNIfTI() );
}
const char** WMWriteNIfTI::getXPMIcon() const
{
static const char * disc_xpm[] =
{
"16 16 7 1",
" c None",
". c #000080",
"+ c #000000",
"@ c #FFFF00",
"# c #E0E0E0",
"$ c #FFFFFF",
"% c #C0C0C0",
"..+++++++++++..+",
"..@@@@@@@@@@@..+",
"..###########..+",
"..$$$$$$$$$$$..+",
"..###########..+",
"..$$$$$$$$$$$..+",
"..###########..+",
"..$$$$$$$$$$$..+",
"...............+",
"....%%%%%%%....+",
"....%..%%%%....+",
"....%..%%%%....+",
"....%..%%%%....+",
"....%..%%%%....+",
"+...%%%%%%%....+",
"++++++++++++++++"
};
return disc_xpm;
}
const std::string WMWriteNIfTI::getName() const
{
return "Write NIfTI";
......
......@@ -86,6 +86,12 @@ public:
*/
virtual boost::shared_ptr< WModule > factory() const;
/**
* Get the icon for this module in XPM format.
*/
virtual const char** getXPMIcon() const;
protected:
/**
* Entry point after loading the module. Runs in separate thread.
......
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