mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-22 20:44:15 +00:00
Windows compilation fixes (Thanks LiHuiShuo)
This commit is contained in:
parent
e16ca862f4
commit
5675c045ae
@ -170,8 +170,8 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
|
|||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
char buffer[UNLEN+1] = {0};
|
char buffer[UNLEN+1] = {0};
|
||||||
DWORD buffer_len = UNLEN + 1;
|
DWORD buffer_len = UNLEN + 1;
|
||||||
if (!GetUserName(buffer, &buffer_len))
|
if (!GetUserNameA(buffer, &buffer_len))
|
||||||
uid = QString(buffer)
|
uid = QString(buffer);
|
||||||
#else
|
#else
|
||||||
uid = QString::number(getuid());
|
uid = QString::number(getuid());
|
||||||
#endif
|
#endif
|
||||||
|
@ -2,10 +2,10 @@
|
|||||||
#define FILESYSTEMWATCHER_H
|
#define FILESYSTEMWATCHER_H
|
||||||
|
|
||||||
#include <QFileSystemWatcher>
|
#include <QFileSystemWatcher>
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
#ifndef Q_WS_WIN
|
#ifndef Q_WS_WIN
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QDir>
|
|
||||||
#include <QPointer>
|
#include <QPointer>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
@ -180,6 +180,7 @@ protected slots:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void scanNetworkFolders() {
|
void scanNetworkFolders() {
|
||||||
|
#ifndef Q_WS_WIN
|
||||||
qDebug("scanNetworkFolders() called");
|
qDebug("scanNetworkFolders() called");
|
||||||
QStringList torrents;
|
QStringList torrents;
|
||||||
// Network folders scan
|
// Network folders scan
|
||||||
@ -192,6 +193,7 @@ protected slots:
|
|||||||
qDebug("The following files are being reported: %s", qPrintable(torrents.join("\n")));
|
qDebug("The following files are being reported: %s", qPrintable(torrents.join("\n")));
|
||||||
emit torrentsAdded(torrents);
|
emit torrentsAdded(torrents);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
@ -180,8 +180,8 @@ int main(int argc, char *argv[]){
|
|||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
char buffer[UNLEN+1] = {0};
|
char buffer[UNLEN+1] = {0};
|
||||||
DWORD buffer_len = UNLEN + 1;
|
DWORD buffer_len = UNLEN + 1;
|
||||||
if (!GetUserName(buffer, &buffer_len))
|
if (!GetUserNameA(buffer, &buffer_len))
|
||||||
uid = QString(buffer)
|
uid = QString(buffer);
|
||||||
#else
|
#else
|
||||||
uid = QString::number(getuid());
|
uid = QString::number(getuid());
|
||||||
#endif
|
#endif
|
||||||
|
10
src/misc.cpp
10
src/misc.cpp
@ -64,6 +64,8 @@
|
|||||||
|
|
||||||
QString misc::QDesktopServicesDataLocation() {
|
QString misc::QDesktopServicesDataLocation() {
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
|
LPWSTR path=new WCHAR[256];
|
||||||
|
QString result;
|
||||||
#if defined Q_WS_WINCE
|
#if defined Q_WS_WINCE
|
||||||
if (SHGetSpecialFolderPath(0, path, CSIDL_APPDATA, FALSE))
|
if (SHGetSpecialFolderPath(0, path, CSIDL_APPDATA, FALSE))
|
||||||
#else
|
#else
|
||||||
@ -147,16 +149,16 @@ long long misc::freeDiskSpaceOnPath(QString path) {
|
|||||||
GetDiskFreeSpaceEx_t
|
GetDiskFreeSpaceEx_t
|
||||||
pGetDiskFreeSpaceEx = (GetDiskFreeSpaceEx_t)::GetProcAddress
|
pGetDiskFreeSpaceEx = (GetDiskFreeSpaceEx_t)::GetProcAddress
|
||||||
(
|
(
|
||||||
::GetModuleHandle(_T("kernel32.dll")),
|
::GetModuleHandle(TEXT("kernel32.dll")),
|
||||||
"GetDiskFreeSpaceExW"
|
"GetDiskFreeSpaceExW"
|
||||||
);
|
);
|
||||||
if ( pGetDiskFreeSpaceEx )
|
if ( pGetDiskFreeSpaceEx )
|
||||||
{
|
{
|
||||||
ULARGE_INTEGER bytesFree, bytesTotal;
|
ULARGE_INTEGER bytesFree, bytesTotal;
|
||||||
unsigned long long *ret;
|
unsigned long long *ret;
|
||||||
if (pGetDiskFreeSpaceEx((LPCTSTR)path.ucs2(), &bytesFree, &bytesTotal, NULL)) {
|
if (pGetDiskFreeSpaceEx((LPCTSTR)path.utf16(), &bytesFree, &bytesTotal, NULL)) {
|
||||||
tmp = (unsigned long long*)&bytesFree
|
ret = (unsigned long long*)&bytesFree;
|
||||||
return ret;
|
return *ret;
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
#include "propertieswidget.h"
|
#include "propertieswidget.h"
|
||||||
|
|
||||||
// Defines for properties list columns
|
// Defines for properties list columns
|
||||||
enum PropColumn {NAME, SIZE, PROGRESS, PRIORITY};
|
enum PropColumn {NAME, PCSIZE, PROGRESS, PRIORITY};
|
||||||
|
|
||||||
class PropListDelegate: public QItemDelegate {
|
class PropListDelegate: public QItemDelegate {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -65,7 +65,7 @@ public:
|
|||||||
painter->save();
|
painter->save();
|
||||||
QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option);
|
QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option);
|
||||||
switch(index.column()){
|
switch(index.column()){
|
||||||
case SIZE:
|
case PCSIZE:
|
||||||
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;
|
||||||
|
42
src/src.pro
42
src/src.pro
@ -16,6 +16,16 @@ DEFINES += VERSION_MAJOR=2
|
|||||||
DEFINES += VERSION_MINOR=3
|
DEFINES += VERSION_MINOR=3
|
||||||
DEFINES += VERSION_BUGFIX=0
|
DEFINES += VERSION_BUGFIX=0
|
||||||
|
|
||||||
|
win32 {
|
||||||
|
# Adapt these paths on Windows
|
||||||
|
INCLUDEPATH += $$quote(D:/librarys/boost_1_42_0)
|
||||||
|
INCLUDEPATH += $$quote(D:/librarys/libtorrent-rasterbar-0.14.9/include)
|
||||||
|
|
||||||
|
DEFINES += _WIN32_WINNT=0x0501
|
||||||
|
DEFINES += _WIN32_IE=0x0400
|
||||||
|
DEFINES += _WIN32_WINDOWS
|
||||||
|
}
|
||||||
|
|
||||||
# NORMAL,ALPHA,BETA,RELEASE_CANDIDATE,DEVEL
|
# NORMAL,ALPHA,BETA,RELEASE_CANDIDATE,DEVEL
|
||||||
DEFINES += VERSION_TYPE=ALPHA
|
DEFINES += VERSION_TYPE=ALPHA
|
||||||
|
|
||||||
@ -117,11 +127,33 @@ DEFINES += QT_USE_FAST_CONCATENATION QT_USE_FAST_OPERATOR_PLUS
|
|||||||
# usually built as static
|
# usually built as static
|
||||||
# win32:LIBS += -ltorrent -lboost_system
|
# win32:LIBS += -ltorrent -lboost_system
|
||||||
# win32:LIBS += -lz ?
|
# win32:LIBS += -lz ?
|
||||||
win32:LIBS += -lssl32 \
|
win32 {
|
||||||
-lws2_32 \
|
LIBS += -lssl \
|
||||||
-lwsock32 \
|
-lws2_32 \
|
||||||
-ladvapi32 \
|
-lwsock32 \
|
||||||
-lwinmm
|
-ladvapi32 \
|
||||||
|
-lwinmm
|
||||||
|
|
||||||
|
# Adapt these paths on Windows
|
||||||
|
LIBS += C:/boost_1_42_0/lib/libboost_filesystem-mgw44-mt.lib \
|
||||||
|
C:/boost_1_42_0/lib/libboost_program_options-mgw44-mt.lib \
|
||||||
|
C:/boost_1_42_0/lib/libboost_system-mgw44-mt.lib \
|
||||||
|
C:/boost_1_42_0/lib/libboost_thread-mgw44-mt.lib \
|
||||||
|
C:/Qt/2010.02.1/mingw/lib/*.a \
|
||||||
|
C:/Qt/2010.02.1/mingw/lib/libboost_thread.lib \
|
||||||
|
C:/Qt/2010.02.1/mingw/lib/libssl.a \
|
||||||
|
C:/Qt/2010.02.1/mingw/lib/libcrypto.a \
|
||||||
|
C:/Qt/2010.02.1/mingw/lib/libssl.dll.a \
|
||||||
|
C:/Qt/2010.02.1/mingw/lib/libcrypto.dll.a \
|
||||||
|
C:/Qt/2010.02.1/mingw/lib/libws2_32.a \
|
||||||
|
C:/Qt/2010.02.1/mingw/lib/libwsock32.a \
|
||||||
|
C:/Qt/2010.02.1/mingw/lib/libadvapi32.a \
|
||||||
|
C:/Qt/2010.02.1/mingw/lib/libwinmm.a \
|
||||||
|
C:/Qt/2010.02.1/mingw/lib/libgdi32.a \
|
||||||
|
-LC:/Qt/2010.02.1/mingw/lib/
|
||||||
|
|
||||||
|
LIBS += -ltorrent-rasterbar
|
||||||
|
}
|
||||||
|
|
||||||
os2:LIBS += -ltorrent-rasterbar \
|
os2:LIBS += -ltorrent-rasterbar \
|
||||||
-lcurl \
|
-lcurl \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user