]> git.lyx.org Git - features.git/blob - src/frontends/qt/GuiLog.h
Guard against possible referencing null.
[features.git] / src / frontends / qt / GuiLog.h
1 // -*- C++ -*-
2 /**
3  * \file GuiLog.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author John Levon
8  * \author Angus Leeming
9  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef GUILOG_H
14 #define GUILOG_H
15
16 #include "GuiDialog.h"
17 #include "ui_LogUi.h"
18
19 #include "support/FileName.h"
20
21
22 namespace lyx {
23 namespace frontend {
24
25 class LogHighlighter;
26
27 class GuiLog : public GuiDialog, public Ui::LogUi
28 {
29         Q_OBJECT
30
31 public:
32         GuiLog(GuiView & lv);
33
34 private Q_SLOTS:
35         void updateContents() override;
36         /// find content
37         void find();
38         /// jump to next error message
39         void on_nextErrorPB_clicked();
40         /// jump to next warning
41         void on_nextWarningPB_clicked();
42         /// open containing directory
43         void on_openDirPB_clicked();
44         /// Log type changed
45         void typeChanged(int);
46
47 private:
48         /// Apply changes
49         void applyView() override {}
50
51         /// log syntax highlighter
52         LogHighlighter * highlighter;
53
54         /** \param data should contain "<logtype> <logfile>"
55          *  where <logtype> is one of "latex", "literate", "lyx2lyx", "vc".
56          */
57         bool initialiseParams(std::string const & data) override;
58         ///
59         void clearParams() override;
60         ///
61         void dispatchParams() override {}
62         ///
63         bool isBufferDependent() const override { return true; }
64
65         /// The title displayed by the dialog reflects the \c LogType
66         docstring title() const;
67         /// put the log file into the ostream
68         void getContents(std::ostream & ss) const;
69 #if QT_VERSION < 0x060000
70         /// go to the next occurrence of the RegExp
71         void goTo(QRegExp const & exp) const;
72         /// does the document after cursor position contain the RegExp?
73         bool contains(QRegExp const & exp) const;
74 #else
75         /// go to the next occurrence of the RegExp
76         void goTo(QRegularExpression const & exp) const;
77         /// does the document after cursor position contain the RegExp?
78         bool contains(QRegularExpression const & exp) const;
79 #endif
80
81 private:
82         /// Recognized log file-types
83         enum LogType {
84                 LatexLog,
85                 LiterateLog,
86                 Lyx2lyxLog,
87                 VCLog
88         };
89
90         LogType type_;
91         support::FileName logfile_;
92 };
93
94
95 } // namespace frontend
96 } // namespace lyx
97
98 #endif // GUILOG_H