ctkQtMobilityServiceRuntime_p.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*=============================================================================
  2. Library: CTK
  3. Copyright (c) German Cancer Research Center,
  4. Division of Medical and Biological Informatics
  5. Licensed under the Apache License, Version 2.0 (the "License");
  6. you may not use this file except in compliance with the License.
  7. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. =============================================================================*/
  15. #ifndef CTKQTMOBILITYSERVICERUNTIME_P_H
  16. #define CTKQTMOBILITYSERVICERUNTIME_P_H
  17. #include <QObject>
  18. #include <QServiceManager>
  19. #include <ctkPluginEvent.h>
  20. #include <ctkPlugin.h>
  21. #include <ctkServiceRegistration.h>
  22. class ctkPluginContext;
  23. class ctkQtMobilityServiceFactory;
  24. using namespace QtMobility;
  25. class ctkQtMobilityServiceRuntime : public QObject
  26. {
  27. Q_OBJECT
  28. public:
  29. ctkQtMobilityServiceRuntime(ctkPluginContext* pc);
  30. void start();
  31. void stop();
  32. QServiceManager& getQServiceManager();
  33. protected slots:
  34. void pluginChanged(const ctkPluginEvent& pe);
  35. private:
  36. QtMobility::QServiceManager qServiceManager;
  37. QMultiHash<QSharedPointer<ctkPlugin>, ctkQtMobilityServiceFactory*> mapPluginToServiceFactory;
  38. QMultiHash<QSharedPointer<ctkPlugin>, ctkServiceRegistration> mapPluginToServiceRegistration;
  39. QSet<QSharedPointer<ctkPlugin> > lazy;
  40. ctkPluginContext* pc;
  41. /**
  42. * Check if the plugin has a service descriptor and register it.
  43. *
  44. * @param plugin Plugin to check
  45. */
  46. void processPlugin(QSharedPointer<ctkPlugin> plugin);
  47. /**
  48. * Remove service resources for plugin
  49. *
  50. * @param p Plugin to check
  51. */
  52. void removePlugin(QSharedPointer<ctkPlugin> plugin);
  53. static QString getQServiceManagerErrorString(QServiceManager::Error error);
  54. };
  55. #endif // CTKQTMOBILITYSERVICERUNTIME_P_H