Compare commits
3 Commits
release-2.
...
release-2.
Author | SHA1 | Date | |
---|---|---|---|
![]() |
c7736dd422 | ||
![]() |
5ab38a9de8 | ||
![]() |
2afed45400 |
@@ -1,10 +1,3 @@
|
||||
* Unreleased - Christophe Dumez <chris@qbittorrent.org> - v2.4.0
|
||||
- FEATURE: Added actions to "Move to top/bottom" of priority queue
|
||||
- FEATURE: Auto-Shutdown on downloads completion
|
||||
- FEATURE: Email notification on download completion
|
||||
- FEATURE: Added button to password-lock the UI
|
||||
- FEATURE: Added label-level Pause/Resume/Delete actions
|
||||
|
||||
* Tue Jul 27 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.3.0
|
||||
- FEATURE: Simplified torrent root folder renaming/truncating (< v2.3.0 is no longer forward compatible)
|
||||
- FEATURE: Remember previous save paths in torrent addition dialog
|
||||
|
88
src/GUI.cpp
@@ -83,7 +83,7 @@ using namespace libtorrent;
|
||||
// Constructor
|
||||
GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), force_exit(false) {
|
||||
setupUi(this);
|
||||
ui_locked = Preferences::isUILocked();
|
||||
|
||||
setWindowTitle(tr("qBittorrent %1", "e.g: qBittorrent v0.x").arg(QString::fromUtf8(VERSION)));
|
||||
displaySpeedInTitle = Preferences::speedInTitleBar();
|
||||
// Setting icons
|
||||
@@ -107,11 +107,6 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), for
|
||||
actionSet_global_upload_limit->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/seeding.png")));
|
||||
actionSet_global_download_limit->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/download.png")));
|
||||
actionDocumentation->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/qb_question.png")));
|
||||
actionLock_qBittorrent->setIcon(QIcon(QString::fromUtf8(":/Icons/oxygen/encrypted32.png")));
|
||||
QMenu *lockMenu = new QMenu();
|
||||
QAction *defineUiLockPasswdAct = lockMenu->addAction(tr("Set the password..."));
|
||||
connect(defineUiLockPasswdAct, SIGNAL(triggered()), this, SLOT(defineUILockPassword()));
|
||||
actionLock_qBittorrent->setMenu(lockMenu);
|
||||
prioSeparator = toolBar->insertSeparator(actionDecreasePriority);
|
||||
prioSeparator2 = menu_Edit->insertSeparator(actionDecreasePriority);
|
||||
prioSeparator->setVisible(false);
|
||||
@@ -165,6 +160,10 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), for
|
||||
|
||||
// Configure BT session according to options
|
||||
loadPreferences(false);
|
||||
// Resume unfinished torrents
|
||||
BTSession->startUpTorrents();
|
||||
// Add torrent given on command line
|
||||
processParams(torrentCmdLine);
|
||||
|
||||
// Start connection checking timer
|
||||
guiUpdater = new QTimer(this);
|
||||
@@ -188,7 +187,6 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), for
|
||||
actionSearch_engine->setChecked(Preferences::isSearchEnabled());
|
||||
displaySearchTab(actionSearch_engine->isChecked());
|
||||
displayRSSTab(actionRSS_Reader->isChecked());
|
||||
actionShutdown_when_downloads_complete->setChecked(Preferences::shutdownWhenDownloadsComplete());
|
||||
|
||||
show();
|
||||
|
||||
@@ -205,18 +203,10 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), for
|
||||
}while(transferListFilters->getStatusFilters()->verticalScrollBar()->sliderPosition() > 0);
|
||||
transferListFilters->getStatusFilters()->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
|
||||
if(ui_locked) {
|
||||
hide();
|
||||
} else {
|
||||
if(Preferences::startMinimized())
|
||||
showMinimized();
|
||||
if(Preferences::startMinimized()) {
|
||||
showMinimized();
|
||||
}
|
||||
|
||||
// Resume unfinished torrents
|
||||
BTSession->startUpTorrents();
|
||||
// Add torrent given on command line
|
||||
processParams(torrentCmdLine);
|
||||
|
||||
qDebug("GUI Built");
|
||||
#ifdef Q_WS_WIN
|
||||
if(!Preferences::neverCheckFileAssoc() && !Preferences::isFileAssocOk()) {
|
||||
@@ -286,8 +276,10 @@ GUI::~GUI() {
|
||||
delete switchTransferShortcut;
|
||||
delete switchRSSShortcut;
|
||||
// Delete BTSession objects
|
||||
qDebug("Deleting BTSession");
|
||||
delete BTSession;
|
||||
// Deleting remaining top level widgets
|
||||
qDebug("Deleting remaining top level widgets");
|
||||
|
||||
// May freeze for a few seconds after the next line
|
||||
// because the Bittorrent session proxy will
|
||||
// actually be deleted now and destruction
|
||||
@@ -295,34 +287,6 @@ GUI::~GUI() {
|
||||
qDebug("Exiting GUI destructor...");
|
||||
}
|
||||
|
||||
void GUI::defineUILockPassword() {
|
||||
QString old_pass_md5 = Preferences::getUILockPasswordMD5();
|
||||
if(old_pass_md5.isNull()) old_pass_md5 = "";
|
||||
bool ok = false;
|
||||
QString new_clear_password = QInputDialog::getText(this, tr("UI lock password"), tr("Please type the UI lock password:"), QLineEdit::Password, old_pass_md5, &ok);
|
||||
if(ok) {
|
||||
if(new_clear_password != old_pass_md5) {
|
||||
Preferences::setUILockPassword(new_clear_password);
|
||||
}
|
||||
QMessageBox::information(this, tr("Password update"), tr("The UI lock password has been successfully updated"));
|
||||
}
|
||||
}
|
||||
|
||||
void GUI::on_actionLock_qBittorrent_triggered() {
|
||||
// Check if there is a password
|
||||
if(Preferences::getUILockPasswordMD5().isEmpty()) {
|
||||
// Ask for a password
|
||||
bool ok = false;
|
||||
QString clear_password = QInputDialog::getText(this, tr("UI lock password"), tr("Please type the UI lock password:"), QLineEdit::Password, "", &ok);
|
||||
if(!ok) return;
|
||||
Preferences::setUILockPassword(clear_password);
|
||||
}
|
||||
// Lock the interface
|
||||
ui_locked = true;
|
||||
Preferences::setUILocked(true);
|
||||
hide();
|
||||
}
|
||||
|
||||
void GUI::displayRSSTab(bool enable) {
|
||||
if(enable) {
|
||||
// RSS tab
|
||||
@@ -564,32 +528,10 @@ void GUI::setTabText(int index, QString text) const {
|
||||
tabs->setTabText(index, text);
|
||||
}
|
||||
|
||||
bool GUI::unlockUI() {
|
||||
bool ok = false;
|
||||
QString clear_password = QInputDialog::getText(this, tr("UI lock password"), tr("Please type the UI lock password:"), QLineEdit::Password, "", &ok);
|
||||
if(!ok) return false;
|
||||
QString real_pass_md5 = Preferences::getUILockPasswordMD5();
|
||||
QCryptographicHash md5(QCryptographicHash::Md5);
|
||||
md5.addData(clear_password.toLocal8Bit());
|
||||
QString password_md5 = md5.result().toHex();
|
||||
if(real_pass_md5 == password_md5) {
|
||||
ui_locked = false;
|
||||
Preferences::setUILocked(false);
|
||||
return true;
|
||||
}
|
||||
QMessageBox::warning(this, tr("Invalid password"), tr("The password is invalid"));
|
||||
return false;
|
||||
}
|
||||
|
||||
// Toggle Main window visibility
|
||||
void GUI::toggleVisibility(QSystemTrayIcon::ActivationReason e) {
|
||||
if(e == QSystemTrayIcon::Trigger || e == QSystemTrayIcon::DoubleClick) {
|
||||
if(isHidden()) {
|
||||
if(ui_locked) {
|
||||
// Ask for UI lock password
|
||||
if(!unlockUI())
|
||||
return;
|
||||
}
|
||||
show();
|
||||
if(isMinimized()) {
|
||||
if(isMaximized()) {
|
||||
@@ -796,8 +738,8 @@ void GUI::on_actionOpen_triggered() {
|
||||
// Open File Open Dialog
|
||||
// Note: it is possible to select more than one file
|
||||
const QStringList pathsList = QFileDialog::getOpenFileNames(0,
|
||||
tr("Open Torrent Files"), settings.value(QString::fromUtf8("MainWindowLastDir"), QDir::homePath()).toString(),
|
||||
tr("Torrent Files")+QString::fromUtf8(" (*.torrent)"));
|
||||
tr("Open Torrent Files"), settings.value(QString::fromUtf8("MainWindowLastDir"), QDir::homePath()).toString(),
|
||||
tr("Torrent Files")+QString::fromUtf8(" (*.torrent)"));
|
||||
if(!pathsList.empty()) {
|
||||
const bool useTorrentAdditionDialog = settings.value(QString::fromUtf8("Preferences/Downloads/AdditionDialog"), true).toBool();
|
||||
const uint listSize = pathsList.size();
|
||||
@@ -879,7 +821,6 @@ void GUI::loadPreferences(bool configure_session) {
|
||||
BTSession->addConsoleMessage(tr("Options were saved successfully."));
|
||||
#ifndef Q_WS_MAC
|
||||
const bool newSystrayIntegration = Preferences::systrayIntegration();
|
||||
actionLock_qBittorrent->setEnabled(newSystrayIntegration);
|
||||
if(newSystrayIntegration != (systrayIcon!=0)) {
|
||||
if(newSystrayIntegration) {
|
||||
// create the trayicon
|
||||
@@ -1125,11 +1066,6 @@ void GUI::on_actionTop_tool_bar_triggered() {
|
||||
Preferences::setToolbarDisplayed(is_visible);
|
||||
}
|
||||
|
||||
void GUI::on_actionShutdown_when_downloads_complete_triggered() {
|
||||
bool is_checked = static_cast<QAction*>(sender())->isChecked();
|
||||
Preferences::setShutdownWhenDownloadsComplete(is_checked);
|
||||
}
|
||||
|
||||
void GUI::on_actionSpeed_in_title_bar_triggered() {
|
||||
displaySpeedInTitle = static_cast<QAction*>(sender())->isChecked();
|
||||
Preferences::showSpeedInTitleBar(displaySpeedInTitle);
|
||||
|
@@ -69,7 +69,6 @@ public:
|
||||
QWidget* getCurrentTabWidget() const;
|
||||
TransferListWidget* getTransferList() const { return transferList; }
|
||||
QMenu* getTrayIconMenu();
|
||||
PropertiesWidget *getProperties() const { return properties; }
|
||||
|
||||
public slots:
|
||||
void trackerAuthenticationRequired(QTorrentHandle& h);
|
||||
@@ -98,9 +97,6 @@ protected slots:
|
||||
void handleDownloadFromUrlFailure(QString, QString) const;
|
||||
void createSystrayDelayed();
|
||||
void tab_changed(int);
|
||||
void on_actionLock_qBittorrent_triggered();
|
||||
void defineUILockPassword();
|
||||
bool unlockUI();
|
||||
// Keyboard shortcuts
|
||||
void createKeyboardShortcuts();
|
||||
void displayTransferTab() const;
|
||||
@@ -154,7 +150,6 @@ private:
|
||||
PropertiesWidget *properties;
|
||||
bool displaySpeedInTitle;
|
||||
bool force_exit;
|
||||
bool ui_locked;
|
||||
// Keyboard shortcuts
|
||||
QShortcut *switchSearchShortcut;
|
||||
QShortcut *switchSearchShortcut2;
|
||||
@@ -175,7 +170,6 @@ private slots:
|
||||
void on_actionRSS_Reader_triggered();
|
||||
void on_actionSpeed_in_title_bar_triggered();
|
||||
void on_actionTop_tool_bar_triggered();
|
||||
void on_actionShutdown_when_downloads_complete_triggered();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 1.0 KiB |
Before Width: | Height: | Size: 892 B |
Before Width: | Height: | Size: 996 B |
Before Width: | Height: | Size: 929 B |
@@ -1,6 +1,6 @@
|
||||
[Desktop Entry]
|
||||
Categories=Qt;Network;P2P;
|
||||
Comment=V2.4.0
|
||||
Comment=V2.3.0
|
||||
Exec=qbittorrent %f
|
||||
GenericName=Bittorrent client
|
||||
GenericName[ar]=العميل Bittorrent
|
||||
|
Before Width: | Height: | Size: 54 B |
Before Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 79 KiB |
@@ -47,7 +47,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>2.4.0</string>
|
||||
<string>2.3.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
|
@@ -47,6 +47,7 @@ class about : public QDialog, private Ui::AboutDlg{
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
// Set icons
|
||||
logo->setPixmap(QPixmap(QString::fromUtf8(":/Icons/skin/qbittorrent22.png")));
|
||||
mascot_lbl->setPixmap(QPixmap(QString::fromUtf8(":/Icons/skin/mascot.png")));
|
||||
//Title
|
||||
lb_name->setText(QString::fromUtf8("<b><h1>")+tr("qBittorrent")+QString::fromUtf8(" "VERSION"</h1></b>"));
|
||||
// Thanks
|
||||
|
@@ -36,7 +36,6 @@
|
||||
#include <QNetworkAddressEntry>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "smtp.h"
|
||||
#include "filesystemwatcher.h"
|
||||
#include "bittorrent.h"
|
||||
#include "misc.h"
|
||||
@@ -204,7 +203,7 @@ bool Bittorrent::isPexEnabled() const {
|
||||
void Bittorrent::processBigRatios() {
|
||||
if(ratio_limit <= 0) return;
|
||||
qDebug("Process big ratios...");
|
||||
std::vector<torrent_handle> torrents = s->get_torrents();
|
||||
std::vector<torrent_handle> torrents = getTorrents();
|
||||
std::vector<torrent_handle>::iterator torrentIT;
|
||||
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
|
||||
const QTorrentHandle h(*torrentIT);
|
||||
@@ -367,7 +366,7 @@ void Bittorrent::configureSession() {
|
||||
geoipDBLoaded = true;
|
||||
}
|
||||
// Update torrent handles
|
||||
std::vector<torrent_handle> torrents = s->get_torrents();
|
||||
std::vector<torrent_handle> torrents = getTorrents();
|
||||
std::vector<torrent_handle>::iterator torrentIT;
|
||||
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
|
||||
QTorrentHandle h = QTorrentHandle(*torrentIT);
|
||||
@@ -701,13 +700,17 @@ qlonglong Bittorrent::getETA(QString hash) {
|
||||
return (qlonglong) floor((double) (bytes_left) / avg_speed);
|
||||
}
|
||||
|
||||
std::vector<torrent_handle> Bittorrent::getTorrents() const {
|
||||
return s->get_torrents();
|
||||
}
|
||||
|
||||
// Return the torrent handle, given its hash
|
||||
QTorrentHandle Bittorrent::getTorrentHandle(QString hash) const{
|
||||
return QTorrentHandle(s->find_torrent(misc::QStringToSha1(hash)));
|
||||
}
|
||||
|
||||
bool Bittorrent::hasActiveTorrents() const {
|
||||
std::vector<torrent_handle> torrents = s->get_torrents();
|
||||
std::vector<torrent_handle> torrents = getTorrents();
|
||||
std::vector<torrent_handle>::iterator torrentIT;
|
||||
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
|
||||
const QTorrentHandle h(*torrentIT);
|
||||
@@ -717,21 +720,6 @@ bool Bittorrent::hasActiveTorrents() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Bittorrent::hasDownloadingTorrents() const {
|
||||
std::vector<torrent_handle> torrents = s->get_torrents();
|
||||
std::vector<torrent_handle>::iterator torrentIT;
|
||||
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
|
||||
if(torrentIT->is_valid()) {
|
||||
try {
|
||||
const torrent_status::state_t state = torrentIT->status().state;
|
||||
if(state != torrent_status::finished && state != torrent_status::seeding)
|
||||
return true;
|
||||
} catch(std::exception) {}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Bittorrent::banIP(QString ip) {
|
||||
FilterParserThread::processFilterList(s, QStringList(ip));
|
||||
Preferences::banIP(ip);
|
||||
@@ -775,7 +763,7 @@ void Bittorrent::deleteTorrent(QString hash, bool delete_local_files) {
|
||||
}
|
||||
|
||||
void Bittorrent::pauseAllTorrents() {
|
||||
std::vector<torrent_handle> torrents = s->get_torrents();
|
||||
std::vector<torrent_handle> torrents = getTorrents();
|
||||
std::vector<torrent_handle>::iterator torrentIT;
|
||||
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
|
||||
QTorrentHandle h = QTorrentHandle(*torrentIT);
|
||||
@@ -787,12 +775,8 @@ void Bittorrent::pauseAllTorrents() {
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<torrent_handle> Bittorrent::getTorrents() const {
|
||||
return s->get_torrents();
|
||||
}
|
||||
|
||||
void Bittorrent::resumeAllTorrents() {
|
||||
std::vector<torrent_handle> torrents = s->get_torrents();
|
||||
std::vector<torrent_handle> torrents = getTorrents();
|
||||
std::vector<torrent_handle>::iterator torrentIT;
|
||||
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
|
||||
QTorrentHandle h = QTorrentHandle(*torrentIT);
|
||||
@@ -857,7 +841,7 @@ QTorrentHandle Bittorrent::addMagnetUri(QString magnet_uri, bool resumed) {
|
||||
if (load_file(fastresume_path.toLocal8Bit().constData(), buf) == 0) {
|
||||
fastResume = true;
|
||||
p.resume_data = &buf;
|
||||
qDebug("Successfully loaded");
|
||||
qDebug("Successfuly loaded");
|
||||
}
|
||||
}
|
||||
QString torrent_name = misc::magnetUriToName(magnet_uri);
|
||||
@@ -1103,7 +1087,7 @@ QTorrentHandle Bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
|
||||
if (load_file(fastresume_path.toLocal8Bit().constData(), buf) == 0) {
|
||||
fastResume = true;
|
||||
p.resume_data = &buf;
|
||||
qDebug("Successfully loaded");
|
||||
qDebug("Successfuly loaded");
|
||||
}
|
||||
}
|
||||
QString savePath;
|
||||
@@ -1676,7 +1660,7 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
|
||||
if(temppath.isEmpty()) {
|
||||
// Disabling temp dir
|
||||
// Moving all torrents to their destination folder
|
||||
std::vector<torrent_handle> torrents = s->get_torrents();
|
||||
std::vector<torrent_handle> torrents = getTorrents();
|
||||
std::vector<torrent_handle>::iterator torrentIT;
|
||||
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
|
||||
QTorrentHandle h = QTorrentHandle(*torrentIT);
|
||||
@@ -1686,7 +1670,7 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
|
||||
} else {
|
||||
qDebug("Enabling default temp path...");
|
||||
// Moving all downloading torrents to temporary save path
|
||||
std::vector<torrent_handle> torrents = s->get_torrents();
|
||||
std::vector<torrent_handle> torrents = getTorrents();
|
||||
std::vector<torrent_handle>::iterator torrentIT;
|
||||
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
|
||||
QTorrentHandle h = QTorrentHandle(*torrentIT);
|
||||
@@ -1768,7 +1752,7 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
|
||||
appendLabelToSavePath = !appendLabelToSavePath;
|
||||
if(appendLabelToSavePath) {
|
||||
// Move torrents storage to sub folder with label name
|
||||
std::vector<torrent_handle> torrents = s->get_torrents();
|
||||
std::vector<torrent_handle> torrents = getTorrents();
|
||||
std::vector<torrent_handle>::iterator torrentIT;
|
||||
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
|
||||
QTorrentHandle h = QTorrentHandle(*torrentIT);
|
||||
@@ -1783,7 +1767,7 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
|
||||
if(appendqBExtension != append) {
|
||||
appendqBExtension = !appendqBExtension;
|
||||
// append or remove .!qB extension for incomplete files
|
||||
std::vector<torrent_handle> torrents = s->get_torrents();
|
||||
std::vector<torrent_handle> torrents = getTorrents();
|
||||
std::vector<torrent_handle>::iterator torrentIT;
|
||||
for(torrentIT = torrents.begin(); torrentIT != torrents.end(); torrentIT++) {
|
||||
QTorrentHandle h = QTorrentHandle(*torrentIT);
|
||||
@@ -1968,16 +1952,6 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
|
||||
}
|
||||
}
|
||||
}
|
||||
void Bittorrent::sendNotificationEmail(QTorrentHandle h) {
|
||||
// Prepare mail content
|
||||
QString content = tr("Torrent name: %1").arg(h.name()) + "\n";
|
||||
content += tr("Torrent size: %1").arg(misc::friendlyUnit(h.actual_size())) + "\n";
|
||||
content += tr("Save path: %1").arg(TorrentPersistentData::getSavePath(h.hash())) + "\n\n";
|
||||
content += tr("The torrent was downloaded in %1.", "The torrent was downloaded in 1 hour and 20 seconds").arg(misc::userFriendlyDuration(h.active_time())) + "\n\n\n";
|
||||
content += tr("Thank you for using qBittorrent.") + "\n";
|
||||
// Send the notification email
|
||||
new Smtp("notification@qbittorrent.org", Preferences::getMailNotificationEmail(), tr("[qBittorrent] %1 has finished downloading").arg(h.name()), content);
|
||||
}
|
||||
|
||||
// Read alerts sent by the Bittorrent session
|
||||
void Bittorrent::readAlerts() {
|
||||
@@ -2039,27 +2013,6 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
|
||||
TorrentPersistentData::saveSeedStatus(h);
|
||||
}
|
||||
qDebug("Received finished alert for %s", qPrintable(h.name()));
|
||||
if(!was_already_seeded) {
|
||||
// Mail notification
|
||||
if(Preferences::isMailNotificationEnabled())
|
||||
sendNotificationEmail(h);
|
||||
// Auto-Shutdown
|
||||
if(Preferences::shutdownWhenDownloadsComplete() && !hasDownloadingTorrents()) {
|
||||
qDebug("Preparing for auto-shutdown because all downloads are complete!");
|
||||
#if LIBTORRENT_VERSION_MINOR < 15
|
||||
saveDHTEntry();
|
||||
#endif
|
||||
qDebug("Saving session state");
|
||||
saveSessionState();
|
||||
qDebug("Saving fast resume data");
|
||||
saveFastResumeData();
|
||||
qDebug("Sending computer shutdown signal");
|
||||
misc::shutdownComputer();
|
||||
qDebug("Exiting the application");
|
||||
qApp->exit();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (save_resume_data_alert* p = dynamic_cast<save_resume_data_alert*>(a.get())) {
|
||||
|
@@ -108,7 +108,6 @@ public:
|
||||
session* getSession() const;
|
||||
QHash<QString, TrackerInfos> getTrackersInfo(QString hash) const;
|
||||
bool hasActiveTorrents() const;
|
||||
bool hasDownloadingTorrents() const;
|
||||
bool isQueueingEnabled() const;
|
||||
int getMaximumActiveDownloads() const;
|
||||
int getMaximumActiveTorrents() const;
|
||||
@@ -200,7 +199,6 @@ protected slots:
|
||||
void takeETASamples();
|
||||
void exportTorrentFiles(QString path);
|
||||
void saveTempFastResumeData();
|
||||
void sendNotificationEmail(QTorrentHandle h);
|
||||
|
||||
signals:
|
||||
void addedTorrent(QTorrentHandle& h);
|
||||
|
@@ -50,7 +50,6 @@
|
||||
#include "torrentpersistentdata.h"
|
||||
#include "createtorrent_imp.h"
|
||||
#include "misc.h"
|
||||
#include "qinisettings.h"
|
||||
|
||||
using namespace libtorrent;
|
||||
using namespace boost::filesystem;
|
||||
@@ -81,11 +80,8 @@ createtorrent::~createtorrent() {
|
||||
}
|
||||
|
||||
void createtorrent::on_addFolder_button_clicked(){
|
||||
QIniSettings settings("qBittorrent", "qBittorrent");
|
||||
QString last_path = settings.value("CreateTorrent/last_add_path", QDir::homePath()).toString();
|
||||
QString dir = QFileDialog::getExistingDirectory(this, tr("Select a folder to add to the torrent"), last_path, QFileDialog::ShowDirsOnly);
|
||||
QString dir = QFileDialog::getExistingDirectory(this, tr("Select a folder to add to the torrent"), QDir::homePath(), QFileDialog::ShowDirsOnly);
|
||||
if(!dir.isEmpty()) {
|
||||
settings.setValue("CreateTorrent/last_add_path", dir);
|
||||
#if defined(Q_WS_WIN) || defined(Q_OS_OS2)
|
||||
dir = dir.replace("/", "\\");
|
||||
#endif
|
||||
@@ -94,11 +90,8 @@ void createtorrent::on_addFolder_button_clicked(){
|
||||
}
|
||||
|
||||
void createtorrent::on_addFile_button_clicked(){
|
||||
QIniSettings settings("qBittorrent", "qBittorrent");
|
||||
QString last_path = settings.value("CreateTorrent/last_add_path", QDir::homePath()).toString();
|
||||
QString file = QFileDialog::getOpenFileName(this, tr("Select a file to add to the torrent"), last_path);
|
||||
QString file = QFileDialog::getOpenFileName(this, tr("Select a file to add to the torrent"), QDir::homePath());
|
||||
if(!file.isEmpty()) {
|
||||
settings.setValue("CreateTorrent/last_add_path", misc::removeLastPathPart(file));
|
||||
#if defined(Q_WS_WIN) || defined(Q_OS_OS2)
|
||||
file = file.replace("/", "\\");
|
||||
#endif
|
||||
@@ -184,14 +177,14 @@ void createtorrent::on_createButton_clicked(){
|
||||
return;
|
||||
}
|
||||
QStringList trackers = allItems(trackers_list);
|
||||
|
||||
QIniSettings settings("qBittorrent", "qBittorrent");
|
||||
QString last_path = settings.value("CreateTorrent/last_save_path", QDir::homePath()).toString();
|
||||
|
||||
QString destination = QFileDialog::getSaveFileName(this, tr("Select destination torrent file"), last_path, tr("Torrent Files")+QString::fromUtf8(" (*.torrent)"));
|
||||
/*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()) {
|
||||
settings.setValue("CreateTorrent/last_save_path", misc::removeLastPathPart(destination));
|
||||
destination += QString::fromUtf8(".torrent");
|
||||
if(!destination.endsWith(QString::fromUtf8(".torrent")))
|
||||
destination += QString::fromUtf8(".torrent");
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
@@ -163,12 +163,6 @@ void EventManager::setGlobalPreferences(QVariantMap m) const {
|
||||
}
|
||||
if(m.contains("export_dir"))
|
||||
Preferences::setExportDir(m["export_dir"].toString());
|
||||
if(m.contains("mail_notification_enabled"))
|
||||
Preferences::setMailNotificationEnabled(m["mail_notification_enabled"].toBool());
|
||||
if(m.contains("mail_notification_email"))
|
||||
Preferences::setMailNotificationEmail(m["mail_notification_email"].toString());
|
||||
if(m.contains("mail_notification_smtp"))
|
||||
Preferences::setMailNotificationSMTP(m["mail_notification_smtp"].toString());
|
||||
if(m.contains("preallocate_all"))
|
||||
Preferences::preAllocateAllFiles(m["preallocate_all"].toBool());
|
||||
if(m.contains("queueing_enabled"))
|
||||
@@ -271,9 +265,6 @@ QVariantMap EventManager::getGlobalPreferences() const {
|
||||
data["download_in_scan_dirs"] = var_list;
|
||||
data["export_dir_enabled"] = Preferences::isTorrentExportEnabled();
|
||||
data["export_dir"] = Preferences::getExportDir();
|
||||
data["mail_notification_enabled"] = Preferences::isMailNotificationEnabled();
|
||||
data["mail_notification_email"] = Preferences::getMailNotificationEmail();
|
||||
data["mail_notification_smtp"] = Preferences::getMailNotificationSMTP();
|
||||
data["preallocate_all"] = Preferences::preAllocateAllFiles();
|
||||
data["queueing_enabled"] = Preferences::isQueueingSystemEnabled();
|
||||
data["max_active_downloads"] = Preferences::getMaxActiveDownloads();
|
||||
|
@@ -202,13 +202,8 @@ signals:
|
||||
private:
|
||||
void addTorrentsFromDir(const QDir &dir, QStringList &torrents) {
|
||||
const QStringList files = dir.entryList(filters, QDir::Files, QDir::Unsorted);
|
||||
foreach(const QString &file, files) {
|
||||
#if defined(Q_WS_WIN) || defined(Q_OS_OS2)
|
||||
torrents << dir.absoluteFilePath(file).replace("/", "\\");
|
||||
#else
|
||||
torrents << dir.absoluteFilePath(file);
|
||||
#endif
|
||||
}
|
||||
foreach(const QString &file, files)
|
||||
torrents << dir.canonicalPath() + '/' + file;
|
||||
}
|
||||
|
||||
};
|
||||
|
@@ -161,7 +161,7 @@ void HttpConnection::respond() {
|
||||
write();
|
||||
return;
|
||||
}
|
||||
// Client successfully authenticated, reset number of failed attempts
|
||||
// Client sucessfuly authenticated, reset number of failed attempts
|
||||
parent->resetNbFailedAttemptsForIp(peer_ip);
|
||||
QString url = parser.url();
|
||||
// Favicon
|
||||
@@ -500,16 +500,6 @@ void HttpConnection::respondCommand(QString command)
|
||||
if(h.is_valid()) h.queue_position_down();
|
||||
return;
|
||||
}
|
||||
if(command == "topPrio") {
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(parser.post("hash"));
|
||||
if(h.is_valid()) h.queue_position_top();
|
||||
return;
|
||||
}
|
||||
if(command == "bottomPrio") {
|
||||
QTorrentHandle h = BTSession->getTorrentHandle(parser.post("hash"));
|
||||
if(h.is_valid()) h.queue_position_bottom();
|
||||
return;
|
||||
}
|
||||
if(command == "recheck"){
|
||||
recheckTorrent(parser.post("hash"));
|
||||
return;
|
||||
|
307
src/icons.qrc
52
src/lang.qrc
@@ -1,34 +1,34 @@
|
||||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource>
|
||||
<file>lang/qbittorrent_nl.qm</file>
|
||||
<file>lang/qbittorrent_hu.qm</file>
|
||||
<file>lang/qbittorrent_ru.qm</file>
|
||||
<file>lang/qbittorrent_zh_TW.qm</file>
|
||||
<file>lang/qbittorrent_tr.qm</file>
|
||||
<file>lang/qbittorrent_fi.qm</file>
|
||||
<file>lang/qbittorrent_es.qm</file>
|
||||
<file>lang/qbittorrent_sk.qm</file>
|
||||
<file>lang/qbittorrent_ja.qm</file>
|
||||
<file>lang/qbittorrent_zh_TW.qm</file>
|
||||
<file>lang/qbittorrent_pt.qm</file>
|
||||
<file>lang/qbittorrent_sv.qm</file>
|
||||
<file>lang/qbittorrent_pl.qm</file>
|
||||
<file>lang/qbittorrent_it.qm</file>
|
||||
<file>lang/qbittorrent_ar.qm</file>
|
||||
<file>lang/qbittorrent_ko.qm</file>
|
||||
<file>lang/qbittorrent_en.qm</file>
|
||||
<file>lang/qbittorrent_ro.qm</file>
|
||||
<file>lang/qbittorrent_bg.qm</file>
|
||||
<file>lang/qbittorrent_ru.qm</file>
|
||||
<file>lang/qbittorrent_nl.qm</file>
|
||||
<file>lang/qbittorrent_nb.qm</file>
|
||||
<file>lang/qbittorrent_fi.qm</file>
|
||||
<file>lang/qbittorrent_uk.qm</file>
|
||||
<file>lang/qbittorrent_cs.qm</file>
|
||||
<file>lang/qbittorrent_pt_BR.qm</file>
|
||||
<file>lang/qbittorrent_el.qm</file>
|
||||
<file>lang/qbittorrent_ca.qm</file>
|
||||
<file>lang/qbittorrent_pt.qm</file>
|
||||
<file>lang/qbittorrent_it.qm</file>
|
||||
<file>lang/qbittorrent_fr.qm</file>
|
||||
<file>lang/qbittorrent_uk.qm</file>
|
||||
<file>lang/qbittorrent_zh.qm</file>
|
||||
<file>lang/qbittorrent_ko.qm</file>
|
||||
<file>lang/qbittorrent_nb.qm</file>
|
||||
<file>lang/qbittorrent_sv.qm</file>
|
||||
<file>lang/qbittorrent_de.qm</file>
|
||||
<file>lang/qbittorrent_sr.qm</file>
|
||||
<file>lang/qbittorrent_pt_BR.qm</file>
|
||||
<file>lang/qbittorrent_da.qm</file>
|
||||
<file>lang/qbittorrent_cs.qm</file>
|
||||
<file>lang/qbittorrent_pl.qm</file>
|
||||
<file>lang/qbittorrent_bg.qm</file>
|
||||
<file>lang/qbittorrent_ar.qm</file>
|
||||
<file>lang/qbittorrent_es.qm</file>
|
||||
<file>lang/qbittorrent_en.qm</file>
|
||||
<file>lang/qbittorrent_hr.qm</file>
|
||||
<file>lang/qbittorrent_ro.qm</file>
|
||||
<file>lang/qbittorrent_sr.qm</file>
|
||||
<file>lang/qbittorrent_hu.qm</file>
|
||||
<file>lang/qbittorrent_da.qm</file>
|
||||
<file>lang/qbittorrent_de.qm</file>
|
||||
<file>lang/qbittorrent_zh.qm</file>
|
||||
<file>lang/qbittorrent_ja.qm</file>
|
||||
<file>lang/qbittorrent_tr.qm</file>
|
||||
<file>lang/qbittorrent_fr.qm</file>
|
||||
</qresource>
|
||||
</RCC>
|