diff --git a/configure b/configure index 5e546568a..33fcb4ea9 100755 --- a/configure +++ b/configure @@ -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 diff --git a/qcm/libboost.qcm b/qcm/libboost.qcm index e4fcbecb8..a7a031969 100644 --- a/qcm/libboost.qcm +++ b/qcm/libboost.qcm @@ -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; } }; diff --git a/qcm/libtorrent-rasterbar.qcm b/qcm/libtorrent-rasterbar.qcm index 1372359f9..38e321861 100644 --- a/qcm/libtorrent-rasterbar.qcm +++ b/qcm/libtorrent-rasterbar.qcm @@ -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; } }; diff --git a/src/GUI.cpp b/src/GUI.cpp index 160b83abf..90811f1e4 100644 --- a/src/GUI.cpp +++ b/src/GUI.cpp @@ -828,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 = "
"; html += tr("qBittorrent"); html += "
"; @@ -843,6 +838,11 @@ void GUI::updateGUI() { html += "
"; html += " "+tr("UP speed: %1 KiB/s", "e.g: Upload speed: 10 KiB/s").arg(QString::number(BTSession->getPayloadUploadRate()/1024., 'f', 1)); html += "
"; +#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 } diff --git a/src/main.cpp b/src/main.cpp index 86fb8efae..e1d53d355 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -52,11 +52,14 @@ #include #include #include -#ifndef Q_WS_WIN + +#if defined(Q_WS_X11) || defined(Q_WS_MAC) #include #include #include "stacktrace.h" -#else +#endif + +#ifdef Q_WS_WIN #include const int UNLEN = 256; #endif @@ -125,7 +128,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"); @@ -301,7 +304,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); @@ -323,7 +326,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); diff --git a/src/propertieswidget.cpp b/src/propertieswidget.cpp index 2ad4eb9be..2f57c1a41 100644 --- a/src/propertieswidget.cpp +++ b/src/propertieswidget.cpp @@ -583,10 +583,10 @@ void PropertiesWidget::renameSelectedFile() { // Check if that name is already used for(int i=0; ifile_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; diff --git a/src/torrentfilesmodel.h b/src/torrentfilesmodel.h index c135af67d..1e798dacb 100644 --- a/src/torrentfilesmodel.h +++ b/src/torrentfilesmodel.h @@ -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();