]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/QViewSourceDialog.C
renaming in frontends/qt4/ui: s/Q//g
[lyx.git] / src / frontends / qt4 / QViewSourceDialog.C
1 /**
2  * \file QViewSourceDialog.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  * \author Bo Peng
8  * \author Abdelrazak Younes
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #include <config.h>
14
15 #include "QViewSourceDialog.h"
16
17 #include "QViewSource.h"
18
19
20 namespace lyx {
21 namespace frontend {
22
23 QViewSourceDialog::QViewSourceDialog(QViewSource * form)
24         : form_(form)
25 {
26         setupUi(this);
27
28         connect(viewFullSourceCB, SIGNAL(clicked()),
29                 this, SLOT(update()));
30         connect(autoUpdateCB, SIGNAL(toggled(bool)),
31                 updatePB, SLOT(setDisabled(bool)));
32         connect(updatePB, SIGNAL(clicked()),
33                 this, SLOT(update()));
34
35         // setting a document at this point trigger an assertion in Qt
36         // so we disable the signals here:
37         form_->document()->blockSignals(true);
38         viewSourceTV->setDocument(form_->document());
39         form_->document()->blockSignals(false);
40         viewSourceTV->setReadOnly(true);
41         ///dialog_->viewSourceTV->setAcceptRichText(false);
42         // this is personal. I think source code should be in fixed-size font
43         QFont font(toqstr(theApp()->typewriterFontName()));
44         font.setKerning(false);
45         font.setFixedPitch(true);
46         font.setStyleHint(QFont::TypeWriter);
47         viewSourceTV->setFont(font);
48         // again, personal taste
49         viewSourceTV->setWordWrapMode(QTextOption::NoWrap);
50 }
51
52
53 void QViewSourceDialog::update()
54 {
55         if (autoUpdateCB->isChecked())
56                 form_->update(viewFullSourceCB->isChecked());
57
58         QWidget::update();
59 }
60
61 } // namespace frontend
62 } // namespace lyx
63
64 #include "QViewSourceDialog_moc.cpp"