summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLostDragonist <lost.dragonist@gmail.com>2018-12-08 10:37:46 -0600
committerLostDragonist <lost.dragonist@gmail.com>2018-12-08 10:44:46 -0600
commitc501b5cca081e1b3697904a3b4e1e236ea9c4e69 (patch)
tree01e2f84719dac045e5ebb57b6081ad9e6eeda5ce /src
parentc87d97de8c4e15c91f17ab35173ec6f22e80c8e5 (diff)
Add notes column to mod list
Diffstat (limited to 'src')
-rw-r--r--src/mainwindow.cpp4
-rw-r--r--src/modinfo.cpp2
-rw-r--r--src/modinfo.h17
-rw-r--r--src/modinfodialog.cpp2
-rw-r--r--src/modinfodialog.ui25
-rw-r--r--src/modinfoforeign.h2
-rw-r--r--src/modinfooverwrite.h2
-rw-r--r--src/modinforegular.cpp17
-rw-r--r--src/modinforegular.h12
-rw-r--r--src/modlist.cpp24
-rw-r--r--src/modlist.h3
11 files changed, 100 insertions, 10 deletions
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,
@@ -269,6 +269,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
*/
@@ -496,6 +502,11 @@ public:
virtual QString getDescription() const = 0;
/**
+ * @return comments for this mod
+ */
+ virtual QString comments() const = 0;
+
+ /**
* @return notes for this mod
*/
virtual QString notes() const = 0;
@@ -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; }
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_10">
<item>
- <widget class="QTextEdit" name="notesEdit"/>
+ <widget class="QLineEdit" name="commentsEdit">
+ <property name="toolTip">
+ <string>Enter comments about the mod here. These are displayed in the notes column of the mod list.</string>
+ </property>
+ <property name="whatsThis">
+ <string>Enter comments about the mod here. These are displayed in the notes column of the mod list.</string>
+ </property>
+ <property name="placeholderText">
+ <string>Enter comments about the mod here. These are displayed in the notes column of the mod list.</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QTextEdit" name="notesEdit">
+ <property name="toolTip">
+ <string>Enter notes about the mod here. These can be viewed in the mod list by hovering over the notes column or the flags column.</string>
+ </property>
+ <property name="whatsThis">
+ <string>Enter notes about the mod here. These can be viewed in the mod list by hovering over the notes column or the flags column.</string>
+ </property>
+ <property name="placeholderText">
+ <string>Enter notes about the mod here. These can be viewed in the mod list by hovering over the notes column or the flags column.</string>
+ </property>
+ </widget>
</item>
</layout>
</widget>
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 &notes)
{
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<ModInfo::EContent> 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
@@ -91,6 +91,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
*/
@@ -280,6 +286,11 @@ public:
virtual QString getDescription() const;
/**
+ * @return comments for this mod
+ */
+ virtual QString comments() const;
+
+ /**
* @return manually set notes for this mod
*/
virtual QString notes() const;
@@ -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("<i>%1</i>").arg(modInfo->notes().replace("\n", "<br>"));
+ case ModInfo::FLAG_NOTES: {
+ QStringList output;
+ if (!modInfo->comments().isEmpty())
+ output << QString("<i>%1</i>").arg(modInfo->comments());
+ if (!modInfo->notes().isEmpty())
+ output << QString("<i>%1</i>").arg(modInfo->notes()).replace("\n", "<br>");
+ return output.join("<br>");
+ }
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)
"</table>");
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<void (const QString &, ModStates)> SignalModStateChanged;