From 7d9caad31e15d1690943611151fa4d17b5e82604 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Wed, 20 Jan 2010 18:06:56 +0000 Subject: [PATCH] Paused torrents can now be rechecked --- Changelog | 2 + src/bittorrent.cpp | 18 ++ src/bittorrent.h | 2 + src/httpconnection.cpp | 8 +- src/lang/qbittorrent_ru.ts | 392 +++++++++++++++++++------------------ src/transferlistwidget.cpp | 5 +- 6 files changed, 229 insertions(+), 198 deletions(-) diff --git a/Changelog b/Changelog index 85d3905e2..9652974ec 100644 --- a/Changelog +++ b/Changelog @@ -9,6 +9,8 @@ - BUGFIX: Fix renaming of files with unicode characters in their name - BUGFIX: Fix typo in legal notice (startup) - BUGFIX: Can listen on ports < 1024 (must be root) + - BUGFIX: Paused torrents can now be rechecked + - I18N: Updated translations (Hungarian, Chinese) * Mon Jan 18 2010 - Christophe Dumez - v2.1.0 - FEATURE: Graphical User Interface can be disabled at compilation time (headless running) diff --git a/src/bittorrent.cpp b/src/bittorrent.cpp index 35fa11b73..6fbaa2a48 100644 --- a/src/bittorrent.cpp +++ b/src/bittorrent.cpp @@ -1915,12 +1915,30 @@ void Bittorrent::addConsoleMessage(QString msg, QString) { } emit torrentFinishedChecking(h); emit metadataReceived(h); + if(torrentsToPausedAfterChecking.contains(hash)) { + torrentsToPausedAfterChecking.removeOne(hash); + h.pause(); + emit pausedTorrent(h); + } } } a = s->pop_alert(); } } + void Bittorrent::recheckTorrent(QString hash) { + QTorrentHandle h = getTorrentHandle(hash); + if(h.is_valid() && h.has_metadata()) { + if(h.is_paused()) { + if(!torrentsToPausedAfterChecking.contains(h.hash())) { + torrentsToPausedAfterChecking << h.hash(); + h.resume(); + } + } + h.force_recheck(); + } + } + QHash Bittorrent::getTrackersInfo(QString hash) const{ return trackersInfos.value(hash, QHash()); } diff --git a/src/bittorrent.h b/src/bittorrent.h index e2d1572e1..69cd539af 100644 --- a/src/bittorrent.h +++ b/src/bittorrent.h @@ -94,6 +94,7 @@ private: QPointer timerAlerts; QMap savepath_fromurl; QHash > trackersInfos; + QStringList torrentsToPausedAfterChecking; // Ratio QPointer BigRatioTimer; // HTTP @@ -180,6 +181,7 @@ public slots: void deleteTorrent(QString hash, bool delete_local_files = false); void startUpTorrents(); session_proxy asyncDeletion(); + void recheckTorrent(QString hash); /* Needed by Web UI */ void pauseAllTorrents(); void pauseTorrent(QString hash); diff --git a/src/httpconnection.cpp b/src/httpconnection.cpp index 564b49c98..9e9e92a7b 100644 --- a/src/httpconnection.cpp +++ b/src/httpconnection.cpp @@ -456,8 +456,8 @@ void HttpConnection::respondCommand(QString command) void HttpConnection::recheckTorrent(QString hash) { QTorrentHandle h = BTSession->getTorrentHandle(hash); - if(h.is_valid() && !h.is_paused()){ - h.force_recheck(); + if(h.is_valid()){ + BTSession->recheckTorrent(h.hash()); } } @@ -466,7 +466,7 @@ void HttpConnection::recheckAllTorrents() { std::vector::iterator torrentIT; for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) { QTorrentHandle h = QTorrentHandle(*torrentIT); - if(h.is_valid() && !h.is_paused()) - h.force_recheck(); + if(h.is_valid()) + BTSession->recheckTorrent(h.hash()); } } diff --git a/src/lang/qbittorrent_ru.ts b/src/lang/qbittorrent_ru.ts index dc26821e1..d4e14a625 100644 --- a/src/lang/qbittorrent_ru.ts +++ b/src/lang/qbittorrent_ru.ts @@ -314,23 +314,23 @@ p, li { white-space: pre-wrap; } Using a disk cache size of %1 MiB - + Используется дисковый кеш размером %1 МиБ PeX support [OFF] - + Поддержка PeX [Выкл] Restart is required to toggle PeX support - + Необходимо перезапустить qBittorrent для включения настройки PeX The Web UI is listening on port %1 - + Web интерфейс прослушивает пор %1 HTTP user agent is %1 - + Браузер %1 Reason: %1 @@ -2560,23 +2560,23 @@ Are you sure you want to quit qBittorrent? HeadlessLoader Information - + Информация To control qBittorrent, access the Web UI at http://localhost:%1 - + Чтобы управлять qBittorrent откройте браузер по адресу http://localhost:%1 The Web UI administrator user name is: %1 - + Администратор Web интерфейса: %1 The Web UI administrator password is still the default one: %1 - + Пароль администратора Web интерфейса все еще пароль по умолчанию: %1 This is a security risk, please consider changing your password from program preferences. - + Риск безопасности, пожалуйста, смените ваш пароль в настройках программы. @@ -2658,51 +2658,59 @@ Are you sure you want to quit qBittorrent? Language - + Язык The port used for incoming connections must be greater than 1024 and less than 65535. - + Порт для входящих соединений должен быть больше чем 1024 и меньше 65535. The port used for the Web UI must be greater than 1024 and less than 65535. - + Порт для Web интерфейса должен быть больше 1024 и меньше 65535. The Web UI username must be at least 3 characters long. - + Имя пользователя Web интерфейса должно быть длинее 3 символов. The Web UI password must be at least 3 characters long. - + Пароль Web интерфейса должно быть длинее 3 символов. Downloaded Is the file downloaded or not? - + Скачано LegalNotice Legal Notice - + Официальное уведомление + + + qBittorrent is a file sharing program. When you run a torrent, its data will be made available to others by mean of upload. And of course, any content you share if your sole responsatibility. + +You probably knew this, so we won't tell you again. + qBittorrent - программа для обмена файлами. Когда вы запускаете торрент, данные становятся доступными другим участникам обмена для отдачи. Конечно, любые данные которые вы отдаете на обмен только ваша ответственность. + +Скорее всего вы знали это, так что мы более не будем вам об этом говорить. Press any key to accept and continue... - + Нажмите любую клавишу для того чтобы принять это и продолжить... Legal notice - + Официальное уведомление Cancel - + Отмена I Agree - + Я согласен qBittorrent is a file sharing program. When you run a torrent, its data will be made available to others by means of upload. Any content you share is your sole responsibility. @@ -3093,158 +3101,158 @@ No further notices will be issued. Preferences Preferences - + Настройки UI - + Интерфейс Downloads - + Закачки Connection - + Соединение Bittorrent - + Bittorrent Proxy - + Прокси IP Filter - + Фильтр по IP Web UI - + Web интерфейс RSS - + RSS User interface - + Настройки интерфейса пользователя Language: - + Язык: (Requires restart) - + (Требует перезагрузки) Visual style: - + Визуальный стиль: System default - + Системная тема Plastique style (KDE like) - + Стиль пластик (как KDE) Cleanlooks style (Gnome like) - + Свободный стиль (как в GNOME) Motif style (Unix like) - + Стиль Motif (на Unix-подобных системах) CDE style (Common Desktop Environment like) - + Стиль CDE (как Окружение Общего Рабочего Стола) Ask for confirmation on exit when download list is not empty - + Спрашивать о подтверждении выхода, если список закачек не пустой Display top toolbar - + Показать верхнюю панель Disable splash screen - + Отключить заставку при загрузке Display current speed in title bar - + Отображать текущую скорость в полосе заголовка Transfer list - + Список передач Refresh interval: - + Интервал обновления: ms - + мс Use alternating row colors In transfer list, one every two rows will have grey background. - + Использовать альтернативные цвета строк Action on double click: Action executed when doucle-clicking on an item in transfer (download/upload) list - + Действие по двойному щелчку: Downloading: - + Скачивание: Start/Stop - + Начать/Остановить Open folder - + Открыть папку Completed: - + Завершено: System tray icon - + Значок в системном лотке Disable system tray icon - + Убрать значок из системного лотка Close to tray i.e: The systray tray icon will still be visible when closing the main window. - + Свернуть в значок при закрытии Minimize to tray - + Сворачивать в значок Start minimized - + Запускать свернутым Show notification balloons in tray - + Показывать всплывающие сообщения в системном лотке File system - + Файловая система QGroupBox::title { @@ -3254,319 +3262,319 @@ margin-left: -3px; QGroupBox { border-width: 0; } - + Destination Folder: - + Папка назначения: Append the torrent's label - + Добавить метку для торрента Use a different folder for incomplete downloads: - + Использовать другую папку для незаконченых загрузок: QLineEdit { margin-left: 23px; } - + Automatically load .torrent files from: - + Автоматически загружать торренты из: Append .!qB extension to incomplete files - + Добавить расширение .!qB к незаконченым файлам Pre-allocate all files - + Резервировать место для всего файла Disk cache: - + Дисковый кеш: MiB (advanced) - + МиБ (расширеный) Torrent queueing - + Очереди Torrent Enable queueing system - + Включить очереди torrent Maximum active downloads: - + Максимальное число активных закачек: Maximum active uploads: - + Максимальное число активных раздач: Maximum active torrents: - + Максимальное число активных torrent: When adding a torrent - + При добавлении торента Display torrent content and some options - + Отображать содержимое torrentа и некоторые настройки Do not start download automatically The torrent will be added to download list in pause state - + Не начинать загрузку автоматически Listening port - + Прослушивание порта Port used for incoming connections: - + Порт, используемый для входящих соединений: Random - + Случайно Enable UPnP port mapping - + Включить распределение портов UPnP Enable NAT-PMP port mapping - + Включить распределение портов NAT-PMP Connections limit - + Ограничение соединений Global maximum number of connections: - + Общее ограничение на число соединений: Maximum number of connections per torrent: - + Максимальное число соединений на torrent: Maximum number of upload slots per torrent: - + Максимальное количество слотов отдачи на torrent: Global bandwidth limiting - + Общее ограничение канала Upload: - + Отдача: Download: - + Загрузка: KiB/s - + КиБ/с Peer connections - + Соединения с пирами Resolve peer countries - + Определить страну пира Resolve peer host names - + Определить имя хоста пира Bittorrent features - + Возможности Bittorrent Enable DHT network (decentralized) - + Включить DHT сеть (децентрализованную) Use a different port for DHT and Bittorrent - + Использовать разные порты для DHT и Bittorrent DHT port: - + Порт DHT: Enable Peer Exchange / PeX (requires restart) - + Включить Обмен пирами / (PeX) (требует перезагрузки) Enable Local Peer Discovery - + Включить обнаружение локальных пиров Encryption: - + Шифрование: Enabled - + Включено Forced - + Принудительно Disabled - + Выключено Share ratio settings - + Настройки коэффициента раздачи Desired ratio: - + Предпочитаемое соотношение: Remove finished torrents when their ratio reaches: - + Удалять законченные torrentы когда их соотношение раздачи достигнет: Type: - + Тип: (None) - + (нет) HTTP - + HTTP Port: - + Порт: Authentication - + Аутентификация Username: - + Имя пользователя: Password: - + Пароль: SOCKS5 - + Сервер SOCKS5 Filter Settings - + Настройки фильтра Activate IP Filtering - + Включить фильтр по IP Enable Web User Interface - + Включить Web интерфейс HTTP Server - + HTTP сервер Enable RSS support - + Включить поддержку RSS RSS settings - + Настройки RSS RSS feeds refresh interval: - + Интервал обновления RSS каналов: minutes - + минут Maximum number of articles per feed: - + Максимальное число статей на канал: Filter path (.dat, .p2p, .p2b): - + Путь к фильтрам (.dat, .p2p, .p2b): HTTP Communications (trackers, Web seeds, search engine) - + HTTP Связи (трекеры, раздающие Web, поисковые движки) Host: - + Хост: Peer Communications - + Связи с пирами SOCKS4 - + Сервер SOCKS4 Client whitelisting workaround - + Белый список клиентов Identify as: - + Представляться как: qBittorrent - + qBittorrent Vuze - + µTorrent - + Version: - + Версия: Build: Software Build nulmber: - + Сборка: Reset to latest software version - + Вернуться к последней версии программы KTorrent - + @@ -3824,43 +3832,43 @@ QGroupBox { Rename... - + Переименовать... New name: - + Новое имя: The file could not be renamed - + Файл не может быть переименован This name is already in use in this folder. Please use a different name. - + Файл с таким именем уже существует в этой папке. Используйте другое имя. The folder could not be renamed - + Папка не может быть переименована Rename the file - + Переименовать файл This file name contains forbidden characters, please choose a different one. - + Имя файла содержит недопустимые символы. Пожалуйста, выберите другое. I/O Error - + Ошибка ввода/вывода This file does not exist yet. - + Этот файл пока не существует. This folder does not exist yet. - + Эта папка пока не существует. @@ -4413,7 +4421,7 @@ Changelog: Offline. This usually means that qBittorrent failed to listen on the selected port for incoming connections. - + Отключен. Обычно это означает, что qBittorrent не может прослушивать выбранный порт для входящих соединений. @@ -4506,31 +4514,31 @@ Changelog: µTorrent compatible list URL: - + URL списка совместимого с µTorrent: I/O Error - + Ошибка ввода/вывода Error while trying to open the downloaded file. - + Ошибеп при открытии скачанного файла. No change - + Без изменений No additional trackers were found. - + Дополнительных трекеров не найдено. Download error - + Ошибка при скачивании The trackers list could not be downloaded, reason: %1 - + Список трекеров не может быть скачан. Причина: %1 @@ -4597,35 +4605,35 @@ Changelog: All labels - + Все метки Unlabeled - + Без метки Remove label - + Удалить метку Add label - + Добавить метку New Label - + Новая метка Label: - + Метка: Invalid label name - + Неправильное имя метки Please don't use any special characters in the label name. - + Пожалуйста, не используйте специальные символы в имени метки. @@ -4790,45 +4798,45 @@ Changelog: Label - + Метка New Label - + Новая метка Label: - + Метка: New... New label... - + Новая... Reset Reset label - + Восстановить метку Rename - + Переименовать New name: - + Новое имя: Rename... - + Переименовать... Invalid label name - + Неправильное имя метки Please don't use any special characters in the label name. - + Пожалуйста, не используйте специальные символы в имени метки. @@ -4898,27 +4906,27 @@ Changelog: UsageDisplay Usage: - + Использование: displays program version - + показать версию программы disable splash screen - + показать заставку при загрузке displays this help message - + показать эту справку changes the webui port (current: %1) - + Изменить порт Web интерфейса (сейчас: %1) [files or urls]: downloads the torrents passed by the user (optional) - + [файлы или ссылки]: скачать торренты указанные пользователем (опционально) @@ -5055,7 +5063,7 @@ Changelog: Label: - + Метка: @@ -5528,7 +5536,7 @@ Changelog: Only one URL per line - Толко один URL в строке + Только один URL в строке Download @@ -6885,47 +6893,47 @@ However, those plugins were disabled. Rename... - + Переименовать... New name: - + Новое имя: The file could not be renamed - + Файл не может быть переименован This name is already in use in this folder. Please use a different name. - + Файл с таким именем уже существует в этой папке. Используйте другое имя. The folder could not be renamed - + Папка не может быть переименована Rename the file - + Переименовать файл Unable to decode magnet link: - + Невозможно декодировать ссылку magnet: Magnet Link - + Ссылка magnet Invalid label name - + Неправильное имя метки Please don't use any special characters in the label name. - + Пожалуйста, не используйте специальные символы в имени метки. This file name contains forbidden characters, please choose a different one. - + Имя файла содержит недопустимые символы. Пожалуйста, выберите другое. diff --git a/src/transferlistwidget.cpp b/src/transferlistwidget.cpp index 75dff4e59..8c3b6f5c3 100644 --- a/src/transferlistwidget.cpp +++ b/src/transferlistwidget.cpp @@ -760,8 +760,9 @@ void TransferListWidget::recheckSelectedTorrents() { foreach(const QModelIndex &index, selectedIndexes){ QString hash = getHashFromRow(mapToSource(index).row()); QTorrentHandle h = BTSession->getTorrentHandle(hash); - if(h.is_valid() && h.has_metadata()) - h.force_recheck(); + if(h.is_valid()) { + BTSession->recheckTorrent(h.hash()); + } } }