Compare commits

...

10 Commits

Author SHA1 Message Date
sledgehammer999
19adad5e43 Bump to 3.1.12 2015-02-23 00:14:24 +02:00
sledgehammer999
edcd9539e7 Update Changelog. 2015-02-23 00:14:17 +02:00
David Christenson
066c70b047 Adjust library paths, add deployment target 2015-02-23 00:14:09 +02:00
David Christenson
2b24018f7a Change library paths and remove prefix 2015-02-23 00:14:01 +02:00
sledgehammer999
c421da873f Remove openssl dependency from Mac OS X configuration file. 2015-02-23 00:13:53 +02:00
sledgehammer999
1ae49d1743 Fix heap corruption. Closes #2342.
Manual backporting of commit b45eb28099 (master).
2015-02-23 00:13:45 +02:00
sledgehammer999
aecb51c42b Improve Windows Registry searching for Python.
Manual backporting of commit f851875ad1 (master).
2015-02-23 00:13:37 +02:00
sledgehammer999
19c0a98701 WINDOWS: Fix automatic python download. Commit 0799dc2 broke this. Closes #2076. 2015-02-23 00:13:17 +02:00
sledgehammer999
ba1f9558a9 Fix compilation with libtorrent 0.15.x. 2014-11-26 02:48:49 +02:00
sledgehammer999
79f3c6439c Stop using internal libtorrent API. Closes 2202. 2014-11-26 01:56:29 +02:00
11 changed files with 129 additions and 106 deletions

View File

@@ -1,3 +1,8 @@
* Wed Feb 22 2015 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v3.1.12
- OSX: Fix build to work with older machines. (sledgehammer999, Noctem)
- WINDOWS: Fix automatic Python download. (sledgehammer999)
- WINDOWS: Fix crashes due to memory corruption and improve Python registry searching. (glassez)
* Wed Oct 22 2014 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v3.1.11 * Wed Oct 22 2014 - sledgehammer999 <sledgehammer999@qbittorrent.org> - v3.1.11
- FEATURE: Allow relative torrent paths when qBittorrent is already running (pmzqla) - FEATURE: Allow relative torrent paths when qBittorrent is already running (pmzqla)
- FEATURE: Make Windows icons suitable for high dpi screens (pmzqla) - FEATURE: Make Windows icons suitable for high dpi screens (pmzqla)

View File

@@ -7,12 +7,10 @@ CONFIG += link_pkgconfig
PKGCONFIG += libtorrent-rasterbar PKGCONFIG += libtorrent-rasterbar
DEFINES += BOOST_ASIO_DYN_LINK DEFINES += BOOST_ASIO_DYN_LINK
# Special include/libs paths (macports) # Special include/libs paths (homebrew and macports)
INCLUDEPATH += /usr/include/openssl /usr/include /opt/local/include/boost /opt/local/include INCLUDEPATH += /usr/local/include /opt/local/include /usr/include
LIBS += -L/opt/local/lib LIBS += -L/usr/local/lib -L/opt/local/lib -L/usr/lib
# OpenSSL lib
LIBS += -lssl -lcrypto
# Boost system lib # Boost system lib
LIBS += -lboost_system-mt LIBS += -lboost_system-mt
# Boost filesystem lib (Not needed for libtorrent >= 0.16.0) # Boost filesystem lib (Not needed for libtorrent >= 0.16.0)
@@ -29,8 +27,9 @@ QMAKE_BUNDLE_DATA += document_icon
qt_conf.path = Contents/Resources qt_conf.path = Contents/Resources
qt_conf.files = mac/qt.conf qt_conf.files = mac/qt.conf
QMAKE_BUNDLE_DATA += qt_conf QMAKE_BUNDLE_DATA += qt_conf
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
qt_translations.path = Contents/MacOS/translations qt_translations.path = Contents/translations
qt_translations.files = qt-translations/qt_ar.qm \ qt_translations.files = qt-translations/qt_ar.qm \
qt-translations/qt_bg.qm \ qt-translations/qt_bg.qm \
qt-translations/qt_ca.qm \ qt-translations/qt_ca.qm \

View File

@@ -45,7 +45,7 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>3.1.11</string> <string>3.1.12</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>qBit</string> <string>qBit</string>
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
@@ -59,7 +59,7 @@
<key>NSAppleScriptEnabled</key> <key>NSAppleScriptEnabled</key>
<string>YES</string> <string>YES</string>
<key>NSHumanReadableCopyright</key> <key>NSHumanReadableCopyright</key>
<string>Copyright © 2006-2014 The qBittorrent project</string> <string>Copyright © 2006-2015 The qBittorrent project</string>
<key>UTExportedTypeDeclarations</key> <key>UTExportedTypeDeclarations</key>
<array> <array>
<dict> <dict>

View File

@@ -1,4 +1,3 @@
[Paths] [Paths]
Prefix = MacOS
Translations = translations Translations = translations
Plugins = PlugIns Plugins = PlugIns

View File

@@ -155,6 +155,8 @@ private:
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
bool addPythonPathToEnv(); bool addPythonPathToEnv();
void installPython(); void installPython();
private slots:
void pythonDownloadSuccess(QString url, QString file_path); void pythonDownloadSuccess(QString url, QString file_path);
void pythonDownloadFailure(QString url, QString error); void pythonDownloadFailure(QString url, QString error);
#endif #endif

View File

@@ -70,6 +70,8 @@ const int UNLEN = 256;
#endif #endif
#endif // DISABLE_GUI #endif // DISABLE_GUI
#include <libtorrent/magnet_uri.hpp>
using namespace libtorrent; using namespace libtorrent;
static struct { const char *source; const char *comment; } units[] = { static struct { const char *source; const char *comment; } units[] = {
@@ -372,6 +374,7 @@ QList<QUrl> misc::magnetUriToTrackers(const QString& magnet_uri)
} }
QString misc::magnetUriToHash(const QString& magnet_uri) { QString misc::magnetUriToHash(const QString& magnet_uri) {
#if LIBTORRENT_VERSION_NUM < 1600
QString hash = ""; QString hash = "";
QRegExp regHex("urn:btih:([0-9A-Za-z]+)"); QRegExp regHex("urn:btih:([0-9A-Za-z]+)");
// Hex // Hex
@@ -397,6 +400,15 @@ QString misc::magnetUriToHash(const QString& magnet_uri) {
} }
qDebug("magnetUriToHash (base32): hash: %s", qPrintable(hash)); qDebug("magnetUriToHash (base32): hash: %s", qPrintable(hash));
return hash; return hash;
#else
add_torrent_params p;
error_code ec;
parse_magnet_uri(magnet_uri.toUtf8().constData(), p, ec);
if (ec)
return QString::null;
return toQString(p.info_hash);
#endif
} }
// Take a number of seconds and return an user-friendly // Take a number of seconds and return an user-friendly

View File

@@ -1226,16 +1226,18 @@ public:
} }
#ifdef Q_WS_WIN #ifdef Q_WS_WIN
static QString getPythonPath() { static QString Preferences::getPythonPath()
{
QString path = pythonSearchReg(USER); QString path = pythonSearchReg(USER);
if (path.isEmpty()) if (!path.isEmpty())
path = pythonSearchReg(SYSTEM_32BIT); return path;
else return path;
if (path.isEmpty()) path = pythonSearchReg(SYSTEM_32BIT);
path = pythonSearchReg(SYSTEM_64BIT); if (!path.isEmpty())
else return path; return path;
path = pythonSearchReg(SYSTEM_64BIT);
if (!path.isEmpty()) if (!path.isEmpty())
return path; return path;
@@ -1243,10 +1245,11 @@ public:
QStringList supported_versions; QStringList supported_versions;
supported_versions << "32" << "31" << "30" << "27" << "26" << "25"; supported_versions << "32" << "31" << "30" << "27" << "26" << "25";
foreach (const QString &v, supported_versions) { foreach (const QString &v, supported_versions) {
if (QFile::exists("C:/Python"+v+"/python.exe")) if (QFile::exists("C:/Python" + v + "/python.exe"))
return "C:\\Python"+v; return "C:/Python" + v;
} }
return QString::null;
return QString();
} }
bool neverCheckFileAssoc() const { bool neverCheckFileAssoc() const {
@@ -1361,120 +1364,123 @@ public:
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
private: private:
enum REG_SEARCH_TYPE {USER, SYSTEM_32BIT, SYSTEM_64BIT}; enum REG_SEARCH_TYPE
{
static QStringList getRegSubkeys(const HKEY &handle) { USER,
QStringList keys; SYSTEM_32BIT,
DWORD subkeys_count = 0; SYSTEM_64BIT
DWORD max_subkey_len = 0; };
long res = ::RegQueryInfoKey(handle, NULL, NULL, NULL, &subkeys_count, &max_subkey_len, NULL, NULL, NULL, NULL, NULL, NULL);
if (res == ERROR_SUCCESS) {
max_subkey_len++; //For null character
LPTSTR key_name = new TCHAR[max_subkey_len];
for (uint i=0; i<subkeys_count; i++) { static QStringList getRegSubkeys(HKEY handle)
res = ::RegEnumKeyEx(handle, 0, key_name, &max_subkey_len, NULL, NULL, NULL, NULL); {
QStringList keys;
DWORD cSubKeys = 0;
DWORD cMaxSubKeyLen = 0;
LONG res = ::RegQueryInfoKeyW(handle, NULL, NULL, NULL, &cSubKeys, &cMaxSubKeyLen, NULL, NULL, NULL, NULL, NULL, NULL);
if (res == ERROR_SUCCESS) {
cMaxSubKeyLen++; // For null character
LPWSTR lpName = new WCHAR[cMaxSubKeyLen];
DWORD cName;
for (DWORD i = 0; i < cSubKeys; ++i) {
cName = cMaxSubKeyLen;
res = ::RegEnumKeyExW(handle, 0, lpName, &cName, NULL, NULL, NULL, NULL);
if (res == ERROR_SUCCESS) if (res == ERROR_SUCCESS)
keys.push_back(QString::fromWCharArray(key_name)); keys.push_back(QString::fromWCharArray(lpName));
} }
delete[] key_name;
delete[] lpName;
} }
return keys; return keys;
} }
static QString getRegValue(const HKEY &handle, const QString &name = QString()) { static QString getRegValue(HKEY handle, const QString &name = QString())
QString end_result; {
DWORD type = 0; QString result;
DWORD size = 0;
DWORD array_size = 0;
LPTSTR value_name = NULL; DWORD type = 0;
DWORD cbData = 0;
LPWSTR lpValueName = NULL;
if (!name.isEmpty()) { if (!name.isEmpty()) {
value_name = new TCHAR[name.size()+1]; lpValueName = new WCHAR[name.size() + 1];
name.toWCharArray(value_name); name.toWCharArray(lpValueName);
value_name[name.size()] = '\0'; lpValueName[name.size()] = 0;
} }
// Discover the size of the value // Discover the size of the value
::RegQueryValueEx(handle, value_name, NULL, &type, NULL, &size); ::RegQueryValueExW(handle, lpValueName, NULL, &type, NULL, &cbData);
array_size = size / sizeof(TCHAR); DWORD cBuffer = (cbData / sizeof(WCHAR)) + 1;
if (size % sizeof(TCHAR)) LPWSTR lpData = new WCHAR[cBuffer];
array_size++; LONG res = ::RegQueryValueExW(handle, lpValueName, NULL, &type, (LPBYTE)lpData, &cbData);
array_size++; //For null character if (lpValueName)
LPTSTR value = new TCHAR[array_size]; delete[] lpValueName;
long res = ::RegQueryValueEx(handle, value_name, NULL, &type, (LPBYTE)value, &size);
if (res == ERROR_SUCCESS) { if (res == ERROR_SUCCESS) {
value[array_size] = '\0'; lpData[cBuffer - 1] = 0;
end_result = QString::fromWCharArray(value); result = QString::fromWCharArray(lpData);
} }
delete[] lpData;
if (value_name) return result;
delete[] value_name;
if (value)
delete[] value;
return end_result;
} }
static QString pythonSearchReg(const REG_SEARCH_TYPE type) { static QString pythonSearchReg(const REG_SEARCH_TYPE type)
HKEY key_handle1; {
long res = 0; HKEY hkRoot;
if (type == USER)
hkRoot = HKEY_CURRENT_USER;
else
hkRoot = HKEY_LOCAL_MACHINE;
switch (type) { REGSAM samDesired = KEY_READ;
case USER: if (type == SYSTEM_32BIT)
res = ::RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("SOFTWARE\\Python\\PythonCore"), 0, KEY_READ, &key_handle1); samDesired |= KEY_WOW64_32KEY;
break; else if (type == SYSTEM_64BIT)
case SYSTEM_32BIT: samDesired |= KEY_WOW64_64KEY;
res = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Python\\PythonCore"), 0, KEY_READ|KEY_WOW64_32KEY, &key_handle1);
break; QString path;
case SYSTEM_64BIT: LONG res = 0;
res = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Python\\PythonCore"), 0, KEY_READ|KEY_WOW64_64KEY, &key_handle1); HKEY hkPythonCore;
break; res = ::RegOpenKeyExW(hkRoot, L"SOFTWARE\\Python\\PythonCore", 0, samDesired, &hkPythonCore);
}
if (res == ERROR_SUCCESS) { if (res == ERROR_SUCCESS) {
QStringList versions = getRegSubkeys(key_handle1); QStringList versions = getRegSubkeys(hkPythonCore);
qDebug("Python versions nb: %d", versions.size()); qDebug("Python versions nb: %d", versions.size());
versions.sort(); versions.sort();
while(!versions.empty()) { bool found = false;
const QString version = versions.takeLast()+"\\InstallPath"; while(!found && !versions.empty()) {
HKEY key_handle2; const QString version = versions.takeLast() + "\\InstallPath";
LPTSTR subkey = new TCHAR[version.size()+1]; LPWSTR lpSubkey = new WCHAR[version.size() + 1];
version.toWCharArray(subkey); version.toWCharArray(lpSubkey);
subkey[version.size()] = '\0'; lpSubkey[version.size()] = 0;
switch (type) { HKEY hkInstallPath;
case USER: res = ::RegOpenKeyExW(hkPythonCore, lpSubkey, 0, samDesired, &hkInstallPath);
res = ::RegOpenKeyEx(key_handle1, subkey, 0, KEY_READ, &key_handle2); delete[] lpSubkey;
break;
case SYSTEM_32BIT:
res = ::RegOpenKeyEx(key_handle1, subkey, 0, KEY_READ|KEY_WOW64_32KEY, &key_handle2);
break;
case SYSTEM_64BIT:
res = ::RegOpenKeyEx(key_handle1, subkey, 0, KEY_READ|KEY_WOW64_64KEY, &key_handle2);
break;
}
delete[] subkey;
if (res == ERROR_SUCCESS) { if (res == ERROR_SUCCESS) {
qDebug("Detected possible Python v%s location", qPrintable(version)); qDebug("Detected possible Python v%s location", qPrintable(version));
QString path = getRegValue(key_handle2); path = getRegValue(hkInstallPath);
::RegCloseKey(key_handle2); ::RegCloseKey(hkInstallPath);
if (!path.isEmpty() && QDir(path).exists("python.exe")) { if (!path.isEmpty() && QDir(path).exists("python.exe")) {
qDebug("Found python.exe at %s", qPrintable(path)); qDebug("Found python.exe at %s", qPrintable(path));
::RegCloseKey(key_handle1); found = true;
return path;
} }
} }
else
::RegCloseKey(key_handle2);
} }
if (!found)
path = QString();
::RegCloseKey(hkPythonCore);
} }
::RegCloseKey(key_handle1);
return QString::null; return path;
} }
#endif #endif
}; };

Binary file not shown.

View File

@@ -77,15 +77,15 @@ void TorrentImportDlg::on_browseContentBtn_clicked()
{ {
QIniSettings settings; QIniSettings settings;
const QString default_dir = settings.value(QString::fromUtf8("TorrentImport/LastContentDir"), QDir::homePath()).toString(); const QString default_dir = settings.value(QString::fromUtf8("TorrentImport/LastContentDir"), QDir::homePath()).toString();
// Test for multi-file taken from libtorrent/create_torrent.hpp -> create_torrent::create_torrent
bool multifile = t->num_files() > 1; bool multifile = t->num_files() > 1;
#if LIBTORRENT_VERSION_NUM >= 1600 #if LIBTORRENT_VERSION_NUM >= 1600
if (!multifile && has_parent_path(t->files().file_path(*(t->files().begin())))) if (!multifile && (QDir::fromNativeSeparators(misc::toQStringU(t->file_at(0).path)).indexOf('/') != -1))
multifile = true; multifile = true;
#else #else
if (!multifile && t->file_at(0).path.has_parent_path()) if (!multifile && t->file_at(0).path.has_parent_path())
multifile = true; multifile = true;
#endif #endif
if (!multifile) { if (!multifile) {
// Single file torrent // Single file torrent
#if LIBTORRENT_VERSION_NUM >= 1600 #if LIBTORRENT_VERSION_NUM >= 1600

View File

@@ -19,7 +19,7 @@ XPStyle on
!define CSIDL_APPDATA '0x1A' ;Application Data path !define CSIDL_APPDATA '0x1A' ;Application Data path
!define CSIDL_LOCALAPPDATA '0x1C' ;Local Application Data path !define CSIDL_LOCALAPPDATA '0x1C' ;Local Application Data path
!define PROG_VERSION "3.1.11" !define PROG_VERSION "3.1.12"
!define MUI_FINISHPAGE_RUN !define MUI_FINISHPAGE_RUN
!define MUI_FINISHPAGE_RUN_FUNCTION PageFinishRun !define MUI_FINISHPAGE_RUN_FUNCTION PageFinishRun
!define MUI_FINISHPAGE_RUN_TEXT $(launch_qbt) !define MUI_FINISHPAGE_RUN_TEXT $(launch_qbt)
@@ -33,7 +33,7 @@ OutFile "qbittorrent_${PROG_VERSION}_setup.exe"
;Installer Version Information ;Installer Version Information
VIAddVersionKey "ProductName" "qBittorrent" VIAddVersionKey "ProductName" "qBittorrent"
VIAddVersionKey "CompanyName" "The qBittorrent project" VIAddVersionKey "CompanyName" "The qBittorrent project"
VIAddVersionKey "LegalCopyright" "Copyright ©2006-2014 The qBittorrent project" VIAddVersionKey "LegalCopyright" "Copyright ©2006-2015 The qBittorrent project"
VIAddVersionKey "FileDescription" "qBittorrent - A Bittorrent Client" VIAddVersionKey "FileDescription" "qBittorrent - A Bittorrent Client"
VIAddVersionKey "FileVersion" "${PROG_VERSION}" VIAddVersionKey "FileVersion" "${PROG_VERSION}"

View File

@@ -1,5 +1,5 @@
PROJECT_NAME = qbittorrent PROJECT_NAME = qbittorrent
PROJECT_VERSION = 3.1.11 PROJECT_VERSION = 3.1.12
os2 { os2 {
DEFINES += VERSION=\'\"v$${PROJECT_VERSION}\"\' DEFINES += VERSION=\'\"v$${PROJECT_VERSION}\"\'
@@ -9,4 +9,4 @@ os2 {
DEFINES += VERSION_MAJOR=3 DEFINES += VERSION_MAJOR=3
DEFINES += VERSION_MINOR=1 DEFINES += VERSION_MINOR=1
DEFINES += VERSION_BUGFIX=11 DEFINES += VERSION_BUGFIX=12