CustusX  2023.01.05-dev+develop.0da12
An IGT application
cxExportDataTypeWidget.cpp
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 #include "cxExportDataTypeWidget.h"
13 
14 #include <QVBoxLayout>
15 #include <QLabel>
16 
17 #include "cxOptionsWidget.h"
19 #include "cxFileManagerService.h"
20 #include "cxLogger.h"
21 #include "cxImage.h"
22 
23 namespace cx
24 {
25 
27  BaseWidget(parent, "ExportDataTypeWidget", "Export "+dataType),
28  mFileManager(filemanager),
29  mServices(services),
30  mSelectedData(property),
31  mDataType(dataType)
32 {
33  QStringList exporters;
34  std::vector<FileReaderWriterServicePtr> writers = filemanager->getExportersForDataType(mDataType);
35  CX_LOG_DEBUG() << "Found " << writers.size() << " writers that export " << mDataType;
36  for(int i=0; i<writers.size(); ++i)
37  {
38  //exporters << writers[i]->getName()+ " (*." + writers[i]->getFileSuffix() +")";
39  exporters << writers[i]->getFileSuffix();
40  }
41 
42  mSelectedData->setValueName(mDataType);
43  mSelectedData->setHelp("Select "+mDataType);
44 
45  //create gui
46  std::vector<SelectDataStringPropertyBasePtr> properties;
47  properties.push_back(mSelectedData);
48  OptionsWidget *options = new OptionsWidget(services->view(), services->patient(), this);
49  options->setOptions(mDataType, properties, true);
50 
51  //add the layout
52  QVBoxLayout *layout = new QVBoxLayout(this);
53  layout->addWidget(new QLabel(mDataType));
54  QString exporter;
55  foreach(exporter,exporters)
56  {
57  QCheckBox *checkbox = new QCheckBox(exporter);
58  mCheckboxes.push_back(checkbox);
59  layout->addWidget(checkbox);
60  }
61  mExportButton = new QPushButton("Export");
62  mExportAllButton = new QPushButton("Export All "+mDataType+"s");
63 
64  QHBoxLayout *hLayout = new QHBoxLayout();
65  hLayout->addWidget(options);
66  hLayout->addWidget(mExportButton);
67  hLayout->addWidget(new QLabel("or"));
68  hLayout->addWidget(mExportAllButton);
69  layout->addLayout(hLayout);
70  layout->addWidget(this->createHorizontalLine());
71 }
72 
74 {
75  CX_LOG_ERROR() << "Q_OBJECTExportDataTypeWidget::exportButtonClicked()";
76 }
77 
79 {
80  CX_LOG_ERROR() << "Q_OBJECTExportDataTypeWidget::exportAllButtonClicked()";
81 }
82 
83 }
Q_OBJECTExportDataTypeWidget(QWidget *parent, QString dataType, FileManagerServicePtr filemanager, VisServicesPtr services, SelectDataStringPropertyBasePtr property)
boost::shared_ptr< class FileManagerService > FileManagerServicePtr
std::vector< QCheckBox * > mCheckboxes
boost::shared_ptr< class VisServices > VisServicesPtr
Definition: cxMainWindow.h:40
SelectDataStringPropertyBasePtr mSelectedData
boost::shared_ptr< class SelectDataStringPropertyBase > SelectDataStringPropertyBasePtr
static QFrame * createHorizontalLine()
Creates a horizontal line which can be inserted into widgets.
#define CX_LOG_ERROR
Definition: cxLogger.h:99
Interface for QWidget which handles widgets uniformly for the system.
Definition: cxBaseWidget.h:88
#define CX_LOG_DEBUG
Definition: cxLogger.h:95
void setOptions(QString uid, std::vector< PropertyPtr > options, bool showAdvanced)
Namespace for all CustusX production code.