Skip to content

Commit

Permalink
- Code optimization using initialization lists
Browse files Browse the repository at this point in the history
- Removed Traditional Chinese translation because we lost our translator and translation is outdated
  • Loading branch information
Christophe Dumez committed Aug 28, 2007
1 parent c6b25e5 commit 6ecb45d
Show file tree
Hide file tree
Showing 19 changed files with 27 additions and 3,385 deletions.
2 changes: 2 additions & 0 deletions TODO
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
5 changes: 1 addition & 4 deletions src/FinishedTorrents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down
2 changes: 1 addition & 1 deletion src/FinishedTorrents.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions src/GUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down Expand Up @@ -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&)));
Expand Down
7 changes: 3 additions & 4 deletions src/about_imp.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,11 @@ class about : public QDialog, private Ui::AboutDlg{
- <u>Bulgarian:</u> Tsvetan & Boiko Bankov ([email protected])<br>\
- <u>Catalan:</u> Gekko Dam Beer ([email protected])<br>\
- <u>Chinese (Simplified):</u> Guo Yue ([email protected])<br>\
- <u>Chinese (Traditional):</u> Jeff Chen ([email protected])<br>\
- <u>Danish:</u> Mathias Nielsen ([email protected])<br>\
- <u>Dutch:</u> Luke Niesink ([email protected])<br>\
- <u>Dutch:</u> Luke Niesink ([email protected])<br>\
- <u>Finnish:</u> Niklas Laxström ([email protected])<br>\
- <u>German:</u> Niels Hoffmann ([email protected])<br>\
- <u>Greek:</u> Tsvetan Bankov ([email protected])<br>\
- <u>Greek:</u> Tsvetan Bankov ([email protected])<br>\
- <u>Hungarian:</u> Majoros Péter ([email protected])<br>\
- <u>Italian:</u> Mirko Ferrari ([email protected]) and Ferraro Luciano ([email protected])<br>\
- <u>Japanese:</u> Nardog ([email protected])<br>\
Expand All @@ -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 ([email protected])<br>\
- <u>Swedish:</u> Daniel Nylander ([email protected])<br>\
- <u>Swedish:</u> Daniel Nylander ([email protected])<br>\
- <u>Turkish:</u> Erdem Bingöl ([email protected])<br>\
- <u>Ukrainian:</u> Andrey Shpachenko ([email protected])<br><br>"));
te_translation->append(tr("Please contact me if you would like to translate qBittorrent into your own language."));
Expand Down
5 changes: 1 addition & 4 deletions src/bittorrent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion src/bittorrent.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 2 additions & 6 deletions src/deleteThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
8 changes: 2 additions & 6 deletions src/downloadThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
6 changes: 1 addition & 5 deletions src/downloadingTorrents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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")));
Expand Down
4 changes: 2 additions & 2 deletions src/downloadingTorrents.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Binary file removed src/lang/qbittorrent_zh_HK.qm
Binary file not shown.
Loading

0 comments on commit 6ecb45d

Please sign in to comment.