mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-17 14:08:03 -06:00
Compare commits
1 Commits
release-1.
...
release-1.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
37bcb56bb8 |
@@ -6,7 +6,6 @@
|
||||
- FEATURE: Added RSS support
|
||||
- FEATURE: Support files prioritizing in a torrent
|
||||
- FEATURE: Brand new search engine plugins system
|
||||
- FEATURE: Filtered files don't appear on hard disk anymore
|
||||
- FEATURE: Finished torrents are now moved to another tab for seeding
|
||||
- FEATURE: Display more infos about the torrent in its properties
|
||||
- FEATURE: Allow the user to edit torrents' trackers
|
||||
|
||||
16
TODO
16
TODO
@@ -52,16 +52,14 @@
|
||||
|
||||
// in v1.0.0 - FEATURE FREEZE
|
||||
- Fix all (or almost all) opened bugs in bug tracker
|
||||
- debug new torrent content selection
|
||||
- Recheck doc
|
||||
- Translations update (IN PROGRESS)
|
||||
- add qt4-qtconfig as package dependency
|
||||
|
||||
rc4->rc5 changelog:
|
||||
- BUGFIX: Now filtered don't appear on hard drive anymore (libtorrent >= r1659)
|
||||
- BUGFIX: AddInPause setting doesn't pause downloads on startup anymore
|
||||
- BUGFIX: Fixed an ETA calculation problem when the torrent has filtered files
|
||||
- BUGFIX: Fixed possible overflow in ETA calculation
|
||||
- BUGFIX: Fixed "Missing Input path" error when creating a torrent
|
||||
- BUGFIX: Fixed some notification messages for torrent addition dialog
|
||||
- BUGFIX: Fixed "Automatically start seeding" feature in torrent creation tool
|
||||
- COSMETIC: Improved progress bar text rendering
|
||||
rc3->rc4 changelog:
|
||||
- BUGFIX: Fixed ip filter preferences (couldn't enable it)
|
||||
- BUGFIX: Fixed compilation problems on FreeBSD (Ok now)
|
||||
- BUGFIX: Updated INSTALL file
|
||||
- BUGFIX: Optimized torrent real size calculation
|
||||
- BUGFIX: Use system default style as a default (instead of Plastique style)
|
||||
@@ -83,9 +83,12 @@ class DLListDelegate: public QItemDelegate {
|
||||
newopt.maximum = 100;
|
||||
newopt.minimum = 0;
|
||||
newopt.state |= QStyle::State_Enabled;
|
||||
newopt.textVisible = true;
|
||||
newopt.textVisible = false;
|
||||
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &newopt,
|
||||
painter);
|
||||
QPalette::ColorGroup cg = opt.state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled;
|
||||
painter->setPen(opt.palette.color(cg, QPalette::WindowText));
|
||||
painter->drawText(opt.rect, Qt::AlignCenter, newopt.text);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
@@ -76,9 +76,12 @@ class FinishedListDelegate: public QItemDelegate {
|
||||
newopt.maximum = 100;
|
||||
newopt.minimum = 0;
|
||||
newopt.state |= QStyle::State_Enabled;
|
||||
newopt.textVisible = true;
|
||||
newopt.textVisible = false;
|
||||
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &newopt,
|
||||
painter);
|
||||
QPalette::ColorGroup cg = opt.state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled;
|
||||
painter->setPen(opt.palette.color(cg, QPalette::WindowText));
|
||||
painter->drawText(opt.rect, Qt::AlignCenter, newopt.text);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
@@ -513,7 +513,7 @@ void GUI::closeEvent(QCloseEvent *e) {
|
||||
// Display window to create a torrent
|
||||
void GUI::on_actionCreate_torrent_triggered() {
|
||||
createtorrent *ct = new createtorrent(this);
|
||||
connect(ct, SIGNAL(torrent_to_seed(QString)), this, SLOT(addTorrent(QString)));
|
||||
connect(ct, SIGNAL(torrent_to_seed(QString)), this, SLOT(addTorrent(QString path)));
|
||||
}
|
||||
|
||||
// Called when we minimize the program
|
||||
@@ -557,7 +557,7 @@ void GUI::dropEvent(QDropEvent *event) {
|
||||
if(useTorrentAdditionDialog) {
|
||||
torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
|
||||
connect(dialog, SIGNAL(torrentAddition(QString, bool, QString)), BTSession, SLOT(addTorrent(QString, bool, QString)));
|
||||
connect(dialog, SIGNAL(setInfoBarGUI(QString, QColor)), downloadingTorrentTab, SLOT(setInfoBar(QString, QColor)));
|
||||
connect(dialog, SIGNAL(setInfoBarGUI(QString, QString)), downloadingTorrentTab, SLOT(setInfoBar(QString, QString)));
|
||||
dialog->showLoad(file);
|
||||
}else{
|
||||
BTSession->addTorrent(file);
|
||||
@@ -598,7 +598,7 @@ void GUI::on_actionOpen_triggered() {
|
||||
if(useTorrentAdditionDialog) {
|
||||
torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
|
||||
connect(dialog, SIGNAL(torrentAddition(QString, bool, QString)), BTSession, SLOT(addTorrent(QString, bool, QString)));
|
||||
connect(dialog, SIGNAL(setInfoBarGUI(QString, QColor)), downloadingTorrentTab, SLOT(setInfoBar(QString, QColor)));
|
||||
connect(dialog, SIGNAL(setInfoBarGUI(QString, QString)), downloadingTorrentTab, SLOT(setInfoBar(QString, QString)));
|
||||
dialog->showLoad(pathsList.at(i));
|
||||
}else{
|
||||
BTSession->addTorrent(pathsList.at(i));
|
||||
|
||||
@@ -61,8 +61,11 @@ class PreviewListDelegate: public QItemDelegate {
|
||||
newopt.maximum = 100;
|
||||
newopt.minimum = 0;
|
||||
newopt.state |= QStyle::State_Enabled;
|
||||
newopt.textVisible = true;
|
||||
newopt.textVisible = false;
|
||||
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &newopt, painter);
|
||||
QPalette::ColorGroup cg = opt.state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled;
|
||||
painter->setPen(opt.palette.color(cg, QPalette::WindowText));
|
||||
painter->drawText(opt.rect, Qt::AlignCenter, newopt.text);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
@@ -75,8 +75,11 @@ class PropListDelegate: public QItemDelegate {
|
||||
newopt.maximum = 100;
|
||||
newopt.minimum = 0;
|
||||
newopt.state |= QStyle::State_Enabled;
|
||||
newopt.textVisible = true;
|
||||
newopt.textVisible = false;
|
||||
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &newopt, painter);
|
||||
QPalette::ColorGroup cg = opt.state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled;
|
||||
painter->setPen(opt.palette.color(cg, QPalette::WindowText));
|
||||
painter->drawText(opt.rect, Qt::AlignCenter, newopt.text);
|
||||
break;
|
||||
}
|
||||
case PRIORITY:{
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "bittorrent.h"
|
||||
#include "misc.h"
|
||||
#include "downloadThread.h"
|
||||
#include "deleteThread.h"
|
||||
|
||||
#include <libtorrent/extensions/metadata_transfer.hpp>
|
||||
#include <libtorrent/extensions/ut_pex.hpp>
|
||||
@@ -61,6 +62,8 @@ bittorrent::bittorrent() : timerScan(0), DHTEnabled(false), preAllocateAll(false
|
||||
downloader = new downloadThread(this);
|
||||
connect(downloader, SIGNAL(downloadFinished(QString, QString)), this, SLOT(processDownloadedFile(QString, QString)));
|
||||
connect(downloader, SIGNAL(downloadFailure(QString, QString)), this, SLOT(handleDownloadFailure(QString, QString)));
|
||||
// File deleter (thread)
|
||||
deleter = new deleteThread(this);
|
||||
qDebug("* BTSession constructed");
|
||||
}
|
||||
|
||||
@@ -69,6 +72,7 @@ bittorrent::~bittorrent() {
|
||||
// Disable directory scanning
|
||||
disableDirectoryScanning();
|
||||
// Delete our objects
|
||||
delete deleter;
|
||||
delete timerAlerts;
|
||||
delete ETARefresher;
|
||||
delete downloader;
|
||||
@@ -78,16 +82,20 @@ bittorrent::~bittorrent() {
|
||||
|
||||
void bittorrent::preAllocateAllFiles(bool b) {
|
||||
preAllocateAll = b;
|
||||
// Reload All Torrents
|
||||
std::vector<torrent_handle> handles = s->get_torrents();
|
||||
unsigned int nbHandles = handles.size();
|
||||
for(unsigned int i=0; i<nbHandles; ++i) {
|
||||
QTorrentHandle h = handles[i];
|
||||
if(!h.is_valid()) {
|
||||
qDebug("/!\\ Error: Invalid handle");
|
||||
continue;
|
||||
if(b) {
|
||||
// Reload All Torrents
|
||||
std::vector<torrent_handle> handles = s->get_torrents();
|
||||
unsigned int nbHandles = handles.size();
|
||||
for(unsigned int i=0; i<nbHandles; ++i) {
|
||||
QTorrentHandle h = handles[i];
|
||||
if(!h.is_valid()) {
|
||||
qDebug("/!\\ Error: Invalid handle");
|
||||
continue;
|
||||
}
|
||||
QString hash = h.hash();
|
||||
if(has_filtered_files(hash)) continue;
|
||||
reloadTorrent(h);
|
||||
}
|
||||
pauseAndReloadTorrent(h, b);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,13 +148,11 @@ void bittorrent::updateETAs() {
|
||||
if(h.is_paused()) continue;
|
||||
QString hash = h.hash();
|
||||
QList<qlonglong> listEtas = ETAstats.value(hash, QList<qlonglong>());
|
||||
// XXX: We can still get an overflow if remaining file size is approximately
|
||||
// 8.38*10^5 TiB (let's assume this can't happen)
|
||||
if(h.download_payload_rate() > 0.1) {
|
||||
if(listEtas.size() == ETAS_MAX_VALUES) {
|
||||
listEtas.removeFirst();
|
||||
}
|
||||
listEtas << (qlonglong)((h.actual_size()-h.total_wanted_done())/(double)h.download_payload_rate());
|
||||
if(listEtas.size() == ETAS_MAX_VALUES) {
|
||||
listEtas.removeFirst();
|
||||
}
|
||||
if(h.download_payload_rate()) {
|
||||
listEtas << (qlonglong)((h.actual_size()-h.total_done())/(double)h.download_payload_rate());
|
||||
ETAstats[hash] = listEtas;
|
||||
qlonglong moy = 0;
|
||||
qlonglong val;
|
||||
@@ -154,16 +160,12 @@ void bittorrent::updateETAs() {
|
||||
Q_ASSERT(nbETAs);
|
||||
foreach(val, listEtas) {
|
||||
moy += (qlonglong)((double)val/(double)nbETAs);
|
||||
Q_ASSERT(moy >= 0);
|
||||
if(moy < 0) break;
|
||||
}
|
||||
ETAs[hash] = moy;
|
||||
} else {
|
||||
// Speed is too low, we don't want an overflow.
|
||||
if(ETAstats.contains(hash)) {
|
||||
ETAstats.remove(hash);
|
||||
}
|
||||
if(ETAs.contains(hash)) {
|
||||
if(moy < 0) {
|
||||
ETAs.remove(hash);
|
||||
} else {
|
||||
ETAs[hash] = moy;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -206,13 +208,12 @@ void bittorrent::deleteTorrent(QString hash, bool permanent) {
|
||||
}
|
||||
QString savePath = h.save_path();
|
||||
QString fileName = h.name();
|
||||
// Remove it from session
|
||||
if(permanent) {
|
||||
qDebug("Removing this on hard drive: %s", qPrintable(savePath+QDir::separator()+fileName));
|
||||
s->remove_torrent(h.get_torrent_handle(), session::delete_files);
|
||||
} else {
|
||||
s->remove_torrent(h.get_torrent_handle());
|
||||
arborescence *files_arb = 0;
|
||||
if(permanent){
|
||||
files_arb = new arborescence(h.get_torrent_info());
|
||||
}
|
||||
// Remove it from session
|
||||
s->remove_torrent(h.get_torrent_handle());
|
||||
// Remove it from torrent backup directory
|
||||
QDir torrentBackup(misc::qBittorrentPath() + "BT_backup");
|
||||
QStringList filters;
|
||||
@@ -227,10 +228,6 @@ void bittorrent::deleteTorrent(QString hash, bool permanent) {
|
||||
ETAs.remove(hash);
|
||||
// Remove tracker errors
|
||||
trackersErrors.remove(hash);
|
||||
// Remove from reloadingTorrents if reloading
|
||||
if(reloadingTorrents.contains(hash)) {
|
||||
reloadingTorrents.remove(hash);
|
||||
}
|
||||
// Remove it from ratio table
|
||||
ratioData.remove(hash);
|
||||
int index = finishedTorrents.indexOf(hash);
|
||||
@@ -244,6 +241,12 @@ void bittorrent::deleteTorrent(QString hash, bool permanent) {
|
||||
std::cerr << "Error: Torrent " << hash.toStdString() << " is neither in finished or unfinished list\n";
|
||||
}
|
||||
}
|
||||
if(permanent && files_arb != 0) {
|
||||
// Remove from Hard drive
|
||||
qDebug("Removing this on hard drive: %s", qPrintable(savePath+QDir::separator()+fileName));
|
||||
// Deleting in a thread to avoid GUI freeze
|
||||
deleter->deleteTorrent(savePath, files_arb);
|
||||
}
|
||||
}
|
||||
|
||||
// Return a list of hashes for the finished torrents
|
||||
@@ -370,7 +373,7 @@ void bittorrent::loadWebSeeds(QString hash) {
|
||||
}
|
||||
|
||||
// Add a torrent to the bittorrent session
|
||||
void bittorrent::addTorrent(QString path, bool fromScanDir, QString from_url, bool resumed) {
|
||||
void bittorrent::addTorrent(QString path, bool fromScanDir, QString from_url) {
|
||||
QTorrentHandle h;
|
||||
entry resume_data;
|
||||
bool fastResume=false;
|
||||
@@ -440,12 +443,12 @@ void bittorrent::addTorrent(QString path, bool fromScanDir, QString from_url, bo
|
||||
}
|
||||
QString savePath = getSavePath(hash);
|
||||
// Adding files to bittorrent session
|
||||
if(preAllocateAll) {
|
||||
h = s->add_torrent(t, fs::path(savePath.toUtf8().data()), resume_data, storage_mode_allocate, true);
|
||||
if(has_filtered_files(hash) || preAllocateAll) {
|
||||
h = s->add_torrent(t, fs::path(savePath.toUtf8().data()), resume_data, false, true);
|
||||
qDebug(" -> Full allocation mode");
|
||||
}else{
|
||||
h = s->add_torrent(t, fs::path(savePath.toUtf8().data()), resume_data, storage_mode_sparse, true);
|
||||
qDebug(" -> Sparse allocation mode");
|
||||
h = s->add_torrent(t, fs::path(savePath.toUtf8().data()), resume_data, true, true);
|
||||
qDebug(" -> Compact allocation mode");
|
||||
}
|
||||
if(!h.is_valid()) {
|
||||
// No need to keep on, it failed.
|
||||
@@ -482,7 +485,7 @@ void bittorrent::addTorrent(QString path, bool fromScanDir, QString from_url, bo
|
||||
QFile::copy(file, newFile);
|
||||
}
|
||||
// Pause torrent if it was paused last time
|
||||
if((!resumed && addInPause) || QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".paused")) {
|
||||
if(addInPause || QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".paused")) {
|
||||
torrentsToPauseAfterChecking << hash;
|
||||
qDebug("Adding a torrent to the torrentsToPauseAfterChecking list");
|
||||
}
|
||||
@@ -1116,9 +1119,10 @@ void bittorrent::readAlerts() {
|
||||
if(index != -1){
|
||||
waitingForPause.removeAt(index);
|
||||
}
|
||||
if(reloadingTorrents.contains(hash)) {
|
||||
reloadTorrent(h, reloadingTorrents.value(hash));
|
||||
reloadingTorrents.remove(hash);
|
||||
index = reloadingTorrents.indexOf(hash);
|
||||
if(index != -1) {
|
||||
reloadingTorrents.removeAt(index);
|
||||
reloadTorrent(h);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1164,7 +1168,7 @@ QStringList bittorrent::getTorrentsToPauseAfterChecking() const{
|
||||
|
||||
// Function to reload the torrent async after the torrent is actually
|
||||
// paused so that we can get fastresume data
|
||||
void bittorrent::pauseAndReloadTorrent(QTorrentHandle h, bool full_alloc) {
|
||||
void bittorrent::pauseAndReloadTorrent(QTorrentHandle h) {
|
||||
if(!h.is_valid()) {
|
||||
std::cerr << "/!\\ Error: Invalid handle\n";
|
||||
return;
|
||||
@@ -1172,14 +1176,14 @@ void bittorrent::pauseAndReloadTorrent(QTorrentHandle h, bool full_alloc) {
|
||||
// ask to pause the torrent (async)
|
||||
h.pause();
|
||||
QString hash = h.hash();
|
||||
// Add it to reloadingTorrents has table so that we now we
|
||||
// Add it to reloadingTorrents list so that we now we
|
||||
// we should reload the torrent once we receive the
|
||||
// torrent_paused_alert. pause() is async now...
|
||||
reloadingTorrents[hash] = full_alloc;
|
||||
reloadingTorrents << hash;
|
||||
}
|
||||
|
||||
// Reload a torrent with full allocation mode
|
||||
void bittorrent::reloadTorrent(const QTorrentHandle &h, bool full_alloc) {
|
||||
void bittorrent::reloadTorrent(const QTorrentHandle &h) {
|
||||
qDebug("** Reloading a torrent");
|
||||
if(!h.is_valid()) {
|
||||
qDebug("/!\\ Error: Invalid handle");
|
||||
@@ -1210,11 +1214,7 @@ void bittorrent::reloadTorrent(const QTorrentHandle &h, bool full_alloc) {
|
||||
SleeperThread::msleep(1000);
|
||||
++timeout;
|
||||
}
|
||||
QTorrentHandle new_h;
|
||||
if(full_alloc)
|
||||
new_h = s->add_torrent(t, saveDir, resumeData, storage_mode_allocate);
|
||||
else
|
||||
new_h = s->add_torrent(t, saveDir, resumeData, storage_mode_sparse);
|
||||
QTorrentHandle new_h = s->add_torrent(t, saveDir, resumeData, false);
|
||||
qDebug("Using full allocation mode");
|
||||
// Connections limit per torrent
|
||||
new_h.set_max_connections(maxConnecsPerTorrent);
|
||||
@@ -1335,7 +1335,7 @@ void bittorrent::applyEncryptionSettings(pe_settings se) {
|
||||
s->set_pe_settings(se);
|
||||
}
|
||||
|
||||
// Will fast resume torrents in
|
||||
// Will fast resume unfinished torrents in
|
||||
// backup directory
|
||||
void bittorrent::resumeUnfinishedTorrents() {
|
||||
qDebug("Resuming unfinished torrents");
|
||||
@@ -1351,7 +1351,7 @@ void bittorrent::resumeUnfinishedTorrents() {
|
||||
}
|
||||
// Resume downloads
|
||||
foreach(fileName, filePaths) {
|
||||
addTorrent(fileName, false, QString(), true);
|
||||
addTorrent(fileName, false);
|
||||
}
|
||||
qDebug("Unfinished torrents resumed");
|
||||
}
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
using namespace libtorrent;
|
||||
|
||||
class downloadThread;
|
||||
class deleteThread;
|
||||
class QTimer;
|
||||
|
||||
class bittorrent : public QObject{
|
||||
@@ -47,12 +48,13 @@ class bittorrent : public QObject{
|
||||
downloadThread *downloader;
|
||||
QString defaultSavePath;
|
||||
QStringList torrentsToPauseAfterChecking;
|
||||
QHash<QString, bool> reloadingTorrents;
|
||||
QStringList reloadingTorrents;
|
||||
QHash<QString, QList<qlonglong> > ETAstats;
|
||||
QHash<QString, qlonglong> ETAs;
|
||||
QHash<QString, QPair<size_type,size_type> > ratioData;
|
||||
QTimer *ETARefresher;
|
||||
QHash<QString, QList<QPair<QString, QString> > > trackersErrors;
|
||||
deleteThread *deleter;
|
||||
QStringList waitingForPause;
|
||||
QStringList finishedTorrents;
|
||||
QStringList unfinishedTorrents;
|
||||
@@ -88,7 +90,7 @@ class bittorrent : public QObject{
|
||||
bool has_filtered_files(QString hash) const;
|
||||
|
||||
public slots:
|
||||
void addTorrent(QString path, bool fromScanDir = false, QString from_url = QString(), bool resumed = false);
|
||||
void addTorrent(QString path, bool fromScanDir = false, QString from_url = QString());
|
||||
void downloadFromUrl(QString url);
|
||||
void downloadFromURLList(const QStringList& url_list);
|
||||
void deleteTorrent(QString hash, bool permanent = false);
|
||||
@@ -102,6 +104,7 @@ class bittorrent : public QObject{
|
||||
void enablePeerExchange();
|
||||
void enableIPFilter(ip_filter filter);
|
||||
void disableIPFilter();
|
||||
void pauseAndReloadTorrent(QTorrentHandle h);
|
||||
void resumeUnfinishedTorrents();
|
||||
void updateETAs();
|
||||
void saveTorrentSpeedLimits(QString hash);
|
||||
@@ -141,8 +144,7 @@ class bittorrent : public QObject{
|
||||
void processDownloadedFile(QString, QString);
|
||||
bool loadTrackerFile(QString hash);
|
||||
void saveTrackerFile(QString hash);
|
||||
void pauseAndReloadTorrent(QTorrentHandle h, bool full_alloc);
|
||||
void reloadTorrent(const QTorrentHandle &h, bool full_alloc); // This is protected now, call pauseAndReloadTorrent() instead
|
||||
void reloadTorrent(const QTorrentHandle &h); // This is protected now, call pauseAndReloadTorrent() instead
|
||||
void deleteBigRatios();
|
||||
|
||||
signals:
|
||||
|
||||
@@ -141,7 +141,7 @@ QStringList createtorrent::allItems(QListWidget *list){
|
||||
// Main function that create a .torrent file
|
||||
void createtorrent::on_createButton_clicked(){
|
||||
QString input = textInputPath->text().trimmed();
|
||||
if(input.isEmpty()){
|
||||
if(input.isEmpty() == 0){
|
||||
QMessageBox::critical(0, tr("No input path set"), tr("Please type an input path first"));
|
||||
return;
|
||||
}
|
||||
@@ -199,7 +199,6 @@ void createtorrent::on_createButton_clicked(){
|
||||
// create the torrent and print it to out
|
||||
entry e = t->create_torrent();
|
||||
libtorrent::bencode(std::ostream_iterator<char>(out), e);
|
||||
out.flush();
|
||||
if(checkStartSeeding->isChecked())
|
||||
emit torrent_to_seed(destination);
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <QTcpSocket>
|
||||
#include <QTcpServer>
|
||||
#include <QPlastiqueStyle>
|
||||
#include "qgnomelook.h"
|
||||
#include <QCleanlooksStyle>
|
||||
#include <QMotifStyle>
|
||||
#include <QCDEStyle>
|
||||
#ifdef Q_WS_WIN
|
||||
@@ -50,7 +50,7 @@ void useStyle(QApplication *app, int style){
|
||||
app->setStyle(new QPlastiqueStyle());
|
||||
break;
|
||||
case 2:
|
||||
app->setStyle(new QGnomeLookStyle());
|
||||
app->setStyle(new QCleanlooksStyle());
|
||||
break;
|
||||
case 3:
|
||||
app->setStyle(new QMotifStyle());
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include <QApplication>
|
||||
#include <QSettings>
|
||||
#include <QPlastiqueStyle>
|
||||
#include "qgnomelook.h"
|
||||
#include <QCleanlooksStyle>
|
||||
#include <QMotifStyle>
|
||||
#include <QCDEStyle>
|
||||
#include <QDialogButtonBox>
|
||||
@@ -222,7 +222,7 @@ void options_imp::useStyle(){
|
||||
QApplication::setStyle(new QPlastiqueStyle());
|
||||
break;
|
||||
case 2:
|
||||
QApplication::setStyle(new QGnomeLookStyle());
|
||||
QApplication::setStyle(new QCleanlooksStyle());
|
||||
break;
|
||||
case 3:
|
||||
QApplication::setStyle(new QMotifStyle());
|
||||
|
||||
@@ -693,8 +693,12 @@ bool properties::savePiecesPriorities() {
|
||||
}
|
||||
pieces_file.close();
|
||||
delete[] priorities;
|
||||
BTSession->loadFilesPriorities(h);
|
||||
// Emit a signal so that the GUI updates the size
|
||||
// If h.has_filtered_pieces() s true, then the torrent
|
||||
// is already in full allocation mode, no need to
|
||||
// reload it.
|
||||
if(hasFilteredFiles && !h.has_filtered_pieces()){
|
||||
BTSession->pauseAndReloadTorrent(h);
|
||||
}
|
||||
emit filteredFilesChanged(hash);
|
||||
has_filtered_files = hasFilteredFiles;
|
||||
return true;
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt4 and libtorrent.
|
||||
* Copyright (C) 2006 Christophe Dumez
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* Contact : chris@qbittorrent.org
|
||||
*/
|
||||
|
||||
#ifndef QGNOMELOOK
|
||||
#define QGNOMELOOK
|
||||
|
||||
#include <QCleanlooksStyle>
|
||||
#include <QStyleOption>
|
||||
#include <QStyleOptionProgressBar>
|
||||
#include <QStyleOptionProgressBarV2>
|
||||
#include <QPen>
|
||||
#include <QPainter>
|
||||
|
||||
class QGnomeLookStyle : public QCleanlooksStyle {
|
||||
public:
|
||||
QGnomeLookStyle() : QCleanlooksStyle() {}
|
||||
|
||||
void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const {
|
||||
switch(element) {
|
||||
case CE_ProgressBarLabel:
|
||||
if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
|
||||
bool vertical = false;
|
||||
if (const QStyleOptionProgressBarV2 *pb2 = qstyleoption_cast<const QStyleOptionProgressBarV2 *>(option)) {
|
||||
vertical = (pb2->orientation == Qt::Vertical);
|
||||
}
|
||||
if (!vertical) {
|
||||
QPalette::ColorRole textRole = QPalette::Dark;/*
|
||||
if ((pb->textAlignment & Qt::AlignCenter) && pb->textVisible
|
||||
&& ((qint64(pb->progress) - qint64(pb->minimum)) * 2 >= (qint64(pb->maximum) - qint64(pb->minimum)))) {
|
||||
textRole = QPalette::HighlightedText;
|
||||
//Draw text shadow, This will increase readability when the background of same color
|
||||
QRect shadowRect(pb->rect);
|
||||
shadowRect.translate(1,1);
|
||||
QColor shadowColor = (pb->palette.color(textRole).value() <= 128) ? QColor(255,255,255,160) : QColor(0,0,0,160);
|
||||
QPalette shadowPalette = pb->palette;
|
||||
shadowPalette.setColor(textRole, shadowColor);
|
||||
drawItemText(painter, shadowRect, Qt::AlignCenter | Qt::TextSingleLine, shadowPalette, pb->state, pb->text, textRole);
|
||||
}
|
||||
QPalette shadowPalette = pb->palette;
|
||||
shadowPalette.setColor(textRole, QColor(0,0,0,160));*/
|
||||
drawItemText(painter, pb->rect, Qt::AlignCenter | Qt::TextSingleLine, pb->palette, pb->state, pb->text, textRole);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
QCleanlooksStyle::drawControl(element, option, painter, widget);
|
||||
}
|
||||
}
|
||||
|
||||
QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget=0) const
|
||||
{
|
||||
QRect rect;
|
||||
switch (element) {
|
||||
#ifndef QT_NO_PROGRESSBAR
|
||||
case SE_ProgressBarLabel:
|
||||
case SE_ProgressBarContents:
|
||||
case SE_ProgressBarGroove:
|
||||
return option->rect;
|
||||
#endif // QT_NO_PROGRESSBAR
|
||||
default:
|
||||
return QCleanlooksStyle::subElementRect(element, option, widget);
|
||||
}
|
||||
|
||||
return visualRect(option->direction, option->rect, rect);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -79,9 +79,9 @@ bool QTorrentHandle::is_paused() const {
|
||||
// return h.get_torrent_info().total_size();
|
||||
// }
|
||||
|
||||
size_type QTorrentHandle::total_wanted_done() const {
|
||||
size_type QTorrentHandle::total_done() const {
|
||||
Q_ASSERT(h.is_valid());
|
||||
return h.status().total_wanted_done;
|
||||
return h.status().total_done;
|
||||
}
|
||||
|
||||
float QTorrentHandle::download_payload_rate() const {
|
||||
|
||||
@@ -59,7 +59,7 @@ class QTorrentHandle {
|
||||
bool is_paused() const;
|
||||
bool has_filtered_pieces() const;
|
||||
// size_type total_size() const;
|
||||
size_type total_wanted_done() const;
|
||||
size_type total_done() const;
|
||||
float download_payload_rate() const;
|
||||
float upload_payload_rate() const;
|
||||
int num_peers() const;
|
||||
|
||||
@@ -11,7 +11,7 @@ TARGET = qbittorrent
|
||||
CONFIG += qt thread x11 network
|
||||
|
||||
# Update this VERSION for each release
|
||||
DEFINES += VERSION=\\\"v1.0.0rc5\\\"
|
||||
DEFINES += VERSION=\\\"v1.0.0rc4\\\"
|
||||
DEFINES += VERSION_MAJOR=1
|
||||
DEFINES += VERSION_MINOR=0
|
||||
DEFINES += VERSION_BUGFIX=0
|
||||
@@ -142,7 +142,7 @@ HEADERS += GUI.h misc.h options_imp.h about_imp.h \
|
||||
allocationDlg.h FinishedListDelegate.h \
|
||||
qtorrenthandle.h downloadingTorrents.h \
|
||||
engineSelectDlg.h pluginSource.h \
|
||||
arborescence.h qgnomelook.h
|
||||
arborescence.h
|
||||
FORMS += MainWindow.ui options.ui about.ui \
|
||||
properties.ui createtorrent.ui preview.ui \
|
||||
login.ui downloadFromURL.ui addTorrentDialog.ui \
|
||||
|
||||
Reference in New Issue
Block a user