void GBVCallOutline::load() //---------------------------- // this code is cut-and-pasted from GTFUNC.CPP // FIXME -- this should all be put back in one spot { BusyNotice busy( "Loading..." ); TreeNodeList roots; int i; _loadFilter->setSymType( KSTFunctions ); TreeFuncNode::loadModule( NULL, dbManager()->module(), roots, _loadFilter ); for( i = 0; i < roots.count(); i += 1 ) { TreeFuncNode * node = (TreeFuncNode *) roots[ i ]; for( int j = 0; j < node->getCount( TreeNode::FlatList ); j += 1 ) { TreeFuncNode *pNode; pNode = (TreeFuncNode *) node->getNode( TreeNode::FlatList, j ); if( pNode->getCount( TreeNode::ParentList ) == 0 ) { addLevel0( pNode ); } } } for( i = 0; i < roots.count(); i += 1 ) { TreeFuncNode * node = (TreeFuncNode *) roots[ i ]; node->deleteTree(); } reset(); }
void DownloadManager::setDbManager(DbManager *nDbManager) { if (nDbManager != m_dbManager) { m_dbManager = nDbManager; #ifdef QT_DEBUG qDebug() << "Changed dbManager to" << m_dbManager; #endif emit dbManagerChanged(dbManager()); } }
void DownloadManager::downloadDB() { setInOperation(true); if (dbManager()) { dbManager()->closeDB(); } dbCacheFile.setFileName(m_dbCacheFileName); if (dbCacheFile.exists()) { dbCacheFile.remove(); } if (!dbCacheFile.open(QIODevice::WriteOnly)) { qCritical("Can not open cache file."); emit dbDownloadFailed(); setInOperation(false); return; } QUrl url(dbUrl); if (availableVersion() > 0) { #ifdef QT_DEBUG qDebug() << "Start downloading database"; #endif QNetworkRequest request(url); reply = manager.get(request); connect(reply, &QNetworkReply::downloadProgress, this, &DownloadManager::downloadDBProgress); connect(reply, &QNetworkReply::finished, this, &DownloadManager::downloadDBFinished); connect(reply, &QNetworkReply::readyRead, this, &DownloadManager::downloadDBReadyRead); } else { qCritical("Can not retrieve DB info file."); setInOperation(false); emit dbDownloadFailed(); } }
void Browse::postTitle() //---------------------- { const char * titleText = "Open Watcom Source Browser"; WString title; title.printf( "%s -- (%s%s), (%s)", titleText, optManager()->fileName(), (optManager()->isModified()) ? "*" : "", dbManager()->fileName() ); setText( title ); }
Browse::Browse( char * cmdLine ) : WMdiWindow( "" ) , _helpInfo( NULL ) , _status( new WStatWindow( this, WRect(0,0,0,0), "Ready" ) ) , _editorDLL( NULL ) //--------------------------------------------------------------- { WString errMessage; CommandParser prs( cmdLine, true ); _searchPath = prs.searchPath(); WFlashPage * flash_page = showFlashPage( 0 ); browseTop = this; topWindow = browseTop; _helpInfo = new WSystemHelp( this, BrowseTitle, _BrowseHelpFile, _BrowseHtmlHelpFile ); setIcon( WBRWIcon ); setupMenus(); viewManager()->registerForEvents( this ); // important that options comes before the database // since the option file can set the query and cause a re-load // of the inheritance graph if( prs.options() ) { optManager()->loadFrom( prs.options() ); } else { optManager()->loadDefault(); } // this must come after the option loads if( optManager()->isEditorDLL() ) { setEditorDLL( optManager()->getEditorName() ); } if( prs.database() ) { dbManager()->setModule( prs.database(), prs.files() ); } else { /* if there is no database, disable interesting menus */ viewManager()->enableMenus( false ); } postTitle(); delete flash_page; show(); hookF1Key( true ); }
Symbol * GlobalViewList::getSymbol( int index ) //--------------------------------------------- // FIXME -- have to cast away constness { int page = IDXTOPAGE( index ); int off = IDXTOOFF( index ); Module * mod = dbManager()->module(); KeySymbol * key = (KeySymbol *) &optManager()->getQueryFilt(); SearchContext * prev; SearchContext * ctxt; WVList * list; GBVListPage * prevPage; GBVListPage * currPage; if( index < 0 ) { return NULL; } try { while( !full() && _pages->count() <= page ) { if( page < 0 || page > _pages->count() ) { return NULL; } else { prevPage = page ? (GBVListPage *)(*_pages)[ page - 1 ] : NULL; prev = prevPage ? prevPage->_context : NULL; } list = new WVList; ctxt = mod->findSymbols( list, key, prev, OFFSETMASK + 1 ); _pages->add( new GBVListPage( ctxt, list ) ); if( ctxt == NULL ) { _full = true; } } if( page < _pages->count() ) { currPage = (GBVListPage *)(*_pages)[ page ]; if( off < currPage->_symbols->count() ) { return (Symbol *) (*currPage->_symbols)[ off ]; } } } catch( CauseOfDeath cause ) { IdentifyAssassin( cause ); } return NULL; }
void TreeFuncWindow::fillRoots( void ) //------------------------------------ { TreeNodeList roots; int i; _loadFilter->setSymType( KSTFunctions ); TreeFuncNode::loadModule( this, dbManager()->module(), roots, _loadFilter ); for( i = roots.count(); i > 0; i -= 1 ) { TreeFuncNode * node = (TreeFuncNode *) roots[ i - 1 ]; for( int j = node->getCount( TreeNode::FlatList ); j > 0; j -= 1 ) { if( node->getNode( TreeNode::FlatList, j - 1 )->getLevel() == 0 ) { _roots.add( new TreeRoot( this, node->getNode( TreeNode::FlatList, j - 1 ) ) ); break; } } } }
void Browse::setupMenus() //----------------------- { int i; menuManager()->setupMenus( this ); for( i = 0; i < NumBrowseMenus; i += 1 ) { menuManager()->registerForMenu( this, BrowseMenus[ i ] ); } viewManager()->setMenus( menuManager() ); optManager()->setMenus( menuManager() ); dbManager()->setMenus( menuManager() ); menuManager()->registerForViewEvents( viewManager() ); viewManager()->enableMenus( false ); }
void DownloadManager::downloadDBFinished() { #ifdef QT_DEBUG qDebug() << "Finished downloading DB."; #endif dbCacheFile.close(); reply->deleteLater(); QFile dbFile; dbFile.setFileName(m_dbFileName); if (dbFile.exists()) { #ifdef QT_DEBUG qDebug() << "Removing existing DB file."; #endif if (!dbFile.remove()) { emit dbDownloadFailed(); setInOperation(false); qCritical("Failed to remove current DB file."); return; } } #ifdef QT_DEBUG qDebug() << "Decompressing downloaded DB."; #endif m_process->start(QStringLiteral("gzip"), QStringList({QStringLiteral("-d"), m_dbCacheFileName})); #ifdef QT_DEBUG qDebug() << m_process->program() << m_process->arguments(); #endif if (m_process->exitCode() != 0) { emit dbDownloadFailed(); qCritical("Failed to decompress DB."); if (configuration()) { configuration()->setDatabaseVersion(0); } setInOperation(false); return; } if (configuration()) { configuration()->setDatabaseVersion(availableVersion()); } QEventLoop loop; if (dbManager()) { connect(m_timer, &QTimer::timeout, dbManager(), &DbManager::checkDB); m_timer->start(); } emit dbDownloadFinished(); setInOperation(false); }