void CompanyList::performRefresh() { bool showInactive = _inactive->isChecked(); Id company_id = currentId(); QListViewItem* current = NULL; clearLists(); CompanySelect conditions; conditions.activeOnly = !showInactive; vector<Company> companies; _quasar->db()->select(companies, conditions); for (unsigned int i = 0; i < companies.size(); ++i) { Company& company = companies[i]; ListViewItem* lvi = new ListViewItem(_list, company.id()); lvi->setValue(0, company.name()); lvi->setValue(1, company.number()); if (showInactive) lvi->setValue(2, !company.isActive()); if (company.id() == company_id) current = lvi; } if (current == NULL) current = _list->firstChild(); _list->setCurrentItem(current); _list->setSelected(current, true); }
void AddressBook::slotInactiveChanged() { clearLists(); int columns = _list->columns(); if (_inactive->isChecked()) { _list->addCheckColumn(tr("Inactive?")); if (_employee != NULL) _employee->addCheckColumn(tr("Inactive?")); if (_customer != NULL) _customer->addCheckColumn(tr("Inactive?")); if (_personal != NULL) _personal->addCheckColumn(tr("Inactive?")); if (_vendor != NULL) _vendor->addCheckColumn(tr("Inactive?")); resize(width() + _list->columnWidth(columns), height()); } else { int column = _list->findColumn(tr("Inactive?")); if (column != -1) { resize(width() - _list->columnWidth(column), height()); _list->removeColumn(column); if (_employee != NULL) _employee->removeColumn(_employee->findColumn(tr("Inactive?"))); if (_customer != NULL) _customer->removeColumn(_customer->findColumn(tr("Inactive?"))); if (_personal != NULL) _personal->removeColumn(_personal->findColumn(tr("Inactive?"))); if (_vendor != NULL) _vendor->removeColumn(_vendor->findColumn(tr("Inactive?"))); } } slotRefresh(); }
void GltxList::performRefresh() { Id gltx_id = currentId(); QListViewItem* current = NULL; clearLists(); vector<Gltx> gltxs; _quasar->db()->select(gltxs, GltxSelect()); DateValcon dateValcon; for (unsigned int i = 0; i < gltxs.size(); i++) { Gltx& gltx = gltxs[i]; ListViewItem* lvi = new ListViewItem(_list, gltx.id()); lvi->setText(0, dateValcon.format(gltx.postDate())); lvi->setText(1, gltx.memo()); if (gltx.id() == gltx_id) current = lvi; } if (current == NULL) current = _list->firstChild(); _list->setCurrentItem(current); _list->setSelected(current, true); }
void TenderList::performRefresh() { bool showInactive = _inactive->isChecked(); Id tender_id = currentId(); QListViewItem* current = NULL; clearLists(); TenderSelect conditions; conditions.activeOnly = !showInactive; vector<Tender> tenders; _quasar->db()->select(tenders, conditions); for (unsigned int i = 0; i < tenders.size(); i++) { Tender& tender = tenders[i]; ListViewItem* lvi = new ListViewItem(_list, tender.id()); lvi->setValue(0, tender.name()); lvi->setValue(1, tender.typeName()); if (showInactive) lvi->setValue(2, !tender.isActive()); if (tender.id() == tender_id) current = lvi; } if (current == NULL) current = _list->firstChild(); _list->setCurrentItem(current); _list->setSelected(current, true); }
void TaxList::performRefresh() { bool showInactive = _inactive->isChecked(); Id tax_id = currentId(); QListViewItem* current = NULL; clearLists(); TaxSelect conditions; conditions.activeOnly = !showInactive; vector<Tax> taxes; _quasar->db()->select(taxes, conditions); for (unsigned int i = 0; i < taxes.size(); i++) { Tax& tax = taxes[i]; fixed rate = _db->taxRate(tax); ListViewItem* lvi = new ListViewItem(_list, tax.id()); lvi->setValue(0, tax.name()); lvi->setValue(1, tax.description()); lvi->setValue(2, rate); if (showInactive) lvi->setValue(3, !tax.isActive()); if (tax.id() == tax_id) current = lvi; } if (current == NULL) current = _list->firstChild(); _list->setCurrentItem(current); _list->setSelected(current, true); }
void PriceBatchList::performRefresh() { bool showInactive = _inactive->isChecked(); Id batch_id = currentId(); QListViewItem* current = NULL; clearLists(); PriceBatchSelect conditions; conditions.activeOnly = !showInactive; vector<PriceBatch> batches; _quasar->db()->select(batches, conditions); for (unsigned int i = 0; i < batches.size(); i++) { PriceBatch& batch = batches[i]; ListViewItem* lvi = new ListViewItem(_list, batch.id()); lvi->setText(0, batch.number()); lvi->setText(1, batch.description()); if (showInactive) lvi->setValue(2, !batch.isActive()); if (batch.id() == batch_id) current = lvi; } if (current == NULL) current = _list->firstChild(); _list->setCurrentItem(current); _list->setSelected(current, true); }
void AnimviewView::updateState() { MadsView::update(); if (!_script || _scriptDone) return; if (!_activeAnimation) { readNextCommand(); assert(_activeAnimation); } // Update the current animation _activeAnimation->update(); if (_activeAnimation->freeFlag()) { delete _activeAnimation; _activeAnimation = NULL; // Clear up current background and sprites _backgroundSurface.reset(); clearLists(); // Reset flags _startFrame = -1; readNextCommand(); // Check if script is finished if (_scriptDone) { scriptDone(); return; } } refresh(); }
void GroupList::performRefresh() { bool showInactive = _inactive->isChecked(); Id group_id = currentId(); QListViewItem* current = NULL; clearLists(); GroupSelect conditions; conditions.activeOnly = !showInactive; vector<Group> groups; _quasar->db()->select(groups, conditions); for (unsigned int i = 0; i < groups.size(); ++i) { Group& group = groups[i]; ListViewItem* lvi = new ListViewItem(_list, group.id()); lvi->setText(0, group.name()); lvi->setText(1, group.typeName()); if (showInactive) lvi->setValue(2, !group.isActive()); if (group.id() == group_id) current = lvi; } if (current == NULL) current = _list->firstChild(); _list->setCurrentItem(current); _list->setSelected(current, true); }
void CustomerTypeList::performRefresh() { bool showInactive = _inactive->isChecked(); Id type_id = currentId(); QListViewItem* current = NULL; clearLists(); CustomerTypeSelect conditions; conditions.activeOnly = !showInactive; vector<CustomerType> types; _quasar->db()->select(types, conditions); for (unsigned int i = 0; i < types.size(); i++) { CustomerType& type = types[i]; Account account; _quasar->db()->lookup(type.accountId(), account); ListViewItem* lvi = new ListViewItem(_list, type.id()); lvi->setText(0, type.name()); lvi->setText(1, account.name()); if (showInactive) lvi->setValue(2, !type.isActive()); if (type.id() == type_id) current = lvi; } if (current == NULL) current = _list->firstChild(); _list->setCurrentItem(current); _list->setSelected(current, true); }
void CheckerBoardWidget::receiveCheckerboard(checkerboard c) { board = c; clearLists(); //this->clear(); changePlayer(); placeCheckers(); }
void GenericDataObjectFilter::setMultiValued(bool multiValued) { if (multiValued != m_multiValued) { m_multiValued = multiValued; clearLists(false, true); } }
void LinkBackFilter::setMultiValued(bool multiValued) { if (multiValued != m_multiValued) { m_multiValued = multiValued; clearLists(false, true); emit multiValuedChanged(multiValued); } }
//al seleccionar un modulo, se crean las etiquetas y los campos editables de los parametros de dicho modulo. void ParameterDialog::updateField(QString module){ ui->label->setText("Parameters of "+module+":"); int index = ui->currentList->currentRow(); clearLists(); if(index < 0 ) return; std::deque<parameter> parametros; parametros = getParameters(index); int j=0; //Se revisa la lista de parametros del module seleccionado. for(int i = 0; i < parametros.size(); i++){ //por cada parametro se crea una etiqueta y su campo editor de dato dependiendo de la tipo del parametro. QLabel *labelTemp = new QLabel(ui->scrollAreaWidgetContents); parameter &p = parametros[i]; labelTemp->setText(p.name); if( p.type == "int"){ QSpinBox *lineEditTemp = new QSpinBox(ui->scrollAreaWidgetContents); lineEditTemp->setMaximum((va->moduleSequence[index]->listParameters[i].value.toInt())+1000); lineEditTemp->setValue(va->moduleSequence[index]->listParameters[i].value.toInt()); lineEditTemp->setObjectName(va->moduleSequence[index]->listParameters[i].name); lineEditTemp->show(); lineEditTemp->setGeometry(QRect(160,30+j,113,20)); valueSB.push_back(lineEditTemp); } else if( p.type == "QString"){ QLineEdit *lineEditTemp = new QLineEdit(ui->scrollAreaWidgetContents); lineEditTemp->setText(p.value); lineEditTemp->setObjectName(p.name); lineEditTemp->show(); lineEditTemp->setGeometry(QRect(160,30+j,113,20)); valueL.push_back(lineEditTemp); } else if( p.type == "double"){ QDoubleSpinBox * lineEditTemp = new QDoubleSpinBox(ui->scrollAreaWidgetContents); lineEditTemp->setMaximum(p.value.toInt()+1000); lineEditTemp->setValue(p.value.toDouble()); lineEditTemp->setObjectName(p.name); lineEditTemp->show(); lineEditTemp->setGeometry(QRect(160,30+j,113,20)); valueDSB.push_back(lineEditTemp); } else { QLineEdit *lineEditTemp = new QLineEdit(ui->scrollAreaWidgetContents); lineEditTemp->setText(p.value); lineEditTemp->setObjectName(p.name); lineEditTemp->show(); lineEditTemp->setGeometry(QRect(160,30+j,113,20)); valueL.push_back(lineEditTemp); } labelTemp->show(); labelTemp->setGeometry(QRect(10,30+j,(labelTemp->text().size())*7,13)); nameParam.push_back(labelTemp); j+=30; } ui->scrollAreaWidgetContents->setGeometry(ui->scrollAreaWidgetContents->x(), ui->scrollAreaWidgetContents->y(), ui->scrollAreaWidgetContents->width(), j+40); }
void GenericDataObjectFilter::createLists() { clearLists(false, true); if (!isMultiValued() || m_value.type() != QVariant::String) { m_values->append(m_value); } else { QStringList list = m_value.toString().split(',', QString::SkipEmptyParts); foreach (QString s, list) { m_values->append(QVariant(s)); } }
void AccountList::performRefresh() { bool showInactive = _inactive->isChecked(); Id account_id = currentId(); QListViewItem* current = NULL; clearLists(); AccountSelect conditions; conditions.activeOnly = !showInactive; _quasar->db()->selectChart(_accounts, conditions); Company company; _quasar->db()->lookup(company); QDate date = QDate::currentDate(); _quasar->db()->accountBalances(date, _account_ids, _balances); ListViewItem* after = NULL; for (unsigned int i = 0; i < _accounts.size(); ++i) { const Account& account = _accounts[i]; fixed balance = getBalance(account); AccountListItem* lvi = NULL; if (account.parentId() == INVALID_ID) { lvi = new AccountListItem(_list, after, account.id()); after = lvi; } else { AccountListItem* li = (AccountListItem*)findId(account.parentId()); assert(li != NULL); lvi = new AccountListItem(li, li->after, account.id()); li->after = lvi; } lvi->setValue(0, account.name()); lvi->setValue(1, account.number()); lvi->setValue(2, account.typeName()); lvi->setValue(3, balance); if (showInactive) lvi->setValue(4, !account.isActive()); lvi->setOpen(true); if (account.id() == account_id) current = lvi; } if (current == NULL) current = _list->firstChild(); _list->setCurrentItem(current); _list->setSelected(current, true); }
GenericDataObjectFilter& GenericDataObjectFilter::operator=(const GenericDataObjectFilter& filter) { if (this != & filter) { // set in this order so that multiple values will be cleared as needed. clearLists(false, true); m_multiValued = false; setCaseSensitivity(filter.getCaseSensitivity()); setInvertFilterResult(filter.isInvertFilterResult()); setFilterMeansAccept(filter.isFilterMeansAccept()); setCompareField(filter.getCompareField()); setCompareType(filter.getCompareType()); setMultiValued(filter.isMultiValued()); setValue(filter.getValue()); } return *this; }
void ActiveList::slotInactiveChanged() { clearLists(); int columns = _list->columns(); if (_inactive->isChecked()) { _list->addCheckColumn(tr("Inactive?")); resize(width() + _list->columnWidth(columns), height()); } else { int column = _list->findColumn(tr("Inactive?")); if (column != -1) { resize(width() - _list->columnWidth(column), height()); _list->removeColumn(column); } } }
void ReachableList::calculateNewList() { // qDebug( "ReachableList::calculateNewList() is called" ); // calculateNewList is also called from calculator, so on check has to be // executed if ( !isOn() ) { return; } // QTime t; // timer for performance measurement // t.start(); setInitValues(); clearLists(); // clear all lists // Now add items of different type to the list addItemsToList(MapContents::AirfieldList); addItemsToList(MapContents::GliderfieldList); addItemsToList(MapContents::OutLandingList); addItemsToList(MapContents::WaypointList); modeAltitude = false; //qDebug("Number of potential reachable sites: %d", count() ); // sort list according to distances qSort(begin(), end() ); removeDoubles(); // qDebug("Number of potential reachable sites (after pruning): %d", count() ); // Remove all elements over the maximum. That are the far away elements. int nr = getMaxNrOfSites(); while ( nr < size() ) { removeFirst(); } // qDebug("Limited Number of potential reachable sites: %d", count() ); calculateDataInList(); //qDebug("Time for full calculation: %d msec", t.restart() ); }
void OgreColladaContentImporter::importContent(const std::string& path) throw (Exception) { // Check that scene is not null if (scene == NULL) { throw Exception(Exception::E_NULL_POINTER, "OgreColladaContentImporter::importContent(): scene is NULL!"); } // Clear the lists of previously loaded scene nodes, entities etc. clearLists(); Poco::ScopedRWLock lock(rwLock, true); ogreColladaImporter->setSceneManager(scene->getOgreSceneManager()); if (!ogreColladaImporter->importCollada(path.c_str())) { throw Exception(Exception::E_FILE_NOT_FOUND, "OgreColladaContentImporter::importContent(): path is invalid."); } }
void CheckerBoardWidget::move() { movement m; m.startPoint.line = firstClick.y(); m.startPoint.column = firstClick.x(); m.endPoint.line = secondClick.y(); m.endPoint.column = secondClick.x(); qDebug() << "[Move] "; qDebug() << "[MOVEMENT] : start (" << m.startPoint.line << ", " << m.startPoint.column << ")"; qDebug() << "[MOVEMENT] : end (" << m.endPoint.line << ", " << m.endPoint.column << ")"; if(test_and_execute_movement(player_color, m, &board) != 0) { //Valid movement, do it for gui qDebug() << "movement is ok"; promote_checkers(&board, player_color); //Check if daughter is made clearLists(); // Clear all the gui gameboard placeCheckers(); // Reconstruct the new GUI gameboard //Check if there is a winner if(game_ended(&board) == BLACK_CHECKER) { _player.color == BLACK_CHECKER ? emit sendWinner(_player) : emit sendWinner(_opponent_player); } if(game_ended(&board) == WHITE_CHECKER) { _player.color == WHITE_CHECKER ? emit sendWinner(_opponent_player) : emit sendWinner(_player); } preventAction(player_color); changePlayer(); // qDebug() << "ppppppppppppppppppppppppppppppp" << (char *) board; emit sendCheckerboard(board); } }
void DiscountList::performRefresh() { bool showInactive = _inactive->isChecked(); Id discount_id = currentId(); QListViewItem* current = NULL; clearLists(); DiscountSelect conditions; conditions.activeOnly = !showInactive; vector<Discount> discounts; _quasar->db()->select(discounts, conditions); for (unsigned int i = 0; i < discounts.size(); ++i) { Discount& discount = discounts[i]; QString amount = ""; if (discount.method() == Discount::PERCENT) amount = PercentValcon().format(discount.amount()); else amount = MoneyValcon().format(discount.amount()); ListViewItem* lvi = new ListViewItem(_list, discount.id()); lvi->setValue(0, discount.name()); lvi->setValue(1, discount.lineDiscount()); lvi->setValue(2, discount.txDiscount()); lvi->setValue(3, discount.methodName()); lvi->setValue(4, amount); if (showInactive) lvi->setValue(5, !discount.isActive()); if (discount.id() == discount_id) current = lvi; } if (current == NULL) current = _list->firstChild(); _list->setCurrentItem(current); _list->setSelected(current, true); }
void PriceList::performRefresh() { bool showInactive = _inactive->isChecked(); int columns = _list->columns(); if (showInactive && columns != 7) { _list->addCheckColumn(tr("Inactive?")); _cost->addCheckColumn(tr("Inactive?")); resize(width() + _list->columnWidth(6), height()); } if (!showInactive && columns != 6) { resize(width() - _list->columnWidth(6), height()); _list->removeColumn(6); _cost->removeColumn(6); } Id price_id = currentId(); Id cost_id = currentId(_cost); QListViewItem* priceItem = NULL; QListViewItem* costItem = NULL; clearLists(); Item item; _quasar->db()->lookup(_item->getId(), item); Card card; _quasar->db()->lookup(_card->getId(), card); ItemPriceSelect conditions; conditions.activeOnly = !showInactive; conditions.item = item; // TODO: set cardMatch conditions.card = card; conditions.batch_id = _batch->getId(); conditions.store_id = _store->getId(); vector<ItemPrice> prices; _quasar->db()->select(prices, conditions); for (unsigned int i = 0; i < prices.size(); i++) { ItemPrice& price = prices[i]; QString itemType, itemName; if (price.itemId() != INVALID_ID) { Item item; _quasar->db()->lookup(price.itemId(), item); itemType = tr("Item"); itemName = item.description(); } else if (price.itemGroup() != INVALID_ID) { Group group; _quasar->db()->lookup(price.itemGroup(), group); itemType = tr("Group"); itemName = group.name(); } else if (price.subdeptId() != INVALID_ID) { Subdept subdept; _quasar->db()->lookup(price.subdeptId(), subdept); itemType = tr("Subdepartment"); itemName = subdept.name(); } else { itemType = tr("All"); } QString cardType, cardName; if (price.cardId() != INVALID_ID) { Card card; _quasar->db()->lookup(price.cardId(), card); cardType = card.dataTypeName(); cardName = card.name(); } else if (price.cardGroup() != INVALID_ID) { Group group; _quasar->db()->lookup(price.cardGroup(), group); cardType = tr("Group"); cardName = group.name(); } else { cardType = tr("All"); } QString priceText; PercentValcon percent; MoneyValcon money; switch (price.method()) { case ItemPrice::PRICE: priceText = price.price().toString(); break; case ItemPrice::COST_PLUS: priceText = tr("Cost+ ") + percent.format(price.percentDiscount()); break; case ItemPrice::PERCENT_OFF: priceText = percent.format(price.percentDiscount()) + tr(" off"); break; case ItemPrice::DOLLAR_OFF: priceText = money.format(price.dollarDiscount()) + tr(" off"); break; } ListViewItem* lvi; if (price.isCost()) lvi = new ListViewItem(_cost, price.id()); else lvi = new ListViewItem(_list, price.id()); lvi->setValue(0, itemType); lvi->setValue(1, itemName); lvi->setValue(2, price.size()); lvi->setValue(3, cardType); lvi->setValue(4, cardName); lvi->setValue(5, priceText); if (showInactive) lvi->setValue(6, !price.isActive()); if (price.id() == price_id) priceItem = lvi; if (price.id() == cost_id) costItem = lvi; } if (priceItem == NULL) priceItem = _list->firstChild(); if (costItem == NULL) costItem = _cost->firstChild(); _list->setCurrentItem(priceItem); _list->setSelected(priceItem, true); _cost->setCurrentItem(costItem); _cost->setSelected(costItem, true); }
void* countCandidatesThreaded(void *dummyParam) { //printf("DYNAMIC ALGO\n"); ThreadParam* th = (ThreadParam*)dummyParam; UINT level = th->level; UINT tnumCandidates = th->numCandidates; UINT offset = th->offset; UINT** waits = th->waits; UINT* waits_size = th->waits_size; UINT* waits_max = th->waits_max; FLOAT* timestamps = th->timestamps; UINT* timestampSizeAll = th->timestampSizeAll; UINT timestampMatrixSize = level * max_timestamp_per_level; // Initialize sizes of timestamp arrays clearListsAll(timestampSizeAll, level, tnumCandidates); clearCount(h_episodeSupport+offset, tnumCandidates); initWaits(waits, waits_size, waits_max, offset, tnumCandidates, level); for (UINT eventIdx = 0; eventIdx < eventSize; eventIdx++ ) { UBYTE eventSymbol = h_events[eventIdx]; if (cid_flag == 1 && eventIdx > 0) { if (h_cid[eventIdx]!= h_cid[eventIdx-1]) clearListsAll(timestampSizeAll, level, tnumCandidates); } UINT* eps_list = waits[eventSymbol]; for( UINT eps_idx = 0; eps_idx < waits_size[eventSymbol]; eps_idx++) { UINT eps_index = eps_list[eps_idx]; FLOAT* timestampMatrix = ×tamps[timestampMatrixSize * (eps_index - offset)]; UINT* timestampSize = ×tampSizeAll[level * (eps_index - offset)]; UINT gCandidateIdx = level * eps_index; UINT gIntervalIdx = 2*(level-1)* eps_index; bool breakOuterLoop = false; // Check other symbols in the episode for matches to the current event for (int symbolIdx = level-1; symbolIdx >= 0 && !breakOuterLoop; symbolIdx-- ) { if ( eventSymbol == h_episodeCandidates[gCandidateIdx + symbolIdx] ) { if (symbolIdx == 0) { if ( symbolIdx == level-1 ) h_episodeSupport[eps_index]++; else { if (timestampSize[0] > 0 && h_start_times[eventIdx] - getFromList(timestampMatrix, 0, timestampSize[0]-1) > h_episodeIntervals[gIntervalIdx+1]) timestampSize[0] = 0; if (duration_flag == 1) addToList(timestampMatrix, timestampSize, symbolIdx, h_end_times[eventIdx]); else addToList(timestampMatrix, timestampSize, symbolIdx, h_start_times[eventIdx]); } } else if (timestampSize[symbolIdx-1] > 0) { FLOAT distance = h_start_times[eventIdx] - getFromList(timestampMatrix, symbolIdx-1, timestampSize[symbolIdx-1]-1); FLOAT lowerBound = h_episodeIntervals[gIntervalIdx + (symbolIdx-1)*2+0]; FLOAT upperBound = h_episodeIntervals[gIntervalIdx + (symbolIdx-1)*2+1]; if ( distance > upperBound ) { // Clear list timestampSize[symbolIdx-1] = 0; } else { // Check previous for acceptable interval for (int prevIdx = timestampSize[symbolIdx-1]-1; prevIdx >= 0; prevIdx--) { distance = h_start_times[eventIdx] - getFromList(timestampMatrix, symbolIdx-1, prevIdx); if (distance > lowerBound && distance <= upperBound) { if (symbolIdx == level-1) { // The final symbol has been found, clear all lists //#pragma message (__LOC__"### Some thing wrong in usage of offset ###") //episodeSupport[eps_index - offset]++; h_episodeSupport[eps_index]++; clearLists(timestampSize, level); breakOuterLoop = true; } else { if ( timestampSize[symbolIdx] > 0 && h_start_times[eventIdx] - getFromList(timestampMatrix, symbolIdx, timestampSize[symbolIdx]-1) > h_episodeIntervals[gIntervalIdx + 2*(symbolIdx)+1] ) timestampSize[symbolIdx] = 0; if (duration_flag == 1) addToList(timestampMatrix, timestampSize, symbolIdx, h_end_times[eventIdx]); else addToList(timestampMatrix, timestampSize, symbolIdx, h_start_times[eventIdx]); } break; } } } } } } } } return NULL; }
//------------------------------------------------------- // Destructeur GshhsReader::~GshhsReader() { clearLists(); }
void RiskMap::clear() { mapName = ""; picName = ""; clearLists(); }
GenericDataObjectFilter::~GenericDataObjectFilter() { clearLists(true, false); }
bool RiskMap::loadFromFile( QString filename ) { QStringList sl; QFile file( filename ); if( !file.open( QIODevice::ReadOnly | QIODevice::Text ) ) { return( false ); } clearLists(); int section = 0; while( !file.atEnd() ) { QByteArray ba = file.readLine(); QString line( ba ); line.chop( 1 ); line.trimmed(); sl = line.split(" "); if( section == 0 ) { if( sl[0].compare( "pic" ) == 0 ) { picName = sl[1]; } if( sl[0].compare( "map" ) == 0 ) { mapName = sl[1]; } } if( section == 1 && sl.size() > 2) { QString name = sl[0]; int armyBonus = sl[1].toInt(); //Color isnt needed this->continents.append( new RiskMapContinent( name, continents.size(), armyBonus ) ); } if( section == 2 && sl.size() > 4 ) { int index = sl[0].toInt(); QString name = sl[1]; int contIndex = sl[2].toInt() - 1; QPointF arnmyPos( sl[3].toInt(), sl[4].toInt() ); lands.append( new RiskMapLand( index, name, contIndex, arnmyPos ) ); } if( section == 3 && sl.size() > 1 ) { int home = sl[0].toInt(); for( int i=1; i<sl.size(); i++ ) { connectLands( home, sl[i].toInt() ); } } if( sl[0].compare( "[continents]" ) == 0 ) { section = 1; } if( sl[0].compare( "[countries]" ) == 0 ) { section = 2; } if( sl[0].compare( "[borders]" ) == 0 ) { section = 3; } } //Fill continents with lands for( int i=0; i<lands.size(); i++ ) { int contId = lands[i]->getContinentId(); continents[contId]->addLand( lands[i] ); } qWarning( "Map loaded: Lands [%d] Continents [%d] Connections [%d]\n", lands.size(), continents.size(), connections.size() ); return( true ); }
RiskMap::RiskMap() : QObject(NULL) { clearLists(); }
GenericDataObjectFilter::GenericDataObjectFilter(QObject *parent) : QObject(parent), m_compareType(VariantComparer::Equal), m_caseSensitivity(Qt::CaseInsensitive), m_invertFilterResult(false), m_filterMeansAccept(true), m_multiValued(false), m_values(nullptr), m_expressions(nullptr) { // After this, the lists are guaranteed to exist. clearLists(false, true); }
/** Prepare draw calls before scene rendering * \param[out] solid_poly_count Total number of polygons in objects * that will be rendered in this frame * \param[out] shadow_poly_count Total number of polygons for shadow * (rendered this frame) */ void DrawCalls::prepareDrawCalls( ShadowMatrices& shadow_matrices, scene::ICameraSceneNode *camnode, unsigned &solid_poly_count, unsigned &shadow_poly_count) { m_wind_dir = getWindDir(); clearLists(); for (unsigned Mat = 0; Mat < Material::SHADERTYPE_COUNT; ++Mat) { m_solid_pass_mesh[Mat].clear(); m_reflective_shadow_map_mesh[Mat].clear(); for (unsigned i = 0; i < 4; i++) m_shadow_pass_mesh[i * Material::SHADERTYPE_COUNT + Mat].clear(); } m_glow_pass_mesh.clear(); m_deferred_update.clear(); PROFILER_PUSH_CPU_MARKER("- culling", 0xFF, 0xFF, 0x0); parseSceneManager( irr_driver->getSceneManager()->getRootSceneNode()->getChildren(), &m_immediate_draw_list, camnode, shadow_matrices); PROFILER_POP_CPU_MARKER(); // Add a 1 s timeout if (!m_sync) m_sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0); PROFILER_PUSH_CPU_MARKER("- Sync Stall", 0xFF, 0x0, 0x0); GLenum reason = glClientWaitSync(m_sync, GL_SYNC_FLUSH_COMMANDS_BIT, 0); if (reason != GL_ALREADY_SIGNALED) { do { reason = glClientWaitSync(m_sync, GL_SYNC_FLUSH_COMMANDS_BIT, 1000000); } while (reason == GL_TIMEOUT_EXPIRED); } glDeleteSync(m_sync); PROFILER_POP_CPU_MARKER(); /* switch (reason) { case GL_ALREADY_SIGNALED: printf("Already Signaled\n"); break; case GL_TIMEOUT_EXPIRED: printf("Timeout Expired\n"); break; case GL_CONDITION_SATISFIED: printf("Condition Satisfied\n"); break; case GL_WAIT_FAILED: printf("Wait Failed\n"); break; }*/ PROFILER_PUSH_CPU_MARKER("- Animations/Buffer upload", 0x0, 0x0, 0x0); for (unsigned i = 0; i < m_deferred_update.size(); i++) m_deferred_update[i]->updateGL(); PROFILER_POP_CPU_MARKER(); if (!CVS->supportsIndirectInstancingRendering()) return; #if !defined(USE_GLES2) int enableOpenMP = 0; if (CVS->supportsAsyncInstanceUpload()) enableOpenMP = 1; PROFILER_PUSH_CPU_MARKER("- Draw Command upload", 0xFF, 0x0, 0xFF); #pragma omp parallel sections if(enableOpenMP) { #pragma omp section { m_solid_cmd_buffer->fill(m_solid_pass_mesh); } #pragma omp section { m_glow_cmd_buffer->fill(&m_glow_pass_mesh); } #pragma omp section { irr_driver->setPhase(SHADOW_PASS); m_shadow_cmd_buffer->fill(m_shadow_pass_mesh); } #pragma omp section if (!shadow_matrices.isRSMMapAvail()) { m_reflective_shadow_map_cmd_buffer->fill(m_reflective_shadow_map_mesh); } } PROFILER_POP_CPU_MARKER(); solid_poly_count = m_solid_cmd_buffer->getPolyCount(); shadow_poly_count = m_shadow_cmd_buffer->getPolyCount(); if (CVS->supportsAsyncInstanceUpload()) glMemoryBarrier(GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT); #endif // !defined(USE_GLES2) }