Commit 213a2fb7 by Sebastian Eichelbaum

[CHANGE] moved icons to own location in the OW share directory as the icons…

[CHANGE] moved icons to own location in the OW share directory as the icons might conflict with system files if placed in pixmaps dir.
parent 581c27b9
......@@ -50,7 +50,7 @@ void WIconManager::addMapping( const std::string& newName, const std::string& ma
QIcon WIconManager::getIcon( const std::string name )
{
// ensure we have a fallback icon
boost::filesystem::path fallback = WPathHelper::getPathHelper()->getSharePath() / ".." / "pixmaps" / "default.png";
boost::filesystem::path fallback = WPathHelper::getPathHelper()->getSharePath() / "qt4gui" / "default.png";
WAssert( boost::filesystem::exists( fallback ), "Found no icon named: " + name + " and no fallback icon. Installation broken?" );
return getIcon( name, QIcon( QPixmap( QString::fromStdString( fallback.string() ) ) ) );
}
......@@ -66,7 +66,9 @@ QIcon WIconManager::getIcon( const std::string name, const QIcon& defaultIcon )
}
// search file
boost::filesystem::path p = WPathHelper::getPathHelper()->getSharePath() / ".." / "pixmaps" / std::string( iconFile + ".png" );
boost::filesystem::path p = WPathHelper::getPathHelper()->getSharePath() / "qt4gui" / std::string( iconFile + ".png" );
// and an alternative path
boost::filesystem::path pAlt = WPathHelper::getPathHelper()->getSharePath() / ".." / "pixmaps" / std::string( iconFile + ".png" );
if( boost::filesystem::exists( p ) )
{
try
......@@ -78,6 +80,17 @@ QIcon WIconManager::getIcon( const std::string name, const QIcon& defaultIcon )
return defaultIcon;
}
}
else if( boost::filesystem::exists( pAlt ) )
{
try
{
return QIcon( QPixmap( QString::fromStdString( pAlt.string() ) ) );
}
catch( ... )
{
return defaultIcon;
}
}
else if( WModuleFactory::getModuleFactory()->isPrototypeAvailable( name ) )
{
// get module icon from meta info if available
......@@ -117,6 +130,7 @@ QIcon WIconManager::getIcon( const std::string name, const QIcon& defaultIcon )
}
else
{
wlog::debug( "WIconManager" ) << pAlt.string();
wlog::debug( "WIconManager" ) << "Icon \"" << name << "\" not found. Falling back to default.";
return defaultIcon;
}
......
......@@ -165,7 +165,7 @@ void WMainWindow::setupGUI()
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// We need several icons later in the GUI. Build some mappings:
m_iconManager.addMapping( "logo", "sopenwalnut" );
m_iconManager.addMapping( "logo", "openwalnut" );
m_iconManager.addMapping( "axial icon", "orientation_axial" );
m_iconManager.addMapping( "coronal icon", "orientation_coronal" );
m_iconManager.addMapping( "sagittal icon", "orientation_sagittal" );
......
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