diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/CommandLineOptions.cpp | 17 | ||||
| -rw-r--r-- | src/CommandLineOptions.h | 1 | ||||
| -rw-r--r-- | src/fbbrowser.cpp | 1 | ||||
| -rw-r--r-- | src/fbgui.cpp | 9 | ||||
| -rw-r--r-- | src/fbgui.h | 8 |
5 files changed, 12 insertions, 24 deletions
diff --git a/src/CommandLineOptions.cpp b/src/CommandLineOptions.cpp index fae5c29..06b00ae 100644 --- a/src/CommandLineOptions.cpp +++ b/src/CommandLineOptions.cpp @@ -10,17 +10,13 @@ CommandLineOptions::CommandLineOptions(int argc, char * const argv[]){ // Parse command line arguments. int longIndex = 0; - // Declare the short options as a char*, these have exactly one - followed by letter from optString. - // For example: ./fbbrowser -h - // Declare the long options in the const struct, these have two - followed by a string found in longOpts[]. - // Same as: ./fbbrowser --help - // Note: I included 'qwsdiplay' here to not have errors, when setting fbbrowser to be the server app aswell. - static const char *optString = "hqwsdiplay"; + // TODO: clean output... + static const char *optString = "uh"; static const struct option longOpts[] = { // If an option requires parameters, write this number instead of no_argument. // The last argument, is the corresponding char to the option string. - {"debug", no_argument, NULL, 'D'}, + {"url", required_argument, NULL, 'u'}, {"help", no_argument, NULL, 'h'} }; // getopt_long returns the index of the next argument to be read, -1 if there are no more arguments. @@ -29,9 +25,12 @@ CommandLineOptions::CommandLineOptions(int argc, char * const argv[]){ { switch(opt) { - case 'h': - //printUsage(); + case 'u': + options.insert("url", optarg); break; + case 'h': + //printUsage(); + break; } opt = getopt_long(argc, argv, optString, longOpts, &longIndex); } diff --git a/src/CommandLineOptions.h b/src/CommandLineOptions.h index a8b15d4..e75a690 100644 --- a/src/CommandLineOptions.h +++ b/src/CommandLineOptions.h @@ -2,6 +2,7 @@ #define COMMANDLINEOPTIONS_H #include <QMap> +#include <QString> class CommandLineOptions { public: diff --git a/src/fbbrowser.cpp b/src/fbbrowser.cpp index 853030a..2b8bc7a 100644 --- a/src/fbbrowser.cpp +++ b/src/fbbrowser.cpp @@ -2,7 +2,6 @@ #include "JSObject.h" #include "DownloadManager.h" - #include <QFile> #include <QFileInfo> #include <QtWebKit> diff --git a/src/fbgui.cpp b/src/fbgui.cpp index 5552643..cc10f20 100644 --- a/src/fbgui.cpp +++ b/src/fbgui.cpp @@ -6,11 +6,6 @@ #include <QApplication> #include <QSettings> -//#include <getopt.h> -//#include <limits.h> -//#include <unistd.h> - - void printUsage() { // Prints usage information. @@ -27,11 +22,11 @@ void printUsage() int main(int argc, char *argv[]) { /* SETTINGS TEST */ - //CommandLineOptions clOptions(argc, argv); + CommandLineOptions clOptions(argc, argv); // TODO: parse url arg from CommmandLineOptions object. // hackfix for now... - QUrl url(argv[4]); + QUrl url = QUrl(argv[4]); QUrl defaultUrl = QUrl("http://132.230.4.3/webkitTest.html"); qDebug() << "URL given: " << url.toString(); diff --git a/src/fbgui.h b/src/fbgui.h index 4d387a6..281acd6 100644 --- a/src/fbgui.h +++ b/src/fbgui.h @@ -2,6 +2,7 @@ #define FBGUI_H #include <QtGui> +#include <QUrl> //QT_BEGIN_NAMESPACE @@ -15,13 +16,6 @@ public: fbgui(); ~fbgui(); void printUsage(); - -//private: - -//private slots: - -//signals: - }; #endif // FBGUI_H |
