]> git.lyx.org Git - lyx.git/blob - src/frontends/qt/GuiCompare.h
#12576 improved file name chooser implementation for GUI dialogs
[lyx.git] / src / frontends / qt / 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
17 #include "ui_CompareUi.h"
18
19 namespace lyx {
20
21 class Compare;
22
23 namespace frontend {
24
25
26 class GuiCompare : public GuiDialog, public Ui::CompareUi
27 {
28         Q_OBJECT
29
30 public:
31         ///
32         GuiCompare(GuiView & lv);
33         ~GuiCompare();
34
35         void closeEvent(QCloseEvent *) override;
36
37 private Q_SLOTS:
38         ///
39         void slotOK();
40         ///
41         void slotCancel();
42         ///
43         void slotButtonBox(QAbstractButton *);
44         ///
45         void changeAdaptor();
46         ///
47         void selectNewFile();
48         ///
49         void selectOldFile();
50
51         ///
52         void error();
53         ///
54         void finished(bool aborted);
55         ///
56         void progress(int);
57         ///
58         void progressMax(int) const;
59         ///
60         void setStatusMessage(QString const &);
61
62 private:
63         ///
64         void updateContents() override;
65         ///
66         bool isValid() override;
67         ///
68         bool initialiseParams(std::string const &) override;
69         ///
70         bool isBufferDependent() const override { return false; }
71         ///
72         void clearParams() override {}
73         ///
74         void dispatchParams() override {}
75         ///
76         void apply() override {}
77
78
79         /// enable or disable all controls and rename the Close/Cancel button
80         void enableControls(bool enable);
81
82         /// browse for a file
83         QString browse(QString const & in_name);
84         /// retrieve the buffer from the specified filename
85         Buffer const * bufferFromFileName(std::string const & file) const;
86
87         /// create the compare object and run the comparison
88         ///  if blocking_mode is true, run should execute so that the caller can block to wait for the results
89         int run(bool blocking_mode = false);
90
91 private:
92         /// the object that will do the comparison
93         Compare * compare_;
94
95         /// the buffer that will contain the result
96         Buffer * dest_buffer_;
97         /// the buffer that will contain the result
98         Buffer const * old_buffer_;
99         /// the buffer that will contain the result
100         Buffer const * new_buffer_;
101 };
102
103
104
105 } // namespace frontend
106 } // namespace lyx
107
108 #endif // GUICOMPARE_H