NorMIT-nav  18.04
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 {
36 class cxResourceWidgets_EXPORT FilePreviewWidget: public FileWatcherWidget
37 {
38  Q_OBJECT
39 
40 public:
41  FilePreviewWidget(QWidget* parent);
42  virtual ~FilePreviewWidget();
43 
44  template<class SYNTAXHIGHLIGHTER>
46  {
47  delete mSyntaxHighlighter;
48  mSyntaxHighlighter = new SYNTAXHIGHLIGHTER(mTextDocument);
49  }
50 
51 public slots:
52  virtual void previewFileSlot(const QString& absoluteFilePath);
53  void saveSlot();
54  void textChangedSlot();
55 
56 private:
57  //void watchFile(bool on);
58 
59  QTextDocument* mTextDocument;
60  QTextEdit* mTextEdit;
61  //QLabel* mFileNameLabel;
62  QSyntaxHighlighter* mSyntaxHighlighter;
63 
64  QPushButton* mSaveButton;
65 
66  //QFileSystemWatcher* mFileSystemWatcher;
67  //boost::shared_ptr<QFile> mCurrentFile;
68 };
69 
70 }
71 
72 #endif /* CXFILEPREVIEWWIDGET_H_ */
View a xml document.
Baseclass for widgets that should watch a file.
Namespace for all CustusX production code.