summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2019-10-08 19:38:56 -0400
committerisanae <14251494+isanae@users.noreply.github.com>2019-10-08 19:38:56 -0400
commit0ea975248b8cdb8319d3a366616f8d852726f83c (patch)
tree5295263ea3488f409c017cc50434f498ebd115a2 /src
parent52db7e8c7ddd39609a8eecbf44fa15ec6369f843 (diff)
remove separators and backups from mod list in the edit executables dialog
Diffstat (limited to 'src')
-rw-r--r--src/editexecutablesdialog.cpp7
-rw-r--r--src/modinfo.cpp25
-rw-r--r--src/modinfo.h12
3 files changed, 38 insertions, 6 deletions
diff --git a/src/editexecutablesdialog.cpp b/src/editexecutablesdialog.cpp
index 19b57e9a..b56fdc41 100644
--- a/src/editexecutablesdialog.cpp
+++ b/src/editexecutablesdialog.cpp
@@ -71,7 +71,12 @@ EditExecutablesDialog::EditExecutablesDialog(OrganizerCore& oc, int sel, QWidget
loadCustomOverwrites();
loadForcedLibraries();
- ui->mods->addItems(m_organizerCore.modList()->allMods());
+ for (auto&& m : m_organizerCore.modList()->allMods()) {
+ if (ModInfo::isRegularName(m)) {
+ ui->mods->addItem(m);
+ }
+ }
+
fillList();
setDirty(false);
diff --git a/src/modinfo.cpp b/src/modinfo.cpp
index e3daa4fd..6e048bfb 100644
--- a/src/modinfo.cpp
+++ b/src/modinfo.cpp
@@ -61,17 +61,32 @@ bool ModInfo::ByName(const ModInfo::Ptr &LHS, const ModInfo::Ptr &RHS)
return QString::compare(LHS->name(), RHS->name(), Qt::CaseInsensitive) < 0;
}
+bool ModInfo::isSeparatorName(const QString& name)
+{
+ static QRegExp separatorExp(".*_separator");
+ return separatorExp.exactMatch(name);
+}
+
+bool ModInfo::isBackupName(const QString& name)
+{
+ static QRegExp backupExp(".*backup[0-9]*");
+ return backupExp.exactMatch(name);
+}
+
+bool ModInfo::isRegularName(const QString& name)
+{
+ return !isSeparatorName(name) && !isBackupName(name);
+}
+
ModInfo::Ptr ModInfo::createFrom(PluginContainer *pluginContainer, const MOBase::IPluginGame *game, const QDir &dir, DirectoryEntry **directoryStructure)
{
QMutexLocker locker(&s_Mutex);
- // int id = s_NextID++;
- static QRegExp backupExp(".*backup[0-9]*");
- static QRegExp separatorExp(".*_separator");
ModInfo::Ptr result;
- if (backupExp.exactMatch(dir.dirName())) {
+
+ if (isBackupName(dir.dirName())) {
result = ModInfo::Ptr(new ModInfoBackup(pluginContainer, game, dir, directoryStructure));
- } else if(separatorExp.exactMatch(dir.dirName())){
+ } else if (isSeparatorName(dir.dirName())) {
result = Ptr(new ModInfoSeparator(pluginContainer, game, dir, directoryStructure));
} else {
result = ModInfo::Ptr(new ModInfoRegular(pluginContainer, game, dir, directoryStructure));
diff --git a/src/modinfo.h b/src/modinfo.h
index e395f45b..30a115c7 100644
--- a/src/modinfo.h
+++ b/src/modinfo.h
@@ -229,6 +229,18 @@ public:
*/
static ModInfo::Ptr createFromPlugin(const QString &modName, const QString &espName, const QStringList &bsaNames, ModInfo::EModType modType, MOShared::DirectoryEntry **directoryStructure, PluginContainer *pluginContainer);
+ // whether the given name is used for separators
+ //
+ static bool isSeparatorName(const QString& name);
+
+ // whether the given name is used for backups
+ //
+ static bool isBackupName(const QString& name);
+
+ // whether the given name is used for regular mods
+ //
+ static bool isRegularName(const QString& name);
+
/**
* @brief retieve a name for one of the CONTENT_ enums
* @param contentType the content value