Skip to content

Commit

Permalink
Add author and description columns to the plugin list
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanFeenstra committed Jan 31, 2025
1 parent 4ed46f5 commit c6b23f2
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/pluginlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ QString PluginList::getColumnName(int column)
return tr("Form Version");
case COL_HEADERVERSION:
return tr("Header Version");
case COL_AUTHOR:
return tr("Author");
case COL_DESCRIPTION:
return tr("Description");
default:
return tr("unknown");
}
Expand All @@ -122,6 +126,10 @@ QString PluginList::getColumnToolTip(int column)
return tr("Form version of the plugin.");
case COL_HEADERVERSION:
return tr("Header version of the plugin.");
case COL_AUTHOR:
return tr("Author of the plugin.");
case COL_DESCRIPTION:
return tr("Description of the plugin.");
default:
return tr("unknown");
}
Expand Down Expand Up @@ -1326,6 +1334,12 @@ QVariant PluginList::displayData(const QModelIndex& modelIndex) const
case COL_HEADERVERSION:
return QString::number(plugin.headerVersion);

case COL_AUTHOR:
return plugin.author;

case COL_DESCRIPTION:
return plugin.description;

default:
return {};
}
Expand Down
6 changes: 5 additions & 1 deletion src/pluginlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,10 @@ class PluginList : public QAbstractItemModel
COL_MODINDEX,
COL_FORMVERSION,
COL_HEADERVERSION,
COL_AUTHOR,
COL_DESCRIPTION,

COL_LASTCOLUMN = COL_HEADERVERSION,
COL_LASTCOLUMN = COL_DESCRIPTION,
};

using PluginStates = MOBase::IPluginList::PluginStates;
Expand Down Expand Up @@ -212,6 +214,8 @@ class PluginList : public QAbstractItemModel

QString getName(int index) const { return m_ESPs.at(index).name; }
int getPriority(int index) const { return m_ESPs.at(index).priority; }
QString getAuthor(int index) const { return m_ESPs.at(index).author; }
QString getDescription(int index) const { return m_ESPs.at(index).description; }
QString getIndexPriority(int index) const;
bool isESPLocked(int index) const;
void lockESPIndex(int index, bool lock);
Expand Down
9 changes: 9 additions & 0 deletions src/pluginlistsortproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,15 @@ bool PluginListSortProxy::lessThan(const QModelIndex& left,
QString rightVal = plugins->getIndexPriority(right.row());
return leftVal < rightVal;
} break;
case PluginList::COL_AUTHOR: {
return QString::compare(plugins->getAuthor(left.row()),
plugins->getAuthor(right.row()), Qt::CaseInsensitive) < 0;
} break;
case PluginList::COL_DESCRIPTION: {
return QString::compare(plugins->getDescription(left.row()),
plugins->getDescription(right.row()),
Qt::CaseInsensitive) < 0;
} break;
default: {
return plugins->getPriority(left.row()) < plugins->getPriority(right.row());
} break;
Expand Down

0 comments on commit c6b23f2

Please sign in to comment.