summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/envmodule.cpp11
-rw-r--r--src/loglist.cpp19
-rw-r--r--src/loglist.h6
-rw-r--r--src/mainwindow.cpp30
-rw-r--r--src/mainwindow.h4
5 files changed, 50 insertions, 20 deletions
diff --git a/src/envmodule.cpp b/src/envmodule.cpp
index 5be52de6..2ff5027d 100644
--- a/src/envmodule.cpp
+++ b/src/envmodule.cpp
@@ -8,6 +8,12 @@ namespace env
using namespace MOBase;
+// the rationale for logging md5 was to make sure the various files were the
+// same as in the released version; this turned out to be of dubious interest,
+// while adding to the startup time
+constexpr bool UseMD5 = false;
+
+
Module::Module(QString path, std::size_t fileSize)
: m_path(std::move(path)), m_fileSize(fileSize)
{
@@ -16,7 +22,10 @@ Module::Module(QString path, std::size_t fileSize)
m_version = getVersion(fi.ffi);
m_timestamp = getTimestamp(fi.ffi);
m_versionString = fi.fileDescription;
- m_md5 = getMD5();
+
+ if (UseMD5) {
+ m_md5 = getMD5();
+ }
}
const QString& Module::path() const
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)
diff --git a/src/loglist.h b/src/loglist.h
index 36671be4..56b95d65 100644
--- a/src/loglist.h
+++ b/src/loglist.h
@@ -48,9 +48,6 @@ protected:
QVariant headerData(
int section, Qt::Orientation ori, int role=Qt::DisplayRole) const override;
-signals:
- void entryAdded(MOBase::log::Entry e);
-
private:
std::deque<MOBase::log::Entry> m_entries;
@@ -75,7 +72,10 @@ public:
private:
OrganizerCore* m_core;
+ QTimer m_timer;
+
void onContextMenu(const QPoint& pos);
+ void onNewEntry();
};
#endif // LOGBUFFER_H
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 <http://www.gnu.org/licenses/>.
#include "localsavegames.h"
#include "listdialog.h"
#include "envshortcut.h"
+#include "browserdialog.h"
#include <QAbstractItemDelegate>
#include <QAbstractProxyModel>
@@ -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<IPluginModPage*>(triggeredAction->data().value<QObject*>());
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()));
}
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 608bfa64..afc434ef 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -21,7 +21,6 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#define MAINWINDOW_H
#include "bsafolder.h"
-#include "browserdialog.h"
#include "delayedfilewriter.h"
#include "errorcodes.h"
#include "imoinfo.h"
@@ -39,6 +38,7 @@ class CategoryFactory;
class OrganizerCore;
class FilterList;
class DataTab;
+class BrowserDialog;
class PluginListSortProxy;
namespace BSA { class Archive; }
@@ -341,7 +341,7 @@ private:
QString m_CurrentLanguage;
std::vector<QTranslator*> m_Translators;
- BrowserDialog m_IntegratedBrowser;
+ std::unique_ptr<BrowserDialog> m_IntegratedBrowser;
QFileSystemWatcher m_SavesWatcher;