]> git.lyx.org Git - lyx.git/blob - src/frontends/qt4/GuiCompare.h
Adds the user interface for the new Comparison feature.
[lyx.git] / src / frontends / qt4 / GuiCompare.h
1 // -*- C++ -*-\r
2 /**\r
3  * \file GuiCompare.h\r
4  * This file is part of LyX, the document processor.\r
5  * Licence details can be found in the file COPYING.\r
6  *\r
7  * \author Vincent van Ravesteijn\r
8  *\r
9  * Full author contact details are available in file CREDITS.\r
10  */\r
11 \r
12 #ifndef GUICOMPARE_H\r
13 #define GUICOMPARE_H\r
14 \r
15 #include "GuiDialog.h"\r
16 #include "ui_CompareUi.h"\r
17 #include "qt_helpers.h"\r
18 \r
19 #include "Compare.h"\r
20 \r
21 namespace lyx {\r
22 namespace frontend {\r
23 \r
24 \r
25 class GuiCompare : public GuiDialog, public Ui::CompareUi\r
26 {\r
27         Q_OBJECT\r
28 \r
29 public:\r
30         ///\r
31         GuiCompare(GuiView & lv);\r
32         ~GuiCompare();\r
33 \r
34         void closeEvent(QCloseEvent *);\r
35                 \r
36 private Q_SLOTS:\r
37         ///\r
38         void slotOK();\r
39         ///\r
40         void slotCancel();\r
41         ///\r
42         void change_adaptor();\r
43         ///\r
44         void select_newfile();\r
45         ///\r
46         void select_oldfile();\r
47 \r
48         ///\r
49         void finished(bool aborted);\r
50         ///\r
51         void nextIt(int);\r
52         ///\r
53         void progress_max(int) const;\r
54 \r
55 private:\r
56         ///\r
57         void updateContents();\r
58         ///\r
59         bool isValid();\r
60         ///\r
61         bool initialiseParams(std::string const &) { return true; }\r
62         ///\r
63         bool isBufferDependent() const { return false; }\r
64         ///\r
65         void clearParams() {}\r
66         ///\r
67         void dispatchParams() {}\r
68         ///\r
69         void apply() {}\r
70 \r
71 \r
72         /// enable or disable all controls and rename the Close/Cancel button\r
73         void enableControls(bool enable) const;\r
74         \r
75         /// browse for a file\r
76         QString browse(QString const & in_name) const;\r
77         /// retrieve the buffer from the specified filename\r
78         Buffer const * bufferFromFileName(std::string const & file) const;\r
79 \r
80         /// create the compare object and run the comparison\r
81         int run();\r
82 \r
83 private:\r
84         /// the object that will do the comparison\r
85         Compare * compare_;\r
86 \r
87         /// the buffer that will contain the result\r
88         Buffer * dest_buffer_;\r
89         /// the buffer that will contain the result\r
90         Buffer const * old_buffer_;\r
91         /// the buffer that will contain the result\r
92         Buffer const * new_buffer_;\r
93 \r
94         /// the window title\r
95         mutable QString window_title_;\r
96 };\r
97 \r
98 \r
99 \r
100 } // namespace frontend\r
101 } // namespace lyx\r
102 \r
103 #endif // GUICOMPARE_H\r