mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-28 05:27:15 +03:00
Windows compilation fixes (Thanks LiHuiShuo)
This commit is contained in:
parent
e16ca862f4
commit
5675c045ae
6 changed files with 52 additions and 16 deletions
|
@ -170,8 +170,8 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
|
|||
#ifdef Q_WS_WIN
|
||||
char buffer[UNLEN+1] = {0};
|
||||
DWORD buffer_len = UNLEN + 1;
|
||||
if (!GetUserName(buffer, &buffer_len))
|
||||
uid = QString(buffer)
|
||||
if (!GetUserNameA(buffer, &buffer_len))
|
||||
uid = QString(buffer);
|
||||
#else
|
||||
uid = QString::number(getuid());
|
||||
#endif
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
#define FILESYSTEMWATCHER_H
|
||||
|
||||
#include <QFileSystemWatcher>
|
||||
#include <QDir>
|
||||
|
||||
#ifndef Q_WS_WIN
|
||||
#include <QTimer>
|
||||
#include <QDir>
|
||||
#include <QPointer>
|
||||
#include <QStringList>
|
||||
#include <QSet>
|
||||
|
@ -180,6 +180,7 @@ protected slots:
|
|||
}
|
||||
|
||||
void scanNetworkFolders() {
|
||||
#ifndef Q_WS_WIN
|
||||
qDebug("scanNetworkFolders() called");
|
||||
QStringList torrents;
|
||||
// Network folders scan
|
||||
|
@ -192,6 +193,7 @@ protected slots:
|
|||
qDebug("The following files are being reported: %s", qPrintable(torrents.join("\n")));
|
||||
emit torrentsAdded(torrents);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
signals:
|
||||
|
|
|
@ -180,8 +180,8 @@ int main(int argc, char *argv[]){
|
|||
#ifdef Q_WS_WIN
|
||||
char buffer[UNLEN+1] = {0};
|
||||
DWORD buffer_len = UNLEN + 1;
|
||||
if (!GetUserName(buffer, &buffer_len))
|
||||
uid = QString(buffer)
|
||||
if (!GetUserNameA(buffer, &buffer_len))
|
||||
uid = QString(buffer);
|
||||
#else
|
||||
uid = QString::number(getuid());
|
||||
#endif
|
||||
|
|
10
src/misc.cpp
10
src/misc.cpp
|
@ -64,6 +64,8 @@
|
|||
|
||||
QString misc::QDesktopServicesDataLocation() {
|
||||
#ifdef Q_WS_WIN
|
||||
LPWSTR path=new WCHAR[256];
|
||||
QString result;
|
||||
#if defined Q_WS_WINCE
|
||||
if (SHGetSpecialFolderPath(0, path, CSIDL_APPDATA, FALSE))
|
||||
#else
|
||||
|
@ -147,16 +149,16 @@ long long misc::freeDiskSpaceOnPath(QString path) {
|
|||
GetDiskFreeSpaceEx_t
|
||||
pGetDiskFreeSpaceEx = (GetDiskFreeSpaceEx_t)::GetProcAddress
|
||||
(
|
||||
::GetModuleHandle(_T("kernel32.dll")),
|
||||
::GetModuleHandle(TEXT("kernel32.dll")),
|
||||
"GetDiskFreeSpaceExW"
|
||||
);
|
||||
if ( pGetDiskFreeSpaceEx )
|
||||
{
|
||||
ULARGE_INTEGER bytesFree, bytesTotal;
|
||||
unsigned long long *ret;
|
||||
if (pGetDiskFreeSpaceEx((LPCTSTR)path.ucs2(), &bytesFree, &bytesTotal, NULL)) {
|
||||
tmp = (unsigned long long*)&bytesFree
|
||||
return ret;
|
||||
if (pGetDiskFreeSpaceEx((LPCTSTR)path.utf16(), &bytesFree, &bytesTotal, NULL)) {
|
||||
ret = (unsigned long long*)&bytesFree;
|
||||
return *ret;
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
#include "propertieswidget.h"
|
||||
|
||||
// Defines for properties list columns
|
||||
enum PropColumn {NAME, SIZE, PROGRESS, PRIORITY};
|
||||
enum PropColumn {NAME, PCSIZE, PROGRESS, PRIORITY};
|
||||
|
||||
class PropListDelegate: public QItemDelegate {
|
||||
Q_OBJECT
|
||||
|
@ -65,7 +65,7 @@ public:
|
|||
painter->save();
|
||||
QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option);
|
||||
switch(index.column()){
|
||||
case SIZE:
|
||||
case PCSIZE:
|
||||
QItemDelegate::drawBackground(painter, opt, index);
|
||||
QItemDelegate::drawDisplay(painter, opt, option.rect, misc::friendlyUnit(index.data().toLongLong()));
|
||||
break;
|
||||
|
|
42
src/src.pro
42
src/src.pro
|
@ -16,6 +16,16 @@ DEFINES += VERSION_MAJOR=2
|
|||
DEFINES += VERSION_MINOR=3
|
||||
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
|
||||
DEFINES += VERSION_TYPE=ALPHA
|
||||
|
||||
|
@ -117,11 +127,33 @@ DEFINES += QT_USE_FAST_CONCATENATION QT_USE_FAST_OPERATOR_PLUS
|
|||
# usually built as static
|
||||
# win32:LIBS += -ltorrent -lboost_system
|
||||
# win32:LIBS += -lz ?
|
||||
win32:LIBS += -lssl32 \
|
||||
-lws2_32 \
|
||||
-lwsock32 \
|
||||
-ladvapi32 \
|
||||
-lwinmm
|
||||
win32 {
|
||||
LIBS += -lssl \
|
||||
-lws2_32 \
|
||||
-lwsock32 \
|
||||
-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 \
|
||||
-lcurl \
|
||||
|
|
Loading…
Reference in a new issue