]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QLog.C
Removed all redundant using directives from the source.
[lyx.git] / src / frontends / qt2 / QLog.C
1 /**
2  * \file QLog.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 "qt_helpers.h"
14 #include "ControlLog.h"
15 #include "support/std_sstream.h"
16
17 #include <qtextview.h>
18 #include <qpushbutton.h>
19
20 #include "QLogDialog.h"
21 #include "QLog.h"
22 #include "Qt2BC.h"
23
24 #include <fstream>
25
26 using std::ifstream;
27 using std::ostringstream;
28
29 typedef QController<ControlLog, QView<QLogDialog> > base_class;
30
31 QLog::QLog(Dialog & parent)
32         : base_class(parent, _("LyX: LaTeX Log"))
33 {
34 }
35
36
37 void QLog::build_dialog()
38 {
39         dialog_.reset(new QLogDialog(this));
40
41         bcview().setCancel(dialog_->closePB);
42 }
43
44
45 void QLog::update_contents()
46 {
47         std::pair<Buffer::LogType, string> const & logfile =
48                 controller().logfile();
49
50         if (logfile.first == Buffer::buildlog)
51                 setTitle(_("Build log"));
52         else
53                 setTitle(_("LaTeX log"));
54
55         dialog_->logTV->setText("");
56
57         ifstream ifstr(logfile.second.c_str());
58         if (!ifstr) {
59                 if (logfile.first == Buffer::buildlog)
60                         dialog_->logTV->setText(qt_("No build log file found."));
61                 else
62                         dialog_->logTV->setText(qt_("No LaTeX log file found."));
63                 return;
64         }
65
66         ostringstream ost;
67         ost << ifstr.rdbuf();
68
69         dialog_->logTV->setText(toqstr(ost.str()));
70 }