Here the installer creation works. I mean, with VS2008, linux and mac
the help files are OK in both the installed version and from the build
directory.

The Initialize() funtion of my workbench advisor contains this:

  if (!berry::QtAssistantUtil::GetHelpCollectionFile().isEmpty())
  {
    typedef std::vector<berry::IBundle::Pointer> BundleContainer;
    BundleContainer bundles = berry::Platform::GetBundles();
    berry::QtAssistantUtil::RegisterQCHFiles(bundles);
  }


In the files.cmake of my application plugin there is this:
#----------- Qt Help Collection Project -------------#

IF (BLUEBERRY_USE_QT_HELP)
  SET(_plugin_qhcp_input
"${CMAKE_CURRENT_SOURCE_DIR}/documentation/KMapsQtHelpCollectionProject.qhcp")
#  SET(_plugin_qhcp_output
"${CMAKE_CURRENT_BINARY_DIR}/KMapsQtHelpCollection_${KMaps_REVISION_ID}.qhc")
  SET(_plugin_qhcp_output
"${CMAKE_CURRENT_BINARY_DIR}/KMapsQtHelpCollection.qhc")
  ADD_CUSTOM_COMMAND(OUTPUT ${_plugin_qhcp_output}
                     COMMAND ${QT_COLLECTIONGENERATOR_EXECUTABLE}
${_plugin_qhcp_input} -o ${_plugin_qhcp_output}
                     DEPENDS ${_plugin_qhcp_input}
                     )

  LIST(APPEND CACHED_RESOURCE_FILES ${_plugin_qhcp_output})
ENDIF()


Finally, the activator of my application plugin contains this:

void KMapsApplicationPlugin::start(ctkPluginContext* context)
{
  berry::AbstractUICTKPlugin::start(context);

  this->context = context;

  BERRY_REGISTER_EXTENSION_CLASS(KMapsApplication, context);

  QString collectionFile = GetQtHelpCollectionFile();

  berry::QtAssistantUtil::SetHelpCollectionFile(collectionFile);
  
berry::QtAssistantUtil::SetDefaultHelpUrl("qthelp://it.unito.cim.kmaps/bundle/index.html");

  delete pluginListener;
  pluginListener = new berry::QCHPluginListener(context);
  context->connectPluginListener(pluginListener,
SLOT(pluginChanged(ctkPluginEvent)), Qt::DirectConnection);

  // register all QCH files from all the currently installed plugins
  pluginListener->processPlugins();
}

ctkPluginContext* KMapsApplicationPlugin::GetPluginContext() const
{
  return context;
}

QString KMapsApplicationPlugin::GetQtHelpCollectionFile() const
{
  if (!helpCollectionFile.isEmpty())
  {
    return helpCollectionFile;
  }

  QString collectionFilename;
//  QString na("n/a");
//  if (na != KMaps_REVISION)
//    collectionFilename = "KMapsQtHelpCollection_" KMaps_REVISION ".qhc";
//  else
    collectionFilename = "KMapsQtHelpCollection.qhc";

  QFileInfo collectionFileInfo = context->getDataFile(collectionFilename);
  QFileInfo pluginFileInfo =
QFileInfo(QUrl(context->getPlugin()->getLocation()).toLocalFile());
  if (!collectionFileInfo.exists() ||
      pluginFileInfo.lastModified() > collectionFileInfo.lastModified())
  {
    // extract the qhc file from the plug-in
    QByteArray content = context->getPlugin()->getResource(collectionFilename);
    if (content.isEmpty())
    {
      BERRY_WARN << "Could not get plug-in resource: " <<
collectionFilename.toStdString();
    }
    else
    {
      QFile file(collectionFileInfo.absoluteFilePath());
      file.open(QIODevice::WriteOnly);
      file.write(content);
      file.close();
    }
  }

  if (QFile::exists(collectionFileInfo.absoluteFilePath()))
  {
    helpCollectionFile = collectionFileInfo.absoluteFilePath();
  }

  return helpCollectionFile;
}


Good luck!

Miklos

On Wed, Jan 25, 2012 at 9:29 AM, Clarkson, Matt <[email protected]> wrote:
> While you are there Miklos, have you tried running "make package" recently. 
> Mine is broke, but I know I am missing a line of CMake, but I can't get it to 
> work.
> So, if your's works, Id like to know where/how you install qt assistant in 
> your final bundle.
> Thanks
>
> Matt

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to