diff options
| author | Silarn <jrim@rimpo.org> | 2018-04-17 02:47:07 -0500 |
|---|---|---|
| committer | Silarn <jrim@rimpo.org> | 2018-04-17 02:47:07 -0500 |
| commit | 7688175c68c2f1ce85951173c0aa3e186587aa1f (patch) | |
| tree | fdbe99b1158c90ae5dc71a9d7871dd236f2e2c24 | |
| parent | b4eae6e5d1cbd92140e9a1058d623a4338a35c43 (diff) | |
Add source game setter in mod info dialog
| -rw-r--r-- | src/modinfo.h | 23 | ||||
| -rw-r--r-- | src/modinfobackup.h | 1 | ||||
| -rw-r--r-- | src/modinfodialog.cpp | 25 | ||||
| -rw-r--r-- | src/modinfodialog.h | 1 | ||||
| -rw-r--r-- | src/modinfodialog.ui | 52 | ||||
| -rw-r--r-- | src/modinfoforeign.h | 1 | ||||
| -rw-r--r-- | src/modinfooverwrite.h | 1 | ||||
| -rw-r--r-- | src/modinforegular.cpp | 6 | ||||
| -rw-r--r-- | src/modinforegular.h | 7 |
9 files changed, 98 insertions, 19 deletions
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<IPluginGame>()) {
+ 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<IPluginGame>()) {
+ 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 @@ </item>
<item>
<widget class="QLabel" name="label_5">
- <property name="enabled">
+ <property name="enabled">
<bool>false</bool>
- </property>
+ </property>
<property name="text">
- <string>Ini Tweaks *This feature is non-functional*</string>
+ <string>Ini Tweaks *This feature is non-functional*</string>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="iniTweaksList">
- <property name="enabled">
+ <property name="enabled">
<bool>false</bool>
- </property>
+ </property>
<property name="maximumSize">
<size>
<width>228</width>
@@ -238,8 +238,8 @@ <rect>
<x>0</x>
<y>0</y>
- <width>98</width>
- <height>28</height>
+ <width>676</width>
+ <height>126</height>
</rect>
</property>
<property name="toolTip">
@@ -490,7 +490,7 @@ Most mods do not have optional esps, so chances are good you are looking at an e <item>
<widget class="QTreeWidget" name="overwrittenTree">
<property name="contextMenuPolicy">
- <enum>Qt::CustomContextMenu</enum>
+ <enum>Qt::CustomContextMenu</enum>
</property>
<property name="textElideMode">
<enum>Qt::ElideLeft</enum>
@@ -502,7 +502,7 @@ Most mods do not have optional esps, so chances are good you are looking at an e <bool>true</bool>
</property>
<property name="columnCount">
- <number>2</number>
+ <number>2</number>
</property>
<attribute name="headerDefaultSectionSize">
<number>365</number>
@@ -614,6 +614,36 @@ p, li { white-space: pre-wrap; } </widget>
</item>
<item>
+ <spacer name="horizontalSpacer_4">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>10</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_10">
+ <property name="text">
+ <string>Source Game</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QComboBox" name="sourceGameEdit">
+ <property name="toolTip">
+ <string>Mod ID for this mod on Nexus.</string>
+ </property>
+ </widget>
+ </item>
+ <item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -819,9 +849,9 @@ p, li { white-space: pre-wrap; } </widget>
<customwidgets>
<customwidget>
- <class>QQuickWidget</class>
+ <class>QWebEngineView</class>
<extends>QWidget</extends>
- <header>QtQuickWidgets/QQuickWidget</header>
+ <header location="global">QtWebEngineWidgets/QWebEngineView</header>
</customwidget>
</customwidgets>
<resources>
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 @@ -94,6 +94,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 * * @param modID the nexus mod id |
