From 03ee407c346845484629c2a6afef39a13f0b9a3d Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Wed, 5 Feb 2020 20:23:53 -0500 Subject: fixed LogModel not being thread safe optimizations: - create BrowserDialog on demand - scroll to bottom of log in a timer, coalesces fast logging - disabled md5 of dlls --- src/loglist.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'src/loglist.cpp') diff --git a/src/loglist.cpp b/src/loglist.cpp index 5d6710c7..af0e6768 100644 --- a/src/loglist.cpp +++ b/src/loglist.cpp @@ -27,7 +27,6 @@ const std::size_t MaxLines = 1000; LogModel::LogModel() { - connect(this, &LogModel::entryAdded, [&](auto&& e){ onEntryAdded(e); }); } void LogModel::create() @@ -42,7 +41,8 @@ LogModel& LogModel::instance() void LogModel::add(MOBase::log::Entry e) { - emit entryAdded(std::move(e)); + QMetaObject::invokeMethod( + this, [this, e]{ onEntryAdded(std::move(e)); }, Qt::QueuedConnection); } void LogModel::clear() @@ -173,13 +173,16 @@ LogList::LogList(QWidget* parent) this, &QWidget::customContextMenuRequested, [&](auto&& pos){ onContextMenu(pos); }); - connect( - model(), SIGNAL(rowsInserted(const QModelIndex &, int, int)), - this, SLOT(scrollToBottom())); + connect(model(), &LogModel::rowsInserted, [&]{ onNewEntry(); }); + connect(model(), &LogModel::dataChanged, [&]{ onNewEntry(); }); - connect( - model(), SIGNAL(dataChanged(QModelIndex,QModelIndex)), - this, SLOT(scrollToBottom())); + m_timer.setSingleShot(true); + connect(&m_timer, &QTimer::timeout, [&]{ scrollToBottom(); }); +} + +void LogList::onNewEntry() +{ + m_timer.start(std::chrono::milliseconds(10)); } void LogList::setCore(OrganizerCore& core) -- cgit v1.3.1 From b7e51b65e832cfbd94789bc0cf3ab015a394aa92 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Wed, 5 Feb 2020 20:37:18 -0500 Subject: removed bad minimum column width in the data tab fixed crash in log when restart MO --- src/datatab.cpp | 2 +- src/filetree.cpp | 4 ---- src/filetree.h | 1 - src/loglist.cpp | 4 ++-- src/mainwindow.ui | 3 --- 5 files changed, 3 insertions(+), 11 deletions(-) (limited to 'src/loglist.cpp') diff --git a/src/datatab.cpp b/src/datatab.cpp index 74fa35ce..4c42339f 100644 --- a/src/datatab.cpp +++ b/src/datatab.cpp @@ -25,9 +25,9 @@ DataTab::DataTab( mwui->dataTabShowOnlyConflicts, mwui->dataTabShowFromArchives} { m_filetree.reset(new FileTree(core, m_pluginContainer, ui.tree)); - m_filter.setUseSourceSort(true); m_filter.setEdit(mwui->dataTabFilter); m_filter.setList(mwui->dataTree); + m_filter.setUseSourceSort(true); if (auto* m=m_filter.proxyModel()) { m->setDynamicSortFilter(false); diff --git a/src/filetree.cpp b/src/filetree.cpp index ae1fddfe..67fd68c1 100644 --- a/src/filetree.cpp +++ b/src/filetree.cpp @@ -296,10 +296,6 @@ void FileTree::openModInfo() } } -void FileTree::toggleVisibility() -{ -} - void FileTree::toggleVisibility(bool visible) { auto* item = singleSelection(); diff --git a/src/filetree.h b/src/filetree.h index 855a1751..d55b321c 100644 --- a/src/filetree.h +++ b/src/filetree.h @@ -31,7 +31,6 @@ public: void exploreOrigin(); void openModInfo(); - void toggleVisibility(); void hide(); void unhide(); diff --git a/src/loglist.cpp b/src/loglist.cpp index af0e6768..28aae0ff 100644 --- a/src/loglist.cpp +++ b/src/loglist.cpp @@ -173,8 +173,8 @@ LogList::LogList(QWidget* parent) this, &QWidget::customContextMenuRequested, [&](auto&& pos){ onContextMenu(pos); }); - connect(model(), &LogModel::rowsInserted, [&]{ onNewEntry(); }); - connect(model(), &LogModel::dataChanged, [&]{ onNewEntry(); }); + connect(model(), &LogModel::rowsInserted, this, [&]{ onNewEntry(); }); + connect(model(), &LogModel::dataChanged, this, [&]{ onNewEntry(); }); m_timer.setSingleShot(true); connect(&m_timer, &QTimer::timeout, [&]{ scrollToBottom(); }); diff --git a/src/mainwindow.ui b/src/mainwindow.ui index acf6767f..b54d54f8 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -1092,9 +1092,6 @@ p, li { white-space: pre-wrap; } true - - 400 - -- cgit v1.3.1