mirror of https://github.com/KLayout/klayout.git
Supply event processing from log events also if an abstract progress is used
This commit is contained in:
parent
738e830c8d
commit
b8677f650b
|
|
@ -22,12 +22,15 @@
|
|||
|
||||
|
||||
#include "layLogViewerDialog.h"
|
||||
#include "layApplication.h"
|
||||
|
||||
#include <QMutex>
|
||||
#include <QMutexLocker>
|
||||
#include <QTimer>
|
||||
#include <QClipboard>
|
||||
#include <QFrame>
|
||||
#include <QThread>
|
||||
#include <QAbstractEventDispatcher>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
|
|
@ -221,25 +224,39 @@ LogFile::max_entries () const
|
|||
void
|
||||
LogFile::add (LogFileEntry::mode_type mode, const std::string &msg, bool continued)
|
||||
{
|
||||
QMutexLocker locker (&m_lock);
|
||||
bool can_yield = false;
|
||||
|
||||
if (m_max_entries == 0) {
|
||||
return;
|
||||
{
|
||||
QMutexLocker locker (&m_lock);
|
||||
|
||||
if (m_max_entries == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (m_messages.size () >= m_max_entries) {
|
||||
m_messages.pop_front ();
|
||||
}
|
||||
|
||||
if (mode == LogFileEntry::Warning || mode == LogFileEntry::WarningContinued) {
|
||||
m_has_warnings = true;
|
||||
} else if (mode == LogFileEntry::Error || mode == LogFileEntry::ErrorContinued) {
|
||||
m_has_errors = true;
|
||||
}
|
||||
|
||||
m_messages.push_back (LogFileEntry (mode, msg, continued));
|
||||
|
||||
++m_generation_id;
|
||||
|
||||
if (QThread::currentThread ()->eventDispatcher () && (tl::Clock::current () - m_last_yield).seconds () > 0.1) {
|
||||
m_last_yield = tl::Clock::current ();
|
||||
can_yield = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_messages.size () >= m_max_entries) {
|
||||
m_messages.pop_front ();
|
||||
// use this opportunity to process events
|
||||
if (can_yield) {
|
||||
QThread::currentThread ()->eventDispatcher ()->processEvents (QEventLoop::AllEvents);
|
||||
}
|
||||
|
||||
if (mode == LogFileEntry::Warning || mode == LogFileEntry::WarningContinued) {
|
||||
m_has_warnings = true;
|
||||
} else if (mode == LogFileEntry::Error || mode == LogFileEntry::ErrorContinued) {
|
||||
m_has_errors = true;
|
||||
}
|
||||
|
||||
m_messages.push_back (LogFileEntry (mode, msg, continued));
|
||||
|
||||
++m_generation_id;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include "ui_LogViewerDialog.h"
|
||||
#include "tlLog.h"
|
||||
#include "tlTimer.h"
|
||||
#include "layCommon.h"
|
||||
|
||||
#include <QTimer>
|
||||
|
|
@ -227,6 +228,7 @@ private:
|
|||
size_t m_last_generation_id;
|
||||
bool m_has_errors, m_has_warnings;
|
||||
bool m_last_attn;
|
||||
tl::Clock m_last_yield;
|
||||
|
||||
/**
|
||||
* @brief Adds an error
|
||||
|
|
|
|||
Loading…
Reference in New Issue