Starts the server; make slight changes in server code
so that it understands qt's resource system (qrc)
we can use that to manage the html related files
(would be stored in app bundle for mac osx, and in
perhaps /usr/local/share for Linux by qt)
Change-Id: I8cc9e7bd99000d287bac5e6c8bd86008924351c6
diff --git a/gui/chronosharegui.cpp b/gui/chronosharegui.cpp
index 04bff02..038f05a 100644
--- a/gui/chronosharegui.cpp
+++ b/gui/chronosharegui.cpp
@@ -34,12 +34,18 @@
 using namespace boost;
 using namespace Ccnx;
 
+static const string HTTP_SERVER_ADDRESS = "localhost";
+static const string HTTP_SERVER_PORT = "9001";
+static const string DOC_ROOT = ":/html";
+static const QString ICON_PICTURE_QSTRING(":/images/friends-group-icon.png");
+
 INIT_LOGGER ("Gui");
 
 ChronoShareGui::ChronoShareGui(QWidget *parent)
   : QDialog(parent)
   , m_watcher(0)
   , m_dispatcher(0)
+  , m_httpServer(0)
 #ifdef ADHOC_SUPPORTED
   , m_executor (1)
 #endif
@@ -132,6 +138,17 @@
   m_watcher = new FsWatcher (m_dirPath,
                              bind (&Dispatcher::Did_LocalFile_AddOrModify, m_dispatcher, _1),
                              bind (&Dispatcher::Did_LocalFile_Delete,      m_dispatcher, _1));
+  QFileInfo indexHtmlInfo(":/html/index.html");
+  if (indexHtmlInfo.exists())
+  {
+    m_httpServer = new http::server::server(HTTP_SERVER_ADDRESS, HTTP_SERVER_PORT, DOC_ROOT);
+    m_httpServerThread = boost::thread(&http::server::server::run, m_httpServer);
+  }
+  else
+  {
+    _LOG_ERROR ("Http server doc root dir does not exist!");
+    // shall we bail here?
+  }
 }
 
 ChronoShareGui::~ChronoShareGui()
@@ -142,6 +159,7 @@
 
   delete m_watcher; // stop filewatching ASAP
   delete m_dispatcher; // stop dispatcher ASAP, but after watcher (to prevent triggering callbacks on deleted object)
+  delete m_httpServer;
 
   // cleanup
   delete m_trayIcon;
@@ -169,7 +187,7 @@
   messageBox.setWindowTitle(title);
   messageBox.setText(text);
 
-  messageBox.setIconPixmap(QPixmap(":/images/friends-group-icon.png"));
+  messageBox.setIconPixmap(QPixmap(ICON_PICTURE_QSTRING));
 
   messageBox.exec();
 }
@@ -181,7 +199,7 @@
   messageBox.setText(text);
   messageBox.setInformativeText(infotext);
 
-  messageBox.setIconPixmap(QPixmap(":/images/friends-group-icon.png"));
+  messageBox.setIconPixmap(QPixmap(ICON_PICTURE_QSTRING));
 
   messageBox.exec();
 }
@@ -284,7 +302,7 @@
 void ChronoShareGui::setIcon()
 {
   // set the icon image
-  m_trayIcon->setIcon(QIcon(":/images/friends-group-icon.png"));
+  m_trayIcon->setIcon(QIcon(ICON_PICTURE_QSTRING));
 }
 
 void ChronoShareGui::openSharedFolder()
diff --git a/gui/chronosharegui.h b/gui/chronosharegui.h
index eba4c12..3e9e0c3 100644
--- a/gui/chronosharegui.h
+++ b/gui/chronosharegui.h
@@ -40,6 +40,8 @@
 
 #include "fs-watcher.h"
 #include "dispatcher.h"
+#include "server.hpp"
+#include <boost/thread/thread.hpp>
 
 class ChronoShareGui : public QDialog
 {
@@ -118,6 +120,8 @@
 
   FsWatcher  *m_watcher;
   Dispatcher *m_dispatcher;
+  http::server::server *m_httpServer;
+  boost::thread m_httpServerThread;
 
   QLabel* labelUsername;
   QPushButton* button;
diff --git a/gui/html.qrc b/gui/html.qrc
new file mode 100644
index 0000000..29a8104
--- /dev/null
+++ b/gui/html.qrc
@@ -0,0 +1,5 @@
+<RCC>
+    <qresource prefix="/">
+        <file>images/friends-group-icon.png</file>
+    </qresource>
+</RCC>
diff --git a/gui/html/index.html b/gui/html/index.html
new file mode 100644
index 0000000..f372d2e
--- /dev/null
+++ b/gui/html/index.html
@@ -0,0 +1,3 @@
+<html>
+<h1>It works!</h1>
+</html>
diff --git a/gui/images.qrc b/gui/images.qrc
index 15d4acf..630a137 100644
--- a/gui/images.qrc
+++ b/gui/images.qrc
@@ -1,5 +1,5 @@
 <RCC>
-    <qresource prefix="/images">
-        <file>friends-group-icon.png</file>
+    <qresource prefix="/">
+        <file>html/index.html</file>
     </qresource>
 </RCC>
diff --git a/gui/friends-group-icon.png b/gui/images/friends-group-icon.png
similarity index 100%
rename from gui/friends-group-icon.png
rename to gui/images/friends-group-icon.png
Binary files differ