summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mainwindow.cpp15
-rw-r--r--src/modlistbypriorityproxy.cpp5
-rw-r--r--src/modlistbypriorityproxy.h2
-rw-r--r--src/modlistview.cpp4
-rw-r--r--src/organizercore.cpp2
-rw-r--r--src/pluginlistcontextmenu.cpp70
-rw-r--r--src/profile.cpp8
7 files changed, 61 insertions, 45 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index a79aca2f..a25406dd 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -1209,8 +1209,21 @@ void MainWindow::showEvent(QShowEvent *event)
m_WasVisible = true;
updateProblemsButton();
- // Notify plugin that the MO2 is ready:
+ // notify plugins that the MO2 is ready
m_PluginContainer.startPlugins(this);
+
+ // forces a log list refresh to display startup logs
+ //
+ // since the log list is not visible until this point, the automatic
+ // resize of columns seems to break the log list (since Qt 5.15.1 or
+ // 5.15.2), an make the list empty on startup (in debug the list is not
+ // empty because some logs are added after the log list becomes visible)
+ //
+ // the reset() forces a re-computation of the column size, thus properly
+ // the logs that are already in the log model
+ //
+ ui->logList->reset();
+ ui->logList->scrollToBottom();
}
}
diff --git a/src/modlistbypriorityproxy.cpp b/src/modlistbypriorityproxy.cpp
index ac50e823..7dae7a54 100644
--- a/src/modlistbypriorityproxy.cpp
+++ b/src/modlistbypriorityproxy.cpp
@@ -41,7 +41,10 @@ void ModListByPriorityProxy::setProfile(Profile* profile)
void ModListByPriorityProxy::setSortOrder(Qt::SortOrder order)
{
- m_sortOrder = order;
+ if (m_sortOrder != order) {
+ m_sortOrder = order;
+ onModelLayoutChanged();
+ }
}
void ModListByPriorityProxy::buildMapping()
diff --git a/src/modlistbypriorityproxy.h b/src/modlistbypriorityproxy.h
index 77e0fe3d..0629bef7 100644
--- a/src/modlistbypriorityproxy.h
+++ b/src/modlistbypriorityproxy.h
@@ -54,7 +54,7 @@ public slots:
protected slots:
void onModelRowsRemoved(const QModelIndex& parent, int first, int last);
- void onModelLayoutChanged(const QList<QPersistentModelIndex>& parents, LayoutChangeHint hint);
+ void onModelLayoutChanged(const QList<QPersistentModelIndex>& parents = {}, LayoutChangeHint hint = LayoutChangeHint::NoLayoutChangeHint);
void onModelReset();
void onModelDataChanged(const QModelIndex& topLeft, const QModelIndex& bottomRight, const QVector<int>& roles = QVector<int>());
diff --git a/src/modlistview.cpp b/src/modlistview.cpp
index 3b0050da..9597b48e 100644
--- a/src/modlistview.cpp
+++ b/src/modlistview.cpp
@@ -509,8 +509,6 @@ void ModListView::onModFilterActive(bool filterActive)
void ModListView::updateModCount()
{
- TimeThis tt("updateModCount");
-
int activeCount = 0;
int visActiveCount = 0;
int backupCount = 0;
@@ -786,7 +784,7 @@ void ModListView::setup(OrganizerCore& core, CategoryFactory& factory, MainWindo
connect(this, &ModListView::dragEntered, core.modList(), &ModList::onDragEnter);
connect(this, &ModListView::dropEntered, m_byPriorityProxy, &ModListByPriorityProxy::onDropEnter);
- connect(model(), &QAbstractItemModel::layoutChanged, this, &ModListView::updateModCount);
+ connect(m_sortProxy, &ModListSortProxy::filterInvalidated, this, &ModListView::updateModCount);
connect(header(), &QHeaderView::sortIndicatorChanged, [=](int, Qt::SortOrder) { verticalScrollBar()->repaint(); });
connect(header(), &QHeaderView::sectionResized, [=](int logicalIndex, int oldSize, int newSize) {
diff --git a/src/organizercore.cpp b/src/organizercore.cpp
index d5c341a9..d6c22d3c 100644
--- a/src/organizercore.cpp
+++ b/src/organizercore.cpp
@@ -744,7 +744,7 @@ ModInfo::Ptr OrganizerCore::installDownload(int index, int priority)
GuessedValue<QString> modName;
// see if there already are mods with the specified mod id
- if (modID != 0) {
+ if (modID > 0) {
std::vector<ModInfo::Ptr> modInfo = ModInfo::getByModID(gameName, modID);
for (auto iter = modInfo.begin(); iter != modInfo.end(); ++iter) {
std::vector<ModInfo::EFlag> flags = (*iter)->getFlags();
diff --git a/src/pluginlistcontextmenu.cpp b/src/pluginlistcontextmenu.cpp
index e6afd996..c6d4ecec 100644
--- a/src/pluginlistcontextmenu.cpp
+++ b/src/pluginlistcontextmenu.cpp
@@ -18,14 +18,16 @@ PluginListContextMenu::PluginListContextMenu(
if (view->selectionModel()->hasSelection()) {
m_selected = view->indexViewToModel(view->selectionModel()->selectedRows());
}
- else {
+ else if (index.isValid()) {
m_selected = { index };
}
- addAction(tr("Enable selected"), [=]() { m_core.pluginList()->setEnabled(m_selected, true); });
- addAction(tr("Disable selected"), [=]() { m_core.pluginList()->setEnabled(m_selected, false); });
+ if (!m_selected.isEmpty()) {
+ addAction(tr("Enable selected"), [=]() { m_core.pluginList()->setEnabled(m_selected, true); });
+ addAction(tr("Disable selected"), [=]() { m_core.pluginList()->setEnabled(m_selected, false); });
- addSeparator();
+ addSeparator();
+ }
addAction(tr("Enable all"), [=]() {
if (QMessageBox::question(
@@ -42,43 +44,47 @@ PluginListContextMenu::PluginListContextMenu(
}
});
- addSeparator();
+ if (!m_selected.isEmpty()) {
+ addSeparator();
+ addMenu(createSendToContextMenu());
- addMenu(createSendToContextMenu());
- addSeparator();
+ addSeparator();
- bool hasLocked = false;
- bool hasUnlocked = false;
- for (auto& idx : m_selected) {
- if (m_core.pluginList()->isEnabled(idx.row())) {
- if (m_core.pluginList()->isESPLocked(idx.row())) {
- hasLocked = true;
- }
- else {
- hasUnlocked = true;
+ bool hasLocked = false;
+ bool hasUnlocked = false;
+ for (auto& idx : m_selected) {
+ if (m_core.pluginList()->isEnabled(idx.row())) {
+ if (m_core.pluginList()->isESPLocked(idx.row())) {
+ hasLocked = true;
+ }
+ else {
+ hasUnlocked = true;
+ }
}
}
- }
- if (hasLocked) {
- addAction(tr("Unlock load order"), [=]() { setESPLock(m_selected, false); });
- }
- if (hasUnlocked) {
- addAction(tr("Lock load order"), [=]() { setESPLock(m_selected, true); });
+ if (hasLocked) {
+ addAction(tr("Unlock load order"), [=]() { setESPLock(m_selected, false); });
+ }
+ if (hasUnlocked) {
+ addAction(tr("Lock load order"), [=]() { setESPLock(m_selected, true); });
+ }
}
- addSeparator();
+ if (m_index.isValid()) {
+ addSeparator();
- unsigned int modInfoIndex = ModInfo::getIndex(m_core.pluginList()->origin(m_index.data().toString()));
- // this is to avoid showing the option on game files like skyrim.esm
- if (modInfoIndex != UINT_MAX) {
- addAction(tr("Open Origin in Explorer"), [=]() { openOriginExplorer(m_selected); });
- ModInfo::Ptr modInfo = ModInfo::getByIndex(modInfoIndex);
- std::vector<ModInfo::EFlag> flags = modInfo->getFlags();
+ unsigned int modInfoIndex = ModInfo::getIndex(m_core.pluginList()->origin(m_index.data().toString()));
+ // this is to avoid showing the option on game files like skyrim.esm
+ if (modInfoIndex != UINT_MAX) {
+ addAction(tr("Open Origin in Explorer"), [=]() { openOriginExplorer(m_selected); });
+ ModInfo::Ptr modInfo = ModInfo::getByIndex(modInfoIndex);
+ std::vector<ModInfo::EFlag> flags = modInfo->getFlags();
- if (!modInfo->isForeign() && m_selected.size() == 1) {
- QAction* infoAction = addAction(tr("Open Origin Info..."), [=]() { openOriginInformation(index); });
- setDefaultAction(infoAction);
+ if (!modInfo->isForeign() && m_selected.size() == 1) {
+ QAction* infoAction = addAction(tr("Open Origin Info..."), [=]() { openOriginInformation(index); });
+ setDefaultAction(infoAction);
+ }
}
}
diff --git a/src/profile.cpp b/src/profile.cpp
index b77a8295..bb3a11e2 100644
--- a/src/profile.cpp
+++ b/src/profile.cpp
@@ -493,12 +493,8 @@ void Profile::refreshModStatus()
// User has a mod named some variation of "overwrite". Tell them about it.
if (warnAboutOverwrite) {
- QMessageBox::warning(
- nullptr,
- tr("Overwrite mod conflict"),
- tr("At least one mod named \"overwrite\" was detected, disabled, and moved to the lowest priority on the mod list. "
- "You may want to rename this mod and enable it again.")
- );
+ reportError(tr("A mod named \"overwrite\" was detected, disabled, and moved to the highest priority on the mod list. "
+ "You may want to rename this mod and enable it again."));
// also, mark the mod-list as changed
modStatusModified = true;
}