summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Neves2012-01-30 14:43:56 +0100
committerMichael Neves2012-01-30 14:43:56 +0100
commit6213133b3769b50d3abe5f4df2d42ae17264f99b (patch)
treecf2e0b1c4913c2b4348e3e05c04877e9b60f0790
parentssl options to fbgui (diff)
downloadfbgui-6213133b3769b50d3abe5f4df2d42ae17264f99b.tar.gz
fbgui-6213133b3769b50d3abe5f4df2d42ae17264f99b.tar.xz
fbgui-6213133b3769b50d3abe5f4df2d42ae17264f99b.zip
ssl option for fbgui
-rw-r--r--src/fbgui/fbgui.cpp4
-rw-r--r--src/fbgui/fbgui.h2
-rw-r--r--src/fbgui/main.cpp18
-rwxr-xr-xtestApp.sh16
4 files changed, 27 insertions, 13 deletions
diff --git a/src/fbgui/fbgui.cpp b/src/fbgui/fbgui.cpp
index 759c747..b37e018 100644
--- a/src/fbgui/fbgui.cpp
+++ b/src/fbgui/fbgui.cpp
@@ -26,6 +26,7 @@ int updateInterval = -1;
QString fileToTriggerURL("");
QString serialLocation("");
QString sessionID("");
+bool sslSupport;
int debugMode = -1;
//-------------------------------------------------------------------------------------------
@@ -54,6 +55,9 @@ void fbgui::init() {
// start fbgui
LOG4CXX_DEBUG(coreLogger, "Initializing fbgui...");
+ if(sslSupport)
+ LOG4CXX_DEBUG(coreLogger, "SSL enabled.");
+
_watcher = new QFileSystemWatcher(this);
setupLayout();
diff --git a/src/fbgui/fbgui.h b/src/fbgui/fbgui.h
index 4891194..3a62579 100644
--- a/src/fbgui/fbgui.h
+++ b/src/fbgui/fbgui.h
@@ -31,6 +31,7 @@
#define DEFAULT_UPDATE_INTERVAL 1;
#define DEFAULT_QRC_HTML_DIR ":/html"
#define DEFAULT_FILE_TRIGGER "/tmp/fbgui/trigger"
+#define DEFAULT_SSL_SUPPORT false;
// Global settings variables
extern QString logFilePath;
@@ -44,6 +45,7 @@ extern QString downloadPath;
extern QUrl baseURL;
extern int debugMode;
extern int updateInterval;
+extern bool sslSupport;
class fbgui: public QMainWindow
{
diff --git a/src/fbgui/main.cpp b/src/fbgui/main.cpp
index 6284054..9e29cbd 100644
--- a/src/fbgui/main.cpp
+++ b/src/fbgui/main.cpp
@@ -37,6 +37,8 @@ void printHelp() {
"Activate debug mode. [0,1]") << endl;
qout << "-h, --help " << QObject::tr(
"Prints this help.") << endl;
+ qout << "-x, --ssl " << QObject::tr(
+ "Enables SSL support.") << endl;
qout.flush();
exit( EXIT_SUCCESS);
}
@@ -80,7 +82,7 @@ int main(int argc, char *argv[]) {
// parse command line arguments using getopt
QMap<QString, QString> clOpts;
int longIndex = 0;
- static const char *optString = "c:u:d:s:t:D:hl:nS:p:e:";
+ static const char *optString = "c:u:d:s:t:D:hl:nS:p:e:x";
static const struct option longOpts[] = { { "config", required_argument,
NULL, 'c' }, { "url", required_argument, NULL, 'u' }, { "download",
required_argument, NULL, 'd' }, { "serial", required_argument, NULL,
@@ -90,7 +92,7 @@ int main(int argc, char *argv[]) {
{ "nd", no_argument, NULL, 'n' }, { "server", required_argument, NULL,
'S' }, { "autoup", no_argument, NULL, 'a' }, {
"socketserverpath", required_argument, NULL, 'p' }, {
- "pathtoexe", required_argument, NULL, 'e' } };
+ "pathtoexe", required_argument, NULL, 'e' }, { "ssl", no_argument, NULL, 'x' } };
int opt = getopt_long(argc, argv, optString, longOpts, &longIndex);
while (opt != -1) {
switch (opt) {
@@ -133,6 +135,9 @@ int main(int argc, char *argv[]) {
case 'e':
clOpts.insert("pathtoexe", optarg);
break;
+ case 'x':
+ clOpts.insert("ssl", "ssl");
+ break;
}
opt = getopt_long(argc, argv, optString, longOpts, &longIndex);
}
@@ -185,6 +190,14 @@ int main(int argc, char *argv[]) {
else
baseURL = DEFAULT_URL;
+ // set SSL support
+ if (clOpts.contains("ssl"))
+ sslSupport = true;
+ else if (confFileSettings.contains("default/ssl_support"))
+ sslSupport = confFileSettings.value("default/ssl_support").toBool();
+ else
+ sslSupport = DEFAULT_SSL_SUPPORT;
+
// set directory for downloads
if (clOpts.contains("downloadDir"))
downloadPath = clOpts.value("downloadDir");
@@ -281,6 +294,7 @@ int main(int argc, char *argv[]) {
LOG4CXX_DEBUG(logger, "downloadDir : " << downloadPath);
LOG4CXX_DEBUG(logger, "trigger: " << fileToTriggerURL);
LOG4CXX_DEBUG(logger, "serialLocation: " << serialLocation);
+ LOG4CXX_DEBUG(logger, "ssl: " << sslSupport);
if (clOpts.contains("nd") || confFileSettings.contains("default/nd")) {
LOG4CXX_DEBUG(logger, "*******************************************");
LOG4CXX_DEBUG(logger, "Network Discovery activated:");
diff --git a/testApp.sh b/testApp.sh
index 132208c..f33ab17 100755
--- a/testApp.sh
+++ b/testApp.sh
@@ -11,13 +11,10 @@
# -s <path>, --serial=<path> sets path to serial number file
#
# Note: all path are expected to be absolute.
-<<<<<<< HEAD
-QT_VERSION=Qt-4.8.0
-=======
-#
+
# Adapt these to your own system.
-QT_VERSION=Qt-4.7.2
-PATH_TO_FBGUI_BUILD=/home/joe/workspace/fbgui
+QT_VERSION=Qt-4.8.0
+PATH_TO_FBGUI_BUILD=/home/michael/workspace/fbgui
# check if network discovery is activated and if running as root
for ARG in $*
@@ -29,7 +26,6 @@ if [ "x$ARG" = "x-n" ]; then
fi
fi
done
->>>>>>> 2abf1cec73371fb4a97a078a47f521d23fbf0775
# clean /tmp/fbgui
[ -d /tmp/fbgui ] && rm -rf /tmp/fbgui
@@ -50,10 +46,8 @@ display_id=$(grep -n $(whoami) /etc/passwd| head -n 1|awk -F : '{print $1}')
# quick sleep to wait for qvfb loading
sleep 0.2
# Start fbgui connecting to QVFb with display_id from above.
-<<<<<<< HEAD
-$working_path/../workspace/fbgui/src/fbgui/fbgui -display QVFb:$display_id $@
-=======
+
$PATH_TO_FBGUI_BUILD/src/fbgui/fbgui -display QVFb:$display_id $@ -e $PATH_TO_FBGUI_BUILD/src/customdhcpcd/cdhcpcd
->>>>>>> 2abf1cec73371fb4a97a078a47f521d23fbf0775
+
# kill qvfb since fbgui stopped
killall qvfb