mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-22 08:27:24 -06:00
Compare commits
10 Commits
release-3.
...
v3_1_x
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
19adad5e43 | ||
|
|
edcd9539e7 | ||
|
|
066c70b047 | ||
|
|
2b24018f7a | ||
|
|
c421da873f | ||
|
|
1ae49d1743 | ||
|
|
aecb51c42b | ||
|
|
19c0a98701 | ||
|
|
ba1f9558a9 | ||
|
|
79f3c6439c |
@@ -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
|
||||
- FEATURE: Allow relative torrent paths when qBittorrent is already running (pmzqla)
|
||||
- FEATURE: Make Windows icons suitable for high dpi screens (pmzqla)
|
||||
|
||||
11
macxconf.pri
11
macxconf.pri
@@ -7,12 +7,10 @@ CONFIG += link_pkgconfig
|
||||
PKGCONFIG += libtorrent-rasterbar
|
||||
DEFINES += BOOST_ASIO_DYN_LINK
|
||||
|
||||
# Special include/libs paths (macports)
|
||||
INCLUDEPATH += /usr/include/openssl /usr/include /opt/local/include/boost /opt/local/include
|
||||
LIBS += -L/opt/local/lib
|
||||
# Special include/libs paths (homebrew and macports)
|
||||
INCLUDEPATH += /usr/local/include /opt/local/include /usr/include
|
||||
LIBS += -L/usr/local/lib -L/opt/local/lib -L/usr/lib
|
||||
|
||||
# OpenSSL lib
|
||||
LIBS += -lssl -lcrypto
|
||||
# Boost system lib
|
||||
LIBS += -lboost_system-mt
|
||||
# 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.files = mac/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/qt_bg.qm \
|
||||
qt-translations/qt_ca.qm \
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>3.1.11</string>
|
||||
<string>3.1.12</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>qBit</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
@@ -59,7 +59,7 @@
|
||||
<key>NSAppleScriptEnabled</key>
|
||||
<string>YES</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2006-2014 The qBittorrent project</string>
|
||||
<string>Copyright © 2006-2015 The qBittorrent project</string>
|
||||
<key>UTExportedTypeDeclarations</key>
|
||||
<array>
|
||||
<dict>
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
[Paths]
|
||||
Prefix = MacOS
|
||||
Translations = translations
|
||||
Plugins = PlugIns
|
||||
|
||||
@@ -155,6 +155,8 @@ private:
|
||||
#ifdef Q_OS_WIN
|
||||
bool addPythonPathToEnv();
|
||||
void installPython();
|
||||
|
||||
private slots:
|
||||
void pythonDownloadSuccess(QString url, QString file_path);
|
||||
void pythonDownloadFailure(QString url, QString error);
|
||||
#endif
|
||||
|
||||
12
src/misc.cpp
12
src/misc.cpp
@@ -70,6 +70,8 @@ const int UNLEN = 256;
|
||||
#endif
|
||||
#endif // DISABLE_GUI
|
||||
|
||||
#include <libtorrent/magnet_uri.hpp>
|
||||
|
||||
using namespace libtorrent;
|
||||
|
||||
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) {
|
||||
#if LIBTORRENT_VERSION_NUM < 1600
|
||||
QString hash = "";
|
||||
QRegExp regHex("urn:btih:([0-9A-Za-z]+)");
|
||||
// Hex
|
||||
@@ -397,6 +400,15 @@ QString misc::magnetUriToHash(const QString& magnet_uri) {
|
||||
}
|
||||
qDebug("magnetUriToHash (base32): hash: %s", qPrintable(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
|
||||
|
||||
@@ -1226,16 +1226,18 @@ public:
|
||||
}
|
||||
|
||||
#ifdef Q_WS_WIN
|
||||
static QString getPythonPath() {
|
||||
static QString Preferences::getPythonPath()
|
||||
{
|
||||
QString path = pythonSearchReg(USER);
|
||||
if (path.isEmpty())
|
||||
path = pythonSearchReg(SYSTEM_32BIT);
|
||||
else return path;
|
||||
if (!path.isEmpty())
|
||||
return path;
|
||||
|
||||
if (path.isEmpty())
|
||||
path = pythonSearchReg(SYSTEM_64BIT);
|
||||
else return path;
|
||||
path = pythonSearchReg(SYSTEM_32BIT);
|
||||
if (!path.isEmpty())
|
||||
return path;
|
||||
|
||||
|
||||
path = pythonSearchReg(SYSTEM_64BIT);
|
||||
if (!path.isEmpty())
|
||||
return path;
|
||||
|
||||
@@ -1243,10 +1245,11 @@ public:
|
||||
QStringList supported_versions;
|
||||
supported_versions << "32" << "31" << "30" << "27" << "26" << "25";
|
||||
foreach (const QString &v, supported_versions) {
|
||||
if (QFile::exists("C:/Python"+v+"/python.exe"))
|
||||
return "C:\\Python"+v;
|
||||
if (QFile::exists("C:/Python" + v + "/python.exe"))
|
||||
return "C:/Python" + v;
|
||||
}
|
||||
return QString::null;
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
bool neverCheckFileAssoc() const {
|
||||
@@ -1361,120 +1364,123 @@ public:
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
private:
|
||||
enum REG_SEARCH_TYPE {USER, SYSTEM_32BIT, SYSTEM_64BIT};
|
||||
|
||||
static QStringList getRegSubkeys(const HKEY &handle) {
|
||||
QStringList keys;
|
||||
DWORD subkeys_count = 0;
|
||||
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];
|
||||
enum REG_SEARCH_TYPE
|
||||
{
|
||||
USER,
|
||||
SYSTEM_32BIT,
|
||||
SYSTEM_64BIT
|
||||
};
|
||||
|
||||
for (uint i=0; i<subkeys_count; i++) {
|
||||
res = ::RegEnumKeyEx(handle, 0, key_name, &max_subkey_len, NULL, NULL, NULL, NULL);
|
||||
static QStringList getRegSubkeys(HKEY handle)
|
||||
{
|
||||
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)
|
||||
keys.push_back(QString::fromWCharArray(key_name));
|
||||
keys.push_back(QString::fromWCharArray(lpName));
|
||||
}
|
||||
delete[] key_name;
|
||||
|
||||
delete[] lpName;
|
||||
}
|
||||
|
||||
return keys;
|
||||
}
|
||||
|
||||
static QString getRegValue(const HKEY &handle, const QString &name = QString()) {
|
||||
QString end_result;
|
||||
DWORD type = 0;
|
||||
DWORD size = 0;
|
||||
DWORD array_size = 0;
|
||||
static QString getRegValue(HKEY handle, const QString &name = QString())
|
||||
{
|
||||
QString result;
|
||||
|
||||
LPTSTR value_name = NULL;
|
||||
DWORD type = 0;
|
||||
DWORD cbData = 0;
|
||||
LPWSTR lpValueName = NULL;
|
||||
if (!name.isEmpty()) {
|
||||
value_name = new TCHAR[name.size()+1];
|
||||
name.toWCharArray(value_name);
|
||||
value_name[name.size()] = '\0';
|
||||
lpValueName = new WCHAR[name.size() + 1];
|
||||
name.toWCharArray(lpValueName);
|
||||
lpValueName[name.size()] = 0;
|
||||
}
|
||||
|
||||
// Discover the size of the value
|
||||
::RegQueryValueEx(handle, value_name, NULL, &type, NULL, &size);
|
||||
array_size = size / sizeof(TCHAR);
|
||||
if (size % sizeof(TCHAR))
|
||||
array_size++;
|
||||
array_size++; //For null character
|
||||
LPTSTR value = new TCHAR[array_size];
|
||||
::RegQueryValueExW(handle, lpValueName, NULL, &type, NULL, &cbData);
|
||||
DWORD cBuffer = (cbData / sizeof(WCHAR)) + 1;
|
||||
LPWSTR lpData = new WCHAR[cBuffer];
|
||||
LONG res = ::RegQueryValueExW(handle, lpValueName, NULL, &type, (LPBYTE)lpData, &cbData);
|
||||
if (lpValueName)
|
||||
delete[] lpValueName;
|
||||
|
||||
long res = ::RegQueryValueEx(handle, value_name, NULL, &type, (LPBYTE)value, &size);
|
||||
if (res == ERROR_SUCCESS) {
|
||||
value[array_size] = '\0';
|
||||
end_result = QString::fromWCharArray(value);
|
||||
lpData[cBuffer - 1] = 0;
|
||||
result = QString::fromWCharArray(lpData);
|
||||
}
|
||||
delete[] lpData;
|
||||
|
||||
if (value_name)
|
||||
delete[] value_name;
|
||||
if (value)
|
||||
delete[] value;
|
||||
|
||||
return end_result;
|
||||
return result;
|
||||
}
|
||||
|
||||
static QString pythonSearchReg(const REG_SEARCH_TYPE type) {
|
||||
HKEY key_handle1;
|
||||
long res = 0;
|
||||
static QString pythonSearchReg(const REG_SEARCH_TYPE type)
|
||||
{
|
||||
HKEY hkRoot;
|
||||
if (type == USER)
|
||||
hkRoot = HKEY_CURRENT_USER;
|
||||
else
|
||||
hkRoot = HKEY_LOCAL_MACHINE;
|
||||
|
||||
switch (type) {
|
||||
case USER:
|
||||
res = ::RegOpenKeyEx(HKEY_CURRENT_USER, TEXT("SOFTWARE\\Python\\PythonCore"), 0, KEY_READ, &key_handle1);
|
||||
break;
|
||||
case SYSTEM_32BIT:
|
||||
res = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Python\\PythonCore"), 0, KEY_READ|KEY_WOW64_32KEY, &key_handle1);
|
||||
break;
|
||||
case SYSTEM_64BIT:
|
||||
res = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Python\\PythonCore"), 0, KEY_READ|KEY_WOW64_64KEY, &key_handle1);
|
||||
break;
|
||||
}
|
||||
REGSAM samDesired = KEY_READ;
|
||||
if (type == SYSTEM_32BIT)
|
||||
samDesired |= KEY_WOW64_32KEY;
|
||||
else if (type == SYSTEM_64BIT)
|
||||
samDesired |= KEY_WOW64_64KEY;
|
||||
|
||||
QString path;
|
||||
LONG res = 0;
|
||||
HKEY hkPythonCore;
|
||||
res = ::RegOpenKeyExW(hkRoot, L"SOFTWARE\\Python\\PythonCore", 0, samDesired, &hkPythonCore);
|
||||
|
||||
if (res == ERROR_SUCCESS) {
|
||||
QStringList versions = getRegSubkeys(key_handle1);
|
||||
QStringList versions = getRegSubkeys(hkPythonCore);
|
||||
qDebug("Python versions nb: %d", versions.size());
|
||||
versions.sort();
|
||||
|
||||
while(!versions.empty()) {
|
||||
const QString version = versions.takeLast()+"\\InstallPath";
|
||||
HKEY key_handle2;
|
||||
LPTSTR subkey = new TCHAR[version.size()+1];
|
||||
version.toWCharArray(subkey);
|
||||
subkey[version.size()] = '\0';
|
||||
bool found = false;
|
||||
while(!found && !versions.empty()) {
|
||||
const QString version = versions.takeLast() + "\\InstallPath";
|
||||
LPWSTR lpSubkey = new WCHAR[version.size() + 1];
|
||||
version.toWCharArray(lpSubkey);
|
||||
lpSubkey[version.size()] = 0;
|
||||
|
||||
switch (type) {
|
||||
case USER:
|
||||
res = ::RegOpenKeyEx(key_handle1, subkey, 0, KEY_READ, &key_handle2);
|
||||
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;
|
||||
}
|
||||
HKEY hkInstallPath;
|
||||
res = ::RegOpenKeyExW(hkPythonCore, lpSubkey, 0, samDesired, &hkInstallPath);
|
||||
delete[] lpSubkey;
|
||||
|
||||
delete[] subkey;
|
||||
if (res == ERROR_SUCCESS) {
|
||||
qDebug("Detected possible Python v%s location", qPrintable(version));
|
||||
QString path = getRegValue(key_handle2);
|
||||
::RegCloseKey(key_handle2);
|
||||
path = getRegValue(hkInstallPath);
|
||||
::RegCloseKey(hkInstallPath);
|
||||
|
||||
if (!path.isEmpty() && QDir(path).exists("python.exe")) {
|
||||
qDebug("Found python.exe at %s", qPrintable(path));
|
||||
::RegCloseKey(key_handle1);
|
||||
return path;
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
::RegCloseKey(key_handle2);
|
||||
}
|
||||
|
||||
if (!found)
|
||||
path = QString();
|
||||
|
||||
::RegCloseKey(hkPythonCore);
|
||||
}
|
||||
::RegCloseKey(key_handle1);
|
||||
return QString::null;
|
||||
|
||||
return path;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
Binary file not shown.
@@ -77,15 +77,15 @@ void TorrentImportDlg::on_browseContentBtn_clicked()
|
||||
{
|
||||
QIniSettings settings;
|
||||
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;
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
if (!multifile && has_parent_path(t->files().file_path(*(t->files().begin()))))
|
||||
multifile = true;
|
||||
if (!multifile && (QDir::fromNativeSeparators(misc::toQStringU(t->file_at(0).path)).indexOf('/') != -1))
|
||||
multifile = true;
|
||||
#else
|
||||
if (!multifile && t->file_at(0).path.has_parent_path())
|
||||
multifile = true;
|
||||
multifile = true;
|
||||
#endif
|
||||
|
||||
if (!multifile) {
|
||||
// Single file torrent
|
||||
#if LIBTORRENT_VERSION_NUM >= 1600
|
||||
|
||||
@@ -19,7 +19,7 @@ XPStyle on
|
||||
!define CSIDL_APPDATA '0x1A' ;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_FUNCTION PageFinishRun
|
||||
!define MUI_FINISHPAGE_RUN_TEXT $(launch_qbt)
|
||||
@@ -33,7 +33,7 @@ OutFile "qbittorrent_${PROG_VERSION}_setup.exe"
|
||||
;Installer Version Information
|
||||
VIAddVersionKey "ProductName" "qBittorrent"
|
||||
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 "FileVersion" "${PROG_VERSION}"
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
PROJECT_NAME = qbittorrent
|
||||
PROJECT_VERSION = 3.1.11
|
||||
PROJECT_VERSION = 3.1.12
|
||||
|
||||
os2 {
|
||||
DEFINES += VERSION=\'\"v$${PROJECT_VERSION}\"\'
|
||||
@@ -9,4 +9,4 @@ os2 {
|
||||
|
||||
DEFINES += VERSION_MAJOR=3
|
||||
DEFINES += VERSION_MINOR=1
|
||||
DEFINES += VERSION_BUGFIX=11
|
||||
DEFINES += VERSION_BUGFIX=12
|
||||
|
||||
Reference in New Issue
Block a user