From 96b2528849d676ff0094dc06182031ac4506b937 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Wed, 16 Mar 2011 01:43:47 +0100 Subject: misc --- src/main.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/main.cpp') diff --git a/src/main.cpp b/src/main.cpp index 8f2b6a5..3138838 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -8,7 +8,6 @@ void printHelp() { - // Prints usage information. QTextStream qout(stdout); qout << QObject::tr("Usage: ./fbgui [OPTIONS]") << endl; qout << QObject::tr("Options:") << endl; @@ -28,12 +27,11 @@ int main(int argc, char *argv[]) app.setObjectName("test"); binPath = QApplication::applicationDirPath(); - // Translator, for later (maybe). QTranslator translator; translator.load(":" + QLocale::system().name()); app.installTranslator(&translator); - /* Parse cmdline argus. */ + /* parse command line arguments */ QMap clOpts; int longIndex = 0; static const char *optString = "u:d:c:Dh"; @@ -67,14 +65,15 @@ int main(int argc, char *argv[]) } opt = getopt_long(argc, argv, optString, longOpts, &longIndex); } - // Print help + if (clOpts.contains("help")) - printHelp(); - // Debug mode + printHelp(); + if (clOpts.contains("debug")){ debug = true; qDebug() << "Debug mode activated."; } + /* "search" config file */ QString configFilePath; QFileInfo confInfo; if (clOpts.contains("configFile")) @@ -94,7 +93,7 @@ int main(int argc, char *argv[]) } if (debug) qDebug() << "Config file is: " << configFilePath; - // Read the config file, for now hardcoded expected name. + /* read the config file */ QSettings confFileSettings(configFilePath, QSettings::IniFormat); confFileSettings.setIniCodec("UTF-8"); @@ -112,7 +111,7 @@ int main(int argc, char *argv[]) } if (debug) qDebug() << "Base URL: " << baseURL.toString(); - // Setting target downloads directory. + /* setting directory for downloads*/ if (clOpts.contains("downloadDir")){ downloadPath = clOpts.value("downloadDir"); if (debug) qDebug() << "Download directory loaded from cmdline."; @@ -123,7 +122,7 @@ int main(int argc, char *argv[]) } else { - downloadPath = DEFAULT_DOWNLOAD_DIR; // Default download dir. + downloadPath = DEFAULT_DOWNLOAD_DIR; if (debug) qDebug() << "Download directory set by default."; } if (debug) qDebug() << "Download directory: " << downloadPath; @@ -132,6 +131,7 @@ int main(int argc, char *argv[]) updateInterval = confFileSettings.value("default/updateInterval").toInt(); if (debug) qDebug() << "Read updateInterval from confFile: " << updateInterval; } + else updateInterval = DEFAULT_UPDATE_INTERVAL; fbgui gui; return app.exec(); -- cgit v1.2.3-55-g7522