mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-21 05:43:32 -07:00
Touch up previous commit.
This commit is contained in:
parent
afdc1ee93e
commit
8bfd333c60
1 changed files with 11 additions and 12 deletions
23
src/main.cpp
23
src/main.cpp
|
@ -101,7 +101,7 @@ void sigsegvHandler(int);
|
||||||
void sigabrtHandler(int);
|
void sigabrtHandler(int);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct QbtCommandLineParameters
|
struct QBtCommandLineParameters
|
||||||
{
|
{
|
||||||
bool showHelp;
|
bool showHelp;
|
||||||
#ifndef Q_OS_WIN
|
#ifndef Q_OS_WIN
|
||||||
|
@ -115,7 +115,7 @@ struct QbtCommandLineParameters
|
||||||
int webUiPort;
|
int webUiPort;
|
||||||
QStringList torrents;
|
QStringList torrents;
|
||||||
|
|
||||||
QbtCommandLineParameters()
|
QBtCommandLineParameters()
|
||||||
: showHelp(false)
|
: showHelp(false)
|
||||||
#ifndef Q_OS_WIN
|
#ifndef Q_OS_WIN
|
||||||
, showVersion(false)
|
, showVersion(false)
|
||||||
|
@ -130,15 +130,14 @@ struct QbtCommandLineParameters
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
QbtCommandLineParameters parseCommandLine();
|
|
||||||
|
|
||||||
#ifndef DISABLE_GUI
|
#ifndef DISABLE_GUI
|
||||||
void showSplashScreen();
|
void showSplashScreen();
|
||||||
#endif
|
#endif
|
||||||
void displayVersion();
|
void displayVersion();
|
||||||
void displayUsage(QString prg_name = QLatin1String("qbittorrent"));
|
void displayUsage(const QString &prg_name);
|
||||||
bool userAgreesWithLegalNotice();
|
bool userAgreesWithLegalNotice();
|
||||||
void displayBadArgMessage(QString message);
|
void displayBadArgMessage(const QString &message);
|
||||||
|
QBtCommandLineParameters parseCommandLine();
|
||||||
|
|
||||||
// Main
|
// Main
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
|
@ -153,7 +152,7 @@ int main(int argc, char *argv[])
|
||||||
QObject::connect(app.data(), SIGNAL(messageReceived(const QString &)),
|
QObject::connect(app.data(), SIGNAL(messageReceived(const QString &)),
|
||||||
messagesCollector, SLOT(collectMessage(const QString &)));
|
messagesCollector, SLOT(collectMessage(const QString &)));
|
||||||
|
|
||||||
const QbtCommandLineParameters params = parseCommandLine();
|
const QBtCommandLineParameters params = parseCommandLine();
|
||||||
|
|
||||||
#ifndef Q_OS_WIN
|
#ifndef Q_OS_WIN
|
||||||
if (params.showVersion) {
|
if (params.showVersion) {
|
||||||
|
@ -285,9 +284,9 @@ int main(int argc, char *argv[])
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
QbtCommandLineParameters parseCommandLine()
|
QBtCommandLineParameters parseCommandLine()
|
||||||
{
|
{
|
||||||
QbtCommandLineParameters result;
|
QBtCommandLineParameters result;
|
||||||
QStringList appArguments = qApp->arguments();
|
QStringList appArguments = qApp->arguments();
|
||||||
|
|
||||||
for (int i = 1; i < appArguments.size(); ++i) {
|
for (int i = 1; i < appArguments.size(); ++i) {
|
||||||
|
@ -404,7 +403,7 @@ void displayVersion()
|
||||||
std::cout << qPrintable(qApp->applicationName()) << " " << VERSION << std::endl;
|
std::cout << qPrintable(qApp->applicationName()) << " " << VERSION << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString makeUsage(QString prg_name)
|
QString makeUsage(const QString &prg_name)
|
||||||
{
|
{
|
||||||
QString text;
|
QString text;
|
||||||
|
|
||||||
|
@ -439,7 +438,7 @@ QString makeUsage(QString prg_name)
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
void displayUsage(QString prg_name)
|
void displayUsage(const QString& prg_name)
|
||||||
{
|
{
|
||||||
#ifndef Q_OS_WIN
|
#ifndef Q_OS_WIN
|
||||||
std::cout << qPrintable(makeUsage(prg_name)) << std::endl;
|
std::cout << qPrintable(makeUsage(prg_name)) << std::endl;
|
||||||
|
@ -451,7 +450,7 @@ void displayUsage(QString prg_name)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void displayBadArgMessage(QString message)
|
void displayBadArgMessage(const QString& message)
|
||||||
{
|
{
|
||||||
QString help = QObject::tr("Run application with -h option to read about command line parameters.");
|
QString help = QObject::tr("Run application with -h option to read about command line parameters.");
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue