1
mirror of https://github.com/qbittorrent/qBittorrent synced 2025-10-16 20:32:23 +02:00

Compare commits

..

47 Commits

Author SHA1 Message Date
Christophe Dumez
aba88159b5 Tagged v1.5.0rc1 release 2009-08-27 03:20:05 +00:00
Christophe Dumez
382f3e3c86 - Disabled debug mode 2009-08-27 03:15:12 +00:00
Christophe Dumez
c1378450fc - Import torrents from v1.4.x (or earlier) in order not to lose them when updating 2009-08-27 03:13:39 +00:00
Christophe Dumez
4e10a8dbf7 rc1 bump & disabling debug 2009-08-27 02:24:20 +00:00
Christophe Dumez
4f7b4c2a55 - Fix last commit 2009-08-27 02:23:17 +00:00
Christophe Dumez
f98f076335 Updated Russian translation 2009-08-27 02:22:50 +00:00
Christophe Dumez
b148a93a8f - Can now create trackerless torrents 2009-08-27 02:15:47 +00:00
Christophe Dumez
37cf23fe33 - Updated Simplified Chinese translation 2009-08-26 14:33:08 +00:00
Christophe Dumez
87f43123c6 - Update news list when a feed is updated and Unread items are displayed 2009-08-26 12:26:43 +00:00
Christophe Dumez
11dd2d81b8 - Updated french translation 2009-08-26 06:23:13 +00:00
Christophe Dumez
d18d07efed - Updated language files 2009-08-26 06:13:37 +00:00
Christophe Dumez
518a120c07 - Bump to beta4 2009-08-26 06:03:04 +00:00
Christophe Dumez
290bc8b7a6 - Support category-based requests in piratebay search plugin 2009-08-26 06:02:17 +00:00
Christophe Dumez
0ede09efb5 - Updated sorting code for seeding list too 2009-08-26 05:46:15 +00:00
Christophe Dumez
15de12f6dd - Several fixes due to new column sorting code 2009-08-26 05:26:43 +00:00
Christophe Dumez
ef95d6df81 - Code cleanup 2009-08-26 05:09:25 +00:00
Christophe Dumez
f382ba4fd0 - Column sorting fixes 2009-08-26 04:17:05 +00:00
Christophe Dumez
01d504d992 - BUGFIX: Greatly improved column sorting code (download list only for now) 2009-08-26 03:50:20 +00:00
Christophe Dumez
cdd894a6a1 - Completed French translation 2009-08-25 10:02:17 +00:00
Christophe Dumez
d7b2d3497f - Some cosmetic changes 2009-08-25 09:34:50 +00:00
Christophe Dumez
5dbd5c4326 - Updated language files 2009-08-25 09:26:11 +00:00
Christophe Dumez
9a14c4c599 - FEATURE: A random listening port can be chosen automatically 2009-08-25 09:19:02 +00:00
Christophe Dumez
3fa14cd47f - Category support for isohunt engine 2009-08-25 03:09:22 +00:00
Christophe Dumez
941d9b9bd9 - Fixed BTJunkie search engine
- Category support for TorrentReactor engine
2009-08-25 03:01:39 +00:00
Christophe Dumez
3d88b7b05c - Category-based search support for BTJunkie engine 2009-08-25 02:45:39 +00:00
Christophe Dumez
8d39e2a776 - Category combobox is now updated when search engines are enabled/disabled 2009-08-25 02:37:11 +00:00
Christophe Dumez
4a1c8a7279 - Search engine now supports category-based requests (only Mininova engine for now but the rest is coming soon)
- Updated "buy it" icon
2009-08-25 02:31:36 +00:00
Christophe Dumez
b8d8862562 - Redesigned search tab to improve usability
- Started work on categorized searching but not yet functional
2009-08-24 10:18:11 +00:00
Christophe Dumez
40e9105ee5 - Make sure Unread item is updated whenever a feed is updated 2009-08-24 09:47:13 +00:00
Christophe Dumez
0984b8b8e1 - Cannot drop a feed into "Unread" item 2009-08-24 08:20:09 +00:00
Christophe Dumez
3dd7dcc58f - Fix "add new feed subscription" when selecting a feed 2009-08-24 08:17:45 +00:00
Christophe Dumez
6ba5df3ec8 - Fix "Refresh selected stream" when Unread item is selected 2009-08-24 08:12:42 +00:00
Christophe Dumez
1560b4ca3b - Copy Feed URL no longer works on Folders 2009-08-24 08:05:54 +00:00
Christophe Dumez
68d8a9ed47 - Fix "add new Feed" when no item is selected (or Unread item is selected) 2009-08-24 08:03:28 +00:00
Christophe Dumez
ca00f3084d - "add new Feed" when clicking on "Unread" item will not add the new feed as a child to "Unread" item 2009-08-24 07:57:56 +00:00
Christophe Dumez
39c16b20ae - Resized edit-find icon for better quality 2009-08-24 07:46:54 +00:00
Christophe Dumez
666d4622b9 - Updated language files
- Updated search icon
2009-08-24 06:52:50 +00:00
Christophe Dumez
27388643b1 - Updated Changelog 2009-08-24 06:43:47 +00:00
Christophe Dumez
90d17d16a4 - Fix "Unread" name disapearing when marking items read 2009-08-24 06:35:15 +00:00
Christophe Dumez
df0f01cd71 - Fix "Unread" name disapearing on update 2009-08-24 06:31:11 +00:00
Christophe Dumez
480d00d747 - Display "Unread" item in RSS Feed list which displays all unread items 2009-08-24 06:28:31 +00:00
Christophe Dumez
a0923741a4 - Make sure items are not overwriten when drag 'n dropping items in RSS feed list 2009-08-24 04:01:26 +00:00
Christophe Dumez
8e2efc2950 - Fix bad ASSERT
- Bump to beta3
2009-08-24 03:49:29 +00:00
Christophe Dumez
91dee6058e - Safer temporary filename generation: create the temporary file to make sure the name is not generated twice 2009-08-24 03:38:31 +00:00
Christophe Dumez
f5c1343722 Updated language files 2009-08-24 03:16:08 +00:00
Christophe Dumez
d4d0a08390 - Make sure priority column stays sorted when changing torrents priority (closes #417829) 2009-08-24 03:03:06 +00:00
Christophe Dumez
d02aca7323 - Fixed possible crash when moving a feed from one folder to another 2009-08-23 15:18:29 +00:00
100 changed files with 10687 additions and 6727 deletions

View File

@@ -1,5 +1,6 @@
* Unknown - Christophe Dumez <chris@qbittorrent.org> - v1.5.0
- FEATURE: Added Magnet URI support
- FEATURE: Search engine supports category-based requests
- FEATURE: Make use of torrent enclosure in RSS feeds for direct download
- FEATURE: Implemented a RSS feed downloader with filter support
- FEATURE: Save old RSS item to hard disk to remember them on start up
@@ -7,8 +8,13 @@
- FEATURE: In torrent addition from URL, paste clipboard content if it contains an URL
- FEATURE: RSS feeds URLs can now be copied to clipboard
- FEATURE: RSS feeds can now be grouped into folders
- FEATURE: Added "Unread" item to RSS feed list to display all unread news
- FEATURE: If a torrent contains a torrent file, process downloaded torrent file too
- FEATURE: A random listening port can be chosen automatically
- BUGFIX: torrent resume code rewrited
- BUGFIX: Greatly improved column sorting code
- BUGFIX: Possibility to create trackerless torrents
- COSMETIC: Redesigned search tab to improve usability
- COSMETIC: Redesigned RSS tab to improve usability
* Sun Aug 21 2009 - Christophe Dumez <chris@qbittorrent.org> - v1.4.1

View File

@@ -38,6 +38,7 @@
#include <QFile>
#include <QSettings>
#include <QStandardItemModel>
#include <QSortFilterProxyModel>
#include <QHeaderView>
#include <QMenu>
#include <QMessageBox>
@@ -54,9 +55,16 @@ FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession) : par
finishedListModel->setHeaderData(F_PEERS, Qt::Horizontal, tr("Connected peers"));
finishedListModel->setHeaderData(F_UPLOAD, Qt::Horizontal, tr("Total uploaded", "i.e: Total amount of uploaded data"));
finishedListModel->setHeaderData(F_RATIO, Qt::Horizontal, tr("Ratio"));
finishedList->setModel(finishedListModel);
proxyModel = new QSortFilterProxyModel();
proxyModel->setDynamicSortFilter(true);
proxyModel->setSourceModel(finishedListModel);
finishedList->setModel(proxyModel);
finishedList->setRootIsDecorated(false);
finishedList->setAllColumnsShowFocus(true);
finishedList->setSortingEnabled(true);
loadHiddenColumns();
// Hide hash column
finishedList->hideColumn(F_HASH);
@@ -104,9 +112,11 @@ FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession) : par
}
FinishedTorrents::~FinishedTorrents(){
saveLastSortedColumn();
saveColWidthFinishedList();
saveHiddenColumns();
delete finishedListDelegate;
delete proxyModel;
delete finishedListModel;
}
@@ -141,8 +151,8 @@ void FinishedTorrents::addTorrent(QString hash){
// Update the number of finished torrents
++nbFinished;
emit finishedTorrentsNumberChanged(nbFinished);
// Sort List
sortFinishedList();
loadLastSortedColumn();
}
// Set the color of a row in data model
@@ -159,7 +169,7 @@ QStringList FinishedTorrents::getSelectedTorrents(bool only_one) const{
foreach(const QModelIndex &index, selectedIndexes) {
if(index.column() == F_NAME) {
// Get the file hash
QString hash = finishedListModel->data(finishedListModel->index(index.row(), F_HASH)).toString();
QString hash = getHashFromRow(index.row());
res << hash;
if(only_one) break;
}
@@ -208,6 +218,18 @@ bool FinishedTorrents::loadColWidthFinishedList(){
return true;
}
void FinishedTorrents::saveLastSortedColumn() {
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
Qt::SortOrder sortOrder = finishedList->header()->sortIndicatorOrder();
QString sortOrderLetter;
if(sortOrder == Qt::AscendingOrder)
sortOrderLetter = QString::fromUtf8("a");
else
sortOrderLetter = QString::fromUtf8("d");
int index = finishedList->header()->sortIndicatorSection();
settings.setValue(QString::fromUtf8("FinishedListSortedCol"), misc::toQString(index)+sortOrderLetter);
}
void FinishedTorrents::loadLastSortedColumn() {
// Loading last sorted column
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
@@ -220,7 +242,7 @@ void FinishedTorrents::loadLastSortedColumn() {
sortOrder = Qt::AscendingOrder;
sortedCol = sortedCol.left(sortedCol.size()-1);
int index = sortedCol.toInt();
sortFinishedList(index, sortOrder);
finishedList->sortByColumn(index, sortOrder);
}
}
@@ -265,7 +287,7 @@ void FinishedTorrents::on_actionSet_upload_limit_triggered(){
foreach(const QModelIndex &index, selectedIndexes){
if(index.column() == F_NAME){
// Get the file hash
hashes << finishedListModel->data(finishedListModel->index(index.row(), F_HASH)).toString();
hashes << getHashFromRow(index.row());
}
}
new BandwidthAllocationDialog(this, true, BTSession, hashes);
@@ -351,8 +373,8 @@ void FinishedTorrents::pauseTorrent(QString hash) {
}
QString FinishedTorrents::getHashFromRow(unsigned int row) const {
Q_ASSERT(row < (unsigned int)finishedListModel->rowCount());
return finishedListModel->data(finishedListModel->index(row, F_HASH)).toString();
Q_ASSERT(row < (unsigned int)proxyModel->rowCount());
return proxyModel->data(proxyModel->index(row, F_HASH)).toString();
}
// Will move it to download tab
@@ -369,7 +391,7 @@ void FinishedTorrents::deleteTorrent(QString hash){
// Show torrent properties dialog
void FinishedTorrents::showProperties(const QModelIndex &index){
showPropertiesFromHash(finishedListModel->data(finishedListModel->index(index.row(), F_HASH)).toString());
showPropertiesFromHash(getHashFromRow(index.row()));
}
void FinishedTorrents::showPropertiesFromHash(QString hash){
@@ -400,7 +422,7 @@ void FinishedTorrents::forceRecheck(){
QModelIndexList selectedIndexes = finishedList->selectionModel()->selectedIndexes();
foreach(const QModelIndex &index, selectedIndexes){
if(index.column() == F_NAME){
QString hash = finishedListModel->data(finishedListModel->index(index.row(), F_HASH)).toString();
QString hash = getHashFromRow(index.row());
QTorrentHandle h = BTSession->getTorrentHandle(hash);
qDebug("Forcing recheck for torrent %s", hash.toLocal8Bit().data());
h.force_recheck();
@@ -416,7 +438,7 @@ void FinishedTorrents::displayFinishedListMenu(const QPoint&){
foreach(const QModelIndex &index, selectedIndexes) {
if(index.column() == F_NAME) {
// Get the file name
QString hash = finishedListModel->data(finishedListModel->index(index.row(), F_HASH)).toString();
QString hash = getHashFromRow(index.row());
// Get handle and pause the torrent
QTorrentHandle h = BTSession->getTorrentHandle(hash);
if(!h.is_valid()) continue;
@@ -462,7 +484,7 @@ void FinishedTorrents::displayFinishedListMenu(const QPoint&){
*/
// hide/show columns menu
void FinishedTorrents::displayFinishedHoSMenu(const QPoint& pos){
void FinishedTorrents::displayFinishedHoSMenu(const QPoint&){
QMenu hideshowColumn(this);
hideshowColumn.setTitle(tr("Hide or Show Column"));
int lastCol = F_RATIO;
@@ -470,7 +492,7 @@ void FinishedTorrents::displayFinishedHoSMenu(const QPoint& pos){
hideshowColumn.addAction(getActionHoSCol(i));
}
// Call menu
hideshowColumn.exec(mapToGlobal(pos)+QPoint(10,34));
hideshowColumn.exec(QCursor::pos());
}
// toggle hide/show a column
@@ -603,97 +625,3 @@ QAction* FinishedTorrents::getActionHoSCol(int index) {
return NULL;
}
}
/*
* Sorting functions
*/
void FinishedTorrents::toggleFinishedListSortOrder(int index) {
Qt::SortOrder sortOrder = Qt::AscendingOrder;
if(finishedList->header()->sortIndicatorSection() == index){
sortOrder = (Qt::SortOrder)!(bool)finishedList->header()->sortIndicatorOrder();
}
switch(index) {
case F_SIZE:
case F_UPSPEED:
case F_RATIO:
case F_UPLOAD:
sortFinishedListFloat(index, sortOrder);
break;
default:
sortFinishedListString(index, sortOrder);
}
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QString sortOrderLetter;
if(sortOrder == Qt::AscendingOrder)
sortOrderLetter = QString::fromUtf8("a");
else
sortOrderLetter = QString::fromUtf8("d");
settings.setValue(QString::fromUtf8("FinishedListSortedCol"), misc::toQString(index)+sortOrderLetter);
}
void FinishedTorrents::sortFinishedList(int index, Qt::SortOrder sortOrder){
if(index == -1) {
index = finishedList->header()->sortIndicatorSection();
sortOrder = finishedList->header()->sortIndicatorOrder();
} else {
finishedList->header()->setSortIndicator(index, sortOrder);
}
switch(index) {
case F_SIZE:
case F_UPSPEED:
case F_UPLOAD:
case F_RATIO:
sortFinishedListFloat(index, sortOrder);
break;
default:
sortFinishedListString(index, sortOrder);
}
}
void FinishedTorrents::sortFinishedListFloat(int index, Qt::SortOrder sortOrder){
QList<QPair<int, double> > lines;
// insertion sorting
unsigned int nbRows = finishedListModel->rowCount();
for(unsigned int i=0; i<nbRows; ++i){
misc::insertSort(lines, QPair<int,double>(i, finishedListModel->data(finishedListModel->index(i, index)).toDouble()), sortOrder);
}
// Insert items in new model, in correct order
unsigned int nbRows_old = lines.size();
for(unsigned int row=0; row<nbRows_old; ++row){
finishedListModel->insertRow(finishedListModel->rowCount());
unsigned int sourceRow = lines[row].first;
unsigned int nbColumns = finishedListModel->columnCount();
for(unsigned int col=0; col<nbColumns; ++col){
finishedListModel->setData(finishedListModel->index(nbRows_old+row, col), finishedListModel->data(finishedListModel->index(sourceRow, col)));
finishedListModel->setData(finishedListModel->index(nbRows_old+row, col), finishedListModel->data(finishedListModel->index(sourceRow, col), Qt::DecorationRole), Qt::DecorationRole);
finishedListModel->setData(finishedListModel->index(nbRows_old+row, col), finishedListModel->data(finishedListModel->index(sourceRow, col), Qt::ForegroundRole), Qt::ForegroundRole);
}
}
// Remove old rows
finishedListModel->removeRows(0, nbRows_old);
}
void FinishedTorrents::sortFinishedListString(int index, Qt::SortOrder sortOrder){
QList<QPair<int, QString> > lines;
// Insertion sorting
unsigned int nbRows = finishedListModel->rowCount();
for(unsigned int i=0; i<nbRows; ++i){
misc::insertSortString(lines, QPair<int, QString>(i, finishedListModel->data(finishedListModel->index(i, index)).toString()), sortOrder);
}
// Insert items in new model, in correct order
unsigned int nbRows_old = lines.size();
for(unsigned int row=0; row<nbRows_old; ++row){
finishedListModel->insertRow(finishedListModel->rowCount());
unsigned int sourceRow = lines[row].first;
unsigned int nbColumns = finishedListModel->columnCount();
for(unsigned int col=0; col<nbColumns; ++col){
finishedListModel->setData(finishedListModel->index(nbRows_old+row, col), finishedListModel->data(finishedListModel->index(sourceRow, col)));
finishedListModel->setData(finishedListModel->index(nbRows_old+row, col), finishedListModel->data(finishedListModel->index(sourceRow, col), Qt::DecorationRole), Qt::DecorationRole);
finishedListModel->setData(finishedListModel->index(nbRows_old+row, col), finishedListModel->data(finishedListModel->index(sourceRow, col), Qt::ForegroundRole), Qt::ForegroundRole);
}
}
// Remove old rows
finishedListModel->removeRows(0, nbRows_old);
}

View File

@@ -35,6 +35,7 @@
#include "qtorrenthandle.h"
class QStandardItemModel;
class QSortFilterProxyModel;
class bittorrent;
class FinishedListDelegate;
@@ -47,6 +48,7 @@ class FinishedTorrents : public QWidget, public Ui::seeding {
bittorrent *BTSession;
FinishedListDelegate *finishedListDelegate;
QStandardItemModel *finishedListModel;
QSortFilterProxyModel *proxyModel;
unsigned int nbFinished;
void hideOrShowColumn(int index);
bool loadHiddenColumns();
@@ -69,10 +71,6 @@ class FinishedTorrents : public QWidget, public Ui::seeding {
void displayFinishedHoSMenu(const QPoint&);
void setRowColor(int row, QString color);
void saveColWidthFinishedList() const;
void toggleFinishedListSortOrder(int index);
void sortFinishedList(int index=-1, Qt::SortOrder sortOrder=Qt::AscendingOrder);
void sortFinishedListFloat(int index, Qt::SortOrder sortOrder);
void sortFinishedListString(int index, Qt::SortOrder sortOrder);
void updateFileSize(QString hash);
void on_actionSet_upload_limit_triggered();
void notifyTorrentDoubleClicked(const QModelIndex& index);
@@ -93,6 +91,7 @@ class FinishedTorrents : public QWidget, public Ui::seeding {
void deleteTorrent(QString hash);
void showPropertiesFromHash(QString hash);
void loadLastSortedColumn();
void saveLastSortedColumn();
void updateMetadata(QTorrentHandle &h);
signals:

View File

@@ -163,7 +163,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
// Search engine tab
searchEngine = new SearchEngine(BTSession, myTrayIcon, systrayIntegration);
tabs->addTab(searchEngine, tr("Search"));
tabs->setTabIcon(2, QIcon(QString::fromUtf8(":/Icons/skin/search.png")));
tabs->setTabIcon(2, QIcon(QString::fromUtf8(":/Icons/oxygen/edit-find.png")));
readSettings();
// RSS Tab
rssWidget = 0;
@@ -1027,7 +1027,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
// Connection
// * Ports binding
unsigned short old_listenPort = BTSession->getListenPort();
BTSession->setListeningPortsRange(options->getPorts());
BTSession->setListeningPort(options->getPort());
unsigned short new_listenPort = BTSession->getListenPort();
if(new_listenPort != old_listenPort) {
BTSession->addConsoleMessage(tr("qBittorrent is bound to port: TCP/%1", "e.g: qBittorrent is bound to port: 6881").arg( misc::toQString(new_listenPort)));

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 813 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 627 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 739 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
src/Icons/oxygen/wallet.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -60,7 +60,7 @@ bittorrent::bittorrent() : DHTEnabled(false), preAllocateAll(false), addInPause(
// To avoid some exceptions
fs::path::default_name_check(fs::no_check);
// Creating bittorrent session
// Check if we should spoof azureus
// Check if we should spoof utorrent
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
if(settings.value(QString::fromUtf8("AzureusSpoof"), false).toBool()) {
s = new session(fingerprint("UT", 1, 8, 3, 0), 0);
@@ -574,6 +574,11 @@ QTorrentHandle bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
} else {
p.save_path = defaultTempPath.toLocal8Bit().data();
}
// TODO: Remove in v1.6.0: For backward compatibility only
if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".finished")) {
p.save_path = savePath.toLocal8Bit().data();
QFile::remove(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".finished");
}
p.ti = t;
// Preallocate all?
if(preAllocateAll)
@@ -659,6 +664,117 @@ QTorrentHandle bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
return h;
}
// Import torrents temp data from v1.4.0 or earlier: save_path, filtered pieces
// TODO: Remove in qBittorrent v1.6.0
void bittorrent::importOldTempData(QString torrent_path) {
// Create torrent hash
boost::intrusive_ptr<torrent_info> t;
try {
t = new torrent_info(torrent_path.toLocal8Bit().data());
QString hash = misc::toQString(t->info_hash());
// Load save path
QFile savepath_file(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".savepath");
QByteArray line;
QString savePath;
if(savepath_file.open(QIODevice::ReadOnly | QIODevice::Text)) {
line = savepath_file.readAll();
savepath_file.close();
qDebug(" -> Save path: %s", line.data());
savePath = QString::fromUtf8(line.data());
qDebug("Imported the following save path: %s", savePath.toLocal8Bit().data());
TorrentTempData::setSavePath(hash, savePath);
// Clean up
savepath_file.remove();
}
// Load pieces priority
QFile pieces_file(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".priorities");
if(pieces_file.exists()){
// Read saved file
if(pieces_file.open(QIODevice::ReadOnly | QIODevice::Text)) {
QByteArray pieces_priorities = pieces_file.readAll();
pieces_file.close();
QList<QByteArray> pieces_priorities_list = pieces_priorities.split('\n');
std::vector<int> pp;
for(int i=0; i<t->num_files(); ++i) {
int priority = pieces_priorities_list.at(i).toInt();
if( priority < 0 || priority > 7) {
priority = 1;
}
qDebug("Setting piece piority to %d", priority);
pp.push_back(priority);
}
TorrentTempData::setFilesPriority(hash, pp);
qDebug("Successfuly imported pieces_priority");
}
// Clean up
pieces_file.remove();
}
// Load sequential
if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".incremental")) {
qDebug("Imported torrent was sequential");
TorrentTempData::setSequential(hash, true);
// Cleanup
QFile::remove(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".incremental");
}
} catch(std::exception&) {
}
}
// Import torrents from v1.4.0 or earlier
// TODO: Remove in qBittorrent v1.6.0
void bittorrent::importOldTorrents() {
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
if(!settings.value("v1_4_x_torrent_imported", false).toBool()) {
// Import old torrent
QDir torrentBackup(misc::qBittorrentPath() + "BT_backup");
QStringList fileNames;
QStringList filters;
filters << "*.torrent";
fileNames = torrentBackup.entryList(filters, QDir::Files, QDir::Unsorted);
if(isQueueingEnabled()) {
QList<QPair<int, QString> > filePaths;
foreach(const QString &fileName, fileNames) {
QString filePath = torrentBackup.path()+QDir::separator()+fileName;
int prio = 99999;
// Get priority
QString prioPath = filePath;
prioPath.replace(".torrent", ".prio");
if(QFile::exists(prioPath)) {
QFile prio_file(prioPath);
if(prio_file.open(QIODevice::ReadOnly | QIODevice::Text)) {
bool ok = false;
prio = prio_file.readAll().toInt(&ok);
if(!ok)
prio = 99999;
prio_file.close();
// Clean up
prio_file.remove();
}
}
misc::insertSort2<QString>(filePaths, qMakePair(prio, filePath));
}
// Resume downloads
QPair<int, QString> fileName;
foreach(fileName, filePaths) {
importOldTempData(fileName.second);
addTorrent(fileName.second, false, QString(), true);
}
} else {
QStringList filePaths;
foreach(const QString &fileName, fileNames) {
filePaths.append(torrentBackup.path()+QDir::separator()+fileName);
}
// Resume downloads
foreach(const QString &fileName, filePaths) {
importOldTempData(fileName);
addTorrent(fileName, false, QString(), true);
}
}
settings.setValue("v1_4_x_torrent_imported", true);
std::cout << "Successfully imported torrents from v1.4.x (or previous) instance" << std::endl;
}
}
// Check if the user filtered files in this torrent.
bool bittorrent::has_filtered_files(QString hash) const{
QVariantList files_priority = TorrentPersistentData::getFilesPriority(hash);
@@ -1084,7 +1200,8 @@ void bittorrent::disableDirectoryScanning() {
// Set the ports range in which is chosen the port the bittorrent
// session will listen to
void bittorrent::setListeningPortsRange(std::pair<unsigned short, unsigned short> ports) {
void bittorrent::setListeningPort(int port) {
std::pair<int,int> ports(port, port);
s->listen_on(ports);
}
@@ -1514,6 +1631,12 @@ void bittorrent::startUpTorrents() {
QDir torrentBackup(misc::qBittorrentPath() + "BT_backup");
QStringList fileNames;
QStringList known_torrents = TorrentPersistentData::knownTorrents();
if(known_torrents.empty()) {
qDebug("No known torrent, importing old torrents");
importOldTorrents();
return;
}
qDebug("Starting up torrents");
if(isQueueingEnabled()) {
QList<QPair<int, QString> > hashes;
foreach(const QString &hash, known_torrents) {

View File

@@ -114,6 +114,8 @@ class bittorrent : public QObject {
public slots:
QTorrentHandle addTorrent(QString path, bool fromScanDir = false, QString from_url = QString(), bool resumed = false);
QTorrentHandle addMagnetUri(QString magnet_uri, bool resumed=false);
void importOldTorrents();
void importOldTempData(QString torrent_path);
void loadSessionState();
void saveSessionState();
void downloadFromUrl(QString url);
@@ -141,7 +143,7 @@ class bittorrent : public QObject {
void decreaseDlTorrentPriority(QString hash);
void downloadUrlAndSkipDialog(QString url, QString save_path=QString::null);
// Session configuration - Setters
void setListeningPortsRange(std::pair<unsigned short, unsigned short> ports);
void setListeningPort(int port);
void setMaxConnections(int maxConnec);
void setMaxConnectionsPerTorrent(int max);
void setMaxUploadsPerTorrent(int max);

View File

@@ -166,10 +166,10 @@ void createtorrent::on_createButton_clicked(){
return;
}
QStringList trackers = allItems(trackers_list);
if(!trackers.size()){
/*if(!trackers.size()){
QMessageBox::critical(0, tr("No tracker path set"), tr("Please set at least one tracker"));
return;
}
}*/
QString destination = QFileDialog::getSaveFileName(this, tr("Select destination torrent file"), QDir::homePath(), tr("Torrent Files")+QString::fromUtf8(" (*.torrent)"));
if(!destination.isEmpty()) {
if(!destination.endsWith(QString::fromUtf8(".torrent")))

View File

@@ -142,7 +142,7 @@
<action name="actionBuy_it">
<property name="icon">
<iconset resource="icons.qrc">
<normaloff>:/Icons/money.png</normaloff>:/Icons/money.png</iconset>
<normaloff>:/Icons/oxygen/wallet.png</normaloff>:/Icons/oxygen/wallet.png</iconset>
</property>
<property name="text">
<string>Buy it</string>

View File

@@ -77,13 +77,20 @@ subDownloadThread::~subDownloadThread(){
}
void subDownloadThread::run(){
// XXX: Trick to get a unique filename
// Get a unique filename
QString filePath;
QTemporaryFile *tmpfile = new QTemporaryFile();
if (tmpfile->open()) {
filePath = tmpfile->fileName();
QTemporaryFile tmpfile;
tmpfile.setAutoRemove(false);
if (tmpfile.open()) {
filePath = tmpfile.fileName();
qDebug("Temporary filename is: %s", filePath.toLocal8Bit().data());
} else {
emit downloadFailureST(this, url, tr("I/O Error"));
return;
}
delete tmpfile;
tmpfile.close();
// Now temporary file is created but closed so that
// curl can use it
FILE *f = fopen(filePath.toLocal8Bit().data(), "wb");
if(!f) {
std::cerr << "couldn't open destination file" << "\n";

File diff suppressed because it is too large Load Diff

View File

@@ -37,6 +37,7 @@
class QStandardItemModel;
class bittorrent;
class DLListDelegate;
class QSortFilterProxyModel;
using namespace libtorrent;
@@ -47,6 +48,7 @@ class DownloadingTorrents : public QWidget, public Ui::downloading{
bittorrent *BTSession;
DLListDelegate *DLDelegate;
QStandardItemModel *DLListModel;
QSortFilterProxyModel *proxyModel;
unsigned int nbTorrents;
void hideOrShowColumn(int index);
bool loadHiddenColumns();
@@ -74,10 +76,6 @@ class DownloadingTorrents : public QWidget, public Ui::downloading{
void on_actionSet_upload_limit_triggered();
void displayDLListMenu(const QPoint& pos);
void displayDLHoSMenu(const QPoint&);
void sortDownloadList(int index=-1, Qt::SortOrder startSortOrder=Qt::AscendingOrder);
void toggleDownloadListSortOrder(int index);
void sortDownloadListFloat(int index, Qt::SortOrder sortOrder);
void sortDownloadListString(int index, Qt::SortOrder sortOrder);
void saveColWidthDLList() const;
void setRowColor(int row, QColor color);
void showProperties(const QModelIndex &index);
@@ -100,7 +98,7 @@ class DownloadingTorrents : public QWidget, public Ui::downloading{
void updateFileSizeAndProgress(QString hash);
void showPropertiesFromHash(QString hash);
void hidePriorityColumn(bool hide);
void sortProgressColumn(QTorrentHandle& h);
void saveLastSortedColumn();
void loadLastSortedColumn();
void addTorrent(QString hash);
void updateMetadata(QTorrentHandle &h);

File diff suppressed because it is too large Load Diff

View File

@@ -32,6 +32,7 @@
#define ENGINE_SELECT_DLG_H
#include "ui_engineSelect.h"
#include "supportedEngines.h"
class downloadThread;
class QDropEvent;
@@ -40,12 +41,11 @@ class engineSelectDlg : public QDialog, public Ui::engineSelect{
Q_OBJECT
private:
// Search related
QHash<QString, bool> installed_engines;
downloadThread *downloader;
SupportedEngines *supported_engines;
public:
engineSelectDlg(QWidget *parent);
engineSelectDlg(QWidget *parent, SupportedEngines *supported_engines);
~engineSelectDlg();
QList<QTreeWidgetItem*> findItemsWithUrl(QString url);
QTreeWidgetItem* findItemWithID(QString id);
@@ -53,15 +53,14 @@ class engineSelectDlg : public QDialog, public Ui::engineSelect{
protected:
bool parseVersionsFile(QString versions_file, QString updateServer);
bool isUpdateNeeded(QString plugin_name, float new_version) const;
bool checkInstalled(QString plugin_name) const;
signals:
void enginesChanged();
protected slots:
void saveSettings();
void on_closeButton_clicked();
void loadSupportedSearchEngines(bool first=false);
void loadSupportedSearchEngines();
void addNewEngine(QString engine_name);
void toggleEngineState(QTreeWidgetItem*, int);
void setRowColor(int row, QString color);
void processDownloadedFile(QString url, QString filePath);

View File

@@ -18,6 +18,7 @@ private:
QHash<QTreeWidgetItem*, RssFile*> mapping;
QHash<QString, QTreeWidgetItem*> feeds_items;
QTreeWidgetItem* current_feed;
QTreeWidgetItem *unread_item;
public:
FeedList(QWidget *parent, RssManager *rssmanager): QTreeWidget(parent), rssmanager(rssmanager) {
@@ -28,14 +29,17 @@ public:
QTreeWidgetItem *___qtreewidgetitem = headerItem();
___qtreewidgetitem->setText(0, QApplication::translate("RSS", "RSS feeds", 0, QApplication::UnicodeUTF8));
connect(this, SIGNAL(currentItemChanged(QTreeWidgetItem*,QTreeWidgetItem*)), this, SLOT(updateCurrentFeed(QTreeWidgetItem*)));
unread_item = new QTreeWidgetItem(this);
unread_item->setText(0, tr("Unread") + QString::fromUtf8(" (") + QString::number(rssmanager->getNbUnRead(), 10)+ QString(")"));
unread_item->setData(0,Qt::DecorationRole, QVariant(QIcon(":/Icons/oxygen/mail-folder-inbox.png")));
itemAdded(unread_item, rssmanager);
setCurrentItem(unread_item);
}
void itemAdded(QTreeWidgetItem *item, RssFile* file) {
mapping[item] = file;
if(file->getType() == RssFile::STREAM) {
feeds_items[file->getID()] = item;
if(topLevelItemCount() == 1)
setCurrentItem(item);
}
}
@@ -45,15 +49,19 @@ public:
feeds_items.remove(file->getID());
}
bool hasFeed(QString url) {
bool hasFeed(QString url) const {
return feeds_items.contains(QUrl(url).toString());
}
QList<QTreeWidgetItem*> getAllFeedItems() {
QList<QTreeWidgetItem*> getAllFeedItems() const {
return feeds_items.values();
}
QStringList getItemPath(QTreeWidgetItem* item) {
QTreeWidgetItem* getUnreadItem() const {
return unread_item;
}
QStringList getItemPath(QTreeWidgetItem* item) const {
QStringList path;
if(item) {
if(item->parent())
@@ -63,7 +71,7 @@ public:
return path;
}
QList<QTreeWidgetItem*> getAllOpenFolders(QTreeWidgetItem *parent=0) {
QList<QTreeWidgetItem*> getAllOpenFolders(QTreeWidgetItem *parent=0) const {
QList<QTreeWidgetItem*> open_folders;
int nbChildren;
if(parent)
@@ -102,19 +110,15 @@ public:
return feeds;
}
RssFile* getRSSItem(QTreeWidgetItem *item) {
RssFile* getRSSItem(QTreeWidgetItem *item) const {
return mapping[item];
}
RssFile* getCurrentRSSItem() {
return mapping[current_feed];
}
RssFile::FileType getItemType(QTreeWidgetItem *item) {
RssFile::FileType getItemType(QTreeWidgetItem *item) const {
return mapping[item]->getType();
}
QString getItemID(QTreeWidgetItem *item) {
QString getItemID(QTreeWidgetItem *item) const {
return mapping[item]->getID();
}
@@ -122,6 +126,10 @@ public:
return feeds_items[url];
}
RssStream* getRSSItemFromUrl(QString url) const {
return (RssStream*)getRSSItem(getTreeItemFromUrl(url));
}
QTreeWidgetItem* currentItem() const {
return current_feed;
}
@@ -132,20 +140,29 @@ public:
signals:
void foldersAltered(QList<QTreeWidgetItem*> folders);
void overwriteAttempt(QString filename);
protected slots:
void updateCurrentFeed(QTreeWidgetItem* new_item) {
if(getItemType(new_item) == RssFile::STREAM)
if((new_item && getItemType(new_item) == RssFile::STREAM) || new_item == unread_item)
current_feed = new_item;
}
protected:
void dragMoveEvent(QDragMoveEvent * event) {
QTreeWidgetItem *item = itemAt(event->pos());
if(item && getItemType(item) != RssFile::FOLDER)
if(item == unread_item) {
event->ignore();
else {
QTreeWidget::dragMoveEvent(event);
} else {
if(item && getItemType(item) != RssFile::FOLDER)
event->ignore();
else {
if(selectedItems().contains(unread_item)) {
event->ignore();
} else {
QTreeWidget::dragMoveEvent(event);
}
}
}
}
@@ -161,6 +178,15 @@ protected:
dest_folder = rssmanager;
}
QList<QTreeWidgetItem *> src_items = selectedItems();
// Check if there is not going to overwrite another file
foreach(QTreeWidgetItem *src_item, src_items) {
RssFile *file = getRSSItem(src_item);
if(dest_folder->hasChild(file->getID())) {
emit overwriteAttempt(file->getID());
return;
}
}
// Proceed with the move
foreach(QTreeWidgetItem *src_item, src_items) {
QTreeWidgetItem *parent_folder = src_item->parent();
if(parent_folder && !folders_altered.contains(parent_folder))

View File

@@ -200,14 +200,19 @@ void HttpConnection::respondCommand(QString command)
if(command == "upload")
{
QByteArray torrentfile = parser.torrent();
// XXX: Trick to get a unique filename
// Get a unique filename
QString filePath;
QTemporaryFile *tmpfile = new QTemporaryFile();
if (tmpfile->open()) {
filePath = tmpfile->fileName();
QTemporaryFile tmpfile;
tmpfile.setAutoRemove(false);
if (tmpfile.open()) {
filePath = tmpfile.fileName();
} else {
std::cerr << "I/O Error: Could not create temporary file" << std::endl;
return;
}
delete tmpfile;
// write it to HD
tmpfile.close();
// Now temporary file is created but closed so that it can be used.
// write torrent to temporary file
QFile torrent(filePath);
if(torrent.open(QIODevice::WriteOnly)) {
torrent.write(torrentfile);

View File

@@ -1,8 +1,6 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file>Icons/gnome-shutdown.png</file>
<file>Icons/rss32.png</file>
<file>Icons/money.png</file>
<file>Icons/sphere2.png</file>
<file>Icons/downarrow.png</file>
<file>Icons/url.png</file>
@@ -29,7 +27,6 @@
<file>Icons/skin/open.png</file>
<file>Icons/skin/qbittorrent16.png</file>
<file>Icons/skin/downloading.png</file>
<file>Icons/skin/search.png</file>
<file>Icons/skin/pause_all.png</file>
<file>Icons/skin/play_all.png</file>
<file>Icons/skin/pause.png</file>
@@ -73,7 +70,9 @@
<file>Icons/flags/japan.png</file>
<file>Icons/oxygen/view-refresh.png</file>
<file>Icons/oxygen/file.png</file>
<file>Icons/oxygen/mail-folder-inbox.png</file>
<file>Icons/oxygen/time.png</file>
<file>Icons/oxygen/edit-find.png</file>
<file>Icons/oxygen/folder-new.png</file>
<file>Icons/oxygen/edit-paste.png</file>
<file>Icons/oxygen/proxy.png</file>
@@ -94,13 +93,15 @@
<file>Icons/oxygen/edit-copy.png</file>
<file>Icons/oxygen/bt_settings.png</file>
<file>Icons/oxygen/document-new.png</file>
<file>Icons/oxygen/preferences-desktop.png</file>
<file>Icons/oxygen/tab-close.png</file>
<file>Icons/oxygen/wallet.png</file>
<file>Icons/oxygen/webui.png</file>
<file>Icons/oxygen/list-remove.png</file>
<file>Icons/oxygen/connection.png</file>
<file>Icons/oxygen/bug.png</file>
<file>Icons/oxygen/list-add.png</file>
<file>Icons/oxygen/folder.png</file>
<file>Icons/oxygen/configure.png</file>
<file>Icons/oxygen/edit-cut.png</file>
<file>Icons/oxygen/unsubscribe.png</file>
<file>Icons/oxygen/subscribe16.png</file>

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More