mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-01 05:08:05 -06:00
Add preliminary support of libtorrent v1.2
libtorrent v1.2 should be built with deprecated features enabled.
This commit is contained in:
@@ -39,7 +39,7 @@
|
||||
#include <QThread>
|
||||
#include <QUrl>
|
||||
|
||||
#include "base/bittorrent/filepriority.h"
|
||||
#include "base/bittorrent/downloadpriority.h"
|
||||
#include "base/bittorrent/session.h"
|
||||
#include "base/preferences.h"
|
||||
#include "base/unicodestrings.h"
|
||||
@@ -621,13 +621,13 @@ void PropertiesWidget::displayFilesListMenu(const QPoint &)
|
||||
renameSelectedFile();
|
||||
}
|
||||
else {
|
||||
BitTorrent::FilePriority prio = BitTorrent::FilePriority::Normal;
|
||||
BitTorrent::DownloadPriority prio = BitTorrent::DownloadPriority::Normal;
|
||||
if (act == m_ui->actionHigh)
|
||||
prio = BitTorrent::FilePriority::High;
|
||||
prio = BitTorrent::DownloadPriority::High;
|
||||
else if (act == m_ui->actionMaximum)
|
||||
prio = BitTorrent::FilePriority::Maximum;
|
||||
prio = BitTorrent::DownloadPriority::Maximum;
|
||||
else if (act == m_ui->actionNotDownloaded)
|
||||
prio = BitTorrent::FilePriority::Ignored;
|
||||
prio = BitTorrent::DownloadPriority::Ignored;
|
||||
|
||||
qDebug("Setting files priority");
|
||||
for (const QModelIndex &index : selectedRows) {
|
||||
@@ -894,11 +894,7 @@ void PropertiesWidget::editWebSeed()
|
||||
|
||||
void PropertiesWidget::applyPriorities()
|
||||
{
|
||||
qDebug("Saving files priorities");
|
||||
const QVector<int> priorities = m_propListModel->model()->getFilePriorities();
|
||||
// Prioritize the files
|
||||
qDebug("prioritize files: %d", priorities[0]);
|
||||
m_torrent->prioritizeFiles(priorities);
|
||||
m_torrent->prioritizeFiles(m_propListModel->model()->getFilePriorities());
|
||||
}
|
||||
|
||||
void PropertiesWidget::filteredFilesChanged()
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#include <QProxyStyle>
|
||||
#endif
|
||||
|
||||
#include "base/bittorrent/filepriority.h"
|
||||
#include "base/bittorrent/downloadpriority.h"
|
||||
#include "base/unicodestrings.h"
|
||||
#include "base/utils/misc.h"
|
||||
#include "base/utils/string.h"
|
||||
@@ -93,7 +93,7 @@ void PropListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
|
||||
newopt.maximum = 100;
|
||||
newopt.minimum = 0;
|
||||
newopt.textVisible = true;
|
||||
if (index.sibling(index.row(), PRIORITY).data().toInt() == static_cast<int>(BitTorrent::FilePriority::Ignored)) {
|
||||
if (index.sibling(index.row(), PRIORITY).data().toInt() == static_cast<int>(BitTorrent::DownloadPriority::Ignored)) {
|
||||
newopt.state &= ~QStyle::State_Enabled;
|
||||
newopt.palette = progressBarDisabledPalette();
|
||||
}
|
||||
@@ -111,17 +111,17 @@ void PropListDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti
|
||||
break;
|
||||
case PRIORITY: {
|
||||
QString text = "";
|
||||
switch (static_cast<BitTorrent::FilePriority>(index.data().toInt())) {
|
||||
case BitTorrent::FilePriority::Mixed:
|
||||
switch (static_cast<BitTorrent::DownloadPriority>(index.data().toInt())) {
|
||||
case BitTorrent::DownloadPriority::Mixed:
|
||||
text = tr("Mixed", "Mixed (priorities");
|
||||
break;
|
||||
case BitTorrent::FilePriority::Ignored:
|
||||
case BitTorrent::DownloadPriority::Ignored:
|
||||
text = tr("Not downloaded");
|
||||
break;
|
||||
case BitTorrent::FilePriority::High:
|
||||
case BitTorrent::DownloadPriority::High:
|
||||
text = tr("High", "High (priority)");
|
||||
break;
|
||||
case BitTorrent::FilePriority::Maximum:
|
||||
case BitTorrent::DownloadPriority::Maximum:
|
||||
text = tr("Maximum", "Maximum (priority)");
|
||||
break;
|
||||
default:
|
||||
@@ -155,14 +155,14 @@ void PropListDelegate::setEditorData(QWidget *editor, const QModelIndex &index)
|
||||
{
|
||||
auto *combobox = static_cast<QComboBox *>(editor);
|
||||
// Set combobox index
|
||||
switch (static_cast<BitTorrent::FilePriority>(index.data().toInt())) {
|
||||
case BitTorrent::FilePriority::Ignored:
|
||||
switch (static_cast<BitTorrent::DownloadPriority>(index.data().toInt())) {
|
||||
case BitTorrent::DownloadPriority::Ignored:
|
||||
combobox->setCurrentIndex(0);
|
||||
break;
|
||||
case BitTorrent::FilePriority::High:
|
||||
case BitTorrent::DownloadPriority::High:
|
||||
combobox->setCurrentIndex(2);
|
||||
break;
|
||||
case BitTorrent::FilePriority::Maximum:
|
||||
case BitTorrent::DownloadPriority::Maximum:
|
||||
combobox->setCurrentIndex(3);
|
||||
break;
|
||||
default:
|
||||
@@ -181,7 +181,7 @@ QWidget *PropListDelegate::createEditor(QWidget *parent, const QStyleOptionViewI
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (index.data().toInt() == static_cast<int>(BitTorrent::FilePriority::Mixed))
|
||||
if (index.data().toInt() == static_cast<int>(BitTorrent::DownloadPriority::Mixed))
|
||||
return nullptr;
|
||||
|
||||
auto *editor = new QComboBox(parent);
|
||||
@@ -199,16 +199,16 @@ void PropListDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
|
||||
int value = combobox->currentIndex();
|
||||
qDebug("PropListDelegate: setModelData(%d)", value);
|
||||
|
||||
BitTorrent::FilePriority prio = BitTorrent::FilePriority::Normal; // NORMAL
|
||||
BitTorrent::DownloadPriority prio = BitTorrent::DownloadPriority::Normal; // NORMAL
|
||||
switch (value) {
|
||||
case 0:
|
||||
prio = BitTorrent::FilePriority::Ignored; // IGNORED
|
||||
prio = BitTorrent::DownloadPriority::Ignored; // IGNORED
|
||||
break;
|
||||
case 2:
|
||||
prio = BitTorrent::FilePriority::High; // HIGH
|
||||
prio = BitTorrent::DownloadPriority::High; // HIGH
|
||||
break;
|
||||
case 3:
|
||||
prio = BitTorrent::FilePriority::Maximum; // MAX
|
||||
prio = BitTorrent::DownloadPriority::Maximum; // MAX
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -367,9 +367,9 @@ void TrackerListWidget::loadTrackers()
|
||||
}
|
||||
|
||||
item->setText(COL_PEERS, QString::number(data.numPeers));
|
||||
item->setText(COL_SEEDS, (entry.nativeEntry().scrape_complete > -1) ? QString::number(entry.nativeEntry().scrape_complete) : tr("N/A"));
|
||||
item->setText(COL_LEECHES, (entry.nativeEntry().scrape_incomplete > -1) ? QString::number(entry.nativeEntry().scrape_incomplete) : tr("N/A"));
|
||||
item->setText(COL_DOWNLOADED, (entry.nativeEntry().scrape_downloaded > -1) ? QString::number(entry.nativeEntry().scrape_downloaded) : tr("N/A"));
|
||||
item->setText(COL_SEEDS, (entry.numSeeds() > -1) ? QString::number(entry.numSeeds()) : tr("N/A"));
|
||||
item->setText(COL_LEECHES, (entry.numLeeches() > -1) ? QString::number(entry.numLeeches()) : tr("N/A"));
|
||||
item->setText(COL_DOWNLOADED, (entry.numDownloaded() > -1) ? QString::number(entry.numDownloaded()) : tr("N/A"));
|
||||
|
||||
item->setTextAlignment(COL_TIER, (Qt::AlignRight | Qt::AlignVCenter));
|
||||
item->setTextAlignment(COL_PEERS, (Qt::AlignRight | Qt::AlignVCenter));
|
||||
|
||||
Reference in New Issue
Block a user