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.
17 #include "support/FileName.h"
22 #include <QWaitCondition>
30 * The options that are used by the Comparison algorithm
31 * and are set in the GuiCompare Dialog.
33 class CompareOptions {
37 : settings_from_new(0)
40 /// Copy the settings from the new or old document
41 bool settings_from_new;
45 * A threaded object that does the Comparison between two documents
46 * and creates a new document with the differences marked with track
49 class Compare : public QThread
55 Compare(Buffer const * const old_buf, Buffer const * const new_buf,
56 Buffer * const dest_buf, CompareOptions const & options);
64 /// The thread has finished due to an error.
67 /// The thread has finished. If the thread is cancelled
68 /// by the user \c aborted is true.
69 void finished(bool aborted) const;
71 /// Adds \c progress to the value of the progress bar in the dialog
72 void progress(int progress) const ;
74 /// Sets the maximum value of the progress bar in the dialog.
75 void progressMax(int max) const;
77 /// A message describing the process
78 void statusMessage(QString msg) const;
81 /// Emits the status message signal
82 void doStatusMessage();
85 /// \name QThread inherited methods
94 /// Starts the comparison algorithm
97 /// The new document's buffer
98 Buffer const * const new_buffer;
99 /// The old document's buffer
100 Buffer const * const old_buffer;
101 /// The buffer with the differences marked with track changes
102 Buffer * const dest_buffer;
104 /// The options that are set in the GuiCompare dialog
105 CompareOptions options_;
108 QWaitCondition condition_;
110 /// Emit a statusMessage signal from time to time
111 QTimer status_timer_;
113 /// Use the Pimpl idiom to hide the internals.