Merge branch 'feature-linux-support'
diff --git a/ChronoShare.desktop.in b/ChronoShare.desktop.in
new file mode 100755
index 0000000..ee6ada4
--- /dev/null
+++ b/ChronoShare.desktop.in
@@ -0,0 +1,8 @@
+[Desktop Entry]
+Name=ChronoShare
+Comment=Peer-to-peer file sharing over NDN
+Exec=${BINDIR}/ChronoShare
+Icon=${DATADIR}/ChronoShare/chronoshare-big.png
+Terminal=false
+Type=Application
+StartupNotify=true
diff --git a/ccnx/ccnx-discovery.cpp b/ccnx/ccnx-discovery.cpp
index afb0307..e6c4e84 100644
--- a/ccnx/ccnx-discovery.cpp
+++ b/ccnx/ccnx-discovery.cpp
@@ -22,12 +22,12 @@
TaggedFunction::GetRandomTag()
{
//boost::random::random_device rng;
- boost::random::uniform_int_distribution<> dist(0, CHAR_SET.size() - 1);
+ //boost::random::uniform_int_distribution<> dist(0, CHAR_SET.size() - 1);
ostringstream oss;
- for (int i = 0; i < DEFAULT_TAG_SIZE; i++)
- {
+ //for (int i = 0; i < DEFAULT_TAG_SIZE; i++)
+ //{
//oss << CHAR_SET[dist(rng)];
- }
+ //}
return oss.str();
}
diff --git a/ccnx/ccnx-discovery.h b/ccnx/ccnx-discovery.h
index 959167a..b03a937 100644
--- a/ccnx/ccnx-discovery.h
+++ b/ccnx/ccnx-discovery.h
@@ -28,8 +28,7 @@
#include "scheduler.h"
#include <boost/shared_ptr.hpp>
#include <boost/function.hpp>
-#include <boost/random/random_device.hpp>
-#include <boost/random/uniform_int_distribution.hpp>
+#include <boost/random.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/locks.hpp>
#include <list>
diff --git a/gui/chronosharegui.cpp b/gui/chronosharegui.cpp
index 0d3580e..2ec6770 100644
--- a/gui/chronosharegui.cpp
+++ b/gui/chronosharegui.cpp
@@ -22,6 +22,7 @@
*/
#include "chronosharegui.h"
+#include "config.h"
#include "logging.h"
#include "ccnx-wrapper.h"
@@ -42,7 +43,8 @@
#else
static const string DOC_ROOT = ":/html";
#endif
-static const QString ICON_PICTURE_QSTRING(":/images/friends-group-icon.png");
+static const QString ICON_BIG_FILE(":/images/chronoshare-big.png");
+static const QString ICON_TRAY_FILE(":/images/" TRAY_ICON);
INIT_LOGGER ("Gui");
@@ -250,7 +252,7 @@
messageBox.setWindowTitle(title);
messageBox.setText(text);
- messageBox.setIconPixmap(QPixmap(ICON_PICTURE_QSTRING));
+ messageBox.setIconPixmap(QPixmap(ICON_BIG_FILE));
messageBox.exec();
}
@@ -262,7 +264,7 @@
messageBox.setText(text);
messageBox.setInformativeText(infotext);
- messageBox.setIconPixmap(QPixmap(ICON_PICTURE_QSTRING));
+ messageBox.setIconPixmap(QPixmap(ICON_BIG_FILE));
messageBox.exec();
}
@@ -343,10 +345,8 @@
// create new tray icon
m_trayIcon = new QSystemTrayIcon(this);
-#ifdef ADHOC_SUPPORTED
// associate the menu with the tray icon
m_trayIcon->setContextMenu(m_trayIconMenu);
-#endif
// handle left click of icon
connect(m_trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), this, SLOT(trayIconClicked(QSystemTrayIcon::ActivationReason)));
@@ -404,7 +404,7 @@
void ChronoShareGui::setIcon()
{
// set the icon image
- m_trayIcon->setIcon(QIcon(ICON_PICTURE_QSTRING));
+ m_trayIcon->setIcon(QIcon(ICON_TRAY_FILE));
}
void ChronoShareGui::openSharedFolder()
diff --git a/gui/images.qrc b/gui/images.qrc
index 29a8104..0c4f852 100644
--- a/gui/images.qrc
+++ b/gui/images.qrc
@@ -1,5 +1,6 @@
<RCC>
<qresource prefix="/">
- <file>images/friends-group-icon.png</file>
+ <file>images/chronoshare-big.png</file>
+ <file>images/chronoshare-ubuntu.png</file>
</qresource>
</RCC>
diff --git a/gui/images/friends-group-icon.png b/gui/images/chronoshare-big.png
similarity index 100%
rename from gui/images/friends-group-icon.png
rename to gui/images/chronoshare-big.png
Binary files differ
diff --git a/gui/images/chronoshare-ubuntu.png b/gui/images/chronoshare-ubuntu.png
new file mode 100644
index 0000000..cbf98d3
--- /dev/null
+++ b/gui/images/chronoshare-ubuntu.png
Binary files differ
diff --git a/server/server.cpp b/server/server.cpp
index df790ed..11b74cb 100644
--- a/server/server.cpp
+++ b/server/server.cpp
@@ -20,7 +20,7 @@
server::server(const std::string& address, const std::string& port,
const std::string& doc_root)
: io_service_(),
- signals_(io_service_),
+ // signals_(io_service_),
acceptor_(io_service_),
connection_manager_(),
new_connection_(),
@@ -29,12 +29,12 @@
// Register to handle the signals that indicate when the server should exit.
// It is safe to register for the same signal multiple times in a program,
// provided all registration for the specified signal is made through Asio.
- signals_.add(SIGINT);
- signals_.add(SIGTERM);
-#if defined(SIGQUIT)
- signals_.add(SIGQUIT);
-#endif // defined(SIGQUIT)
- signals_.async_wait(boost::bind(&server::handle_stop, this));
+// signals_.add(SIGINT);
+// signals_.add(SIGTERM);
+//#if defined(SIGQUIT)
+// signals_.add(SIGQUIT);
+//#endif // defined(SIGQUIT)
+// signals_.async_wait(boost::bind(&server::handle_stop, this));
// Open the acceptor with the option to reuse the address (i.e. SO_REUSEADDR).
boost::asio::ip::tcp::resolver resolver(io_service_);
diff --git a/server/server.hpp b/server/server.hpp
index b82088b..8a81b06 100644
--- a/server/server.hpp
+++ b/server/server.hpp
@@ -51,7 +51,7 @@
boost::asio::io_service io_service_;
/// The signal_set is used to register for process termination notifications.
- boost::asio::signal_set signals_;
+ // boost::asio::signal_set signals_;
/// Acceptor used to listen for incoming connections.
boost::asio::ip::tcp::acceptor acceptor_;
diff --git a/src/dispatcher.cc b/src/dispatcher.cc
index 717fadb..390cb4a 100644
--- a/src/dispatcher.cc
+++ b/src/dispatcher.cc
@@ -235,7 +235,13 @@
{
m_actionLog->AddLocalActionUpdate (relativeFilePath.generic_string(),
*hash,
- last_write_time (absolutePath), status (absolutePath).permissions (), seg_num);
+ last_write_time (absolutePath),
+#if BOOST_VERSION >= 104900
+ status (absolutePath).permissions (),
+#else
+ 0,
+#endif
+ seg_num);
// notify SyncCore to propagate the change
m_core->localStateChangedDelayed ();
@@ -473,7 +479,9 @@
{
if (filesystem::exists (filePath) &&
filesystem::last_write_time (filePath) == file->mtime () &&
+#if BOOST_VERSION >= 104900
filesystem::status (filePath).permissions () == static_cast<filesystem::perms> (file->mode ()) &&
+#endif
*Hash::FromFileContent (filePath) == hash)
{
_LOG_DEBUG ("Asking to assemble a file, but file already exists on a filesystem");
@@ -491,7 +499,9 @@
if (ok)
{
last_write_time (filePath, file->mtime ());
+#if BOOST_VERSION >= 104900
permissions (filePath, static_cast<filesystem::perms> (file->mode ()));
+#endif
m_fileState->SetFileComplete (file->filename ());
}
diff --git a/src/fetcher.h b/src/fetcher.h
index 0a0fe9d..515b2e9 100644
--- a/src/fetcher.h
+++ b/src/fetcher.h
@@ -28,6 +28,9 @@
#include "executor.h"
#include <boost/intrusive/list.hpp>
#include <boost/date_time/posix_time/posix_time_types.hpp>
+#include <set>
+
+#include <set>
class FetchManager;
diff --git a/src/state-server.cc b/src/state-server.cc
index 89b6095..2d1d96a 100644
--- a/src/state-server.cc
+++ b/src/state-server.cc
@@ -135,7 +135,7 @@
Object id;
id.push_back (Pair ("userName", boost::lexical_cast<string> (name)));
- id.push_back (Pair ("seqNo", seq_no));
+ id.push_back (Pair ("seqNo", static_cast<int64_t> (seq_no)));
json.push_back (Pair ("id", id));
@@ -463,7 +463,9 @@
{
if (filesystem::exists (filePath) &&
filesystem::last_write_time (filePath) == file->mtime () &&
+#if BOOST_VERSION >= 104900
filesystem::status (filePath).permissions () == static_cast<filesystem::perms> (file->mode ()) &&
+#endif
*Hash::FromFileContent (filePath) == hash)
{
m_ccnx->publishData (interest, "OK: File already exists", 1);
@@ -481,7 +483,9 @@
if (m_objectManager.objectsToLocalFile (deviceName, hash, filePath))
{
last_write_time (filePath, file->mtime ());
+#if BOOST_VERSION >= 104900
permissions (filePath, static_cast<filesystem::perms> (file->mode ()));
+#endif
m_ccnx->publishData (interest, "OK", 1);
}
else
diff --git a/wscript b/wscript
index c86104e..d82ce50 100644
--- a/wscript
+++ b/wscript
@@ -13,10 +13,10 @@
if Utils.unversioned_sys_platform () == "darwin":
opt.add_option('--auto-update', action='store_true',default=False,dest='autoupdate',help='''(OSX) Download sparkle framework and enable autoupdate feature''')
- opt.load('compiler_c compiler_cxx boost ccnx protoc qt4')
+ opt.load('compiler_c compiler_cxx boost ccnx protoc qt4 gnu_dirs')
def configure(conf):
- conf.load("compiler_c compiler_cxx")
+ conf.load("compiler_c compiler_cxx gnu_dirs")
if conf.options.debug:
conf.define ('_DEBUG', 1)
@@ -48,6 +48,10 @@
conf.check_cfg(package='libevent', args=['--cflags', '--libs'], uselib_store='LIBEVENT', mandatory=True)
conf.check_cfg(package='libevent_pthreads', args=['--cflags', '--libs'], uselib_store='LIBEVENT_PTHREADS', mandatory=True)
+ conf.define ("TRAY_ICON", "chronoshare-big.png")
+ if Utils.unversioned_sys_platform () == "linux":
+ conf.define ("TRAY_ICON", "chronoshare-ubuntu.png")
+
if Utils.unversioned_sys_platform () == "darwin":
conf.check_cxx(framework_name='Foundation', uselib_store='OSX_FOUNDATION', mandatory=False, compile_filename='test.mm')
conf.check_cxx(framework_name='AppKit', uselib_store='OSX_APPKIT', mandatory=False, compile_filename='test.mm')
@@ -261,6 +265,16 @@
if bld.env['HAVE_LOCAL_SPARKLE']:
qt.mac_frameworks = "osx/Frameworks/Sparkle.framework"
+ if Utils.unversioned_sys_platform () == "linux":
+ bld (
+ features = "process_in",
+ target = "ChronoShare.desktop",
+ source = "ChronoShare.desktop.in",
+ install_prefix = "${DATADIR}/applications",
+ )
+ bld.install_files ("${DATADIR}/applications", "ChronoShare.desktop")
+ bld.install_files ("${DATADIR}/ChronoShare", "gui/images/chronoshare-big.png")
+
cmdline = bld (
target = "csd",
features = "qt4 cxx cxxprogram",
@@ -284,10 +298,22 @@
"""Alias .mm files to be compiled the same as .cc files, gcc/clang will do the right thing."""
return self.create_compiled_task('cxx', node)
-@TaskGen.extension('.js', '.png', '.css', '.html', '.gif', '.ico')
+@TaskGen.extension('.js', '.png', '.css', '.html', '.gif', '.ico', '.in')
def sig_hook(self, node):
node.sig=Utils.h_file (node.abspath())
+@TaskGen.feature('process_in')
+@TaskGen.after_method('process_source')
+def create_process_in(self):
+ dst = self.bld.path.find_or_declare (self.target)
+ tsk = self.create_task ('process_in', self.source, dst)
+
+class process_in(Task.Task):
+ color='PINK'
+
+ def run (self):
+ self.outputs[0].write (Utils.subst_vars(self.inputs[0].read (), self.env))
+
@TaskGen.feature('html_resources')
@TaskGen.before_method('process_source')
def create_qrc_task(self):