Example #1
0
void TagFilterModel::tagAdded(const QString &tag)
{
    const int row = m_tagItems.count();
    beginInsertRows(QModelIndex(), row, row);
    addToModel(tag, 0);
    endInsertRows();
}
Example #2
0
void TagFilterModel::populate()
{
    using Torrent = BitTorrent::TorrentHandle;

    const auto *session = BitTorrent::Session::instance();
    const auto torrents = session->torrents();

    // All torrents
    addToModel(getSpecialAllTag(), torrents.count());

    const int untaggedCount = std::count_if(torrents.cbegin(), torrents.cend(),
                                             [](Torrent *torrent) { return torrent->tags().isEmpty(); });
    addToModel(getSpecialUntaggedTag(), untaggedCount);

    for (const QString &tag : asConst(session->tags())) {
        const int count = std::count_if(torrents.cbegin(), torrents.cend(),
                                        [tag](Torrent *torrent) { return torrent->hasTag(tag); });
        addToModel(tag, count);
    }
}
Example #3
0
	void PCPolyhedron::increaseLod(const PCPtr& nuCloud) {
		PCModelObject::increaseLod(nuCloud);
		addToModel(nuCloud);
	}