Fix Error dialog. Patch from Richard and Abdel.

http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg158649.html
http://www.mail-archive.com/lyx-devel@lists.lyx.org/msg158658.html


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33732 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Pavel Sanda 2010-03-13 11:39:50 +00:00
parent 559537c080
commit 9be4767f27
3 changed files with 30 additions and 8 deletions

View File

@ -3300,17 +3300,26 @@ bool Buffer::doExport(string const & format, bool put_in_tempdir,
bool const success = theConverters().convert(this, FileName(filename), bool const success = theConverters().convert(this, FileName(filename),
tmp_result_file, FileName(absFileName()), backend_format, format, tmp_result_file, FileName(absFileName()), backend_format, format,
error_list); error_list);
// Emit the signal to show the error list.
// Emit the signal to show the error list or copy it back to the
// cloned Buffer so that it cab be emitted afterwards.
if (format != backend_format) { if (format != backend_format) {
errors(error_type); if (d->cloned_buffer_) {
d->cloned_buffer_->d->errorLists[error_type] =
d->errorLists[error_type];
} else
errors(error_type);
// also to the children, in case of master-buffer-view // also to the children, in case of master-buffer-view
std::vector<Buffer *> clist = getChildren(); std::vector<Buffer *> clist = getChildren();
for (vector<Buffer *>::const_iterator cit = clist.begin(); for (vector<Buffer *>::const_iterator cit = clist.begin();
cit != clist.end(); ++cit) cit != clist.end(); ++cit) {
(*cit)->errors(error_type, true); if (d->cloned_buffer_) {
(*cit)->d->cloned_buffer_->d->errorLists[error_type] =
(*cit)->d->errorLists[error_type];
} else
(*cit)->errors(error_type, true);
}
} }
if (!success)
return false;
if (d->cloned_buffer_) { if (d->cloned_buffer_) {
// Enable reverse dvi or pdf to work by copying back the texrow // Enable reverse dvi or pdf to work by copying back the texrow
@ -3318,8 +3327,13 @@ bool Buffer::doExport(string const & format, bool put_in_tempdir,
// FIXME: There is a possibility of concurrent access to texrow // FIXME: There is a possibility of concurrent access to texrow
// here from the main GUI thread that should be securized. // here from the main GUI thread that should be securized.
d->cloned_buffer_->d->texrow = d->texrow; d->cloned_buffer_->d->texrow = d->texrow;
string const error_type = bufferFormat();
d->cloned_buffer_->d->errorLists[error_type] = d->errorLists[error_type];
} }
if (!success)
return false;
if (put_in_tempdir) { if (put_in_tempdir) {
result_file = tmp_result_file.absFilename(); result_file = tmp_result_file.absFilename();
return true; return true;

View File

@ -108,8 +108,9 @@ void GuiErrorList::paramsToDialog()
errorsLW->clear(); errorsLW->clear();
descriptionTB->setPlainText(QString()); descriptionTB->setPlainText(QString());
ErrorList::const_iterator it = errorList().begin(); ErrorList const & el = errorList();
ErrorList::const_iterator end = errorList().end(); ErrorList::const_iterator it = el.begin();
ErrorList::const_iterator end = el.end();
for (; it != end; ++it) for (; it != end; ++it)
errorsLW->addItem(toqstr(it->error)); errorsLW->addItem(toqstr(it->error));
errorsLW->setCurrentRow(0); errorsLW->setCurrentRow(0);

View File

@ -351,6 +351,8 @@ public:
/// ///
QFutureWatcher<docstring> autosave_watcher_; QFutureWatcher<docstring> autosave_watcher_;
QFutureWatcher<docstring> preview_watcher_; QFutureWatcher<docstring> preview_watcher_;
///
string last_export_format;
#else #else
struct DummyWatcher { bool isRunning(){return false;} }; struct DummyWatcher { bool isRunning(){return false;} };
DummyWatcher preview_watcher_; DummyWatcher preview_watcher_;
@ -447,6 +449,7 @@ void GuiView::threadFinished()
QFutureWatcher<docstring> const * watcher = QFutureWatcher<docstring> const * watcher =
static_cast<QFutureWatcher<docstring> const *>(sender()); static_cast<QFutureWatcher<docstring> const *>(sender());
message(watcher->result()); message(watcher->result());
errors(d.last_export_format);
#endif #endif
} }
@ -2824,6 +2827,7 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
QFuture<docstring> f = QtConcurrent::run(exportAndDestroy, QFuture<docstring> f = QtConcurrent::run(exportAndDestroy,
doc_buffer->clone(), format); doc_buffer->clone(), format);
d.setPreviewFuture(f); d.setPreviewFuture(f);
d.last_export_format = doc_buffer->bufferFormat();
#else #else
bool const update_unincluded = bool const update_unincluded =
doc_buffer->params().maintain_unincluded_children doc_buffer->params().maintain_unincluded_children
@ -2844,6 +2848,7 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
QFuture<docstring> f = QtConcurrent::run(previewAndDestroy, QFuture<docstring> f = QtConcurrent::run(previewAndDestroy,
doc_buffer->clone(), format); doc_buffer->clone(), format);
d.setPreviewFuture(f); d.setPreviewFuture(f);
d.last_export_format = doc_buffer->bufferFormat();
#else #else
bool const update_unincluded = bool const update_unincluded =
doc_buffer->params().maintain_unincluded_children doc_buffer->params().maintain_unincluded_children
@ -2863,6 +2868,7 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
QFuture<docstring> f = QtConcurrent::run(exportAndDestroy, QFuture<docstring> f = QtConcurrent::run(exportAndDestroy,
master->clone(), format); master->clone(), format);
d.setPreviewFuture(f); d.setPreviewFuture(f);
d.last_export_format = doc_buffer->bufferFormat();
#else #else
bool const update_unincluded = bool const update_unincluded =
master->params().maintain_unincluded_children master->params().maintain_unincluded_children
@ -2880,6 +2886,7 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
QFuture<docstring> f = QtConcurrent::run(previewAndDestroy, QFuture<docstring> f = QtConcurrent::run(previewAndDestroy,
master->clone(), format); master->clone(), format);
d.setPreviewFuture(f); d.setPreviewFuture(f);
d.last_export_format = doc_buffer->bufferFormat();
#else #else
master->preview(format); master->preview(format);
#endif #endif