mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-13 16:53:08 -07:00
- Added a command line parameter --no-splash to disable splash screen
This commit is contained in:
parent
3dd9ebc61d
commit
148d175ab0
2 changed files with 76 additions and 65 deletions
|
@ -956,6 +956,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
|
||||||
bool useTorrentAdditionDialog = settings.value(QString::fromUtf8("Preferences/Downloads/AdditionDialog"), true).toBool();
|
bool useTorrentAdditionDialog = settings.value(QString::fromUtf8("Preferences/Downloads/AdditionDialog"), true).toBool();
|
||||||
foreach(QString param, params) {
|
foreach(QString param, params) {
|
||||||
param = param.trimmed();
|
param = param.trimmed();
|
||||||
|
if(param.startsWith("--")) continue;
|
||||||
if(param.startsWith(QString::fromUtf8("http://"), Qt::CaseInsensitive) || param.startsWith(QString::fromUtf8("ftp://"), Qt::CaseInsensitive) || param.startsWith(QString::fromUtf8("https://"), Qt::CaseInsensitive)) {
|
if(param.startsWith(QString::fromUtf8("http://"), Qt::CaseInsensitive) || param.startsWith(QString::fromUtf8("ftp://"), Qt::CaseInsensitive) || param.startsWith(QString::fromUtf8("https://"), Qt::CaseInsensitive)) {
|
||||||
BTSession->downloadFromUrl(param);
|
BTSession->downloadFromUrl(param);
|
||||||
}else{
|
}else{
|
||||||
|
|
12
src/main.cpp
12
src/main.cpp
|
@ -116,6 +116,7 @@ void useStyle(QApplication *app, int style){
|
||||||
int main(int argc, char *argv[]){
|
int main(int argc, char *argv[]){
|
||||||
QFile file;
|
QFile file;
|
||||||
QString locale;
|
QString locale;
|
||||||
|
bool no_splash = false;
|
||||||
if(argc > 1){
|
if(argc > 1){
|
||||||
if(QString::fromUtf8(argv[1]) == QString::fromUtf8("--version")){
|
if(QString::fromUtf8(argv[1]) == QString::fromUtf8("--version")){
|
||||||
std::cout << "qBittorrent " << VERSION << '\n';
|
std::cout << "qBittorrent " << VERSION << '\n';
|
||||||
|
@ -124,10 +125,14 @@ int main(int argc, char *argv[]){
|
||||||
if(QString::fromUtf8(argv[1]) == QString::fromUtf8("--help")){
|
if(QString::fromUtf8(argv[1]) == QString::fromUtf8("--help")){
|
||||||
std::cout << "Usage: \n";
|
std::cout << "Usage: \n";
|
||||||
std::cout << '\t' << argv[0] << " --version : displays program version\n";
|
std::cout << '\t' << argv[0] << " --version : displays program version\n";
|
||||||
|
std::cout << '\t' << argv[0] << " --no-splash : disable splash screen\n";
|
||||||
std::cout << '\t' << argv[0] << " --help : displays this help message\n";
|
std::cout << '\t' << argv[0] << " --help : displays this help message\n";
|
||||||
std::cout << '\t' << argv[0] << " [files or urls] : starts program and download given parameters (optional)\n";
|
std::cout << '\t' << argv[0] << " [files or urls] : starts program and download given parameters (optional)\n";
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
if(QString::fromUtf8(argv[1]) == QString::fromUtf8("--no-splash")){
|
||||||
|
no_splash = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Set environment variable
|
// Set environment variable
|
||||||
if(putenv((char*)"QBITTORRENT="VERSION)) {
|
if(putenv((char*)"QBITTORRENT="VERSION)) {
|
||||||
|
@ -182,8 +187,11 @@ int main(int argc, char *argv[]){
|
||||||
app = new QApplication(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/skin/splash.png")));
|
QSplashScreen *splash;
|
||||||
|
if(!no_splash) {
|
||||||
|
splash = new QSplashScreen(QPixmap(QString::fromUtf8(":/Icons/skin/splash.png")));
|
||||||
splash->show();
|
splash->show();
|
||||||
|
}
|
||||||
// Open options file to read locale
|
// Open options file to read locale
|
||||||
locale = settings.value(QString::fromUtf8("Preferences/General/Locale"), QString()).toString();
|
locale = settings.value(QString::fromUtf8("Preferences/General/Locale"), QString()).toString();
|
||||||
QTranslator translator;
|
QTranslator translator;
|
||||||
|
@ -208,8 +216,10 @@ int main(int argc, char *argv[]){
|
||||||
// Remove first argument (program name)
|
// Remove first argument (program name)
|
||||||
torrentCmdLine.removeFirst();
|
torrentCmdLine.removeFirst();
|
||||||
GUI *window = new GUI(0, torrentCmdLine);
|
GUI *window = new GUI(0, torrentCmdLine);
|
||||||
|
if(!no_splash) {
|
||||||
splash->finish(window);
|
splash->finish(window);
|
||||||
delete splash;
|
delete splash;
|
||||||
|
}
|
||||||
int ret = app->exec();
|
int ret = app->exec();
|
||||||
delete window;
|
delete window;
|
||||||
delete app;
|
delete app;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue