From c7ccf39abfc397bdd55570a29ebec4bbaea75731 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Tue, 15 Dec 2009 11:10:47 +0000 Subject: [PATCH] - Use QCoreApplication instead of QApplication when GUI is disabled --- src/main.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index a47398d10..4a3a2116b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -28,12 +28,12 @@ * Contact : chris@qbittorrent.org */ -#include #include #include #include #ifndef DISABLE_GUI + #include #include #include #include "qgnomelook.h" @@ -48,6 +48,7 @@ #include "GUI.h" #include "ico.h" #else + #include #include "headlessloader.h" #endif @@ -64,7 +65,11 @@ #include #include "misc.h" -QApplication *app; +#ifdef DISABLE_GUI + QCoreApplication *app; +#else + QApplication *app; +#endif #ifndef Q_WS_WIN void sigtermHandler(int) { @@ -188,7 +193,11 @@ int main(int argc, char *argv[]){ localSocket.close(); return 0; } +#ifdef DISABLE_GUI + app = new QCoreApplication(argc, argv); +#else app = new QApplication(argc, argv); +#endif #ifndef DISABLE_GUI useStyle(app, settings.value("Preferences/General/Style", 0).toInt()); app->setStyleSheet("QStatusBar::item { border-width: 0; }");