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.
18 #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), author(0)
36 /// Copy the settings from the new or old document
37 bool settings_from_new;
38 /// Author id for change tracking
43 * A threaded object that does the Comparison between two documents
44 * and creates a new document with the differences marked with track
47 class Compare : public QThread
53 Compare(Buffer const * const old_buf, Buffer const * const new_buf,
54 Buffer * const dest_buf, CompareOptions const & options);
62 /// The thread has finished due to an error.
65 /// The thread has finished. If the thread is cancelled
66 /// by the user \c aborted is true.
67 void finished(bool aborted) const;
69 /// Adds \c progress to the value of the progress bar in the dialog
70 void progress(int progress) const ;
72 /// Sets the maximum value of the progress bar in the dialog.
73 void progressMax(int max) const;
75 /// A message describing the process
76 void statusMessage(QString msg) const;
79 /// Emits the status message signal
80 void doStatusMessage();
83 /// \name QThread inherited methods
92 /// Starts the comparison algorithm
95 /// The new document's buffer
96 Buffer const * const new_buffer;
97 /// The old document's buffer
98 Buffer const * const old_buffer;
99 /// The buffer with the differences marked with track changes
100 Buffer * const dest_buffer;
102 /// The options that are set in the GuiCompare dialog
103 CompareOptions options_;
106 QWaitCondition condition_;
108 /// Emit a statusMessage signal from time to time
109 QTimer status_timer_;
111 /// Use the Pimpl idiom to hide the internals.