Fix the 100% cpu load problem when previewing with Qt 4.2 and 4.3.

Now it works fine again with those Qt versions.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36235 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Enrico Forestieri 2010-11-10 15:35:56 +00:00
parent 74a3fa9cf1
commit 91208a2f79

View File

@ -497,6 +497,7 @@ QVector<GuiWorkArea*> GuiView::GuiViewPrivate::guiWorkAreas()
} }
#if QT_VERSION >= 0x040400
void GuiView::setCursorShapes(Qt::CursorShape shape) void GuiView::setCursorShapes(Qt::CursorShape shape)
{ {
QVector<GuiWorkArea*> areas = d.guiWorkAreas(); QVector<GuiWorkArea*> areas = d.guiWorkAreas();
@ -549,7 +550,6 @@ void GuiView::processingThreadStarted()
void GuiView::processingThreadFinished() void GuiView::processingThreadFinished()
{ {
#if (QT_VERSION >= 0x040400)
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());
@ -558,9 +558,40 @@ void GuiView::processingThreadFinished()
d.processing_cursor_timer_.stop(); d.processing_cursor_timer_.stop();
restoreCursorShapes(); restoreCursorShapes();
d.indicates_processing_ = false; d.indicates_processing_ = false;
#endif
} }
#else
void GuiView::setCursorShapes(Qt::CursorShape)
{
}
void GuiView::restoreCursorShapes()
{
}
void GuiView::saveCursorShapes()
{
}
void GuiView::indicateProcessing()
{
}
void GuiView::processingThreadStarted()
{
}
void GuiView::processingThreadFinished()
{
}
#endif
void GuiView::saveLayout() const void GuiView::saveLayout() const
{ {
@ -2942,12 +2973,12 @@ bool GuiView::GuiViewPrivate::asyncBufferProcessing(
if (!used_buffer) if (!used_buffer)
return false; return false;
gv_->processingThreadStarted();
string format = argument; string format = argument;
if (format.empty()) if (format.empty())
format = used_buffer->getDefaultOutputFormat(); format = used_buffer->getDefaultOutputFormat();
#if EXPORT_in_THREAD && (QT_VERSION >= 0x040400) #if EXPORT_in_THREAD && (QT_VERSION >= 0x040400)
gv_->processingThreadStarted();
if (!msg.empty()) { if (!msg.empty()) {
progress_->clearMessages(); progress_->clearMessages();
gv_->message(msg); gv_->message(msg);
@ -2972,7 +3003,6 @@ bool GuiView::GuiViewPrivate::asyncBufferProcessing(
!used_buffer->params().getIncludedChildren().empty(); !used_buffer->params().getIncludedChildren().empty();
return (used_buffer->*syncFunc)(format, true, update_unincluded); return (used_buffer->*syncFunc)(format, true, update_unincluded);
} else if (previewFunc) { } else if (previewFunc) {
// TODO includeall must be false or we get a 100% busy thread, a bug?
return (used_buffer->*previewFunc)(format, false); return (used_buffer->*previewFunc)(format, false);
} }
(void) asyncFunc; (void) asyncFunc;