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