Add version generation and display

The control center version includes versions of the bundled ndn-cxx,
NFD, and ndn-tools.  The implementation is a bit hacky and most of the
the logic should be moved to the build script eventually.

Change-Id: Ie5f33c62f5e35a6a727c038ca0a3e03385dbd7db
diff --git a/src/Info.plist b/src/Info.plist.in
similarity index 89%
rename from src/Info.plist
rename to src/Info.plist.in
index 6bb818d..a373b29 100644
--- a/src/Info.plist
+++ b/src/Info.plist.in
@@ -19,11 +19,11 @@
     <key>CFBundleSignature</key>
     <string>????</string>
     <key>CFBundleShortVersionString</key>
-    <string>0.1.1</string>
+    <string>@VERSION@</string>
     <key>LSMinimumSystemVersion</key>
     <string>10.6</string>
     <key>CFBundleVersion</key>
-    <string>0.1.1</string>
+    <string>@VERSION@</string>
     <key>NSMainNibFile</key>
     <string>MainMenu</string>
     <key>NSPrincipalClass</key>
@@ -33,7 +33,7 @@
     <key>LSUIElement</key>
     <string>1</string>
     <key>SUFeedURL</key>
-    <string>https://irl.cs.ucla.edu/~cawka/ndn-control-center.xml</string>
+    <string>@APPCAST@</string>
     <key>SUPublicDSAKeyFile</key>
     <string>ndn_sparkle_pub.pem</string>
 </dict>
diff --git a/src/main.qml b/src/main.qml
index b051c6c..eaa3b3a 100644
--- a/src/main.qml
+++ b/src/main.qml
@@ -91,6 +91,19 @@
                         }
                     }
                 }
+                GridLayout {
+                     anchors.left: parent.left
+                     anchors.bottom: parent.bottom
+                     Label {
+                         text: "NFD Control Center version:"
+                         font.pixelSize: 10
+                     }
+                     Label {
+                         text: nccVersion
+                         font.pixelSize: 10
+                         font.bold: true
+                     }
+                }
             }
         }
         // Tab {
diff --git a/src/tray-menu.cpp b/src/tray-menu.cpp
index 9bcdaa4..a2f1c24 100644
--- a/src/tray-menu.cpp
+++ b/src/tray-menu.cpp
@@ -33,11 +33,18 @@
 
 #include <Security/Authorization.h>
 #include <Security/AuthorizationTags.h>
+
+#include "build/NFD/build/core/version.hpp"
+#include "build/ndn-tools/build/core/version.cpp"
+
 #else
 #define CONNECT_ICON ":/res/icon-connected-white.png"
 #define DISCONNECT_ICON ":/res/icon-disconnected-white.png"
+
 #endif // OSX_BUILD
 
+#include <ndn-cxx/version.hpp>
+
 namespace ndn {
 namespace ncc {
 
@@ -74,6 +81,13 @@
   connect(this, SIGNAL(nfdActivityUpdate(bool)), this, SLOT(updateNfdActivityIcon(bool)),
           Qt::QueuedConnection);
 
+  QString nccVersion = QString(NCC_VERSION) + " (ndn-cxx: " + NDN_CXX_VERSION_BUILD_STRING +
+    ", NFD: " + NFD_VERSION_BUILD_STRING +
+    ", ndn-tools: " + ::ndn::tools::VERSION +
+    ")";
+
+  m_context->setContextProperty("nccVersion", nccVersion);
+
   m_menu->addAction(m_entryPref);
   m_menu->addAction(m_entrySec);
 
diff --git a/wscript b/wscript
index a25a5ad..bee976f 100644
--- a/wscript
+++ b/wscript
@@ -1,6 +1,7 @@
 # -*- Mode: python; py-indent-offset: 4; indent-tabs-mode: nil; coding: utf-8; -*-
-VERSION='0.1.1'
+VERSION='0.2'
 APPNAME='nfd-control-center'
+APPCAST='https://irl.cs.ucla.edu/~cawka/ndn-control-center.xml'
 
 from waflib import Logs, Utils, Task, TaskGen
 import os
@@ -31,6 +32,9 @@
     if Utils.unversioned_sys_platform() == "darwin":
         conf.define('OSX_BUILD', 1)
 
+    conf.define('NCC_VERSION', VERSION)
+    conf.define('NCC_APPCAST', APPCAST)
+
     conf.write_config_header('config.hpp')
 
 def build(bld):
@@ -55,8 +59,16 @@
         bld.install_files("${DATAROOTDIR}/nfd-control-center",
                           bld.path.ant_glob(['res/*']))
     else:
+        bld(features="subst",
+            source='src/Info.plist.in',
+            target='src/Info.plist',
+            install_path=None,
+            VERSION=VERSION,
+            APPCAST=APPCAST)
+        bld.env['INCLUDES_NDN_TOOLS'] = 'build/ndn-tools'
+
         app.source += bld.path.ant_glob(['src/osx-*.mm', 'src/osx-*.cpp'])
-        app.use += " OSX_FOUNDATION OSX_APPKIT OSX_SPARKLE OSX_COREWLAN"
+        app.use += " OSX_FOUNDATION OSX_APPKIT OSX_SPARKLE OSX_COREWLAN NDN_TOOLS"
         app.target = "NFD Control Center"
         app.mac_app = True
         app.mac_plist = 'src/Info.plist'