QgsLegendSymbologyList QgsCategorizedSymbolRendererV2::legendSymbologyItems( QSize iconSize ) { QgsLegendSymbologyList lst; int count = categories().count(); for ( int i = 0; i < count; i++ ) { const QgsRendererCategoryV2& cat = categories()[i]; QPixmap pix = QgsSymbolLayerV2Utils::symbolPreviewPixmap( cat.symbol(), iconSize ); lst << qMakePair( cat.label(), pix ); } return lst; }
void Menu::addCategory(MenuCategory *category) { m_categories.append(category); if(category->property("id").toUInt() > m_currentCategoryId) m_currentCategoryId = category->property("id").toUInt(); Pos::instance()->appendToMenuHistory("AddMenuCategory:" + category->serialize()); categoriesChanged(categories()); }
galleryd::queue::category_t galleryd::queue::match( item_t &items) { std::smatch match; const auto len = items.size(); category_t categories (len); for(size_t i = 0; i < len; ++i) { // test with the last successfull regex first if(std::regex_match(items[i], match, re_list[re_last].first)) { items[i] = match[1]; categories[i] = re_list[re_last].second; continue; } for(size_t j = 0; j < re_list.size(); ++j) { if(j == re_last) continue; if(std::regex_match(items[i], match, re_list[j].first)) { items[i] = match[1]; categories[i] = re_list[j].second; re_last = j; } } } return categories; }
QVariant Channel::data(int role) const { switch (role) { case DisplayRole: return display(); case DecorationRole: return decoration(); case NameRole: return name(); case NumberRole: return number(); case TypeRole: return type(); case LanguageRole: return language(); case UrlRole: return url(); case XmltvIdRole: return xmltvId(); case CategoriesRole: return categories(); case LogoRole: return logo(); case ProtectedRole: return passwordProtected(); default: return QVariant(); } }
/*! \internal */ QMap<int, QString> OPimContact::toMap() const { QMap<int, QString> map = mMap; QString cats = idsToString( categories() ); if ( !cats.isEmpty() ) map.insert( Qtopia::AddressCategory, cats ); return map; }
void generalGammaDistributionFixedCategories::computeRatesProbs(){ MDOUBLE totalProb = 0.0; MDOUBLE catProb = 0.0; MDOUBLE lowerBoundaryProb = 0.0; MDOUBLE upperBoundaryProb = 0.0; int cat; _ratesProb.clear(); _ratesProb.resize(categories()); for (cat = 0; cat < categories()-1; ++cat) { upperBoundaryProb = getCumulativeProb(_bonderi[cat+1]); catProb = upperBoundaryProb - lowerBoundaryProb; _ratesProb[cat] = catProb; totalProb += catProb; lowerBoundaryProb = upperBoundaryProb; } _ratesProb[cat] = 1.0 - totalProb; }
void CategoryFilterWidget::removeUnusedCategories() { auto session = BitTorrent::Session::instance(); foreach (const QString &category, session->categories()) if (model()->data(static_cast<CategoryFilterProxyModel *>(model())->index(category), Qt::UserRole) == 0) session->removeCategory(category); updateGeometry(); }
Q_DECL_EXPORT int main(int argc, char *argv[]) { QApplication app(argc, argv); app.setApplicationName("QDL"); app.setApplicationVersion(VERSION_NUMBER); app.setWindowIcon(QIcon::fromTheme("qdl2")); app.setQuitOnLastWindowClosed(false); const QStringList args = app.arguments(); if (args.contains("--log")) { Logger::setVerbosity(10); } QScopedPointer<Categories> categories(Categories::instance()); QScopedPointer<ClipboardUrlModel> clipboard(ClipboardUrlModel::instance()); QScopedPointer<DecaptchaPluginManager> decaptchaManager(DecaptchaPluginManager::instance()); QScopedPointer<Qdl> qdl(Qdl::instance()); QScopedPointer<RecaptchaPluginManager> recaptchaManager(RecaptchaPluginManager::instance()); QScopedPointer<ServicePluginManager> serviceManager(ServicePluginManager::instance()); QScopedPointer<Settings> settings(Settings::instance()); QScopedPointer<TransferModel> transfers(TransferModel::instance()); QScopedPointer<UrlCheckModel> checker(UrlCheckModel::instance()); QScopedPointer<UrlRetrievalModel> retriever(UrlRetrievalModel::instance()); QScopedPointer<WebServer> server(WebServer::instance()); clipboard.data()->setEnabled(Settings::clipboardMonitorEnabled()); server.data()->setPort(Settings::webInterfacePort()); server.data()->setUsername(Settings::webInterfaceUsername()); server.data()->setPassword(Settings::webInterfacePassword()); server.data()->setAuthenticationEnabled(Settings::webInterfaceAuthenticationEnabled()); decaptchaManager.data()->load(); recaptchaManager.data()->load(); serviceManager.data()->load(); clipboard.data()->restore(); transfers.data()->restore(); if (Settings::webInterfaceEnabled()) { server.data()->start(); } if (!args.contains("--nogui")) { Qdl::showWindow(); } QObject::connect(settings.data(), SIGNAL(clipboardMonitorEnabledChanged(bool)), clipboard.data(), SLOT(setEnabled(bool))); QObject::connect(settings.data(), SIGNAL(webInterfaceAuthenticationEnabledChanged(bool)), server.data(), SLOT(setAuthenticationEnabled(bool))); QObject::connect(settings.data(), SIGNAL(webInterfaceUsernameChanged(QString)), server.data(), SLOT(setUsername(QString))); QObject::connect(settings.data(), SIGNAL(webInterfacePasswordChanged(QString)), server.data(), SLOT(setPassword(QString))); QObject::connect(settings.data(), SIGNAL(webInterfacePortChanged(int)), server.data(), SLOT(setPort(int))); QObject::connect(settings.data(), SIGNAL(webInterfaceEnabledChanged(bool)), server.data(), SLOT(setRunning(bool))); return app.exec(); }
QString Feed::debugInfo() const { QString info; info += QLatin1String("# Feed begin ######################\n"); QString dtitle = title(); if (!dtitle.isNull()) info += QLatin1String("title: #") + dtitle + QLatin1String("#\n"); QString dlink = link(); if (!dlink.isNull()) info += QLatin1String("link: #") + dlink + QLatin1String("#\n"); QString ddescription = description(); if (!ddescription.isNull()) info += QLatin1String("description: #") + ddescription + QLatin1String("#\n"); QString dcopyright = copyright(); if (!dcopyright.isNull()) info += QLatin1String("copyright: #") + dcopyright + QLatin1String("#\n"); QString dlanguage = language(); if (!dlanguage.isNull()) info += QLatin1String("language: #") + dlanguage + QLatin1String("#\n"); QList<PersonPtr> dauthors = authors(); QList<PersonPtr>::ConstIterator itp = dauthors.constBegin(); QList<PersonPtr>::ConstIterator endp = dauthors.constEnd(); for ( ; itp != endp; ++itp) info += (*itp)->debugInfo(); QList<CategoryPtr> dcategories = categories(); QList<CategoryPtr>::ConstIterator itc = dcategories.constBegin(); QList<CategoryPtr>::ConstIterator endc = dcategories.constEnd(); for ( ; itc != endc; ++itc) info += (*itc)->debugInfo(); ImagePtr dimage = image(); if (!dimage->isNull()) info += dimage->debugInfo(); QList<ItemPtr> ditems = items(); QList<ItemPtr>::ConstIterator it = ditems.constBegin(); QList<ItemPtr>::ConstIterator end = ditems.constEnd(); for ( ; it != end; ++it) info += (*it)->debugInfo(); info += QLatin1String("# Feed end ########################\n"); return info; }
QString Entry::debugInfo() const { QString info; info += QLatin1String("### Entry: ###################\n"); if (!title().isEmpty()) info += QLatin1String("title: #") + title() + QLatin1String("#\n"); if (!summary().isEmpty()) info += QLatin1String("summary: #") + summary() + QLatin1String("#\n"); if (!id().isEmpty()) info += QLatin1String("id: #") + id() + QLatin1String("#\n"); if (!content().isNull()) info += content().debugInfo(); if (!rights().isEmpty()) info += QLatin1String("rights: #") + rights() + QLatin1String("#\n"); QString dupdated = dateTimeToString(updated()); if (!dupdated.isNull()) info += QLatin1String("updated: #") + dupdated + QLatin1String("#\n"); QString dpublished = dateTimeToString(published()); if (!dpublished.isNull()) info += QLatin1String("published: #") + dpublished + QLatin1String("#\n"); QList<Link> dlinks = links(); QList<Link>::ConstIterator endlinks = dlinks.constEnd(); for (QList<Link>::ConstIterator it = dlinks.constBegin(); it != endlinks; ++it) info += (*it).debugInfo(); QList<Category> dcats = categories(); QList<Category>::ConstIterator endcats = dcats.constEnd(); for (QList<Category>::ConstIterator it = dcats.constBegin(); it != endcats; ++it) info += (*it).debugInfo(); info += QLatin1String("### Authors: ###################\n"); QList<Person> dauthors = authors(); QList<Person>::ConstIterator endauthors = dauthors.constEnd(); for (QList<Person>::ConstIterator it = dauthors.constBegin(); it != endauthors; ++it) info += (*it).debugInfo(); info += QLatin1String("### Contributors: ###################\n"); QList<Person> dcontri = contributors(); QList<Person>::ConstIterator endcontri = dcontri.constEnd(); for (QList<Person>::ConstIterator it = dcontri.constBegin(); it != endcontri; ++it) info += (*it).debugInfo(); if (!source().isNull()) info += source().debugInfo(); info += QLatin1String("### Entry end ################\n"); return info; }
QgsLegendSymbologyList QgsCategorizedSymbolRendererV2::legendSymbologyItems( QSize iconSize ) { QSettings settings; bool showClassifiers = settings.value( "/qgis/showLegendClassifiers", false ).toBool(); QgsLegendSymbologyList lst; if ( showClassifiers ) { lst << qMakePair( classAttribute(), QPixmap() ); } int count = categories().count(); for ( int i = 0; i < count; i++ ) { const QgsRendererCategoryV2& cat = categories()[i]; QPixmap pix = QgsSymbolLayerV2Utils::symbolPreviewPixmap( cat.symbol(), iconSize ); lst << qMakePair( cat.label(), pix ); } return lst; }
CategoryList Categories::get() { QSettings categories(APP_CONFIG_PATH + "categories", QSettings::IniFormat); CategoryList list; foreach (const QString &name, categories.childKeys()) { const QString path = categories.value(name).toString(); list << Category(name, path.endsWith("/") ? path : path + "/"); } return list; }
bool MyMoneyReport::hasReferenceTo ( const QString& id ) const { QStringList list; // collect all ids accounts ( list ); categories ( list ); payees ( list ); return ( list.contains ( id ) > 0 ); }
KABC::AddresseeList XXPortSelectDialog::contacts() { const QStringList selection = mCore->selectedUIDs(); KABC::AddresseeList list; if ( mUseSelection->isChecked() ) { QStringList::ConstIterator it; for ( it = selection.constBegin(); it != selection.constEnd(); ++it ) { KABC::Addressee addr = mCore->addressBook()->findByUid( *it ); if ( !addr.isEmpty() ) list.append( addr ); } } else if ( mUseFilters->isChecked() ) { // find contacts that can pass selected filter Filter::List::ConstIterator filterIt; for ( filterIt = mFilters.constBegin(); filterIt != mFilters.constEnd(); ++filterIt ) if ( (*filterIt).name() == mFiltersCombo->currentText() ) break; KABC::AddressBook::Iterator it; for ( it = mCore->addressBook()->begin(); it != mCore->addressBook()->end(); ++it ) { if ( (*filterIt).filterAddressee( *it ) ) list.append( *it ); } } else if ( mUseCategories->isChecked() ) { const QStringList categorieList = categories(); KABC::AddressBook::ConstIterator it; KABC::AddressBook::ConstIterator addressBookEnd( mCore->addressBook()->constEnd() ); for ( it = mCore->addressBook()->constBegin(); it != addressBookEnd; ++it ) { const QStringList tmp( (*it).categories() ); QStringList::ConstIterator tmpIt; for ( tmpIt = tmp.constBegin(); tmpIt != tmp.constEnd(); ++tmpIt ) if ( categorieList.contains( *tmpIt ) ) { list.append( *it ); break; } } } else { // create a string list of all entries: KABC::AddressBook::ConstIterator it; for ( it = mCore->addressBook()->constBegin(); it != mCore->addressBook()->constEnd(); ++it ) list.append( *it ); } if ( mUseSorting ) { list.setReverseSorting( mSortTypeCombo->currentIndex() == 1 ); int pos = mFieldCombo->currentIndex(); if ( pos < mFields.count() ) list.sortByField( mFields[ pos ] ); } return list; }
void generalGammaDistribution::fill_bonderi() { int i; for (i=1; i<categories(); ++i) { _bonderi[i]=search_for_z_in_dis_with_any_beta(_alpha, _beta,static_cast<MDOUBLE>(i)/categories()); } _bonderi[0]=0; _bonderi[i]=VERYBIG/10000.0;// this is becuase we multiply bondei[i] by alpha or beta, and // by this manipulation we avoid overflows...; //return 0; }
void generalGammaDistribution::fill_mean() { fill_bonderi(); int i; //for (i=0; i<=categories(); ++i) cout<<endl<<bonderi[i]; //LOG(5,<<"\n====== the r categories are =====\n"); for (i=0; i<categories(); ++i) { _rates[i]=the_avarage_r_in_category_between_a_and_b(_bonderi[i], _bonderi[i+1], _alpha, _beta, categories()); //LOG(5,<<meanG[i]<<endl); } //LOG(5,<<endl<<alpha<<endl); //return 0; }
QString Source::debugInfo() const { QString info; info += QLatin1String("### Source: ###################\n"); if (!title().isEmpty()) info += QLatin1String("title: #") + title() + QLatin1String("#\n"); if (!subtitle().isEmpty()) info += QLatin1String("subtitle: #") + subtitle() + QLatin1String("#\n"); if (!id().isEmpty()) info += QLatin1String("id: #") + id() + QLatin1String("#\n"); if (!rights().isEmpty()) info += QLatin1String("rights: #") + rights() + QLatin1String("#\n"); if (!icon().isEmpty()) info += QLatin1String("icon: #") + icon() + QLatin1String("#\n"); if (!logo().isEmpty()) info += QLatin1String("logo: #") + logo() + QLatin1String("#\n"); if (!generator().isNull()) info += generator().debugInfo(); QString dupdated = dateTimeToString(updated()); if (!dupdated.isNull()) info += QLatin1String("updated: #") + dupdated + QLatin1String("#\n"); QList<Link> dlinks = links(); QList<Link>::ConstIterator endlinks = dlinks.constEnd(); for (QList<Link>::ConstIterator it = dlinks.constBegin(); it != endlinks; ++it) info += (*it).debugInfo(); QList<Category> dcats = categories(); QList<Category>::ConstIterator endcats = dcats.constEnd(); for (QList<Category>::ConstIterator it = dcats.constBegin(); it != endcats; ++it) info += (*it).debugInfo(); info += QLatin1String("### Authors: ###################\n"); QList<Person> dauthors = authors(); QList<Person>::ConstIterator endauthors = dauthors.constEnd(); for (QList<Person>::ConstIterator it = dauthors.constBegin(); it != endauthors; ++it) info += (*it).debugInfo(); info += QLatin1String("### Contributors: ###################\n"); QList<Person> dcontri = contributors(); QList<Person>::ConstIterator endcontri = dcontri.constEnd(); for (QList<Person>::ConstIterator it = dcontri.constBegin(); it != endcontri; ++it) info += (*it).debugInfo(); info += QLatin1String("### Source end ################\n"); return info; }
/*! \internal Appends the contact information to \a buf. */ void OContact::save( QString &buf ) const { static const QStringList SLFIELDS = fields(); // I'm expecting "<Contact " in front of this... for ( QMap<int, QString>::ConstIterator it = mMap.begin(); it != mMap.end(); ++it ) { const QString &value = it.data(); int key = it.key(); if ( !value.isEmpty() ) { if ( key == Qtopia::AddressCategory || key == Qtopia::AddressUid) continue; key -= Qtopia::AddressCategory+1; buf += SLFIELDS[key]; buf += "=\"" + Qtopia::escapeString(value) + "\" "; } } buf += customToXml(); if ( categories().count() > 0 ) buf += "Categories=\"" + idsToString( categories() ) + "\" "; buf += "Uid=\"" + QString::number( uid() ) + "\" "; // You need to close this yourself }
AddNewTorrentDialog::AddNewTorrentDialog(QWidget *parent) : QDialog(parent) , ui(new Ui::AddNewTorrentDialog) , m_contentModel(0) , m_contentDelegate(0) , m_hasMetadata(false) , m_oldIndex(0) { ui->setupUi(this); setAttribute(Qt::WA_DeleteOnClose); ui->lblMetaLoading->setVisible(false); ui->progMetaLoading->setVisible(false); auto session = BitTorrent::Session::instance(); ui->startTorrentCheckBox->setChecked(!session->isAddTorrentPaused()); (session->isASMDisabledByDefault() ? ui->simpleModeRadioButton : ui->advancedModeRadioButton)->setChecked(true); populateSavePathComboBox(); connect(ui->savePathComboBox, SIGNAL(currentIndexChanged(int)), SLOT(onSavePathChanged(int))); connect(ui->browseButton, SIGNAL(clicked()), SLOT(browseButton_clicked())); ui->defaultSavePathCheckBox->setVisible(false); // Default path is selected by default ui->doNotDeleteTorrentCheckBox->setVisible(TorrentFileGuard::autoDeleteMode() != TorrentFileGuard::Never); // Load categories QStringList categories = session->categories(); std::sort(categories.begin(), categories.end(), Utils::String::naturalCompareCaseInsensitive); QString defaultCategory = settings()->loadValue(KEY_DEFAULTCATEGORY).toString(); if (!defaultCategory.isEmpty()) ui->categoryComboBox->addItem(defaultCategory); ui->categoryComboBox->addItem(""); foreach (const QString &category, categories) if (category != defaultCategory) ui->categoryComboBox->addItem(category); ui->categoryComboBox->model()->sort(0); ui->contentTreeView->header()->setSortIndicator(0, Qt::AscendingOrder); loadState(); // Signal / slots connect(ui->adv_button, SIGNAL(clicked(bool)), SLOT(showAdvancedSettings(bool))); connect(ui->doNotDeleteTorrentCheckBox, SIGNAL(clicked(bool)), SLOT(doNotDeleteTorrentClicked(bool))); editHotkey = new QShortcut(QKeySequence("F2"), ui->contentTreeView, 0, 0, Qt::WidgetShortcut); connect(editHotkey, SIGNAL(activated()), SLOT(renameSelectedFile())); connect(ui->contentTreeView, SIGNAL(doubleClicked(QModelIndex)), SLOT(renameSelectedFile())); ui->buttonBox->button(QDialogButtonBox::Ok)->setFocus(); }
bool Categories::remove(const QString &name) { QSettings categories(APP_CONFIG_PATH + "categories", QSettings::IniFormat); if (categories.contains(name)) { categories.remove(name); if (self) { emit self->changed(); } return true; } return false; }
void MainController::editCategory() { QString zeus = m_mw->currentCategory(); CategorySPointer gaia = category(m_mw->currentCategory()); CategoryController chronos(category(m_mw->currentCategory())); chronos.exec(); if(zeus != gaia->name()) { m_mw->setCategoryList(categories().keys()); m_mw->setCurrentCategory(gaia->name()); } }
bool Categories::add(const QString &name, const QString &path) { QSettings categories(APP_CONFIG_PATH + "categories", QSettings::IniFormat); if (path != categories.value(name)) { categories.setValue(name, path); if (self) { emit self->changed(); } return true; } return false; }
void nftdialog::setupCategories() { QString categories(""); categoryList->clear(); categoryList->addItem(tr("All")); for (uint i = 0; i < settings->templates.size(); i++) { if ((categories.indexOf(settings->templates[i]->templateCategory) == -1) && (!settings->templates[i]->isDeleted)) { categoryList->addItem(settings->templates[i]->templateCategory); categories += settings->templates[i]->templateCategory; } } categoryList->sortItems(); categoryList->setCurrentRow(0); }
void CategoryFilterModel::populate() { m_rootItem->clear(); auto session = BitTorrent::Session::instance(); auto torrents = session->torrents(); m_isSubcategoriesEnabled = session->isSubcategoriesEnabled(); const QString UID_ALL; const QString UID_UNCATEGORIZED(QChar(1)); // All torrents m_rootItem->addChild(UID_ALL, new CategoryModelItem(nullptr, tr("All"), torrents.count())); // Uncategorized torrents using Torrent = BitTorrent::TorrentHandle; m_rootItem->addChild( UID_UNCATEGORIZED , new CategoryModelItem( nullptr, tr("Uncategorized") , std::count_if(torrents.begin(), torrents.end() , [](Torrent *torrent) { return torrent->category().isEmpty(); }))); using Torrent = BitTorrent::TorrentHandle; foreach (const QString &category, session->categories()) { if (m_isSubcategoriesEnabled) { CategoryModelItem *parent = m_rootItem; foreach (const QString &subcat, session->expandCategory(category)) { const QString subcatName = shortName(subcat); if (!parent->hasChild(subcatName)) { new CategoryModelItem( parent, subcatName , std::count_if(torrents.begin(), torrents.end() , [subcat](Torrent *torrent) { return torrent->category() == subcat; })); } parent = parent->child(subcatName); } } else { new CategoryModelItem( m_rootItem, category , std::count_if(torrents.begin(), torrents.end() , [category](Torrent *torrent) { return torrent->belongsToCategory(category); })); } }
void WmWidget::slotApplyImagesDesc(){ //-- enregistrement des edit dans la map KUrl::List urls; QList<QTreeWidgetItem *> selectedItems=m_imgList->listView()->selectedItems(); for (int i = 0; i < selectedItems.size(); ++i){ KPImagesListViewItem* l_item = dynamic_cast<KPImagesListViewItem*>(selectedItems.at(i)); urls.append(l_item->url()); } for (int i = 0; i < urls.size(); ++i) { QMap<QString, QString> imageMetaData; imageMetaData = m_imagesDescInfo[urls.at(i).path()]; if(m_titleCheck->isChecked()){ QString url = urls.at(i).path().split('/').last(); url = title(); if(url.split('.').last().isEmpty()){ url = url +"."+urls.at(i).path().split('.').last(); m_titleEdit->setText(url); } kDebug()<<" Url in the if "<<url; imageMetaData["title"] = url; kDebug()<<" Url after if "<<url; } if(m_dateCheck->isChecked()){ imageMetaData["time"] = date(); } if(m_categoryCheck->isChecked()){ imageMetaData["categories"] = categories(); } if(m_descCheck->isChecked()){ imageMetaData["description"] = description(); } m_imagesDescInfo[urls.at(i).path()]=imageMetaData; } }
void StatsBoard::createAllCategoriesTexts() { std::vector< std::vector< std::map<std::string, int> > > datas = ScoreManager::getInstance().get2DVectMapDatas(); std::vector<std::string> titles; std::vector<std::string> keys; titles.push_back("Points"); titles.push_back("Boni"); titles.push_back("Damages taken"); titles.push_back("Enemies killed"); titles.push_back("Largest killing spree"); keys.push_back(Score::TOTALPOINTS_KEY); keys.push_back(Score::BONI_KEY); keys.push_back(Score::DAMAGESTAKEN_KEY); keys.push_back(Score::ENEMIESKILLED_KEY); keys.push_back(Score::LARGESTKILLINGSPREE_KEY); std::vector< std::vector<int> > categories(titles.size()); int lastSubDisc = LDL[0]; int lastLvlDisc = LDL[1]; int limitToDisplay = levelsPerSubworld[curSubworld]; // for each level, store its values in the right category for (int i = 0; i < limitToDisplay; ++i) { if (curSubworld != lastSubDisc || i <= lastLvlDisc) { for (size_t j = 0; j < titles.size(); ++j) { categories[j].push_back(datas[curSubworld][i][keys[j]]); } } } float startX = MARGIN*2 + findLargestTextWidth(); // findLargestSize() will search max text width among the texts existing (i.e. the levelTexts) float categoryWidth = (gameView.getSizeX() - startX)/categories.size(); for (size_t i = 0; i < titles.size(); ++i) { createCategoryTexts(startX + categoryWidth*i, MARGIN, titles[i], categories[i]); } }
// this function is here to override the inherited function // note that the rates themselves and the boundaries do not change. // the number of categories cannot be changed, since fixed categories must be given before void generalGammaDistributionFixedCategories::setGammaParameters (int in_number_of_categories, MDOUBLE in_alpha, MDOUBLE in_beta) { if (in_number_of_categories==1) { _rates[0] = 1.0; return; } if (in_number_of_categories != categories()) errorMsg::reportError("generalGammaDistributionFixedCategories::setGammaParameters: the number of categories cannot be changed, first call setFixedCategories"); if ((in_alpha == _alpha) && (in_beta == _beta)) return; if (in_alpha < MINIMUM_ALPHA_PARAM) in_alpha = MINIMUM_ALPHA_PARAM;// when alpha is very small there are underflow problems if (in_beta < MINIMUM_ALPHA_PARAM) in_beta = MINIMUM_ALPHA_PARAM;// when beta is very small there are underflaw problems _alpha = in_alpha; _beta = in_beta; computeRatesProbs(); }
void PlatformApiSkeleton::handle_application_list_update_event(const anbox::protobuf::bridge::ApplicationListUpdateEvent &event) { for (int n = 0; n < event.removed_applications_size(); n++) { application::Database::Item item; const auto app = event.removed_applications(n); item.package = app.package(); if (item.package.empty()) continue; app_db_->remove(item); } for (int n = 0; n < event.applications_size(); n++) { application::Database::Item item; const auto app = event.applications(n); item.name = app.name(); item.package = app.package(); const auto li = app.launch_intent(); item.launch_intent.action = li.action(); item.launch_intent.uri = li.uri(); item.launch_intent.type = li.uri(); item.launch_intent.package = li.package(); item.launch_intent.component = li.component(); for (int m = 0; m < li.categories_size(); m++) item.launch_intent.categories.push_back(li.categories(m)); item.icon = std::vector<char>(app.icon().begin(), app.icon().end()); if (item.package.empty()) continue; app_db_->store_or_update(item); } }
QString Item::debugInfo() const { QString info; info += QLatin1String("### Item: ###################\n"); if (!title().isNull()) info += QLatin1String("title: #") + title() + QLatin1String("#\n"); if (!link().isNull()) info += QLatin1String("link: #") + link() + QLatin1String("#\n"); if (!description().isNull()) info += QLatin1String("description: #") + description() + QLatin1String("#\n"); if (!content().isNull()) info += QLatin1String("content: #") + content() + QLatin1String("#\n"); if (!author().isNull()) info += QLatin1String("author: #") + author() + QLatin1String("#\n"); if (!comments().isNull()) info += QLatin1String("comments: #") + comments() + QLatin1String("#\n"); QString dpubdate = dateTimeToString(pubDate()); if (!dpubdate.isNull()) info += QLatin1String("pubDate: #") + dpubdate + QLatin1String("#\n"); if (!guid().isNull()) info += QLatin1String("guid: #") + guid() + QLatin1String("#\n"); if (guidIsPermaLink()) info += QLatin1String("guid is PL: #true#\n"); if (!source().isNull()) info += source().debugInfo(); QList<Category> cats = categories(); for (QList<Category>::ConstIterator it = cats.constBegin(); it != cats.constEnd(); ++it) info += (*it).debugInfo(); QList<Enclosure> encs = enclosures(); for (QList<Enclosure>::ConstIterator it = encs.constBegin(); it != encs.constEnd(); ++it) info += (*it).debugInfo(); info += QLatin1String("### Item end ################\n"); return info; }
int fprint(FILE *ff, fltl::TDOP<AlphaT> &tdop) throw() { FLTL_TDOP_USE_TYPES(fltl::TDOP<AlphaT>); int num(0); category_type cat; unsigned upper_bound(0); operator_string_type ops; generator_type categories(tdop.search(~cat)); generator_type initial_rules(tdop.search(cat --->* (~ops))); generator_type extension_rules(tdop.search(cat[upper_bound] --->* (~ops))); for(; categories.match_next(); ) { num += fprint(ff, tdop, cat); num += fprintf(ff, " {\n"); // print out initial rules for(initial_rules.rewind(); initial_rules.match_next(); ) { num += fprintf(ff, " "); num += fprint(ff, tdop, ops); num += fprintf(ff, ";\n"); } // print out extension rules for(extension_rules.rewind(); extension_rules.match_next(); ) { num += fprintf(ff, " %u ", upper_bound); num += fprint(ff, tdop, ops); num += fprintf(ff, ";\n"); } num += fprintf(ff, "}\n"); } return num; }