mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-04-30 14:44:31 +02:00
Improvements to modlist export
Added .replace("{mod_id}", modID) Signed-off-by: hanlie <48323966+HanlieChina@users.noreply.github.com>
This commit is contained in:
parent
d0b9073f60
commit
6bda537633
@ -138,6 +138,15 @@ auto Mod::name() const -> QString
|
|||||||
return Resource::name();
|
return Resource::name();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto Mod::mod_id() const -> QString
|
||||||
|
{
|
||||||
|
auto d_mod_id = details().mod_id;
|
||||||
|
if (!d_mod_id.isEmpty())
|
||||||
|
return d_mod_id;
|
||||||
|
|
||||||
|
return Resource::name();
|
||||||
|
}
|
||||||
|
|
||||||
auto Mod::version() const -> QString
|
auto Mod::version() const -> QString
|
||||||
{
|
{
|
||||||
return details().version;
|
return details().version;
|
||||||
|
@ -61,6 +61,7 @@ class Mod : public Resource {
|
|||||||
|
|
||||||
auto details() const -> const ModDetails&;
|
auto details() const -> const ModDetails&;
|
||||||
auto name() const -> QString override;
|
auto name() const -> QString override;
|
||||||
|
auto mod_id() const -> QString;
|
||||||
auto version() const -> QString;
|
auto version() const -> QString;
|
||||||
auto homepage() const -> QString override;
|
auto homepage() const -> QString override;
|
||||||
auto description() const -> QString;
|
auto description() const -> QString;
|
||||||
|
@ -152,6 +152,9 @@ class Resource : public QObject {
|
|||||||
|
|
||||||
[[nodiscard]] bool isMoreThanOneHardLink() const;
|
[[nodiscard]] bool isMoreThanOneHardLink() const;
|
||||||
|
|
||||||
|
[[nodiscard]] auto mod_id() const -> QString { return m_mod_id; }
|
||||||
|
void setModId(const QString& modId) { m_mod_id = modId; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/* The file corresponding to this resource. */
|
/* The file corresponding to this resource. */
|
||||||
QFileInfo m_file_info;
|
QFileInfo m_file_info;
|
||||||
@ -162,6 +165,7 @@ class Resource : public QObject {
|
|||||||
QString m_internal_id;
|
QString m_internal_id;
|
||||||
/* Name as reported via the file name. In the absence of a better name, this is shown to the user. */
|
/* Name as reported via the file name. In the absence of a better name, this is shown to the user. */
|
||||||
QString m_name;
|
QString m_name;
|
||||||
|
QString m_mod_id;
|
||||||
|
|
||||||
/* The type of file we're dealing with. */
|
/* The type of file we're dealing with. */
|
||||||
ResourceType m_type = ResourceType::UNKNOWN;
|
ResourceType m_type = ResourceType::UNKNOWN;
|
||||||
|
@ -203,6 +203,7 @@ QString exportToModList(QList<Mod*> mods, QString lineTemplate)
|
|||||||
for (auto mod : mods) {
|
for (auto mod : mods) {
|
||||||
auto meta = mod->metadata();
|
auto meta = mod->metadata();
|
||||||
auto modName = mod->name();
|
auto modName = mod->name();
|
||||||
|
auto modID = mod->mod_id();
|
||||||
auto url = mod->homepage();
|
auto url = mod->homepage();
|
||||||
auto ver = mod->version();
|
auto ver = mod->version();
|
||||||
if (ver.isEmpty() && meta != nullptr)
|
if (ver.isEmpty() && meta != nullptr)
|
||||||
@ -211,6 +212,7 @@ QString exportToModList(QList<Mod*> mods, QString lineTemplate)
|
|||||||
auto filename = mod->fileinfo().fileName();
|
auto filename = mod->fileinfo().fileName();
|
||||||
lines << QString(lineTemplate)
|
lines << QString(lineTemplate)
|
||||||
.replace("{name}", modName)
|
.replace("{name}", modName)
|
||||||
|
.replace("{mod_id}", modID)
|
||||||
.replace("{url}", url)
|
.replace("{url}", url)
|
||||||
.replace("{version}", ver)
|
.replace("{version}", ver)
|
||||||
.replace("{authors}", authors)
|
.replace("{authors}", authors)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user