Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
QmitkFileReaderWriterOptionsWidget.h
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 #ifndef QMITKFILEREADERWRITEROPTIONSWIDGET_H
18 #define QMITKFILEREADERWRITEROPTIONSWIDGET_H
19 
20 #include <QCheckBox>
21 #include <QComboBox>
22 #include <QDoubleSpinBox>
23 #include <QLabel>
24 #include <QLineEdit>
25 #include <QSpinBox>
26 #include <QWidget>
27 
28 #include <usAny.h>
29 
31 {
32  QmitkAnyAdapter(const std::string &name) : m_Name(name) {}
33  virtual ~QmitkAnyAdapter() {}
34  virtual us::Any GetAny() const = 0;
35  std::string GetName() const { return m_Name; }
36 private:
37  std::string m_Name;
38 };
39 
40 class QmitkAnyStringWidget : public QLineEdit, public QmitkAnyAdapter
41 {
42  Q_OBJECT
43 
44 public:
45  QmitkAnyStringWidget(const std::string &name, const us::Any &any, QWidget *parent = nullptr);
46  us::Any GetAny() const override;
47 };
48 
49 class QmitkAnyVectorWidget : public QComboBox, public QmitkAnyAdapter
50 {
51  Q_OBJECT
52 
53 public:
54  QmitkAnyVectorWidget(const std::string &name,
55  const us::Any &any,
56  const QString &defaultValue,
57  QWidget *parent = nullptr);
58  us::Any GetAny() const override;
59 };
60 
61 class QmitkAnyBoolWidget : public QCheckBox, public QmitkAnyAdapter
62 {
63  Q_OBJECT
64 
65 public:
66  QmitkAnyBoolWidget(const std::string &name, const us::Any &any, QWidget *parent = nullptr);
67  us::Any GetAny() const override;
68 };
69 
70 class QmitkAnyShortWidget : public QSpinBox, public QmitkAnyAdapter
71 {
72  Q_OBJECT
73 
74 public:
75  QmitkAnyShortWidget(const std::string &name, const us::Any &any, QWidget *parent = nullptr);
76  us::Any GetAny() const override;
77 };
78 
79 class QmitkAnyUShortWidget : public QSpinBox, public QmitkAnyAdapter
80 {
81  Q_OBJECT
82 
83 public:
84  QmitkAnyUShortWidget(const std::string &name, const us::Any &any, QWidget *parent = nullptr);
85  us::Any GetAny() const override;
86 };
87 
88 class QmitkAnyIntWidget : public QSpinBox, public QmitkAnyAdapter
89 {
90  Q_OBJECT
91 
92 public:
93  QmitkAnyIntWidget(const std::string &name, const us::Any &any, QWidget *parent = nullptr);
94  us::Any GetAny() const override;
95 };
96 
97 class QmitkAnyUIntWidget : public QSpinBox, public QmitkAnyAdapter
98 {
99  Q_OBJECT
100 
101 public:
102  QmitkAnyUIntWidget(const std::string &name, const us::Any &any, QWidget *parent = nullptr);
103  us::Any GetAny() const override;
104 };
105 
106 class QmitkAnyFloatWidget : public QDoubleSpinBox, public QmitkAnyAdapter
107 {
108  Q_OBJECT
109 
110 public:
111  QmitkAnyFloatWidget(const std::string &name, const us::Any &any, QWidget *parent = nullptr);
112  us::Any GetAny() const override;
113 };
114 
115 class QmitkAnyDoubleWidget : public QDoubleSpinBox, public QmitkAnyAdapter
116 {
117  Q_OBJECT
118 
119 public:
120  QmitkAnyDoubleWidget(const std::string &name, const us::Any &any, QWidget *parent = nullptr);
121  us::Any GetAny() const override;
122 };
123 
124 class QmitkInvalidAnyWidget : public QLabel, public QmitkAnyAdapter
125 {
126  Q_OBJECT
127 
128 public:
129  QmitkInvalidAnyWidget(const std::string &name, const us::Any &any, QWidget *parent = nullptr);
130  us::Any GetAny() const override;
131 };
132 
134 {
135  Q_OBJECT
136 
137 public:
138  typedef std::map<std::string, us::Any> Options;
139 
140  QmitkFileReaderWriterOptionsWidget(const Options &options, QWidget *parent = nullptr);
141 
142  Options GetOptions() const;
143 
144 private:
145  Q_DISABLE_COPY(QmitkFileReaderWriterOptionsWidget)
146 };
147 
148 #endif // QMITKFILEREADERWRITEROPTIONSWIDGET_H
QmitkAnyUIntWidget(const std::string &name, const us::Any &any, QWidget *parent=nullptr)
virtual us::Any GetAny() const =0
QmitkAnyFloatWidget(const std::string &name, const us::Any &any, QWidget *parent=nullptr)
QmitkAnyUShortWidget(const std::string &name, const us::Any &any, QWidget *parent=nullptr)
QmitkFileReaderWriterOptionsWidget(const Options &options, QWidget *parent=nullptr)
QmitkAnyAdapter(const std::string &name)
Definition: usAny.h:163
QmitkAnyVectorWidget(const std::string &name, const us::Any &any, const QString &defaultValue, QWidget *parent=nullptr)
QmitkAnyShortWidget(const std::string &name, const us::Any &any, QWidget *parent=nullptr)
QmitkAnyIntWidget(const std::string &name, const us::Any &any, QWidget *parent=nullptr)
QmitkAnyStringWidget(const std::string &name, const us::Any &any, QWidget *parent=nullptr)
QmitkAnyBoolWidget(const std::string &name, const us::Any &any, QWidget *parent=nullptr)
QmitkInvalidAnyWidget(const std::string &name, const us::Any &any, QWidget *parent=nullptr)
QmitkAnyDoubleWidget(const std::string &name, const us::Any &any, QWidget *parent=nullptr)