/** @brief Init * * @todo: document this function */ bool Customizations::Init(const wxString& archive_name ) { //!TODO require blocking usync init if it's not loaded m_modname = archive_name; bool ret = m_customs.loadOptions( OptionsWrapper::ModCustomizations, m_modname ); if ( ret ) { #ifdef SL_QT_MODE m_shortname = ToQString( shortname ); #endif wxBitmap icon_bmp( wxNullBitmap ); if ( GetBitmap( _T("icon"), icon_bmp ) ) { wxIcon tmp; tmp.CopyFromBitmap( icon_bmp ); m_app_icons = wxIconBundle( tmp );//replacing current int i = 1; while( GetBitmap( wxString::Format(_T("icon%d"), i ), icon_bmp ) ) { tmp.CopyFromBitmap( icon_bmp ); m_app_icons.AddIcon( tmp ); } } m_help_url = m_customs.getSingleValue( _T("help_url") ); } m_active = ret; return ret; }
/** @brief Init * * @todo: document this function */ bool Customizations::Init( const wxString& archive_name ) { m_archive = archive_name; LSL::susynclib().AddArchive(STD_STRING(m_archive)); //!TODO require blocking usync init if it's not loaded bool ret = m_customs.loadOptions( LSL::OptionsWrapper::ModCustomizations, STD_STRING(m_archive)); if ( ret ) { wxBitmap icon_bmp( wxNullBitmap ); if ( GetBitmap( _T("icon"), icon_bmp ) ) { wxIcon tmp; tmp.CopyFromBitmap( icon_bmp ); m_app_icons = wxIconBundle( tmp );//replacing current int i = 1; while( GetBitmap( wxString::Format(_T("icon%d"), i ), icon_bmp ) ) { tmp.CopyFromBitmap( icon_bmp ); m_app_icons.AddIcon( tmp ); } } m_help_url = TowxString(m_customs.getSingleValue("help_url")); } m_active = ret; return ret; }
bool Customizations::GetBitmap( const wxString& key, wxBitmap& bitmap ) { if ( Provides( key ) ) { const wxString path = m_customs.getSingleValue( key ); #ifdef SL_QT_MODE wxBitmap icon_bmp ( wxQtConvertImage( usync().GetQImage( m_modname, path, false ) ) ); #else wxBitmap icon_bmp (usync().GetImage( m_modname, path, false ) ); #endif if( icon_bmp.IsOk() ) { bitmap = icon_bmp; return true; } } return false;//either loaded bmp was kaput or key not found }