Fraxinus  17.12
An IGT application
cxToolListWidget.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 #ifndef CXTOOLLISTWIDGET_H_
34 #define CXTOOLLISTWIDGET_H_
35 
36 #include "cxGuiExport.h"
37 
38 #include <QListWidget>
39 #include "cxForwardDeclarations.h"
40 
41 class QDir;
42 class QListWidgetItem;
43 
44 namespace cx
45 {
57 class cxGui_EXPORT ToolListWidget : public QListWidget
58 {
59  Q_OBJECT
60 
61 public:
62  ToolListWidget(TrackingServicePtr trackingService, QWidget* parent = NULL);
63  virtual ~ToolListWidget();
64 
65 signals:
66  void toolSelected(QString absoluteFilePath);
67  void userChangedList();
68  void listSizeChanged();
69 
70 protected:
71  void populate(QStringList toolsAbsoluteFilePath);
72  void addTool(QString absoluteFilePath);
73 
75 
76 private slots:
77  void selectionChangedSlot();
78  void toolSelectedSlot(QListWidgetItem* item);
79 };
80 
81 //---------------------------------------------------------------------------------------------------------------------
82 
91 class cxGui_EXPORT FilteringToolListWidget : public ToolListWidget
92 {
93  Q_OBJECT
94 
95 public:
96  FilteringToolListWidget(TrackingServicePtr trackingService, QWidget* parent = NULL);
97  virtual ~FilteringToolListWidget();
98 
99  virtual QSize minimumSizeHint() const;
100 
101 public slots:
102  void filterSlot(QStringList applicationsFilter, QStringList trackingsystemsFilter);
103 
104 protected:
105  void mousePressEvent(QMouseEvent *event);
106  void mouseMoveEvent(QMouseEvent *event);
107  void startDrag();
108 
109 private:
110  QStringList filter(QStringList toolsToFilter, QStringList applicationsFilter, QStringList trackingsystemsFilter);
111  QPoint startPos;
112 };
113 
114 //---------------------------------------------------------------------------------------------------------------------
115 
124 class cxGui_EXPORT ConfigToolListWidget : public ToolListWidget
125 {
126  Q_OBJECT
127 
128 public:
129  ConfigToolListWidget(TrackingServicePtr trackingService, QWidget* parent = NULL);
130  virtual ~ConfigToolListWidget();
131 
132  virtual void dropEvent(QDropEvent* event);
133  QStringList getTools();
134 
135 public slots:
136  void configSlot(QStringList toolsAbsoluteFilePath);
137  void filterSlot(QStringList trackingsystemFilter);
138 
139 private slots:
140  void deleteSlot();
141  void deleteItemSlot(QListWidgetItem* item);
142  void contextMenuSlot(const QPoint & point);
143 
144 protected:
145  void dragEnterEvent(QDragEnterEvent *event);
146  void dragMoveEvent(QDragMoveEvent *event);
147 
148 private:
149  QListWidgetItem* mItemToDelete;
150 };
151 
152 } //namespace cx
153 #endif /* CXTOOLLISTWIDGET_H_ */
boost::shared_ptr< class TrackingService > TrackingServicePtr
Class for displaying tool files that can be dragged and droppedSuperclass, not used directly...
Helper class for tool config list display.
Helper class for tool list display.
TrackingServicePtr mTrackingService
Namespace for all CustusX production code.