2 * \file QViewSourceDialog.C
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
8 * \author Abdelrazak Younes
10 * Full author contact details are available in file CREDITS.
15 #include "QViewSourceDialog.h"
17 #include "QViewSource.h"
23 QViewSourceDialog::QViewSourceDialog(QViewSource * form)
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()));
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);
53 void QViewSourceDialog::update()
55 if (autoUpdateCB->isChecked())
56 form_->update(viewFullSourceCB->isChecked());
61 } // namespace frontend
64 #include "QViewSourceDialog_moc.cpp"