From 35bbe0001efa9aac48c56503643b98ec03c080e7 Mon Sep 17 00:00:00 2001 From: Al12rs Date: Tue, 17 Jul 2018 14:37:50 +0200 Subject: Added a flag to the plugin list indicating if a certain plugin has one or more archives attached. Changed the tooltip to list the loaded archives. Fixed tool tip to have titles for subsections. --- src/pluginlist.cpp | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'src/pluginlist.cpp') diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index a6ae8fa7..9153df72 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -181,9 +181,17 @@ void PluginList::refresh(const QString &profileName try { FilesOrigin &origin = baseDirectory.getOriginByID(current->getOrigin(archive)); + QString iniPath = QFileInfo(filename).baseName() + ".ini"; bool hasIni = baseDirectory.findFile(ToWString(iniPath)).get() != nullptr; + std::set loadedArchives; + QString originPath = QString::fromWCharArray(origin.getPath().c_str()); + QDir dir(QDir::toNativeSeparators(originPath)); + for (QString filename : dir.entryList(QStringList() << QFileInfo(filename).baseName() + "*.bsa" << QFileInfo(filename).baseName() + "*.ba2")) { + loadedArchives.insert(filename); + } + QString originName = ToQString(origin.getName()); unsigned int modIndex = ModInfo::getIndex(originName); if (modIndex != UINT_MAX) { @@ -191,7 +199,7 @@ void PluginList::refresh(const QString &profileName originName = modInfo->name(); } - m_ESPs.push_back(ESPInfo(filename, forceEnabled, originName, ToQString(current->getFullPath()), hasIni)); + m_ESPs.push_back(ESPInfo(filename, forceEnabled, originName, ToQString(current->getFullPath()), hasIni, loadedArchives)); m_ESPs.rbegin()->m_Priority = -1; } catch (const std::exception &e) { reportError(tr("failed to update esp info for file %1 (source id: %2), error: %3").arg(filename).arg(current->getOrigin(archive)).arg(e.what())); @@ -888,8 +896,15 @@ QVariant PluginList::data(const QModelIndex &modelIndex, int role) const if (!enabledMasters.empty()) { text += "
" + tr("Enabled Masters") + ": " + SetJoin(enabledMasters, ", "); } + if (!m_ESPs[index].m_Archives.empty()) { + text += "
" + tr("Loads Archives") + ": " + SetJoin(m_ESPs[index].m_Archives, ", "); + text += "
" + tr("There are Archives connected to this plugin. " + "Their assets will be added to your game, overwriting in case of conflicts following the plugin order. " + "Loose files will always overwrite assets from Archives."); + } if (m_ESPs[index].m_HasIni) { - text += "
" + tr("There is an ini file connected to this esp. " + text += "
" + tr("Loads INI settings") + ": "; + text += "
" + tr("There is an ini file connected to this plugin. " "Its settings will be added to your game settings, overwriting in case of conflicts."); } if (m_ESPs[index].m_IsLightFlagged && !m_ESPs[index].m_IsLight) { @@ -917,6 +932,9 @@ QVariant PluginList::data(const QModelIndex &modelIndex, int role) const if (m_ESPs[index].m_HasIni) { result.append(":/MO/gui/attachment"); } + if (!m_ESPs[index].m_Archives.empty()) { + result.append(":/MO/gui/archive_conflict_neutral"); + } if (m_ESPs[index].m_IsLightFlagged && !m_ESPs[index].m_IsLight) { result.append(":/MO/gui/awaiting"); } @@ -1228,9 +1246,9 @@ bool PluginList::eventFilter(QObject *obj, QEvent *event) PluginList::ESPInfo::ESPInfo(const QString &name, bool enabled, const QString &originName, const QString &fullPath, - bool hasIni) + bool hasIni, std::set archives) : m_Name(name), m_FullPath(fullPath), m_Enabled(enabled), m_ForceEnabled(enabled), - m_Priority(0), m_LoadOrder(-1), m_OriginName(originName), m_HasIni(hasIni), m_ModSelected(false) + m_Priority(0), m_LoadOrder(-1), m_OriginName(originName), m_HasIni(hasIni), m_Archives(archives), m_ModSelected(false) { try { ESP::File file(ToWString(fullPath)); -- cgit v1.3.1 From 023cacab7fc2a9c36749fe235255fce8c4edd65b Mon Sep 17 00:00:00 2001 From: Al12rs Date: Tue, 17 Jul 2018 16:26:17 +0200 Subject: Added ability to open mod information window by double cliking on plugins. --- src/mainwindow.cpp | 38 ++++++++++++++++++ src/mainwindow.h | 1 + src/mainwindow.ui | 115 +++++++++++++++++------------------------------------ src/pluginlist.cpp | 7 ++++ src/pluginlist.h | 6 +++ 5 files changed, 88 insertions(+), 79 deletions(-) (limited to 'src/pluginlist.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 5999608c..c4e888ac 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -2872,6 +2872,44 @@ void MainWindow::on_modList_doubleClicked(const QModelIndex &index) } } +void MainWindow::on_espList_doubleClicked(const QModelIndex &index) +{ + if (!index.isValid()) { + return; + } + + if (m_OrganizerCore.pluginList()->timeElapsedSinceLastChecked() <= QApplication::doubleClickInterval()) { + // don't interpret double click if we only just checked a plugin + return; + } + + QModelIndex sourceIdx = mapToModel(m_OrganizerCore.pluginList(), index); + if (!sourceIdx.isValid()) { + return; + } + try { + + QItemSelectionModel *selection = ui->espList->selectionModel(); + + if (selection->hasSelection() && selection->selectedRows().count() == 1) { + + QModelIndex idx = selection->currentIndex(); + QString fileName = idx.data().toString(); + + + displayModInformation(ModInfo::getIndex(m_OrganizerCore.pluginList()->origin(fileName))); + // workaround to cancel the editor that might have opened because of + // selection-click + ui->espList->closePersistentEditor(index); + + + } + } + catch (const std::exception &e) { + reportError(e.what()); + } +} + bool MainWindow::populateMenuCategories(QMenu *menu, int targetID) { ModInfo::Ptr modInfo = ModInfo::getByIndex(m_ContextRow); diff --git a/src/mainwindow.h b/src/mainwindow.h index 737a1534..773bf298 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -574,6 +574,7 @@ private slots: // ui slots void on_executablesListBox_currentIndexChanged(int index); void on_modList_customContextMenuRequested(const QPoint &pos); void on_modList_doubleClicked(const QModelIndex &index); + void on_espList_doubleClicked(const QModelIndex &index); void on_profileBox_currentIndexChanged(int index); void on_savegameList_customContextMenuRequested(const QPoint &pos); void on_startButton_clicked(); diff --git a/src/mainwindow.ui b/src/mainwindow.ui index e0aa6f36..d8873d4f 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -96,9 +96,9 @@ - - false - + + false + 0 @@ -194,7 +194,7 @@ - + Pick a module collection @@ -248,7 +248,7 @@ p, li { white-space: pre-wrap; } 16 - + @@ -265,16 +265,6 @@ p, li { white-space: pre-wrap; } - - - - - - - - - - Restore Backup... @@ -509,7 +499,7 @@ p, li { white-space: pre-wrap; } - + Qt::Horizontal @@ -521,7 +511,7 @@ p, li { white-space: pre-wrap; } - + @@ -536,12 +526,12 @@ p, li { white-space: pre-wrap; } 22 - + 95 0 - + false @@ -567,7 +557,7 @@ p, li { white-space: pre-wrap; } - + Qt::Horizontal @@ -579,14 +569,14 @@ p, li { white-space: pre-wrap; } - - - + + + 220 0 - + Qt::ClickFocus @@ -608,13 +598,13 @@ p, li { white-space: pre-wrap; } - - + + 220 0 - + Namefilter @@ -835,12 +825,12 @@ p, li { white-space: pre-wrap; } - - true - + + true + Sort - + :/MO/gui/sort:/MO/gui/sort @@ -954,6 +944,9 @@ p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> <p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">This list contains the esps, esms, and esls contained in the active mods. These require their own load order. Use drag&amp;drop to modify this load order. Please note that MO will only save the load order for mods that are active/checked.<br />There is a great tool named &quot;BOSS&quot; to automatically sort these files.</span></p></body></html> + + QAbstractItemView::EditKeyPressed|QAbstractItemView::SelectedClicked + true @@ -987,6 +980,9 @@ p, li { white-space: pre-wrap; } true + + false + false @@ -1009,15 +1005,12 @@ p, li { white-space: pre-wrap; } - - - + + false + Archives - - true - 6 @@ -1032,17 +1025,7 @@ p, li { white-space: pre-wrap; } 6 - - - - - - - - - - - + @@ -1072,50 +1055,24 @@ p, li { white-space: pre-wrap; } BSAs checked here are loaded in such a way that your installation order is obeyed properly. - - QAbstractItemView::NoEditTriggers - false - + false - + false - - QAbstractItemView::NoDragDrop - - - Qt::IgnoreAction - - - QAbstractItemView::SingleSelection - - - QAbstractItemView::SelectRows - - + 20 - + true - + 1 - - false - - - 200 - - - - File - - diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index 9153df72..c6cea045 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -77,6 +77,7 @@ PluginList::PluginList(QObject *parent) , m_FontMetrics(QFont()) { connect(this, SIGNAL(writePluginsList()), this, SLOT(generatePluginIndexes())); + m_LastCheck.start(); } PluginList::~PluginList() @@ -583,6 +584,11 @@ void PluginList::disconnectSlots() { m_PluginStateChanged.disconnect_all_slots(); } +int PluginList::timeElapsedSinceLastChecked() const +{ + return m_LastCheck.elapsed(); +} + QStringList PluginList::pluginNames() const { QStringList result; @@ -954,6 +960,7 @@ bool PluginList::setData(const QModelIndex &modIndex, const QVariant &value, int if (role == Qt::CheckStateRole) { m_ESPs[modIndex.row()].m_Enabled = value.toInt() == Qt::Checked || m_ESPs[modIndex.row()].m_ForceEnabled; + m_LastCheck.restart(); emit dataChanged(modIndex, modIndex); refreshLoadOrder(); diff --git a/src/pluginlist.h b/src/pluginlist.h index 583c7272..b8e35c32 100644 --- a/src/pluginlist.h +++ b/src/pluginlist.h @@ -28,6 +28,7 @@ namespace MOBase { class IPluginGame; } #include #include #include +#include #include #pragma warning(push) @@ -192,6 +193,8 @@ public: */ int enabledCount() const; + int timeElapsedSinceLastChecked() const; + QString getName(int index) const { return m_ESPs.at(index).m_Name; } int getPriority(int index) const { return m_ESPs.at(index).m_Priority; } QString getIndexPriority(int index) const; @@ -273,6 +276,7 @@ signals: void writePluginsList(); + private: struct ESPInfo { @@ -347,6 +351,8 @@ private: QTemporaryFile m_TempFile; + QTime m_LastCheck; + const MOBase::IPluginGame *m_GamePlugin; }; -- cgit v1.3.1 From f824d255a2044e81208e0813c76f9d31e630267c Mon Sep 17 00:00:00 2001 From: Al12rs Date: Tue, 17 Jul 2018 19:51:30 +0200 Subject: Added clarification to loads archives tooltip. --- src/pluginlist.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/pluginlist.cpp') diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index c6cea045..58364e78 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -906,7 +906,7 @@ QVariant PluginList::data(const QModelIndex &modelIndex, int role) const text += "
" + tr("Loads Archives") + ": " + SetJoin(m_ESPs[index].m_Archives, ", "); text += "
" + tr("There are Archives connected to this plugin. " "Their assets will be added to your game, overwriting in case of conflicts following the plugin order. " - "Loose files will always overwrite assets from Archives."); + "Loose files will always overwrite assets from Archives. (This flag only checks for Archives from the same mod as the plugin)"); } if (m_ESPs[index].m_HasIni) { text += "
" + tr("Loads INI settings") + ": "; -- cgit v1.3.1 From 385765ecddbb1e9d7f38cf313c3c6db6dc07be52 Mon Sep 17 00:00:00 2001 From: LostDragonist Date: Mon, 23 Jul 2018 14:13:12 -0500 Subject: Truncate strings longer than 1024 characters in the plugin list tooltip --- src/pluginlist.cpp | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'src/pluginlist.cpp') diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index 58364e78..76de436d 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -72,6 +72,15 @@ static bool ByDate(const PluginList::ESPInfo& LHS, const PluginList::ESPInfo& RH return QFileInfo(LHS.m_FullPath).lastModified() < QFileInfo(RHS.m_FullPath).lastModified(); } +static QString TruncateString(const QString& text) { + QString new_text = text; + if (new_text.length() > 1024) { + new_text.truncate(1024); + new_text += "..."; + } + return new_text; +} + PluginList::PluginList(QObject *parent) : QAbstractItemModel(parent) , m_FontMetrics(QFont()) @@ -187,7 +196,7 @@ void PluginList::refresh(const QString &profileName bool hasIni = baseDirectory.findFile(ToWString(iniPath)).get() != nullptr; std::set loadedArchives; - QString originPath = QString::fromWCharArray(origin.getPath().c_str()); + QString originPath = QString::fromWCharArray(origin.getPath().c_str()); QDir dir(QDir::toNativeSeparators(originPath)); for (QString filename : dir.entryList(QStringList() << QFileInfo(filename).baseName() + "*.bsa" << QFileInfo(filename).baseName() + "*.ba2")) { loadedArchives.insert(filename); @@ -887,23 +896,23 @@ QVariant PluginList::data(const QModelIndex &modelIndex, int role) const } else { QString text = tr("Origin: %1").arg(m_ESPs[index].m_OriginName); if (m_ESPs[index].m_Author.size() > 0) { - text += "
" + tr("Author") + ": " + m_ESPs[index].m_Author; + text += "
" + tr("Author") + ": " + TruncateString(m_ESPs[index].m_Author); } if (m_ESPs[index].m_Description.size() > 0) { - text += "
" + tr("Description") + ": " + m_ESPs[index].m_Description; + text += "
" + tr("Description") + ": " + TruncateString(m_ESPs[index].m_Description); } if (m_ESPs[index].m_MasterUnset.size() > 0) { - text += "
" + tr("Missing Masters") + ": " + SetJoin(m_ESPs[index].m_MasterUnset, ", ") + ""; + text += "
" + tr("Missing Masters") + ": " + TruncateString(SetJoin(m_ESPs[index].m_MasterUnset, ", ")) + ""; } std::set enabledMasters; std::set_difference(m_ESPs[index].m_Masters.begin(), m_ESPs[index].m_Masters.end(), m_ESPs[index].m_MasterUnset.begin(), m_ESPs[index].m_MasterUnset.end(), std::inserter(enabledMasters, enabledMasters.end())); if (!enabledMasters.empty()) { - text += "
" + tr("Enabled Masters") + ": " + SetJoin(enabledMasters, ", "); + text += "
" + tr("Enabled Masters") + ": " + TruncateString(SetJoin(enabledMasters, ", ")); } if (!m_ESPs[index].m_Archives.empty()) { - text += "
" + tr("Loads Archives") + ": " + SetJoin(m_ESPs[index].m_Archives, ", "); + text += "
" + tr("Loads Archives") + ": " + TruncateString(SetJoin(m_ESPs[index].m_Archives, ", ")); text += "
" + tr("There are Archives connected to this plugin. " "Their assets will be added to your game, overwriting in case of conflicts following the plugin order. " "Loose files will always overwrite assets from Archives. (This flag only checks for Archives from the same mod as the plugin)"); -- cgit v1.3.1 From 7eb4b33214279aeb97541344e1c20da2b8dd79ff Mon Sep 17 00:00:00 2001 From: LostDragonist Date: Tue, 31 Jul 2018 03:52:55 -0500 Subject: Tweak shading of mods and plugins to better support dark themes --- src/modlist.cpp | 7 +++---- src/pluginlist.cpp | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'src/pluginlist.cpp') diff --git a/src/modlist.cpp b/src/modlist.cpp index e077a5ee..0d084c22 100644 --- a/src/modlist.cpp +++ b/src/modlist.cpp @@ -354,7 +354,6 @@ QVariant ModList::data(const QModelIndex &modelIndex, int role) const int highlight = modInfo->getHighlight(); if (highlight & ModInfo::HIGHLIGHT_IMPORTANT) return QBrush(Qt::darkRed); else if (highlight & ModInfo::HIGHLIGHT_INVALID) return QBrush(Qt::darkGray); - else if (highlight & ModInfo::HIGHLIGHT_PLUGIN) return QBrush(Qt::darkBlue); } else if (column == COL_VERSION) { if (!modInfo->getNewestVersion().isValid()) { return QVariant(); @@ -368,11 +367,11 @@ QVariant ModList::data(const QModelIndex &modelIndex, int role) const } else if ((role == Qt::BackgroundRole) || (role == ViewMarkingScrollBar::DEFAULT_ROLE)) { if (modInfo->getHighlight() & ModInfo::HIGHLIGHT_PLUGIN) { - return QColor(0, 0, 255, 32); + return QColor(0, 0, 255, 64); } else if (m_Overwrite.find(modIndex) != m_Overwrite.end()) { - return QColor(0, 255, 0, 32); + return QColor(0, 255, 0, 64); } else if (m_Overwritten.find(modIndex) != m_Overwritten.end()) { - return QColor(255, 0, 0, 32); + return QColor(255, 0, 0, 64); } else { return QVariant(); } diff --git a/src/pluginlist.cpp b/src/pluginlist.cpp index 76de436d..323cd98f 100644 --- a/src/pluginlist.cpp +++ b/src/pluginlist.cpp @@ -861,7 +861,7 @@ QVariant PluginList::data(const QModelIndex &modelIndex, int role) const } else if (role == Qt::BackgroundRole || (role == ViewMarkingScrollBar::DEFAULT_ROLE)) { if (m_ESPs[index].m_ModSelected) { - return QColor(0, 0, 255, 32); + return QColor(0, 0, 255, 64); } else { return QVariant(); } -- cgit v1.3.1