From c4636d891f94f3af6664a82d1f6757a386431fde Mon Sep 17 00:00:00 2001 From: Al12rs Date: Sat, 25 Aug 2018 14:30:27 +0200 Subject: Added ModGroups contents icon and flag. --- src/modinforegular.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/modinforegular.cpp') diff --git a/src/modinforegular.cpp b/src/modinforegular.cpp index 5b6ddcda..f74b3a36 100644 --- a/src/modinforegular.cpp +++ b/src/modinforegular.cpp @@ -471,6 +471,10 @@ std::vector ModInfoRegular::getContents() const m_CachedContent.push_back(CONTENT_INI); } + if (dir.entryList(QStringList() << "*.modgroups").size() > 0) { + m_CachedContent.push_back(CONTENT_MODGROUP); + } + ScriptExtender *extender = qApp->property("managed_game") .value() ->feature(); -- cgit v1.3.1 From c6751b690aaed5a7069eb7ec073e7675335a2e0f Mon Sep 17 00:00:00 2001 From: Al12rs Date: Fri, 7 Sep 2018 18:56:28 +0200 Subject: Improved Skript Extender Plugin filter to actually look for plugins and not only the SKSE folder. --- src/modinforegular.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/modinforegular.cpp') diff --git a/src/modinforegular.cpp b/src/modinforegular.cpp index f74b3a36..dcace416 100644 --- a/src/modinforegular.cpp +++ b/src/modinforegular.cpp @@ -481,8 +481,12 @@ std::vector ModInfoRegular::getContents() const if (extender != nullptr) { QString sePluginPath = extender->PluginPath(); - if (dir.exists(sePluginPath)) - m_CachedContent.push_back(CONTENT_SKSE); + if (dir.exists(sePluginPath)) { + QDir sePluginDir(absolutePath() + "/" + sePluginPath); + if (sePluginDir.entryList(QStringList() << "*.dll").size() > 0) { + m_CachedContent.push_back(CONTENT_SKSE); + } + } } if (dir.exists("textures") || dir.exists("icons") || dir.exists("bookart")) m_CachedContent.push_back(CONTENT_TEXTURE); -- cgit v1.3.1 From ba162804cd85120e7210f31bbcd1e4b2a45fd394 Mon Sep 17 00:00:00 2001 From: Al12rs Date: Fri, 7 Sep 2018 20:19:20 +0200 Subject: Added Contains Script Extender Files filter. --- src/modinfo.cpp | 1 + src/modinfo.h | 1 + src/modinforegular.cpp | 1 + 3 files changed, 3 insertions(+) (limited to 'src/modinforegular.cpp') diff --git a/src/modinfo.cpp b/src/modinfo.cpp index b42c7303..8ce40da3 100644 --- a/src/modinfo.cpp +++ b/src/modinfo.cpp @@ -100,6 +100,7 @@ QString ModInfo::getContentTypeName(int contentType) case CONTENT_SOUND: return tr("Sound Effects"); case CONTENT_SCRIPT: return tr("Scripts"); case CONTENT_SKSE: return tr("Script Extender"); + case CONTENT_SKSEFILES: return tr("Script Extender Files"); case CONTENT_SKYPROC: return tr("SkyProc Tools"); case CONTENT_MCM: return tr("MCM Data"); case CONTENT_INI: return tr("INI files"); diff --git a/src/modinfo.h b/src/modinfo.h index 82dd8dc8..919d1a5b 100644 --- a/src/modinfo.h +++ b/src/modinfo.h @@ -83,6 +83,7 @@ public: CONTENT_SOUND, CONTENT_SCRIPT, CONTENT_SKSE, + CONTENT_SKSEFILES, CONTENT_SKYPROC, CONTENT_MCM, CONTENT_INI, diff --git a/src/modinforegular.cpp b/src/modinforegular.cpp index dcace416..1e77e050 100644 --- a/src/modinforegular.cpp +++ b/src/modinforegular.cpp @@ -482,6 +482,7 @@ std::vector ModInfoRegular::getContents() const if (extender != nullptr) { QString sePluginPath = extender->PluginPath(); if (dir.exists(sePluginPath)) { + m_CachedContent.push_back(CONTENT_SKSEFILES); QDir sePluginDir(absolutePath() + "/" + sePluginPath); if (sePluginDir.entryList(QStringList() << "*.dll").size() > 0) { m_CachedContent.push_back(CONTENT_SKSE); -- cgit v1.3.1 From 15ab8d5c5e9b5a06ad61247aa81f4673a42595e6 Mon Sep 17 00:00:00 2001 From: Al12rs Date: Sat, 29 Sep 2018 15:07:24 +0200 Subject: Changed "ignore missing game data" to not create an empty Texture folder and instead save the choice in meta.ini --- src/mainwindow.cpp | 6 ++++-- src/modinfo.h | 5 +++++ src/modinforegular.cpp | 16 +++++++++++++--- src/modinforegular.h | 7 +++++++ src/modlist.cpp | 4 +++- 5 files changed, 32 insertions(+), 6 deletions(-) (limited to 'src/modinforegular.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 04491c3e..9d0c37c0 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -2684,16 +2684,18 @@ void MainWindow::ignoreMissingData_clicked() for (QModelIndex idx : selection->selectedRows()) { int row_idx = idx.data(Qt::UserRole + 1).toInt(); ModInfo::Ptr info = ModInfo::getByIndex(row_idx); - QDir(info->absolutePath()).mkdir("textures"); + //QDir(info->absolutePath()).mkdir("textures"); info->testValid(); + info->markValidated(true); connect(this, SIGNAL(modListDataChanged(QModelIndex, QModelIndex)), m_OrganizerCore.modList(), SIGNAL(dataChanged(QModelIndex, QModelIndex))); emit modListDataChanged(m_OrganizerCore.modList()->index(row_idx, 0), m_OrganizerCore.modList()->index(row_idx, m_OrganizerCore.modList()->columnCount() - 1)); } } else { ModInfo::Ptr info = ModInfo::getByIndex(m_ContextRow); - QDir(info->absolutePath()).mkdir("textures"); + //QDir(info->absolutePath()).mkdir("textures"); info->testValid(); + info->markValidated(true); connect(this, SIGNAL(modListDataChanged(QModelIndex, QModelIndex)), m_OrganizerCore.modList(), SIGNAL(dataChanged(QModelIndex, QModelIndex))); emit modListDataChanged(m_OrganizerCore.modList()->index(m_ContextRow, 0), m_OrganizerCore.modList()->index(m_ContextRow, m_OrganizerCore.modList()->columnCount() - 1)); diff --git a/src/modinfo.h b/src/modinfo.h index 919d1a5b..895105df 100644 --- a/src/modinfo.h +++ b/src/modinfo.h @@ -577,6 +577,11 @@ public: */ virtual void markConverted(bool converted) {} + /** + * @brief updates the mod to flag it as valid in order to ignore the invalid game data flag + */ + virtual void markValidated(bool validated) {} + /** * @brief reads meta information from disk */ diff --git a/src/modinforegular.cpp b/src/modinforegular.cpp index 1e77e050..1d84e2c8 100644 --- a/src/modinforegular.cpp +++ b/src/modinforegular.cpp @@ -31,6 +31,7 @@ ModInfoRegular::ModInfoRegular(PluginContainer *pluginContainer, const IPluginGa , m_GameName(game->gameShortName()) , m_IsAlternate(false) , m_Converted(false) + , m_Validated(false) , m_MetaInfoChanged(false) , m_EndorsedState(ENDORSED_UNKNOWN) , m_NexusBridge(pluginContainer) @@ -86,6 +87,7 @@ void ModInfoRegular::readMeta() m_NexusDescription = metaFile.value("nexusDescription", "").toString(); m_Repository = metaFile.value("repository", "Nexus").toString(); m_Converted = metaFile.value("converted", false).toBool(); + m_Validated = metaFile.value("validated", false).toBool(); m_URL = metaFile.value("url", "").toString(); m_LastNexusQuery = QDateTime::fromString(metaFile.value("lastNexusQuery", "").toString(), Qt::ISODate); if (metaFile.contains("endorsed")) { @@ -150,6 +152,7 @@ void ModInfoRegular::saveMeta() metaFile.setValue("url", m_URL); metaFile.setValue("lastNexusQuery", m_LastNexusQuery.toString(Qt::ISODate)); metaFile.setValue("converted", m_Converted); + metaFile.setValue("validated", m_Validated); if (m_EndorsedState != ENDORSED_UNKNOWN) { metaFile.setValue("endorsed", m_EndorsedState); } @@ -415,6 +418,13 @@ void ModInfoRegular::markConverted(bool converted) emit modDetailsUpdated(true); } +void ModInfoRegular::markValidated(bool validated) +{ + m_Validated = validated; + m_MetaInfoChanged = true; + saveMeta(); + emit modDetailsUpdated(true); +} QString ModInfoRegular::absolutePath() const { @@ -438,7 +448,7 @@ std::vector ModInfoRegular::getFlags() const if ((m_NexusID > 0) && (endorsedState() == ENDORSED_FALSE)) { result.push_back(ModInfo::FLAG_NOTENDORSED); } - if (!isValid()) { + if (!isValid() && !m_Validated) { result.push_back(ModInfo::FLAG_INVALID); } if (m_Notes.length() != 0) { @@ -514,7 +524,7 @@ std::vector ModInfoRegular::getContents() const int ModInfoRegular::getHighlight() const { - if (!isValid()) + if (!isValid() && !m_Validated) return HIGHLIGHT_INVALID; auto flags = getFlags(); if (std::find(flags.begin(), flags.end(), ModInfo::FLAG_PLUGIN_SELECTED) != flags.end()) @@ -525,7 +535,7 @@ int ModInfoRegular::getHighlight() const QString ModInfoRegular::getDescription() const { - if (!isValid()) { + if (!isValid() && !m_Validated) { return tr("%1 contains no esp/esm/esl and no asset (textures, meshes, interface, ...) directory").arg(name()); } else { const std::set &categories = getCategories(); diff --git a/src/modinforegular.h b/src/modinforegular.h index 3abaded4..2f3eb941 100644 --- a/src/modinforegular.h +++ b/src/modinforegular.h @@ -28,6 +28,7 @@ public: bool isAlternate() { return m_IsAlternate; } bool isConverted() { return m_Converted; } + bool isValidated() { return m_Validated; } /** * @brief test if there is a newer version of the mod @@ -188,6 +189,11 @@ public: */ virtual void markConverted(bool converted) override; + /** + * @brief updates the mod to flag it as valid in order to ignore the invalid game data flag + */ + virtual void markValidated(bool validated) override; + /** * @brief getter for the mod name * @@ -358,6 +364,7 @@ private: bool m_MetaInfoChanged; bool m_IsAlternate; bool m_Converted; + bool m_Validated; MOBase::VersionInfo m_NewestVersion; MOBase::VersionInfo m_IgnoredVersion; diff --git a/src/modlist.cpp b/src/modlist.cpp index bcd087bc..c7f6a53b 100644 --- a/src/modlist.cpp +++ b/src/modlist.cpp @@ -768,6 +768,8 @@ IModList::ModStates ModList::state(unsigned int modIndex) const QSharedPointer modInfoRegular = modInfo.staticCast(); if (modInfoRegular->isAlternate() && !modInfoRegular->isConverted()) result |= IModList::STATE_ALTERNATE; + if (!modInfo->isValid() && modInfoRegular->isValidated()) + result |= IModList::STATE_VALID; } if (modInfo->canBeEnabled()) { if (m_Profile->modEnabled(modIndex)) { @@ -1263,4 +1265,4 @@ void ModList::disableSelected(const QItemSelectionModel *selectionModel) } } } -} \ No newline at end of file +} -- cgit v1.3.1 From dce6507dad1ff7d76a5c0497d516c79bacd08477 Mon Sep 17 00:00:00 2001 From: Al12rs Date: Sun, 28 Oct 2018 15:04:50 +0100 Subject: Added Color costumization for Separators. --- src/mainwindow.cpp | 28 +++++++++++++++++++++++++++- src/mainwindow.h | 1 + src/modinfo.h | 11 +++++++++++ src/modinforegular.cpp | 13 +++++++++++++ src/modinforegular.h | 7 +++++++ src/modlist.cpp | 6 +++++- 6 files changed, 64 insertions(+), 2 deletions(-) (limited to 'src/modinforegular.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index bc25ab70..438ba037 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -154,6 +154,8 @@ along with Mod Organizer. If not, see . #include #include #include +#include +#include #include #include @@ -2868,6 +2870,26 @@ void MainWindow::createSeparator_clicked() m_OrganizerCore.refreshModList(); } +void MainWindow::setColor_clicked() +{ + ModInfo::Ptr modInfo = ModInfo::getByIndex(m_ContextRow); + QColor color = QColorDialog::getColor(modInfo->getColor(),this); + QItemSelectionModel *selection = ui->modList->selectionModel(); + if (selection->hasSelection() && selection->selectedRows().count() > 1) { + for (QModelIndex idx : selection->selectedRows()) { + ModInfo::Ptr info = ModInfo::getByIndex(idx.data(Qt::UserRole + 1).toInt()); + auto flags = info->getFlags(); + if (std::find(flags.begin(), flags.end(), ModInfo::FLAG_SEPARATOR) != flags.end()) + { + info->setColor(color); + } + } + } + else { + modInfo->setColor(color); + } +} + void MainWindow::createModFromOverwrite() { GuessedValue name; @@ -3608,7 +3630,7 @@ QMenu *MainWindow::modListContextMenu() menu->addAction(tr("Create empty mod"), this, SLOT(createEmptyMod_clicked())); - menu->addAction(tr("Create separator"), this, SLOT(createSeparator_clicked())); + menu->addAction(tr("Create Separator"), this, SLOT(createSeparator_clicked())); menu->addSeparator(); @@ -3655,8 +3677,12 @@ void MainWindow::on_modList_customContextMenuRequested(const QPoint &pos) menu->addAction(tr("Restore Backup"), this, SLOT(restoreBackup_clicked())); menu->addAction(tr("Remove Backup..."), this, SLOT(removeMod_clicked())); } else if (std::find(flags.begin(), flags.end(), ModInfo::FLAG_SEPARATOR) != flags.end()){ + menu->addSeparator(); menu->addAction(tr("Rename Separator..."), this, SLOT(renameMod_clicked())); menu->addAction(tr("Remove Separator..."), this, SLOT(removeMod_clicked())); + menu->addSeparator(); + menu->addAction(tr("Select Color..."), this, SLOT(setColor_clicked())); + menu->addSeparator(); } else if (std::find(flags.begin(), flags.end(), ModInfo::FLAG_FOREIGN) != flags.end()) { // nop, nothing to do with this mod } else { diff --git a/src/mainwindow.h b/src/mainwindow.h index 78d374e6..02e368d7 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -408,6 +408,7 @@ private slots: void restoreBackup_clicked(); void renameMod_clicked(); void removeMod_clicked(); + void setColor_clicked(); void backupMod_clicked(); void reinstallMod_clicked(); void endorse_clicked(); diff --git a/src/modinfo.h b/src/modinfo.h index 9f6c2fbc..235fb50c 100644 --- a/src/modinfo.h +++ b/src/modinfo.h @@ -31,6 +31,7 @@ class QDir; #include #include #include +#include #include @@ -524,6 +525,16 @@ public: */ virtual QStringList archives() const = 0; + /* + *@return the color choosen by the user for the mod/separator + */ + virtual QColor getColor() { return QColor(); } + + /* + *@return true if the color has been set successfully. + */ + virtual void setColor(QColor color) { } + /** * @brief adds the information that a file has been installed into this mod * @param modId id of the mod installed diff --git a/src/modinforegular.cpp b/src/modinforegular.cpp index 1d84e2c8..d0f56a52 100644 --- a/src/modinforegular.cpp +++ b/src/modinforegular.cpp @@ -90,6 +90,7 @@ void ModInfoRegular::readMeta() m_Validated = metaFile.value("validated", false).toBool(); m_URL = metaFile.value("url", "").toString(); m_LastNexusQuery = QDateTime::fromString(metaFile.value("lastNexusQuery", "").toString(), Qt::ISODate); + m_Color = metaFile.value("color",QColor()).value(); if (metaFile.contains("endorsed")) { if (metaFile.value("endorsed").canConvert()) { switch (metaFile.value("endorsed").toInt()) { @@ -153,6 +154,7 @@ void ModInfoRegular::saveMeta() metaFile.setValue("lastNexusQuery", m_LastNexusQuery.toString(Qt::ISODate)); metaFile.setValue("converted", m_Converted); metaFile.setValue("validated", m_Validated); + metaFile.setValue("color", m_Color); if (m_EndorsedState != ENDORSED_UNKNOWN) { metaFile.setValue("endorsed", m_EndorsedState); } @@ -397,6 +399,17 @@ void ModInfoRegular::setNeverEndorse() } +void ModInfoRegular::setColor(QColor color) +{ + m_Color = color; + m_MetaInfoChanged = true; +} + +QColor ModInfoRegular::getColor() +{ + return m_Color; +} + bool ModInfoRegular::remove() { m_MetaInfoChanged = false; diff --git a/src/modinforegular.h b/src/modinforegular.h index 2f3eb941..78a6e58a 100644 --- a/src/modinforegular.h +++ b/src/modinforegular.h @@ -311,6 +311,10 @@ public: virtual QStringList archives() const; + virtual void setColor(QColor color); + + virtual QColor getColor(); + virtual void addInstalledFile(int modId, int fileId); /** @@ -355,9 +359,12 @@ private: QString m_URL; QString m_GameName; + QDateTime m_CreationTime; QDateTime m_LastNexusQuery; + QColor m_Color; + int m_NexusID; std::set> m_InstalledFileIDs; diff --git a/src/modlist.cpp b/src/modlist.cpp index 31ef9ddc..6caafeb2 100644 --- a/src/modlist.cpp +++ b/src/modlist.cpp @@ -383,12 +383,16 @@ QVariant ModList::data(const QModelIndex &modelIndex, int role) const return QVariant(); } else if ((role == Qt::BackgroundRole) || (role == ViewMarkingScrollBar::DEFAULT_ROLE)) { + auto flags = modInfo->getFlags(); if (modInfo->getHighlight() & ModInfo::HIGHLIGHT_PLUGIN) { return QColor(0, 0, 255, 64); } else if (m_Overwrite.find(modIndex) != m_Overwrite.end()) { return QColor(0, 255, 0, 64); - } else if (m_Overwritten.find(modIndex) != m_Overwritten.end()) { + } + else if (m_Overwritten.find(modIndex) != m_Overwritten.end()) { return QColor(255, 0, 0, 64); + } else if (std::find(flags.begin(), flags.end(), ModInfo::FLAG_SEPARATOR) != flags.end() && modInfo->getColor().isValid()) { + return modInfo->getColor(); } else { return QVariant(); } -- cgit v1.3.1 From c501b5cca081e1b3697904a3b4e1e236ea9c4e69 Mon Sep 17 00:00:00 2001 From: LostDragonist Date: Sat, 8 Dec 2018 10:37:46 -0600 Subject: Add notes column to mod list --- src/mainwindow.cpp | 4 ++++ src/modinfo.cpp | 2 +- src/modinfo.h | 17 ++++++++++++++--- src/modinfodialog.cpp | 2 ++ src/modinfodialog.ui | 25 ++++++++++++++++++++++++- src/modinfoforeign.h | 2 ++ src/modinfooverwrite.h | 2 ++ src/modinforegular.cpp | 17 +++++++++++++++-- src/modinforegular.h | 12 ++++++++++++ src/modlist.cpp | 24 ++++++++++++++++++++++-- src/modlist.h | 3 ++- 11 files changed, 100 insertions(+), 10 deletions(-) (limited to 'src/modinforegular.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 84b77945..9a40ce2e 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -299,6 +299,7 @@ MainWindow::MainWindow(QSettings &initSettings ui->modList->header()->setSectionHidden(ModList::COL_MODID, true); ui->modList->header()->setSectionHidden(ModList::COL_GAME, true); ui->modList->header()->setSectionHidden(ModList::COL_INSTALLTIME, true); + ui->modList->header()->setSectionHidden(ModList::COL_NOTES, true); } ui->modList->header()->setSectionHidden(ModList::COL_NAME, false); // prevent the name-column from being hidden @@ -1726,6 +1727,9 @@ void MainWindow::processUpdates() { lastHidden = hidden; } } + if (lastVersion < QVersionNumber(2,1,6)) { + ui->modList->header()->setSectionHidden(ModList::COL_NOTES, true); + } } if (currentVersion > lastVersion) diff --git a/src/modinfo.cpp b/src/modinfo.cpp index 4c41a114..1c6139f6 100644 --- a/src/modinfo.cpp +++ b/src/modinfo.cpp @@ -104,7 +104,7 @@ QString ModInfo::getContentTypeName(int contentType) case CONTENT_SOUND: return tr("Sound Effects"); case CONTENT_SCRIPT: return tr("Scripts"); case CONTENT_SKSE: return tr("Script Extender"); - case CONTENT_SKSEFILES: return tr("Script Extender Files"); + case CONTENT_SKSEFILES: return tr("Script Extender Files"); case CONTENT_SKYPROC: return tr("SkyProc Tools"); case CONTENT_MCM: return tr("MCM Data"); case CONTENT_INI: return tr("INI files"); diff --git a/src/modinfo.h b/src/modinfo.h index 235fb50c..5a69185d 100644 --- a/src/modinfo.h +++ b/src/modinfo.h @@ -44,7 +44,7 @@ namespace MOShared { class DirectoryEntry; } /** * @brief Represents meta information about a single mod. - * + * * Represents meta information about a single mod. The class interface is used * to manage the mod collection * @@ -85,7 +85,7 @@ public: CONTENT_SOUND, CONTENT_SCRIPT, CONTENT_SKSE, - CONTENT_SKSEFILES, + CONTENT_SKSEFILES, CONTENT_SKYPROC, CONTENT_MCM, CONTENT_INI, @@ -268,6 +268,12 @@ public: **/ virtual void setCategory(int categoryID, bool active) = 0; + /** + * @brief changes the comments (manually set information displayed in the mod list) for this mod + * @param comments new comments + */ + virtual void setComments(const QString &comments) = 0; + /** * @brief change the notes (manually set information) for this mod * @param notes new notes @@ -495,6 +501,11 @@ public: */ virtual QString getDescription() const = 0; + /** + * @return comments for this mod + */ + virtual QString comments() const = 0; + /** * @return notes for this mod */ @@ -526,7 +537,7 @@ public: virtual QStringList archives() const = 0; /* - *@return the color choosen by the user for the mod/separator + *@return the color choosen by the user for the mod/separator */ virtual QColor getColor() { return QColor(); } diff --git a/src/modinfodialog.cpp b/src/modinfodialog.cpp index 54910e41..416eca58 100644 --- a/src/modinfodialog.cpp +++ b/src/modinfodialog.cpp @@ -112,6 +112,7 @@ ModInfoDialog::ModInfoDialog(ModInfo::Ptr modInfo, const DirectoryEntry *directo } ui->sourceGameEdit->setCurrentIndex(ui->sourceGameEdit->findData(gameName)); + ui->commentsEdit->setText(modInfo->comments()); ui->notesEdit->setText(modInfo->notes()); ui->descriptionView->setPage(new DescriptionPage); @@ -189,6 +190,7 @@ ModInfoDialog::ModInfoDialog(ModInfo::Ptr modInfo, const DirectoryEntry *directo ModInfoDialog::~ModInfoDialog() { + m_ModInfo->setComments(ui->commentsEdit->text()); m_ModInfo->setNotes(ui->notesEdit->toPlainText()); saveCategories(ui->categoriesTree->invisibleRootItem()); saveIniTweaks(); // ini tweaks are written to the ini file directly. This is the only information not managed by ModInfo diff --git a/src/modinfodialog.ui b/src/modinfodialog.ui index b3873bf3..671c7f31 100644 --- a/src/modinfodialog.ui +++ b/src/modinfodialog.ui @@ -782,7 +782,30 @@ p, li { white-space: pre-wrap; } - + + + Enter comments about the mod here. These are displayed in the notes column of the mod list. + + + Enter comments about the mod here. These are displayed in the notes column of the mod list. + + + Enter comments about the mod here. These are displayed in the notes column of the mod list. + + + + + + + Enter notes about the mod here. These can be viewed in the mod list by hovering over the notes column or the flags column. + + + Enter notes about the mod here. These can be viewed in the mod list by hovering over the notes column or the flags column. + + + Enter notes about the mod here. These can be viewed in the mod list by hovering over the notes column or the flags column. + + diff --git a/src/modinfoforeign.h b/src/modinfoforeign.h index 0d7b3847..93061294 100644 --- a/src/modinfoforeign.h +++ b/src/modinfoforeign.h @@ -18,6 +18,7 @@ public: virtual bool updateNXMInfo() { return false; } virtual void setCategory(int, bool) {} virtual bool setName(const QString&) { return false; } + virtual void setComments(const QString&) {} virtual void setNotes(const QString&) {} virtual void setGameName(QString) {} virtual void setNexusID(int) {} @@ -33,6 +34,7 @@ public: virtual bool isEmpty() const { return false; } virtual QString name() const; virtual QString internalName() const { return name(); } + virtual QString comments() const { return ""; } virtual QString notes() const { return ""; } virtual QDateTime creationTime() const; virtual QString absolutePath() const; diff --git a/src/modinfooverwrite.h b/src/modinfooverwrite.h index 5681dc6f..4b98d715 100644 --- a/src/modinfooverwrite.h +++ b/src/modinfooverwrite.h @@ -20,6 +20,7 @@ public: virtual bool updateNXMInfo() { return false; } virtual void setCategory(int, bool) {} virtual bool setName(const QString&) { return false; } + virtual void setComments(const QString&) {} virtual void setNotes(const QString&) {} virtual void setGameName(QString) {} virtual void setNexusID(int) {} @@ -35,6 +36,7 @@ public: virtual bool alwaysEnabled() const { return true; } virtual bool isEmpty() const; virtual QString name() const { return "Overwrite"; } + virtual QString comments() const { return ""; } virtual QString notes() const { return ""; } virtual QDateTime creationTime() const { return QDateTime(); } virtual QString absolutePath() const; diff --git a/src/modinforegular.cpp b/src/modinforegular.cpp index d0f56a52..6a52d3df 100644 --- a/src/modinforegular.cpp +++ b/src/modinforegular.cpp @@ -76,6 +76,7 @@ bool ModInfoRegular::isEmpty() const void ModInfoRegular::readMeta() { QSettings metaFile(m_Path + "/meta.ini", QSettings::IniFormat); + m_Comments = metaFile.value("comments", "").toString(); m_Notes = metaFile.value("notes", "").toString(); QString tempGameName = metaFile.value("gameName", m_GameName).toString(); if (tempGameName.size()) m_GameName = tempGameName; @@ -148,6 +149,7 @@ void ModInfoRegular::saveMeta() metaFile.setValue("repository", m_Repository); metaFile.setValue("gameName", m_GameName); metaFile.setValue("modid", m_NexusID); + metaFile.setValue("comments", m_Comments); metaFile.setValue("notes", m_Notes); metaFile.setValue("nexusDescription", m_NexusDescription); metaFile.setValue("url", m_URL); @@ -324,6 +326,12 @@ bool ModInfoRegular::setName(const QString &name) return true; } +void ModInfoRegular::setComments(const QString &comments) +{ + m_Comments = comments; + m_MetaInfoChanged = true; +} + void ModInfoRegular::setNotes(const QString ¬es) { m_Notes = notes; @@ -405,7 +413,7 @@ void ModInfoRegular::setColor(QColor color) m_MetaInfoChanged = true; } -QColor ModInfoRegular::getColor() +QColor ModInfoRegular::getColor() { return m_Color; } @@ -510,7 +518,7 @@ std::vector ModInfoRegular::getContents() const if (sePluginDir.entryList(QStringList() << "*.dll").size() > 0) { m_CachedContent.push_back(CONTENT_SKSE); } - } + } } if (dir.exists("textures") || dir.exists("icons") || dir.exists("bookart")) m_CachedContent.push_back(CONTENT_TEXTURE); @@ -567,6 +575,11 @@ QString ModInfoRegular::getDescription() const } } +QString ModInfoRegular::comments() const +{ + return m_Comments; +} + QString ModInfoRegular::notes() const { return m_Notes; diff --git a/src/modinforegular.h b/src/modinforegular.h index 78a6e58a..33b26998 100644 --- a/src/modinforegular.h +++ b/src/modinforegular.h @@ -90,6 +90,12 @@ public: **/ bool setName(const QString &name); + /** + * @brief changes the comments (manually set information displayed in the mod list) for this mod + * @param comments new comments + */ + void setComments(const QString &comments); + /** * @brief change the notes (manually set information) for this mod * @param notes new notes @@ -279,6 +285,11 @@ public: */ virtual QString getDescription() const; + /** + * @return comments for this mod + */ + virtual QString comments() const; + /** * @return manually set notes for this mod */ @@ -353,6 +364,7 @@ private: QString m_Name; QString m_Path; QString m_InstallationFile; + QString m_Comments; QString m_Notes; QString m_NexusDescription; QString m_Repository; diff --git a/src/modlist.cpp b/src/modlist.cpp index 7ca0667a..547cc853 100644 --- a/src/modlist.cpp +++ b/src/modlist.cpp @@ -150,7 +150,14 @@ QString ModList::getFlagText(ModInfo::EFlag flag, ModInfo::Ptr modInfo) const case ModInfo::FLAG_SEPARATOR: return tr("Separator"); case ModInfo::FLAG_INVALID: return tr("No valid game data"); case ModInfo::FLAG_NOTENDORSED: return tr("Not endorsed yet"); - case ModInfo::FLAG_NOTES: return QString("%1").arg(modInfo->notes().replace("\n", "
")); + case ModInfo::FLAG_NOTES: { + QStringList output; + if (!modInfo->comments().isEmpty()) + output << QString("%1").arg(modInfo->comments()); + if (!modInfo->notes().isEmpty()) + output << QString("%1").arg(modInfo->notes()).replace("\n", "
"); + return output.join("
"); + } case ModInfo::FLAG_CONFLICT_OVERWRITE: return tr("Overwrites files"); case ModInfo::FLAG_CONFLICT_OVERWRITTEN: return tr("Overwritten files"); case ModInfo::FLAG_CONFLICT_MIXED: return tr("Overwrites & Overwritten"); @@ -276,6 +283,8 @@ QVariant ModList::data(const QModelIndex &modelIndex, int role) const } else { return QVariant(); } + } else if (column == COL_NOTES) { + return modInfo->comments(); } else { return tr("invalid"); } @@ -295,6 +304,8 @@ QVariant ModList::data(const QModelIndex &modelIndex, int role) const } } else if (column == COL_VERSION) { return QVariant(Qt::AlignRight | Qt::AlignVCenter); + } else if (column == COL_NOTES) { + return QVariant(Qt::AlignLeft | Qt::AlignVCenter); } else { return QVariant(Qt::AlignCenter | Qt::AlignVCenter); } @@ -443,6 +454,8 @@ QVariant ModList::data(const QModelIndex &modelIndex, int role) const } return ToQString(categoryString.str()); + } else if (column == COL_NOTES) { + return getFlagText(ModInfo::FLAG_NOTES, modInfo); } else { return QVariant(); } @@ -559,6 +572,10 @@ bool ModList::setData(const QModelIndex &index, const QVariant &value, int role) result = false; } } break; + case COL_NOTES: { + info->setComments(value.toString()); + result = true; + } break; default: { qWarning("edit on column \"%s\" not supported", getColumnName(index.column()).toUtf8().constData()); @@ -625,7 +642,8 @@ Qt::ItemFlags ModList::flags(const QModelIndex &modelIndex) const (modelIndex.column() == COL_MODID)) { result |= Qt::ItemIsEditable; } - if ((modelIndex.column() == COL_NAME) + if (((modelIndex.column() == COL_NAME) || + (modelIndex.column() == COL_NOTES)) && (std::find(flags.begin(), flags.end(), ModInfo::FLAG_FOREIGN) == flags.end())) { result |= Qt::ItemIsEditable; } @@ -1147,6 +1165,7 @@ QString ModList::getColumnName(int column) case COL_GAME: return tr("Source Game"); case COL_MODID: return tr("Nexus ID"); case COL_INSTALLTIME: return tr("Installation"); + case COL_NOTES: return tr("Notes"); default: return tr("unknown"); } } @@ -1182,6 +1201,7 @@ QString ModList::getColumnToolTip(int column) ""); case COL_INSTALLTIME: return tr("Time this mod was installed"); + case COL_NOTES: return tr("User notes about the mod"); default: return tr("unknown"); } } diff --git a/src/modlist.h b/src/modlist.h index 8de08da3..42269386 100644 --- a/src/modlist.h +++ b/src/modlist.h @@ -65,8 +65,9 @@ public: COL_VERSION, COL_INSTALLTIME, COL_PRIORITY, + COL_NOTES, - COL_LASTCOLUMN = COL_PRIORITY + COL_LASTCOLUMN = COL_NOTES }; typedef boost::signals2::signal SignalModStateChanged; -- cgit v1.3.1