diff options
| author | LostDragonist <lost.dragonist@gmail.com> | 2018-12-24 21:43:57 -0600 |
|---|---|---|
| committer | LostDragonist <lost.dragonist@gmail.com> | 2018-12-24 22:37:53 -0600 |
| commit | 40a3e93c4698f31494df6483ff964a535342e177 (patch) | |
| tree | 1528751ac02d9d170e4b4014f6e579ebbb3132e3 | |
| parent | d021011cfa1f9276dc9c3dd7c2fcd395e3a78260 (diff) | |
Add an option to disable endorsements
| -rw-r--r-- | src/mainwindow.cpp | 7 | ||||
| -rw-r--r-- | src/modinfodialog.cpp | 2 | ||||
| -rw-r--r-- | src/modinforegular.cpp | 5 | ||||
| -rw-r--r-- | src/settings.cpp | 8 | ||||
| -rw-r--r-- | src/settings.h | 6 | ||||
| -rw-r--r-- | src/settingsdialog.ui | 64 |
6 files changed, 61 insertions, 31 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 47fe4308..10b91c7c 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -4270,7 +4270,7 @@ void MainWindow::on_modList_customContextMenuRequested(const QPoint &pos) menu->addSeparator();
- if (info->getNexusID() > 0) {
+ if (info->getNexusID() > 0 && Settings::instance().endorsementIntegration()) {
switch (info->endorsedState()) {
case ModInfo::ENDORSED_TRUE: {
menu->addAction(tr("Un-Endorse"), this, SLOT(unendorse_clicked()));
@@ -5143,7 +5143,7 @@ void MainWindow::nxmUpdatesAvailable(const std::vector<int> &modIDs, QVariant us if (game
&& result["id"].toInt() == game->nexusModOrganizerID()
&& result["game_id"].toInt() == game->nexusGameID()) {
- if (!result["voted_by_user"].toBool()) {
+ if (!result["voted_by_user"].toBool() && Settings::instance().endorsementIntegration()) {
ui->actionEndorseMO->setVisible(true);
}
} else {
@@ -5167,7 +5167,8 @@ void MainWindow::nxmUpdatesAvailable(const std::vector<int> &modIDs, QVariant us (*iter)->setNewestVersion(result["version"].toString());
(*iter)->setNexusDescription(result["description"].toString());
if (NexusInterface::instance(&m_PluginContainer)->getAccessManager()->loggedIn() &&
- result.contains("voted_by_user")) {
+ result.contains("voted_by_user") &&
+ Settings::instance().endorsementIntegration()) {
// don't use endorsement info if we're not logged in or if the response doesn't contain it
(*iter)->setIsEndorsed(result["voted_by_user"].toBool());
}
diff --git a/src/modinfodialog.cpp b/src/modinfodialog.cpp index 6d894237..c8e0fb9e 100644 --- a/src/modinfodialog.cpp +++ b/src/modinfodialog.cpp @@ -171,8 +171,8 @@ ModInfoDialog::ModInfoDialog(ModInfo::Ptr modInfo, const DirectoryEntry *directo ui->tabWidget->setTabEnabled(TAB_CONFLICTS, m_Origin != nullptr);
-
+ ui->endorseBtn->setVisible(Settings::instance().endorsementIntegration());
ui->endorseBtn->setEnabled((m_ModInfo->endorsedState() == ModInfo::ENDORSED_FALSE) ||
(m_ModInfo->endorsedState() == ModInfo::ENDORSED_NEVER));
diff --git a/src/modinforegular.cpp b/src/modinforegular.cpp index 6a52d3df..548e3178 100644 --- a/src/modinforegular.cpp +++ b/src/modinforegular.cpp @@ -4,6 +4,7 @@ #include "messagedialog.h" #include "report.h" #include "scriptextender.h" +#include "settings.h" #include <QApplication> #include <QDirIterator> @@ -466,7 +467,9 @@ void ModInfoRegular::ignoreUpdate(bool ignore) std::vector<ModInfo::EFlag> ModInfoRegular::getFlags() const { std::vector<ModInfo::EFlag> result = ModInfoWithConflictInfo::getFlags(); - if ((m_NexusID > 0) && (endorsedState() == ENDORSED_FALSE)) { + if ((m_NexusID > 0) && + (endorsedState() == ENDORSED_FALSE) && + Settings::instance().endorsementIntegration()) { result.push_back(ModInfo::FLAG_NOTENDORSED); } if (!isValid() && !m_Validated) { diff --git a/src/settings.cpp b/src/settings.cpp index 18e893cb..42bf1357 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -459,6 +459,11 @@ bool Settings::useProxy() const return m_Settings.value("Settings/use_proxy", false).toBool(); } +bool Settings::endorsementIntegration() const +{ + return m_Settings.value("Settings/endorsement_integration", true).toBool(); +} + bool Settings::displayForeign() const { return m_Settings.value("Settings/display_foreign", true).toBool(); @@ -941,6 +946,7 @@ Settings::NexusTab::NexusTab(Settings *parent, SettingsDialog &dialog) , m_knownServersList(dialog.findChild<QListWidget *>("knownServersList")) , m_preferredServersList( dialog.findChild<QListWidget *>("preferredServersList")) + , m_endorsementBox(dialog.findChild<QCheckBox *>("endorsementBox")) { if (parent->automaticLoginEnabled()) { m_loginCheckBox->setChecked(true); @@ -950,6 +956,7 @@ Settings::NexusTab::NexusTab(Settings *parent, SettingsDialog &dialog) m_offlineBox->setChecked(parent->offlineMode()); m_proxyBox->setChecked(parent->useProxy()); + m_endorsementBox->setChecked(parent->endorsementIntegration()); // display server preferences m_Settings.beginGroup("Servers"); @@ -991,6 +998,7 @@ void Settings::NexusTab::update() } m_Settings.setValue("Settings/offline_mode", m_offlineBox->isChecked()); m_Settings.setValue("Settings/use_proxy", m_proxyBox->isChecked()); + m_Settings.setValue("Settings/endorsement_integration", m_endorsementBox->isChecked()); // store server preference m_Settings.beginGroup("Servers"); diff --git a/src/settings.h b/src/settings.h index 912864e2..25f22911 100644 --- a/src/settings.h +++ b/src/settings.h @@ -271,6 +271,11 @@ public: bool useProxy() const; /** + * @return true if endorsement integration is enabled + */ + bool endorsementIntegration() const; + + /** * @return true if the user wants to see non-official plugins installed outside MO in his mod list */ bool displayForeign() const; @@ -470,6 +475,7 @@ private: QCheckBox *m_proxyBox; QListWidget *m_knownServersList; QListWidget *m_preferredServersList; + QCheckBox *m_endorsementBox; }; /** Display/store the configuration in the 'steam' tab of the settings dialogue */ diff --git a/src/settingsdialog.ui b/src/settingsdialog.ui index 0412fc10..d9fa92d8 100644 --- a/src/settingsdialog.ui +++ b/src/settingsdialog.ui @@ -537,30 +537,44 @@ p, li { white-space: pre-wrap; } </widget>
</item>
<item>
- <widget class="QCheckBox" name="offlineBox">
- <property name="statusTip">
- <string>Disable automatic internet features</string>
- </property>
- <property name="whatsThis">
- <string>Disable automatic internet features. This does not affect features that are explicitly invoked by the user (like checking mods for updates, endorsing, opening the web browser)</string>
- </property>
- <property name="text">
- <string>Offline Mode</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QCheckBox" name="proxyBox">
- <property name="statusTip">
- <string>Use a proxy for network connections.</string>
- </property>
- <property name="whatsThis">
- <string>Use a proxy for network connections. This uses the system-wide settings which can be configured in Internet Explorer. Please note that MO will start up a few seconds slower on some systems when using a proxy.</string>
- </property>
- <property name="text">
- <string>Use HTTP Proxy (Uses System Settings)</string>
- </property>
- </widget>
+ <layout class="QGridLayout" name="gridLayout_8">
+ <item row="0" column="0">
+ <widget class="QCheckBox" name="offlineBox">
+ <property name="statusTip">
+ <string>Disable automatic internet features</string>
+ </property>
+ <property name="whatsThis">
+ <string>Disable automatic internet features. This does not affect features that are explicitly invoked by the user (like checking mods for updates, endorsing, opening the web browser)</string>
+ </property>
+ <property name="text">
+ <string>Offline Mode</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <widget class="QCheckBox" name="proxyBox">
+ <property name="statusTip">
+ <string>Use a proxy for network connections.</string>
+ </property>
+ <property name="whatsThis">
+ <string>Use a proxy for network connections. This uses the system-wide settings which can be configured in Internet Explorer. Please note that MO will start up a few seconds slower on some systems when using a proxy.</string>
+ </property>
+ <property name="text">
+ <string>Use HTTP Proxy (Uses System Settings)</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1">
+ <widget class="QCheckBox" name="endorsementBox">
+ <property name="text">
+ <string>Endorsement Integration</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_7">
@@ -1347,8 +1361,6 @@ programs you are intentionally running.</string> <tabstop>usernameEdit</tabstop>
<tabstop>passwordEdit</tabstop>
<tabstop>clearCacheButton</tabstop>
- <tabstop>offlineBox</tabstop>
- <tabstop>proxyBox</tabstop>
<tabstop>associateButton</tabstop>
<tabstop>knownServersList</tabstop>
<tabstop>preferredServersList</tabstop>
|
