From 7688175c68c2f1ce85951173c0aa3e186587aa1f Mon Sep 17 00:00:00 2001 From: Silarn Date: Tue, 17 Apr 2018 02:47:07 -0500 Subject: Add source game setter in mod info dialog --- src/modinfo.h | 23 ++++++++++++++-------- src/modinfobackup.h | 1 + src/modinfodialog.cpp | 25 ++++++++++++++++++++++++ src/modinfodialog.h | 1 + src/modinfodialog.ui | 52 +++++++++++++++++++++++++++++++++++++++----------- src/modinfoforeign.h | 1 + src/modinfooverwrite.h | 1 + src/modinforegular.cpp | 6 ++++++ src/modinforegular.h | 7 +++++++ 9 files changed, 98 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/modinfo.h b/src/modinfo.h index f321f068..07dccafd 100644 --- a/src/modinfo.h +++ b/src/modinfo.h @@ -265,7 +265,14 @@ public: * @brief change the notes (manually set information) for this mod * @param notes new notes */ - virtual void setNotes(const QString ¬es) = 0; + virtual void setNotes(const QString ¬es) = 0; + + /** + * @brief set/change the source game of this mod + * + * @param gameName the source game shortName + */ + virtual void setGameName(QString gameName) = 0; /** * @brief set/change the nexus mod id of this mod @@ -411,13 +418,13 @@ public: * * @return the nexus mod id. may be 0 if the mod id isn't known or doesn't exist **/ - virtual int getNexusID() const = 0; - - /** - * @brief getter for the source game repository - * - * @return the source game repository. should default to the active game. - **/ + virtual int getNexusID() const = 0; + + /** + * @brief getter for the source game repository + * + * @return the source game repository. should default to the active game. + **/ virtual QString getGameName() const = 0; /** diff --git a/src/modinfobackup.h b/src/modinfobackup.h index aa59dda4..0a59691b 100644 --- a/src/modinfobackup.h +++ b/src/modinfobackup.h @@ -14,6 +14,7 @@ public: virtual bool updateIgnored() const { return false; } virtual bool downgradeAvailable() const { return false; } virtual bool updateNXMInfo() { return false; } + virtual void setGameName(QString) {} virtual void setNexusID(int) {} virtual void endorse(bool) {} virtual int getFixedPriority() const { return -1; } diff --git a/src/modinfodialog.cpp b/src/modinfodialog.cpp index 31ffe82d..e2da6a2c 100644 --- a/src/modinfodialog.cpp +++ b/src/modinfodialog.cpp @@ -92,6 +92,21 @@ ModInfoDialog::ModInfoDialog(ModInfo::Ptr modInfo, const DirectoryEntry *directo ui->modIDEdit->setValidator(new QIntValidator(modIDEdit)); ui->modIDEdit->setText(QString("%1").arg(modInfo->getNexusID())); + ui->sourceGameEdit->addItem(organizerCore->managedGame()->gameName(), organizerCore->managedGame()->gameShortName()); + if (organizerCore->managedGame()->validShortNames().size() == 0) { + ui->sourceGameEdit->setDisabled(true); + } else { + for (auto game : pluginContainer->plugins()) { + for (QString gameName : organizerCore->managedGame()->validShortNames()) { + if (game->gameShortName().compare(gameName, Qt::CaseInsensitive) == 0) { + ui->sourceGameEdit->addItem(game->gameName(), game->gameShortName()); + break; + } + } + } + } + ui->sourceGameEdit->setCurrentIndex(ui->sourceGameEdit->findData(m_ModInfo->getGameName())); + ui->notesEdit->setText(modInfo->notes()); ui->descriptionView->setPage(new DescriptionPage); @@ -901,6 +916,16 @@ void ModInfoDialog::on_modIDEdit_editingFinished() } } +void ModInfoDialog::on_sourceGameEdit_currentIndexChanged(int) +{ + for (auto game : m_PluginContainer->plugins()) { + if (game->gameName() == ui->sourceGameEdit->currentText()) { + m_ModInfo->setGameName(game->gameShortName()); + return; + } + } +} + void ModInfoDialog::on_versionEdit_editingFinished() { VersionInfo version(ui->versionEdit->text()); diff --git a/src/modinfodialog.h b/src/modinfodialog.h index 9eb17be5..52db5654 100644 --- a/src/modinfodialog.h +++ b/src/modinfodialog.h @@ -179,6 +179,7 @@ private slots: void on_saveTXTButton_clicked(); void on_visitNexusLabel_linkActivated(const QString &link); void on_modIDEdit_editingFinished(); + void on_sourceGameEdit_currentIndexChanged(int); void on_versionEdit_editingFinished(); void on_iniFileView_textChanged(); void on_textFileView_textChanged(); diff --git a/src/modinfodialog.ui b/src/modinfodialog.ui index 05415445..9e9ba77b 100644 --- a/src/modinfodialog.ui +++ b/src/modinfodialog.ui @@ -110,19 +110,19 @@ - + false - + - Ini Tweaks *This feature is non-functional* + Ini Tweaks *This feature is non-functional* - + false - + 228 @@ -238,8 +238,8 @@ 0 0 - 98 - 28 + 676 + 126 @@ -490,7 +490,7 @@ Most mods do not have optional esps, so chances are good you are looking at an e - Qt::CustomContextMenu + Qt::CustomContextMenu Qt::ElideLeft @@ -502,7 +502,7 @@ Most mods do not have optional esps, so chances are good you are looking at an e true - 2 + 2 365 @@ -613,6 +613,36 @@ p, li { white-space: pre-wrap; } + + + + Qt::Horizontal + + + QSizePolicy::Fixed + + + + 10 + 20 + + + + + + + + Source Game + + + + + + + Mod ID for this mod on Nexus. + + + @@ -819,9 +849,9 @@ p, li { white-space: pre-wrap; } - QQuickWidget + QWebEngineView QWidget -
QtQuickWidgets/QQuickWidget
+
QtWebEngineWidgets/QWebEngineView
diff --git a/src/modinfoforeign.h b/src/modinfoforeign.h index 23500df8..0d7b3847 100644 --- a/src/modinfoforeign.h +++ b/src/modinfoforeign.h @@ -19,6 +19,7 @@ public: virtual void setCategory(int, bool) {} virtual bool setName(const QString&) { return false; } virtual void setNotes(const QString&) {} + virtual void setGameName(QString) {} virtual void setNexusID(int) {} virtual void setNewestVersion(const MOBase::VersionInfo&) {} virtual void ignoreUpdate(bool) {} diff --git a/src/modinfooverwrite.h b/src/modinfooverwrite.h index 360c7335..5681dc6f 100644 --- a/src/modinfooverwrite.h +++ b/src/modinfooverwrite.h @@ -21,6 +21,7 @@ public: virtual void setCategory(int, bool) {} virtual bool setName(const QString&) { return false; } virtual void setNotes(const QString&) {} + virtual void setGameName(QString) {} virtual void setNexusID(int) {} virtual void setNewestVersion(const MOBase::VersionInfo&) {} virtual void ignoreUpdate(bool) {} diff --git a/src/modinforegular.cpp b/src/modinforegular.cpp index 69718705..a514e1bf 100644 --- a/src/modinforegular.cpp +++ b/src/modinforegular.cpp @@ -319,6 +319,12 @@ void ModInfoRegular::setNotes(const QString ¬es) m_MetaInfoChanged = true; } +void ModInfoRegular::setGameName(QString gameName) +{ + m_GameName = gameName; + m_MetaInfoChanged = true; +} + void ModInfoRegular::setNexusID(int modID) { m_NexusID = modID; diff --git a/src/modinforegular.h b/src/modinforegular.h index 7a6f4827..cf13872c 100644 --- a/src/modinforegular.h +++ b/src/modinforegular.h @@ -93,6 +93,13 @@ public: */ void setNotes(const QString ¬es); + /** + * @brief set/change the source game of this mod + * + * @param gameName the source game shortName + */ + void setGameName(QString gameName); + /** * @brief set/change the nexus mod id of this mod * -- cgit v1.3.1