diff --git a/src/GUI.cpp b/src/GUI.cpp index 90811f1e4..8a9b06cd4 100644 --- a/src/GUI.cpp +++ b/src/GUI.cpp @@ -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 diff --git a/src/filesystemwatcher.h b/src/filesystemwatcher.h index 217777d65..f8a84af30 100644 --- a/src/filesystemwatcher.h +++ b/src/filesystemwatcher.h @@ -2,10 +2,10 @@ #define FILESYSTEMWATCHER_H #include +#include #ifndef Q_WS_WIN #include -#include #include #include #include @@ -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: diff --git a/src/main.cpp b/src/main.cpp index 50ac3c67b..6b82fc592 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -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 diff --git a/src/misc.cpp b/src/misc.cpp index ac518b893..0833caabb 100644 --- a/src/misc.cpp +++ b/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; } diff --git a/src/proplistdelegate.h b/src/proplistdelegate.h index cc53a186d..6d419dbc0 100644 --- a/src/proplistdelegate.h +++ b/src/proplistdelegate.h @@ -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; diff --git a/src/src.pro b/src/src.pro index e6c54f0cc..c7677fff9 100644 --- a/src/src.pro +++ b/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 \