Fraxinus  16.5.0-fx-rc9
An IGT application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cxPluginBrowser.h
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) 2008-2014, SINTEF Department of Medical Technology
5 All rights reserved.
6 
7 Redistribution and use in source and binary forms, with or without
8 modification, are permitted provided that the following conditions are met:
9 
10 1. Redistributions of source code must retain the above copyright notice,
11  this list of conditions and the following disclaimer.
12 
13 2. Redistributions in binary form must reproduce the above copyright notice,
14  this list of conditions and the following disclaimer in the documentation
15  and/or other materials provided with the distribution.
16 
17 3. Neither the name of the copyright holder nor the names of its contributors
18  may be used to endorse or promote products derived from this software
19  without specific prior written permission.
20 
21 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 =========================================================================*/
32 
33 // Based on a class from CTK:
34 /*=============================================================================
35 
36 
37  Library: CTK
38 
39  Copyright (c) German Cancer Research Center,
40  Division of Medical and Biological Informatics
41 
42  Licensed under the Apache License, Version 2.0 (the "License");
43  you may not use this file except in compliance with the License.
44  You may obtain a copy of the License at
45 
46  http://www.apache.org/licenses/LICENSE-2.0
47 
48  Unless required by applicable law or agreed to in writing, software
49  distributed under the License is distributed on an "AS IS" BASIS,
50  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
51  See the License for the specific language governing permissions and
52  limitations under the License.
53 
54 =============================================================================*/
55 
56 #ifndef CXPLUGINBROWSER_H
57 #define CXPLUGINBROWSER_H
58 
59 #include "cxGuiExport.h"
60 
61 #include <QMainWindow>
62 
63 #include <ctkServiceEvent.h>
64 #include <ctkPluginEvent.h>
65 #include <ctkPluginFrameworkEvent.h>
66 #include <ctkPlugin.h>
67 #include <QModelIndex>
68 #include "cxPluginFramework.h"
69 #include "cxMultiFileInputWidget.h"
70 
71 class QTableView;
72 class ctkPluginFramework;
73 class cxtServiceEvent;
74 
75 namespace cx
76 {
77 class ctkPluginTableModel;
78 
79 class cxGui_EXPORT ctkPluginBrowser : public QMainWindow
80 {
81  Q_OBJECT
82 
83 public:
84 
86  virtual ~ctkPluginBrowser();
87 
88 private Q_SLOTS:
89 
90  void pluginSelected(const QModelIndex& index);
91  void resizePluginsTableView();
92 
93  void frameworkEvent(const ctkPluginFrameworkEvent& event);
94  void pluginEvent(const ctkPluginEvent& event);
95  void serviceEvent(const ctkServiceEvent& event);
96 
97  void startPlugin();
98  void startPluginNow();
99  void stopPlugin();
100  void toggleInstallPlugin();
101  void searchPathChanged();
102 
103 private:
104 
105 // void closeEvent(QCloseEvent* closeEvent);
106  void setupUi();
107  PluginData getSelectedPlugin();
108 
109  void updatePluginToolbar();
110  void startPlugin(ctkPlugin::StartOptions options);
111  void wrapInDockWidget(QWidget* widget);
112 
113 
114  PluginFrameworkManagerPtr framework;
115  ctkPluginTableModel* mPluginTableModel;
116 
117  QAction* startPluginNowAction;
118  QAction* startPluginAction;
119  QAction* stopPluginAction;
120  QAction* toggleInstallPluginAction;
121 
122  cx::MultiFileInputWidget* searchPathSelectWidget;
123 
124  QTableView* pluginsTableView;
125  QToolBar* pluginToolBar;
126  QTextEdit* mPluginInfoWidget;
127  void updatePluginInfo();
128 
129  QString mSettingsMainWindowStateTag;
130  QString mSettingsMainWindowGeometryTag;
131  QMap<ctkPluginEvent::Type, QString> pluginEventTypeToString;
132 
133 };
134 
135 } //namespace cx
136 
137 
138 #endif // CXPLUGINBROWSER_H
std::pair< QString, ctkPluginPtr > PluginData
boost::shared_ptr< class PluginFrameworkManager > PluginFrameworkManagerPtr