mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-09 22:37:59 +00:00
- Code optimization using initialization lists
- Removed Traditional Chinese translation because we lost our translator and translation is outdated
This commit is contained in:
parent
c6b25e5f79
commit
6ecb45d661
2
TODO
2
TODO
@ -73,6 +73,7 @@ LANGUAGES UPDATED:
|
||||
|
||||
beta5->beta6 changelog:
|
||||
- FEATURE: Split download tab from GUI class and cleaned up code
|
||||
- FEATURE: A lot of code optimization
|
||||
- BUGFIX: Made torrent deletion from hard-drive safer
|
||||
- BUGFIX: Fixed a bug when switching from finished to downloading list
|
||||
- BUGFIX: Showing checking progress for paused torrents too
|
||||
@ -81,3 +82,4 @@ beta5->beta6 changelog:
|
||||
- BUGFIX: Made finished list context menu more similar to the download list one
|
||||
- BUGFIX: Fixed Pause/Start action in lists context menus
|
||||
- BUGFIX: Display the torrent that are being checked as 'checking' in seeding list
|
||||
- I18N: Removed no longer maintained Traditional chinese translation
|
@ -32,13 +32,10 @@
|
||||
#include <QHeaderView>
|
||||
#include <QMenu>
|
||||
|
||||
FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession){
|
||||
FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession) : parent(parent), BTSession(BTSession), nbFinished(0){
|
||||
setupUi(this);
|
||||
actionStart->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/play.png")));
|
||||
actionPause->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/pause.png")));
|
||||
nbFinished = 0;
|
||||
this->BTSession = BTSession;
|
||||
this->parent = parent;
|
||||
connect(BTSession, SIGNAL(addedTorrent(QString, QTorrentHandle&, bool)), this, SLOT(torrentAdded(QString, QTorrentHandle&, bool)));
|
||||
finishedListModel = new QStandardItemModel(0,7);
|
||||
finishedListModel->setHeaderData(F_NAME, Qt::Horizontal, tr("Name", "i.e: file name"));
|
||||
|
@ -34,11 +34,11 @@ using namespace libtorrent;
|
||||
class FinishedTorrents : public QWidget, public Ui::seeding {
|
||||
Q_OBJECT
|
||||
private:
|
||||
QObject *parent;
|
||||
bittorrent *BTSession;
|
||||
FinishedListDelegate *finishedListDelegate;
|
||||
QStandardItemModel *finishedListModel;
|
||||
unsigned int nbFinished;
|
||||
QObject *parent;
|
||||
|
||||
public:
|
||||
FinishedTorrents(QObject *parent, bittorrent *BTSession);
|
||||
|
@ -56,7 +56,7 @@ namespace fs = boost::filesystem;
|
||||
*****************************************************/
|
||||
|
||||
// Constructor
|
||||
GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent) {
|
||||
GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), force_exit(false) {
|
||||
setupUi(this);
|
||||
setWindowTitle(tr("qBittorrent %1", "e.g: qBittorrent v0.x").arg(QString::fromUtf8(VERSION)));
|
||||
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||
@ -104,7 +104,6 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent) {
|
||||
// creating options
|
||||
options = new options_imp(this);
|
||||
connect(options, SIGNAL(status_changed(QString, bool)), this, SLOT(OptionsSaved(QString, bool)));
|
||||
force_exit = false;
|
||||
BTSession = new bittorrent();
|
||||
connect(BTSession, SIGNAL(fullDiskError(QTorrentHandle&)), this, SLOT(fullDiskError(QTorrentHandle&)));
|
||||
connect(BTSession, SIGNAL(finishedTorrent(QTorrentHandle&)), this, SLOT(finishedTorrent(QTorrentHandle&)));
|
||||
|
@ -57,12 +57,11 @@ class about : public QDialog, private Ui::AboutDlg{
|
||||
- <u>Bulgarian:</u> Tsvetan & Boiko Bankov (emerge_life@users.sourceforge.net)<br>\
|
||||
- <u>Catalan:</u> Gekko Dam Beer (gekko04@users.sourceforge.net)<br>\
|
||||
- <u>Chinese (Simplified):</u> Guo Yue (guoyue0418@hotmail.com)<br>\
|
||||
- <u>Chinese (Traditional):</u> Jeff Chen (jeff.cn.chen@gmail.com)<br>\
|
||||
- <u>Danish:</u> Mathias Nielsen (comoneo@gmail.com)<br>\
|
||||
- <u>Dutch:</u> Luke Niesink (luke@lukeniesink.net)<br>\
|
||||
- <u>Dutch:</u> Luke Niesink (luke@lukeniesink.net)<br>\
|
||||
- <u>Finnish:</u> Niklas Laxström (nikerabbit@users.sourceforge.net)<br>\
|
||||
- <u>German:</u> Niels Hoffmann (zentralmaschine@users.sourceforge.net)<br>\
|
||||
- <u>Greek:</u> Tsvetan Bankov (emerge_life@users.sourceforge.net)<br>\
|
||||
- <u>Greek:</u> Tsvetan Bankov (emerge_life@users.sourceforge.net)<br>\
|
||||
- <u>Hungarian:</u> Majoros Péter (majoros.j.p@t-online.hu)<br>\
|
||||
- <u>Italian:</u> Mirko Ferrari (mirkoferrari@gmail.com) and Ferraro Luciano (luciano.ferraro@gmail.com)<br>\
|
||||
- <u>Japanese:</u> Nardog (nardog@e2umail.com)<br>\
|
||||
@ -74,7 +73,7 @@ class about : public QDialog, private Ui::AboutDlg{
|
||||
- <u>Russian:</u> Nick Khazov (m2k3d0n at users.sourceforge.net)<br>\
|
||||
- <u>Slovak:</u> helix84<br>\
|
||||
- <u>Spanish:</u> Vicente Raul Plata Fonseca (silverxnt@users.sourceforge.net)<br>\
|
||||
- <u>Swedish:</u> Daniel Nylander (po@danielnylander.se)<br>\
|
||||
- <u>Swedish:</u> Daniel Nylander (po@danielnylander.se)<br>\
|
||||
- <u>Turkish:</u> Erdem Bingöl (erdem84@gmail.com)<br>\
|
||||
- <u>Ukrainian:</u> Andrey Shpachenko (masterfix@users.sourceforge.net)<br><br>"));
|
||||
te_translation->append(tr("Please contact me if you would like to translate qBittorrent into your own language."));
|
||||
|
@ -42,10 +42,9 @@
|
||||
#define ETAS_MAX_VALUES 8
|
||||
|
||||
// Main constructor
|
||||
bittorrent::bittorrent() {
|
||||
bittorrent::bittorrent() : timerScan(0), DHTEnabled(false){
|
||||
// To avoid some exceptions
|
||||
fs::path::default_name_check(fs::no_check);
|
||||
timerScan = 0;
|
||||
// Supported preview extensions
|
||||
// XXX: A bit dirty to do it this way (use mime types?)
|
||||
supported_preview_extensions << "AVI" << "DIVX" << "MPG" << "MPEG" << "MPE" << "MP3" << "OGG" << "WMV" << "WMA" << "RMV" << "RMVB" << "ASF" << "MOV" << "WAV" << "MP2" << "SWF" << "AC3" << "OGM" << "MP4" << "FLV" << "VOB" << "QT" << "MKV" << "AIF" << "AIFF" << "AIFC" << "MID" << "MPG" << "RA" << "RAM" << "AU" << "M4A" << "FLAC" << "M4P" << "3GP" << "AAC" << "RM" << "SWA" << "MPC" << "MPP";
|
||||
@ -57,8 +56,6 @@ bittorrent::bittorrent() {
|
||||
s->start_lsd();
|
||||
s->start_natpmp();
|
||||
s->start_upnp();
|
||||
// DHT (Trackerless), disabled until told otherwise
|
||||
DHTEnabled = false;
|
||||
// Enabling metadata plugin
|
||||
s->add_extension(&create_metadata_plugin);
|
||||
timerAlerts = new QTimer();
|
||||
|
@ -40,10 +40,10 @@ class bittorrent : public QObject{
|
||||
|
||||
private:
|
||||
session *s;
|
||||
bool DHTEnabled;
|
||||
QString scan_dir;
|
||||
QTimer *timerScan;
|
||||
QTimer *timerAlerts;
|
||||
bool DHTEnabled;
|
||||
downloadThread *downloader;
|
||||
QStringList supported_preview_extensions;
|
||||
QString defaultSavePath;
|
||||
|
@ -38,9 +38,7 @@ class subDeleteThread : public QThread {
|
||||
bool abort;
|
||||
|
||||
public:
|
||||
subDeleteThread(QObject *parent, QString save_path, QStringList files_path) : QThread(parent), save_path(save_path), files_path(files_path){
|
||||
abort = false;
|
||||
}
|
||||
subDeleteThread(QObject *parent, QString save_path, QStringList files_path) : QThread(parent), save_path(save_path), files_path(files_path), abort(false){}
|
||||
|
||||
~subDeleteThread(){
|
||||
abort = true;
|
||||
@ -72,9 +70,7 @@ class deleteThread : public QThread {
|
||||
QList<subDeleteThread*> subThreads;
|
||||
|
||||
public:
|
||||
deleteThread(QObject* parent) : QThread(parent){
|
||||
abort = false;
|
||||
}
|
||||
deleteThread(QObject* parent) : QThread(parent), abort(false){}
|
||||
|
||||
~deleteThread(){
|
||||
mutex.lock();
|
||||
|
@ -45,9 +45,7 @@ class subDownloadThread : public QThread {
|
||||
bool abort;
|
||||
|
||||
public:
|
||||
subDownloadThread(QObject *parent, QString url) : QThread(parent), url(url){
|
||||
abort = false;
|
||||
}
|
||||
subDownloadThread(QObject *parent, QString url) : QThread(parent), url(url), abort(false){}
|
||||
|
||||
~subDownloadThread(){
|
||||
abort = true;
|
||||
@ -146,9 +144,7 @@ class downloadThread : public QThread {
|
||||
void downloadFailure(QString url, QString reason);
|
||||
|
||||
public:
|
||||
downloadThread(QObject* parent) : QThread(parent){
|
||||
abort = false;
|
||||
}
|
||||
downloadThread(QObject* parent) : QThread(parent), abort(false){}
|
||||
|
||||
~downloadThread(){
|
||||
mutex.lock();
|
||||
|
@ -33,12 +33,8 @@
|
||||
#include <QTime>
|
||||
#include <QMenu>
|
||||
|
||||
DownloadingTorrents::DownloadingTorrents(QObject *parent, bittorrent *BTSession) {
|
||||
DownloadingTorrents::DownloadingTorrents(QObject *parent, bittorrent *BTSession) : parent(parent), BTSession(BTSession), delayedSorting(false), nbTorrents(0) {
|
||||
setupUi(this);
|
||||
this->BTSession = BTSession;
|
||||
this->parent = parent;
|
||||
delayedSorting = false;
|
||||
nbTorrents = 0;
|
||||
// Setting icons
|
||||
actionStart->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/play.png")));
|
||||
actionPause->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/pause.png")));
|
||||
|
@ -34,13 +34,13 @@ using namespace libtorrent;
|
||||
class DownloadingTorrents : public QWidget, public Ui::downloading{
|
||||
Q_OBJECT
|
||||
private:
|
||||
QObject *parent;
|
||||
bittorrent *BTSession;
|
||||
DLListDelegate *DLDelegate;
|
||||
QStandardItemModel *DLListModel;
|
||||
unsigned int nbTorrents;
|
||||
bool delayedSorting;
|
||||
unsigned int nbTorrents;
|
||||
Qt::SortOrder delayedSortingOrder;
|
||||
QObject *parent;
|
||||
|
||||
public:
|
||||
DownloadingTorrents(QObject *parent, bittorrent *BTSession);
|
||||
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -122,12 +122,10 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
||||
locales << "uk_UA";
|
||||
combo_i18n->addItem((QIcon(QString::fromUtf8(":/Icons/flags/russia.png"))), QString::fromUtf8("Русский"));
|
||||
locales << "ru_RU";
|
||||
combo_i18n->addItem((QIcon(QString::fromUtf8(":/Icons/flags/japan.png"))), QString::fromUtf8("日本語"));
|
||||
locales << "ja_JP";
|
||||
combo_i18n->addItem((QIcon(QString::fromUtf8(":/Icons/flags/japan.png"))), QString::fromUtf8("日本語"));
|
||||
locales << "ja_JP";
|
||||
combo_i18n->addItem((QIcon(QString::fromUtf8(":/Icons/flags/china.png"))), QString::fromUtf8("中文 (简体)"));
|
||||
locales << "zh_CN";
|
||||
combo_i18n->addItem((QIcon(QString::fromUtf8(":/Icons/flags/china_hong_kong.png"))), QString::fromUtf8("中文 (繁體)"));
|
||||
locales << "zh_HK";
|
||||
combo_i18n->addItem((QIcon(QString::fromUtf8(":/Icons/flags/south_korea.png"))), QString::fromUtf8("한글"));
|
||||
locales << "ko_KR";
|
||||
|
||||
|
@ -31,10 +31,8 @@
|
||||
#include <QStandardItemModel>
|
||||
|
||||
// Constructor
|
||||
properties::properties(QWidget *parent, bittorrent *BTSession, QTorrentHandle &h): QDialog(parent), h(h){
|
||||
properties::properties(QWidget *parent, bittorrent *BTSession, QTorrentHandle &h): QDialog(parent), h(h), BTSession(BTSession), changedFilteredfiles(false), hash(h.hash()) {
|
||||
setupUi(this);
|
||||
this->BTSession = BTSession;
|
||||
changedFilteredfiles = false;
|
||||
lbl_priorities->setText(tr("Priorities:")+"<ul><li>"+tr("Ignored: file is not downloaded at all")+"</li><li>"+tr("Normal: normal priority. Download order is dependent on availability")+"</li><li>"+tr("High: higher than normal priority. Pieces are preferred over pieces with the same availability, but not over pieces with lower availability")+"</li><li>"+tr("Maximum: maximum priority, availability is disregarded, the piece is preferred over any other piece with lower priority")+"</li></ul>");
|
||||
// set icons
|
||||
addTracker_button->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/add.png")));
|
||||
@ -66,7 +64,6 @@ properties::properties(QWidget *parent, bittorrent *BTSession, QTorrentHandle &h
|
||||
connect(addWS_button, SIGNAL(clicked()), this, SLOT(askWebSeed()));
|
||||
connect(deleteWS_button, SIGNAL(clicked()), this, SLOT(deleteSelectedUrlSeeds()));
|
||||
// get Infos from torrent handle
|
||||
hash = h.hash();
|
||||
fileName->setText(h.name());
|
||||
// Torrent Infos
|
||||
save_path->setText(h.save_path());
|
||||
|
@ -36,13 +36,13 @@ class properties : public QDialog, private Ui::properties{
|
||||
Q_OBJECT
|
||||
private:
|
||||
QTorrentHandle h;
|
||||
bittorrent *BTSession;
|
||||
bool changedFilteredfiles;
|
||||
QString hash;
|
||||
PropListDelegate *PropDelegate;
|
||||
QStandardItemModel *PropListModel;
|
||||
QTimer *updateInfosTimer;
|
||||
bool has_filtered_files;
|
||||
bool changedFilteredfiles;
|
||||
bittorrent *BTSession;
|
||||
QStringList urlSeeds;
|
||||
|
||||
protected slots:
|
||||
|
16
src/rss.h
16
src/rss.h
@ -59,9 +59,7 @@ class RssItem : public QObject {
|
||||
|
||||
public:
|
||||
// public constructor
|
||||
RssItem(const QDomElement& properties) {
|
||||
read = false;
|
||||
downloadLink = "none";
|
||||
RssItem(const QDomElement& properties) : read(false), downloadLink("none") {
|
||||
QDomElement property = properties.firstChild().toElement();
|
||||
while(!property.isNull()) {
|
||||
if (property.tagName() == "title")
|
||||
@ -116,18 +114,18 @@ class RssStream : public QObject{
|
||||
|
||||
private:
|
||||
QString title;
|
||||
QString alias;
|
||||
QString link;
|
||||
QString description;
|
||||
QString image;
|
||||
QString url;
|
||||
QString alias;
|
||||
QString filePath;
|
||||
QString iconPath;
|
||||
QList<RssItem*> listItem;
|
||||
QTime lastRefresh;
|
||||
bool read;
|
||||
bool downloadFailure;
|
||||
bool refreshed;
|
||||
bool downloadFailure;
|
||||
bool currently_loading;
|
||||
|
||||
public slots :
|
||||
@ -150,13 +148,7 @@ class RssStream : public QObject{
|
||||
}
|
||||
|
||||
public:
|
||||
RssStream(QString _url) {
|
||||
url = _url;
|
||||
alias = "";
|
||||
refreshed = false;
|
||||
downloadFailure = false;
|
||||
currently_loading = false;
|
||||
iconPath = ":/Icons/rss.png";
|
||||
RssStream(QString _url): url(_url), alias(""), iconPath(":/Icons/rss.png"), refreshed(false), downloadFailure(false), currently_loading(false) {
|
||||
qDebug("RSSStream constructed");
|
||||
}
|
||||
|
||||
|
@ -42,10 +42,8 @@
|
||||
|
||||
#define SEARCHHISTORY_MAXSIZE 50
|
||||
|
||||
SearchEngine::SearchEngine(bittorrent *BTSession, QSystemTrayIcon *myTrayIcon, bool systrayIntegration) : QWidget(), systrayIntegration(systrayIntegration){
|
||||
SearchEngine::SearchEngine(bittorrent *BTSession, QSystemTrayIcon *myTrayIcon, bool systrayIntegration) : QWidget(), BTSession(BTSession), myTrayIcon(myTrayIcon), systrayIntegration(systrayIntegration){
|
||||
setupUi(this);
|
||||
this->BTSession = BTSession;
|
||||
this->myTrayIcon = myTrayIcon;
|
||||
downloader = new downloadThread(this);
|
||||
connect(downloader, SIGNAL(downloadFinished(QString, QString)), this, SLOT(novaUpdateDownloaded(QString, QString)));
|
||||
connect(downloader, SIGNAL(downloadFailure(QString, QString)), this, SLOT(handleNovaDownloadFailure(QString, QString)));
|
||||
|
@ -123,7 +123,6 @@ TRANSLATIONS = $$LANG_PATH/qbittorrent_fr.ts \
|
||||
$$LANG_PATH/qbittorrent_uk.ts \
|
||||
$$LANG_PATH/qbittorrent_bg.ts \
|
||||
$$LANG_PATH/qbittorrent_it.ts \
|
||||
$$LANG_PATH/qbittorrent_zh_HK.ts \
|
||||
$$LANG_PATH/qbittorrent_sk.ts \
|
||||
$$LANG_PATH/qbittorrent_ro.ts \
|
||||
$$LANG_PATH/qbittorrent_pt.ts \
|
||||
|
Loading…
Reference in New Issue
Block a user