NorMIT-nav  2023.01.05-dev+develop.0da12
An IGT application
cxImportWidget.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) 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 #ifndef CXIMPORTWIDGET_H
13 #define CXIMPORTWIDGET_H
14 
15 #include <QDialog>
16 #include "cxBaseWidget.h"
17 #include "cxFileManagerService.h"
18 #include "org_custusx_core_filemanager_Export.h"
19 
20 class QTableWidget;
21 class QStackedWidget;
22 class QPushButton;
23 class QProgressDialog;
24 
25 namespace cx
26 {
27 class ImportDataTypeWidget;
28 
29 class org_custusx_core_filemanager_EXPORT SimpleImportDataDialog : public QDialog
30 {
31  Q_OBJECT
32 public:
33  SimpleImportDataDialog(ImportDataTypeWidget *widget, QWidget* parent=NULL);
35 private slots:
36  void tableItemSelected(int currentRow, int currentColumn, int previousRow, int previousColumn);
37  void cancelClicked();
38 private:
39  ImportDataTypeWidget* mImportDataTypeWidget;
40 };
41 
42 class org_custusx_core_filemanager_EXPORT ImportWidget : public BaseWidget
43 {
44  Q_OBJECT
45 
46 public:
47  ImportWidget(FileManagerServicePtr filemanager, VisServicesPtr services);
48 
49 signals:
50  void readyToImport();
51  void finishedImporting();
52  void parentCandidatesUpdated();
53 
54 private slots:
55  void addFilesForImportWithDialogTriggerend();
56  void importButtonClicked();
57  void cancelButtonClicked();
58  ImportDataTypeWidget *addMoreFilesButtonClicked();
59  void removeWidget(QWidget *widget);
60  void removeRowFromTableAndRemoveFilenameFromImportList();
61 
62  void tableItemSelected(int currentRow, int currentColumn, int previousRow, int previousColumn);
63  void cleanUpAfterImport();
64 
65 private:
66  QStringList openFileBrowserForSelectingFiles();
67  QString generateFileTypeFilter() const;
68 
69  QString generateUid(QString filename) const;
70  void generateParentCandidates();
71  int insertDataIntoTable(QString filename, std::vector<DataPtr> data);
72  void clearData();
73  QStringList removeDirIfSubdirIsIncluded(QStringList importFiles);
74  void showProgressDialog(QProgressDialog &progress);
75 
76  QTableWidget* mTableWidget;
77  QStringList mTableHeader;
78  int mSelectedIndexInTable;
79 
80  QStackedWidget *mStackedWidget;
81 
82  QStringList mFileNames;
83  std::vector<DataPtr> mParentCandidates;
84  std::vector<DataPtr> mNotImportedData;
85 
86  FileManagerServicePtr mFileManager;
87  VisServicesPtr mVisServices;
88 
89  QVBoxLayout * mTopLayout;
90 };
91 
92 }
93 #endif // CXIMPORTWIDGET_H
cx::ImportWidget
Definition: cxImportWidget.h:42
cxFileManagerService.h
cxBaseWidget.h
cx
Namespace for all CustusX production code.
Definition: cx_dev_group_definitions.h:13
cx::BaseWidget
Interface for QWidget which handles widgets uniformly for the system.
Definition: cxBaseWidget.h:88
cx::SimpleImportDataDialog::~SimpleImportDataDialog
virtual ~SimpleImportDataDialog()
Definition: cxImportWidget.h:34
cx::VisServicesPtr
boost::shared_ptr< class VisServices > VisServicesPtr
Definition: cxMainWindow.h:40
cx::SimpleImportDataDialog
Definition: cxImportWidget.h:29
cx::FileManagerServicePtr
boost::shared_ptr< class FileManagerService > FileManagerServicePtr
Definition: cxLogicManager.h:31
cx::ImportDataTypeWidget
Definition: cxImportDataTypeWidget.h:33