summaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp39
1 files changed, 15 insertions, 24 deletions
diff --git a/src/main.cpp b/src/main.cpp
index a319ae4..f3d4201 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -11,20 +11,16 @@ void printHelp() {
QTextStream qout(stdout);
qout << QObject::tr("Usage: ./fbgui [OPTIONS]") << endl;
qout << QObject::tr("Options:") << endl;
- qout << "-c <path>, --config=<path> " << QObject::tr(
- "Path to configuration file.") << endl;
- qout << "-u <URL>, --url=<URL> " << QObject::tr(
- "Sets the URL to be loaded.") << endl;
- qout << "-d <path>, --download=<path> " << QObject::tr(
- "Specify the download directory.") << endl;
+ qout << "-c <path>, --config=<path> " << QObject::tr("Path to configuration file.") << endl;
+ qout << "-u <URL>, --url=<URL> " << QObject::tr("Sets the URL to be loaded.") << endl;
+ qout << "-d <path>, --download=<path> " << QObject::tr("Specify the download directory.")
+ << endl;
qout << "-t <path, --trigger=<path> " << QObject::tr(
"Specify location of the file triggering the URL load.") << endl;
qout << "-s <path, --serial=<path> " << QObject::tr(
"Specify location of the file containing the serial number.") << endl;
- qout << "-D <level>, --debug=<level> " << QObject::tr(
- "Activate debug mode. [0,1]") << endl;
- qout << "-h, --help " << QObject::tr(
- "Prints this help.") << endl;
+ qout << "-D <level>, --debug=<level> " << QObject::tr("Activate debug mode. [0,1]") << endl;
+ qout << "-h, --help " << QObject::tr("Prints this help.") << endl;
qout.flush();
exit( EXIT_SUCCESS);
}
@@ -50,12 +46,11 @@ int main(int argc, char *argv[]) {
QMap<QString, QString> clOpts;
int longIndex = 0;
static const char *optString = "c:u:d:s:t:D:hl:";
- static const struct option longOpts[] = { { "config", required_argument,
- NULL, 'c' }, { "url", required_argument, NULL, 'u' }, { "download",
- required_argument, NULL, 'd' }, { "serial", required_argument, NULL,
- 's' }, { "trigger", required_argument, NULL, 't' }, { "debug",
- required_argument, NULL, 'D' }, { "help", no_argument, NULL, 'h' }, {
- "log", required_argument, NULL, 'l' } };
+ static const struct option longOpts[] = { { "config", required_argument, NULL, 'c' }, { "url",
+ required_argument, NULL, 'u' }, { "download", required_argument, NULL, 'd' }, { "serial",
+ required_argument, NULL, 's' }, { "trigger", required_argument, NULL, 't' }, { "debug",
+ required_argument, NULL, 'D' }, { "help", no_argument, NULL, 'h' }, { "log",
+ required_argument, NULL, 'l' } };
int opt = getopt_long(argc, argv, optString, longOpts, &longIndex);
while (opt != -1) {
switch (opt) {
@@ -139,15 +134,13 @@ int main(int argc, char *argv[]) {
if (clOpts.contains("downloadDir"))
downloadPath = clOpts.value("downloadDir");
else if (confFileSettings.contains("default/download_directory"))
- downloadPath
- = confFileSettings.value("default/download_directory").toString();
+ downloadPath = confFileSettings.value("default/download_directory").toString();
else
downloadPath = DEFAULT_DOWNLOAD_DIR;
// set update interval for download progress functions of download manager.
if (confFileSettings.contains("default/update_interval"))
- updateInterval
- = confFileSettings.value("default/update_interval").toInt();
+ updateInterval = confFileSettings.value("default/update_interval").toInt();
else
updateInterval = DEFAULT_UPDATE_INTERVAL;
@@ -155,8 +148,7 @@ int main(int argc, char *argv[]) {
if (clOpts.contains("trigger"))
fileToTriggerURL = clOpts.value("trigger");
else if (confFileSettings.contains("default/file_trigger"))
- fileToTriggerURL
- = confFileSettings.value("default/file_trigger").toString();
+ fileToTriggerURL = confFileSettings.value("default/file_trigger").toString();
else
fileToTriggerURL = DEFAULT_FILE_TRIGGER;
@@ -164,8 +156,7 @@ int main(int argc, char *argv[]) {
if (clOpts.contains("serialLocation"))
serialLocation = clOpts.value("serialLocation");
else if (confFileSettings.contains("default/serial_location"))
- serialLocation
- = confFileSettings.value("default/serial_location").toString();
+ serialLocation = confFileSettings.value("default/serial_location").toString();
else
serialLocation = QString("/serial"); // tests