CustusX  22.04-rc5
An IGT application
cxFilePreviewWidget.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 CXFILEPREVIEWWIDGET_H_
13 #define CXFILEPREVIEWWIDGET_H_
14 
15 #include "cxResourceWidgetsExport.h"
16 
17 #include "cxFileWatcherWidget.h"
18 class QTextDocument;
19 class QTextEdit;
20 class QPushButton;
21 #include <QSyntaxHighlighter>
22 
23 namespace cx
24 {
25 typedef boost::shared_ptr<class FilePreviewProperty> FilePreviewPropertyPtr;
26 
37 class cxResourceWidgets_EXPORT FilePreviewWidget: public FileWatcherWidget
38 {
39  Q_OBJECT
40 
41 public:
42  FilePreviewWidget(QWidget* parent, FilePreviewPropertyPtr dataInterface = FilePreviewPropertyPtr(), QGridLayout* gridLayout = 0, int row = 0);
43  virtual ~FilePreviewWidget();
44 
45  template<class SYNTAXHIGHLIGHTER>
47  {
48  delete mSyntaxHighlighter;
49  mSyntaxHighlighter = new SYNTAXHIGHLIGHTER(mTextDocument);
50  }
51 
52 public slots:
53  virtual void previewFileSlot(const QString& absoluteFilePath);
54  void saveSlot();
55  void textChangedSlot();
56 
57 protected slots:
58  void fileinterfaceChanged();
59 
60 private:
61  //void watchFile(bool on);
62  void createAndAddEditorLayout(QGridLayout *gridLayout, int row);
63 
64  FilePreviewPropertyPtr mData;
65 
66  QTextDocument* mTextDocument;
67  QTextEdit* mTextEdit;
68  //QLabel* mFileNameLabel;
69  QSyntaxHighlighter* mSyntaxHighlighter;
70 
71  QPushButton* mSaveButton;
72 
73  //QFileSystemWatcher* mFileSystemWatcher;
74  //boost::shared_ptr<QFile> mCurrentFile;
75 };
76 
77 }
78 
79 #endif /* CXFILEPREVIEWWIDGET_H_ */
boost::shared_ptr< class FilePreviewProperty > FilePreviewPropertyPtr
View a xml document.
Baseclass for widgets that should watch a file.
Namespace for all CustusX production code.