Compare commits

..

2 Commits

Author SHA1 Message Date
Christophe Dumez
a40b754d63 Tagged v2.4.0 release 2010-08-24 18:30:28 +00:00
Christophe Dumez
f54bc8bea4 Branched v2.4.x 2010-08-24 18:27:18 +00:00
588 changed files with 146854 additions and 75085 deletions

View File

@@ -36,9 +36,9 @@ Images Authors:
url: http://www.oxygen-icons.org
* files: src/Icons/flags/*.png
copyright: Mark James <mjames@gmail.com>
license: Public Domain
url: http://www.famfamfam.com
copyright: Open Clip Art Library
license: Creative Commons Public Domain Dedication
url: http://www.openclipart.org
* files: src/Icons/skin/*.png
files: src/menuicons/YYxYY/*.png
@@ -83,7 +83,7 @@ Translations authors:
- German: Niels Hoffmann (zentralmaschine@users.sourceforge.net)
- Greek: Tsvetan Bankov (emerge_life@users.sourceforge.net) and Stephanos Antaris (santaris@csd.auth.gr)
- Hungarian: Majoros Péter (majoros.j.p@t-online.hu)
- Italian: Matteo Sechi (bu17714@gmail.com)
- Italian: Mirko Ferrari (mirkoferrari@gmail.com) and Ferraro Luciano (luciano.ferraro@gmail.com)
- Japanese: Nardog (alphisation@gmail.com)
- Korean: Jin Woo Sin (jin828sin@users.sourceforge.net)
- Norwegian: Lars-Erik Labori (hamil@users.sourceforge.net)

View File

@@ -1,25 +1,3 @@
* Unreleased - Christophe Dumez <chris@qbittorrent.org> - v2.5.0
- FEATURE: qBittorrent can now act as a tracker
- FEATURE: New and improved RSS feed automated downloader
- FEATURE: Added feature to shutdown qbittorrent on torrents completion
- FEATURE: Added a torrent import assistant to seed or keep downloading outside torrents
- FEATURE: qBittorrent can update itself from Sourceforge (Windows/Mac OS X only)
- FEATURE: Added a transfer list column to display the current tracker
- FEATURE: Remember the last trackers used in the torrent creation tool
- FEATURE: The optimal piece size is now automatically computed in the torrent creation tool
- FEATURE: Bring up the connection settings when clicking on the connection status icon
- FEATURE: Major code refactoring and optimization
- FEATURE: Added "Amount downloaded/left" columns to transfer list
- FEATURE: Simplified proxy settings
- FEATURE: Optimized and improved the peer country resolution code
- FEATURE: Download first/last pieces first when sequential download is
enabled (Thanks Ahmad)
- BUGFIX: Fix SOCKS5 proxy authentication in search engine(closes #680072)
- COSMETIC: Replaced message box by on-screen notification for download errors
- COSMETIC: Improved the torrent creation tool appearance
- COSMETIC: Use country flags by Mark James (Thanks to Dmytro Pukha)
- OTHERS: Dropped support for Qt <= 4.4
* Tue Aug 24 2010 - 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

View File

@@ -10,7 +10,7 @@ qBittorrent - A BitTorrent client in C++ / Qt4
will install and execute qBittorrent hopefully without any problems.
Dependencies:
- Qt >= 4.5.0 (libqt-devel, libqtgui, libqtcore, libqtnetwork, libqtxml)
- Qt >= 4.4.0 (libqt-devel, libqtgui, libqtcore, libqtnetwork, libqtxml)
- pkg-config executable

14
configure vendored
View File

@@ -325,7 +325,7 @@ cat >$1/modules.cpp <<EOT
#line 1 "qt4.qcm"
/*
-----BEGIN QCMOD-----
name: Qt >= 4.5
name: Qt >= 4.4
arg: disable-gui, Disable qBittorrent Graphical user interface for headless running
-----END QCMOD-----
*/
@@ -333,14 +333,14 @@ class qc_qt4 : public ConfObj
{
public:
qc_qt4(Conf *c) : ConfObj(c) {}
QString name() const { return "Qt >= 4.5"; }
QString shortname() const { return "Qt 4.5"; }
QString name() const { return "Qt >= 4.4"; }
QString shortname() const { return "Qt 4.4"; }
bool exec()
{
if(!conf->getenv("QC_DISABLE_GUI").isEmpty()) {
conf->addExtra("CONFIG += nox");
conf->addDefine("DISABLE_GUI");
}
return(QT_VERSION >= 0x040500);
return(QT_VERSION >= 0x040400);
}
};
#line 1 "pkg-config.qcm"
@@ -534,7 +534,7 @@ public:
QString version, libs, other;
VersionMode mode = VersionMin;
if(conf->findPkgConfig("libnotify", mode, req_ver, &version, &incs, &libs, &other)) {
conf->addExtra("CONFIG += libnotify");
conf->addDefine("WITH_LIBNOTIFY");
for(int n = 0; n < incs.count(); ++n)
conf->addIncludePath(incs[n]);
if(!libs.isEmpty())
@@ -625,7 +625,7 @@ public:
s = conf->getenv("QC_WITH_QTSINGLEAPPLICATION");
if(s.compare("system", Qt::CaseInsensitive) == 0) {
// System
conf->addExtra("CONFIG += usesystemqtsingleapplication");
conf->addDefine("USE_SYSTEM_QTSINGLEAPPLICATION");
printf(" [system] ");
} else {
printf(" [shipped] ");

View File

@@ -1,16 +0,0 @@
PREFIX = /usr/local
BINDIR = /usr/local/bin
DATADIR = /usr/local/share
INCLUDEPATH += /usr/local/include/libtorrent /usr/include/openssl /usr/include /opt/local/include/boost /opt/local/include
LIBS += -ltorrent-rasterbar -lcrypto -L/opt/local/lib -lboost_system-mt -lboost_filesystem-mt -lboost_thread-mt -framework Cocoa -framework Carbon
document_icon.path = Contents/Resources
document_icon.files = Icons/qBitTorrentDocument.icns
QMAKE_BUNDLE_DATA += document_icon
ICON = Icons/qbittorrent_mac.icns
QMAKE_INFO_PLIST = Info.plist
DEFINES += WITH_GEOIP_EMBEDDED
message("On Mac OS X, GeoIP database must be embedded.")

View File

@@ -1,10 +0,0 @@
LIBS += -ltorrent-rasterbar \
-lboost_thread \
-lboost_system \
-lboost_filesystem \
-lssl -lcrypto -lidn -lpthread
RC_FILE = qbittorrent_os2.rc
DEFINES += WITH_GEOIP_EMBEDDED
message("On eCS(OS/2), GeoIP database must be embedded.")

199
qBittorrent.kdevelop Normal file
View File

@@ -0,0 +1,199 @@
<?xml version = '1.0'?>
<kdevelop>
<general>
<author>Christophe Dumez</author>
<email>chris@qbittorrent.org</email>
<version>1.0.0</version>
<projectmanagement>KDevTrollProject</projectmanagement>
<primarylanguage>C++</primarylanguage>
<keywords>
<keyword>Qt</keyword>
</keywords>
<projectname>qBittorrent</projectname>
<ignoreparts/>
<projectdirectory>.</projectdirectory>
<absoluteprojectpath>false</absoluteprojectpath>
<description/>
<defaultencoding/>
<versioncontrol>kdevsubversion</versioncontrol>
</general>
<kdevfileview>
<groups>
<group pattern="*.cpp;*.cxx;*.h" name="Sources" />
<group pattern="*.ui" name="User Interface" />
<group pattern="*.png" name="Icons" />
<group pattern="*" name="Others" />
<hidenonprojectfiles>false</hidenonprojectfiles>
<hidenonlocation>false</hidenonlocation>
</groups>
<tree>
<hidepatterns>*.o,*.lo,CVS</hidepatterns>
<hidenonprojectfiles>false</hidenonprojectfiles>
<showvcsfields>false</showvcsfields>
</tree>
</kdevfileview>
<kdevdoctreeview>
<ignoretocs>
<toc>bash</toc>
<toc>bash_bugs</toc>
<toc>clanlib</toc>
<toc>w3c-dom-level2-html</toc>
<toc>fortran_bugs_gcc</toc>
<toc>gnome1</toc>
<toc>gnustep</toc>
<toc>gtk</toc>
<toc>gtk_bugs</toc>
<toc>haskell</toc>
<toc>haskell_bugs_ghc</toc>
<toc>java_bugs_gcc</toc>
<toc>java_bugs_sun</toc>
<toc>kde2book</toc>
<toc>opengl</toc>
<toc>pascal_bugs_fp</toc>
<toc>php</toc>
<toc>php_bugs</toc>
<toc>perl</toc>
<toc>perl_bugs</toc>
<toc>python</toc>
<toc>python_bugs</toc>
<toc>qt-kdev3</toc>
<toc>ruby</toc>
<toc>ruby_bugs</toc>
<toc>sdl</toc>
<toc>stl</toc>
<toc>w3c-svg</toc>
<toc>sw</toc>
<toc>w3c-uaag10</toc>
<toc>wxwidgets_bugs</toc>
</ignoretocs>
<ignoredoxygen>
<toc>KDE Libraries (Doxygen)</toc>
</ignoredoxygen>
</kdevdoctreeview>
<kdevdebugger>
<general>
<dbgshell/>
<gdbpath/>
<configGdbScript/>
<runShellScript/>
<runGdbScript/>
<breakonloadinglibs>true</breakonloadinglibs>
<separatetty>false</separatetty>
<floatingtoolbar>false</floatingtoolbar>
</general>
<display>
<staticmembers>false</staticmembers>
<demanglenames>true</demanglenames>
<outputradix>10</outputradix>
</display>
</kdevdebugger>
<kdevcppsupport>
<qt>
<version>4</version>
<used>true</used>
<includestyle>4</includestyle>
<designerintegration>ExternalDesigner</designerintegration>
<root>/usr/lib/qt4</root>
<qmake>/usr/bin/qmake</qmake>
<designer>/usr/bin/designer</designer>
<designerpluginpaths/>
</qt>
<references>
<pcs>automatic_%2Fhome%2Fishanarora%2Fprojects%2Fqbittorrent</pcs>
</references>
<codecompletion>
<automaticCodeCompletion>true</automaticCodeCompletion>
<automaticArgumentsHint>true</automaticArgumentsHint>
<automaticHeaderCompletion>true</automaticHeaderCompletion>
<codeCompletionDelay>250</codeCompletionDelay>
<argumentsHintDelay>400</argumentsHintDelay>
<headerCompletionDelay>250</headerCompletionDelay>
<showOnlyAccessibleItems>false</showOnlyAccessibleItems>
<completionBoxItemOrder>0</completionBoxItemOrder>
<howEvaluationContextMenu>true</howEvaluationContextMenu>
<showCommentWithArgumentHint>true</showCommentWithArgumentHint>
<statusBarTypeEvaluation>false</statusBarTypeEvaluation>
<namespaceAliases>std=_GLIBCXX_STD;__gnu_cxx=std</namespaceAliases>
<processPrimaryTypes>true</processPrimaryTypes>
<processFunctionArguments>true</processFunctionArguments>
<preProcessAllHeaders>true</preProcessAllHeaders>
<parseMissingHeadersExperimental>true</parseMissingHeadersExperimental>
<resolveIncludePathsUsingMakeExperimental>true</resolveIncludePathsUsingMakeExperimental>
<alwaysParseInBackground>true</alwaysParseInBackground>
<usePermanentCaching>true</usePermanentCaching>
<alwaysIncludeNamespaces>false</alwaysIncludeNamespaces>
<includePaths>.;</includePaths>
</codecompletion>
<creategettersetter>
<prefixGet>get</prefixGet>
<prefixSet>set</prefixSet>
<prefixVariable>m_,_</prefixVariable>
<parameterName>theValue</parameterName>
<inlineGet>true</inlineGet>
<inlineSet>true</inlineSet>
</creategettersetter>
<splitheadersource>
<enabled>false</enabled>
<synchronize>true</synchronize>
<orientation>Vertical</orientation>
</splitheadersource>
</kdevcppsupport>
<kdevfilecreate>
<filetypes/>
<useglobaltypes>
<type ext="ui" />
<type ext="cpp" />
<type ext="h" />
</useglobaltypes>
</kdevfilecreate>
<kdevtrollproject>
<general>
<activedir>src</activedir>
</general>
<run>
<directoryradio>executable</directoryradio>
<mainprogram>/home/ishanarora/projects/qbittorrent/src/qbittorrent</mainprogram>
<programargs/>
<globaldebugarguments/>
<globalcwd>/home/ishanarora/projects/qbittorrent</globalcwd>
<useglobalprogram>true</useglobalprogram>
<terminal>false</terminal>
<autocompile>true</autocompile>
<autoinstall>false</autoinstall>
<autokdesu>false</autokdesu>
<envvars/>
</run>
<make>
<abortonerror>true</abortonerror>
<runmultiplejobs>false</runmultiplejobs>
<numberofjobs>1</numberofjobs>
<dontact>false</dontact>
<makebin/>
<prio>0</prio>
<envvars/>
</make>
<qmake>
<savebehaviour>2</savebehaviour>
<replacePaths>false</replacePaths>
<disableDefaultOpts>true</disableDefaultOpts>
</qmake>
</kdevtrollproject>
<cppsupportpart>
<filetemplates>
<interfacesuffix>.h</interfacesuffix>
<implementationsuffix>.cpp</implementationsuffix>
</filetemplates>
</cppsupportpart>
<ctagspart>
<customArguments/>
<customTagfilePath>/home/ishanarora/projects/qbittorrent/tags</customTagfilePath>
<activeTagsFiles/>
</ctagspart>
<kdevdocumentation>
<projectdoc>
<docsystem/>
<docurl/>
<usermanualurl/>
</projectdoc>
</kdevdocumentation>
</kdevelop>

View File

@@ -24,7 +24,7 @@ public:
QString version, libs, other;
VersionMode mode = VersionMin;
if(conf->findPkgConfig("libnotify", mode, req_ver, &version, &incs, &libs, &other)) {
conf->addExtra("CONFIG += libnotify");
conf->addDefine("WITH_LIBNOTIFY");
for(int n = 0; n < incs.count(); ++n)
conf->addIncludePath(incs[n]);
if(!libs.isEmpty())

View File

@@ -1,6 +1,6 @@
/*
-----BEGIN QCMOD-----
name: Qt >= 4.5
name: Qt >= 4.4
arg: disable-gui, Disable qBittorrent Graphical user interface for headless running
-----END QCMOD-----
*/
@@ -8,13 +8,13 @@ class qc_qt4 : public ConfObj
{
public:
qc_qt4(Conf *c) : ConfObj(c) {}
QString name() const { return "Qt >= 4.5"; }
QString shortname() const { return "Qt 4.5"; }
QString name() const { return "Qt >= 4.4"; }
QString shortname() const { return "Qt 4.4"; }
bool exec()
{
if(!conf->getenv("QC_DISABLE_GUI").isEmpty()) {
conf->addExtra("CONFIG += nox");
conf->addDefine("DISABLE_GUI");
}
return(QT_VERSION >= 0x040500);
return(QT_VERSION >= 0x040400);
}
};

View File

@@ -1,26 +0,0 @@
/*
-----BEGIN QCMOD-----
name: libboost
arg: with-qtsingleapplication=[system|shipped], Use the shipped qtsingleapplication library or the system one
-----END QCMOD-----
*/
class qc_qtsingleapplication : public ConfObj
{
public:
qc_qtsingleapplication(Conf *c) : ConfObj(c) {}
QString name() const { return "qtsingleapplication library"; }
QString shortname() const { return "qtsingleapplication"; }
bool exec(){
QString s;
s = conf->getenv("QC_WITH_QTSINGLEAPPLICATION");
if(s.compare("system", Qt::CaseInsensitive) == 0) {
// System
conf->addExtra("CONFIG += usesystemqtsingleapplication");
printf(" [system] ");
} else {
printf(" [shipped] ");
}
return true;
}
};

View File

@@ -42,17 +42,16 @@
#include <QClipboard>
#include <QCloseEvent>
#include <QShortcut>
#include <QScrollBar>
#include "mainwindow.h"
#include "GUI.h"
#include "transferlistwidget.h"
#include "misc.h"
#include "torrentcreatordlg.h"
#include "createtorrent_imp.h"
#include "downloadfromurldlg.h"
#include "torrentadditiondlg.h"
#include "searchengine.h"
#include "rss_imp.h"
#include "qbtsession.h"
#include "bittorrent.h"
#include "about_imp.h"
#include "trackerlogin.h"
#include "options_imp.h"
@@ -67,18 +66,11 @@
#include "statusbar.h"
#include "hidabletabwidget.h"
#include "qinisettings.h"
#include "torrentimportdlg.h"
#include "rsssettings.h"
#include "torrentmodel.h"
#ifdef Q_WS_MAC
#include "qmacapplication.h"
void qt_mac_set_dock_menu(QMenu *menu);
#endif
#include "lineedit.h"
#include "sessionapplication.h"
#if defined(Q_WS_WIN) || defined(Q_WS_MAC)
#include "programupdater.h"
#endif
using namespace libtorrent;
@@ -91,14 +83,11 @@ using namespace libtorrent;
*****************************************************/
// Constructor
MainWindow::MainWindow(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), force_exit(false) {
GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), force_exit(false) {
setupUi(this);
Preferences pref;
ui_locked = pref.isUILocked();
ui_locked = Preferences::isUILocked();
setWindowTitle(tr("qBittorrent %1", "e.g: qBittorrent v0.x").arg(QString::fromUtf8(VERSION)));
displaySpeedInTitle = pref.speedInTitleBar();
// Clean exit on log out
connect(static_cast<SessionApplication*>(qApp), SIGNAL(sessionIsShuttingDown()), this, SLOT(deleteBTSession()));
displaySpeedInTitle = Preferences::speedInTitleBar();
// Setting icons
this->setWindowIcon(QIcon(QString::fromUtf8(":/Icons/skin/qbittorrent32.png")));
actionOpen->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/open.png")));
@@ -121,7 +110,7 @@ MainWindow::MainWindow(QWidget *parent, QStringList torrentCmdLine) : QMainWindo
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")));
lockMenu = new QMenu();
QMenu *lockMenu = new QMenu();
QAction *defineUiLockPasswdAct = lockMenu->addAction(tr("Set the password..."));
connect(defineUiLockPasswdAct, SIGNAL(triggered()), this, SLOT(defineUILockPassword()));
actionLock_qBittorrent->setMenu(lockMenu);
@@ -133,7 +122,7 @@ MainWindow::MainWindow(QWidget *parent, QStringList torrentCmdLine) : QMainWindo
// Fix Tool bar layout
toolBar->layout()->setSpacing(7);
// Creating Bittorrent session
BTSession = QBtSession::instance();
BTSession = new Bittorrent();
connect(BTSession, SIGNAL(fullDiskError(QTorrentHandle&, QString)), this, SLOT(fullDiskError(QTorrentHandle&, QString)));
connect(BTSession, SIGNAL(finishedTorrent(QTorrentHandle&)), this, SLOT(finishedTorrent(QTorrentHandle&)));
connect(BTSession, SIGNAL(trackerAuthenticationRequired(QTorrentHandle&)), this, SLOT(trackerAuthenticationRequired(QTorrentHandle&)));
@@ -155,7 +144,7 @@ MainWindow::MainWindow(QWidget *parent, QStringList torrentCmdLine) : QMainWindo
// Transfer List tab
transferList = new TransferListWidget(hSplitter, this, BTSession);
properties = new PropertiesWidget(hSplitter, this, transferList);
properties = new PropertiesWidget(hSplitter, this, transferList, BTSession);
transferListFilters = new TransferListFiltersWidget(vSplitter, transferList);
hSplitter->addWidget(transferList);
hSplitter->addWidget(properties);
@@ -164,9 +153,7 @@ 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()));
connect(transferList, SIGNAL(torrentStatusUpdate(uint,uint,uint,uint,uint)), this, SLOT(updateNbTorrents(uint,uint,uint,uint,uint)));
vboxLayout->addWidget(tabs);
// Name filter
@@ -178,9 +165,9 @@ MainWindow::MainWindow(QWidget *parent, QStringList torrentCmdLine) : QMainWindo
// Transfer list slots
connect(actionStart, SIGNAL(triggered()), transferList, SLOT(startSelectedTorrents()));
connect(actionStart_All, SIGNAL(triggered()), BTSession, SLOT(resumeAllTorrents()));
connect(actionStart_All, SIGNAL(triggered()), transferList, SLOT(startAllTorrents()));
connect(actionPause, SIGNAL(triggered()), transferList, SLOT(pauseSelectedTorrents()));
connect(actionPause_All, SIGNAL(triggered()), BTSession, SLOT(pauseAllTorrents()));
connect(actionPause_All, SIGNAL(triggered()), transferList, SLOT(pauseAllTorrents()));
connect(actionDelete, SIGNAL(triggered()), transferList, SLOT(deleteSelectedTorrents()));
connect(actionIncreasePriority, SIGNAL(triggered()), transferList, SLOT(increasePrioSelectedTorrents()));
connect(actionDecreasePriority, SIGNAL(triggered()), transferList, SLOT(decreasePrioSelectedTorrents()));
@@ -196,8 +183,7 @@ MainWindow::MainWindow(QWidget *parent, QStringList torrentCmdLine) : QMainWindo
setAcceptDrops(true);
createKeyboardShortcuts();
// Create status bar
status_bar = new StatusBar(QMainWindow::statusBar());
connect(status_bar->connectionStatusButton(), SIGNAL(clicked()), SLOT(showConnectionSettings()));
status_bar = new StatusBar(QMainWindow::statusBar(), BTSession);
connect(actionUse_alternative_speed_limits, SIGNAL(triggered()), status_bar, SLOT(toggleAlternativeSpeeds()));
#ifdef Q_WS_MAC
@@ -205,14 +191,13 @@ MainWindow::MainWindow(QWidget *parent, QStringList torrentCmdLine) : QMainWindo
#endif
// View settings
actionTop_tool_bar->setChecked(pref.isToolbarDisplayed());
actionSpeed_in_title_bar->setChecked(pref.speedInTitleBar());
actionRSS_Reader->setChecked(RssSettings().isRSSEnabled());
actionSearch_engine->setChecked(pref.isSearchEnabled());
actionTop_tool_bar->setChecked(Preferences::isToolbarDisplayed());
actionSpeed_in_title_bar->setChecked(Preferences::speedInTitleBar());
actionRSS_Reader->setChecked(Preferences::isRSSEnabled());
actionSearch_engine->setChecked(Preferences::isSearchEnabled());
displaySearchTab(actionSearch_engine->isChecked());
displayRSSTab(actionRSS_Reader->isChecked());
actionShutdown_when_downloads_complete->setChecked(pref.shutdownWhenDownloadsComplete());
actionShutdown_qBittorrent_when_downloads_complete->setChecked(pref.shutdownqBTWhenDownloadsComplete());
actionShutdown_when_downloads_complete->setChecked(Preferences::shutdownWhenDownloadsComplete());
show();
@@ -221,12 +206,18 @@ MainWindow::MainWindow(QWidget *parent, QStringList torrentCmdLine) : QMainWindo
properties->readSettings();
// Limit status filters list height
transferListFilters->getStatusFilters()->updateHeight();
int cur_height = 80;
do {
transferListFilters->getStatusFilters()->setFixedHeight(cur_height);
cur_height += 10;
transferListFilters->getStatusFilters()->scrollToBottom();
}while(transferListFilters->getStatusFilters()->verticalScrollBar()->sliderPosition() > 0);
transferListFilters->getStatusFilters()->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
if(ui_locked) {
hide();
} else {
if(pref.startMinimized())
if(Preferences::startMinimized())
showMinimized();
}
@@ -240,50 +231,34 @@ MainWindow::MainWindow(QWidget *parent, QStringList torrentCmdLine) : QMainWindo
// Add torrent given on command line
processParams(torrentCmdLine);
// Populate the transfer list
transferList->getSourceModel()->populate();
qDebug("GUI Built");
#ifdef Q_WS_WIN
if(!pref.neverCheckFileAssoc() && !Preferences::isFileAssocOk()) {
if(!Preferences::neverCheckFileAssoc() && !Preferences::isFileAssocOk()) {
if(QMessageBox::question(0, tr("Torrent file association"),
tr("qBittorrent is not the default application to open torrent files or Magnet links.\nDo you want to associate qBittorrent to torrent files and Magnet links?"),
QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes) {
Preferences::setFileAssoc();
} else {
pref.setNeverCheckFileAssoc();
Preferences::setNeverCheckFileAssoc();
}
}
#endif
#ifdef Q_WS_MAC
qt_mac_set_dock_menu(getTrayIconMenu());
#endif
#if defined(Q_WS_WIN) || defined(Q_WS_MAC)
// Check for update
ProgramUpdater *updater = new ProgramUpdater(this);
connect(updater, SIGNAL(updateCheckFinished(bool, QString)), SLOT(handleUpdateCheckFinished(bool, QString)));
updater->checkForUpdates();
#endif
}
void MainWindow::deleteBTSession() {
guiUpdater->stop();
status_bar->stopTimer();
if(BTSession) {
delete BTSession;
BTSession = 0;
}
QTimer::singleShot(0, this, SLOT(close()));
}
// Destructor
MainWindow::~MainWindow() {
GUI::~GUI() {
qDebug("GUI destruction");
hide();
#ifdef Q_WS_MAC
// Workaround to avoid bug http://bugreports.qt.nokia.com/browse/QTBUG-7305
setUnifiedTitleAndToolBarOnMac(false);
#endif
// Async deletion of Bittorrent session as early as possible
// in order to speed up exit
session_proxy sp = BTSession->asyncDeletion();
// Some saving
properties->saveSettings();
disconnect(tabs, SIGNAL(currentChanged(int)), this, SLOT(tab_changed(int)));
@@ -294,7 +269,6 @@ MainWindow::~MainWindow() {
delete search_filter;
delete transferList;
delete guiUpdater;
delete lockMenu;
if(createTorrentDlg)
delete createTorrentDlg;
if(console)
@@ -330,8 +304,7 @@ MainWindow::~MainWindow() {
delete switchRSSShortcut;
// Delete BTSession objects
qDebug("Deleting BTSession");
QBtSession::drop();
BTSession = 0;
delete BTSession;
// May freeze for a few seconds after the next line
// because the Bittorrent session proxy will
// actually be deleted now and destruction
@@ -339,41 +312,40 @@ MainWindow::~MainWindow() {
qDebug("Exiting GUI destructor...");
}
void MainWindow::defineUILockPassword() {
QString old_pass_md5 = Preferences().getUILockPasswordMD5();
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);
Preferences::setUILockPassword(new_clear_password);
}
QMessageBox::information(this, tr("Password update"), tr("The UI lock password has been successfully updated"));
}
}
void MainWindow::on_actionLock_qBittorrent_triggered() {
Preferences pref;
void GUI::on_actionLock_qBittorrent_triggered() {
// Check if there is a password
if(pref.getUILockPasswordMD5().isEmpty()) {
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;
pref.setUILockPassword(clear_password);
Preferences::setUILockPassword(clear_password);
}
// Lock the interface
ui_locked = true;
pref.setUILocked(true);
Preferences::setUILocked(true);
myTrayIconMenu->setEnabled(false);
hide();
}
void MainWindow::displayRSSTab(bool enable) {
void GUI::displayRSSTab(bool enable) {
if(enable) {
// RSS tab
if(!rssWidget) {
rssWidget = new RSSImp(tabs);
rssWidget = new RSSImp(BTSession);
int index_tab = tabs->addTab(rssWidget, tr("RSS"));
tabs->setTabIcon(index_tab, QIcon(QString::fromUtf8(":/Icons/rss32.png")));
}
@@ -387,11 +359,11 @@ void MainWindow::displayRSSTab(bool enable) {
}
}
void MainWindow::displaySearchTab(bool enable) {
void GUI::displaySearchTab(bool enable) {
if(enable) {
// RSS tab
if(!searchEngine) {
searchEngine = new SearchEngine(this);
searchEngine = new SearchEngine(this, BTSession);
tabs->insertTab(1, searchEngine, QIcon(QString::fromUtf8(":/Icons/oxygen/edit-find.png")), tr("Search"));
}
tabs->showTabBar(true);
@@ -404,28 +376,32 @@ void MainWindow::displaySearchTab(bool enable) {
}
}
void MainWindow::updateNbTorrents() {
tabs->setTabText(0, tr("Transfers (%1)").arg(transferList->getSourceModel()->rowCount()));
void GUI::updateNbTorrents(unsigned int nb_downloading, unsigned int nb_seeding, unsigned int nb_active, unsigned int nb_inactive, unsigned int nb_paused) {
Q_UNUSED(nb_downloading);
Q_UNUSED(nb_seeding);
Q_UNUSED(nb_paused);
tabs->setTabText(0, tr("Transfers (%1)").arg(QString::number(nb_inactive+nb_active)));
}
void MainWindow::on_actionWebsite_triggered() const {
void GUI::on_actionWebsite_triggered() const {
QDesktopServices::openUrl(QUrl(QString::fromUtf8("http://www.qbittorrent.org")));
}
void MainWindow::on_actionDocumentation_triggered() const {
void GUI::on_actionDocumentation_triggered() const {
QDesktopServices::openUrl(QUrl(QString::fromUtf8("http://doc.qbittorrent.org")));
}
void MainWindow::on_actionBugReport_triggered() const {
void GUI::on_actionBugReport_triggered() const {
QDesktopServices::openUrl(QUrl(QString::fromUtf8("http://bugs.qbittorrent.org")));
}
void MainWindow::tab_changed(int new_tab) {
void GUI::tab_changed(int new_tab) {
Q_UNUSED(new_tab);
// We cannot rely on the index new_tab
// because the tab order is undetermined now
if(tabs->currentWidget() == vSplitter) {
qDebug("Changed tab to transfer list, refreshing the list");
transferList->refreshList();
properties->loadDynamicData();
return;
}
@@ -435,7 +411,7 @@ void MainWindow::tab_changed(int new_tab) {
}
}
void MainWindow::writeSettings() {
void GUI::writeSettings() {
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
settings.beginGroup(QString::fromUtf8("MainWindow"));
settings.setValue("geometry", saveGeometry());
@@ -448,18 +424,18 @@ void MainWindow::writeSettings() {
}
// called when a torrent has finished
void MainWindow::finishedTorrent(QTorrentHandle& h) const {
void GUI::finishedTorrent(QTorrentHandle& h) const {
if(!TorrentPersistentData::isSeed(h.hash()))
showNotificationBaloon(tr("Download completion"), tr("%1 has finished downloading.", "e.g: xxx.avi has finished downloading.").arg(h.name()));
}
// Notification when disk is full
void MainWindow::fullDiskError(QTorrentHandle& h, QString msg) const {
void GUI::fullDiskError(QTorrentHandle& h, QString msg) const {
if(!h.is_valid()) return;
showNotificationBaloon(tr("I/O Error", "i.e: Input/Output Error"), tr("An I/O error occured for torrent %1.\n Reason: %2", "e.g: An error occured for torrent xxx.avi.\n Reason: disk is full.").arg(h.name()).arg(msg));
}
void MainWindow::createKeyboardShortcuts() {
void GUI::createKeyboardShortcuts() {
actionCreate_torrent->setShortcut(QKeySequence(QString::fromUtf8("Ctrl+N")));
actionOpen->setShortcut(QKeySequence(QString::fromUtf8("Ctrl+O")));
actionExit->setShortcut(QKeySequence(QString::fromUtf8("Ctrl+Q")));
@@ -483,23 +459,23 @@ void MainWindow::createKeyboardShortcuts() {
}
// Keyboard shortcuts slots
void MainWindow::displayTransferTab() const {
void GUI::displayTransferTab() const {
tabs->setCurrentWidget(transferList);
}
void MainWindow::displaySearchTab() const {
void GUI::displaySearchTab() const {
if(searchEngine)
tabs->setCurrentWidget(searchEngine);
}
void MainWindow::displayRSSTab() const {
void GUI::displayRSSTab() const {
if(rssWidget)
tabs->setCurrentWidget(rssWidget);
}
// End of keyboard shortcuts slots
void MainWindow::readSettings() {
void GUI::readSettings() {
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
settings.beginGroup(QString::fromUtf8("MainWindow"));
restoreGeometry(settings.value("geometry").toByteArray());
@@ -518,7 +494,7 @@ void MainWindow::readSettings() {
settings.endGroup();
}
void MainWindow::balloonClicked() {
void GUI::balloonClicked() {
if(isHidden()) {
show();
if(isMinimized()) {
@@ -529,9 +505,8 @@ void MainWindow::balloonClicked() {
}
}
void MainWindow::askRecursiveTorrentDownloadConfirmation(QTorrentHandle &h) {
Preferences pref;
if(pref.recursiveDownloadDisabled()) return;
void GUI::askRecursiveTorrentDownloadConfirmation(QTorrentHandle &h) {
if(Preferences::recursiveDownloadDisabled()) return;
QMessageBox confirmBox(QMessageBox::Question, tr("Recursive download confirmation"), tr("The torrent %1 contains torrent files, do you want to proceed with their download?").arg(h.name()));
QPushButton *yes = confirmBox.addButton(tr("Yes"), QMessageBox::YesRole);
/*QPushButton *no = */confirmBox.addButton(tr("No"), QMessageBox::NoRole);
@@ -543,16 +518,16 @@ void MainWindow::askRecursiveTorrentDownloadConfirmation(QTorrentHandle &h) {
return;
}
if(confirmBox.clickedButton() == never) {
pref.disableRecursiveDownload();
Preferences::disableRecursiveDownload();
}
}
}
void MainWindow::handleDownloadFromUrlFailure(QString url, QString reason) const{
void GUI::handleDownloadFromUrlFailure(QString url, QString reason) const{
// Display a message box
showNotificationBaloon(tr("Url download error"), tr("Couldn't download file at url: %1, reason: %2.").arg(url).arg(reason));
QMessageBox::critical(0, tr("Url download error"), tr("Couldn't download file at url: %1, reason: %2.").arg(url).arg(reason));
}
void MainWindow::on_actionSet_global_upload_limit_triggered() {
void GUI::on_actionSet_global_upload_limit_triggered() {
qDebug("actionSet_global_upload_limit_triggered");
bool ok;
const long new_limit = SpeedLimitDialog::askSpeedLimit(&ok, tr("Global Upload Speed Limit"), BTSession->getSession()->upload_rate_limit());
@@ -560,21 +535,21 @@ void MainWindow::on_actionSet_global_upload_limit_triggered() {
qDebug("Setting global upload rate limit to %.1fKb/s", new_limit/1024.);
BTSession->getSession()->set_upload_rate_limit(new_limit);
if(new_limit <= 0)
Preferences().setGlobalUploadLimit(-1);
Preferences::setGlobalUploadLimit(-1);
else
Preferences().setGlobalUploadLimit(new_limit/1024.);
Preferences::setGlobalUploadLimit(new_limit/1024.);
}
}
void MainWindow::on_actionShow_console_triggered() {
void GUI::on_actionShow_console_triggered() {
if(!console) {
console = new consoleDlg(this);
console = new consoleDlg(this, BTSession);
} else {
console->setFocus();
}
}
void MainWindow::on_actionSet_global_download_limit_triggered() {
void GUI::on_actionSet_global_download_limit_triggered() {
qDebug("actionSet_global_download_limit_triggered");
bool ok;
const long new_limit = SpeedLimitDialog::askSpeedLimit(&ok, tr("Global Download Speed Limit"), BTSession->getSession()->download_rate_limit());
@@ -582,20 +557,20 @@ void MainWindow::on_actionSet_global_download_limit_triggered() {
qDebug("Setting global download rate limit to %.1fKb/s", new_limit/1024.);
BTSession->getSession()->set_download_rate_limit(new_limit);
if(new_limit <= 0)
Preferences().setGlobalDownloadLimit(-1);
Preferences::setGlobalDownloadLimit(-1);
else
Preferences().setGlobalDownloadLimit(new_limit/1024.);
Preferences::setGlobalDownloadLimit(new_limit/1024.);
}
}
// Necessary if we want to close the window
// in one time if "close to systray" is enabled
void MainWindow::on_actionExit_triggered() {
void GUI::on_actionExit_triggered() {
force_exit = true;
close();
}
QWidget* MainWindow::getCurrentTabWidget() const {
QWidget* GUI::getCurrentTabWidget() const {
if(isMinimized() || !isVisible())
return 0;
if(tabs->currentIndex() == 0)
@@ -603,22 +578,21 @@ QWidget* MainWindow::getCurrentTabWidget() const {
return tabs->currentWidget();
}
void MainWindow::setTabText(int index, QString text) const {
void GUI::setTabText(int index, QString text) const {
tabs->setTabText(index, text);
}
bool MainWindow::unlockUI() {
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;
Preferences pref;
QString real_pass_md5 = pref.getUILockPasswordMD5();
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;
pref.setUILocked(false);
Preferences::setUILocked(false);
myTrayIconMenu->setEnabled(true);
return true;
}
@@ -626,7 +600,7 @@ bool MainWindow::unlockUI() {
return false;
}
void MainWindow::notifyOfUpdate(QString) {
void GUI::notifyOfUpdate(QString) {
// Show restart message
status_bar->showRestartRequired();
// Delete the executable watcher
@@ -635,7 +609,7 @@ void MainWindow::notifyOfUpdate(QString) {
}
// Toggle Main window visibility
void MainWindow::toggleVisibility(QSystemTrayIcon::ActivationReason e) {
void GUI::toggleVisibility(QSystemTrayIcon::ActivationReason e) {
if(e == QSystemTrayIcon::Trigger || e == QSystemTrayIcon::DoubleClick) {
if(isHidden()) {
if(ui_locked) {
@@ -660,7 +634,7 @@ void MainWindow::toggleVisibility(QSystemTrayIcon::ActivationReason e) {
}
// Display About Dialog
void MainWindow::on_actionAbout_triggered() {
void GUI::on_actionAbout_triggered() {
//About dialog
if(aboutDlg) {
aboutDlg->setFocus();
@@ -669,16 +643,18 @@ void MainWindow::on_actionAbout_triggered() {
}
}
void MainWindow::showEvent(QShowEvent *e) {
void GUI::showEvent(QShowEvent *e) {
qDebug("** Show Event **");
if(getCurrentTabWidget() == transferList) {
qDebug("-> Refreshing transfer list");
transferList->refreshList();
properties->loadDynamicData();
}
e->accept();
}
// Called when we close the program
void MainWindow::closeEvent(QCloseEvent *e) {
void GUI::closeEvent(QCloseEvent *e) {
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
const bool goToSystrayOnExit = settings.value(QString::fromUtf8("Preferences/General/CloseToTray"), false).toBool();
if(!force_exit && systrayIcon && goToSystrayOnExit && !this->isHidden()) {
@@ -686,7 +662,7 @@ void MainWindow::closeEvent(QCloseEvent *e) {
e->accept();
return;
}
if(settings.value(QString::fromUtf8("Preferences/General/ExitConfirm"), true).toBool() && BTSession && BTSession->hasActiveTorrents()) {
if(settings.value(QString::fromUtf8("Preferences/General/ExitConfirm"), true).toBool() && BTSession->hasActiveTorrents()) {
if(e->spontaneous() || force_exit) {
if(!isVisible())
show();
@@ -706,7 +682,7 @@ void MainWindow::closeEvent(QCloseEvent *e) {
}
if(confirmBox.clickedButton() == alwaysBtn) {
// Remember choice
Preferences().setConfirmOnExit(false);
Preferences::setConfirmOnExit(false);
}
}
}
@@ -723,23 +699,24 @@ void MainWindow::closeEvent(QCloseEvent *e) {
}
// Display window to create a torrent
void MainWindow::on_actionCreate_torrent_triggered() {
void GUI::on_actionCreate_torrent_triggered() {
if(createTorrentDlg) {
createTorrentDlg->setFocus();
} else {
createTorrentDlg = new TorrentCreatorDlg(this);
createTorrentDlg = new createtorrent(this);
connect(createTorrentDlg, SIGNAL(torrent_to_seed(QString)), this, SLOT(addTorrent(QString)));
}
}
bool MainWindow::event(QEvent * e) {
bool GUI::event(QEvent * e) {
switch(e->type()) {
case QEvent::WindowStateChange: {
qDebug("Window change event");
//Now check to see if the window is minimised
if(isMinimized()) {
qDebug("minimisation");
if(systrayIcon && Preferences().minimizeToTray()) {
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
if(systrayIcon && settings.value(QString::fromUtf8("Preferences/General/MinimizeToTray"), false).toBool()) {
qDebug("Has active window: %d", (int)(qApp->activeWindow() != 0));
// Check if there is a modal window
bool has_modal_window = false;
@@ -767,7 +744,7 @@ bool MainWindow::event(QEvent * e) {
qDebug("MAC: new toolbar visibility is %d", !actionTop_tool_bar->isChecked());
actionTop_tool_bar->toggle();
Preferences().setToolbarDisplayed(actionTop_tool_bar->isChecked());
Preferences::setToolbarDisplayed(actionTop_tool_bar->isChecked());
return ret;
}
#endif
@@ -778,7 +755,7 @@ bool MainWindow::event(QEvent * e) {
}
// Action executed when a file is dropped
void MainWindow::dropEvent(QDropEvent *event) {
void GUI::dropEvent(QDropEvent *event) {
event->acceptProposedAction();
QStringList files;
if(event->mimeData()->hasUrls()) {
@@ -815,7 +792,7 @@ void MainWindow::dropEvent(QDropEvent *event) {
continue;
}
if(useTorrentAdditionDialog) {
torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
torrentAdditionDialog *dialog = new torrentAdditionDialog(this, BTSession);
dialog->showLoad(file);
}else{
BTSession->addTorrent(file);
@@ -824,7 +801,7 @@ void MainWindow::dropEvent(QDropEvent *event) {
}
// Decode if we accept drag 'n drop or not
void MainWindow::dragEnterEvent(QDragEnterEvent *event) {
void GUI::dragEnterEvent(QDragEnterEvent *event) {
foreach(const QString &mime, event->mimeData()->formats()){
qDebug("mimeData: %s", mime.toLocal8Bit().data());
}
@@ -841,7 +818,7 @@ void MainWindow::dragEnterEvent(QDragEnterEvent *event) {
// Display a dialog to allow user to add
// torrents to download list
void MainWindow::on_actionOpen_triggered() {
void GUI::on_actionOpen_triggered() {
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
// Open File Open Dialog
// Note: it is possible to select more than one file
@@ -853,7 +830,7 @@ void MainWindow::on_actionOpen_triggered() {
const uint listSize = pathsList.size();
for(uint i=0; i<listSize; ++i) {
if(useTorrentAdditionDialog) {
torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
torrentAdditionDialog *dialog = new torrentAdditionDialog(this, BTSession);
dialog->showLoad(pathsList.at(i));
}else{
BTSession->addTorrent(pathsList.at(i));
@@ -870,11 +847,11 @@ void MainWindow::on_actionOpen_triggered() {
// This function parse the parameters and call
// the right addTorrent function, considering
// the parameter type.
void MainWindow::processParams(const QString& params_str) {
void GUI::processParams(const QString& params_str) {
processParams(params_str.split("|", QString::SkipEmptyParts));
}
void MainWindow::processParams(const QStringList& params) {
void GUI::processParams(const QStringList& params) {
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
const bool useTorrentAdditionDialog = settings.value(QString::fromUtf8("Preferences/Downloads/AdditionDialog"), true).toBool();
foreach(QString param, params) {
@@ -888,14 +865,14 @@ void MainWindow::processParams(const QStringList& params) {
}
if(param.startsWith("magnet:", Qt::CaseInsensitive)) {
if(useTorrentAdditionDialog) {
torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
torrentAdditionDialog *dialog = new torrentAdditionDialog(this, BTSession);
dialog->showLoadMagnetURI(param);
} else {
BTSession->addMagnetUri(param);
}
} else {
if(useTorrentAdditionDialog) {
torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
torrentAdditionDialog *dialog = new torrentAdditionDialog(this, BTSession);
dialog->showLoad(param);
}else{
BTSession->addTorrent(param);
@@ -905,30 +882,30 @@ void MainWindow::processParams(const QStringList& params) {
}
}
void MainWindow::addTorrent(QString path) {
void GUI::addTorrent(QString path) {
BTSession->addTorrent(path);
}
void MainWindow::processDownloadedFiles(QString path, QString url) {
void GUI::processDownloadedFiles(QString path, QString url) {
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
const bool useTorrentAdditionDialog = settings.value(QString::fromUtf8("Preferences/Downloads/AdditionDialog"), true).toBool();
if(useTorrentAdditionDialog) {
torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
torrentAdditionDialog *dialog = new torrentAdditionDialog(this, BTSession);
dialog->showLoad(path, url);
}else{
BTSession->addTorrent(path, false, url);
}
}
void MainWindow::optionsSaved() {
void GUI::optionsSaved() {
loadPreferences();
}
// Load program preferences
void MainWindow::loadPreferences(bool configure_session) {
void GUI::loadPreferences(bool configure_session) {
BTSession->addConsoleMessage(tr("Options were saved successfully."));
const Preferences pref;
const bool newSystrayIntegration = pref.systrayIntegration();
#ifndef Q_WS_MAC
const bool newSystrayIntegration = Preferences::systrayIntegration();
actionLock_qBittorrent->setEnabled(newSystrayIntegration);
if(newSystrayIntegration != (systrayIcon!=0)) {
if(newSystrayIntegration) {
@@ -952,8 +929,9 @@ void MainWindow::loadPreferences(bool configure_session) {
delete myTrayIconMenu;
}
}
#endif
// General
if(pref.isToolbarDisplayed()) {
if(Preferences::isToolbarDisplayed()) {
toolBar->setVisible(true);
toolBar->layout()->setSpacing(7);
} else {
@@ -961,15 +939,15 @@ void MainWindow::loadPreferences(bool configure_session) {
search_filter->clear();
toolBar->setVisible(false);
}
const uint new_refreshInterval = pref.getRefreshInterval();
const uint new_refreshInterval = Preferences::getRefreshInterval();
transferList->setRefreshInterval(new_refreshInterval);
transferList->setAlternatingRowColors(pref.useAlternatingRowColors());
properties->getFilesList()->setAlternatingRowColors(pref.useAlternatingRowColors());
properties->getTrackerList()->setAlternatingRowColors(pref.useAlternatingRowColors());
properties->getPeerList()->setAlternatingRowColors(pref.useAlternatingRowColors());
transferList->setAlternatingRowColors(Preferences::useAlternatingRowColors());
properties->getFilesList()->setAlternatingRowColors(Preferences::useAlternatingRowColors());
properties->getTrackerList()->setAlternatingRowColors(Preferences::useAlternatingRowColors());
properties->getPeerList()->setAlternatingRowColors(Preferences::useAlternatingRowColors());
// Queueing System
if(pref.isQueueingSystemEnabled()) {
if(!actionDecreasePriority->isVisible()) {
if(Preferences::isQueueingSystemEnabled()) {
if(!configure_session || !BTSession->isQueueingEnabled()) {
transferList->hidePriorityColumn(false);
actionDecreasePriority->setVisible(true);
actionIncreasePriority->setVisible(true);
@@ -978,7 +956,7 @@ void MainWindow::loadPreferences(bool configure_session) {
toolBar->layout()->setSpacing(7);
}
} else {
if(actionDecreasePriority->isVisible()) {
if(BTSession->isQueueingEnabled()) {
transferList->hidePriorityColumn(true);
actionDecreasePriority->setVisible(false);
actionIncreasePriority->setVisible(false);
@@ -997,7 +975,7 @@ void MainWindow::loadPreferences(bool configure_session) {
qDebug("GUI settings loaded");
}
void MainWindow::addUnauthenticatedTracker(const QPair<QTorrentHandle,QString> &tracker) {
void GUI::addUnauthenticatedTracker(const QPair<QTorrentHandle,QString> &tracker) {
// Trackers whose authentication was cancelled
if(unauthenticated_trackers.indexOf(tracker) < 0) {
unauthenticated_trackers << tracker;
@@ -1005,7 +983,7 @@ void MainWindow::addUnauthenticatedTracker(const QPair<QTorrentHandle,QString> &
}
// Called when a tracker requires authentication
void MainWindow::trackerAuthenticationRequired(QTorrentHandle& h) {
void GUI::trackerAuthenticationRequired(QTorrentHandle& h) {
if(unauthenticated_trackers.indexOf(QPair<QTorrentHandle,QString>(h, h.current_tracker())) < 0) {
// Tracker login
new trackerLogin(this, h);
@@ -1013,10 +991,11 @@ void MainWindow::trackerAuthenticationRequired(QTorrentHandle& h) {
}
// Check connection status and display right icon
void MainWindow::updateGUI() {
void GUI::updateGUI() {
// update global informations
#ifndef Q_WS_MAC
if(systrayIcon) {
#if defined(Q_WS_X11) || defined(Q_WS_MAC)
#if defined(Q_WS_X11)
QString html = "<div style='background-color: #678db2; color: #fff;height: 18px; font-weight: bold; margin-bottom: 5px;'>";
html += tr("qBittorrent");
html += "</div>";
@@ -1034,22 +1013,18 @@ void MainWindow::updateGUI() {
#endif
systrayIcon->setToolTip(html); // tray icon
}
#endif
if(displaySpeedInTitle) {
setWindowTitle(tr("qBittorrent %1 (Down: %2/s, Up: %3/s)", "%1 is qBittorrent version").arg(QString::fromUtf8(VERSION)).arg(misc::friendlyUnit(BTSession->getSessionStatus().payload_download_rate)).arg(misc::friendlyUnit(BTSession->getSessionStatus().payload_upload_rate)));
}
}
void MainWindow::showNotificationBaloon(QString title, QString msg) const {
if(!Preferences().useProgramNotification()) return;
void GUI::showNotificationBaloon(QString title, QString msg) const {
if(!Preferences::useProgramNotification()) return;
#ifdef WITH_LIBNOTIFY
if (notify_init ("summary-body")) {
NotifyNotification* notification;
notification = notify_notification_new (qPrintable(title), qPrintable(msg), "qbittorrent"
#if !defined(NOTIFY_VERSION_MINOR) || (NOTIFY_VERSION_MAJOR == 0 && NOTIFY_VERSION_MINOR < 7)
, 0
#endif
);
notification = notify_notification_new (qPrintable(title), qPrintable(msg), "qbittorrent", 0);
gboolean success = notify_notification_show (notification, NULL);
g_object_unref(G_OBJECT(notification));
notify_uninit ();
@@ -1058,8 +1033,10 @@ void MainWindow::showNotificationBaloon(QString title, QString msg) const {
}
}
#endif
#ifndef Q_WS_MAC
if(systrayIcon && QSystemTrayIcon::supportsMessages())
systrayIcon->showMessage(title, msg, QSystemTrayIcon::Information, TIME_TRAY_BALLOON);
#endif
}
/*****************************************************
@@ -1068,7 +1045,7 @@ void MainWindow::showNotificationBaloon(QString title, QString msg) const {
* *
*****************************************************/
void MainWindow::downloadFromURLList(const QStringList& url_list) {
void GUI::downloadFromURLList(const QStringList& url_list) {
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
const bool useTorrentAdditionDialog = settings.value(QString::fromUtf8("Preferences/Downloads/AdditionDialog"), true).toBool();
foreach(QString url, url_list) {
@@ -1078,7 +1055,7 @@ void MainWindow::downloadFromURLList(const QStringList& url_list) {
}
if(url.startsWith("magnet:", Qt::CaseInsensitive)) {
if(useTorrentAdditionDialog) {
torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
torrentAdditionDialog *dialog = new torrentAdditionDialog(this, BTSession);
dialog->showLoadMagnetURI(url);
} else {
BTSession->addMagnetUri(url);
@@ -1095,7 +1072,8 @@ void MainWindow::downloadFromURLList(const QStringList& url_list) {
* *
*****************************************************/
void MainWindow::createSystrayDelayed() {
void GUI::createSystrayDelayed() {
#ifndef Q_WS_MAC
static int timeout = 20;
if(QSystemTrayIcon::isSystemTrayAvailable()) {
// Ok, systray integration is now supported
@@ -1113,16 +1091,17 @@ void MainWindow::createSystrayDelayed() {
delete systrayCreator;
// Disable it in program preferences to
// avoid trying at earch startup
Preferences().setSystrayIntegration(false);
Preferences::setSystrayIntegration(false);
}
}
#endif
}
void MainWindow::updateAltSpeedsBtn(bool alternative) {
void GUI::updateAltSpeedsBtn(bool alternative) {
actionUse_alternative_speed_limits->setChecked(alternative);
}
QMenu* MainWindow::getTrayIconMenu() {
QMenu* GUI::getTrayIconMenu() {
if(myTrayIconMenu)
return myTrayIconMenu;
// Tray icon Menu
@@ -1130,9 +1109,8 @@ QMenu* MainWindow::getTrayIconMenu() {
myTrayIconMenu->addAction(actionOpen);
myTrayIconMenu->addAction(actionDownload_from_URL);
myTrayIconMenu->addSeparator();
const bool isAltBWEnabled = Preferences().isAltBandwidthEnabled();
updateAltSpeedsBtn(isAltBWEnabled);
actionUse_alternative_speed_limits->setChecked(isAltBWEnabled);
updateAltSpeedsBtn(Preferences::isAltBandwidthEnabled());
actionUse_alternative_speed_limits->setChecked(Preferences::isAltBandwidthEnabled());
myTrayIconMenu->addAction(actionUse_alternative_speed_limits);
myTrayIconMenu->addAction(actionSet_global_download_limit);
myTrayIconMenu->addAction(actionSet_global_upload_limit);
@@ -1146,7 +1124,7 @@ QMenu* MainWindow::getTrayIconMenu() {
return myTrayIconMenu;
}
void MainWindow::createTrayIcon() {
void GUI::createTrayIcon() {
// Tray icon
#ifdef Q_WS_WIN
systrayIcon = new QSystemTrayIcon(QIcon(QString::fromUtf8(":/Icons/skin/qbittorrent16.png")), this);
@@ -1162,7 +1140,7 @@ void MainWindow::createTrayIcon() {
}
// Display Program Options
void MainWindow::on_actionOptions_triggered() {
void GUI::on_actionOptions_triggered() {
if(options) {
// Get focus
options->setFocus();
@@ -1172,46 +1150,36 @@ void MainWindow::on_actionOptions_triggered() {
}
}
void MainWindow::on_actionTop_tool_bar_triggered() {
void GUI::on_actionTop_tool_bar_triggered() {
bool is_visible = static_cast<QAction*>(sender())->isChecked();
toolBar->setVisible(is_visible);
Preferences().setToolbarDisplayed(is_visible);
Preferences::setToolbarDisplayed(is_visible);
}
void MainWindow::on_actionShutdown_when_downloads_complete_triggered() {
void GUI::on_actionShutdown_when_downloads_complete_triggered() {
bool is_checked = static_cast<QAction*>(sender())->isChecked();
Preferences().setShutdownWhenDownloadsComplete(is_checked);
Preferences::setShutdownWhenDownloadsComplete(is_checked);
}
void MainWindow::on_actionShutdown_qBittorrent_when_downloads_complete_triggered() {
bool is_checked = static_cast<QAction*>(sender())->isChecked();
Preferences().setShutdownqBTWhenDownloadsComplete(is_checked);
}
void MainWindow::on_actionSpeed_in_title_bar_triggered() {
void GUI::on_actionSpeed_in_title_bar_triggered() {
displaySpeedInTitle = static_cast<QAction*>(sender())->isChecked();
Preferences().showSpeedInTitleBar(displaySpeedInTitle);
Preferences::showSpeedInTitleBar(displaySpeedInTitle);
if(displaySpeedInTitle)
updateGUI();
else
setWindowTitle(tr("qBittorrent %1", "e.g: qBittorrent v0.x").arg(QString::fromUtf8(VERSION)));
}
void MainWindow::on_actionRSS_Reader_triggered() {
RssSettings().setRSSEnabled(actionRSS_Reader->isChecked());
void GUI::on_actionRSS_Reader_triggered() {
Preferences::setRSSEnabled(actionRSS_Reader->isChecked());
displayRSSTab(actionRSS_Reader->isChecked());
}
void MainWindow::on_actionSearch_engine_triggered() {
Preferences().setSearchEnabled(actionSearch_engine->isChecked());
void GUI::on_actionSearch_engine_triggered() {
Preferences::setSearchEnabled(actionSearch_engine->isChecked());
displaySearchTab(actionSearch_engine->isChecked());
}
void MainWindow::on_action_Import_Torrent_triggered()
{
TorrentImportDlg::importTorrent();
}
/*****************************************************
* *
* HTTP Downloader *
@@ -1220,47 +1188,10 @@ void MainWindow::on_action_Import_Torrent_triggered()
// Display an input dialog to prompt user for
// an url
void MainWindow::on_actionDownload_from_URL_triggered() {
void GUI::on_actionDownload_from_URL_triggered() {
if(!downloadFromURLDialog) {
downloadFromURLDialog = new downloadFromURL(this);
connect(downloadFromURLDialog, SIGNAL(urlsReadyToBeDownloaded(const QStringList&)), this, SLOT(downloadFromURLList(const QStringList&)));
}
}
#if defined(Q_WS_WIN) || defined(Q_WS_MAC)
void MainWindow::handleUpdateCheckFinished(bool update_available, QString new_version)
{
if(update_available) {
if(QMessageBox::question(this, tr("A newer version is available"),
tr("A newer version of qBittorrent is available on Sourceforge.\nWould you like to update qBittorrent to version %1?").arg(new_version),
QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes) {
// The user want to update, let's download the update
ProgramUpdater* updater = dynamic_cast<ProgramUpdater*>(sender());
connect(updater, SIGNAL(updateInstallFinished(QString)), SLOT(handleUpdateInstalled(QString)));
updater->updateProgram();
return;
}
}
sender()->deleteLater();
}
void MainWindow::handleUpdateInstalled(QString error_msg)
{
if(!error_msg.isEmpty()) {
QMessageBox::critical(this, tr("Impossible to update qBittorrent"), tr("qBittorrent failed to update, reason: %1").arg(error_msg));
}
}
#endif
void MainWindow::on_actionDonate_money_triggered()
{
QDesktopServices::openUrl(QUrl("http://sourceforge.net/donate/index.php?group_id=163414"));
}
void MainWindow::showConnectionSettings()
{
on_actionOptions_triggered();
options->showConnectionTab();
}

View File

@@ -37,7 +37,7 @@
#include "ui_mainwindow.h"
#include "qtorrenthandle.h"
class QBtSession;
class Bittorrent;
class QTimer;
class downloadFromURL;
class SearchEngine;
@@ -54,19 +54,19 @@ class PropertiesWidget;
class StatusBar;
class consoleDlg;
class about;
class TorrentCreatorDlg;
class createtorrent;
class downloadFromURL;
class HidableTabWidget;
class LineEdit;
class QFileSystemWatcher;
class MainWindow : public QMainWindow, private Ui::MainWindow{
class GUI : public QMainWindow, private Ui::MainWindow{
Q_OBJECT
public:
// Construct / Destruct
MainWindow(QWidget *parent=0, QStringList torrentCmdLine=QStringList());
~MainWindow();
GUI(QWidget *parent=0, QStringList torrentCmdLine=QStringList());
~GUI();
// Methods
QWidget* getCurrentTabWidget() const;
TransferListWidget* getTransferList() const { return transferList; }
@@ -79,8 +79,7 @@ public slots:
void showNotificationBaloon(QString title, QString msg) const;
void downloadFromURLList(const QStringList& urls);
void updateAltSpeedsBtn(bool alternative);
void updateNbTorrents();
void deleteBTSession();
void updateNbTorrents(unsigned int nb_downloading, unsigned int nb_seeding, unsigned int nb_active, unsigned int nb_inactive, unsigned int nb_paused);
protected slots:
// GUI related slots
@@ -105,7 +104,6 @@ protected slots:
void defineUILockPassword();
bool unlockUI();
void notifyOfUpdate(QString);
void showConnectionSettings();
// Keyboard shortcuts
void createKeyboardShortcuts();
void displayTransferTab() const;
@@ -130,10 +128,6 @@ protected slots:
void optionsSaved();
// HTTP slots
void on_actionDownload_from_URL_triggered();
#if defined(Q_WS_WIN) || defined(Q_WS_MAC)
void handleUpdateCheckFinished(bool update_available, QString new_version);
void handleUpdateInstalled(QString error_msg);
#endif
protected:
void closeEvent(QCloseEvent *);
@@ -145,7 +139,7 @@ protected:
private:
QFileSystemWatcher *executable_watcher;
// Bittorrent
QBtSession *BTSession;
Bittorrent *BTSession;
QList<QPair<QTorrentHandle,QString> > unauthenticated_trackers; // Still needed?
// GUI related
QTimer *guiUpdater;
@@ -154,7 +148,7 @@ private:
QPointer<options_imp> options;
QPointer<consoleDlg> console;
QPointer<about> aboutDlg;
QPointer<TorrentCreatorDlg> createTorrentDlg;
QPointer<createtorrent> createTorrentDlg;
QPointer<downloadFromURL> downloadFromURLDialog;
QPointer<QSystemTrayIcon> systrayIcon;
QPointer<QTimer> systrayCreator;
@@ -176,7 +170,6 @@ private:
QAction *prioSeparator2;
QSplitter *hSplitter;
QSplitter *vSplitter;
QMenu *lockMenu;
// Search
QPointer<SearchEngine> searchEngine;
// RSS
@@ -188,9 +181,6 @@ private slots:
void on_actionSpeed_in_title_bar_triggered();
void on_actionTop_tool_bar_triggered();
void on_actionShutdown_when_downloads_complete_triggered();
void on_actionShutdown_qBittorrent_when_downloads_complete_triggered();
void on_action_Import_Torrent_triggered();
void on_actionDonate_money_triggered();
};
#endif

Binary file not shown.

Before

Width:  |  Height:  |  Size: 643 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 408 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 604 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 591 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 643 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 600 B

BIN
src/Icons/flags/algeria.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 473 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 488 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 428 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 506 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 647 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 403 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 673 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
src/Icons/flags/austria.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 285 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 524 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 663 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 589 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 593 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 585 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 504 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 449 B

BIN
src/Icons/flags/belarus.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 373 B

BIN
src/Icons/flags/belgium.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 497 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 462 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 457 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 675 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 486 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 611 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 639 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 500 B

BIN
src/Icons/flags/bosnia.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 583 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 593 B

BIN
src/Icons/flags/brazil.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 799 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 526 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 631 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 512 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 443 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 514 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 600 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 628 B

BIN
src/Icons/flags/canada.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 686 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 625 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 528 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 614 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 521 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 367 B

BIN
src/Icons/flags/china.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 329 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 453 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 586 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 450 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 525 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 472 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 483 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 203 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 477 B

BIN
src/Icons/flags/croatia.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 479 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 439 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 563 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 529 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 608 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 428 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 476 B

BIN
src/Icons/flags/czech.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 455 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 545 B

BIN
src/Icons/flags/denmark.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 572 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 495 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 620 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 508 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 582 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 500 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 429 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 465 B

BIN
src/Icons/flags/egypt.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 314 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 508 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 653 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 469 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 592 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 489 B

BIN
src/Icons/flags/finland.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 610 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 648 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 552 B

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