mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-29 16:04:21 +00:00
Better fix for --no-splash argument
This commit is contained in:
parent
965f7f5d26
commit
bcd81c0791
18
src/main.cpp
18
src/main.cpp
@ -316,17 +316,17 @@ int main(int argc, char *argv[]) {
|
|||||||
signal(SIGSEGV, sigsegvHandler);
|
signal(SIGSEGV, sigsegvHandler);
|
||||||
#endif
|
#endif
|
||||||
// Read torrents given on command line
|
// Read torrents given on command line
|
||||||
QStringList torrentCmdLine = app.arguments();
|
QStringList torrents;
|
||||||
// Remove first argument (program name)
|
QStringList appArguments = app.arguments();
|
||||||
torrentCmdLine.removeFirst();
|
for (int i = 1; i < appArguments.size(); ++i) {
|
||||||
#ifndef QT_NO_DEBUG_OUTPUT
|
if (!appArguments[i].startsWith("--")) {
|
||||||
foreach (const QString &argument, torrentCmdLine) {
|
qDebug() << "Command line argument:" << appArguments[i];
|
||||||
qDebug() << "Command line argument:" << argument;
|
torrents << appArguments[i];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef DISABLE_GUI
|
#ifndef DISABLE_GUI
|
||||||
MainWindow window(0, torrentCmdLine);
|
MainWindow window(0, torrents);
|
||||||
QObject::connect(&app, SIGNAL(messageReceived(const QString&)),
|
QObject::connect(&app, SIGNAL(messageReceived(const QString&)),
|
||||||
&window, SLOT(processParams(const QString&)));
|
&window, SLOT(processParams(const QString&)));
|
||||||
app.setActivationWindow(&window);
|
app.setActivationWindow(&window);
|
||||||
@ -335,7 +335,7 @@ int main(int argc, char *argv[]) {
|
|||||||
#endif // Q_WS_MAC
|
#endif // Q_WS_MAC
|
||||||
#else
|
#else
|
||||||
// Load Headless class
|
// Load Headless class
|
||||||
HeadlessLoader loader(torrentCmdLine);
|
HeadlessLoader loader(torrents);
|
||||||
QObject::connect(&app, SIGNAL(messageReceived(const QString&)),
|
QObject::connect(&app, SIGNAL(messageReceived(const QString&)),
|
||||||
&loader, SLOT(processParams(const QString&)));
|
&loader, SLOT(processParams(const QString&)));
|
||||||
#endif
|
#endif
|
||||||
|
@ -957,9 +957,6 @@ void MainWindow::processParams(const QStringList& params) {
|
|||||||
const bool useTorrentAdditionDialog = pref.useAdditionDialog();
|
const bool useTorrentAdditionDialog = pref.useAdditionDialog();
|
||||||
foreach (QString param, params) {
|
foreach (QString param, params) {
|
||||||
param = param.trimmed();
|
param = param.trimmed();
|
||||||
if (param.startsWith("--"))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if (misc::isUrl(param)) {
|
if (misc::isUrl(param)) {
|
||||||
QBtSession::instance()->downloadFromUrl(param);
|
QBtSession::instance()->downloadFromUrl(param);
|
||||||
}else{
|
}else{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user