Windows execution fixes (it runs now!)

This commit is contained in:
Christophe Dumez
2010-05-30 11:36:56 +00:00
parent ec15e8247d
commit 11f79432b5
3 changed files with 32 additions and 27 deletions

View File

@@ -168,6 +168,13 @@ void useStyle(QApplication *app, QString style){
// Main // Main
int main(int argc, char *argv[]){ int main(int argc, char *argv[]){
// Create Application
#ifdef DISABLE_GUI
app = new QCoreApplication(argc, argv);
#else
app = new QApplication(argc, argv);
#endif
QString locale; QString locale;
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
#ifndef DISABLE_GUI #ifndef DISABLE_GUI
@@ -208,16 +215,10 @@ int main(int argc, char *argv[]){
std::cout << "disconnected\n"; std::cout << "disconnected\n";
} }
localSocket.close(); localSocket.close();
delete app;
return 0; return 0;
} }
// Create Application
#ifdef DISABLE_GUI
app = new QCoreApplication(argc, argv);
#else
app = new QApplication(argc, argv);
#endif
// Load translation // Load translation
locale = settings.value(QString::fromUtf8("Preferences/General/Locale"), QString()).toString(); locale = settings.value(QString::fromUtf8("Preferences/General/Locale"), QString()).toString();
QTranslator translator; QTranslator translator;
@@ -341,7 +342,10 @@ int main(int argc, char *argv[]){
delete loader; delete loader;
#endif #endif
qDebug("Deleting app..."); qDebug("Deleting app...");
#ifndef Q_WS_WIN
// XXX: Why does it crash on Windows!?
delete app; delete app;
#endif
qDebug("App was deleted! All good."); qDebug("App was deleted! All good.");
return ret; return ret;
} }

View File

@@ -74,6 +74,7 @@ QString misc::QDesktopServicesDataLocation() {
result = QString::fromWCharArray(path); result = QString::fromWCharArray(path);
if (!QCoreApplication::applicationName().isEmpty()) if (!QCoreApplication::applicationName().isEmpty())
result = result + QLatin1String("\\") + qApp->applicationName(); result = result + QLatin1String("\\") + qApp->applicationName();
return result;
#else #else
#ifdef Q_WS_MAC #ifdef Q_WS_MAC
// http://developer.apple.com/documentation/Carbon/Reference/Folder_Manager/Reference/reference.html // http://developer.apple.com/documentation/Carbon/Reference/Folder_Manager/Reference/reference.html
@@ -300,7 +301,7 @@ QString misc::BTBackupLocation() {
} }
QString misc::cacheLocation() { QString misc::cacheLocation() {
const QString &location = QDir::cleanPath(QDesktopServicesCacheLocation()); QString location = QDir::cleanPath(QDesktopServicesCacheLocation());
QDir locationDir(location); QDir locationDir(location);
if(!locationDir.exists()) if(!locationDir.exists())
locationDir.mkpath(locationDir.absolutePath()); locationDir.mkpath(locationDir.absolutePath());

View File

@@ -3,7 +3,7 @@ LANG_PATH = lang
ICONS_PATH = Icons ICONS_PATH = Icons
# Set the following variable to 1 to enable debug # Set the following variable to 1 to enable debug
DEBUG_MODE = 0 DEBUG_MODE = 1
# Global # Global
TEMPLATE = app TEMPLATE = app
@@ -22,7 +22,7 @@ DEFINES += VERSION_BUGFIX=8
win32 { win32 {
# Adapt these paths on Windows # Adapt these paths on Windows
INCLUDEPATH += $$quote(C:/qbittorrent/boost_1_40_0) INCLUDEPATH += $$quote(C:/qbittorrent/boost_1_42_0)
INCLUDEPATH += $$quote(C:/qbittorrent/libtorrent-rasterbar-0.14.10/include) INCLUDEPATH += $$quote(C:/qbittorrent/libtorrent-rasterbar-0.14.10/include)
INCLUDEPATH += $$quote(C:/qbittorrent/libtorrent-rasterbar-0.14.10/zlib) INCLUDEPATH += $$quote(C:/qbittorrent/libtorrent-rasterbar-0.14.10/zlib)
@@ -133,27 +133,27 @@ DEFINES += QT_USE_FAST_CONCATENATION QT_USE_FAST_OPERATOR_PLUS
# win32:LIBS += -ltorrent -lboost_system # win32:LIBS += -ltorrent -lboost_system
# win32:LIBS += -lz ? # win32:LIBS += -lz ?
win32 { win32 {
LIBS += -lssleay32 \
-leay32 \
-lws2_32 \
-lwsock32 \
-ladvapi32 \
-lwinmm
# Adapt these paths on Windows # Adapt these paths on Windows
LIBS += C:/qbittorrent/libs/libtorrent.lib \ LIBS += C:/qbittorrent/libs/libtorrent.lib \
C:/qbittorrent/libs/libboost_system.lib \ C:/qbittorrent/libs/libboost_system-mgw44-mt-s.lib \
C:/qbittorrent/libs/libboost_filesystem.lib \ C:/qbittorrent/libs/libboost_filesystem-mgw44-mt-s.lib \
C:/qbittorrent/libs/libboost_thread.lib \ C:/qbittorrent/libs/libboost_thread-mgw44-mt-s.lib \
C:/Qt/2010.02.1/mingw/lib/*.a \ C:/OpenSSL/lib/MinGW/ssleay32.a \
C:/Qt/2010.02.1/mingw/lib/libssleay32.a \ C:/OpenSSL/lib/MinGW/libeay32.a \
C:/Qt/2010.02.1/mingw/lib/libeay32.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/libwsock32.a \
C:/Qt/2010.02.1/mingw/lib/libadvapi32.a \ C:/Qt/2010.02.1/mingw/lib/libws2_32.a #\
C:/Qt/2010.02.1/mingw/lib/libwinmm.a \ # -LC:/Qt/2010.02.1/mingw/lib/
C:/Qt/2010.02.1/mingw/lib/libgdi32.a \ # C:/Qt/2010.02.1/mingw/lib/libadvapi32.a \
-LC:/Qt/2010.02.1/mingw/lib/ # C:/Qt/2010.02.1/mingw/lib/libwinmm.a \
# C:/Qt/2010.02.1/mingw/lib/libgdi32.a \
# LIBS += -lssleay32 \
# -leay32 \
# -lws2_32 \
# -lwsock32 \
# -ladvapi32 \
# -lwinmm
} }
os2:LIBS += -ltorrent-rasterbar \ os2:LIBS += -ltorrent-rasterbar \