void PrefAssociations::refreshList() { m_regExtensions.clear(); WinFileAssoc ().GetRegisteredExtensions(Extensions().multimedia(), m_regExtensions); for (int k = 0; k < listWidget->count(); k++) { QListWidgetItem* pItem = listWidget->item(k); if (pItem) { pItem->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled); if (m_regExtensions.contains(pItem->text())) { pItem->setCheckState(Qt::Checked); //Don't allow de-selection in windows VISTA if extension is registered. //VISTA doesn't seem to support extension 'restoration' in the API. if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA) { pItem->setFlags(0); } } else { pItem->setCheckState(Qt::Unchecked); } } } }
void Load( const std::string &fileName, const std::string &plugin = std::string("") ) { constexpr const char *dbg_CurFunc = "Toolbox::Image::Load(const std::string &, const std::string &)"; if ( _PluginMgr.Plugins().empty() ) throw std::runtime_error( std::string(dbg_CurFunc) + ": No Image plugins loaded!" ); // Find which plugin we need to load the file with if ( !plugin.empty() ) { // If explicitly given, lets use it auto ImgPlugin = _PluginMgr.Create< Image_Plugin >( plugin ); ImgPlugin->Load( fileName, this ); } else { std::string Extension( Plugin::GetExtFromFilename(fileName) ); auto Plugins = _PluginMgr.Plugins(); // If plugin is not provided, we search our plugins for the fileName's extension bool Found = false; for ( auto p = Plugins.begin(), p_end = Plugins.end(); p != p_end; ++p ) { auto ImgPlugin = _PluginMgr.Create< Image_Plugin >( (*p)->Name() ); if ( !ImgPlugin ) throw std::runtime_error( std::string(dbg_CurFunc) + ": Failed to create plugin instance." ); Image_Plugin::tExtensionList Extensions = ImgPlugin->Extensions(); for ( auto e = Extensions.begin(), e_end = Extensions.end(); e != e_end; ++e ) { if ( !e->compare(Extension) ) { Found = true; ImgPlugin->Load( fileName, this ); break; } } ImgPlugin.reset(); Extensions.clear(); if ( Found ) break; } if ( !Found ) throw std::runtime_error( std::string(dbg_CurFunc) + ": Failed to load image. Couldn't find a plugin to load '" + Extension + "' files." ); } }
int main( int argc, char **argv) { struct Certificate cert; int lth; Certificate(&cert, (ushort) 0); if (argc == 0 || argc < 3) FATAL(MSG_USAGE); lth = get_casn_file(&cert.self, argv[1], 0); struct casn *casnp = &cert.toBeSigned.serialNumber; if ((lth = vsize_casn(casnp)) < 6) FATAL(MSG_SN); struct Extension *extp; if (!(extp = find_extension(&cert.toBeSigned.extensions, id_pe_ipAddrBlock, 0))) FATAL(MSG_EXT, "IPAddress"); struct Extensions extensions; Extensions(&extensions, (ushort) 0); if ((lth = get_casn_file(&extensions.self, argv[2], 0)) < 0) FATAL(MSG_OPEN, argv[2]); struct Extension *sbextp = (struct Extension *)member_casn(&extensions.self, 0); // ip // Addresses uchar *sb = (uchar *) calloc(1, size_casn(&sbextp->self)); read_casn(&sbextp->self, sb); uchar *b = (uchar *) calloc(1, size_casn(&extp->self)); read_casn(&extp->self, b); if (diff_casn(&sbextp->self, &extp->self)) FATAL(MSG_IN, "IP Addresses"); sbextp = (struct Extension *)next_of(&sbextp->self); if (!(extp = find_extension(&cert.toBeSigned.extensions, id_pe_autonomousSysNum, 0))) FATAL(MSG_EXT, "AS number"); if (diff_casn(&sbextp->self, &extp->self)) FATAL(MSG_IN, "AS numbers"); DONE(MSG_OK, argv[1]); return 0; }
void PrintGLES2Extensions( ) { std::string Extensions( reinterpret_cast< const char * >( glGetString( GL_EXTENSIONS ) ) ); std::vector< std::string > ExtensionArray; size_t ExtensionStart = 0, ExtensionEnd = 0; while( ExtensionEnd < Extensions.size( ) ) { if( Extensions[ ExtensionEnd ] == ' ' ) { std::string Extension = Extensions.substr( ExtensionStart, ExtensionEnd - ExtensionStart ); ExtensionArray.push_back( Extension ); // Skip the space ExtensionStart = ExtensionEnd + 1; } else if( ExtensionEnd == Extensions.size( ) - 1 ) { std::string Extension = Extensions.substr( ExtensionStart, Extensions.size( ) - ExtensionStart ); ExtensionArray.push_back( Extension ); } ++ExtensionEnd; } std::cout << "[Aura::PrintGLES2Extensions] <INFO> " << ExtensionArray.size( ) << " extensions available" << std::endl; for( size_t Extension = 0; Extension < ExtensionArray.size( ); ++Extension ) { std::cout << "\t" << ExtensionArray[ Extension ] << std::endl; } }
bool GLQuery::IsExtensionSupported(const std::string& extension) { std::vector<std::string> extensions = Extensions(); return (std::find(extensions.begin(), extensions.end(), extension) != extensions.end()); }
bool CVideoSyncGLX::Setup(PUPDATECLOCK func) { CSingleLock lock(g_graphicsContext); m_glXWaitVideoSyncSGI = NULL; m_glXGetVideoSyncSGI = NULL; m_vInfo = NULL; m_Window = 0; m_Context = NULL; UpdateClock = func; int singleBufferAttributes[] = { GLX_RGBA, GLX_RED_SIZE, 0, GLX_GREEN_SIZE, 0, GLX_BLUE_SIZE, 0, None }; int ReturnV, SwaMask; unsigned int GlxTest; XSetWindowAttributes Swa; m_vInfo = NULL; m_Context = NULL; m_Window = 0; CLog::Log(LOGDEBUG, "CVideoReferenceClock: Setting up GLX"); m_winSystem.Register(this); m_displayLost = false; m_displayReset = false; m_lostEvent.Reset(); if (!m_Dpy) { m_Dpy = XOpenDisplay(NULL); if (!m_Dpy) { CLog::Log(LOGDEBUG, "CVideoReferenceClock: Unable to open display"); return false; } } if (!glXQueryExtension(m_Dpy, NULL, NULL)) { CLog::Log(LOGDEBUG, "CVideoReferenceClock: X server does not support GLX"); return false; } bool ExtensionFound = false; std::istringstream Extensions(glXQueryExtensionsString(m_Dpy, m_winSystem.GetCurrentScreen())); std::string ExtensionStr; while (!ExtensionFound) { Extensions >> ExtensionStr; if (Extensions.fail()) break; if (ExtensionStr == "GLX_SGI_video_sync") ExtensionFound = true; } if (!ExtensionFound) { CLog::Log(LOGDEBUG, "CVideoReferenceClock: X server does not support GLX_SGI_video_sync"); return false; } m_vInfo = glXChooseVisual(m_Dpy, m_winSystem.GetCurrentScreen(), singleBufferAttributes); if (!m_vInfo) { CLog::Log(LOGDEBUG, "CVideoReferenceClock: glXChooseVisual returned NULL"); return false; } Swa.border_pixel = 0; Swa.event_mask = StructureNotifyMask; Swa.colormap = XCreateColormap(m_Dpy, m_winSystem.GetWindow(), m_vInfo->visual, AllocNone ); SwaMask = CWBorderPixel | CWColormap | CWEventMask; m_Window = XCreateWindow(m_Dpy, m_winSystem.GetWindow(), 0, 0, 256, 256, 0, m_vInfo->depth, InputOutput, m_vInfo->visual, SwaMask, &Swa); m_Context = glXCreateContext(m_Dpy, m_vInfo, NULL, True); if (!m_Context) { CLog::Log(LOGDEBUG, "CVideoReferenceClock: glXCreateContext returned NULL"); return false; } ReturnV = glXMakeCurrent(m_Dpy, m_Window, m_Context); if (ReturnV != True) { CLog::Log(LOGDEBUG, "CVideoReferenceClock: glXMakeCurrent returned %i", ReturnV); return false; } m_glXWaitVideoSyncSGI = (int (*)(int, int, unsigned int*))glXGetProcAddress((const GLubyte*)"glXWaitVideoSyncSGI"); if (!m_glXWaitVideoSyncSGI) { CLog::Log(LOGDEBUG, "CVideoReferenceClock: glXWaitVideoSyncSGI not found"); return false; } ReturnV = m_glXWaitVideoSyncSGI(2, 0, &GlxTest); if (ReturnV) { CLog::Log(LOGDEBUG, "CVideoReferenceClock: glXWaitVideoSyncSGI returned %i", ReturnV); return false; } m_glXGetVideoSyncSGI = (int (*)(unsigned int*))glXGetProcAddress((const GLubyte*)"glXGetVideoSyncSGI"); if (!m_glXGetVideoSyncSGI) { CLog::Log(LOGDEBUG, "CVideoReferenceClock: glXGetVideoSyncSGI not found"); return false; } ReturnV = m_glXGetVideoSyncSGI(&GlxTest); if (ReturnV) { CLog::Log(LOGDEBUG, "CVideoReferenceClock: glXGetVideoSyncSGI returned %i", ReturnV); return false; } return true; }