]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiInclude.h
Transfer some more dialog related code from core to frontend:
[lyx.git] / src / frontends / qt4 / GuiInclude.h
1 // -*- C++ -*-
2 /**
3  * \file GuiInclude.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Alejandro Aguilar Sierra
8  * \author Angus Leeming
9  * \author John Levon
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #ifndef GUIINCLUDE_H
15 #define GUIINCLUDE_H
16
17 #include "GuiDialog.h"
18 #include "ui_IncludeUi.h"
19
20 #include "insets/InsetCommandParams.h"
21
22 #include "support/docstring.h"
23
24
25 namespace lyx {
26 namespace frontend {
27
28 class GuiInclude : public GuiCommand, public Ui::IncludeUi
29 {
30         Q_OBJECT
31
32 public:
33         GuiInclude(GuiView & lv);
34
35 private Q_SLOTS:
36         void change_adaptor();
37         /// edit the child document, .lyx file will be opened in lyx
38         /// other formats will be edited by external applications.
39         void edit();
40         /// browse for a file
41         void browse();
42         ///
43         void typeChanged(int v);
44         /// AFAIK, QValidator only works for QLineEdit so
45         /// I have to validate listingsED (QTextEdit) manually.
46         /// This function displays a hint or error message returned by
47         /// validate_listings_params
48         void set_listings_msg();
49
50 private:
51         ///
52         enum Type {
53                 ///
54                 INPUT,
55                 ///
56                 VERBATIM,
57                 ///
58                 INCLUDE,
59                 ///
60                 LISTINGS,
61         };
62         ///
63         void closeEvent(QCloseEvent * e);
64         ///
65         void updateLists();
66         /// validate listings parameters and return an error message, if any
67         docstring validate_listings_params();
68         ///
69         void edit(std::string const & file);
70         ///
71         bool isValid();
72         /// Apply changes
73         void applyView();
74         /// update
75         void updateContents();
76         ///
77         bool isBufferDependent() const { return true; }
78         /// Browse for a file
79         docstring browse(docstring const &, Type) const;
80 };
81
82 } // namespace frontend
83 } // namespace lyx
84
85 #endif // GUIINCLUDE_H