Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
mitkUSUIActivator.cpp
Go to the documentation of this file.
1 /*===================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #include "mitkUSUIActivator.h"
20 
22  : m_CustomWidgetFactory(0), m_CustomVideoDeviceWidget(0)
23 {
24 }
25 
27 {
28  delete m_CustomWidgetFactory;
29  delete m_CustomVideoDeviceWidget;
30 
31  if ( m_ServiceRegistration ) { m_ServiceRegistration.Unregister(); }
32 }
33 
34 void mitk::USUIActivator::Load(us::ModuleContext* context)
35 {
36  // create a custom video device widget, which will be used as
37  // a prototype for the custom widget factory
38  if ( ! m_CustomVideoDeviceWidget )
39  {
40  m_CustomVideoDeviceWidget = new QmitkUSControlsCustomVideoDeviceWidget();
41  }
42 
43  // create a factory for custom widgets, using the video device
44  // widget as a prototype
45  if ( ! m_CustomWidgetFactory )
46  {
47  m_CustomWidgetFactory = new mitk::USUICustomWidgetFactory(m_CustomVideoDeviceWidget);
48  }
49 
50  // register the custom widget factory as a microservice
51  m_ServiceRegistration = m_CustomWidgetFactory->RegisterService(context);
52 }
53 
54 void mitk::USUIActivator::Unload(us::ModuleContext* /*context*/)
55 {
56  m_ServiceRegistration.Unregister();
57  m_ServiceRegistration = 0;
58 
59  delete m_CustomWidgetFactory;
60  m_CustomWidgetFactory = 0;
61 
62  delete m_CustomVideoDeviceWidget;
63  m_CustomVideoDeviceWidget = 0;
64 }
Prototype service factory for creating unique instances of QmitUSAbstractCustomWidget.
void Load(us::ModuleContext *context) override
Widget for custom controls of mitk::USVideoDevice. This class handles the itk::USVideoDeviceCustomCon...
void Unload(us::ModuleContext *context) override