mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 15:27:54 +00:00
Make use of Fast concatenation feature in Qt 4.6
This commit is contained in:
parent
6d7fba1a6c
commit
a468404ab5
@ -822,8 +822,9 @@ QTorrentHandle Bittorrent::addMagnetUri(QString magnet_uri, bool resumed) {
|
|||||||
//Getting fast resume data if existing
|
//Getting fast resume data if existing
|
||||||
std::vector<char> buf;
|
std::vector<char> buf;
|
||||||
if(resumed) {
|
if(resumed) {
|
||||||
qDebug("Trying to load fastresume data: %s", qPrintable(torrentBackup.path()+QDir::separator()+hash+QString(".fastresume")));
|
const QString &fastresume_path = torrentBackup.path()+QDir::separator()+hash+QString(".fastresume");
|
||||||
if (load_file((torrentBackup.path()+QDir::separator()+hash+QString(".fastresume")).toLocal8Bit().constData(), buf) == 0) {
|
qDebug("Trying to load fastresume data: %s", qPrintable(fastresume_path));
|
||||||
|
if (load_file(fastresume_path.toLocal8Bit().constData(), buf) == 0) {
|
||||||
fastResume = true;
|
fastResume = true;
|
||||||
p.resume_data = &buf;
|
p.resume_data = &buf;
|
||||||
qDebug("Successfuly loaded");
|
qDebug("Successfuly loaded");
|
||||||
@ -1030,8 +1031,9 @@ QTorrentHandle Bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
|
|||||||
//Getting fast resume data if existing
|
//Getting fast resume data if existing
|
||||||
std::vector<char> buf;
|
std::vector<char> buf;
|
||||||
if(resumed) {
|
if(resumed) {
|
||||||
qDebug("Trying to load fastresume data: %s", qPrintable(torrentBackup.path()+QDir::separator()+hash+QString(".fastresume")));
|
const QString &fastresume_path = torrentBackup.path()+QDir::separator()+hash+QString(".fastresume");
|
||||||
if (load_file((torrentBackup.path()+QDir::separator()+hash+QString(".fastresume")).toLocal8Bit().constData(), buf) == 0) {
|
qDebug("Trying to load fastresume data: %s", qPrintable(fastresume_path));
|
||||||
|
if (load_file(fastresume_path.toLocal8Bit().constData(), buf) == 0) {
|
||||||
fastResume = true;
|
fastResume = true;
|
||||||
p.resume_data = &buf;
|
p.resume_data = &buf;
|
||||||
qDebug("Successfuly loaded");
|
qDebug("Successfuly loaded");
|
||||||
@ -1315,7 +1317,8 @@ void Bittorrent::enableLSD(bool b) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Bittorrent::loadSessionState() {
|
void Bittorrent::loadSessionState() {
|
||||||
boost::filesystem::ifstream ses_state_file((misc::cacheLocation()+QDir::separator()+QString::fromUtf8("ses_state")).toLocal8Bit().constData()
|
const QString &state_path = misc::cacheLocation()+QDir::separator()+QString::fromUtf8("ses_state");
|
||||||
|
boost::filesystem::ifstream ses_state_file(state_path.toLocal8Bit().constData()
|
||||||
, std::ios_base::binary);
|
, std::ios_base::binary);
|
||||||
ses_state_file.unsetf(std::ios_base::skipws);
|
ses_state_file.unsetf(std::ios_base::skipws);
|
||||||
s->load_state(bdecode(
|
s->load_state(bdecode(
|
||||||
@ -1326,7 +1329,8 @@ void Bittorrent::loadSessionState() {
|
|||||||
void Bittorrent::saveSessionState() {
|
void Bittorrent::saveSessionState() {
|
||||||
qDebug("Saving session state to disk...");
|
qDebug("Saving session state to disk...");
|
||||||
entry session_state = s->state();
|
entry session_state = s->state();
|
||||||
boost::filesystem::ofstream out((misc::cacheLocation()+QDir::separator()+QString::fromUtf8("ses_state")).toLocal8Bit().constData()
|
const QString &state_path = misc::cacheLocation()+QDir::separator()+QString::fromUtf8("ses_state");
|
||||||
|
boost::filesystem::ofstream out(state_path.toLocal8Bit().constData()
|
||||||
, std::ios_base::binary);
|
, std::ios_base::binary);
|
||||||
out.unsetf(std::ios_base::skipws);
|
out.unsetf(std::ios_base::skipws);
|
||||||
bencode(std::ostream_iterator<char>(out), session_state);
|
bencode(std::ostream_iterator<char>(out), session_state);
|
||||||
@ -2217,7 +2221,8 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
|
|||||||
if(DHTEnabled) {
|
if(DHTEnabled) {
|
||||||
try{
|
try{
|
||||||
entry dht_state = s->dht_state();
|
entry dht_state = s->dht_state();
|
||||||
boost::filesystem::ofstream out((misc::cacheLocation()+QDir::separator()+QString::fromUtf8("dht_state")).toLocal8Bit().constData(), std::ios_base::binary);
|
const QString &dht_path = misc::cacheLocation()+QDir::separator()+QString::fromUtf8("dht_state");
|
||||||
|
boost::filesystem::ofstream out(dht_path.toLocal8Bit().constData(), std::ios_base::binary);
|
||||||
out.unsetf(std::ios_base::skipws);
|
out.unsetf(std::ios_base::skipws);
|
||||||
bencode(std::ostream_iterator<char>(out), dht_state);
|
bencode(std::ostream_iterator<char>(out), dht_state);
|
||||||
qDebug("DHT entry saved");
|
qDebug("DHT entry saved");
|
||||||
|
@ -117,7 +117,7 @@ void downloadThread::applyProxySettings() {
|
|||||||
QString IP = settings.value(QString::fromUtf8("Preferences/Connection/HTTPProxy/IP"), "0.0.0.0").toString();
|
QString IP = settings.value(QString::fromUtf8("Preferences/Connection/HTTPProxy/IP"), "0.0.0.0").toString();
|
||||||
proxy.setHostName(IP);
|
proxy.setHostName(IP);
|
||||||
QString port = settings.value(QString::fromUtf8("Preferences/Connection/HTTPProxy/Port"), 8080).toString();
|
QString port = settings.value(QString::fromUtf8("Preferences/Connection/HTTPProxy/Port"), 8080).toString();
|
||||||
qDebug("Using proxy: %s", qPrintable(IP+QString(":")+port));
|
qDebug("Using proxy: %s", qPrintable(IP));
|
||||||
proxy.setPort(port.toUShort());
|
proxy.setPort(port.toUShort());
|
||||||
// Default proxy type is HTTP, we must change if it is SOCKS5
|
// Default proxy type is HTTP, we must change if it is SOCKS5
|
||||||
if(intValue == SOCKS5 || intValue == SOCKS5_PW) {
|
if(intValue == SOCKS5 || intValue == SOCKS5_PW) {
|
||||||
|
@ -295,23 +295,23 @@ QVariantMap EventManager::getPropGeneralInfo(QString hash) const {
|
|||||||
data["creation_date"] = h.creation_date();
|
data["creation_date"] = h.creation_date();
|
||||||
// Comment
|
// Comment
|
||||||
data["comment"] = h.comment();
|
data["comment"] = h.comment();
|
||||||
data["total_wasted"] = misc::friendlyUnit(h.total_failed_bytes()+h.total_redundant_bytes());
|
data["total_wasted"] = QVariant(misc::friendlyUnit(h.total_failed_bytes()+h.total_redundant_bytes()));
|
||||||
data["total_uploaded"] = misc::friendlyUnit(h.all_time_upload()) + " ("+misc::friendlyUnit(h.total_payload_upload())+" "+tr("this session")+")";
|
data["total_uploaded"] = QVariant(misc::friendlyUnit(h.all_time_upload()) + " ("+misc::friendlyUnit(h.total_payload_upload())+" "+tr("this session")+")");
|
||||||
data["total_downloaded"] = misc::friendlyUnit(h.all_time_download()) + " ("+misc::friendlyUnit(h.total_payload_download())+" "+tr("this session")+")";
|
data["total_downloaded"] = QVariant(misc::friendlyUnit(h.all_time_download()) + " ("+misc::friendlyUnit(h.total_payload_download())+" "+tr("this session")+")");
|
||||||
if(h.upload_limit() <= 0)
|
if(h.upload_limit() <= 0)
|
||||||
data["up_limit"] = QString::fromUtf8("∞");
|
data["up_limit"] = QString::fromUtf8("∞");
|
||||||
else
|
else
|
||||||
data["up_limit"] = misc::friendlyUnit(h.upload_limit())+tr("/s", "/second (i.e. per second)");
|
data["up_limit"] = QVariant(misc::friendlyUnit(h.upload_limit())+tr("/s", "/second (i.e. per second)"));
|
||||||
if(h.download_limit() <= 0)
|
if(h.download_limit() <= 0)
|
||||||
data["dl_limit"] = QString::fromUtf8("∞");
|
data["dl_limit"] = QString::fromUtf8("∞");
|
||||||
else
|
else
|
||||||
data["dl_limit"] = misc::friendlyUnit(h.download_limit())+tr("/s", "/second (i.e. per second)");
|
data["dl_limit"] = QVariant(misc::friendlyUnit(h.download_limit())+tr("/s", "/second (i.e. per second)"));
|
||||||
QString elapsed_txt = misc::userFriendlyDuration(h.active_time());
|
QString elapsed_txt = misc::userFriendlyDuration(h.active_time());
|
||||||
if(h.is_seed()) {
|
if(h.is_seed()) {
|
||||||
elapsed_txt += " ("+tr("Seeded for %1", "e.g. Seeded for 3m10s").arg(misc::userFriendlyDuration(h.seeding_time()))+")";
|
elapsed_txt += " ("+tr("Seeded for %1", "e.g. Seeded for 3m10s").arg(misc::userFriendlyDuration(h.seeding_time()))+")";
|
||||||
}
|
}
|
||||||
data["time_elapsed"] = elapsed_txt;
|
data["time_elapsed"] = elapsed_txt;
|
||||||
data["nb_connections"] = QString::number(h.num_connections())+" ("+tr("%1 max", "e.g. 10 max").arg(QString::number(h.connections_limit()))+")";
|
data["nb_connections"] = QVariant(QString::number(h.num_connections())+" ("+tr("%1 max", "e.g. 10 max").arg(QString::number(h.connections_limit()))+")");
|
||||||
// Update ratio info
|
// Update ratio info
|
||||||
double ratio = BTSession->getRealRatio(h.hash());
|
double ratio = BTSession->getRealRatio(h.hash());
|
||||||
if(ratio > 100.)
|
if(ratio > 100.)
|
||||||
|
@ -329,7 +329,8 @@ public:
|
|||||||
#ifndef Q_WS_WIN
|
#ifndef Q_WS_WIN
|
||||||
unsigned long long available;
|
unsigned long long available;
|
||||||
struct statfs stats;
|
struct statfs stats;
|
||||||
const int ret = statfs ((dir_path.path()+"/.").toLocal8Bit().data(), &stats) ;
|
const QString &statfs_path = dir_path.path()+"/.";
|
||||||
|
const int ret = statfs (qPrintable(statfs_path), &stats) ;
|
||||||
if(ret == 0) {
|
if(ret == 0) {
|
||||||
available = ((unsigned long long)stats.f_bavail) *
|
available = ((unsigned long long)stats.f_bavail) *
|
||||||
((unsigned long long)stats.f_bsize) ;
|
((unsigned long long)stats.f_bsize) ;
|
||||||
|
@ -279,7 +279,7 @@ void PeerListWidget::saveSettings() const {
|
|||||||
else
|
else
|
||||||
sortOrderLetter = QString::fromUtf8("d");
|
sortOrderLetter = QString::fromUtf8("d");
|
||||||
int index = header()->sortIndicatorSection();
|
int index = header()->sortIndicatorSection();
|
||||||
settings.setValue(QString::fromUtf8("TorrentProperties/Peers/PeerListSortedCol"), QString::number(index)+sortOrderLetter);
|
settings.setValue(QString::fromUtf8("TorrentProperties/Peers/PeerListSortedCol"), QVariant(QString::number(index)+sortOrderLetter));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerListWidget::loadPeers(const QTorrentHandle &h, bool force_hostname_resolution) {
|
void PeerListWidget::loadPeers(const QTorrentHandle &h, bool force_hostname_resolution) {
|
||||||
|
@ -121,11 +121,7 @@ public:
|
|||||||
// Downloads
|
// Downloads
|
||||||
static QString getSavePath() {
|
static QString getSavePath() {
|
||||||
QSettings settings("qBittorrent", "qBittorrent");
|
QSettings settings("qBittorrent", "qBittorrent");
|
||||||
QString home = QDir::homePath();
|
return settings.value(QString::fromUtf8("Preferences/Downloads/SavePath"), QDir::home().absoluteFilePath("qBT_dir")).toString();
|
||||||
if(home[home.length()-1] != QDir::separator()){
|
|
||||||
home += QDir::separator();
|
|
||||||
}
|
|
||||||
return settings.value(QString::fromUtf8("Preferences/Downloads/SavePath"), home+"qBT_dir").toString();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setSavePath(QString save_path) {
|
static void setSavePath(QString save_path) {
|
||||||
@ -145,8 +141,8 @@ public:
|
|||||||
|
|
||||||
static QString getTempPath() {
|
static QString getTempPath() {
|
||||||
QSettings settings("qBittorrent", "qBittorrent");
|
QSettings settings("qBittorrent", "qBittorrent");
|
||||||
QString home = QDir::homePath();
|
QString temp = QDir::home().absoluteFilePath("qBT_dir")+QDir::separator()+"temp";
|
||||||
return settings.value(QString::fromUtf8("Preferences/Downloads/TempPath"), home+"qBT_dir"+QDir::separator()+"temp").toString();
|
return settings.value(QString::fromUtf8("Preferences/Downloads/TempPath"), temp).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setTempPath(QString path) {
|
static void setTempPath(QString path) {
|
||||||
|
@ -293,7 +293,7 @@ void PropertiesWidget::saveSettings() {
|
|||||||
sizes = slideSizes;
|
sizes = slideSizes;
|
||||||
qDebug("Sizes: %d", sizes.size());
|
qDebug("Sizes: %d", sizes.size());
|
||||||
if(sizes.size() == 2) {
|
if(sizes.size() == 2) {
|
||||||
settings.setValue(QString::fromUtf8("TorrentProperties/SplitterSizes"), QString::number(sizes.first())+','+QString::number(sizes.last()));
|
settings.setValue(QString::fromUtf8("TorrentProperties/SplitterSizes"), QVariant(QString::number(sizes.first())+','+QString::number(sizes.last())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -480,7 +480,7 @@ void PropertiesWidget::openDoubleClickedFile(QModelIndex index) {
|
|||||||
h.flush_cache();
|
h.flush_cache();
|
||||||
#endif
|
#endif
|
||||||
if(QFile::exists(file_path))
|
if(QFile::exists(file_path))
|
||||||
QDesktopServices::openUrl("file://"+file_path);
|
QDesktopServices::openUrl(QUrl("file://"+file_path));
|
||||||
else
|
else
|
||||||
QMessageBox::warning(this, tr("I/O Error"), tr("This file does not exist yet."));
|
QMessageBox::warning(this, tr("I/O Error"), tr("This file does not exist yet."));
|
||||||
} else {
|
} else {
|
||||||
@ -501,7 +501,7 @@ void PropertiesWidget::openDoubleClickedFile(QModelIndex index) {
|
|||||||
h.flush_cache();
|
h.flush_cache();
|
||||||
#endif
|
#endif
|
||||||
if(QFile::exists(file_path))
|
if(QFile::exists(file_path))
|
||||||
QDesktopServices::openUrl("file://"+file_path);
|
QDesktopServices::openUrl(QUrl("file://"+file_path));
|
||||||
else
|
else
|
||||||
QMessageBox::warning(this, tr("I/O Error"), tr("This folder does not exist yet."));
|
QMessageBox::warning(this, tr("I/O Error"), tr("This folder does not exist yet."));
|
||||||
}
|
}
|
||||||
|
@ -405,7 +405,7 @@ void RSSImp::fillFeedsList(QTreeWidgetItem *parent, RssFolder *rss_parent) {
|
|||||||
item = new QTreeWidgetItem(listStreams);
|
item = new QTreeWidgetItem(listStreams);
|
||||||
else
|
else
|
||||||
item = new QTreeWidgetItem(parent);
|
item = new QTreeWidgetItem(parent);
|
||||||
item->setData(0, Qt::DisplayRole, rss_child->getName()+ QString::fromUtf8(" (")+QString::number(rss_child->getNbUnRead(), 10)+QString(")"));
|
item->setData(0, Qt::DisplayRole, QVariant(rss_child->getName()+ QString::fromUtf8(" (")+QString::number(rss_child->getNbUnRead(), 10)+QString(")")));
|
||||||
// Notify TreeWidget of item addition
|
// Notify TreeWidget of item addition
|
||||||
listStreams->itemAdded(item, rss_child);
|
listStreams->itemAdded(item, rss_child);
|
||||||
// Set Icon
|
// Set Icon
|
||||||
|
@ -432,14 +432,15 @@ void SearchEngine::updateNova() {
|
|||||||
QString shipped_file = shipped_subDir.path()+"/"+file;
|
QString shipped_file = shipped_subDir.path()+"/"+file;
|
||||||
// Copy python classes
|
// Copy python classes
|
||||||
if(file.endsWith(".py")) {
|
if(file.endsWith(".py")) {
|
||||||
if(getPluginVersion(shipped_file) > getPluginVersion(destDir+file) ) {
|
const QString &dest_file = destDir+file;
|
||||||
|
if(getPluginVersion(shipped_file) > getPluginVersion(dest_file) ) {
|
||||||
qDebug("shippped %s is more recent then local plugin, updating", qPrintable(file));
|
qDebug("shippped %s is more recent then local plugin, updating", qPrintable(file));
|
||||||
if(QFile::exists(destDir+file)) {
|
if(QFile::exists(dest_file)) {
|
||||||
qDebug("Removing old %s", qPrintable(destDir+file));
|
qDebug("Removing old %s", qPrintable(dest_file));
|
||||||
QFile::remove(destDir+file);
|
QFile::remove(dest_file);
|
||||||
}
|
}
|
||||||
qDebug("%s copied to %s", qPrintable(shipped_file), qPrintable(destDir+file));
|
qDebug("%s copied to %s", qPrintable(shipped_file), qPrintable(dest_file));
|
||||||
QFile::copy(shipped_file, destDir+file);
|
QFile::copy(shipped_file, dest_file);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Copy icons
|
// Copy icons
|
||||||
|
@ -108,6 +108,9 @@ QT += network
|
|||||||
|
|
||||||
DEFINES += QT_NO_CAST_TO_ASCII
|
DEFINES += QT_NO_CAST_TO_ASCII
|
||||||
|
|
||||||
|
# Fast concatenation (Qt >= 4.6)
|
||||||
|
DEFINES += QT_USE_FAST_CONCATENATION QT_USE_FAST_OPERATOR_PLUS
|
||||||
|
|
||||||
# Windows
|
# Windows
|
||||||
# usually built as static
|
# usually built as static
|
||||||
# win32:LIBS += -ltorrent -lboost_system
|
# win32:LIBS += -ltorrent -lboost_system
|
||||||
|
@ -172,19 +172,19 @@ public:
|
|||||||
vLayout->setSpacing(2);
|
vLayout->setSpacing(2);
|
||||||
// Add status filters
|
// Add status filters
|
||||||
QListWidgetItem *all = new QListWidgetItem(statusFilters);
|
QListWidgetItem *all = new QListWidgetItem(statusFilters);
|
||||||
all->setData(Qt::DisplayRole, tr("All") + " (0)");
|
all->setData(Qt::DisplayRole, QVariant(tr("All") + " (0)"));
|
||||||
all->setData(Qt::DecorationRole, QIcon(":/Icons/skin/filterall.png"));
|
all->setData(Qt::DecorationRole, QIcon(":/Icons/skin/filterall.png"));
|
||||||
QListWidgetItem *downloading = new QListWidgetItem(statusFilters);
|
QListWidgetItem *downloading = new QListWidgetItem(statusFilters);
|
||||||
downloading->setData(Qt::DisplayRole, tr("Downloading") + " (0)");
|
downloading->setData(Qt::DisplayRole, QVariant(tr("Downloading") + " (0)"));
|
||||||
downloading->setData(Qt::DecorationRole, QIcon(":/Icons/skin/downloading.png"));
|
downloading->setData(Qt::DecorationRole, QIcon(":/Icons/skin/downloading.png"));
|
||||||
QListWidgetItem *completed = new QListWidgetItem(statusFilters);
|
QListWidgetItem *completed = new QListWidgetItem(statusFilters);
|
||||||
completed->setData(Qt::DisplayRole, tr("Completed") + " (0)");
|
completed->setData(Qt::DisplayRole, QVariant(tr("Completed") + " (0)"));
|
||||||
completed->setData(Qt::DecorationRole, QIcon(":/Icons/skin/uploading.png"));
|
completed->setData(Qt::DecorationRole, QIcon(":/Icons/skin/uploading.png"));
|
||||||
QListWidgetItem *active = new QListWidgetItem(statusFilters);
|
QListWidgetItem *active = new QListWidgetItem(statusFilters);
|
||||||
active->setData(Qt::DisplayRole, tr("Active") + " (0)");
|
active->setData(Qt::DisplayRole, QVariant(tr("Active") + " (0)"));
|
||||||
active->setData(Qt::DecorationRole, QIcon(":/Icons/skin/filteractive.png"));
|
active->setData(Qt::DecorationRole, QIcon(":/Icons/skin/filteractive.png"));
|
||||||
QListWidgetItem *inactive = new QListWidgetItem(statusFilters);
|
QListWidgetItem *inactive = new QListWidgetItem(statusFilters);
|
||||||
inactive->setData(Qt::DisplayRole, tr("Inactive") + " (0)");
|
inactive->setData(Qt::DisplayRole, QVariant(tr("Inactive") + " (0)"));
|
||||||
inactive->setData(Qt::DecorationRole, QIcon(":/Icons/skin/filterinactive.png"));
|
inactive->setData(Qt::DecorationRole, QIcon(":/Icons/skin/filterinactive.png"));
|
||||||
|
|
||||||
// SIGNAL/SLOT
|
// SIGNAL/SLOT
|
||||||
@ -198,10 +198,10 @@ public:
|
|||||||
|
|
||||||
// Add Label filters
|
// Add Label filters
|
||||||
QListWidgetItem *allLabels = new QListWidgetItem(labelFilters);
|
QListWidgetItem *allLabels = new QListWidgetItem(labelFilters);
|
||||||
allLabels->setData(Qt::DisplayRole, tr("All labels") + " (0)");
|
allLabels->setData(Qt::DisplayRole, QVariant(tr("All labels") + " (0)"));
|
||||||
allLabels->setData(Qt::DecorationRole, QIcon(":/Icons/oxygen/folder.png"));
|
allLabels->setData(Qt::DecorationRole, QIcon(":/Icons/oxygen/folder.png"));
|
||||||
QListWidgetItem *noLabel = new QListWidgetItem(labelFilters);
|
QListWidgetItem *noLabel = new QListWidgetItem(labelFilters);
|
||||||
noLabel->setData(Qt::DisplayRole, tr("Unlabeled") + " (0)");
|
noLabel->setData(Qt::DisplayRole, QVariant(tr("Unlabeled") + " (0)"));
|
||||||
noLabel->setData(Qt::DecorationRole, QIcon(":/Icons/oxygen/folder.png"));
|
noLabel->setData(Qt::DecorationRole, QIcon(":/Icons/oxygen/folder.png"));
|
||||||
|
|
||||||
// Load settings
|
// Load settings
|
||||||
@ -257,11 +257,11 @@ public:
|
|||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void updateTorrentNumbers(uint nb_downloading, uint nb_seeding, uint nb_active, uint nb_inactive) {
|
void updateTorrentNumbers(uint nb_downloading, uint nb_seeding, uint nb_active, uint nb_inactive) {
|
||||||
statusFilters->item(FILTER_ALL)->setData(Qt::DisplayRole, tr("All")+" ("+QString::number(nb_active+nb_inactive)+")");
|
statusFilters->item(FILTER_ALL)->setData(Qt::DisplayRole, QVariant(tr("All")+" ("+QString::number(nb_active+nb_inactive)+")"));
|
||||||
statusFilters->item(FILTER_DOWNLOADING)->setData(Qt::DisplayRole, tr("Downloading")+" ("+QString::number(nb_downloading)+")");
|
statusFilters->item(FILTER_DOWNLOADING)->setData(Qt::DisplayRole, QVariant(tr("Downloading")+" ("+QString::number(nb_downloading)+")"));
|
||||||
statusFilters->item(FILTER_COMPLETED)->setData(Qt::DisplayRole, tr("Completed")+" ("+QString::number(nb_seeding)+")");
|
statusFilters->item(FILTER_COMPLETED)->setData(Qt::DisplayRole, QVariant(tr("Completed")+" ("+QString::number(nb_seeding)+")"));
|
||||||
statusFilters->item(FILTER_ACTIVE)->setData(Qt::DisplayRole, tr("Active")+" ("+QString::number(nb_active)+")");
|
statusFilters->item(FILTER_ACTIVE)->setData(Qt::DisplayRole, QVariant(tr("Active")+" ("+QString::number(nb_active)+")"));
|
||||||
statusFilters->item(FILTER_INACTIVE)->setData(Qt::DisplayRole, tr("Inactive")+" ("+QString::number(nb_inactive)+")");
|
statusFilters->item(FILTER_INACTIVE)->setData(Qt::DisplayRole, QVariant(tr("Inactive")+" ("+QString::number(nb_inactive)+")"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void torrentDropped(int row) {
|
void torrentDropped(int row) {
|
||||||
|
@ -295,7 +295,7 @@ void TransferListWidget::updateMetadata(QTorrentHandle &h) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void TransferListWidget::previewFile(QString filePath) {
|
void TransferListWidget::previewFile(QString filePath) {
|
||||||
QDesktopServices::openUrl(QString("file://")+filePath);
|
QDesktopServices::openUrl(QUrl(QString("file://")+filePath));
|
||||||
}
|
}
|
||||||
|
|
||||||
int TransferListWidget::updateTorrent(int row) {
|
int TransferListWidget::updateTorrent(int row) {
|
||||||
@ -584,9 +584,9 @@ void TransferListWidget::torrentDoubleClicked(const QModelIndex& index) {
|
|||||||
break;
|
break;
|
||||||
case OPEN_DEST:
|
case OPEN_DEST:
|
||||||
if(h.has_metadata())
|
if(h.has_metadata())
|
||||||
QDesktopServices::openUrl("file://" + h.root_path());
|
QDesktopServices::openUrl(QUrl("file://" + h.root_path()));
|
||||||
else
|
else
|
||||||
QDesktopServices::openUrl("file://" + h.save_path());
|
QDesktopServices::openUrl(QUrl("file://" + h.save_path()));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -693,7 +693,7 @@ void TransferListWidget::buySelectedTorrents() const {
|
|||||||
foreach(const QString &hash, hashes) {
|
foreach(const QString &hash, hashes) {
|
||||||
const QTorrentHandle &h = BTSession->getTorrentHandle(hash);
|
const QTorrentHandle &h = BTSession->getTorrentHandle(hash);
|
||||||
if(h.is_valid())
|
if(h.is_valid())
|
||||||
QDesktopServices::openUrl("http://match.sharemonkey.com/?info_hash="+h.hash()+"&n="+h.name()+"&cid=33");
|
QDesktopServices::openUrl(QUrl("http://match.sharemonkey.com/?info_hash="+h.hash()+"&n="+h.name()+"&cid=33"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1257,7 +1257,7 @@ void TransferListWidget::saveLastSortedColumn() {
|
|||||||
else
|
else
|
||||||
sortOrderLetter = QString::fromUtf8("d");
|
sortOrderLetter = QString::fromUtf8("d");
|
||||||
const int index = header()->sortIndicatorSection();
|
const int index = header()->sortIndicatorSection();
|
||||||
settings.setValue(QString::fromUtf8("TransferListSortedCol"), QString::number(index)+sortOrderLetter);
|
settings.setValue(QString::fromUtf8("TransferListSortedCol"), QVariant(QString::number(index)+sortOrderLetter));
|
||||||
}
|
}
|
||||||
|
|
||||||
void TransferListWidget::loadLastSortedColumn() {
|
void TransferListWidget::loadLastSortedColumn() {
|
||||||
|
Loading…
Reference in New Issue
Block a user