Compare commits
2 Commits
release-2.
...
release-2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a40b754d63 | ||
|
|
f54bc8bea4 |
8
AUTHORS
@@ -36,9 +36,9 @@ Images Authors:
|
|||||||
url: http://www.oxygen-icons.org
|
url: http://www.oxygen-icons.org
|
||||||
|
|
||||||
* files: src/Icons/flags/*.png
|
* files: src/Icons/flags/*.png
|
||||||
copyright: Mark James <mjames@gmail.com>
|
copyright: Open Clip Art Library
|
||||||
license: Public Domain
|
license: Creative Commons Public Domain Dedication
|
||||||
url: http://www.famfamfam.com
|
url: http://www.openclipart.org
|
||||||
|
|
||||||
* files: src/Icons/skin/*.png
|
* files: src/Icons/skin/*.png
|
||||||
files: src/menuicons/YYxYY/*.png
|
files: src/menuicons/YYxYY/*.png
|
||||||
@@ -83,7 +83,7 @@ Translations authors:
|
|||||||
- German: Niels Hoffmann (zentralmaschine@users.sourceforge.net)
|
- German: Niels Hoffmann (zentralmaschine@users.sourceforge.net)
|
||||||
- Greek: Tsvetan Bankov (emerge_life@users.sourceforge.net) and Stephanos Antaris (santaris@csd.auth.gr)
|
- 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)
|
- 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)
|
- Japanese: Nardog (alphisation@gmail.com)
|
||||||
- Korean: Jin Woo Sin (jin828sin@users.sourceforge.net)
|
- Korean: Jin Woo Sin (jin828sin@users.sourceforge.net)
|
||||||
- Norwegian: Lars-Erik Labori (hamil@users.sourceforge.net)
|
- Norwegian: Lars-Erik Labori (hamil@users.sourceforge.net)
|
||||||
|
|||||||
22
Changelog
@@ -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
|
* Tue Aug 24 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.4.0
|
||||||
- FEATURE: Added actions to "Move to top/bottom" of priority queue
|
- FEATURE: Added actions to "Move to top/bottom" of priority queue
|
||||||
- FEATURE: Auto-Shutdown on downloads completion
|
- FEATURE: Auto-Shutdown on downloads completion
|
||||||
|
|||||||
2
INSTALL
@@ -10,7 +10,7 @@ qBittorrent - A BitTorrent client in C++ / Qt4
|
|||||||
will install and execute qBittorrent hopefully without any problems.
|
will install and execute qBittorrent hopefully without any problems.
|
||||||
|
|
||||||
Dependencies:
|
Dependencies:
|
||||||
- Qt >= 4.5.0 (libqt-devel, libqtgui, libqtcore, libqtnetwork, libqtxml)
|
- Qt >= 4.4.0 (libqt-devel, libqtgui, libqtcore, libqtnetwork, libqtxml)
|
||||||
|
|
||||||
- pkg-config executable
|
- pkg-config executable
|
||||||
|
|
||||||
|
|||||||
14
configure
vendored
@@ -325,7 +325,7 @@ cat >$1/modules.cpp <<EOT
|
|||||||
#line 1 "qt4.qcm"
|
#line 1 "qt4.qcm"
|
||||||
/*
|
/*
|
||||||
-----BEGIN QCMOD-----
|
-----BEGIN QCMOD-----
|
||||||
name: Qt >= 4.5
|
name: Qt >= 4.4
|
||||||
arg: disable-gui, Disable qBittorrent Graphical user interface for headless running
|
arg: disable-gui, Disable qBittorrent Graphical user interface for headless running
|
||||||
-----END QCMOD-----
|
-----END QCMOD-----
|
||||||
*/
|
*/
|
||||||
@@ -333,14 +333,14 @@ class qc_qt4 : public ConfObj
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
qc_qt4(Conf *c) : ConfObj(c) {}
|
qc_qt4(Conf *c) : ConfObj(c) {}
|
||||||
QString name() const { return "Qt >= 4.5"; }
|
QString name() const { return "Qt >= 4.4"; }
|
||||||
QString shortname() const { return "Qt 4.5"; }
|
QString shortname() const { return "Qt 4.4"; }
|
||||||
bool exec()
|
bool exec()
|
||||||
{
|
{
|
||||||
if(!conf->getenv("QC_DISABLE_GUI").isEmpty()) {
|
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"
|
#line 1 "pkg-config.qcm"
|
||||||
@@ -534,7 +534,7 @@ public:
|
|||||||
QString version, libs, other;
|
QString version, libs, other;
|
||||||
VersionMode mode = VersionMin;
|
VersionMode mode = VersionMin;
|
||||||
if(conf->findPkgConfig("libnotify", mode, req_ver, &version, &incs, &libs, &other)) {
|
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)
|
for(int n = 0; n < incs.count(); ++n)
|
||||||
conf->addIncludePath(incs[n]);
|
conf->addIncludePath(incs[n]);
|
||||||
if(!libs.isEmpty())
|
if(!libs.isEmpty())
|
||||||
@@ -625,7 +625,7 @@ public:
|
|||||||
s = conf->getenv("QC_WITH_QTSINGLEAPPLICATION");
|
s = conf->getenv("QC_WITH_QTSINGLEAPPLICATION");
|
||||||
if(s.compare("system", Qt::CaseInsensitive) == 0) {
|
if(s.compare("system", Qt::CaseInsensitive) == 0) {
|
||||||
// System
|
// System
|
||||||
conf->addExtra("CONFIG += usesystemqtsingleapplication");
|
conf->addDefine("USE_SYSTEM_QTSINGLEAPPLICATION");
|
||||||
printf(" [system] ");
|
printf(" [system] ");
|
||||||
} else {
|
} else {
|
||||||
printf(" [shipped] ");
|
printf(" [shipped] ");
|
||||||
|
|||||||
16
macxconf.pri
@@ -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.")
|
|
||||||
10
os2conf.pri
@@ -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
@@ -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>
|
||||||
@@ -24,7 +24,7 @@ public:
|
|||||||
QString version, libs, other;
|
QString version, libs, other;
|
||||||
VersionMode mode = VersionMin;
|
VersionMode mode = VersionMin;
|
||||||
if(conf->findPkgConfig("libnotify", mode, req_ver, &version, &incs, &libs, &other)) {
|
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)
|
for(int n = 0; n < incs.count(); ++n)
|
||||||
conf->addIncludePath(incs[n]);
|
conf->addIncludePath(incs[n]);
|
||||||
if(!libs.isEmpty())
|
if(!libs.isEmpty())
|
||||||
|
|||||||
10
qcm/qt4.qcm
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
-----BEGIN QCMOD-----
|
-----BEGIN QCMOD-----
|
||||||
name: Qt >= 4.5
|
name: Qt >= 4.4
|
||||||
arg: disable-gui, Disable qBittorrent Graphical user interface for headless running
|
arg: disable-gui, Disable qBittorrent Graphical user interface for headless running
|
||||||
-----END QCMOD-----
|
-----END QCMOD-----
|
||||||
*/
|
*/
|
||||||
@@ -8,13 +8,13 @@ class qc_qt4 : public ConfObj
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
qc_qt4(Conf *c) : ConfObj(c) {}
|
qc_qt4(Conf *c) : ConfObj(c) {}
|
||||||
QString name() const { return "Qt >= 4.5"; }
|
QString name() const { return "Qt >= 4.4"; }
|
||||||
QString shortname() const { return "Qt 4.5"; }
|
QString shortname() const { return "Qt 4.4"; }
|
||||||
bool exec()
|
bool exec()
|
||||||
{
|
{
|
||||||
if(!conf->getenv("QC_DISABLE_GUI").isEmpty()) {
|
if(!conf->getenv("QC_DISABLE_GUI").isEmpty()) {
|
||||||
conf->addExtra("CONFIG += nox");
|
conf->addDefine("DISABLE_GUI");
|
||||||
}
|
}
|
||||||
return(QT_VERSION >= 0x040500);
|
return(QT_VERSION >= 0x040400);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -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;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -42,17 +42,16 @@
|
|||||||
#include <QClipboard>
|
#include <QClipboard>
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
#include <QShortcut>
|
#include <QShortcut>
|
||||||
#include <QScrollBar>
|
|
||||||
|
|
||||||
#include "mainwindow.h"
|
#include "GUI.h"
|
||||||
#include "transferlistwidget.h"
|
#include "transferlistwidget.h"
|
||||||
#include "misc.h"
|
#include "misc.h"
|
||||||
#include "torrentcreatordlg.h"
|
#include "createtorrent_imp.h"
|
||||||
#include "downloadfromurldlg.h"
|
#include "downloadfromurldlg.h"
|
||||||
#include "torrentadditiondlg.h"
|
#include "torrentadditiondlg.h"
|
||||||
#include "searchengine.h"
|
#include "searchengine.h"
|
||||||
#include "rss_imp.h"
|
#include "rss_imp.h"
|
||||||
#include "qbtsession.h"
|
#include "bittorrent.h"
|
||||||
#include "about_imp.h"
|
#include "about_imp.h"
|
||||||
#include "trackerlogin.h"
|
#include "trackerlogin.h"
|
||||||
#include "options_imp.h"
|
#include "options_imp.h"
|
||||||
@@ -67,18 +66,11 @@
|
|||||||
#include "statusbar.h"
|
#include "statusbar.h"
|
||||||
#include "hidabletabwidget.h"
|
#include "hidabletabwidget.h"
|
||||||
#include "qinisettings.h"
|
#include "qinisettings.h"
|
||||||
#include "torrentimportdlg.h"
|
|
||||||
#include "rsssettings.h"
|
|
||||||
#include "torrentmodel.h"
|
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
#include "qmacapplication.h"
|
#include "qmacapplication.h"
|
||||||
void qt_mac_set_dock_menu(QMenu *menu);
|
void qt_mac_set_dock_menu(QMenu *menu);
|
||||||
#endif
|
#endif
|
||||||
#include "lineedit.h"
|
#include "lineedit.h"
|
||||||
#include "sessionapplication.h"
|
|
||||||
#if defined(Q_WS_WIN) || defined(Q_WS_MAC)
|
|
||||||
#include "programupdater.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace libtorrent;
|
using namespace libtorrent;
|
||||||
|
|
||||||
@@ -91,14 +83,11 @@ using namespace libtorrent;
|
|||||||
*****************************************************/
|
*****************************************************/
|
||||||
|
|
||||||
// Constructor
|
// 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);
|
setupUi(this);
|
||||||
Preferences pref;
|
ui_locked = Preferences::isUILocked();
|
||||||
ui_locked = pref.isUILocked();
|
|
||||||
setWindowTitle(tr("qBittorrent %1", "e.g: qBittorrent v0.x").arg(QString::fromUtf8(VERSION)));
|
setWindowTitle(tr("qBittorrent %1", "e.g: qBittorrent v0.x").arg(QString::fromUtf8(VERSION)));
|
||||||
displaySpeedInTitle = pref.speedInTitleBar();
|
displaySpeedInTitle = Preferences::speedInTitleBar();
|
||||||
// Clean exit on log out
|
|
||||||
connect(static_cast<SessionApplication*>(qApp), SIGNAL(sessionIsShuttingDown()), this, SLOT(deleteBTSession()));
|
|
||||||
// Setting icons
|
// Setting icons
|
||||||
this->setWindowIcon(QIcon(QString::fromUtf8(":/Icons/skin/qbittorrent32.png")));
|
this->setWindowIcon(QIcon(QString::fromUtf8(":/Icons/skin/qbittorrent32.png")));
|
||||||
actionOpen->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/open.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")));
|
actionSet_global_download_limit->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/download.png")));
|
||||||
actionDocumentation->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/qb_question.png")));
|
actionDocumentation->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/qb_question.png")));
|
||||||
actionLock_qBittorrent->setIcon(QIcon(QString::fromUtf8(":/Icons/oxygen/encrypted32.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..."));
|
QAction *defineUiLockPasswdAct = lockMenu->addAction(tr("Set the password..."));
|
||||||
connect(defineUiLockPasswdAct, SIGNAL(triggered()), this, SLOT(defineUILockPassword()));
|
connect(defineUiLockPasswdAct, SIGNAL(triggered()), this, SLOT(defineUILockPassword()));
|
||||||
actionLock_qBittorrent->setMenu(lockMenu);
|
actionLock_qBittorrent->setMenu(lockMenu);
|
||||||
@@ -133,7 +122,7 @@ MainWindow::MainWindow(QWidget *parent, QStringList torrentCmdLine) : QMainWindo
|
|||||||
// Fix Tool bar layout
|
// Fix Tool bar layout
|
||||||
toolBar->layout()->setSpacing(7);
|
toolBar->layout()->setSpacing(7);
|
||||||
// Creating Bittorrent session
|
// Creating Bittorrent session
|
||||||
BTSession = QBtSession::instance();
|
BTSession = new Bittorrent();
|
||||||
connect(BTSession, SIGNAL(fullDiskError(QTorrentHandle&, QString)), this, SLOT(fullDiskError(QTorrentHandle&, QString)));
|
connect(BTSession, SIGNAL(fullDiskError(QTorrentHandle&, QString)), this, SLOT(fullDiskError(QTorrentHandle&, QString)));
|
||||||
connect(BTSession, SIGNAL(finishedTorrent(QTorrentHandle&)), this, SLOT(finishedTorrent(QTorrentHandle&)));
|
connect(BTSession, SIGNAL(finishedTorrent(QTorrentHandle&)), this, SLOT(finishedTorrent(QTorrentHandle&)));
|
||||||
connect(BTSession, SIGNAL(trackerAuthenticationRequired(QTorrentHandle&)), this, SLOT(trackerAuthenticationRequired(QTorrentHandle&)));
|
connect(BTSession, SIGNAL(trackerAuthenticationRequired(QTorrentHandle&)), this, SLOT(trackerAuthenticationRequired(QTorrentHandle&)));
|
||||||
@@ -155,7 +144,7 @@ MainWindow::MainWindow(QWidget *parent, QStringList torrentCmdLine) : QMainWindo
|
|||||||
|
|
||||||
// Transfer List tab
|
// Transfer List tab
|
||||||
transferList = new TransferListWidget(hSplitter, this, BTSession);
|
transferList = new TransferListWidget(hSplitter, this, BTSession);
|
||||||
properties = new PropertiesWidget(hSplitter, this, transferList);
|
properties = new PropertiesWidget(hSplitter, this, transferList, BTSession);
|
||||||
transferListFilters = new TransferListFiltersWidget(vSplitter, transferList);
|
transferListFilters = new TransferListFiltersWidget(vSplitter, transferList);
|
||||||
hSplitter->addWidget(transferList);
|
hSplitter->addWidget(transferList);
|
||||||
hSplitter->addWidget(properties);
|
hSplitter->addWidget(properties);
|
||||||
@@ -164,9 +153,7 @@ MainWindow::MainWindow(QWidget *parent, QStringList torrentCmdLine) : QMainWindo
|
|||||||
vSplitter->setCollapsible(0, true);
|
vSplitter->setCollapsible(0, true);
|
||||||
vSplitter->setCollapsible(1, false);
|
vSplitter->setCollapsible(1, false);
|
||||||
tabs->addTab(vSplitter, QIcon(QString::fromUtf8(":/Icons/oxygen/folder-remote.png")), tr("Transfers"));
|
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, SIGNAL(torrentStatusUpdate(uint,uint,uint,uint,uint)), this, SLOT(updateNbTorrents(uint,uint,uint,uint,uint)));
|
||||||
connect(transferList->getSourceModel(), SIGNAL(rowsRemoved(QModelIndex, int, int)), this, SLOT(updateNbTorrents()));
|
|
||||||
|
|
||||||
vboxLayout->addWidget(tabs);
|
vboxLayout->addWidget(tabs);
|
||||||
|
|
||||||
// Name filter
|
// Name filter
|
||||||
@@ -178,9 +165,9 @@ MainWindow::MainWindow(QWidget *parent, QStringList torrentCmdLine) : QMainWindo
|
|||||||
|
|
||||||
// Transfer list slots
|
// Transfer list slots
|
||||||
connect(actionStart, SIGNAL(triggered()), transferList, SLOT(startSelectedTorrents()));
|
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, 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(actionDelete, SIGNAL(triggered()), transferList, SLOT(deleteSelectedTorrents()));
|
||||||
connect(actionIncreasePriority, SIGNAL(triggered()), transferList, SLOT(increasePrioSelectedTorrents()));
|
connect(actionIncreasePriority, SIGNAL(triggered()), transferList, SLOT(increasePrioSelectedTorrents()));
|
||||||
connect(actionDecreasePriority, SIGNAL(triggered()), transferList, SLOT(decreasePrioSelectedTorrents()));
|
connect(actionDecreasePriority, SIGNAL(triggered()), transferList, SLOT(decreasePrioSelectedTorrents()));
|
||||||
@@ -196,8 +183,7 @@ MainWindow::MainWindow(QWidget *parent, QStringList torrentCmdLine) : QMainWindo
|
|||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
createKeyboardShortcuts();
|
createKeyboardShortcuts();
|
||||||
// Create status bar
|
// Create status bar
|
||||||
status_bar = new StatusBar(QMainWindow::statusBar());
|
status_bar = new StatusBar(QMainWindow::statusBar(), BTSession);
|
||||||
connect(status_bar->connectionStatusButton(), SIGNAL(clicked()), SLOT(showConnectionSettings()));
|
|
||||||
connect(actionUse_alternative_speed_limits, SIGNAL(triggered()), status_bar, SLOT(toggleAlternativeSpeeds()));
|
connect(actionUse_alternative_speed_limits, SIGNAL(triggered()), status_bar, SLOT(toggleAlternativeSpeeds()));
|
||||||
|
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
@@ -205,14 +191,13 @@ MainWindow::MainWindow(QWidget *parent, QStringList torrentCmdLine) : QMainWindo
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// View settings
|
// View settings
|
||||||
actionTop_tool_bar->setChecked(pref.isToolbarDisplayed());
|
actionTop_tool_bar->setChecked(Preferences::isToolbarDisplayed());
|
||||||
actionSpeed_in_title_bar->setChecked(pref.speedInTitleBar());
|
actionSpeed_in_title_bar->setChecked(Preferences::speedInTitleBar());
|
||||||
actionRSS_Reader->setChecked(RssSettings().isRSSEnabled());
|
actionRSS_Reader->setChecked(Preferences::isRSSEnabled());
|
||||||
actionSearch_engine->setChecked(pref.isSearchEnabled());
|
actionSearch_engine->setChecked(Preferences::isSearchEnabled());
|
||||||
displaySearchTab(actionSearch_engine->isChecked());
|
displaySearchTab(actionSearch_engine->isChecked());
|
||||||
displayRSSTab(actionRSS_Reader->isChecked());
|
displayRSSTab(actionRSS_Reader->isChecked());
|
||||||
actionShutdown_when_downloads_complete->setChecked(pref.shutdownWhenDownloadsComplete());
|
actionShutdown_when_downloads_complete->setChecked(Preferences::shutdownWhenDownloadsComplete());
|
||||||
actionShutdown_qBittorrent_when_downloads_complete->setChecked(pref.shutdownqBTWhenDownloadsComplete());
|
|
||||||
|
|
||||||
show();
|
show();
|
||||||
|
|
||||||
@@ -221,12 +206,18 @@ MainWindow::MainWindow(QWidget *parent, QStringList torrentCmdLine) : QMainWindo
|
|||||||
properties->readSettings();
|
properties->readSettings();
|
||||||
|
|
||||||
// Limit status filters list height
|
// 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) {
|
if(ui_locked) {
|
||||||
hide();
|
hide();
|
||||||
} else {
|
} else {
|
||||||
if(pref.startMinimized())
|
if(Preferences::startMinimized())
|
||||||
showMinimized();
|
showMinimized();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,50 +231,34 @@ MainWindow::MainWindow(QWidget *parent, QStringList torrentCmdLine) : QMainWindo
|
|||||||
// Add torrent given on command line
|
// Add torrent given on command line
|
||||||
processParams(torrentCmdLine);
|
processParams(torrentCmdLine);
|
||||||
|
|
||||||
// Populate the transfer list
|
|
||||||
transferList->getSourceModel()->populate();
|
|
||||||
|
|
||||||
qDebug("GUI Built");
|
qDebug("GUI Built");
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
if(!pref.neverCheckFileAssoc() && !Preferences::isFileAssocOk()) {
|
if(!Preferences::neverCheckFileAssoc() && !Preferences::isFileAssocOk()) {
|
||||||
if(QMessageBox::question(0, tr("Torrent file association"),
|
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?"),
|
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) {
|
QMessageBox::Yes|QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes) {
|
||||||
Preferences::setFileAssoc();
|
Preferences::setFileAssoc();
|
||||||
} else {
|
} else {
|
||||||
pref.setNeverCheckFileAssoc();
|
Preferences::setNeverCheckFileAssoc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
qt_mac_set_dock_menu(getTrayIconMenu());
|
qt_mac_set_dock_menu(getTrayIconMenu());
|
||||||
#endif
|
#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
|
// Destructor
|
||||||
MainWindow::~MainWindow() {
|
GUI::~GUI() {
|
||||||
qDebug("GUI destruction");
|
qDebug("GUI destruction");
|
||||||
hide();
|
hide();
|
||||||
#ifdef Q_WS_MAC
|
#ifdef Q_WS_MAC
|
||||||
// Workaround to avoid bug http://bugreports.qt.nokia.com/browse/QTBUG-7305
|
// Workaround to avoid bug http://bugreports.qt.nokia.com/browse/QTBUG-7305
|
||||||
setUnifiedTitleAndToolBarOnMac(false);
|
setUnifiedTitleAndToolBarOnMac(false);
|
||||||
#endif
|
#endif
|
||||||
|
// Async deletion of Bittorrent session as early as possible
|
||||||
|
// in order to speed up exit
|
||||||
|
session_proxy sp = BTSession->asyncDeletion();
|
||||||
// Some saving
|
// Some saving
|
||||||
properties->saveSettings();
|
properties->saveSettings();
|
||||||
disconnect(tabs, SIGNAL(currentChanged(int)), this, SLOT(tab_changed(int)));
|
disconnect(tabs, SIGNAL(currentChanged(int)), this, SLOT(tab_changed(int)));
|
||||||
@@ -294,7 +269,6 @@ MainWindow::~MainWindow() {
|
|||||||
delete search_filter;
|
delete search_filter;
|
||||||
delete transferList;
|
delete transferList;
|
||||||
delete guiUpdater;
|
delete guiUpdater;
|
||||||
delete lockMenu;
|
|
||||||
if(createTorrentDlg)
|
if(createTorrentDlg)
|
||||||
delete createTorrentDlg;
|
delete createTorrentDlg;
|
||||||
if(console)
|
if(console)
|
||||||
@@ -330,8 +304,7 @@ MainWindow::~MainWindow() {
|
|||||||
delete switchRSSShortcut;
|
delete switchRSSShortcut;
|
||||||
// Delete BTSession objects
|
// Delete BTSession objects
|
||||||
qDebug("Deleting BTSession");
|
qDebug("Deleting BTSession");
|
||||||
QBtSession::drop();
|
delete BTSession;
|
||||||
BTSession = 0;
|
|
||||||
// May freeze for a few seconds after the next line
|
// May freeze for a few seconds after the next line
|
||||||
// because the Bittorrent session proxy will
|
// because the Bittorrent session proxy will
|
||||||
// actually be deleted now and destruction
|
// actually be deleted now and destruction
|
||||||
@@ -339,41 +312,40 @@ MainWindow::~MainWindow() {
|
|||||||
qDebug("Exiting GUI destructor...");
|
qDebug("Exiting GUI destructor...");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::defineUILockPassword() {
|
void GUI::defineUILockPassword() {
|
||||||
QString old_pass_md5 = Preferences().getUILockPasswordMD5();
|
QString old_pass_md5 = Preferences::getUILockPasswordMD5();
|
||||||
if(old_pass_md5.isNull()) old_pass_md5 = "";
|
if(old_pass_md5.isNull()) old_pass_md5 = "";
|
||||||
bool ok = false;
|
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);
|
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(ok) {
|
||||||
if(new_clear_password != old_pass_md5) {
|
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"));
|
QMessageBox::information(this, tr("Password update"), tr("The UI lock password has been successfully updated"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionLock_qBittorrent_triggered() {
|
void GUI::on_actionLock_qBittorrent_triggered() {
|
||||||
Preferences pref;
|
|
||||||
// Check if there is a password
|
// Check if there is a password
|
||||||
if(pref.getUILockPasswordMD5().isEmpty()) {
|
if(Preferences::getUILockPasswordMD5().isEmpty()) {
|
||||||
// Ask for a password
|
// Ask for a password
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
QString clear_password = QInputDialog::getText(this, tr("UI lock password"), tr("Please type the UI lock password:"), QLineEdit::Password, "", &ok);
|
QString clear_password = QInputDialog::getText(this, tr("UI lock password"), tr("Please type the UI lock password:"), QLineEdit::Password, "", &ok);
|
||||||
if(!ok) return;
|
if(!ok) return;
|
||||||
pref.setUILockPassword(clear_password);
|
Preferences::setUILockPassword(clear_password);
|
||||||
}
|
}
|
||||||
// Lock the interface
|
// Lock the interface
|
||||||
ui_locked = true;
|
ui_locked = true;
|
||||||
pref.setUILocked(true);
|
Preferences::setUILocked(true);
|
||||||
myTrayIconMenu->setEnabled(false);
|
myTrayIconMenu->setEnabled(false);
|
||||||
hide();
|
hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::displayRSSTab(bool enable) {
|
void GUI::displayRSSTab(bool enable) {
|
||||||
if(enable) {
|
if(enable) {
|
||||||
// RSS tab
|
// RSS tab
|
||||||
if(!rssWidget) {
|
if(!rssWidget) {
|
||||||
rssWidget = new RSSImp(tabs);
|
rssWidget = new RSSImp(BTSession);
|
||||||
int index_tab = tabs->addTab(rssWidget, tr("RSS"));
|
int index_tab = tabs->addTab(rssWidget, tr("RSS"));
|
||||||
tabs->setTabIcon(index_tab, QIcon(QString::fromUtf8(":/Icons/rss32.png")));
|
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) {
|
if(enable) {
|
||||||
// RSS tab
|
// RSS tab
|
||||||
if(!searchEngine) {
|
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->insertTab(1, searchEngine, QIcon(QString::fromUtf8(":/Icons/oxygen/edit-find.png")), tr("Search"));
|
||||||
}
|
}
|
||||||
tabs->showTabBar(true);
|
tabs->showTabBar(true);
|
||||||
@@ -404,28 +376,32 @@ void MainWindow::displaySearchTab(bool enable) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updateNbTorrents() {
|
void GUI::updateNbTorrents(unsigned int nb_downloading, unsigned int nb_seeding, unsigned int nb_active, unsigned int nb_inactive, unsigned int nb_paused) {
|
||||||
tabs->setTabText(0, tr("Transfers (%1)").arg(transferList->getSourceModel()->rowCount()));
|
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")));
|
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")));
|
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")));
|
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);
|
Q_UNUSED(new_tab);
|
||||||
// We cannot rely on the index new_tab
|
// We cannot rely on the index new_tab
|
||||||
// because the tab order is undetermined now
|
// because the tab order is undetermined now
|
||||||
if(tabs->currentWidget() == vSplitter) {
|
if(tabs->currentWidget() == vSplitter) {
|
||||||
qDebug("Changed tab to transfer list, refreshing the list");
|
qDebug("Changed tab to transfer list, refreshing the list");
|
||||||
|
transferList->refreshList();
|
||||||
properties->loadDynamicData();
|
properties->loadDynamicData();
|
||||||
return;
|
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"));
|
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||||
settings.beginGroup(QString::fromUtf8("MainWindow"));
|
settings.beginGroup(QString::fromUtf8("MainWindow"));
|
||||||
settings.setValue("geometry", saveGeometry());
|
settings.setValue("geometry", saveGeometry());
|
||||||
@@ -448,18 +424,18 @@ void MainWindow::writeSettings() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// called when a torrent has finished
|
// called when a torrent has finished
|
||||||
void MainWindow::finishedTorrent(QTorrentHandle& h) const {
|
void GUI::finishedTorrent(QTorrentHandle& h) const {
|
||||||
if(!TorrentPersistentData::isSeed(h.hash()))
|
if(!TorrentPersistentData::isSeed(h.hash()))
|
||||||
showNotificationBaloon(tr("Download completion"), tr("%1 has finished downloading.", "e.g: xxx.avi has finished downloading.").arg(h.name()));
|
showNotificationBaloon(tr("Download completion"), tr("%1 has finished downloading.", "e.g: xxx.avi has finished downloading.").arg(h.name()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Notification when disk is full
|
// 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;
|
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));
|
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")));
|
actionCreate_torrent->setShortcut(QKeySequence(QString::fromUtf8("Ctrl+N")));
|
||||||
actionOpen->setShortcut(QKeySequence(QString::fromUtf8("Ctrl+O")));
|
actionOpen->setShortcut(QKeySequence(QString::fromUtf8("Ctrl+O")));
|
||||||
actionExit->setShortcut(QKeySequence(QString::fromUtf8("Ctrl+Q")));
|
actionExit->setShortcut(QKeySequence(QString::fromUtf8("Ctrl+Q")));
|
||||||
@@ -483,23 +459,23 @@ void MainWindow::createKeyboardShortcuts() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Keyboard shortcuts slots
|
// Keyboard shortcuts slots
|
||||||
void MainWindow::displayTransferTab() const {
|
void GUI::displayTransferTab() const {
|
||||||
tabs->setCurrentWidget(transferList);
|
tabs->setCurrentWidget(transferList);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::displaySearchTab() const {
|
void GUI::displaySearchTab() const {
|
||||||
if(searchEngine)
|
if(searchEngine)
|
||||||
tabs->setCurrentWidget(searchEngine);
|
tabs->setCurrentWidget(searchEngine);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::displayRSSTab() const {
|
void GUI::displayRSSTab() const {
|
||||||
if(rssWidget)
|
if(rssWidget)
|
||||||
tabs->setCurrentWidget(rssWidget);
|
tabs->setCurrentWidget(rssWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
// End of keyboard shortcuts slots
|
// End of keyboard shortcuts slots
|
||||||
|
|
||||||
void MainWindow::readSettings() {
|
void GUI::readSettings() {
|
||||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||||
settings.beginGroup(QString::fromUtf8("MainWindow"));
|
settings.beginGroup(QString::fromUtf8("MainWindow"));
|
||||||
restoreGeometry(settings.value("geometry").toByteArray());
|
restoreGeometry(settings.value("geometry").toByteArray());
|
||||||
@@ -518,7 +494,7 @@ void MainWindow::readSettings() {
|
|||||||
settings.endGroup();
|
settings.endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::balloonClicked() {
|
void GUI::balloonClicked() {
|
||||||
if(isHidden()) {
|
if(isHidden()) {
|
||||||
show();
|
show();
|
||||||
if(isMinimized()) {
|
if(isMinimized()) {
|
||||||
@@ -529,9 +505,8 @@ void MainWindow::balloonClicked() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::askRecursiveTorrentDownloadConfirmation(QTorrentHandle &h) {
|
void GUI::askRecursiveTorrentDownloadConfirmation(QTorrentHandle &h) {
|
||||||
Preferences pref;
|
if(Preferences::recursiveDownloadDisabled()) return;
|
||||||
if(pref.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()));
|
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 *yes = confirmBox.addButton(tr("Yes"), QMessageBox::YesRole);
|
||||||
/*QPushButton *no = */confirmBox.addButton(tr("No"), QMessageBox::NoRole);
|
/*QPushButton *no = */confirmBox.addButton(tr("No"), QMessageBox::NoRole);
|
||||||
@@ -543,16 +518,16 @@ void MainWindow::askRecursiveTorrentDownloadConfirmation(QTorrentHandle &h) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(confirmBox.clickedButton() == never) {
|
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
|
// 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");
|
qDebug("actionSet_global_upload_limit_triggered");
|
||||||
bool ok;
|
bool ok;
|
||||||
const long new_limit = SpeedLimitDialog::askSpeedLimit(&ok, tr("Global Upload Speed Limit"), BTSession->getSession()->upload_rate_limit());
|
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.);
|
qDebug("Setting global upload rate limit to %.1fKb/s", new_limit/1024.);
|
||||||
BTSession->getSession()->set_upload_rate_limit(new_limit);
|
BTSession->getSession()->set_upload_rate_limit(new_limit);
|
||||||
if(new_limit <= 0)
|
if(new_limit <= 0)
|
||||||
Preferences().setGlobalUploadLimit(-1);
|
Preferences::setGlobalUploadLimit(-1);
|
||||||
else
|
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) {
|
if(!console) {
|
||||||
console = new consoleDlg(this);
|
console = new consoleDlg(this, BTSession);
|
||||||
} else {
|
} else {
|
||||||
console->setFocus();
|
console->setFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionSet_global_download_limit_triggered() {
|
void GUI::on_actionSet_global_download_limit_triggered() {
|
||||||
qDebug("actionSet_global_download_limit_triggered");
|
qDebug("actionSet_global_download_limit_triggered");
|
||||||
bool ok;
|
bool ok;
|
||||||
const long new_limit = SpeedLimitDialog::askSpeedLimit(&ok, tr("Global Download Speed Limit"), BTSession->getSession()->download_rate_limit());
|
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.);
|
qDebug("Setting global download rate limit to %.1fKb/s", new_limit/1024.);
|
||||||
BTSession->getSession()->set_download_rate_limit(new_limit);
|
BTSession->getSession()->set_download_rate_limit(new_limit);
|
||||||
if(new_limit <= 0)
|
if(new_limit <= 0)
|
||||||
Preferences().setGlobalDownloadLimit(-1);
|
Preferences::setGlobalDownloadLimit(-1);
|
||||||
else
|
else
|
||||||
Preferences().setGlobalDownloadLimit(new_limit/1024.);
|
Preferences::setGlobalDownloadLimit(new_limit/1024.);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Necessary if we want to close the window
|
// Necessary if we want to close the window
|
||||||
// in one time if "close to systray" is enabled
|
// in one time if "close to systray" is enabled
|
||||||
void MainWindow::on_actionExit_triggered() {
|
void GUI::on_actionExit_triggered() {
|
||||||
force_exit = true;
|
force_exit = true;
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget* MainWindow::getCurrentTabWidget() const {
|
QWidget* GUI::getCurrentTabWidget() const {
|
||||||
if(isMinimized() || !isVisible())
|
if(isMinimized() || !isVisible())
|
||||||
return 0;
|
return 0;
|
||||||
if(tabs->currentIndex() == 0)
|
if(tabs->currentIndex() == 0)
|
||||||
@@ -603,22 +578,21 @@ QWidget* MainWindow::getCurrentTabWidget() const {
|
|||||||
return tabs->currentWidget();
|
return tabs->currentWidget();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::setTabText(int index, QString text) const {
|
void GUI::setTabText(int index, QString text) const {
|
||||||
tabs->setTabText(index, text);
|
tabs->setTabText(index, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::unlockUI() {
|
bool GUI::unlockUI() {
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
QString clear_password = QInputDialog::getText(this, tr("UI lock password"), tr("Please type the UI lock password:"), QLineEdit::Password, "", &ok);
|
QString clear_password = QInputDialog::getText(this, tr("UI lock password"), tr("Please type the UI lock password:"), QLineEdit::Password, "", &ok);
|
||||||
if(!ok) return false;
|
if(!ok) return false;
|
||||||
Preferences pref;
|
QString real_pass_md5 = Preferences::getUILockPasswordMD5();
|
||||||
QString real_pass_md5 = pref.getUILockPasswordMD5();
|
|
||||||
QCryptographicHash md5(QCryptographicHash::Md5);
|
QCryptographicHash md5(QCryptographicHash::Md5);
|
||||||
md5.addData(clear_password.toLocal8Bit());
|
md5.addData(clear_password.toLocal8Bit());
|
||||||
QString password_md5 = md5.result().toHex();
|
QString password_md5 = md5.result().toHex();
|
||||||
if(real_pass_md5 == password_md5) {
|
if(real_pass_md5 == password_md5) {
|
||||||
ui_locked = false;
|
ui_locked = false;
|
||||||
pref.setUILocked(false);
|
Preferences::setUILocked(false);
|
||||||
myTrayIconMenu->setEnabled(true);
|
myTrayIconMenu->setEnabled(true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -626,7 +600,7 @@ bool MainWindow::unlockUI() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::notifyOfUpdate(QString) {
|
void GUI::notifyOfUpdate(QString) {
|
||||||
// Show restart message
|
// Show restart message
|
||||||
status_bar->showRestartRequired();
|
status_bar->showRestartRequired();
|
||||||
// Delete the executable watcher
|
// Delete the executable watcher
|
||||||
@@ -635,7 +609,7 @@ void MainWindow::notifyOfUpdate(QString) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Toggle Main window visibility
|
// Toggle Main window visibility
|
||||||
void MainWindow::toggleVisibility(QSystemTrayIcon::ActivationReason e) {
|
void GUI::toggleVisibility(QSystemTrayIcon::ActivationReason e) {
|
||||||
if(e == QSystemTrayIcon::Trigger || e == QSystemTrayIcon::DoubleClick) {
|
if(e == QSystemTrayIcon::Trigger || e == QSystemTrayIcon::DoubleClick) {
|
||||||
if(isHidden()) {
|
if(isHidden()) {
|
||||||
if(ui_locked) {
|
if(ui_locked) {
|
||||||
@@ -660,7 +634,7 @@ void MainWindow::toggleVisibility(QSystemTrayIcon::ActivationReason e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Display About Dialog
|
// Display About Dialog
|
||||||
void MainWindow::on_actionAbout_triggered() {
|
void GUI::on_actionAbout_triggered() {
|
||||||
//About dialog
|
//About dialog
|
||||||
if(aboutDlg) {
|
if(aboutDlg) {
|
||||||
aboutDlg->setFocus();
|
aboutDlg->setFocus();
|
||||||
@@ -669,16 +643,18 @@ void MainWindow::on_actionAbout_triggered() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::showEvent(QShowEvent *e) {
|
void GUI::showEvent(QShowEvent *e) {
|
||||||
qDebug("** Show Event **");
|
qDebug("** Show Event **");
|
||||||
if(getCurrentTabWidget() == transferList) {
|
if(getCurrentTabWidget() == transferList) {
|
||||||
|
qDebug("-> Refreshing transfer list");
|
||||||
|
transferList->refreshList();
|
||||||
properties->loadDynamicData();
|
properties->loadDynamicData();
|
||||||
}
|
}
|
||||||
e->accept();
|
e->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called when we close the program
|
// Called when we close the program
|
||||||
void MainWindow::closeEvent(QCloseEvent *e) {
|
void GUI::closeEvent(QCloseEvent *e) {
|
||||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||||
const bool goToSystrayOnExit = settings.value(QString::fromUtf8("Preferences/General/CloseToTray"), false).toBool();
|
const bool goToSystrayOnExit = settings.value(QString::fromUtf8("Preferences/General/CloseToTray"), false).toBool();
|
||||||
if(!force_exit && systrayIcon && goToSystrayOnExit && !this->isHidden()) {
|
if(!force_exit && systrayIcon && goToSystrayOnExit && !this->isHidden()) {
|
||||||
@@ -686,7 +662,7 @@ void MainWindow::closeEvent(QCloseEvent *e) {
|
|||||||
e->accept();
|
e->accept();
|
||||||
return;
|
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(e->spontaneous() || force_exit) {
|
||||||
if(!isVisible())
|
if(!isVisible())
|
||||||
show();
|
show();
|
||||||
@@ -706,7 +682,7 @@ void MainWindow::closeEvent(QCloseEvent *e) {
|
|||||||
}
|
}
|
||||||
if(confirmBox.clickedButton() == alwaysBtn) {
|
if(confirmBox.clickedButton() == alwaysBtn) {
|
||||||
// Remember choice
|
// Remember choice
|
||||||
Preferences().setConfirmOnExit(false);
|
Preferences::setConfirmOnExit(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -723,23 +699,24 @@ void MainWindow::closeEvent(QCloseEvent *e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Display window to create a torrent
|
// Display window to create a torrent
|
||||||
void MainWindow::on_actionCreate_torrent_triggered() {
|
void GUI::on_actionCreate_torrent_triggered() {
|
||||||
if(createTorrentDlg) {
|
if(createTorrentDlg) {
|
||||||
createTorrentDlg->setFocus();
|
createTorrentDlg->setFocus();
|
||||||
} else {
|
} else {
|
||||||
createTorrentDlg = new TorrentCreatorDlg(this);
|
createTorrentDlg = new createtorrent(this);
|
||||||
connect(createTorrentDlg, SIGNAL(torrent_to_seed(QString)), this, SLOT(addTorrent(QString)));
|
connect(createTorrentDlg, SIGNAL(torrent_to_seed(QString)), this, SLOT(addTorrent(QString)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::event(QEvent * e) {
|
bool GUI::event(QEvent * e) {
|
||||||
switch(e->type()) {
|
switch(e->type()) {
|
||||||
case QEvent::WindowStateChange: {
|
case QEvent::WindowStateChange: {
|
||||||
qDebug("Window change event");
|
qDebug("Window change event");
|
||||||
//Now check to see if the window is minimised
|
//Now check to see if the window is minimised
|
||||||
if(isMinimized()) {
|
if(isMinimized()) {
|
||||||
qDebug("minimisation");
|
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));
|
qDebug("Has active window: %d", (int)(qApp->activeWindow() != 0));
|
||||||
// Check if there is a modal window
|
// Check if there is a modal window
|
||||||
bool has_modal_window = false;
|
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());
|
qDebug("MAC: new toolbar visibility is %d", !actionTop_tool_bar->isChecked());
|
||||||
actionTop_tool_bar->toggle();
|
actionTop_tool_bar->toggle();
|
||||||
Preferences().setToolbarDisplayed(actionTop_tool_bar->isChecked());
|
Preferences::setToolbarDisplayed(actionTop_tool_bar->isChecked());
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -778,7 +755,7 @@ bool MainWindow::event(QEvent * e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Action executed when a file is dropped
|
// Action executed when a file is dropped
|
||||||
void MainWindow::dropEvent(QDropEvent *event) {
|
void GUI::dropEvent(QDropEvent *event) {
|
||||||
event->acceptProposedAction();
|
event->acceptProposedAction();
|
||||||
QStringList files;
|
QStringList files;
|
||||||
if(event->mimeData()->hasUrls()) {
|
if(event->mimeData()->hasUrls()) {
|
||||||
@@ -815,7 +792,7 @@ void MainWindow::dropEvent(QDropEvent *event) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(useTorrentAdditionDialog) {
|
if(useTorrentAdditionDialog) {
|
||||||
torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
|
torrentAdditionDialog *dialog = new torrentAdditionDialog(this, BTSession);
|
||||||
dialog->showLoad(file);
|
dialog->showLoad(file);
|
||||||
}else{
|
}else{
|
||||||
BTSession->addTorrent(file);
|
BTSession->addTorrent(file);
|
||||||
@@ -824,7 +801,7 @@ void MainWindow::dropEvent(QDropEvent *event) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Decode if we accept drag 'n drop or not
|
// 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()){
|
foreach(const QString &mime, event->mimeData()->formats()){
|
||||||
qDebug("mimeData: %s", mime.toLocal8Bit().data());
|
qDebug("mimeData: %s", mime.toLocal8Bit().data());
|
||||||
}
|
}
|
||||||
@@ -841,7 +818,7 @@ void MainWindow::dragEnterEvent(QDragEnterEvent *event) {
|
|||||||
|
|
||||||
// Display a dialog to allow user to add
|
// Display a dialog to allow user to add
|
||||||
// torrents to download list
|
// torrents to download list
|
||||||
void MainWindow::on_actionOpen_triggered() {
|
void GUI::on_actionOpen_triggered() {
|
||||||
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||||
// Open File Open Dialog
|
// Open File Open Dialog
|
||||||
// Note: it is possible to select more than one file
|
// Note: it is possible to select more than one file
|
||||||
@@ -853,7 +830,7 @@ void MainWindow::on_actionOpen_triggered() {
|
|||||||
const uint listSize = pathsList.size();
|
const uint listSize = pathsList.size();
|
||||||
for(uint i=0; i<listSize; ++i) {
|
for(uint i=0; i<listSize; ++i) {
|
||||||
if(useTorrentAdditionDialog) {
|
if(useTorrentAdditionDialog) {
|
||||||
torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
|
torrentAdditionDialog *dialog = new torrentAdditionDialog(this, BTSession);
|
||||||
dialog->showLoad(pathsList.at(i));
|
dialog->showLoad(pathsList.at(i));
|
||||||
}else{
|
}else{
|
||||||
BTSession->addTorrent(pathsList.at(i));
|
BTSession->addTorrent(pathsList.at(i));
|
||||||
@@ -870,11 +847,11 @@ void MainWindow::on_actionOpen_triggered() {
|
|||||||
// This function parse the parameters and call
|
// This function parse the parameters and call
|
||||||
// the right addTorrent function, considering
|
// the right addTorrent function, considering
|
||||||
// the parameter type.
|
// the parameter type.
|
||||||
void MainWindow::processParams(const QString& params_str) {
|
void GUI::processParams(const QString& params_str) {
|
||||||
processParams(params_str.split("|", QString::SkipEmptyParts));
|
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"));
|
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||||
const bool useTorrentAdditionDialog = settings.value(QString::fromUtf8("Preferences/Downloads/AdditionDialog"), true).toBool();
|
const bool useTorrentAdditionDialog = settings.value(QString::fromUtf8("Preferences/Downloads/AdditionDialog"), true).toBool();
|
||||||
foreach(QString param, params) {
|
foreach(QString param, params) {
|
||||||
@@ -888,14 +865,14 @@ void MainWindow::processParams(const QStringList& params) {
|
|||||||
}
|
}
|
||||||
if(param.startsWith("magnet:", Qt::CaseInsensitive)) {
|
if(param.startsWith("magnet:", Qt::CaseInsensitive)) {
|
||||||
if(useTorrentAdditionDialog) {
|
if(useTorrentAdditionDialog) {
|
||||||
torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
|
torrentAdditionDialog *dialog = new torrentAdditionDialog(this, BTSession);
|
||||||
dialog->showLoadMagnetURI(param);
|
dialog->showLoadMagnetURI(param);
|
||||||
} else {
|
} else {
|
||||||
BTSession->addMagnetUri(param);
|
BTSession->addMagnetUri(param);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(useTorrentAdditionDialog) {
|
if(useTorrentAdditionDialog) {
|
||||||
torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
|
torrentAdditionDialog *dialog = new torrentAdditionDialog(this, BTSession);
|
||||||
dialog->showLoad(param);
|
dialog->showLoad(param);
|
||||||
}else{
|
}else{
|
||||||
BTSession->addTorrent(param);
|
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);
|
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"));
|
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||||
const bool useTorrentAdditionDialog = settings.value(QString::fromUtf8("Preferences/Downloads/AdditionDialog"), true).toBool();
|
const bool useTorrentAdditionDialog = settings.value(QString::fromUtf8("Preferences/Downloads/AdditionDialog"), true).toBool();
|
||||||
if(useTorrentAdditionDialog) {
|
if(useTorrentAdditionDialog) {
|
||||||
torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
|
torrentAdditionDialog *dialog = new torrentAdditionDialog(this, BTSession);
|
||||||
dialog->showLoad(path, url);
|
dialog->showLoad(path, url);
|
||||||
}else{
|
}else{
|
||||||
BTSession->addTorrent(path, false, url);
|
BTSession->addTorrent(path, false, url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::optionsSaved() {
|
void GUI::optionsSaved() {
|
||||||
loadPreferences();
|
loadPreferences();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load program preferences
|
// Load program preferences
|
||||||
void MainWindow::loadPreferences(bool configure_session) {
|
void GUI::loadPreferences(bool configure_session) {
|
||||||
BTSession->addConsoleMessage(tr("Options were saved successfully."));
|
BTSession->addConsoleMessage(tr("Options were saved successfully."));
|
||||||
const Preferences pref;
|
#ifndef Q_WS_MAC
|
||||||
const bool newSystrayIntegration = pref.systrayIntegration();
|
const bool newSystrayIntegration = Preferences::systrayIntegration();
|
||||||
actionLock_qBittorrent->setEnabled(newSystrayIntegration);
|
actionLock_qBittorrent->setEnabled(newSystrayIntegration);
|
||||||
if(newSystrayIntegration != (systrayIcon!=0)) {
|
if(newSystrayIntegration != (systrayIcon!=0)) {
|
||||||
if(newSystrayIntegration) {
|
if(newSystrayIntegration) {
|
||||||
@@ -952,8 +929,9 @@ void MainWindow::loadPreferences(bool configure_session) {
|
|||||||
delete myTrayIconMenu;
|
delete myTrayIconMenu;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
// General
|
// General
|
||||||
if(pref.isToolbarDisplayed()) {
|
if(Preferences::isToolbarDisplayed()) {
|
||||||
toolBar->setVisible(true);
|
toolBar->setVisible(true);
|
||||||
toolBar->layout()->setSpacing(7);
|
toolBar->layout()->setSpacing(7);
|
||||||
} else {
|
} else {
|
||||||
@@ -961,15 +939,15 @@ void MainWindow::loadPreferences(bool configure_session) {
|
|||||||
search_filter->clear();
|
search_filter->clear();
|
||||||
toolBar->setVisible(false);
|
toolBar->setVisible(false);
|
||||||
}
|
}
|
||||||
const uint new_refreshInterval = pref.getRefreshInterval();
|
const uint new_refreshInterval = Preferences::getRefreshInterval();
|
||||||
transferList->setRefreshInterval(new_refreshInterval);
|
transferList->setRefreshInterval(new_refreshInterval);
|
||||||
transferList->setAlternatingRowColors(pref.useAlternatingRowColors());
|
transferList->setAlternatingRowColors(Preferences::useAlternatingRowColors());
|
||||||
properties->getFilesList()->setAlternatingRowColors(pref.useAlternatingRowColors());
|
properties->getFilesList()->setAlternatingRowColors(Preferences::useAlternatingRowColors());
|
||||||
properties->getTrackerList()->setAlternatingRowColors(pref.useAlternatingRowColors());
|
properties->getTrackerList()->setAlternatingRowColors(Preferences::useAlternatingRowColors());
|
||||||
properties->getPeerList()->setAlternatingRowColors(pref.useAlternatingRowColors());
|
properties->getPeerList()->setAlternatingRowColors(Preferences::useAlternatingRowColors());
|
||||||
// Queueing System
|
// Queueing System
|
||||||
if(pref.isQueueingSystemEnabled()) {
|
if(Preferences::isQueueingSystemEnabled()) {
|
||||||
if(!actionDecreasePriority->isVisible()) {
|
if(!configure_session || !BTSession->isQueueingEnabled()) {
|
||||||
transferList->hidePriorityColumn(false);
|
transferList->hidePriorityColumn(false);
|
||||||
actionDecreasePriority->setVisible(true);
|
actionDecreasePriority->setVisible(true);
|
||||||
actionIncreasePriority->setVisible(true);
|
actionIncreasePriority->setVisible(true);
|
||||||
@@ -978,7 +956,7 @@ void MainWindow::loadPreferences(bool configure_session) {
|
|||||||
toolBar->layout()->setSpacing(7);
|
toolBar->layout()->setSpacing(7);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(actionDecreasePriority->isVisible()) {
|
if(BTSession->isQueueingEnabled()) {
|
||||||
transferList->hidePriorityColumn(true);
|
transferList->hidePriorityColumn(true);
|
||||||
actionDecreasePriority->setVisible(false);
|
actionDecreasePriority->setVisible(false);
|
||||||
actionIncreasePriority->setVisible(false);
|
actionIncreasePriority->setVisible(false);
|
||||||
@@ -997,7 +975,7 @@ void MainWindow::loadPreferences(bool configure_session) {
|
|||||||
qDebug("GUI settings loaded");
|
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
|
// Trackers whose authentication was cancelled
|
||||||
if(unauthenticated_trackers.indexOf(tracker) < 0) {
|
if(unauthenticated_trackers.indexOf(tracker) < 0) {
|
||||||
unauthenticated_trackers << tracker;
|
unauthenticated_trackers << tracker;
|
||||||
@@ -1005,7 +983,7 @@ void MainWindow::addUnauthenticatedTracker(const QPair<QTorrentHandle,QString> &
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Called when a tracker requires authentication
|
// 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) {
|
if(unauthenticated_trackers.indexOf(QPair<QTorrentHandle,QString>(h, h.current_tracker())) < 0) {
|
||||||
// Tracker login
|
// Tracker login
|
||||||
new trackerLogin(this, h);
|
new trackerLogin(this, h);
|
||||||
@@ -1013,10 +991,11 @@ void MainWindow::trackerAuthenticationRequired(QTorrentHandle& h) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check connection status and display right icon
|
// Check connection status and display right icon
|
||||||
void MainWindow::updateGUI() {
|
void GUI::updateGUI() {
|
||||||
// update global informations
|
// update global informations
|
||||||
|
#ifndef Q_WS_MAC
|
||||||
if(systrayIcon) {
|
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;'>";
|
QString html = "<div style='background-color: #678db2; color: #fff;height: 18px; font-weight: bold; margin-bottom: 5px;'>";
|
||||||
html += tr("qBittorrent");
|
html += tr("qBittorrent");
|
||||||
html += "</div>";
|
html += "</div>";
|
||||||
@@ -1034,22 +1013,18 @@ void MainWindow::updateGUI() {
|
|||||||
#endif
|
#endif
|
||||||
systrayIcon->setToolTip(html); // tray icon
|
systrayIcon->setToolTip(html); // tray icon
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if(displaySpeedInTitle) {
|
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)));
|
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 {
|
void GUI::showNotificationBaloon(QString title, QString msg) const {
|
||||||
if(!Preferences().useProgramNotification()) return;
|
if(!Preferences::useProgramNotification()) return;
|
||||||
#ifdef WITH_LIBNOTIFY
|
#ifdef WITH_LIBNOTIFY
|
||||||
if (notify_init ("summary-body")) {
|
if (notify_init ("summary-body")) {
|
||||||
NotifyNotification* notification;
|
NotifyNotification* notification;
|
||||||
|
notification = notify_notification_new (qPrintable(title), qPrintable(msg), "qbittorrent", 0);
|
||||||
notification = notify_notification_new (qPrintable(title), qPrintable(msg), "qbittorrent"
|
|
||||||
#if !defined(NOTIFY_VERSION_MINOR) || (NOTIFY_VERSION_MAJOR == 0 && NOTIFY_VERSION_MINOR < 7)
|
|
||||||
, 0
|
|
||||||
#endif
|
|
||||||
);
|
|
||||||
gboolean success = notify_notification_show (notification, NULL);
|
gboolean success = notify_notification_show (notification, NULL);
|
||||||
g_object_unref(G_OBJECT(notification));
|
g_object_unref(G_OBJECT(notification));
|
||||||
notify_uninit ();
|
notify_uninit ();
|
||||||
@@ -1058,8 +1033,10 @@ void MainWindow::showNotificationBaloon(QString title, QString msg) const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef Q_WS_MAC
|
||||||
if(systrayIcon && QSystemTrayIcon::supportsMessages())
|
if(systrayIcon && QSystemTrayIcon::supportsMessages())
|
||||||
systrayIcon->showMessage(title, msg, QSystemTrayIcon::Information, TIME_TRAY_BALLOON);
|
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"));
|
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||||
const bool useTorrentAdditionDialog = settings.value(QString::fromUtf8("Preferences/Downloads/AdditionDialog"), true).toBool();
|
const bool useTorrentAdditionDialog = settings.value(QString::fromUtf8("Preferences/Downloads/AdditionDialog"), true).toBool();
|
||||||
foreach(QString url, url_list) {
|
foreach(QString url, url_list) {
|
||||||
@@ -1078,7 +1055,7 @@ void MainWindow::downloadFromURLList(const QStringList& url_list) {
|
|||||||
}
|
}
|
||||||
if(url.startsWith("magnet:", Qt::CaseInsensitive)) {
|
if(url.startsWith("magnet:", Qt::CaseInsensitive)) {
|
||||||
if(useTorrentAdditionDialog) {
|
if(useTorrentAdditionDialog) {
|
||||||
torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
|
torrentAdditionDialog *dialog = new torrentAdditionDialog(this, BTSession);
|
||||||
dialog->showLoadMagnetURI(url);
|
dialog->showLoadMagnetURI(url);
|
||||||
} else {
|
} else {
|
||||||
BTSession->addMagnetUri(url);
|
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;
|
static int timeout = 20;
|
||||||
if(QSystemTrayIcon::isSystemTrayAvailable()) {
|
if(QSystemTrayIcon::isSystemTrayAvailable()) {
|
||||||
// Ok, systray integration is now supported
|
// Ok, systray integration is now supported
|
||||||
@@ -1113,16 +1091,17 @@ void MainWindow::createSystrayDelayed() {
|
|||||||
delete systrayCreator;
|
delete systrayCreator;
|
||||||
// Disable it in program preferences to
|
// Disable it in program preferences to
|
||||||
// avoid trying at earch startup
|
// 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);
|
actionUse_alternative_speed_limits->setChecked(alternative);
|
||||||
}
|
}
|
||||||
|
|
||||||
QMenu* MainWindow::getTrayIconMenu() {
|
QMenu* GUI::getTrayIconMenu() {
|
||||||
if(myTrayIconMenu)
|
if(myTrayIconMenu)
|
||||||
return myTrayIconMenu;
|
return myTrayIconMenu;
|
||||||
// Tray icon Menu
|
// Tray icon Menu
|
||||||
@@ -1130,9 +1109,8 @@ QMenu* MainWindow::getTrayIconMenu() {
|
|||||||
myTrayIconMenu->addAction(actionOpen);
|
myTrayIconMenu->addAction(actionOpen);
|
||||||
myTrayIconMenu->addAction(actionDownload_from_URL);
|
myTrayIconMenu->addAction(actionDownload_from_URL);
|
||||||
myTrayIconMenu->addSeparator();
|
myTrayIconMenu->addSeparator();
|
||||||
const bool isAltBWEnabled = Preferences().isAltBandwidthEnabled();
|
updateAltSpeedsBtn(Preferences::isAltBandwidthEnabled());
|
||||||
updateAltSpeedsBtn(isAltBWEnabled);
|
actionUse_alternative_speed_limits->setChecked(Preferences::isAltBandwidthEnabled());
|
||||||
actionUse_alternative_speed_limits->setChecked(isAltBWEnabled);
|
|
||||||
myTrayIconMenu->addAction(actionUse_alternative_speed_limits);
|
myTrayIconMenu->addAction(actionUse_alternative_speed_limits);
|
||||||
myTrayIconMenu->addAction(actionSet_global_download_limit);
|
myTrayIconMenu->addAction(actionSet_global_download_limit);
|
||||||
myTrayIconMenu->addAction(actionSet_global_upload_limit);
|
myTrayIconMenu->addAction(actionSet_global_upload_limit);
|
||||||
@@ -1146,7 +1124,7 @@ QMenu* MainWindow::getTrayIconMenu() {
|
|||||||
return myTrayIconMenu;
|
return myTrayIconMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::createTrayIcon() {
|
void GUI::createTrayIcon() {
|
||||||
// Tray icon
|
// Tray icon
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
systrayIcon = new QSystemTrayIcon(QIcon(QString::fromUtf8(":/Icons/skin/qbittorrent16.png")), this);
|
systrayIcon = new QSystemTrayIcon(QIcon(QString::fromUtf8(":/Icons/skin/qbittorrent16.png")), this);
|
||||||
@@ -1162,7 +1140,7 @@ void MainWindow::createTrayIcon() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Display Program Options
|
// Display Program Options
|
||||||
void MainWindow::on_actionOptions_triggered() {
|
void GUI::on_actionOptions_triggered() {
|
||||||
if(options) {
|
if(options) {
|
||||||
// Get focus
|
// Get focus
|
||||||
options->setFocus();
|
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();
|
bool is_visible = static_cast<QAction*>(sender())->isChecked();
|
||||||
toolBar->setVisible(is_visible);
|
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();
|
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() {
|
void GUI::on_actionSpeed_in_title_bar_triggered() {
|
||||||
bool is_checked = static_cast<QAction*>(sender())->isChecked();
|
|
||||||
Preferences().setShutdownqBTWhenDownloadsComplete(is_checked);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MainWindow::on_actionSpeed_in_title_bar_triggered() {
|
|
||||||
displaySpeedInTitle = static_cast<QAction*>(sender())->isChecked();
|
displaySpeedInTitle = static_cast<QAction*>(sender())->isChecked();
|
||||||
Preferences().showSpeedInTitleBar(displaySpeedInTitle);
|
Preferences::showSpeedInTitleBar(displaySpeedInTitle);
|
||||||
if(displaySpeedInTitle)
|
if(displaySpeedInTitle)
|
||||||
updateGUI();
|
updateGUI();
|
||||||
else
|
else
|
||||||
setWindowTitle(tr("qBittorrent %1", "e.g: qBittorrent v0.x").arg(QString::fromUtf8(VERSION)));
|
setWindowTitle(tr("qBittorrent %1", "e.g: qBittorrent v0.x").arg(QString::fromUtf8(VERSION)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionRSS_Reader_triggered() {
|
void GUI::on_actionRSS_Reader_triggered() {
|
||||||
RssSettings().setRSSEnabled(actionRSS_Reader->isChecked());
|
Preferences::setRSSEnabled(actionRSS_Reader->isChecked());
|
||||||
displayRSSTab(actionRSS_Reader->isChecked());
|
displayRSSTab(actionRSS_Reader->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionSearch_engine_triggered() {
|
void GUI::on_actionSearch_engine_triggered() {
|
||||||
Preferences().setSearchEnabled(actionSearch_engine->isChecked());
|
Preferences::setSearchEnabled(actionSearch_engine->isChecked());
|
||||||
displaySearchTab(actionSearch_engine->isChecked());
|
displaySearchTab(actionSearch_engine->isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_action_Import_Torrent_triggered()
|
|
||||||
{
|
|
||||||
TorrentImportDlg::importTorrent();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*****************************************************
|
/*****************************************************
|
||||||
* *
|
* *
|
||||||
* HTTP Downloader *
|
* HTTP Downloader *
|
||||||
@@ -1220,47 +1188,10 @@ void MainWindow::on_action_Import_Torrent_triggered()
|
|||||||
|
|
||||||
// Display an input dialog to prompt user for
|
// Display an input dialog to prompt user for
|
||||||
// an url
|
// an url
|
||||||
void MainWindow::on_actionDownload_from_URL_triggered() {
|
void GUI::on_actionDownload_from_URL_triggered() {
|
||||||
if(!downloadFromURLDialog) {
|
if(!downloadFromURLDialog) {
|
||||||
downloadFromURLDialog = new downloadFromURL(this);
|
downloadFromURLDialog = new downloadFromURL(this);
|
||||||
connect(downloadFromURLDialog, SIGNAL(urlsReadyToBeDownloaded(const QStringList&)), this, SLOT(downloadFromURLList(const QStringList&)));
|
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();
|
|
||||||
}
|
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
#include "ui_mainwindow.h"
|
#include "ui_mainwindow.h"
|
||||||
#include "qtorrenthandle.h"
|
#include "qtorrenthandle.h"
|
||||||
|
|
||||||
class QBtSession;
|
class Bittorrent;
|
||||||
class QTimer;
|
class QTimer;
|
||||||
class downloadFromURL;
|
class downloadFromURL;
|
||||||
class SearchEngine;
|
class SearchEngine;
|
||||||
@@ -54,19 +54,19 @@ class PropertiesWidget;
|
|||||||
class StatusBar;
|
class StatusBar;
|
||||||
class consoleDlg;
|
class consoleDlg;
|
||||||
class about;
|
class about;
|
||||||
class TorrentCreatorDlg;
|
class createtorrent;
|
||||||
class downloadFromURL;
|
class downloadFromURL;
|
||||||
class HidableTabWidget;
|
class HidableTabWidget;
|
||||||
class LineEdit;
|
class LineEdit;
|
||||||
class QFileSystemWatcher;
|
class QFileSystemWatcher;
|
||||||
|
|
||||||
class MainWindow : public QMainWindow, private Ui::MainWindow{
|
class GUI : public QMainWindow, private Ui::MainWindow{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Construct / Destruct
|
// Construct / Destruct
|
||||||
MainWindow(QWidget *parent=0, QStringList torrentCmdLine=QStringList());
|
GUI(QWidget *parent=0, QStringList torrentCmdLine=QStringList());
|
||||||
~MainWindow();
|
~GUI();
|
||||||
// Methods
|
// Methods
|
||||||
QWidget* getCurrentTabWidget() const;
|
QWidget* getCurrentTabWidget() const;
|
||||||
TransferListWidget* getTransferList() const { return transferList; }
|
TransferListWidget* getTransferList() const { return transferList; }
|
||||||
@@ -79,8 +79,7 @@ public slots:
|
|||||||
void showNotificationBaloon(QString title, QString msg) const;
|
void showNotificationBaloon(QString title, QString msg) const;
|
||||||
void downloadFromURLList(const QStringList& urls);
|
void downloadFromURLList(const QStringList& urls);
|
||||||
void updateAltSpeedsBtn(bool alternative);
|
void updateAltSpeedsBtn(bool alternative);
|
||||||
void updateNbTorrents();
|
void updateNbTorrents(unsigned int nb_downloading, unsigned int nb_seeding, unsigned int nb_active, unsigned int nb_inactive, unsigned int nb_paused);
|
||||||
void deleteBTSession();
|
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
// GUI related slots
|
// GUI related slots
|
||||||
@@ -105,7 +104,6 @@ protected slots:
|
|||||||
void defineUILockPassword();
|
void defineUILockPassword();
|
||||||
bool unlockUI();
|
bool unlockUI();
|
||||||
void notifyOfUpdate(QString);
|
void notifyOfUpdate(QString);
|
||||||
void showConnectionSettings();
|
|
||||||
// Keyboard shortcuts
|
// Keyboard shortcuts
|
||||||
void createKeyboardShortcuts();
|
void createKeyboardShortcuts();
|
||||||
void displayTransferTab() const;
|
void displayTransferTab() const;
|
||||||
@@ -130,10 +128,6 @@ protected slots:
|
|||||||
void optionsSaved();
|
void optionsSaved();
|
||||||
// HTTP slots
|
// HTTP slots
|
||||||
void on_actionDownload_from_URL_triggered();
|
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:
|
protected:
|
||||||
void closeEvent(QCloseEvent *);
|
void closeEvent(QCloseEvent *);
|
||||||
@@ -145,7 +139,7 @@ protected:
|
|||||||
private:
|
private:
|
||||||
QFileSystemWatcher *executable_watcher;
|
QFileSystemWatcher *executable_watcher;
|
||||||
// Bittorrent
|
// Bittorrent
|
||||||
QBtSession *BTSession;
|
Bittorrent *BTSession;
|
||||||
QList<QPair<QTorrentHandle,QString> > unauthenticated_trackers; // Still needed?
|
QList<QPair<QTorrentHandle,QString> > unauthenticated_trackers; // Still needed?
|
||||||
// GUI related
|
// GUI related
|
||||||
QTimer *guiUpdater;
|
QTimer *guiUpdater;
|
||||||
@@ -154,7 +148,7 @@ private:
|
|||||||
QPointer<options_imp> options;
|
QPointer<options_imp> options;
|
||||||
QPointer<consoleDlg> console;
|
QPointer<consoleDlg> console;
|
||||||
QPointer<about> aboutDlg;
|
QPointer<about> aboutDlg;
|
||||||
QPointer<TorrentCreatorDlg> createTorrentDlg;
|
QPointer<createtorrent> createTorrentDlg;
|
||||||
QPointer<downloadFromURL> downloadFromURLDialog;
|
QPointer<downloadFromURL> downloadFromURLDialog;
|
||||||
QPointer<QSystemTrayIcon> systrayIcon;
|
QPointer<QSystemTrayIcon> systrayIcon;
|
||||||
QPointer<QTimer> systrayCreator;
|
QPointer<QTimer> systrayCreator;
|
||||||
@@ -176,7 +170,6 @@ private:
|
|||||||
QAction *prioSeparator2;
|
QAction *prioSeparator2;
|
||||||
QSplitter *hSplitter;
|
QSplitter *hSplitter;
|
||||||
QSplitter *vSplitter;
|
QSplitter *vSplitter;
|
||||||
QMenu *lockMenu;
|
|
||||||
// Search
|
// Search
|
||||||
QPointer<SearchEngine> searchEngine;
|
QPointer<SearchEngine> searchEngine;
|
||||||
// RSS
|
// RSS
|
||||||
@@ -188,9 +181,6 @@ private slots:
|
|||||||
void on_actionSpeed_in_title_bar_triggered();
|
void on_actionSpeed_in_title_bar_triggered();
|
||||||
void on_actionTop_tool_bar_triggered();
|
void on_actionTop_tool_bar_triggered();
|
||||||
void on_actionShutdown_when_downloads_complete_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
|
#endif
|
||||||
|
Before Width: | Height: | Size: 643 B |
|
Before Width: | Height: | Size: 408 B |
|
Before Width: | Height: | Size: 604 B |
|
Before Width: | Height: | Size: 591 B |
|
Before Width: | Height: | Size: 643 B |
|
Before Width: | Height: | Size: 600 B |
BIN
src/Icons/flags/algeria.png
Normal file
|
After Width: | Height: | Size: 473 B |
|
Before Width: | Height: | Size: 497 B |
|
Before Width: | Height: | Size: 488 B |
|
Before Width: | Height: | Size: 428 B |
|
Before Width: | Height: | Size: 506 B |
BIN
src/Icons/flags/argentina.png
Normal file
|
After Width: | Height: | Size: 308 B |
|
Before Width: | Height: | Size: 647 B |
|
Before Width: | Height: | Size: 403 B |
|
Before Width: | Height: | Size: 673 B |
BIN
src/Icons/flags/australia.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
src/Icons/flags/austria.png
Normal file
|
After Width: | Height: | Size: 285 B |
|
Before Width: | Height: | Size: 524 B |
|
Before Width: | Height: | Size: 663 B |
|
Before Width: | Height: | Size: 589 B |
|
Before Width: | Height: | Size: 593 B |
|
Before Width: | Height: | Size: 585 B |
|
Before Width: | Height: | Size: 504 B |
|
Before Width: | Height: | Size: 449 B |
BIN
src/Icons/flags/belarus.png
Normal file
|
After Width: | Height: | Size: 373 B |
BIN
src/Icons/flags/belgium.png
Normal file
|
After Width: | Height: | Size: 173 B |
|
Before Width: | Height: | Size: 497 B |
|
Before Width: | Height: | Size: 462 B |
|
Before Width: | Height: | Size: 457 B |
|
Before Width: | Height: | Size: 675 B |
|
Before Width: | Height: | Size: 486 B |
|
Before Width: | Height: | Size: 611 B |
|
Before Width: | Height: | Size: 639 B |
|
Before Width: | Height: | Size: 500 B |
BIN
src/Icons/flags/bosnia.png
Normal file
|
After Width: | Height: | Size: 583 B |
|
Before Width: | Height: | Size: 593 B |
BIN
src/Icons/flags/brazil.png
Normal file
|
After Width: | Height: | Size: 799 B |
|
Before Width: | Height: | Size: 526 B |
|
Before Width: | Height: | Size: 631 B |
BIN
src/Icons/flags/bulgaria.png
Normal file
|
After Width: | Height: | Size: 200 B |
|
Before Width: | Height: | Size: 512 B |
|
Before Width: | Height: | Size: 443 B |
|
Before Width: | Height: | Size: 514 B |
|
Before Width: | Height: | Size: 600 B |
|
Before Width: | Height: | Size: 628 B |
BIN
src/Icons/flags/canada.png
Normal file
|
After Width: | Height: | Size: 686 B |
|
Before Width: | Height: | Size: 625 B |
|
Before Width: | Height: | Size: 528 B |
|
Before Width: | Height: | Size: 614 B |
|
Before Width: | Height: | Size: 521 B |
|
Before Width: | Height: | Size: 367 B |
BIN
src/Icons/flags/china.png
Normal file
|
After Width: | Height: | Size: 329 B |
|
Before Width: | Height: | Size: 453 B |
|
Before Width: | Height: | Size: 586 B |
|
Before Width: | Height: | Size: 450 B |
|
Before Width: | Height: | Size: 525 B |
|
Before Width: | Height: | Size: 472 B |
|
Before Width: | Height: | Size: 483 B |
BIN
src/Icons/flags/costa_rica.png
Normal file
|
After Width: | Height: | Size: 203 B |
|
Before Width: | Height: | Size: 477 B |
BIN
src/Icons/flags/croatia.png
Normal file
|
After Width: | Height: | Size: 479 B |
|
Before Width: | Height: | Size: 439 B |
|
Before Width: | Height: | Size: 563 B |
|
Before Width: | Height: | Size: 529 B |
|
Before Width: | Height: | Size: 608 B |
|
Before Width: | Height: | Size: 428 B |
|
Before Width: | Height: | Size: 476 B |
BIN
src/Icons/flags/czech.png
Normal file
|
After Width: | Height: | Size: 455 B |
|
Before Width: | Height: | Size: 545 B |
BIN
src/Icons/flags/denmark.png
Normal file
|
After Width: | Height: | Size: 270 B |
|
Before Width: | Height: | Size: 572 B |
|
Before Width: | Height: | Size: 495 B |
|
Before Width: | Height: | Size: 620 B |
|
Before Width: | Height: | Size: 508 B |
|
Before Width: | Height: | Size: 582 B |
|
Before Width: | Height: | Size: 500 B |
|
Before Width: | Height: | Size: 429 B |
|
Before Width: | Height: | Size: 465 B |
BIN
src/Icons/flags/egypt.png
Normal file
|
After Width: | Height: | Size: 314 B |
|
Before Width: | Height: | Size: 508 B |
|
Before Width: | Height: | Size: 653 B |
|
Before Width: | Height: | Size: 469 B |
|
Before Width: | Height: | Size: 592 B |
|
Before Width: | Height: | Size: 489 B |
BIN
src/Icons/flags/finland.png
Normal file
|
After Width: | Height: | Size: 290 B |
|
Before Width: | Height: | Size: 610 B |
|
Before Width: | Height: | Size: 648 B |
|
Before Width: | Height: | Size: 552 B |