mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-17 22:18:05 -06:00
Compare commits
15 Commits
release-2.
...
release-2.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6cf2b44b8a | ||
|
|
ba22fa8331 | ||
|
|
5ce02cb612 | ||
|
|
1013f39a42 | ||
|
|
cd5c4bf464 | ||
|
|
84bfc54b03 | ||
|
|
5b3b5eb2ef | ||
|
|
990a863d41 | ||
|
|
7f27d10735 | ||
|
|
1377a75a53 | ||
|
|
bcd33fc861 | ||
|
|
46d8fa1656 | ||
|
|
28cf69b84d | ||
|
|
89389df74d | ||
|
|
77c29f48cb |
@@ -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
|
||||
- FEATURE: DHT port can be set from Web UI
|
||||
- BUGFIX: Fix possible crash with folder scanning
|
||||
|
||||
45
configure
vendored
45
configure
vendored
@@ -21,6 +21,7 @@ Dependency options:
|
||||
--disable-gui Disable qBittorrent Graphical user
|
||||
interface for headless running
|
||||
--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-geoip-database Disable use of geoip-database
|
||||
--with-geoip-database-embedded Geoip Database will be embedded in
|
||||
@@ -152,6 +153,11 @@ while [ $# -gt 0 ]; do
|
||||
shift
|
||||
;;
|
||||
|
||||
--with-libboost-lib=*)
|
||||
QC_WITH_LIBBOOST_LIB=$optarg
|
||||
shift
|
||||
;;
|
||||
|
||||
--disable-libnotify)
|
||||
QC_DISABLE_libnotify="Y"
|
||||
shift
|
||||
@@ -190,6 +196,7 @@ echo DATADIR=$DATADIR
|
||||
echo EX_QTDIR=$EX_QTDIR
|
||||
echo QC_DISABLE_GUI=$QC_DISABLE_GUI
|
||||
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_geoip_database=$QC_DISABLE_geoip_database
|
||||
echo QC_WITH_GEOIP_DATABASE_EMBEDDED=$QC_WITH_GEOIP_DATABASE_EMBEDDED
|
||||
@@ -362,11 +369,13 @@ public:
|
||||
else
|
||||
conf->addDefine("LIBTORRENT_0_15");
|
||||
// Get linking parameters
|
||||
QStringList params;
|
||||
QByteArray staticlibs;
|
||||
params << "--static" << "--libs" << "libtorrent-rasterbar";
|
||||
conf->doCommand("pkg-config", params, &staticlibs);
|
||||
conf->addLib(staticlibs.trimmed());
|
||||
//QStringList params;
|
||||
//QByteArray staticlibs;
|
||||
//params << "--static" << "--libs" << "libtorrent-rasterbar";
|
||||
//conf->doCommand("pkg-config", params, &staticlibs);
|
||||
//conf->addLib(staticlibs.trimmed());
|
||||
//libcrypto
|
||||
conf->addLib("-lcrypto");
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -375,6 +384,7 @@ public:
|
||||
-----BEGIN QCMOD-----
|
||||
name: libboost
|
||||
arg: with-libboost-inc=[path], Path to libboost include files
|
||||
arg: with-libboost-lib=[path], Path to libboost library files
|
||||
-----END QCMOD-----
|
||||
*/
|
||||
class qc_libboost : public ConfObj
|
||||
@@ -424,6 +434,30 @@ public:
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
};
|
||||
@@ -1483,6 +1517,7 @@ export DATADIR
|
||||
export EX_QTDIR
|
||||
export QC_DISABLE_GUI
|
||||
export QC_WITH_LIBBOOST_INC
|
||||
export QC_WITH_LIBBOOST_LIB
|
||||
export QC_DISABLE_libnotify
|
||||
export QC_DISABLE_geoip_database
|
||||
export QC_WITH_GEOIP_DATABASE_EMBEDDED
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
-----BEGIN QCMOD-----
|
||||
name: libboost
|
||||
arg: with-libboost-inc=[path], Path to libboost include files
|
||||
arg: with-libboost-lib=[path], Path to libboost library files
|
||||
-----END QCMOD-----
|
||||
*/
|
||||
class qc_libboost : public ConfObj
|
||||
@@ -51,6 +52,30 @@ public:
|
||||
}
|
||||
}
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -27,11 +27,13 @@ public:
|
||||
else
|
||||
conf->addDefine("LIBTORRENT_0_15");
|
||||
// Get linking parameters
|
||||
QStringList params;
|
||||
QByteArray staticlibs;
|
||||
params << "--static" << "--libs" << "libtorrent-rasterbar";
|
||||
conf->doCommand("pkg-config", params, &staticlibs);
|
||||
conf->addLib(staticlibs.trimmed());
|
||||
//QStringList params;
|
||||
//QByteArray staticlibs;
|
||||
//params << "--static" << "--libs" << "libtorrent-rasterbar";
|
||||
//conf->doCommand("pkg-config", params, &staticlibs);
|
||||
//conf->addLib(staticlibs.trimmed());
|
||||
//libcrypto
|
||||
conf->addLib("-lcrypto");
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
27
src/GUI.cpp
27
src/GUI.cpp
@@ -66,6 +66,11 @@
|
||||
#include "propertieswidget.h"
|
||||
#include "statusbar.h"
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
#include <windows.h>
|
||||
const int UNLEN = 256;
|
||||
#endif
|
||||
|
||||
using namespace libtorrent;
|
||||
|
||||
#define TIME_TRAY_BALLOON 5000
|
||||
@@ -161,7 +166,15 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
|
||||
processParams(torrentCmdLine);
|
||||
// Use a tcp server to allow only one instance of qBittorrent
|
||||
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
|
||||
if(QFile::exists(QDir::tempPath()+QDir::separator()+QString("qBittorrent-")+uid)) {
|
||||
// Socket was not closed cleanly
|
||||
@@ -815,12 +828,7 @@ void GUI::trackerAuthenticationRequired(QTorrentHandle& h) {
|
||||
void GUI::updateGUI() {
|
||||
// update global informations
|
||||
if(systrayIcon) {
|
||||
#ifdef Q_WS_WIN
|
||||
// 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
|
||||
#if defined(Q_WS_X11) || defined(Q_WS_MAC)
|
||||
QString html = "<div style='background-color: #678db2; color: #fff;height: 18px; font-weight: bold; margin-bottom: 5px;'>";
|
||||
html += tr("qBittorrent");
|
||||
html += "</div>";
|
||||
@@ -830,6 +838,11 @@ void GUI::updateGUI() {
|
||||
html += "<div style='vertical-align: baseline; height: 18px;'>";
|
||||
html += "<img src=':/Icons/skin/seeding.png'/> "+tr("UP speed: %1 KiB/s", "e.g: Upload speed: 10 KiB/s").arg(QString::number(BTSession->getPayloadUploadRate()/1024., 'f', 1));
|
||||
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
|
||||
systrayIcon->setToolTip(html); // tray icon
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[Desktop Entry]
|
||||
Categories=Qt;Network;P2P;
|
||||
Comment=V2.2.2
|
||||
Comment=V2.2.3
|
||||
Exec=qbittorrent %f
|
||||
GenericName=Bittorrent client
|
||||
GenericName[bg]=Торент клиент
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 79 KiB |
@@ -92,6 +92,9 @@ class about : public QDialog, private Ui::AboutDlg{
|
||||
te_translation->scrollToAnchor(QString::fromUtf8("top"));
|
||||
// License
|
||||
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\
|
||||
addition of the following special exception:\
|
||||
<br><br>\
|
||||
@@ -438,6 +441,7 @@ exception statement from your version.</i>\
|
||||
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>\
|
||||
Public License instead of this License.<br>"));
|
||||
#endif
|
||||
te_license->scrollToAnchor(QString::fromUtf8("top"));
|
||||
show();
|
||||
}
|
||||
|
||||
@@ -2002,7 +2002,9 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
|
||||
}
|
||||
#endif
|
||||
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())) {
|
||||
// Level: fatal
|
||||
|
||||
32
src/main.cpp
32
src/main.cpp
@@ -39,7 +39,6 @@
|
||||
#include <QStyle>
|
||||
#include <QSplashScreen>
|
||||
#include <QPushButton>
|
||||
#include "qgnomelook.h"
|
||||
#include "GUI.h"
|
||||
#include "ico.h"
|
||||
#else
|
||||
@@ -51,14 +50,19 @@
|
||||
|
||||
#include <QSettings>
|
||||
#include <QLocalSocket>
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#ifndef Q_WS_WIN
|
||||
|
||||
#if defined(Q_WS_X11) || defined(Q_WS_MAC)
|
||||
#include <signal.h>
|
||||
#include <execinfo.h>
|
||||
#include "stacktrace.h"
|
||||
#endif
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
#include <windows.h>
|
||||
const int UNLEN = 256;
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include "misc.h"
|
||||
#include "preferences.h"
|
||||
@@ -123,7 +127,7 @@ public:
|
||||
|
||||
#include "main.moc"
|
||||
|
||||
#ifndef Q_WS_WIN
|
||||
#if defined(Q_WS_X11) || defined(Q_WS_MAC)
|
||||
void sigintHandler(int) {
|
||||
signal(SIGINT, 0);
|
||||
qDebug("Catching SIGINT, exiting cleanly");
|
||||
@@ -158,18 +162,12 @@ void useStyle(QApplication *app, QString style){
|
||||
if(!style.isEmpty()) {
|
||||
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());
|
||||
}
|
||||
#endif
|
||||
|
||||
// Main
|
||||
int main(int argc, char *argv[]){
|
||||
QFile file;
|
||||
QString locale;
|
||||
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
|
||||
#ifndef DISABLE_GUI
|
||||
@@ -178,7 +176,15 @@ int main(int argc, char *argv[]){
|
||||
|
||||
//Check if there is another instance running
|
||||
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);
|
||||
if (localSocket.waitForConnected(1000)){
|
||||
std::cout << "Another qBittorrent instance is already running...\n";
|
||||
@@ -292,7 +298,7 @@ int main(int argc, char *argv[]){
|
||||
#ifndef DISABLE_GUI
|
||||
app->setQuitOnLastWindowClosed(false);
|
||||
#endif
|
||||
#ifndef Q_WS_WIN
|
||||
#if defined(Q_WS_X11) || defined(Q_WS_MAC)
|
||||
signal(SIGABRT, sigabrtHandler);
|
||||
signal(SIGTERM, sigtermHandler);
|
||||
signal(SIGINT, sigintHandler);
|
||||
@@ -314,7 +320,7 @@ int main(int argc, char *argv[]){
|
||||
#endif
|
||||
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
|
||||
signal(SIGINT, 0);
|
||||
signal(SIGTERM, 0);
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QApplication>
|
||||
#include <QSettings>
|
||||
#include "qgnomelook.h"
|
||||
#include <QDialogButtonBox>
|
||||
#include <QCloseEvent>
|
||||
#include <QDesktopWidget>
|
||||
@@ -216,6 +215,8 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
|
||||
connect(checkDownloadLimit, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
|
||||
connect(spinUploadLimit, 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(schedule_from, 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() {
|
||||
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() {
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#define PEERLISTDELEGATE_H
|
||||
|
||||
#include <QItemDelegate>
|
||||
#include <QPainter>
|
||||
#include "misc.h"
|
||||
|
||||
enum PeerListColumns {IP, CLIENT, PROGRESS, DOWN_SPEED, UP_SPEED, TOT_DOWN, TOT_UP, IP_HIDDEN};
|
||||
@@ -45,30 +46,32 @@ public:
|
||||
~PeerListDelegate(){}
|
||||
|
||||
void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const{
|
||||
painter->save();
|
||||
QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option);
|
||||
switch(index.column()){
|
||||
case TOT_DOWN:
|
||||
case TOT_UP:
|
||||
case TOT_DOWN:
|
||||
case TOT_UP:
|
||||
QItemDelegate::drawBackground(painter, opt, index);
|
||||
QItemDelegate::drawDisplay(painter, opt, option.rect, misc::friendlyUnit(index.data().toLongLong()));
|
||||
break;
|
||||
case DOWN_SPEED:
|
||||
case UP_SPEED:{
|
||||
QItemDelegate::drawBackground(painter, opt, index);
|
||||
double speed = index.data().toDouble();
|
||||
if (speed > 0.0)
|
||||
QItemDelegate::drawDisplay(painter, opt, opt.rect, misc::friendlyUnit(speed)+tr("/s", "/second (i.e. per second)"));
|
||||
break;
|
||||
}
|
||||
case PROGRESS:{
|
||||
QItemDelegate::drawBackground(painter, opt, index);
|
||||
double progress = index.data().toDouble();
|
||||
QItemDelegate::drawDisplay(painter, opt, opt.rect, QString::number(progress*100., 'f', 1)+"%");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
QItemDelegate::paint(painter, option, index);
|
||||
}
|
||||
case DOWN_SPEED:
|
||||
case UP_SPEED:{
|
||||
QItemDelegate::drawBackground(painter, opt, index);
|
||||
double speed = index.data().toDouble();
|
||||
if (speed > 0.0)
|
||||
QItemDelegate::drawDisplay(painter, opt, opt.rect, misc::friendlyUnit(speed)+tr("/s", "/second (i.e. per second)"));
|
||||
break;
|
||||
}
|
||||
case PROGRESS:{
|
||||
QItemDelegate::drawBackground(painter, opt, index);
|
||||
double progress = index.data().toDouble();
|
||||
QItemDelegate::drawDisplay(painter, opt, opt.rect, QString::number(progress*100., 'f', 1)+"%");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
QItemDelegate::paint(painter, option, index);
|
||||
}
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
QWidget* createEditor(QWidget*, const QStyleOptionViewItem &, const QModelIndex &) const {
|
||||
|
||||
@@ -54,6 +54,7 @@ class PreviewListDelegate: public QItemDelegate {
|
||||
~PreviewListDelegate(){}
|
||||
|
||||
void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const{
|
||||
painter->save();
|
||||
QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option);
|
||||
|
||||
switch(index.column()){
|
||||
@@ -77,6 +78,7 @@ class PreviewListDelegate: public QItemDelegate {
|
||||
default:
|
||||
QItemDelegate::paint(painter, option, index);
|
||||
}
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
QWidget* createEditor(QWidget*, const QStyleOptionViewItem &, const QModelIndex &) const {
|
||||
|
||||
@@ -583,10 +583,10 @@ void PropertiesWidget::renameSelectedFile() {
|
||||
// Check if that name is already used
|
||||
for(int i=0; i<h.num_files(); ++i) {
|
||||
if(i == file_index) continue;
|
||||
#ifdef Q_WS_WIN
|
||||
if(misc::toQString(h.get_torrent_info().file_at(i).path.string()).compare(new_name, Qt::CaseInsensitive) == 0) {
|
||||
#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::CaseSensitive) == 0) {
|
||||
#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
|
||||
// Display error message
|
||||
QMessageBox::warning(this, tr("The file could not be renamed"),
|
||||
@@ -622,10 +622,10 @@ void PropertiesWidget::renameSelectedFile() {
|
||||
const int num_files = h.num_files();
|
||||
for(int i=0; i<num_files; ++i) {
|
||||
const QString current_name = misc::toQString(h.get_torrent_info().file_at(i).path.string());
|
||||
#ifdef Q_WS_WIN
|
||||
if(current_name.startsWith(new_path, Qt::CaseInsensitive)) {
|
||||
#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS)
|
||||
if(current_name.startsWith(new_path, Qt::CaseSensitive)) {
|
||||
#else
|
||||
if(current_name.startsWith(new_path, Qt::CaseSensitive)) {
|
||||
if(current_name.startsWith(new_path, Qt::CaseInsensitive)) {
|
||||
#endif
|
||||
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."),
|
||||
|
||||
@@ -62,6 +62,7 @@ public:
|
||||
~PropListDelegate(){}
|
||||
|
||||
void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const{
|
||||
painter->save();
|
||||
QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option);
|
||||
switch(index.column()){
|
||||
case SIZE:
|
||||
@@ -105,6 +106,7 @@ public:
|
||||
QItemDelegate::paint(painter, option, index);
|
||||
break;
|
||||
}
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const{
|
||||
|
||||
@@ -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
|
||||
@@ -84,8 +84,9 @@ protected:
|
||||
if(stopped) return;
|
||||
libtorrent::asio::ip::tcp::endpoint endpoint = *it;
|
||||
emit ip_resolved(misc::toQString(endpoint.address().to_string()), misc::toQString((*it).host_name()));
|
||||
} catch(std::exception &e) {
|
||||
std::cerr << "Hostname resolution failed, reason: " << e.what() << std::endl;
|
||||
} catch(std::exception/* &e*/) {
|
||||
/*std::cerr << "Hostname resolution failed, reason: " << e.what() << std::endl;*/
|
||||
std::cerr << "Hostname resolution error." << std::endl;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -74,6 +74,11 @@ SearchEngine::SearchEngine(GUI *parent, Bittorrent *BTSession) : QWidget(parent)
|
||||
// Creating Search Process
|
||||
searchProcess = new QProcess(this);
|
||||
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);
|
||||
connect(searchProcess, SIGNAL(started()), this, SLOT(searchStarted()));
|
||||
connect(searchProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(readSearchOutput()));
|
||||
|
||||
@@ -55,6 +55,7 @@ class SearchListDelegate: public QItemDelegate {
|
||||
~SearchListDelegate(){}
|
||||
|
||||
void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const{
|
||||
painter->save();
|
||||
QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option);
|
||||
switch(index.column()){
|
||||
case SIZE:
|
||||
@@ -64,6 +65,7 @@ class SearchListDelegate: public QItemDelegate {
|
||||
default:
|
||||
QItemDelegate::paint(painter, option, index);
|
||||
}
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
QWidget* createEditor(QWidget*, const QStyleOptionViewItem &, const QModelIndex &) const {
|
||||
|
||||
22
src/src.pro
22
src/src.pro
@@ -11,10 +11,10 @@ CONFIG += qt \
|
||||
thread
|
||||
|
||||
# Update this VERSION for each release
|
||||
DEFINES += VERSION=\\\"v2.2.2\\\"
|
||||
DEFINES += VERSION=\'\"v2.2.3\"\'
|
||||
DEFINES += VERSION_MAJOR=2
|
||||
DEFINES += VERSION_MINOR=2
|
||||
DEFINES += VERSION_BUGFIX=2
|
||||
DEFINES += VERSION_BUGFIX=3
|
||||
|
||||
# NORMAL,ALPHA,BETA,RELEASE_CANDIDATE,DEVEL
|
||||
DEFINES += VERSION_TYPE=NORMAL
|
||||
@@ -100,8 +100,10 @@ else:TARGET = qbittorrent
|
||||
# QMAKE_CXXFLAGS_RELEASE += -fwrapv
|
||||
# QMAKE_CXXFLAGS_DEBUG += -fwrapv
|
||||
unix:QMAKE_LFLAGS_SHAPP += -rdynamic
|
||||
CONFIG += link_pkgconfig
|
||||
PKGCONFIG += "libtorrent-rasterbar"
|
||||
unix {
|
||||
CONFIG += link_pkgconfig
|
||||
PKGCONFIG += "libtorrent-rasterbar"
|
||||
}
|
||||
|
||||
QT += network
|
||||
!contains(DEFINES, DISABLE_GUI):QT += xml
|
||||
@@ -121,11 +123,22 @@ win32:LIBS += -lssl32 \
|
||||
-ladvapi32 \
|
||||
-lwinmm
|
||||
|
||||
os2:LIBS += -ltorrent-rasterbar \
|
||||
-lcurl \
|
||||
-lboost_thread \
|
||||
-lboost_system \
|
||||
-lboost_filesystem \
|
||||
-lssl -lcrypto -lidn -lpthread
|
||||
|
||||
!contains(DEFINES, DISABLE_GUI) {
|
||||
win32 {
|
||||
DEFINES += WITH_GEOIP_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 {
|
||||
DEFINES += WITH_GEOIP_EMBEDDED
|
||||
message("On Mac OS X, GeoIP database must be embedded.")
|
||||
@@ -227,7 +240,6 @@ else:HEADERS += GUI.h \
|
||||
ico.h \
|
||||
engineselectdlg.h \
|
||||
pluginsource.h \
|
||||
qgnomelook.h \
|
||||
searchEngine.h \
|
||||
rss.h \
|
||||
rss_imp.h \
|
||||
|
||||
@@ -305,10 +305,10 @@ public slots:
|
||||
// Check if that name is already used
|
||||
for(uint i=0; i<nbFiles; ++i) {
|
||||
if(i == file_index) continue;
|
||||
#ifdef Q_WS_WIN
|
||||
if(files_path.at(i).compare(new_name, Qt::CaseInsensitive) == 0) {
|
||||
#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS)
|
||||
if(files_path.at(i).compare(new_name, Qt::CaseSensitive) == 0) {
|
||||
#else
|
||||
if(files_path.at(i).compare(new_name, Qt::CaseSensitive) == 0) {
|
||||
if(files_path.at(i).compare(new_name, Qt::CaseInsensitive) == 0) {
|
||||
#endif
|
||||
// Display error message
|
||||
QMessageBox::warning(this, tr("The file could not be renamed"),
|
||||
@@ -339,10 +339,10 @@ public slots:
|
||||
// Check for overwriting
|
||||
for(uint i=0; i<nbFiles; ++i) {
|
||||
const QString ¤t_name = files_path.at(i);
|
||||
#ifdef Q_WS_WIN
|
||||
if(current_name.startsWith(new_path, Qt::CaseInsensitive)) {
|
||||
#if defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_QWS)
|
||||
if(current_name.startsWith(new_path, Qt::CaseSensitive)) {
|
||||
#else
|
||||
if(current_name.startsWith(new_path, Qt::CaseSensitive)) {
|
||||
if(current_name.startsWith(new_path, Qt::CaseInsensitive)) {
|
||||
#endif
|
||||
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."),
|
||||
@@ -456,10 +456,10 @@ public slots:
|
||||
if(!is_magnet) {
|
||||
bool path_changed = false;
|
||||
for(uint i=0; i<nbFiles; ++i) {
|
||||
#ifdef Q_WS_WIN
|
||||
if(files_path.at(i).compare(misc::toQString(t->file_at(i).path.string()), Qt::CaseInsensitive) != 0) {
|
||||
#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::CaseSensitive) != 0) {
|
||||
#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
|
||||
path_changed = true;
|
||||
break;
|
||||
|
||||
@@ -507,7 +507,7 @@ public:
|
||||
TreeItem *parent = this->rootItem;
|
||||
if(t.num_files() == 1) {
|
||||
// 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();
|
||||
foreach(const QString &part, path_parts) {
|
||||
TreeItem *folder = new TreeItem(part, parent);
|
||||
@@ -520,7 +520,7 @@ public:
|
||||
return;
|
||||
}
|
||||
// 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);
|
||||
//parent->appendChild(current_parent);
|
||||
TreeItem *root_folder = current_parent;
|
||||
@@ -532,7 +532,7 @@ public:
|
||||
current_parent = root_folder;
|
||||
QString path = QDir::cleanPath(misc::toQString(fi->path.string()));
|
||||
// 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);
|
||||
QString fileName = pathFolders.takeLast();
|
||||
QString currentFolderName = pathFolders.takeFirst();
|
||||
|
||||
@@ -55,6 +55,7 @@ public:
|
||||
|
||||
void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const{
|
||||
QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option);
|
||||
painter->save();
|
||||
switch(index.column()){
|
||||
case TR_SIZE:{
|
||||
QItemDelegate::drawBackground(painter, opt, index);
|
||||
@@ -172,6 +173,7 @@ public:
|
||||
default:
|
||||
QItemDelegate::paint(painter, option, index);
|
||||
}
|
||||
painter->restore();
|
||||
}
|
||||
|
||||
QWidget* createEditor(QWidget*, const QStyleOptionViewItem &, const QModelIndex &) const {
|
||||
|
||||
Reference in New Issue
Block a user