4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Vincent van Ravesteijn
9 * Full author contact details are available in file CREDITS.
20 #include <QWaitCondition>
26 * The options that are used by the Comparison algorithm
27 * and are set in the GuiCompare Dialog.
29 class CompareOptions {
33 : settings_from_new(0)
36 /// Copy the settings from the new or old document
37 bool settings_from_new;
41 * A threaded object that does the Comparison between two documents
42 * and creates a new document with the differences marked with track
45 class Compare : public QThread
51 Compare(Buffer const * const old_buf, Buffer const * const new_buf,
52 Buffer * const dest_buf, CompareOptions const & options);
60 /// The thread has finished due to an error.
63 /// The thread has finished. If the thread is cancelled
64 /// by the user \c aborted is true.
65 void finished(bool aborted) const;
67 /// Adds \c progress to the value of the progress bar in the dialog
68 void progress(int progress) const ;
70 /// Sets the maximum value of the progress bar in the dialog.
71 void progressMax(int max) const;
73 /// A message describing the process
74 void statusMessage(QString msg) const;
77 /// Emits the status message signal
78 void doStatusMessage();
81 /// \name QThread inherited methods
90 /// Starts the comparison algorithm
93 /// The new document's buffer
94 Buffer const * const new_buffer;
95 /// The old document's buffer
96 Buffer const * const old_buffer;
97 /// The buffer with the differences marked with track changes
98 Buffer * const dest_buffer;
100 /// The options that are set in the GuiCompare dialog
101 CompareOptions options_;
104 QWaitCondition condition_;
106 /// Emit a statusMessage signal from time to time
107 QTimer status_timer_;
109 /// Use the Pimpl idiom to hide the internals.