// clear all data void VRML_LAYER::Clear( void ) { int i; fix = false; idx = 0; for( i = contours.size(); i > 0; --i ) { delete contours.back(); contours.pop_back(); } pth.clear(); areas.clear(); for( i = vertices.size(); i > 0; --i ) { delete vertices.back(); vertices.pop_back(); } clearTmp(); }
bool FgXmlFlightstatusProtocol::nextChunk() { //DEBUGP(LOGWARNING, m_tmpIndex.data(Qt::ToolTipRole) << "->" << m_currentmodel->rowCount(m_tmpIndex)); //DEBUGP(LOGWARNING, m_tmpIndex.parent().row() << "->" << m_tmpIndex.row()); if (m_currentmodel->rowCount(m_tmpIndex)>0) { if (m_tmpDesc.count<m_currentmodel->rowCount(m_tmpIndex)) { m_tmpIndex=m_currentmodel->index(m_tmpDesc.count,0,m_tmpIndex); } } m_tmpDesc.index=m_tmpIndex; m_protinfo.append(m_tmpDesc); clearTmp(); return true; };
// tesselates the contours in preparation for a 3D output; // returns true if all was fine, false otherwise bool VRML_LAYER::Tesselate( VRML_LAYER* holes, bool aHolesOnly ) { if( !tess ) { error = "Tesselate(): GLU tesselator was not initialized"; return false; } pholes = holes; Fault = false; if( aHolesOnly ) gluTessProperty( tess, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_NEGATIVE ); else gluTessProperty( tess, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_POSITIVE ); if( contours.size() < 1 || vertices.size() < 3 ) { error = "Tesselate(): not enough vertices"; return false; } // finish the winding calculation on all vertices prior to setting 'fix' if( !fix ) { for( unsigned int i = 0; i < contours.size(); ++i ) { if( contours[i]->size() < 3 ) continue; VERTEX_3D* vp0 = vertices[ contours[i]->back() ]; VERTEX_3D* vp1 = vertices[ contours[i]->front() ]; areas[i] += ( vp1->x - vp0->x ) * ( vp1->y + vp0->y ); } } // prevent the addition of any further contours and contour vertices fix = true; // clear temporary internals which may have been used in a previous run clearTmp(); // request an outline gluTessProperty( tess, GLU_TESS_BOUNDARY_ONLY, GL_TRUE ); // adjust internal indices for extra points and holes if( holes ) hidx = holes->GetSize(); else hidx = 0; eidx = idx + hidx; if( aHolesOnly && ( checkNContours( true ) == 0 ) ) { error = "tesselate(): no hole contours"; return false; } else if( !aHolesOnly && ( checkNContours( false ) == 0 ) ) { error = "tesselate(): no solid contours"; return false; } // open the polygon gluTessBeginPolygon( tess, this ); if( aHolesOnly ) { pholes = NULL; // do not accept foreign holes hidx = 0; eidx = idx; // add holes pushVertices( true ); gluTessEndPolygon( tess ); if( Fault ) return false; return true; } // add solid outlines pushVertices( false ); // close the polygon gluTessEndPolygon( tess ); if( Fault ) return false; // if there are no outlines we cannot proceed if( outline.empty() ) { error = "tesselate(): no points in result"; return false; } // at this point we have a solid outline; add it to the tesselator gluTessBeginPolygon( tess, this ); if( !pushOutline( NULL ) ) return false; // add the holes contained by this object pushVertices( true ); // import external holes (if any) if( hidx && ( holes->Import( idx, tess ) < 0 ) ) { std::ostringstream ostr; ostr << "Tesselate():FAILED: " << holes->GetError(); error = ostr.str(); return false; } if( Fault ) return false; // erase the previous outline data and vertex order // but preserve the extra vertices while( !outline.empty() ) { delete outline.back(); outline.pop_back(); } ordmap.clear(); ord = 0; // go through the vertex lists and reset ephemeral parameters for( unsigned int i = 0; i < vertices.size(); ++i ) { vertices[i]->o = -1; } for( unsigned int i = 0; i < extra_verts.size(); ++i ) { extra_verts[i]->o = -1; } // close the polygon; this creates the outline points // and the point ordering list 'ordmap' solid.clear(); gluTessEndPolygon( tess ); // repeat the last operation but request a tesselated surface // rather than an outline; this creates the triangles list. gluTessProperty( tess, GLU_TESS_BOUNDARY_ONLY, GL_FALSE ); gluTessBeginPolygon( tess, this ); if( !pushOutline( holes ) ) return false; gluTessEndPolygon( tess ); if( Fault ) return false; return true; }
MainWindow::MainWindow(int startState, QString run_binary, QWidget * parent, Qt::WindowFlags f) : QMainWindow(parent, f){ // Loading libq4wine-core.so #ifdef RELEASE libq4wine.setFileName(_CORELIB_PATH_); #else libq4wine.setFileName("../q4wine-lib/libq4wine-core"); #endif if (!libq4wine.load()){ libq4wine.load(); } // Getting corelib class pointer CoreLibClassPointer = (CoreLibPrototype *) libq4wine.resolve("createCoreLib"); CoreLib.reset((corelib *)CoreLibClassPointer(true)); clearTmp(); db_prefix.fixPrefixPath(); if (CoreLib->getSetting("DesktopImport", "importAtStartup", false, 0)==1){ Progress progress(0, ""); progress.exec(); } // importIcons(QString("%1/.local/share/applications/wine/").arg(QDir::homePath())); //exportProcess.close(); // Base GUI setup setupUi(this); if (!this->createSocket()){ this->close(); return; } if (startState == 1) this->showMinimized(); setWindowTitle(tr("%1 :. Qt GUI for Wine v%2").arg(APP_NAME) .arg(APP_VERS)); std::auto_ptr<QVBoxLayout> vlayout (new QVBoxLayout); std::auto_ptr<PrefixConfigWidget> configWidget (new PrefixConfigWidget(tabPrefixSeup)); connect(configWidget.get(), SIGNAL(updateDatabaseConnections()), this, SLOT(updateDtabaseConnectedItems())); connect(configWidget.get(), SIGNAL(setTabIndex (int)), tbwGeneral, SLOT(setCurrentIndex (int))); connect(this, SIGNAL(updateDatabaseConnections()), configWidget.get(), SLOT(getPrefixes())); std::auto_ptr<LoggingWidget> logWidget (new LoggingWidget(tabLogging)); connect (this, SIGNAL(reloadLogData()), logWidget.get(), SLOT(getLogRecords())); logWidget->getLogRecords(); logLayout->addWidget(logWidget.release()); std::auto_ptr<IconListWidget> lstIcons (new IconListWidget(tabPrograms)); connect(this, SIGNAL(runProgramRequest(QString)), lstIcons.get(), SLOT(runProgramRequest(QString))); connect(lstIcons.get(), SIGNAL(iconItemClick(QString, QString, QString, QString, QString)), this, SLOT(updateIconDesc(QString, QString, QString, QString, QString))); connect(lstIcons.get(), SIGNAL(changeStatusText(QString)), this, SLOT(changeStatusText(QString))); connect(lstIcons.get(), SIGNAL(appRunned(bool)), this, SLOT(setMeVisible(bool))); std::auto_ptr<PrefixTreeWidget> twPrograms (new PrefixTreeWidget(tabPrograms)); connect(twPrograms.get(), SIGNAL(updateDatabaseConnections()), this, SLOT(updateDtabaseConnectedItems())); connect(this, SIGNAL(updateDatabaseConnections()), twPrograms.get(), SLOT(getPrefixes())); connect(twPrograms.get(), SIGNAL(showFolderContents(QString, QString)), lstIcons.get(), SLOT(showFolderContents(QString, QString))); connect(twPrograms.get(), SIGNAL(setSearchFocus()), this, SLOT(setSearchFocus())); connect(twPrograms.get(), SIGNAL(changeStatusText(QString)), this, SLOT(changeStatusText(QString))); connect(this, SIGNAL(setDefaultFocus(QString, QString)), twPrograms.get(), SLOT(setDefaultFocus(QString, QString))); connect(configWidget.get(), SIGNAL(prefixIndexChanged(QString)), twPrograms.get(), SLOT(setDefaultFocus(QString))); connect(twPrograms.get(), SIGNAL(prefixIndexChanged(QString)), configWidget.get(), SLOT(setPrefix(QString))); connect(twPrograms.get(), SIGNAL(setTabIndex (int)), tbwGeneral, SLOT(setCurrentIndex (int))); connect(twPrograms.get(), SIGNAL(pasteAction()), lstIcons.get(), SLOT(iconPaste_Click())); std::auto_ptr<WineProcessWidget> procWidget (new WineProcessWidget(tabProcess)); connect(this, SIGNAL(stopProcTimer()), procWidget.get(), SLOT(stopTimer())); connect(this, SIGNAL(startProcTimer()), procWidget.get(), SLOT(startTimer())); connect(procWidget.get(), SIGNAL(changeStatusText(QString)), this, SLOT(changeStatusText(QString))); tabProcessLayout->addWidget(procWidget.release()); std::auto_ptr<PrefixControlWidget> prefixWidget (new PrefixControlWidget(tabPrefix)); connect(prefixWidget.get(), SIGNAL(updateDatabaseConnections()), twPrograms.get(), SLOT(getPrefixes())); connect(prefixWidget.get(), SIGNAL(updateDatabaseConnections()), this, SLOT(updateDtabaseConnectedItems())); connect(configWidget.get(), SIGNAL(prefixIndexChanged(QString)), prefixWidget.get(), SLOT(setDefaultFocus(QString))); connect(prefixWidget.get(), SIGNAL(prefixIndexChanged(QString)), configWidget.get(), SLOT(setPrefix(QString))); connect(prefixWidget.get(), SIGNAL(setTabIndex (int)), tbwGeneral, SLOT(setCurrentIndex (int))); connect(twPrograms.get(), SIGNAL(updateDatabaseConnections()), prefixWidget.get(), SLOT(updateDtabaseItems())); std::auto_ptr<IconListToolbar> iconToolBar (new IconListToolbar(tabPrograms)); connect(iconToolBar.get(), SIGNAL(searchFilterChange(QString)), lstIcons.get(), SLOT(setFilterString(QString))); connect(iconToolBar.get(), SIGNAL(changeView(int)), lstIcons.get(), SLOT(changeView(int))); std::auto_ptr<PrefixTreeToolbar> prefixToolBar (new PrefixTreeToolbar(tabPrograms)); connect(prefixToolBar.get(), SIGNAL(expandTree()), twPrograms.get(), SLOT(expandTree())); connect(prefixToolBar.get(), SIGNAL(collapseTree()), twPrograms.get(), SLOT(collapseTree())); connect(prefixToolBar.get(), SIGNAL(updatePrefixTree()), this, SLOT(updateDtabaseConnectedItems())); connect(prefixToolBar.get(), SIGNAL(updatePrefixTree()), prefixWidget.get(), SLOT(updateDtabaseItems())); vlayout.reset(new QVBoxLayout); vlayout->addWidget(prefixToolBar.release()); vlayout->addWidget(twPrograms.release()); vlayout->setMargin(0); vlayout->setSpacing(0); std::auto_ptr<QWidget> wid (new QWidget(tabPrograms)); wid->setLayout(vlayout.release()); splitter.reset(new QSplitter(tabPrograms)); splitter->addWidget(wid.release()); vlayout.reset(new QVBoxLayout); vlayout->addWidget(iconToolBar.release()); vlayout->addWidget(lstIcons.release()); vlayout->setMargin(0); vlayout->setSpacing(0); //vlayout->setContentsMargins(0,0,0,0); wid.reset(new QWidget(tabPrograms)); wid->setLayout(vlayout.release()); splitter->addWidget(wid.release()); vlayout.reset(new QVBoxLayout); vlayout->addWidget(splitter.get()); vlayout->addWidget(gbInfo); vlayout->setContentsMargins(3,0,3,3); tabPrograms->setLayout(vlayout.release()); tabPrefixLayout->addWidget(prefixWidget.release()); setupLayout->addWidget(configWidget.release()); // Updating database connected items updateDtabaseConnectedItems(); // Getting settings from config file this->createTrayIcon(); this->getSettings(); connect(tbwGeneral, SIGNAL(currentChanged(int)), this, SLOT(tbwGeneral_CurrentTabChange(int))); //connect(cmdCreateFake, SIGNAL(clicked()), this, SLOT(cmdCreateFake_Click())); //connect(cmdUpdateFake, SIGNAL(clicked()), this, SLOT(cmdUpdateFake_Click())); //Main menu actions connection to slots connect(mainRun, SIGNAL(triggered()), this, SLOT(mainRun_Click())); connect(mainPrograms, SIGNAL(triggered()), this, SLOT(mainPrograms_Click())); connect(mainLogging, SIGNAL(triggered()), this, SLOT(mainLogging_Click())); connect(mainProcess, SIGNAL(triggered()), this, SLOT(mainProcess_Click())); connect(mainSetup, SIGNAL(triggered()), this, SLOT(mainSetup_Click())); connect(mainPrefix, SIGNAL(triggered()), this, SLOT(mainPrefix_Click())); connect(mainImageManage, SIGNAL(triggered()), this, SLOT(mainImageManager_Click())); connect(mainAbout, SIGNAL(triggered()), this, SLOT(mainAbout_Click())); connect(mainAboutQt, SIGNAL(triggered()), this, SLOT(mainAboutQt_Click())); connect(mainExportIcons, SIGNAL(triggered()), this, SLOT(mainExportIcons_Click())); connect(mainOptions, SIGNAL(triggered()), this, SLOT(mainOptions_Click())); connect(mainInstall, SIGNAL(triggered()), this, SLOT(mainInstall_Click())); connect(mainExit, SIGNAL(triggered()), this, SLOT(mainExit_Click())); connect(mainImportWineIcons, SIGNAL(triggered()), this, SLOT(mainImportWineIcons_Click())); connect(mainVersionManager, SIGNAL(triggered()), this, SLOT(mainVersionManager_Click())); CoreLib->runAutostart(); #ifndef WITH_ICOUTILS mainExportIcons->setEnabled(false); #endif if (!run_binary.isEmpty()) messageReceived(run_binary); if (!trayIcon->isVisible()) show(); return; }
bool FgXmlFlightstatusProtocol::insertChunkName(const QString& name) { m_tmpIndex=getMatchingModelIndex(name, m_currentmodel); if (m_tmpIndex!=QModelIndex()) return true; clearTmp(); return false; };
// tesselates the contours in preparation for a 3D output; // returns true if all was fine, false otherwise bool VRML_LAYER::Tesselate( VRML_LAYER* holes ) { if( !tess ) { error = "Tesselate(): GLU tesselator was not initialized"; return false; } pholes = holes; Fault = false; if( contours.size() < 1 || vertices.size() < 3 ) { error = "Tesselate(): not enough vertices"; return false; } // finish the winding calculation on all vertices prior to setting 'fix' if( !fix ) { for( unsigned int i = 0; i < contours.size(); ++i ) { if( contours[i]->size() < 3 ) continue; VERTEX_3D* vp0 = vertices[ contours[i]->back() ]; VERTEX_3D* vp1 = vertices[ contours[i]->front() ]; areas[i] += ( vp1->x - vp0->x ) * ( vp1->y + vp0->y ); } } // prevent the addition of any further contours and contour vertices fix = true; // clear temporary internals which may have been used in a previous run clearTmp(); // request an outline gluTessProperty( tess, GLU_TESS_BOUNDARY_ONLY, GL_TRUE ); // adjust internal indices for extra points and holes if( holes ) hidx = holes->GetSize(); else hidx = 0; eidx = idx + hidx; // open the polygon gluTessBeginPolygon( tess, this ); pushVertices( false ); // close the polygon gluTessEndPolygon( tess ); if( Fault ) return false; // push the (solid) outline to the tesselator if( !pushOutline( holes ) ) return false; // add the holes contained by this object pushVertices( true ); // import external holes (if any) if( hidx && ( holes->Import( idx, tess ) < 0 ) ) { std::ostringstream ostr; ostr << "Tesselate():FAILED: " << holes->GetError(); error = ostr.str(); return NULL; } if( Fault ) return false; // erase the previous outline data and vertex order // but preserve the extra vertices for( int i = outline.size(); i > 0; --i ) { delete outline.back(); outline.pop_back(); } for( unsigned int i = ordmap.size(); i > 0; --i ) ordmap.pop_back(); // go through the vertex lists and reset ephemeral parameters for( unsigned int i = 0; i < vertices.size(); ++i ) { vertices[i]->o = -1; } for( unsigned int i = 0; i < extra_verts.size(); ++i ) { extra_verts[i]->o = -1; } ord = 0; // close the polygon; we now have all the data necessary for the tesselation gluTessEndPolygon( tess ); // request a tesselated surface gluTessProperty( tess, GLU_TESS_BOUNDARY_ONLY, GL_FALSE ); if( !pushOutline( holes ) ) return false; gluTessEndPolygon( tess ); if( Fault ) return false; return true; }