Boost Application Interprocess with Qt Quick

Posted on 7 February 2015

Here is template in current stage on GitHub

How to build:

cmake ../Perfume

Notes:

Server

LOG4CPLUS_INFO(logger_, "Running server class");
managed_shared_memory segment
   (create_only, "Patchouli", 65536);

managed_shared_memory::size_type free_memory = 
                         segment.get_free_memory();

void * shptr = segment.allocate(1024);
segment.construct<sharedString>( "sharedString" )
        (app_name, segment.get_segment_manager());

boost::thread thread(&server::worker, this);

Client

root->connect(trayIcon, &QSystemTrayIcon::activated,
  [root] (QSystemTrayIcon::ActivationReason reason) {
    switch (reason) {
    case QSystemTrayIcon::Trigger:
    case QSystemTrayIcon::DoubleClick:
      ((QQuickWindow *)root)->showNormal();
      break;
    }
});
managed_shared_memory segment(open_only, "Patchouli");
std::pair<sharedString * , size_t > p
  = segment.find<sharedString>("sharedString");
((QQuickWindow *)root)->setTitle( p.first->c_str() );

Credits