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/mainwindow.cpp | 30 ++++++++++++++++++++++++------
1 file changed, 24 insertions(+), 6 deletions(-)
(limited to 'src/mainwindow.cpp')
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index 439775f8..130b5fe7 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -87,6 +87,7 @@ along with Mod Organizer. If not, see .
#include "localsavegames.h"
#include "listdialog.h"
#include "envshortcut.h"
+#include "browserdialog.h"
#include
#include
@@ -406,8 +407,6 @@ MainWindow::MainWindow(Settings &settings
connect(&m_OrganizerCore, &OrganizerCore::modInstalled, this, &MainWindow::modInstalled);
connect(&m_OrganizerCore, &OrganizerCore::close, this, &QMainWindow::close);
- connect(&m_IntegratedBrowser, SIGNAL(requestDownload(QUrl,QNetworkReply*)), &m_OrganizerCore, SLOT(requestDownload(QUrl,QNetworkReply*)));
-
m_CheckBSATimer.setSingleShot(true);
connect(&m_CheckBSATimer, SIGNAL(timeout()), this, SLOT(checkBSAList()));
@@ -632,7 +631,12 @@ MainWindow::~MainWindow()
m_PluginContainer.setUserInterface(nullptr, nullptr);
m_OrganizerCore.setUserInterface(nullptr);
- m_IntegratedBrowser.close();
+
+ if (m_IntegratedBrowser) {
+ m_IntegratedBrowser->close();
+ m_IntegratedBrowser.reset();
+ }
+
delete ui;
} catch (std::exception &e) {
QMessageBox::critical(nullptr, tr("Crash on exit"),
@@ -1393,7 +1397,12 @@ bool MainWindow::canExit()
void MainWindow::cleanup()
{
QWebEngineProfile::defaultProfile()->clearAllVisitedLinks();
- m_IntegratedBrowser.close();
+
+ if (m_IntegratedBrowser) {
+ m_IntegratedBrowser->close();
+ m_IntegratedBrowser = {};
+ }
+
m_SaveMetaTimer.stop();
m_MetaSave.waitForFinished();
}
@@ -1501,8 +1510,17 @@ void MainWindow::modPagePluginInvoke()
IPluginModPage *plugin = qobject_cast(triggeredAction->data().value());
if (plugin != nullptr) {
if (plugin->useIntegratedBrowser()) {
- m_IntegratedBrowser.setWindowTitle(plugin->displayName());
- m_IntegratedBrowser.openUrl(plugin->pageURL());
+
+ if (!m_IntegratedBrowser) {
+ m_IntegratedBrowser.reset(new BrowserDialog);
+
+ connect(
+ m_IntegratedBrowser.get(), SIGNAL(requestDownload(QUrl,QNetworkReply*)),
+ &m_OrganizerCore, SLOT(requestDownload(QUrl,QNetworkReply*)));
+ }
+
+ m_IntegratedBrowser->setWindowTitle(plugin->displayName());
+ m_IntegratedBrowser->openUrl(plugin->pageURL());
} else {
QDesktopServices::openUrl(QUrl(plugin->pageURL()));
}
--
cgit v1.3.1