]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/QShowFile.C
enable Font cache only for MacOSX and inline width() for other platform.
[lyx.git] / src / frontends / qt4 / QShowFile.C
1 /**
2  * \file QShowFile.C
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author John Levon
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10
11 #include <config.h>
12
13 #include "QShowFile.h"
14 #include "QShowFileDialog.h"
15 #include "Qt2BC.h"
16 #include "qt_helpers.h"
17
18 #include "controllers/ControlShowFile.h"
19
20 #include <QTextBrowser>
21 #include <QPushButton>
22
23 using std::string;
24
25 namespace lyx {
26 namespace frontend {
27
28 typedef QController<ControlShowFile, QView<QShowFileDialog> > base_class;
29
30
31 QShowFile::QShowFile(Dialog & parent)
32         : base_class(parent, lyx::to_utf8(_("Show File")))
33 {
34 }
35
36
37 void QShowFile::build_dialog()
38 {
39         dialog_.reset(new QShowFileDialog(this));
40
41         bcview().setCancel(dialog_->closePB);
42 }
43
44
45 void QShowFile::update_contents()
46 {
47         dialog_->setWindowTitle(toqstr(controller().getFileName()));
48
49         string contents = controller().getFileContents();
50         if (contents.empty()) {
51                 contents = "Error -> Cannot load file!";
52         }
53
54         dialog_->textTB->setPlainText(toqstr(contents));
55 }
56
57 } // namespace frontend
58 } // namespace lyx