mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-30 08:24:22 +00:00
- The torrent size displayed now takes filtered files into consideration
This commit is contained in:
parent
9c83c195e3
commit
45d51e1d44
@ -12,7 +12,7 @@
|
||||
- FEATURE: Allow to set upload/download limit per torrent (right click)
|
||||
- FEATURE: Ask for exit confirmation only if download list is not empty
|
||||
- FEATURE: Better systems integration (buttons, dialogs...)
|
||||
- BUGFIX: Window can now stay maximized on exit
|
||||
- BUGFIX: The torrent size displayed now takes filtered files into consideration
|
||||
- COSMETIC: Redesigned torrent properties a little
|
||||
- COSMETIC: Redesigned options a little
|
||||
- COSMETIC: Display more logs messages concerning features
|
||||
|
1
TODO
1
TODO
@ -45,6 +45,5 @@
|
||||
- Use its piece prioritization support (debug)
|
||||
- Get upload/download limit per torrent (uncomment some code) ALMOST
|
||||
- Improve ratio display / calculation / saving / per torrent...
|
||||
- Display the sum of the size of the selected files in the torrent instead of the whole torrent size in download list
|
||||
- Sorting in Download Status column should be smarter than just an alphabetical sort
|
||||
- Windows port : http://www.peerweb.nl/qbittorrent/experimentalbuild/testing.zip
|
20
src/GUI.cpp
20
src/GUI.cpp
@ -155,6 +155,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent){
|
||||
// Configure BT session according to options
|
||||
configureSession(true);
|
||||
force_exit = false;
|
||||
connect(&BTSession, SIGNAL(updateFileSize(QString)), this, SLOT(updateFileSize(QString)));
|
||||
// Resume unfinished torrents
|
||||
BTSession.resumeUnfinishedTorrents();
|
||||
// Add torrent given on command line
|
||||
@ -959,6 +960,18 @@ void GUI::on_actionDelete_triggered(){
|
||||
}
|
||||
}
|
||||
|
||||
size_type GUI::torrentEffectiveSize(QString hash) const{
|
||||
torrent_handle h = BTSession.getTorrentHandle(hash);
|
||||
torrent_info t = h.get_torrent_info();
|
||||
unsigned short nbFiles = t.num_files();
|
||||
size_type effective_size = 0;
|
||||
for(unsigned int i=0; i<nbFiles; ++i){
|
||||
if(h.piece_priority(i) != 0)
|
||||
effective_size += t.file_at(i).size;
|
||||
}
|
||||
return effective_size;
|
||||
}
|
||||
|
||||
// Called when a torrent is added
|
||||
void GUI::torrentAdded(const QString& path, torrent_handle& h, bool fastResume){
|
||||
QString hash = QString(misc::toString(h.info_hash()).c_str());
|
||||
@ -970,7 +983,7 @@ void GUI::torrentAdded(const QString& path, torrent_handle& h, bool fastResume){
|
||||
// Adding torrent to download list
|
||||
DLListModel->insertRow(row);
|
||||
DLListModel->setData(DLListModel->index(row, NAME), QVariant(h.name().c_str()));
|
||||
DLListModel->setData(DLListModel->index(row, SIZE), QVariant((qlonglong)h.get_torrent_info().total_size()));
|
||||
DLListModel->setData(DLListModel->index(row, SIZE), QVariant((qlonglong)torrentEffectiveSize(hash)));
|
||||
DLListModel->setData(DLListModel->index(row, DLSPEED), QVariant((double)0.));
|
||||
DLListModel->setData(DLListModel->index(row, UPSPEED), QVariant((double)0.));
|
||||
DLListModel->setData(DLListModel->index(row, SEEDSLEECH), QVariant("0/0"));
|
||||
@ -1070,6 +1083,11 @@ void GUI::showProperties(const QModelIndex &index){
|
||||
prop->show();
|
||||
}
|
||||
|
||||
void GUI::updateFileSize(QString hash){
|
||||
int row = getRowFromHash(hash);
|
||||
DLListModel->setData(DLListModel->index(row, SIZE), QVariant((qlonglong)torrentEffectiveSize(hash)));
|
||||
}
|
||||
|
||||
// Set BT session configuration
|
||||
void GUI::configureSession(bool deleteOptions){
|
||||
qDebug("Configuring session");
|
||||
|
@ -126,6 +126,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
|
||||
void on_actionExit_triggered();
|
||||
void createTrayIcon();
|
||||
// Torrent actions
|
||||
size_type torrentEffectiveSize(QString hash) const;
|
||||
void showProperties(const QModelIndex &index);
|
||||
void on_actionTorrent_Properties_triggered();
|
||||
void on_actionPause_triggered();
|
||||
@ -168,6 +169,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
|
||||
void trackerError(const QString& hash, const QString& time, const QString& msg);
|
||||
void trackerAuthenticationRequired(torrent_handle& h);
|
||||
void setTabText(int index, QString text);
|
||||
void updateFileSize(QString hash);
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *);
|
||||
@ -178,7 +180,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
|
||||
GUI(QWidget *parent=0, QStringList torrentCmdLine=QStringList());
|
||||
~GUI();
|
||||
// Methods
|
||||
int getRowFromHash(const QString& name) const;
|
||||
int getRowFromHash(const QString& hash) const;
|
||||
QPoint screenCenter();
|
||||
};
|
||||
|
||||
|
@ -709,6 +709,7 @@ void bittorrent::readAlerts(){
|
||||
}
|
||||
|
||||
void bittorrent::reloadTorrent(const torrent_handle &h, bool compact_mode){
|
||||
qDebug("** Reloading a torrent");
|
||||
if(!h.is_valid()){
|
||||
qDebug("/!\\ Error: Invalid handle");
|
||||
return;
|
||||
@ -767,6 +768,7 @@ void bittorrent::reloadTorrent(const torrent_handle &h, bool compact_mode){
|
||||
qDebug("Incremental download enabled for %s", (const char*)fileName.toUtf8());
|
||||
new_h.set_sequenced_download_threshold(15);
|
||||
}
|
||||
emit updateFileSize(fileHash);
|
||||
}
|
||||
|
||||
int bittorrent::getListenPort() const{
|
||||
|
@ -151,6 +151,7 @@ class bittorrent : public QObject{
|
||||
void scanDirFoundTorrents(const QStringList& pathList);
|
||||
void newDownloadedTorrent(const QString& path, const QString& url);
|
||||
void aboutToDownloadFromUrl(const QString& url);
|
||||
void updateFileSize(QString hash);
|
||||
#ifndef NO_UPNP
|
||||
void noWanServiceDetected();
|
||||
void wanServiceDetected();
|
||||
|
@ -343,10 +343,6 @@ void properties::savePiecesPriorities(){
|
||||
pieces_file.write(QByteArray((misc::toString(priority)+"\n").c_str()));
|
||||
}
|
||||
pieces_file.close();
|
||||
if(!has_filtered_files){
|
||||
// Don't need to reload torrent
|
||||
// if already in full allocation mode
|
||||
emit changedFilteredFiles(h, !hasFilteredFiles);
|
||||
}
|
||||
emit changedFilteredFiles(h, !hasFilteredFiles);
|
||||
has_filtered_files = hasFilteredFiles;
|
||||
}
|
||||
|
@ -57,6 +57,7 @@ class properties : public QDialog, private Ui::properties{
|
||||
|
||||
signals:
|
||||
void changedFilteredFiles(torrent_handle h, bool compact_mode);
|
||||
void fileSizeChanged(QString fileHash);
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
|
Loading…
x
Reference in New Issue
Block a user