diff --git a/Changelog b/Changelog index 0cdf2c8267d1a383d32271f3c58a569cd345241c..26a53e5bd89e634f5f10b8e5c8f70f4b4578a3f9 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,11 @@ +* Sat Jan 1 2010 - Christophe Dumez - v2.5.3 + - BUGFIX: Fix priority up/down for multiple torrents at the same time (closes #692184) + - BUGFIX: Make sure the number of torrents is properly set on startup (closes #694135) + - BUGFIX: Fix scan directories saving (closes #694768) + - BUGFIX: Remove empty folders on torrent soft deletion (closes #695174) + - BUGFIX: Make sure the main window has focus on startup + - BUGFIX: Fix ampersand display in search tabs (closes #695715) + * Sun Dec 19 2010 - Christophe Dumez - v2.5.2 - BUGFIX: Fix alternative speed icon staying pressed when disabled - BUGFIX: Fix slot warning on startup diff --git a/install.os2 b/install.os2 new file mode 100644 index 0000000000000000000000000000000000000000..0d5535dc083b1b50c25face15d8a44996d40e25b --- /dev/null +++ b/install.os2 @@ -0,0 +1,136 @@ +QBittorrent installation + + + +0. CONTENTS OF THIS FILE +======================== + +1. INTRODUCTION + +2. REQUIREMENTS + +3. INSTALLATION + +4. CONTACT + +5. CREDITS + +6. SUPPORT AND DONATIONS + +7. HISTORY + + +1. INTRODUCTION +=============== + +Welcome to QBittorrent port for OS/2 and eComStation. + + +2. REQUIREMENTS +=============== + +* klibc 0.6.3 or later + + ftp://ftp.netlabs.org/pub/gcc/libc-0_6_3-csd3.wpi + +* openssl 1.0 + + ftp://ftp.netlabs.org/pub/unixos2/ssl10.zip + +* Qt4 dll + + see http://svn.netlabs.org/qt4 for more information whats needed and where to get the latest + + +3. INSTALLATION +=============== + +To install QBittorrent, do the following: + +klibc +----- + + 1. Download klibc 0.6.3 csd3 or later. + 2. Install the package by double-clicking on the WPI file. + + +openssl 1.0 +----------- + + 1. Download the zip file + 2. Install the files to your libpath eg. x:\ecs\dll + +Qt4 dll +------- + + 1. Download the package + 2. Install the package by double-clicking on the wpi file. + + + +QBittorrent +----------- + + 1. Create a directory for QBittorrent. + 2. Extract the QBittorrent package to the new directory. + 3. Create a WPS object for QBittorrent.exe. + 4. Start QBittorrent + 5. Happy torrenting + + + +4. CONTACT +========== + +Please send bugreports to: + + ecs@aroa.ch + +Only bug reports with a reproducable bug are accepted. :-) + + + +5. CREDITS +========== + +The port was done by: + +Silvan Scherrer aka _diver + +Thanks go to: + + * Dmitry A. Kuminov + +They either helped me when I had some nasty questions or did some testing for +me. + + +6. SUPPORT AND DONATIONS +======================== + +QBittorrent port is based on volunteer work. If you would like to support further +development, you can do so in one of the following ways: + + + * Donate to the Qt4 project: see qt.netlabs.org for more information + + * Contribute to the project: Besides actual development, this also includes + maintaining the documentation and the project web site as well as help + for users. + + +7. HISTORY +========== + +2010-12-23 + + * updated to 2.5.2 code level of QBittorrent + +2010-11-22 + + * updated to 2.4.11 code level of QBittorrent + +2010-xx-xx + + * initial port + diff --git a/os2conf.pri b/os2conf.pri index a282a63c190d3dfb3e021c05501b2b7483669210..1bffdcbb4bd7ed728d59483096bbc6e541edb97b 100644 --- a/os2conf.pri +++ b/os2conf.pri @@ -1,3 +1,10 @@ +INCLUDEPATH += $$PWD + +exists(conf.pri) { + # to the conf.pri goes all system dependent stuff + include(conf.pri) +} + LIBS += -ltorrent-rasterbar \ -lboost_thread \ -lboost_system \ diff --git a/src/Icons/qBittorrent.desktop b/src/Icons/qBittorrent.desktop index dffce5a71520937fa1c2c5d40d9cc13b2eb660f7..f381928efd0b7cf53c81ca0e4b5fe5d367c46211 100644 --- a/src/Icons/qBittorrent.desktop +++ b/src/Icons/qBittorrent.desktop @@ -1,6 +1,6 @@ [Desktop Entry] Categories=Qt;Network;P2P; -Comment=V2.5.2 +Comment=V2.5.3 Exec=qbittorrent %f GenericName=Bittorrent client GenericName[ar]=العميل Bittorrent diff --git a/src/Info.plist b/src/Info.plist index a2fcad45fa5e8add08a717fb9f62e13ada81a5a9..7f2aa8b32fd11939943d45d47850b67c74410a5a 100644 --- a/src/Info.plist +++ b/src/Info.plist @@ -47,7 +47,7 @@ CFBundlePackageType APPL CFBundleGetInfoString - 2.5.2 + 2.5.3 CFBundleSignature ???? CFBundleExecutable diff --git a/src/main.cpp b/src/main.cpp index a9a31ad489b173e646ebdb55bee665c461ef9b9c..573a5d197dbc5b73ae0cad321880bbc76b0e3be2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -263,9 +263,9 @@ int main(int argc, char *argv[]){ painter.setFont(QFont("Arial", 22, QFont::Black)); painter.drawText(224 - painter.fontMetrics().width(version), 270, version); splash = new QSplashScreen(splash_img, Qt::WindowStaysOnTopHint); + QTimer::singleShot(1500, splash, SLOT(deleteLater())); splash->show(); app.processEvents(); - QTimer::singleShot(2000, splash, SLOT(deleteLater())); } #endif // Set environment variable @@ -296,6 +296,8 @@ int main(int argc, char *argv[]){ torrentCmdLine.removeFirst(); #ifndef DISABLE_GUI MainWindow window(0, torrentCmdLine); + if(!no_splash) + window.raise(); QObject::connect(&app, SIGNAL(messageReceived(const QString&)), &window, SLOT(processParams(const QString&))); app.setActivationWindow(&window); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 3e13c7b89735c8374e17b665b3bd2381fa80ad0e..3b472ef9459e69f060eed640e680e5b58f242b0c 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -163,8 +163,6 @@ MainWindow::MainWindow(QWidget *parent, QStringList torrentCmdLine) : QMainWindo vSplitter->setCollapsible(0, true); vSplitter->setCollapsible(1, false); tabs->addTab(vSplitter, QIcon(QString::fromUtf8(":/Icons/oxygen/folder-remote.png")), tr("Transfers")); - connect(transferList->getSourceModel(), SIGNAL(rowsInserted(QModelIndex, int, int)), this, SLOT(updateNbTorrents())); - connect(transferList->getSourceModel(), SIGNAL(rowsRemoved(QModelIndex, int, int)), this, SLOT(updateNbTorrents())); vboxLayout->addWidget(tabs); @@ -227,6 +225,8 @@ MainWindow::MainWindow(QWidget *parent, QStringList torrentCmdLine) : QMainWindo } else { if(pref.startMinimized()) showMinimized(); + else + setFocus(); } // Start watching the executable for updates @@ -242,6 +242,11 @@ MainWindow::MainWindow(QWidget *parent, QStringList torrentCmdLine) : QMainWindo // Populate the transfer list transferList->getSourceModel()->populate(); + // Update the number of torrents (tab) + updateNbTorrents(); + connect(transferList->getSourceModel(), SIGNAL(rowsInserted(QModelIndex, int, int)), this, SLOT(updateNbTorrents())); + connect(transferList->getSourceModel(), SIGNAL(rowsRemoved(QModelIndex, int, int)), this, SLOT(updateNbTorrents())); + qDebug("GUI Built"); #ifdef Q_WS_WIN if(!pref.neverCheckFileAssoc() && !Preferences::isFileAssocOk()) { @@ -263,6 +268,7 @@ MainWindow::MainWindow(QWidget *parent, QStringList torrentCmdLine) : QMainWindo connect(updater, SIGNAL(updateCheckFinished(bool, QString)), SLOT(handleUpdateCheckFinished(bool, QString))); updater->checkForUpdates(); #endif + } void MainWindow::deleteBTSession() { diff --git a/src/misc.cpp b/src/misc.cpp index ff0b5825e5a14d5ab451c2a219359a416e969f65..bf997d501d82549cf0ffe0c56111e6930c14d116 100644 --- a/src/misc.cpp +++ b/src/misc.cpp @@ -557,19 +557,6 @@ bool misc::isPreviewable(QString extension){ return false; } -bool misc::removeEmptyTree(QString path) { - QDir dir(path); - foreach(const QString &child, dir.entryList(QDir::AllDirs)) { - if(child == "." || child == "..") continue; - return removeEmptyTree(dir.absoluteFilePath(child)); - } - const QString dir_name = dir.dirName(); - if(dir.cdUp()) { - return dir.rmdir(dir_name); - } - return false; -} - QString misc::bcLinkToMagnet(QString bc_link) { QByteArray raw_bc = bc_link.toUtf8(); raw_bc = raw_bc.mid(8); // skip bc://bt/ @@ -759,3 +746,9 @@ bool misc::isValidTorrentFile(const QString &torrent_path) { } return true; } + +QString misc::branchPath(QString file_path) +{ + file_path.replace("\\", "/"); + return file_path.left(file_path.lastIndexOf('/')); +} diff --git a/src/misc.h b/src/misc.h index ab5c5c2de08af730259b45b7cc600016b50221f8..9ed57ebcf03981f1eaf0b0531b38661ffb4614c0 100644 --- a/src/misc.h +++ b/src/misc.h @@ -149,7 +149,7 @@ public: // value must be given in bytes static QString friendlyUnit(double val); static bool isPreviewable(QString extension); - static bool removeEmptyTree(QString path); + static QString branchPath(QString file_path); static QString magnetUriToName(QString magnet_uri); static QString magnetUriToHash(QString magnet_uri); static QString bcLinkToMagnet(QString bc_link); diff --git a/src/preferences/options_imp.cpp b/src/preferences/options_imp.cpp index abf591f36dee6e83fb53fcbd486f0967b4e04216..34f42796da4ef447aeb9e8c65dcc4d3c61a924f9 100644 --- a/src/preferences/options_imp.cpp +++ b/src/preferences/options_imp.cpp @@ -341,7 +341,7 @@ void options_imp::saveOptions(){ pref.preAllocateAllFiles(preAllocateAllFiles()); pref.useAdditionDialog(useAdditionDialog()); pref.addTorrentsInPause(addTorrentsInPause()); - ScanFoldersModel::instance()->makePersistent(pref); + ScanFoldersModel::instance()->makePersistent(); addedScanDirs.clear(); QString export_dir = getExportDir(); #if defined(Q_WS_WIN) || defined(Q_OS_OS2) diff --git a/src/properties/propertieswidget.cpp b/src/properties/propertieswidget.cpp index a887fd877abeb091f20686353ed2087e97592386..db6eaac741961a40452aa5496b81c6b6a5a6c163 100644 --- a/src/properties/propertieswidget.cpp +++ b/src/properties/propertieswidget.cpp @@ -631,7 +631,8 @@ void PropertiesWidget::renameSelectedFile() { // Remove old folder const QDir old_folder(h.save_path()+"/"+old_path); int timeout = 10; - while(!misc::removeEmptyTree(old_folder.absolutePath()) && timeout > 0) { + while(!QDir().rmpath(old_folder.absolutePath()) && timeout > 0) { + // XXX: We should not sleep here (freezes the UI for 1 second) SleeperThread::msleep(100); --timeout; } diff --git a/src/qtlibtorrent/qbtsession.cpp b/src/qtlibtorrent/qbtsession.cpp index 671c2ac1711cc2f27c4f1026599246b13110c252..0c61a52012fedf92116038492697e3107d83cf3a 100644 --- a/src/qtlibtorrent/qbtsession.cpp +++ b/src/qtlibtorrent/qbtsession.cpp @@ -276,6 +276,7 @@ void QBtSession::configureSession() { } int i = 0; foreach (const QString &dir, scan_dirs) { + qDebug() << "Adding scan dir" << dir << downloadInDirList.at(i); m_scanFolders->addPath(dir, downloadInDirList.at(i)); ++i; } @@ -735,6 +736,9 @@ void QBtSession::deleteTorrent(QString hash, bool delete_local_files) { foreach(const QString &uneeded_file, uneeded_files) { qDebug("Removing uneeded file: %s", qPrintable(uneeded_file)); misc::safeRemove(uneeded_file); + const QString parent_folder = misc::branchPath(uneeded_file); + qDebug("Attempt to remove parent folder (if empty): %s", qPrintable(parent_folder)); + QDir().rmpath(parent_folder); } } // Remove it from torrent backup directory @@ -2106,14 +2110,14 @@ void QBtSession::readAlerts() { #endif if(!hash.isEmpty()) { if(savePathsToRemove.contains(hash)) { - misc::removeEmptyTree(savePathsToRemove.take(hash)); + QDir().rmpath(savePathsToRemove.take(hash)); } } else { // XXX: Fallback QStringList hashes_deleted; foreach(const QString& key, savePathsToRemove.keys()) { // Attempt to delete - misc::removeEmptyTree(savePathsToRemove[key]); + QDir().rmpath(savePathsToRemove[key]); if(!QDir(savePathsToRemove[key]).exists()) { hashes_deleted << key; } @@ -2134,7 +2138,7 @@ void QBtSession::readAlerts() { QDir old_save_dir(old_save_path); if(old_save_dir != QDir(defaultSavePath) && old_save_dir != QDir(defaultTempPath)) { qDebug("Attempting to remove %s", qPrintable(old_save_path)); - misc::removeEmptyTree(old_save_path); + QDir().rmpath(old_save_path); } if(defaultTempPath.isEmpty() || !new_save_path.startsWith(defaultTempPath)) { qDebug("Storage has been moved, updating save path to %s", qPrintable(new_save_path)); diff --git a/src/scannedfoldersmodel.cpp b/src/scannedfoldersmodel.cpp index 466d28957588447230f414e68fd74fcdb8179f60..52c3d4dc89df7325251b6996e9a7c409ee2d62a8 100644 --- a/src/scannedfoldersmodel.cpp +++ b/src/scannedfoldersmodel.cpp @@ -29,7 +29,7 @@ */ #include "scannedfoldersmodel.h" - +#include "preferences.h" #include "filesystemwatcher.h" #include @@ -189,15 +189,16 @@ int ScanFoldersModel::findPathData(const QString &path) const { return -1; } -void ScanFoldersModel::makePersistent(QIniSettings &settings) { +void ScanFoldersModel::makePersistent() { + Preferences pref; QStringList paths; QList downloadInFolderInfo; foreach (const PathData* pathData, m_pathList) { paths << pathData->path; downloadInFolderInfo << pathData->downloadAtPath; } - settings.setValue(QString::fromUtf8("ScanDirs"), paths); - settings.setValue(QString::fromUtf8("DownloadInScanDirs"), misc::toStringList(downloadInFolderInfo)); + pref.setScanDirs(paths); + pref.setDownloadInScanDirs(downloadInFolderInfo); } ScanFoldersModel *ScanFoldersModel::m_instance = 0; diff --git a/src/scannedfoldersmodel.h b/src/scannedfoldersmodel.h index 35da569a575fd1935bf80fe4f3cb4f65edd230bf..f0551d3e61a00f94622db88b9b9e967c1847f0e2 100644 --- a/src/scannedfoldersmodel.h +++ b/src/scannedfoldersmodel.h @@ -61,7 +61,7 @@ public: PathStatus setDownloadAtPath(int row, bool downloadAtPath); bool downloadInTorrentFolder(const QString &filePath) const; - void makePersistent(QIniSettings &settings); + void makePersistent(); signals: // The absolute paths of new torrent files in the scanned directories. diff --git a/src/searchengine/searchengine.cpp b/src/searchengine/searchengine.cpp index 63ad7def6029d164a5610f0d2abfa61e0d85ad34..7fe28d33d16995a1a99ace0d7e52f0276bb8fc6d 100644 --- a/src/searchengine/searchengine.cpp +++ b/src/searchengine/searchengine.cpp @@ -313,7 +313,7 @@ void SearchEngine::on_search_button_clicked(){ // Reload environment variables (proxy) searchProcess->setEnvironment(QProcess::systemEnvironment()); - QString pattern = search_pattern->text().trimmed(); + const QString pattern = search_pattern->text().trimmed(); // No search pattern entered if(pattern.isEmpty()){ QMessageBox::critical(0, tr("Empty search pattern"), tr("Please type a search pattern first")); @@ -323,7 +323,9 @@ void SearchEngine::on_search_button_clicked(){ currentSearchTab=new SearchTab(this); connect(currentSearchTab->header(), SIGNAL(sectionResized(int, int, int)), this, SLOT(propagateSectionResized(int,int,int))); all_tab.append(currentSearchTab); - tabWidget->addTab(currentSearchTab, pattern); + QString tabName = pattern; + tabName.replace(QRegExp("&{1}"), "&&"); + tabWidget->addTab(currentSearchTab, tabName); tabWidget->setCurrentWidget(currentSearchTab); #if QT_VERSION < 0x040500 closeTab_button->setEnabled(true); @@ -594,7 +596,7 @@ void SearchEngine::searchFinished(int exitcode,QProcess::ExitStatus){ // SLOT to append one line to search results list // Line is in the following form : // file url | file name | file size | nb seeds | nb leechers | Search engine url -void SearchEngine::appendSearchResult(QString line){ +void SearchEngine::appendSearchResult(const QString &line){ if(!currentSearchTab) { if(searchProcess->state() != QProcess::NotRunning){ searchProcess->terminate(); @@ -606,7 +608,7 @@ void SearchEngine::appendSearchResult(QString line){ return; } QStringList parts = line.split("|"); - if(parts.size() != 6){ + if(parts.size() < 6){ return; } Q_ASSERT(currentSearchTab); diff --git a/src/searchengine/searchengine.h b/src/searchengine/searchengine.h index 7c4703c9dce65b7a5280b7557210e647b913cae7..4f94f9b9a42efe3b70b2321e456ed2ed78a7892b 100644 --- a/src/searchengine/searchengine.h +++ b/src/searchengine/searchengine.h @@ -91,7 +91,7 @@ protected slots: #else void closeTab(int index); #endif - void appendSearchResult(QString line); + void appendSearchResult(const QString& line); void searchFinished(int exitcode,QProcess::ExitStatus); void readSearchOutput(); void searchStarted(); diff --git a/src/transferlistwidget.cpp b/src/transferlistwidget.cpp index 85c9380ddd1d18043a9996947cd56d77d2f7a6b4..21d0c984f09353c2e280ff5f7e7ef116b834640c 100644 --- a/src/transferlistwidget.cpp +++ b/src/transferlistwidget.cpp @@ -53,9 +53,12 @@ #include #include #include +#include #include "qinisettings.h" +using namespace libtorrent; + TransferListWidget::TransferListWidget(QWidget *parent, MainWindow *main_window, QBtSession *_BTSession): QTreeView(parent), BTSession(_BTSession), main_window(main_window) { // Create and apply delegate @@ -312,24 +315,50 @@ void TransferListWidget::deleteVisibleTorrents() { } void TransferListWidget::increasePrioSelectedTorrents() { + qDebug() << Q_FUNC_INFO; if(main_window->getCurrentTabWidget() != this) return; const QStringList hashes = getSelectedTorrentsHashes(); + std::priority_queue, std::vector >, std::greater > > torrent_queue; + // Sort torrents by priority foreach(const QString &hash, hashes) { - QTorrentHandle h = BTSession->getTorrentHandle(hash); - if(h.is_valid() && !h.is_seed()) { + try { + QTorrentHandle h = BTSession->getTorrentHandle(hash); + if(!h.is_seed()) { + torrent_queue.push(qMakePair(h.queue_position(), h)); + } + }catch(invalid_handle&){} + } + // Increase torrents priority (starting with the ones with highest priority) + while(!torrent_queue.empty()) { + QTorrentHandle h = torrent_queue.top().second; + try { h.queue_position_up(); - } + } catch(invalid_handle& h) {} + torrent_queue.pop(); } } void TransferListWidget::decreasePrioSelectedTorrents() { + qDebug() << Q_FUNC_INFO; if(main_window->getCurrentTabWidget() != this) return; const QStringList hashes = getSelectedTorrentsHashes(); + std::priority_queue, std::vector >, std::less > > torrent_queue; + // Sort torrents by priority foreach(const QString &hash, hashes) { - QTorrentHandle h = BTSession->getTorrentHandle(hash); - if(h.is_valid() && !h.is_seed()) { + try { + QTorrentHandle h = BTSession->getTorrentHandle(hash); + if(!h.is_seed()) { + torrent_queue.push(qMakePair(h.queue_position(), h)); + } + }catch(invalid_handle&){} + } + // Decrease torrents priority (starting with the ones with lowest priority) + while(!torrent_queue.empty()) { + QTorrentHandle h = torrent_queue.top().second; + try { h.queue_position_down(); - } + } catch(invalid_handle& h) {} + torrent_queue.pop(); } } diff --git a/src/webui/httpconnection.cpp b/src/webui/httpconnection.cpp index 96356e513e86e9f677dff69c86c98b9e38281d08..d8b8ba68b4e50b12d3521c3ca5d6cc2fc4cde713 100644 --- a/src/webui/httpconnection.cpp +++ b/src/webui/httpconnection.cpp @@ -45,6 +45,8 @@ #include #include #include +#include +#include using namespace libtorrent; @@ -498,23 +500,25 @@ void HttpConnection::respondCommand(QString command) return; } if(command == "increasePrio") { - QTorrentHandle h = QBtSession::instance()->getTorrentHandle(parser.post("hash")); - if(h.is_valid()) h.queue_position_up(); + increaseTorrentsPriority(parser.post("hashes").split("|")); return; } if(command == "decreasePrio") { - QTorrentHandle h = QBtSession::instance()->getTorrentHandle(parser.post("hash")); - if(h.is_valid()) h.queue_position_down(); + decreaseTorrentsPriority(parser.post("hashes").split("|")); return; } if(command == "topPrio") { - QTorrentHandle h = QBtSession::instance()->getTorrentHandle(parser.post("hash")); - if(h.is_valid()) h.queue_position_top(); + foreach(const QString &hash, parser.post("hashes").split("|")) { + QTorrentHandle h = QBtSession::instance()->getTorrentHandle(hash); + if(h.is_valid()) h.queue_position_top(); + } return; } if(command == "bottomPrio") { - QTorrentHandle h = QBtSession::instance()->getTorrentHandle(parser.post("hash")); - if(h.is_valid()) h.queue_position_bottom(); + foreach(const QString &hash, parser.post("hashes").split("|")) { + QTorrentHandle h = QBtSession::instance()->getTorrentHandle(hash); + if(h.is_valid()) h.queue_position_bottom(); + } return; } if(command == "recheck"){ @@ -543,3 +547,49 @@ void HttpConnection::recheckAllTorrents() { QBtSession::instance()->recheckTorrent(h.hash()); } } + +void HttpConnection::decreaseTorrentsPriority(const QStringList &hashes) +{ + qDebug() << Q_FUNC_INFO << hashes; + std::priority_queue, std::vector >, std::less > > torrent_queue; + // Sort torrents by priority + foreach(const QString &hash, hashes) { + try { + QTorrentHandle h = QBtSession::instance()->getTorrentHandle(hash); + if(!h.is_seed()) { + torrent_queue.push(qMakePair(h.queue_position(), h)); + } + }catch(invalid_handle&){} + } + // Decrease torrents priority (starting with the ones with lowest priority) + while(!torrent_queue.empty()) { + QTorrentHandle h = torrent_queue.top().second; + try { + h.queue_position_down(); + } catch(invalid_handle& h) {} + torrent_queue.pop(); + } +} + +void HttpConnection::increaseTorrentsPriority(const QStringList &hashes) +{ + qDebug() << Q_FUNC_INFO << hashes; + std::priority_queue, std::vector >, std::greater > > torrent_queue; + // Sort torrents by priority + foreach(const QString &hash, hashes) { + try { + QTorrentHandle h = QBtSession::instance()->getTorrentHandle(hash); + if(!h.is_seed()) { + torrent_queue.push(qMakePair(h.queue_position(), h)); + } + }catch(invalid_handle&){} + } + // Increase torrents priority (starting with the ones with highest priority) + while(!torrent_queue.empty()) { + QTorrentHandle h = torrent_queue.top().second; + try { + h.queue_position_up(); + } catch(invalid_handle& h) {} + torrent_queue.pop(); + } +} diff --git a/src/webui/httpconnection.h b/src/webui/httpconnection.h index 17be39cc67f12bb8f4ff8b4b828f4eb921be55d5..e5878e80f91a0a5faa1d87213b3acb974298e87a 100644 --- a/src/webui/httpconnection.h +++ b/src/webui/httpconnection.h @@ -67,6 +67,9 @@ protected slots: void handleDownloadFailure(QString, QString); void recheckTorrent(QString hash); void recheckAllTorrents(); + void decreaseTorrentsPriority(const QStringList& hashes); + void increaseTorrentsPriority(const QStringList& hashes); + public: HttpConnection(QTcpSocket *socket, HttpServer *httpserver); diff --git a/src/webui/httpserver.cpp b/src/webui/httpserver.cpp index 79078262ee2f01fc5da702ff70c3e1394b901c29..2e7ee508ef0292a4a9d29f92b695093016fd5bb6 100644 --- a/src/webui/httpserver.cpp +++ b/src/webui/httpserver.cpp @@ -208,7 +208,7 @@ bool HttpServer::isAuthorized(QByteArray auth, QString method) const { return false; } QByteArray prop_nonce = regex_nonce.cap(1).toLocal8Bit(); - qDebug("prop nonce is: %s", prop_nonce.data()); + //qDebug("prop nonce is: %s", prop_nonce.data()); // get uri QRegExp regex_uri(".*uri=\"([^\"]+)\".*"); if(regex_uri.indexIn(auth) < 0) { @@ -216,7 +216,7 @@ bool HttpServer::isAuthorized(QByteArray auth, QString method) const { return false; } QByteArray prop_uri = regex_uri.cap(1).toLocal8Bit(); - qDebug("prop uri is: %s", prop_uri.data()); + //qDebug("prop uri is: %s", prop_uri.data()); // get response QRegExp regex_response(".*response=[\"]?([\\w=]+)[\"]?.*"); if(regex_response.indexIn(auth) < 0) { @@ -224,7 +224,7 @@ bool HttpServer::isAuthorized(QByteArray auth, QString method) const { return false; } QByteArray prop_response = regex_response.cap(1).toLocal8Bit(); - qDebug("prop response is: %s", prop_response.data()); + //qDebug("prop response is: %s", prop_response.data()); // Compute correct reponse QCryptographicHash md5_ha2(QCryptographicHash::Md5); md5_ha2.addData(method.toLocal8Bit() + ":" + prop_uri); @@ -239,21 +239,21 @@ bool HttpServer::isAuthorized(QByteArray auth, QString method) const { return false; } QByteArray prop_nc = regex_nc.cap(1).toLocal8Bit(); - qDebug("prop nc is: %s", prop_nc.data()); + //qDebug("prop nc is: %s", prop_nc.data()); QRegExp regex_cnonce(".*cnonce=[\"]?([\\w=]+)[\"]?.*"); if(regex_cnonce.indexIn(auth) < 0) { qDebug("AUTH-PROB: qop but missing cnonce"); return false; } QByteArray prop_cnonce = regex_cnonce.cap(1).toLocal8Bit(); - qDebug("prop cnonce is: %s", prop_cnonce.data()); + //qDebug("prop cnonce is: %s", prop_cnonce.data()); QRegExp regex_qop(".*qop=[\"]?(\\w+)[\"]?.*"); if(regex_qop.indexIn(auth) < 0) { qDebug("AUTH-PROB: missing qop"); return false; } QByteArray prop_qop = regex_qop.cap(1).toLocal8Bit(); - qDebug("prop qop is: %s", prop_qop.data()); + //qDebug("prop qop is: %s", prop_qop.data()); md5_ha.addData(password_ha1+":"+prop_nonce+":"+prop_nc+":"+prop_cnonce+":"+prop_qop+":"+ha2); response = md5_ha.result().toHex(); } else { @@ -261,7 +261,7 @@ bool HttpServer::isAuthorized(QByteArray auth, QString method) const { md5_ha.addData(password_ha1+":"+prop_nonce+":"+ha2); response = md5_ha.result().toHex(); } - qDebug("AUTH: comparing reponses: (%d)", static_cast(prop_response == response)); + //qDebug("AUTH: comparing reponses: (%d)", static_cast(prop_response == response)); return prop_response == response; } diff --git a/src/webui/scripts/mocha-init.js b/src/webui/scripts/mocha-init.js index 490a60514a108526c1e721ccf64917433ec484cf..88aa6285b9d88afb7934dbdc05f7f5a7271756c2 100644 --- a/src/webui/scripts/mocha-init.js +++ b/src/webui/scripts/mocha-init.js @@ -204,7 +204,7 @@ initializeWindows = function(){ } }; - ['pause','resume','decreasePrio','increasePrio', 'topPrio', 'bottomPrio', 'recheck'].each(function(item) { + ['pause','resume', 'recheck'].each(function(item) { addClickEvent(item, function(e){ new Event(e).stop(); var h = myTable.selectedIds(); @@ -220,13 +220,18 @@ initializeWindows = function(){ new Request({url: '/command/'+item+'all'}).send(); }); }); + + ['decreasePrio','increasePrio', 'topPrio', 'bottomPrio'].each(function(item) { + addClickEvent(item, function(e){ + new Event(e).stop(); + setPriorityFN(item); + }); + }); setPriorityFN = function(cmd) { var h = myTable.selectedIds(); - if(h.length){ - h.each(function(hash, index){ - new Request({url: '/command/'+cmd, method: 'post', data: {hash: hash}}).send(); - }); + if(h.length) { + new Request({url: '/command/'+cmd, method: 'post', data: {hashes: h.join("|")}}).send(); } } diff --git a/version.pri b/version.pri index 021dd84d7197d2f70b52654d7d9f25b08955495f..ffdb75d8e0e20064abaaa723d900e27cc4dd0e01 100644 --- a/version.pri +++ b/version.pri @@ -1,11 +1,11 @@ os2 { - DEFINES += VERSION=\'\"v2.5.2\"\' + DEFINES += VERSION=\'\"v2.5.3\"\' } else { - DEFINES += VERSION=\\\"v2.5.2\\\" + DEFINES += VERSION=\\\"v2.5.3\\\" } DEFINES += VERSION_MAJOR=2 DEFINES += VERSION_MINOR=5 -DEFINES += VERSION_BUGFIX=2 +DEFINES += VERSION_BUGFIX=3 # NORMAL,ALPHA,BETA,RELEASE_CANDIDATE,DEVEL DEFINES += VERSION_TYPE=NORMAL