当前位置: 首页>>代码示例>>C++>>正文


C++ QTorrentHandle::hash方法代码示例

本文整理汇总了C++中QTorrentHandle::hash方法的典型用法代码示例。如果您正苦于以下问题:C++ QTorrentHandle::hash方法的具体用法?C++ QTorrentHandle::hash怎么用?C++ QTorrentHandle::hash使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QTorrentHandle的用法示例。


在下文中一共展示了QTorrentHandle::hash方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: saveSeedStatus

void TorrentPersistentData::saveSeedStatus(const QTorrentHandle &h) {
  QHash<QString, QVariant> data = all_data[h.hash()].toHash();
  bool was_seed = data.value("seed", false).toBool();
  if (was_seed != h.is_seed()) {
    data["seed"] = !was_seed;
    all_data[h.hash()] = data;
    markDirty();
  }
}
开发者ID:sorokin,项目名称:qBittorrent,代码行数:9,代码来源:torrentpersistentdata.cpp

示例2:

TorrentModelItem::TorrentModelItem(const QTorrentHandle &h)
  : m_torrent(h)
  , m_addedTime(TorrentPersistentData::getAddedDate(h.hash()))
  , m_seedTime(TorrentPersistentData::getSeedDate(h.hash()))
  , m_label(TorrentPersistentData::getLabel(h.hash()))
  , m_name(TorrentPersistentData::getName(h.hash()))
  , m_hash(h.hash())
{
  if (m_name.isEmpty())
    m_name = h.name();
}
开发者ID:Bigcheese,项目名称:qBittorrent,代码行数:11,代码来源:torrentmodel.cpp

示例3:

TorrentModelItem::TorrentModelItem(const QTorrentHandle &h)
  : m_torrent(h)
  , m_lastStatus(h.status(torrent_handle::query_accurate_download_counters))
  , m_addedTime(TorrentPersistentData::getAddedDate(h.hash()))
  , m_label(TorrentPersistentData::getLabel(h.hash()))
  , m_name(TorrentPersistentData::getName(h.hash()))
  , m_hash(h.hash())
{
  if (m_name.isEmpty())
    m_name = h.name();
}
开发者ID:BrunoReX,项目名称:qBittorrent,代码行数:11,代码来源:torrentmodel.cpp

示例4:

TorrentModelItem::TorrentModelItem(const QTorrentHandle &h)
    : m_torrent(h)
    , m_lastStatus(h.status(torrent_handle::query_accurate_download_counters))
    , m_addedTime(TorrentPersistentData::instance()->getAddedDate(h.hash()))
    , m_label(TorrentPersistentData::instance()->getLabel(h.hash()))
    , m_name(TorrentPersistentData::instance()->getName(h.hash()))
    , m_hash(h.hash())
{
    if (m_name.isEmpty())
        m_name = h.name();
    // If name is empty show the hash. This happens when magnet isn't retrieved.
    if (m_name.isEmpty())
        m_name = h.hash();
}
开发者ID:AdunanzA,项目名称:Tsunami-Old,代码行数:14,代码来源:torrentmodel.cpp

示例5: handleTorrentUpdate

void TorrentModel::handleTorrentUpdate(const QTorrentHandle &h)
{
  const int row = torrentRow(h.hash());
  if (row >= 0) {
    notifyTorrentChanged(row);
  }
}
开发者ID:Bigcheese,项目名称:qBittorrent,代码行数:7,代码来源:torrentmodel.cpp

示例6: handleTorrentAboutToBeRemoved

void TorrentModel::handleTorrentAboutToBeRemoved(const QTorrentHandle &h)
{
  const int row = torrentRow(h.hash());
  if (row >= 0) {
    emit torrentAboutToBeRemoved(m_torrents.at(row));
  }
}
开发者ID:jadacez,项目名称:qBittorrent,代码行数:7,代码来源:torrentmodel.cpp

示例7: torrentHasLabel

bool QTorrentFilter::torrentHasLabel(const QTorrentHandle &h) const
{
    if (label_.isNull())
        return true;
    else
        return TorrentPersistentData::instance()->getLabel(h.hash()) == label_;
}
开发者ID:AdunanzA,项目名称:Tsunami-Old,代码行数:7,代码来源:qtorrentfilter.cpp

示例8: populate

void TorrentModel::populate() {
  // Load the torrents
  std::vector<torrent_handle> torrents = QBtSession::instance()->getSession()->get_torrents();
  
  std::vector<torrent_handle>::const_iterator it = torrents.begin();
  std::vector<torrent_handle>::const_iterator itend = torrents.end();
  for ( ; it != itend; ++it) {
    const QTorrentHandle h(*it);
    if (HiddenData::hasData(h.hash()))
      continue;
    addTorrent(h);
  }
  // Refresh timer
  connect(&m_refreshTimer, SIGNAL(timeout()), SLOT(forceModelRefresh()));
  m_refreshTimer.start(m_refreshInterval);
  // Listen for torrent changes
  connect(QBtSession::instance(), SIGNAL(addedTorrent(QTorrentHandle)), SLOT(addTorrent(QTorrentHandle)));
  connect(QBtSession::instance(), SIGNAL(torrentAboutToBeRemoved(QTorrentHandle)), SLOT(handleTorrentAboutToBeRemoved(QTorrentHandle)));
  connect(QBtSession::instance(), SIGNAL(deletedTorrent(QString)), SLOT(removeTorrent(QString)));
  connect(QBtSession::instance(), SIGNAL(finishedTorrent(QTorrentHandle)), SLOT(handleFinishedTorrent(QTorrentHandle)));
  connect(QBtSession::instance(), SIGNAL(metadataReceived(QTorrentHandle)), SLOT(handleTorrentUpdate(QTorrentHandle)));
  connect(QBtSession::instance(), SIGNAL(resumedTorrent(QTorrentHandle)), SLOT(handleTorrentUpdate(QTorrentHandle)));
  connect(QBtSession::instance(), SIGNAL(pausedTorrent(QTorrentHandle)), SLOT(handleTorrentUpdate(QTorrentHandle)));
  connect(QBtSession::instance(), SIGNAL(torrentFinishedChecking(QTorrentHandle)), SLOT(handleTorrentUpdate(QTorrentHandle)));
  connect(QBtSession::instance(), SIGNAL(stateUpdate(std::vector<libtorrent::torrent_status>)), SLOT(stateUpdated(std::vector<libtorrent::torrent_status>)));
}
开发者ID:BrunoReX,项目名称:qBittorrent,代码行数:26,代码来源:torrentmodel.cpp

示例9: getSyncMainData

/**
 * The function returns the changed data from the server to synchronize with the web client.
 * Return value is map in JSON format.
 * Map contain the key:
 *  - "Rid": ID response
 * Map can contain the keys:
 *  - "full_update": full data update flag
 *  - "torrents": dictionary contains information about torrents.
 *  - "torrents_removed": a list of hashes of removed torrents
 *  - "labels": list of labels
 *  - "labels_removed": list of removed labels
 *  - "server_state": map contains information about the state of the server
 * The keys of the 'torrents' dictionary are hashes of torrents.
 * Each value of the 'torrents' dictionary contains map. The map can contain following keys:
 *  - "name": Torrent name
 *  - "size": Torrent size
 *  - "progress: Torrent progress
 *  - "dlspeed": Torrent download speed
 *  - "upspeed": Torrent upload speed
 *  - "priority": Torrent priority (-1 if queuing is disabled)
 *  - "num_seeds": Torrent seeds connected to
 *  - "num_complete": Torrent seeds in the swarm
 *  - "num_leechs": Torrent leechers connected to
 *  - "num_incomplete": Torrent leechers in the swarm
 *  - "ratio": Torrent share ratio
 *  - "eta": Torrent ETA
 *  - "state": Torrent state
 *  - "seq_dl": Torrent sequential download state
 *  - "f_l_piece_prio": Torrent first last piece priority state
 * Server state map may contain the following keys:
 *  - "connection_status": conection status
 *  - "dht_nodes": DHT nodes count
 *  - "dl_info_data": bytes downloaded
 *  - "dl_info_speed": download speed
 *  - "dl_rate_limit: downlaod rate limit
 *  - "up_info_data: bytes uploaded
 *  - "up_info_speed: upload speed
 *  - "up_rate_limit: upload speed limit
 *  - "queueing": priority system usage flag
 *  - "refresh_interval": torrents table refresh interval
 */
QByteArray btjson::getSyncMainData(int acceptedResponseId, QVariantMap &lastData, QVariantMap &lastAcceptedData)
{
    QVariantMap data;

    QVariantHash torrents;

    std::vector<torrent_handle> torrentsList = QBtSession::instance()->getTorrents();
    std::vector<torrent_handle>::const_iterator it = torrentsList.begin();
    std::vector<torrent_handle>::const_iterator end = torrentsList.end();

    for (; it != end; ++it) {
        QTorrentHandle torrent = QTorrentHandle(*it);
        QVariantMap map = toMap(torrent);
        map.remove(KEY_TORRENT_HASH);
        torrents[torrent.hash()] = map;
    }

    data["torrents"] = torrents;

    QVariantList labels;
    foreach (QString s, Preferences::instance()->getTorrentLabels())
        labels << s;

    data["labels"] = labels;

    QVariantMap serverState = getTranserInfoMap();
    serverState[KEY_SYNC_MAINDATA_QUEUEING] = QBtSession::instance()->isQueueingEnabled();
    serverState[KEY_SYNC_MAINDATA_USE_ALT_SPEED_LIMITS] = Preferences::instance()->isAltBandwidthEnabled();
    serverState[KEY_SYNC_MAINDATA_REFRESH_INTERVAL] = Preferences::instance()->getRefreshInterval();
    data["server_state"] = serverState;

    return json::toJson(generateSyncData(acceptedResponseId, data, lastAcceptedData, lastData));
}
开发者ID:azuwis,项目名称:debian_qbittorrent,代码行数:74,代码来源:btjson.cpp

示例10: handleTorrentUpdate

void TorrentModel::handleTorrentUpdate(const QTorrentHandle &h)
{
  const int row = torrentRow(h.hash());
  if (row >= 0) {
    m_torrents[row]->refreshStatus(h.status(torrent_handle::query_accurate_download_counters));
    notifyTorrentChanged(row);
  }
}
开发者ID:jadacez,项目名称:qBittorrent,代码行数:8,代码来源:torrentmodel.cpp

示例11: handleFinishedTorrent

void TorrentModel::handleFinishedTorrent(const QTorrentHandle& h)
{
  const int row = torrentRow(h.hash());
  if (row < 0)
    return;

  // Update completion date
  m_torrents[row]->refreshStatus(h.status(torrent_handle::query_accurate_download_counters));
  notifyTorrentChanged(row);
}
开发者ID:BrunoReX,项目名称:qBittorrent,代码行数:10,代码来源:torrentmodel.cpp

示例12: handleFinishedTorrent

void TorrentModel::handleFinishedTorrent(const QTorrentHandle& h)
{
  const int row = torrentRow(h.hash());
  if (row < 0)
    return;

  // Update completion date
  m_torrents[row]->setData(TorrentModelItem::TR_SEED_DATE, QDateTime::currentDateTime(), Qt::DisplayRole);
  notifyTorrentChanged(row);
}
开发者ID:Bigcheese,项目名称:qBittorrent,代码行数:10,代码来源:torrentmodel.cpp

示例13: handleFinishedTorrent

void TorrentModel::handleFinishedTorrent(const QTorrentHandle& h)
{
  const int row = torrentRow(h.hash());
  if (row < 0)
    return;

  // Update completion date
  m_torrents[row]->setData(TorrentModelItem::TR_SEED_DATE, QDateTime::currentDateTime(), Qt::DisplayRole);
  m_torrents[row]->refreshStatus(h.status(torrent_handle::query_accurate_download_counters));
  notifyTorrentChanged(row);
}
开发者ID:jadacez,项目名称:qBittorrent,代码行数:11,代码来源:torrentmodel.cpp

示例14: addTorrent

void TorrentModel::addTorrent(const QTorrentHandle &h)
{
  if (torrentRow(h.hash()) < 0) {
    beginInsertTorrent(m_torrents.size());
    TorrentModelItem *item = new TorrentModelItem(h);
    connect(item, SIGNAL(labelChanged(QString,QString)), SLOT(handleTorrentLabelChange(QString,QString)));
    m_torrents << item;
    emit torrentAdded(item);
    endInsertTorrent();
  }
}
开发者ID:jadacez,项目名称:qBittorrent,代码行数:11,代码来源:torrentmodel.cpp

示例15: saveTorrentPersistentData

void TorrentPersistentData::saveTorrentPersistentData(const QTorrentHandle &h, const QString &save_path, const bool is_magnet) {
  Q_ASSERT(h.is_valid());
  qDebug("Saving persistent data for %s", qPrintable(h.hash()));
  // Save persistent data
  QHash<QString, QVariant> data = all_data.value(h.hash()).toHash();
  data["is_magnet"] = is_magnet;
  if (is_magnet) {
    data["magnet_uri"] = misc::toQString(make_magnet_uri(h));
  }
  data["seed"] = h.is_seed();
  data["priority"] = h.queue_position();
  if (save_path.isEmpty()) {
    qDebug("TorrentPersistantData: save path is %s", qPrintable(h.save_path()));
    data["save_path"] = h.save_path();
  } else {
    qDebug("TorrentPersistantData: overriding save path is %s", qPrintable(save_path));
    data["save_path"] = save_path; // Override torrent save path (e.g. because it is a temp dir)
  }
  // Label
  data["label"] = TorrentTempData::getLabel(h.hash());
  // Save data
  all_data[h.hash()] = data;
  markDirty();
  qDebug("TorrentPersistentData: Saving save_path %s, hash: %s", qPrintable(h.save_path()), qPrintable(h.hash()));
  // Set Added date
  setAddedDate(h.hash(), QDateTime::currentDateTime());
  // Finally, remove temp data
  TorrentTempData::deleteTempData(h.hash());
}
开发者ID:sorokin,项目名称:qBittorrent,代码行数:29,代码来源:torrentpersistentdata.cpp


注:本文中的QTorrentHandle::hash方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。