|
|
@ -43,12 +43,23 @@ |
|
|
|
#ifdef Q_WS_MAC |
|
|
|
#ifdef Q_WS_MAC |
|
|
|
#include <QMacStyle> |
|
|
|
#include <QMacStyle> |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
|
|
|
|
#ifndef Q_WS_WIN |
|
|
|
|
|
|
|
#include <signal.h> |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
#include <stdlib.h> |
|
|
|
#include <stdlib.h> |
|
|
|
#include "GUI.h" |
|
|
|
#include "GUI.h" |
|
|
|
#include "misc.h" |
|
|
|
#include "misc.h" |
|
|
|
#include "ico.h" |
|
|
|
#include "ico.h" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QApplication *app; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef Q_WS_WIN |
|
|
|
|
|
|
|
void sigtermHandler(int) { |
|
|
|
|
|
|
|
qDebug("Catching SIGTERM, exiting cleanly"); |
|
|
|
|
|
|
|
app->exit(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
void useStyle(QApplication *app, int style){ |
|
|
|
void useStyle(QApplication *app, int style){ |
|
|
|
switch(style) { |
|
|
|
switch(style) { |
|
|
@ -144,9 +155,9 @@ int main(int argc, char *argv[]){ |
|
|
|
#ifndef QT_4_4 |
|
|
|
#ifndef QT_4_4 |
|
|
|
} |
|
|
|
} |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
QApplication app(argc, argv); |
|
|
|
app = new QApplication(argc, argv); |
|
|
|
useStyle(&app, settings.value("Preferences/General/Style", 0).toInt()); |
|
|
|
useStyle(app, settings.value("Preferences/General/Style", 0).toInt()); |
|
|
|
app.setStyleSheet("QStatusBar::item { border-width: 0; }"); |
|
|
|
app->setStyleSheet("QStatusBar::item { border-width: 0; }"); |
|
|
|
QSplashScreen *splash = new QSplashScreen(QPixmap(QString::fromUtf8(":/Icons/splash.png"))); |
|
|
|
QSplashScreen *splash = new QSplashScreen(QPixmap(QString::fromUtf8(":/Icons/splash.png"))); |
|
|
|
splash->show(); |
|
|
|
splash->show(); |
|
|
|
// Open options file to read locale
|
|
|
|
// Open options file to read locale
|
|
|
@ -161,17 +172,20 @@ int main(int argc, char *argv[]){ |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
qDebug("%s locale unrecognized, using default (en_GB).", (const char*)locale.toUtf8()); |
|
|
|
qDebug("%s locale unrecognized, using default (en_GB).", (const char*)locale.toUtf8()); |
|
|
|
} |
|
|
|
} |
|
|
|
app.installTranslator(&translator); |
|
|
|
app->installTranslator(&translator); |
|
|
|
app.setApplicationName(QString::fromUtf8("qBittorrent")); |
|
|
|
app->setApplicationName(QString::fromUtf8("qBittorrent")); |
|
|
|
app.setQuitOnLastWindowClosed(false); |
|
|
|
app->setQuitOnLastWindowClosed(false); |
|
|
|
// Read torrents given on command line
|
|
|
|
// Read torrents given on command line
|
|
|
|
QStringList torrentCmdLine = app.arguments(); |
|
|
|
QStringList torrentCmdLine = app->arguments(); |
|
|
|
// Remove first argument (program name)
|
|
|
|
// Remove first argument (program name)
|
|
|
|
torrentCmdLine.removeFirst(); |
|
|
|
torrentCmdLine.removeFirst(); |
|
|
|
GUI window(0, torrentCmdLine); |
|
|
|
GUI window(0, torrentCmdLine); |
|
|
|
splash->finish(&window); |
|
|
|
splash->finish(&window); |
|
|
|
delete splash; |
|
|
|
delete splash; |
|
|
|
return app.exec(); |
|
|
|
#ifndef Q_WS_WIN |
|
|
|
|
|
|
|
signal(SIGTERM, sigtermHandler); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
return app->exec(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|