Compare commits

..

15 Commits

Author SHA1 Message Date
Christophe Dumez
6cf2b44b8a Tagged v2.2.3 release 2010-04-04 20:05:10 +00:00
Christophe Dumez
ba22fa8331 Bump to v2.2.3 2010-04-04 19:55:16 +00:00
Christophe Dumez
5ce02cb612 Clean fix for progress display with cleanlooks style 2010-03-31 14:36:16 +00:00
Christophe Dumez
1013f39a42 A msvc compilation fix 2010-03-30 19:40:35 +00:00
Christophe Dumez
cd5c4bf464 On Windows, add qBittorrent executable folder to PATH envar 2010-03-30 19:03:12 +00:00
Christophe Dumez
84bfc54b03 Updated Changelog 2010-03-30 12:13:43 +00:00
Christophe Dumez
5b3b5eb2ef Enable Apply button when alternative rate limits are changed 2010-03-30 12:09:51 +00:00
Christophe Dumez
990a863d41 Several compilation and execution fixes for Windows and OS/2
Cleaner binutils gold linker support
2010-03-30 11:39:40 +00:00
Christophe Dumez
7f27d10735 Fix possible error in boost exception handling 2010-03-29 10:44:33 +00:00
Christophe Dumez
1377a75a53 Fix typo 2010-03-27 16:00:47 +00:00
Christophe Dumez
bcd33fc861 ANother Windows fix 2010-03-27 15:58:28 +00:00
Christophe Dumez
46d8fa1656 Another compilation fix 2010-03-27 15:50:50 +00:00
Christophe Dumez
28cf69b84d Windows compilation fix improvement 2010-03-27 09:17:40 +00:00
Christophe Dumez
89389df74d Compilation fix on Windows (getuid missing) 2010-03-27 09:06:01 +00:00
Christophe Dumez
77c29f48cb Fix possible crash when deleting a torrent just after pausing it 2010-03-23 21:42:33 +00:00
23 changed files with 202 additions and 178 deletions

View File

@@ -1,3 +1,11 @@
* Sun Apr 04 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.2.3
- BUGFIX: Fix possible crash when deleting a torrent just after pausing it
- BUGFIX: Enable Apply button when alternative rate limits are changed
- BUGFIX: Source compatibility with Windows (Thanks Ishan Arora)
- BUGFIX: Source compatibility with eCS (OS/2) (Thanks Silvan Scherrer)
- BUGFIX: Cleaner binutils gold linker support
- BUGFIX: Clean fix for progress display with cleanlooks style
* Mon Mar 22 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.2.2 * Mon Mar 22 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.2.2
- FEATURE: DHT port can be set from Web UI - FEATURE: DHT port can be set from Web UI
- BUGFIX: Fix possible crash with folder scanning - BUGFIX: Fix possible crash with folder scanning

45
configure vendored
View File

@@ -21,6 +21,7 @@ Dependency options:
--disable-gui Disable qBittorrent Graphical user --disable-gui Disable qBittorrent Graphical user
interface for headless running interface for headless running
--with-libboost-inc=[path] Path to libboost include files --with-libboost-inc=[path] Path to libboost include files
--with-libboost-lib=[path] Path to libboost library files
--disable-libnotify Disable use of libnotify --disable-libnotify Disable use of libnotify
--disable-geoip-database Disable use of geoip-database --disable-geoip-database Disable use of geoip-database
--with-geoip-database-embedded Geoip Database will be embedded in --with-geoip-database-embedded Geoip Database will be embedded in
@@ -152,6 +153,11 @@ while [ $# -gt 0 ]; do
shift shift
;; ;;
--with-libboost-lib=*)
QC_WITH_LIBBOOST_LIB=$optarg
shift
;;
--disable-libnotify) --disable-libnotify)
QC_DISABLE_libnotify="Y" QC_DISABLE_libnotify="Y"
shift shift
@@ -190,6 +196,7 @@ echo DATADIR=$DATADIR
echo EX_QTDIR=$EX_QTDIR echo EX_QTDIR=$EX_QTDIR
echo QC_DISABLE_GUI=$QC_DISABLE_GUI echo QC_DISABLE_GUI=$QC_DISABLE_GUI
echo QC_WITH_LIBBOOST_INC=$QC_WITH_LIBBOOST_INC echo QC_WITH_LIBBOOST_INC=$QC_WITH_LIBBOOST_INC
echo QC_WITH_LIBBOOST_LIB=$QC_WITH_LIBBOOST_LIB
echo QC_DISABLE_libnotify=$QC_DISABLE_libnotify echo QC_DISABLE_libnotify=$QC_DISABLE_libnotify
echo QC_DISABLE_geoip_database=$QC_DISABLE_geoip_database echo QC_DISABLE_geoip_database=$QC_DISABLE_geoip_database
echo QC_WITH_GEOIP_DATABASE_EMBEDDED=$QC_WITH_GEOIP_DATABASE_EMBEDDED echo QC_WITH_GEOIP_DATABASE_EMBEDDED=$QC_WITH_GEOIP_DATABASE_EMBEDDED
@@ -362,11 +369,13 @@ public:
else else
conf->addDefine("LIBTORRENT_0_15"); conf->addDefine("LIBTORRENT_0_15");
// Get linking parameters // Get linking parameters
QStringList params; //QStringList params;
QByteArray staticlibs; //QByteArray staticlibs;
params << "--static" << "--libs" << "libtorrent-rasterbar"; //params << "--static" << "--libs" << "libtorrent-rasterbar";
conf->doCommand("pkg-config", params, &staticlibs); //conf->doCommand("pkg-config", params, &staticlibs);
conf->addLib(staticlibs.trimmed()); //conf->addLib(staticlibs.trimmed());
//libcrypto
conf->addLib("-lcrypto");
return true; return true;
} }
}; };
@@ -375,6 +384,7 @@ public:
-----BEGIN QCMOD----- -----BEGIN QCMOD-----
name: libboost name: libboost
arg: with-libboost-inc=[path], Path to libboost include files arg: with-libboost-inc=[path], Path to libboost include files
arg: with-libboost-lib=[path], Path to libboost library files
-----END QCMOD----- -----END QCMOD-----
*/ */
class qc_libboost : public ConfObj class qc_libboost : public ConfObj
@@ -424,6 +434,30 @@ public:
} }
} }
conf->addIncludePath(s); conf->addIncludePath(s);
// Find library
s = conf->getenv("QC_WITH_LIBBOOST_LIB");
if(!s.isEmpty()) {
if(!conf->checkLibrary(s, "boost_system-mt")) {
return false;
}
}else{
QStringList sl;
sl << "/usr/lib/";
sl << "/usr/lib64/";
sl << "/usr/local/lib/";
sl << "/usr/local/lib64/";
bool found = false;
foreach(s, sl){
if(conf->checkLibrary(s, "boost_system-mt")) {
found = true;
break;
}
}
if(!found)
return false;
}
conf->addLib(QString("-L") + s);
conf->addLib("-lboost_system-mt -lboost_filesystem-mt -lboost_thread-mt");
return true; return true;
} }
}; };
@@ -1483,6 +1517,7 @@ export DATADIR
export EX_QTDIR export EX_QTDIR
export QC_DISABLE_GUI export QC_DISABLE_GUI
export QC_WITH_LIBBOOST_INC export QC_WITH_LIBBOOST_INC
export QC_WITH_LIBBOOST_LIB
export QC_DISABLE_libnotify export QC_DISABLE_libnotify
export QC_DISABLE_geoip_database export QC_DISABLE_geoip_database
export QC_WITH_GEOIP_DATABASE_EMBEDDED export QC_WITH_GEOIP_DATABASE_EMBEDDED

View File

@@ -2,6 +2,7 @@
-----BEGIN QCMOD----- -----BEGIN QCMOD-----
name: libboost name: libboost
arg: with-libboost-inc=[path], Path to libboost include files arg: with-libboost-inc=[path], Path to libboost include files
arg: with-libboost-lib=[path], Path to libboost library files
-----END QCMOD----- -----END QCMOD-----
*/ */
class qc_libboost : public ConfObj class qc_libboost : public ConfObj
@@ -51,6 +52,30 @@ public:
} }
} }
conf->addIncludePath(s); conf->addIncludePath(s);
// Find library
s = conf->getenv("QC_WITH_LIBBOOST_LIB");
if(!s.isEmpty()) {
if(!conf->checkLibrary(s, "boost_system-mt")) {
return false;
}
}else{
QStringList sl;
sl << "/usr/lib/";
sl << "/usr/lib64/";
sl << "/usr/local/lib/";
sl << "/usr/local/lib64/";
bool found = false;
foreach(s, sl){
if(conf->checkLibrary(s, "boost_system-mt")) {
found = true;
break;
}
}
if(!found)
return false;
}
conf->addLib(QString("-L") + s);
conf->addLib("-lboost_system-mt -lboost_filesystem-mt -lboost_thread-mt");
return true; return true;
} }
}; };

View File

@@ -27,11 +27,13 @@ public:
else else
conf->addDefine("LIBTORRENT_0_15"); conf->addDefine("LIBTORRENT_0_15");
// Get linking parameters // Get linking parameters
QStringList params; //QStringList params;
QByteArray staticlibs; //QByteArray staticlibs;
params << "--static" << "--libs" << "libtorrent-rasterbar"; //params << "--static" << "--libs" << "libtorrent-rasterbar";
conf->doCommand("pkg-config", params, &staticlibs); //conf->doCommand("pkg-config", params, &staticlibs);
conf->addLib(staticlibs.trimmed()); //conf->addLib(staticlibs.trimmed());
//libcrypto
conf->addLib("-lcrypto");
return true; return true;
} }
}; };

View File

@@ -66,6 +66,11 @@
#include "propertieswidget.h" #include "propertieswidget.h"
#include "statusbar.h" #include "statusbar.h"
#ifdef Q_WS_WIN
#include <windows.h>
const int UNLEN = 256;
#endif
using namespace libtorrent; using namespace libtorrent;
#define TIME_TRAY_BALLOON 5000 #define TIME_TRAY_BALLOON 5000
@@ -161,7 +166,15 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
processParams(torrentCmdLine); processParams(torrentCmdLine);
// Use a tcp server to allow only one instance of qBittorrent // Use a tcp server to allow only one instance of qBittorrent
localServer = new QLocalServer(); localServer = new QLocalServer();
QString uid = QString::number(getuid()); QString uid = "";
#ifdef Q_WS_WIN
char buffer[UNLEN+1] = {0};
DWORD buffer_len = UNLEN + 1;
if (!GetUserName(buffer, &buffer_len))
uid = QString(buffer)
#else
uid = QString::number(getuid());
#endif
#ifdef Q_WS_X11 #ifdef Q_WS_X11
if(QFile::exists(QDir::tempPath()+QDir::separator()+QString("qBittorrent-")+uid)) { if(QFile::exists(QDir::tempPath()+QDir::separator()+QString("qBittorrent-")+uid)) {
// Socket was not closed cleanly // Socket was not closed cleanly
@@ -815,12 +828,7 @@ void GUI::trackerAuthenticationRequired(QTorrentHandle& h) {
void GUI::updateGUI() { void GUI::updateGUI() {
// update global informations // update global informations
if(systrayIcon) { if(systrayIcon) {
#ifdef Q_WS_WIN #if defined(Q_WS_X11) || defined(Q_WS_MAC)
// Windows does not support html here
QString html =tr("DL speed: %1 KiB/s", "e.g: Download speed: 10 KiB/s").arg(QString::number(BTSession->getPayloadDownloadRate()/1024., 'f', 1));
html += "\n";
html += tr("UP speed: %1 KiB/s", "e.g: Upload speed: 10 KiB/s").arg(QString::number(BTSession->getPayloadUploadRate()/1024., 'f', 1));
#else
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>";
@@ -830,6 +838,11 @@ void GUI::updateGUI() {
html += "<div style='vertical-align: baseline; height: 18px;'>"; html += "<div style='vertical-align: baseline; height: 18px;'>";
html += "<img src=':/Icons/skin/seeding.png'/>&nbsp;"+tr("UP speed: %1 KiB/s", "e.g: Upload speed: 10 KiB/s").arg(QString::number(BTSession->getPayloadUploadRate()/1024., 'f', 1)); html += "<img src=':/Icons/skin/seeding.png'/>&nbsp;"+tr("UP speed: %1 KiB/s", "e.g: Upload speed: 10 KiB/s").arg(QString::number(BTSession->getPayloadUploadRate()/1024., 'f', 1));
html += "</div>"; html += "</div>";
#else
// OSes such as Windows do not support html here
QString html =tr("DL speed: %1 KiB/s", "e.g: Download speed: 10 KiB/s").arg(QString::number(BTSession->getPayloadDownloadRate()/1024., 'f', 1));
html += "\n";
html += tr("UP speed: %1 KiB/s", "e.g: Upload speed: 10 KiB/s").arg(QString::number(BTSession->getPayloadUploadRate()/1024., 'f', 1));
#endif #endif
systrayIcon->setToolTip(html); // tray icon systrayIcon->setToolTip(html); // tray icon
} }

View File

@@ -1,6 +1,6 @@
[Desktop Entry] [Desktop Entry]
Categories=Qt;Network;P2P; Categories=Qt;Network;P2P;
Comment=V2.2.2 Comment=V2.2.3
Exec=qbittorrent %f Exec=qbittorrent %f
GenericName=Bittorrent client GenericName=Bittorrent client
GenericName[bg]=Торент клиент GenericName[bg]=Торент клиент

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 79 KiB

View File

@@ -92,6 +92,9 @@ class about : public QDialog, private Ui::AboutDlg{
te_translation->scrollToAnchor(QString::fromUtf8("top")); te_translation->scrollToAnchor(QString::fromUtf8("top"));
// License // License
te_license->append(QString::fromUtf8("<a name='top'></a>")); te_license->append(QString::fromUtf8("<a name='top'></a>"));
#ifdef Q_WS_WIN
te_license->append(QString::fromUtf8("qBittorrent is licensed under the GNU General Public License version 2."));
#else
te_license->append(QString::fromUtf8("qBittorrent is licensed under the GNU General Public License version 2 with the\ te_license->append(QString::fromUtf8("qBittorrent is licensed under the GNU General Public License version 2 with the\
addition of the following special exception:\ addition of the following special exception:\
<br><br>\ <br><br>\
@@ -438,6 +441,7 @@ exception statement from your version.</i>\
consider it more useful to permit linking proprietary applications with the<br>\ consider it more useful to permit linking proprietary applications with the<br>\
library. If this is what you want to do, use the GNU Library General<br>\ library. If this is what you want to do, use the GNU Library General<br>\
Public License instead of this License.<br>")); Public License instead of this License.<br>"));
#endif
te_license->scrollToAnchor(QString::fromUtf8("top")); te_license->scrollToAnchor(QString::fromUtf8("top"));
show(); show();
} }

View File

@@ -2002,7 +2002,9 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
} }
#endif #endif
else if (torrent_paused_alert* p = dynamic_cast<torrent_paused_alert*>(a.get())) { else if (torrent_paused_alert* p = dynamic_cast<torrent_paused_alert*>(a.get())) {
p->handle.save_resume_data(); if(p->handle.is_valid()) {
p->handle.save_resume_data();
}
} }
else if (tracker_error_alert* p = dynamic_cast<tracker_error_alert*>(a.get())) { else if (tracker_error_alert* p = dynamic_cast<tracker_error_alert*>(a.get())) {
// Level: fatal // Level: fatal

View File

@@ -39,7 +39,6 @@
#include <QStyle> #include <QStyle>
#include <QSplashScreen> #include <QSplashScreen>
#include <QPushButton> #include <QPushButton>
#include "qgnomelook.h"
#include "GUI.h" #include "GUI.h"
#include "ico.h" #include "ico.h"
#else #else
@@ -51,14 +50,19 @@
#include <QSettings> #include <QSettings>
#include <QLocalSocket> #include <QLocalSocket>
#include <unistd.h>
#include <sys/types.h> #include <sys/types.h>
#ifndef Q_WS_WIN
#if defined(Q_WS_X11) || defined(Q_WS_MAC)
#include <signal.h> #include <signal.h>
#include <execinfo.h> #include <execinfo.h>
#include "stacktrace.h" #include "stacktrace.h"
#endif #endif
#ifdef Q_WS_WIN
#include <windows.h>
const int UNLEN = 256;
#endif
#include <stdlib.h> #include <stdlib.h>
#include "misc.h" #include "misc.h"
#include "preferences.h" #include "preferences.h"
@@ -123,7 +127,7 @@ public:
#include "main.moc" #include "main.moc"
#ifndef Q_WS_WIN #if defined(Q_WS_X11) || defined(Q_WS_MAC)
void sigintHandler(int) { void sigintHandler(int) {
signal(SIGINT, 0); signal(SIGINT, 0);
qDebug("Catching SIGINT, exiting cleanly"); qDebug("Catching SIGINT, exiting cleanly");
@@ -158,18 +162,12 @@ void useStyle(QApplication *app, QString style){
if(!style.isEmpty()) { if(!style.isEmpty()) {
QApplication::setStyle(QStyleFactory::create(style)); QApplication::setStyle(QStyleFactory::create(style));
} }
if(app->style()->objectName() == "cleanlooks") {
// Force our own cleanlooks style
qDebug("Forcing our own cleanlooks style");
app->setStyle(new QGnomeLookStyle());
}
Preferences::setStyle(app->style()->objectName()); Preferences::setStyle(app->style()->objectName());
} }
#endif #endif
// Main // Main
int main(int argc, char *argv[]){ int main(int argc, char *argv[]){
QFile file;
QString locale; QString locale;
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
#ifndef DISABLE_GUI #ifndef DISABLE_GUI
@@ -178,7 +176,15 @@ int main(int argc, char *argv[]){
//Check if there is another instance running //Check if there is another instance running
QLocalSocket localSocket; QLocalSocket localSocket;
QString uid = QString::number(getuid()); QString uid;
#ifdef Q_WS_WIN
char buffer[UNLEN+1] = {0};
DWORD buffer_len = UNLEN + 1;
if (!GetUserName(buffer, &buffer_len))
uid = QString(buffer)
#else
uid = QString::number(getuid());
#endif
localSocket.connectToServer("qBittorrent-"+uid, QIODevice::WriteOnly); localSocket.connectToServer("qBittorrent-"+uid, QIODevice::WriteOnly);
if (localSocket.waitForConnected(1000)){ if (localSocket.waitForConnected(1000)){
std::cout << "Another qBittorrent instance is already running...\n"; std::cout << "Another qBittorrent instance is already running...\n";
@@ -292,7 +298,7 @@ int main(int argc, char *argv[]){
#ifndef DISABLE_GUI #ifndef DISABLE_GUI
app->setQuitOnLastWindowClosed(false); app->setQuitOnLastWindowClosed(false);
#endif #endif
#ifndef Q_WS_WIN #if defined(Q_WS_X11) || defined(Q_WS_MAC)
signal(SIGABRT, sigabrtHandler); signal(SIGABRT, sigabrtHandler);
signal(SIGTERM, sigtermHandler); signal(SIGTERM, sigtermHandler);
signal(SIGINT, sigintHandler); signal(SIGINT, sigintHandler);
@@ -314,7 +320,7 @@ int main(int argc, char *argv[]){
#endif #endif
int ret = app->exec(); int ret = app->exec();
#ifndef Q_WS_WIN #if defined(Q_WS_X11) || defined(Q_WS_MAC)
// Application has exited, stop catching SIGINT and SIGTERM // Application has exited, stop catching SIGINT and SIGTERM
signal(SIGINT, 0); signal(SIGINT, 0);
signal(SIGTERM, 0); signal(SIGTERM, 0);

View File

@@ -34,7 +34,6 @@
#include <QSystemTrayIcon> #include <QSystemTrayIcon>
#include <QApplication> #include <QApplication>
#include <QSettings> #include <QSettings>
#include "qgnomelook.h"
#include <QDialogButtonBox> #include <QDialogButtonBox>
#include <QCloseEvent> #include <QCloseEvent>
#include <QDesktopWidget> #include <QDesktopWidget>
@@ -216,6 +215,8 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
connect(checkDownloadLimit, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(checkDownloadLimit, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(spinUploadLimit, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton())); connect(spinUploadLimit, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(spinDownloadLimit, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton())); connect(spinDownloadLimit, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(spinUploadLimitAlt, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(spinDownloadLimitAlt, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(check_schedule, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton())); connect(check_schedule, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(schedule_from, SIGNAL(timeChanged(QTime)), this, SLOT(enableApplyButton())); connect(schedule_from, SIGNAL(timeChanged(QTime)), this, SLOT(enableApplyButton()));
connect(schedule_to, SIGNAL(timeChanged(QTime)), this, SLOT(enableApplyButton())); connect(schedule_to, SIGNAL(timeChanged(QTime)), this, SLOT(enableApplyButton()));
@@ -308,11 +309,6 @@ void options_imp::changePage(QListWidgetItem *current, QListWidgetItem *previous
void options_imp::useStyle() { void options_imp::useStyle() {
QApplication::setStyle(QStyleFactory::create(comboStyle->itemText(comboStyle->currentIndex()))); QApplication::setStyle(QStyleFactory::create(comboStyle->itemText(comboStyle->currentIndex())));
if(QApplication::style()->objectName() == "cleanlooks") {
// Force our own cleanlooks style
qDebug("Forcing our own cleanlooks style");
QApplication::setStyle(new QGnomeLookStyle());
}
} }
void options_imp::loadWindowState() { void options_imp::loadWindowState() {

View File

@@ -32,6 +32,7 @@
#define PEERLISTDELEGATE_H #define PEERLISTDELEGATE_H
#include <QItemDelegate> #include <QItemDelegate>
#include <QPainter>
#include "misc.h" #include "misc.h"
enum PeerListColumns {IP, CLIENT, PROGRESS, DOWN_SPEED, UP_SPEED, TOT_DOWN, TOT_UP, IP_HIDDEN}; enum PeerListColumns {IP, CLIENT, PROGRESS, DOWN_SPEED, UP_SPEED, TOT_DOWN, TOT_UP, IP_HIDDEN};
@@ -45,30 +46,32 @@ public:
~PeerListDelegate(){} ~PeerListDelegate(){}
void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const{ void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const{
painter->save();
QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option); QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option);
switch(index.column()){ switch(index.column()){
case TOT_DOWN: case TOT_DOWN:
case TOT_UP: case TOT_UP:
QItemDelegate::drawBackground(painter, opt, index); QItemDelegate::drawBackground(painter, opt, index);
QItemDelegate::drawDisplay(painter, opt, option.rect, misc::friendlyUnit(index.data().toLongLong())); QItemDelegate::drawDisplay(painter, opt, option.rect, misc::friendlyUnit(index.data().toLongLong()));
break; break;
case DOWN_SPEED: case DOWN_SPEED:
case UP_SPEED:{ case UP_SPEED:{
QItemDelegate::drawBackground(painter, opt, index); QItemDelegate::drawBackground(painter, opt, index);
double speed = index.data().toDouble(); double speed = index.data().toDouble();
if (speed > 0.0) if (speed > 0.0)
QItemDelegate::drawDisplay(painter, opt, opt.rect, misc::friendlyUnit(speed)+tr("/s", "/second (i.e. per second)")); QItemDelegate::drawDisplay(painter, opt, opt.rect, misc::friendlyUnit(speed)+tr("/s", "/second (i.e. per second)"));
break; break;
} }
case PROGRESS:{ case PROGRESS:{
QItemDelegate::drawBackground(painter, opt, index); QItemDelegate::drawBackground(painter, opt, index);
double progress = index.data().toDouble(); double progress = index.data().toDouble();
QItemDelegate::drawDisplay(painter, opt, opt.rect, QString::number(progress*100., 'f', 1)+"%"); QItemDelegate::drawDisplay(painter, opt, opt.rect, QString::number(progress*100., 'f', 1)+"%");
break; break;
} }
default: default:
QItemDelegate::paint(painter, option, index); QItemDelegate::paint(painter, option, index);
} }
painter->restore();
} }
QWidget* createEditor(QWidget*, const QStyleOptionViewItem &, const QModelIndex &) const { QWidget* createEditor(QWidget*, const QStyleOptionViewItem &, const QModelIndex &) const {

View File

@@ -54,6 +54,7 @@ class PreviewListDelegate: public QItemDelegate {
~PreviewListDelegate(){} ~PreviewListDelegate(){}
void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const{ void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const{
painter->save();
QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option); QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option);
switch(index.column()){ switch(index.column()){
@@ -77,6 +78,7 @@ class PreviewListDelegate: public QItemDelegate {
default: default:
QItemDelegate::paint(painter, option, index); QItemDelegate::paint(painter, option, index);
} }
painter->restore();
} }
QWidget* createEditor(QWidget*, const QStyleOptionViewItem &, const QModelIndex &) const { QWidget* createEditor(QWidget*, const QStyleOptionViewItem &, const QModelIndex &) const {

View File

@@ -583,10 +583,10 @@ void PropertiesWidget::renameSelectedFile() {
// Check if that name is already used // Check if that name is already used
for(int i=0; i<h.num_files(); ++i) { for(int i=0; i<h.num_files(); ++i) {
if(i == file_index) continue; if(i == file_index) continue;
#ifdef Q_WS_WIN #if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS)
if(misc::toQString(h.get_torrent_info().file_at(i).path.string()).compare(new_name, Qt::CaseInsensitive) == 0) { if(misc::toQString(h.get_torrent_info().file_at(i).path.string()).compare(new_name, Qt::CaseSensitive) == 0) {
#else #else
if(misc::toQString(h.get_torrent_info().file_at(i).path.string()).compare(new_name, Qt::CaseSensitive) == 0) { if(misc::toQString(h.get_torrent_info().file_at(i).path.string()).compare(new_name, Qt::CaseInsensitive) == 0) {
#endif #endif
// Display error message // Display error message
QMessageBox::warning(this, tr("The file could not be renamed"), QMessageBox::warning(this, tr("The file could not be renamed"),
@@ -622,10 +622,10 @@ void PropertiesWidget::renameSelectedFile() {
const int num_files = h.num_files(); const int num_files = h.num_files();
for(int i=0; i<num_files; ++i) { for(int i=0; i<num_files; ++i) {
const QString current_name = misc::toQString(h.get_torrent_info().file_at(i).path.string()); const QString current_name = misc::toQString(h.get_torrent_info().file_at(i).path.string());
#ifdef Q_WS_WIN #if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS)
if(current_name.startsWith(new_path, Qt::CaseInsensitive)) { if(current_name.startsWith(new_path, Qt::CaseSensitive)) {
#else #else
if(current_name.startsWith(new_path, Qt::CaseSensitive)) { if(current_name.startsWith(new_path, Qt::CaseInsensitive)) {
#endif #endif
QMessageBox::warning(this, tr("The folder could not be renamed"), QMessageBox::warning(this, tr("The folder could not be renamed"),
tr("This name is already in use in this folder. Please use a different name."), tr("This name is already in use in this folder. Please use a different name."),

View File

@@ -62,6 +62,7 @@ public:
~PropListDelegate(){} ~PropListDelegate(){}
void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const{ void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const{
painter->save();
QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option); QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option);
switch(index.column()){ switch(index.column()){
case SIZE: case SIZE:
@@ -105,6 +106,7 @@ public:
QItemDelegate::paint(painter, option, index); QItemDelegate::paint(painter, option, index);
break; break;
} }
painter->restore();
} }
QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const{ QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const{

View File

@@ -1,96 +0,0 @@
/*
* Bittorrent Client using Qt4 and libtorrent.
* Copyright (C) 2006 Christophe Dumez
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org
*/
#ifndef QGNOMELOOK
#define QGNOMELOOK
#include <QCleanlooksStyle>
#include <QStyleOption>
#include <QStyleOptionProgressBar>
#include <QStyleOptionProgressBarV2>
#include <QPen>
#include <QPainter>
class QGnomeLookStyle : public QCleanlooksStyle {
public:
QGnomeLookStyle() : QCleanlooksStyle() {}
void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const {
switch(element) {
case CE_ProgressBarLabel:
if (const QStyleOptionProgressBar *pb = qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
bool vertical = false;
if (const QStyleOptionProgressBarV2 *pb2 = qstyleoption_cast<const QStyleOptionProgressBarV2 *>(option)) {
vertical = (pb2->orientation == Qt::Vertical);
}
if (!vertical) {
QPalette::ColorRole textRole = QPalette::WindowText;/*
if ((pb->textAlignment & Qt::AlignCenter) && pb->textVisible
&& ((qint64(pb->progress) - qint64(pb->minimum)) * 2 >= (qint64(pb->maximum) - qint64(pb->minimum)))) {
textRole = QPalette::HighlightedText;
//Draw text shadow, This will increase readability when the background of same color
QRect shadowRect(pb->rect);
shadowRect.translate(1,1);
QColor shadowColor = (pb->palette.color(textRole).value() <= 128) ? QColor(255,255,255,160) : QColor(0,0,0,160);
QPalette shadowPalette = pb->palette;
shadowPalette.setColor(textRole, shadowColor);
drawItemText(painter, shadowRect, Qt::AlignCenter | Qt::TextSingleLine, shadowPalette, pb->state, pb->text, textRole);
}
QPalette shadowPalette = pb->palette;
shadowPalette.setColor(textRole, QColor(0,0,0,160));*/
drawItemText(painter, pb->rect, Qt::AlignCenter | Qt::TextSingleLine, pb->palette, pb->state, pb->text, textRole);
}
}
break;
default:
QCleanlooksStyle::drawControl(element, option, painter, widget);
}
}
QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget=0) const
{
QRect rect;
switch (element) {
#ifndef QT_NO_PROGRESSBAR
case SE_ProgressBarLabel:
case SE_ProgressBarContents:
case SE_ProgressBarGroove:
return option->rect;
#endif // QT_NO_PROGRESSBAR
default:
return QCleanlooksStyle::subElementRect(element, option, widget);
}
return visualRect(option->direction, option->rect, rect);
}
};
#endif

View File

@@ -84,8 +84,9 @@ protected:
if(stopped) return; if(stopped) return;
libtorrent::asio::ip::tcp::endpoint endpoint = *it; libtorrent::asio::ip::tcp::endpoint endpoint = *it;
emit ip_resolved(misc::toQString(endpoint.address().to_string()), misc::toQString((*it).host_name())); emit ip_resolved(misc::toQString(endpoint.address().to_string()), misc::toQString((*it).host_name()));
} catch(std::exception &e) { } catch(std::exception/* &e*/) {
std::cerr << "Hostname resolution failed, reason: " << e.what() << std::endl; /*std::cerr << "Hostname resolution failed, reason: " << e.what() << std::endl;*/
std::cerr << "Hostname resolution error." << std::endl;
} }
} }
}; };

View File

@@ -74,6 +74,11 @@ SearchEngine::SearchEngine(GUI *parent, Bittorrent *BTSession) : QWidget(parent)
// Creating Search Process // Creating Search Process
searchProcess = new QProcess(this); searchProcess = new QProcess(this);
QStringList env = QProcess::systemEnvironment(); QStringList env = QProcess::systemEnvironment();
#ifdef Q_WS_WIN
// add qBittorrent executable folder to PATH environment variable
qDebug("qBittorrent executable path: %s", qPrintable(qApp->applicationDirPath()));
env.replaceInStrings(QRegExp("^PATH=(.*)", Qt::CaseInsensitive), "PATH=\\1;"+qApp->applicationDirPath());
#endif
searchProcess->setEnvironment(env); searchProcess->setEnvironment(env);
connect(searchProcess, SIGNAL(started()), this, SLOT(searchStarted())); connect(searchProcess, SIGNAL(started()), this, SLOT(searchStarted()));
connect(searchProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(readSearchOutput())); connect(searchProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(readSearchOutput()));

View File

@@ -55,6 +55,7 @@ class SearchListDelegate: public QItemDelegate {
~SearchListDelegate(){} ~SearchListDelegate(){}
void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const{ void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const{
painter->save();
QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option); QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option);
switch(index.column()){ switch(index.column()){
case SIZE: case SIZE:
@@ -64,6 +65,7 @@ class SearchListDelegate: public QItemDelegate {
default: default:
QItemDelegate::paint(painter, option, index); QItemDelegate::paint(painter, option, index);
} }
painter->restore();
} }
QWidget* createEditor(QWidget*, const QStyleOptionViewItem &, const QModelIndex &) const { QWidget* createEditor(QWidget*, const QStyleOptionViewItem &, const QModelIndex &) const {

View File

@@ -11,10 +11,10 @@ CONFIG += qt \
thread thread
# Update this VERSION for each release # Update this VERSION for each release
DEFINES += VERSION=\\\"v2.2.2\\\" DEFINES += VERSION=\'\"v2.2.3\"\'
DEFINES += VERSION_MAJOR=2 DEFINES += VERSION_MAJOR=2
DEFINES += VERSION_MINOR=2 DEFINES += VERSION_MINOR=2
DEFINES += VERSION_BUGFIX=2 DEFINES += VERSION_BUGFIX=3
# NORMAL,ALPHA,BETA,RELEASE_CANDIDATE,DEVEL # NORMAL,ALPHA,BETA,RELEASE_CANDIDATE,DEVEL
DEFINES += VERSION_TYPE=NORMAL DEFINES += VERSION_TYPE=NORMAL
@@ -100,8 +100,10 @@ else:TARGET = qbittorrent
# QMAKE_CXXFLAGS_RELEASE += -fwrapv # QMAKE_CXXFLAGS_RELEASE += -fwrapv
# QMAKE_CXXFLAGS_DEBUG += -fwrapv # QMAKE_CXXFLAGS_DEBUG += -fwrapv
unix:QMAKE_LFLAGS_SHAPP += -rdynamic unix:QMAKE_LFLAGS_SHAPP += -rdynamic
CONFIG += link_pkgconfig unix {
PKGCONFIG += "libtorrent-rasterbar" CONFIG += link_pkgconfig
PKGCONFIG += "libtorrent-rasterbar"
}
QT += network QT += network
!contains(DEFINES, DISABLE_GUI):QT += xml !contains(DEFINES, DISABLE_GUI):QT += xml
@@ -121,11 +123,22 @@ win32:LIBS += -lssl32 \
-ladvapi32 \ -ladvapi32 \
-lwinmm -lwinmm
os2:LIBS += -ltorrent-rasterbar \
-lcurl \
-lboost_thread \
-lboost_system \
-lboost_filesystem \
-lssl -lcrypto -lidn -lpthread
!contains(DEFINES, DISABLE_GUI) { !contains(DEFINES, DISABLE_GUI) {
win32 { win32 {
DEFINES += WITH_GEOIP_EMBEDDED DEFINES += WITH_GEOIP_EMBEDDED
message("On Windows, GeoIP database must be embedded.") message("On Windows, GeoIP database must be embedded.")
} }
os2 {
DEFINES += WITH_GEOIP_EMBEDDED
message("On eCS(OS/2), GeoIP database must be embedded.")
}
macx { macx {
DEFINES += WITH_GEOIP_EMBEDDED DEFINES += WITH_GEOIP_EMBEDDED
message("On Mac OS X, GeoIP database must be embedded.") message("On Mac OS X, GeoIP database must be embedded.")
@@ -227,7 +240,6 @@ else:HEADERS += GUI.h \
ico.h \ ico.h \
engineselectdlg.h \ engineselectdlg.h \
pluginsource.h \ pluginsource.h \
qgnomelook.h \
searchEngine.h \ searchEngine.h \
rss.h \ rss.h \
rss_imp.h \ rss_imp.h \

View File

@@ -305,10 +305,10 @@ public slots:
// Check if that name is already used // Check if that name is already used
for(uint i=0; i<nbFiles; ++i) { for(uint i=0; i<nbFiles; ++i) {
if(i == file_index) continue; if(i == file_index) continue;
#ifdef Q_WS_WIN #if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS)
if(files_path.at(i).compare(new_name, Qt::CaseInsensitive) == 0) { if(files_path.at(i).compare(new_name, Qt::CaseSensitive) == 0) {
#else #else
if(files_path.at(i).compare(new_name, Qt::CaseSensitive) == 0) { if(files_path.at(i).compare(new_name, Qt::CaseInsensitive) == 0) {
#endif #endif
// Display error message // Display error message
QMessageBox::warning(this, tr("The file could not be renamed"), QMessageBox::warning(this, tr("The file could not be renamed"),
@@ -339,10 +339,10 @@ public slots:
// Check for overwriting // Check for overwriting
for(uint i=0; i<nbFiles; ++i) { for(uint i=0; i<nbFiles; ++i) {
const QString &current_name = files_path.at(i); const QString &current_name = files_path.at(i);
#ifdef Q_WS_WIN #if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS)
if(current_name.startsWith(new_path, Qt::CaseInsensitive)) { if(current_name.startsWith(new_path, Qt::CaseSensitive)) {
#else #else
if(current_name.startsWith(new_path, Qt::CaseSensitive)) { if(current_name.startsWith(new_path, Qt::CaseInsensitive)) {
#endif #endif
QMessageBox::warning(this, tr("The folder could not be renamed"), QMessageBox::warning(this, tr("The folder could not be renamed"),
tr("This name is already in use in this folder. Please use a different name."), tr("This name is already in use in this folder. Please use a different name."),
@@ -456,10 +456,10 @@ public slots:
if(!is_magnet) { if(!is_magnet) {
bool path_changed = false; bool path_changed = false;
for(uint i=0; i<nbFiles; ++i) { for(uint i=0; i<nbFiles; ++i) {
#ifdef Q_WS_WIN #if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS)
if(files_path.at(i).compare(misc::toQString(t->file_at(i).path.string()), Qt::CaseInsensitive) != 0) { if(files_path.at(i).compare(misc::toQString(t->file_at(i).path.string()), Qt::CaseSensitive) != 0) {
#else #else
if(files_path.at(i).compare(misc::toQString(t->file_at(i).path.string()), Qt::CaseSensitive) != 0) { if(files_path.at(i).compare(misc::toQString(t->file_at(i).path.string()), Qt::CaseInsensitive) != 0) {
#endif #endif
path_changed = true; path_changed = true;
break; break;

View File

@@ -507,7 +507,7 @@ public:
TreeItem *parent = this->rootItem; TreeItem *parent = this->rootItem;
if(t.num_files() == 1) { if(t.num_files() == 1) {
// Create possible parent folder // Create possible parent folder
QStringList path_parts = misc::toQString(t.file_at(0).path.string()).split(QDir::separator()); QStringList path_parts = misc::toQString(t.file_at(0).path.string()).split("/");
path_parts.removeLast(); path_parts.removeLast();
foreach(const QString &part, path_parts) { foreach(const QString &part, path_parts) {
TreeItem *folder = new TreeItem(part, parent); TreeItem *folder = new TreeItem(part, parent);
@@ -520,7 +520,7 @@ public:
return; return;
} }
// Create parent folder // Create parent folder
QString root_name = misc::toQString(t.file_at(0).path.string()).split(QDir::separator()).first(); QString root_name = misc::toQString(t.file_at(0).path.string()).split("/").first();
TreeItem *current_parent = new TreeItem(root_name, parent); TreeItem *current_parent = new TreeItem(root_name, parent);
//parent->appendChild(current_parent); //parent->appendChild(current_parent);
TreeItem *root_folder = current_parent; TreeItem *root_folder = current_parent;
@@ -532,7 +532,7 @@ public:
current_parent = root_folder; current_parent = root_folder;
QString path = QDir::cleanPath(misc::toQString(fi->path.string())); QString path = QDir::cleanPath(misc::toQString(fi->path.string()));
// Iterate of parts of the path to create necessary folders // Iterate of parts of the path to create necessary folders
QStringList pathFolders = path.split(QDir::separator()); QStringList pathFolders = path.split("/");
Q_ASSERT(pathFolders.size() >= 2); Q_ASSERT(pathFolders.size() >= 2);
QString fileName = pathFolders.takeLast(); QString fileName = pathFolders.takeLast();
QString currentFolderName = pathFolders.takeFirst(); QString currentFolderName = pathFolders.takeFirst();

View File

@@ -55,6 +55,7 @@ public:
void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const{ void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const{
QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option); QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option);
painter->save();
switch(index.column()){ switch(index.column()){
case TR_SIZE:{ case TR_SIZE:{
QItemDelegate::drawBackground(painter, opt, index); QItemDelegate::drawBackground(painter, opt, index);
@@ -172,6 +173,7 @@ public:
default: default:
QItemDelegate::paint(painter, option, index); QItemDelegate::paint(painter, option, index);
} }
painter->restore();
} }
QWidget* createEditor(QWidget*, const QStyleOptionViewItem &, const QModelIndex &) const { QWidget* createEditor(QWidget*, const QStyleOptionViewItem &, const QModelIndex &) const {