CustusX  22.04-rc5
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 "cxBaseWidget.h"
16 #include "cxFileManagerService.h"
17 #include "org_custusx_core_filemanager_Export.h"
18 
19 class QTableWidget;
20 class QStackedWidget;
21 class QPushButton;
22 
23 namespace cx
24 {
25 
26 class org_custusx_core_filemanager_EXPORT ImportWidget : public BaseWidget
27 {
28  Q_OBJECT
29 
30 public:
31  ImportWidget(FileManagerServicePtr filemanager, VisServicesPtr services);
32 
33 signals:
34  void readyToImport();
35  void finishedImporting();
36  void parentCandidatesUpdated();
37 
38 private slots:
39  void importButtonClicked();
40  void cancelButtonClicked();
41  void addMoreFilesButtonClicked();
42  void removeWidget(QWidget *widget);
43  void removeRowFromTableAndRemoveFilenameFromImportList();
44 
45  void tableItemSelected(int currentRow, int currentColumn, int previousRow, int previousColumn);
46  void cleanUpAfterImport();
47 
48 private:
49  QStringList openFileBrowserForSelectingFiles();
50  QString generateFileTypeFilter() const;
51 
52  QString generateUid(QString filename) const;
53  void generateParentCandidates();
54  int insertDataIntoTable(QString filename, std::vector<DataPtr> data);
55  int findRowIndexContainingButton(QPushButton *button) const;
56  void clearData();
57 
58  QTableWidget* mTableWidget;
59  QStringList mTableHeader;
60  int mSelectedIndexInTable;
61 
62  QStackedWidget *mStackedWidget;
63 
64  QStringList mFileNames;
65  std::vector<DataPtr> mParentCandidates;
66  std::vector<DataPtr> mNotImportedData;
67 
68  FileManagerServicePtr mFileManager;
69  VisServicesPtr mVisServices;
70 
71  QVBoxLayout * mTopLayout;
72 };
73 
74 }
75 #endif // CXIMPORTWIDGET_H
boost::shared_ptr< class FileManagerService > FileManagerServicePtr
boost::shared_ptr< class VisServices > VisServicesPtr
Definition: cxMainWindow.h:40
Interface for QWidget which handles widgets uniformly for the system.
Definition: cxBaseWidget.h:88
Namespace for all CustusX production code.