From c2ed511ff0822e2003b0ec3fe574a2a9e6b9d592 Mon Sep 17 00:00:00 2001 From: Silarn Date: Tue, 21 May 2019 01:41:12 -0500 Subject: With old mods, only queue the old ones in case of API overflow --- src/modinfo.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/modinfo.cpp') diff --git a/src/modinfo.cpp b/src/modinfo.cpp index c1974152..bc2979ef 100644 --- a/src/modinfo.cpp +++ b/src/modinfo.cpp @@ -313,19 +313,23 @@ bool ModInfo::checkAllForUpdate(PluginContainer *pluginContainer, QObject *recei if (latest < QDateTime::currentDateTimeUtc().addDays(-30)) { std::set> organizedGames; for (auto mod : s_Collection) { - if (mod->canBeUpdated()) { + if (mod->canBeUpdated() && mod->getLastNexusUpdate() < QDateTime::currentDateTimeUtc().addDays(-30)) { organizedGames.insert(std::make_pair(mod->getGameName().toLower(), mod->getNexusID())); } } if (organizedGames.empty()) { - qWarning("All of your mods have been checked recently. We restrict update checks to help preserve your available API requests."); + qWarning() << tr("All of your mods have been checked recently. We restrict update checks to help preserve your available API requests."); updatesAvailable = false; + } else { + qInfo() << tr( + "You have mods that haven't been checked within 30 days using the new API. These mods must be checked before we can use the bulk update API. " + "This will consume significantly more API requests than usual. You will need to rerun the update check once complete in order to parse the remaining mods." + ); } - for (auto game : organizedGames) { + for (auto game : organizedGames) NexusInterface::instance(pluginContainer)->requestUpdates(game.second, receiver, QVariant(), game.first, QString()); - } } else if (earliest < QDateTime::currentDateTimeUtc().addDays(-30)) { for (auto gameName : games) NexusInterface::instance(pluginContainer)->requestUpdateInfo(gameName, NexusInterface::UpdatePeriod::MONTH, receiver, QVariant(true), QString()); -- cgit v1.3.1 From 41292e02bdebea8b09c2c11ee87221672e970cdf Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Fri, 28 Jun 2019 14:21:10 -0400 Subject: changed how the mod url works: - it is now independent from the nexus mod url - it can be set in addition to having a valid mod id - both urls can be displayed in the context menu re-arranged some of the widgets on the nexus tab added a track button added a custom url checkbox and open in browser button added a max-width to the browser --- src/mainwindow.cpp | 44 +++--- src/modinfo.cpp | 19 +++ src/modinfo.h | 29 +++- src/modinfodialog.ui | 341 ++++++++++++++++++++++++++------------------- src/modinfodialognexus.cpp | 147 +++++++++++++------ src/modinfodialognexus.h | 11 +- src/modinforegular.cpp | 85 ++++++++++- src/modinforegular.h | 16 +-- 8 files changed, 462 insertions(+), 230 deletions(-) (limited to 'src/modinfo.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d75e8d9d..d48fae4f 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -3429,18 +3429,16 @@ void MainWindow::visitOnNexus_clicked() int row_idx; ModInfo::Ptr info; QString gameName; - QString webUrl; + for (QModelIndex idx : selection->selectedRows()) { row_idx = idx.data(Qt::UserRole + 1).toInt(); info = ModInfo::getByIndex(row_idx); int modID = info->getNexusID(); - webUrl = info->getURL(); gameName = info->getGameName(); if (modID > 0) { linkClicked(NexusInterface::instance(&m_PluginContainer)->getModURL(modID, gameName)); - } - else if (webUrl != "") { - linkClicked(webUrl); + } else { + qCritical() << "mod '" << info->name() << "' has no nexus id"; } } } @@ -3450,14 +3448,13 @@ void MainWindow::visitOnNexus_clicked() if (modID > 0) { linkClicked(NexusInterface::instance(&m_PluginContainer)->getModURL(modID, gameName)); } else { - MessageDialog::showMessage(tr("Nexus ID for this Mod is unknown"), this); + MessageDialog::showMessage(tr("Nexus ID for this mod is unknown"), this); } } } void MainWindow::visitWebPage_clicked() { - QItemSelectionModel *selection = ui->modList->selectionModel(); if (selection->hasSelection() && selection->selectedRows().count() > 1) { int count = selection->selectedRows().count(); @@ -3471,28 +3468,22 @@ void MainWindow::visitWebPage_clicked() int row_idx; ModInfo::Ptr info; QString gameName; - QString webUrl; for (QModelIndex idx : selection->selectedRows()) { row_idx = idx.data(Qt::UserRole + 1).toInt(); info = ModInfo::getByIndex(row_idx); - int modID = info->getNexusID(); - webUrl = info->getURL(); - gameName = info->getGameName(); - if (modID > 0) { - linkClicked(NexusInterface::instance(&m_PluginContainer)->getModURL(modID, gameName)); - } - else if (webUrl != "") { - linkClicked(webUrl); + + const auto url = info->parseCustomURL(); + if (url.isValid()) { + linkClicked(url.toString()); } } } else { ModInfo::Ptr info = ModInfo::getByIndex(m_ContextRow); - if (info->getURL() != "") { - linkClicked(info->getURL()); - } - else { - MessageDialog::showMessage(tr("Web page for this mod is unknown"), this); + + const auto url = info->parseCustomURL(); + if (url.isValid()) { + linkClicked(url.toString()); } } } @@ -4711,7 +4702,7 @@ void MainWindow::exportModListCSV() builder.writeHeader(); auto indexesByPriority = m_OrganizerCore.currentProfile()->getAllIndexesByPriority(); - for (auto& iter : indexesByPriority) { + for (auto& iter : indexesByPriority) { ModInfo::Ptr info = ModInfo::getByIndex(iter.second); bool enabled = m_OrganizerCore.currentProfile()->modEnabled(iter.second); if ((selectedRowID == 1) && !enabled) { @@ -4991,8 +4982,13 @@ void MainWindow::on_modList_customContextMenuRequested(const QPoint &pos) if (info->getNexusID() > 0) { menu.addAction(tr("Visit on Nexus"), this, SLOT(visitOnNexus_clicked())); - } else if ((info->getURL() != "")) { - menu.addAction(tr("Visit web page"), this, SLOT(visitWebPage_clicked())); + } + + const auto url = info->parseCustomURL(); + if (url.isValid()) { + menu.addAction( + tr("Visit on %1").arg(url.host()), + this, SLOT(visitWebPage_clicked())); } menu.addAction(tr("Open in Explorer"), this, SLOT(openExplorer_clicked())); diff --git a/src/modinfo.cpp b/src/modinfo.cpp index bc2979ef..585d4963 100644 --- a/src/modinfo.cpp +++ b/src/modinfo.cpp @@ -520,3 +520,22 @@ void ModInfo::testValid() dirIter.next(); } } + +QUrl ModInfo::parseCustomURL() const +{ + if (!hasCustomURL() || getCustomURL().isEmpty()) { + return {}; + } + + const auto url = QUrl::fromUserInput(getCustomURL()); + + if (!url.isValid()) { + qCritical() + << "mod '" << name() << "' has an invalid custom url " + << "'" << getCustomURL() << "'"; + + return {}; + } + + return url; +} diff --git a/src/modinfo.h b/src/modinfo.h index f1d816fe..e395f45b 100644 --- a/src/modinfo.h +++ b/src/modinfo.h @@ -733,14 +733,31 @@ public: virtual void doConflictCheck() const {} /** - * @brief set the URL for a mod - */ - virtual void setURL(QString const &) {} + * @brief sets whether this mod uses a custom url + **/ + virtual void setHasCustomURL(bool) {} /** - * @returns the URL for a mod - */ - virtual QString getURL() const { return ""; } + * @brief returns whether this mod uses a custom url + **/ + virtual bool hasCustomURL() const { return false; } + + /** + * @brief sets the custom url + **/ + virtual void setCustomURL(QString const &) {} + + /** + * @brief returns the custom url + **/ + virtual QString getCustomURL() const { return ""; } + + /** + * If hasCustomURL() is true and getCustomURL() is not empty, tries to parse + * the url using QUrl::fromUserInput() and returns it. Otherwise, returns an + * empty QUrl. + **/ + QUrl parseCustomURL() const; signals: diff --git a/src/modinfodialog.ui b/src/modinfodialog.ui index 4de65e95..78f19a36 100644 --- a/src/modinfodialog.ui +++ b/src/modinfodialog.ui @@ -491,7 +491,7 @@ Most mods do not have optional esps, so chances are good you are looking at an e - 1 + 0 @@ -887,138 +887,8 @@ text-align: left; - - - - - - 0 - 0 - - - - Refresh - - - Refresh all information from Nexus. - - - Refresh - - - - :/MO/gui/refresh:/MO/gui/refresh - - - Qt::ToolButtonTextBesideIcon - - - - - - - Open in Browser - - - - :/MO/gui/resources/internet-web-browser.png:/MO/gui/resources/internet-web-browser.png - - - Qt::ToolButtonTextBesideIcon - - - - - - - Endorse - - - - :/MO/gui/icon_favorite:/MO/gui/icon_favorite - - - Qt::ToolButtonTextBesideIcon - - - - - - - Mod ID - - - - - - - Mod ID for this mod on Nexus. - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Mod ID for this mod on Nexus. This is filled in automatically if you downloaded and installed the mod from inside MO. Otherwise you can enter it manually. To find the correct id, find the mod on nexus. The URL will look like this: <a href=" https://www.nexusmods.com/skyrimspecialedition/mods/6194"><span style=" text-decoration: underline; color:#0000ff;">https://www.nexusmods.com/skyrimspecialedition/mods/6194</span></a>. In this example, 6194 is the id you're looking for. Besides: The above is the link to Mod Organizer 2 on Nexus. Why not go there now and endorse us?</p></body></html> - - - - - - - Source Game - - - - - - - Source game for this mod. - - - <html><head/><body><p>Source game for this mod. This determines where the mod was downloaded from and decides where to fetch info, version updates, and send endorsements. Changing this will likely require you to enter a new Mod ID.</p></body></html> - - - - - - - <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> -<html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Installed Version of the Mod. The tooltip will contain the current version available on nexus. The installed version is only set if you installed the mod through MO.</span></p></body></html> - - - Version - - - - - - - 32 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - + + 0 @@ -1032,17 +902,169 @@ p, li { white-space: pre-wrap; } 0 - - - URL - - + + + + + Mod ID + + + + + + + Mod ID for this mod on Nexus. + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Mod ID for this mod on Nexus. This is filled in automatically if you downloaded and installed the mod from inside MO. Otherwise you can enter it manually. To find the correct id, find the mod on nexus. The URL will look like this: <a href=" https://www.nexusmods.com/skyrimspecialedition/mods/6194"><span style=" text-decoration: underline; color:#0000ff;">https://www.nexusmods.com/skyrimspecialedition/mods/6194</span></a>. In this example, 6194 is the id you're looking for. Besides: The above is the link to Mod Organizer 2 on Nexus. Why not go there now and endorse us?</p></body></html> + + + + + + + Source Game + + + + + + + Source game for this mod. + + + <html><head/><body><p>Source game for this mod. This determines where the mod was downloaded from and decides where to fetch info, version updates, and send endorsements. Changing this will likely require you to enter a new Mod ID.</p></body></html> + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:8pt;">Installed Version of the Mod. The tooltip will contain the current version available on nexus. The installed version is only set if you installed the mod through MO.</span></p></body></html> + + + Version + + + + + + + 32 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + - - - true - + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 0 + 0 + + + + Refresh + + + Refresh all information from Nexus. + + + Refresh + + + + :/MO/gui/refresh:/MO/gui/refresh + + + + + + + Open in Browser + + + + :/MO/gui/resources/internet-web-browser.png:/MO/gui/resources/internet-web-browser.png + + + + + + + Endorse + + + + :/MO/gui/icon_favorite:/MO/gui/icon_favorite + + + + + + + Track + + + + :/MO/gui/tracked:/MO/gui/tracked + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + @@ -1093,6 +1115,41 @@ p, li { white-space: pre-wrap; } + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Use Custom URL + + + + + + + + + + Open in Browser + + + + + + diff --git a/src/modinfodialognexus.cpp b/src/modinfodialognexus.cpp index e1fbe352..8c8ce55a 100644 --- a/src/modinfodialognexus.cpp +++ b/src/modinfodialognexus.cpp @@ -7,6 +7,8 @@ #include #include +namespace shell = MOBase::shell; + bool isValidModID(int id) { return (id > 0); @@ -22,15 +24,20 @@ NexusTab::NexusTab( ui->endorse->setVisible(core().settings().endorsementIntegration()); connect(ui->modID, &QLineEdit::editingFinished, [&]{ onModIDChanged(); }); - connect(ui->version, &QLineEdit::editingFinished, [&]{ onVersionChanged(); }); - connect(ui->openInBrowser, &QToolButton::clicked, [&]{ onOpenLink(); }); - connect(ui->endorse, &QToolButton::clicked, [&]{ onEndorse(); }); - connect(ui->refresh, &QToolButton::clicked, [&]{ onRefreshBrowser(); }); - connect( ui->sourceGame, static_cast(&QComboBox::currentIndexChanged), [&]{ onSourceGameChanged(); }); + connect(ui->version, &QLineEdit::editingFinished, [&]{ onVersionChanged(); }); + + connect(ui->refresh, &QPushButton::clicked, [&]{ onRefreshBrowser(); }); + connect(ui->visitNexus, &QPushButton::clicked, [&]{ onVisitNexus(); }); + connect(ui->endorse, &QPushButton::clicked, [&]{ onEndorse(); }); + connect(ui->track, &QPushButton::clicked, [&]{ onTrack(); }); + + connect(ui->hasCustomURL, &QCheckBox::toggled, [&]{ onCustomURLToggled(); }); + connect(ui->customURL, &QLineEdit::editingFinished, [&]{ onCustomURLChanged(); }); + connect(ui->visitCustomURL, &QPushButton::clicked, [&]{ onVisitCustomURL(); }); } NexusTab::~NexusTab() @@ -52,7 +59,8 @@ void NexusTab::clear() ui->sourceGame->clear(); ui->version->clear(); ui->browser->setPage(new NexusTabWebpage(ui->browser)); - ui->url->clear(); + ui->hasCustomURL->setChecked(false); + ui->customURL->clear(); setHasData(false); } @@ -89,7 +97,7 @@ void NexusTab::update() connect( page, &NexusTabWebpage::linkClicked, - [&](const QUrl& url){ MOBase::shell::OpenLink(url); }); + [&](const QUrl& url){ shell::OpenLink(url); }); ui->endorse->setEnabled( (mod()->endorsedState() == ModInfo::ENDORSED_FALSE) || @@ -138,15 +146,52 @@ void NexusTab::updateWebpage() const QString nexusLink = NexusInterface::instance(&plugin()) ->getModURL(modID, mod()->getGameName()); - ui->openInBrowser->setToolTip(nexusLink); - mod()->setURL(nexusLink); + ui->visitNexus->setToolTip(nexusLink); refreshData(modID); } else { onModChanged(); } ui->version->setText(mod()->getVersion().displayString()); - ui->url->setText(mod()->getURL()); + ui->hasCustomURL->setChecked(mod()->hasCustomURL()); + ui->customURL->setText(mod()->getCustomURL()); + ui->customURL->setEnabled(mod()->hasCustomURL()); + ui->visitCustomURL->setEnabled(mod()->hasCustomURL()); + ui->visitCustomURL->setToolTip(mod()->parseCustomURL().toString()); + + updateTracking(); +} + +void NexusTab::updateTracking() +{ + if (mod()->trackedState() == ModInfo::TRACKED_TRUE) { + ui->track->setChecked(true); + ui->track->setText(tr("Tracked")); + } else { + ui->track->setChecked(false); + ui->track->setText(tr("Untracked")); + } +} + +void NexusTab::refreshData(int modID) +{ + if (tryRefreshData(modID)) { + m_requestStarted = true; + } else { + onModChanged(); + } +} + +bool NexusTab::tryRefreshData(int modID) +{ + if (isValidModID(modID) && !m_requestStarted) { + if (mod()->updateNXMInfo()) { + ui->browser->setHtml(""); + return true; + } + } + + return false; } void NexusTab::onModChanged() @@ -165,6 +210,9 @@ void NexusTab::onModChanged() font-size: 14px; background: #404040; color: #f1f1f1; + max-width: 1060px; + margin-left: auto; + margin-right: auto; } a @@ -178,12 +226,11 @@ void NexusTab::onModChanged() )"; if (nexusDescription.isEmpty()) { - descriptionAsHTML = descriptionAsHTML.arg(tr( - "
" - "

Uh oh!

" - "

Sorry, there is no description available for this mod. :(

" - "
")); - + descriptionAsHTML = descriptionAsHTML.arg(tr(R"( +
+

This mod does not have a valid Nexus ID. You can add a custom web + page for it in the "Custom URL" box below.

+
)")); } else { descriptionAsHTML = descriptionAsHTML.arg( BBCode::convertToHTML(nexusDescription)); @@ -191,6 +238,7 @@ void NexusTab::onModChanged() ui->browser->page()->setHtml(descriptionAsHTML); updateVersionColor(); + updateTracking(); } void NexusTab::onModIDChanged() @@ -241,18 +289,6 @@ void NexusTab::onVersionChanged() updateVersionColor(); } -void NexusTab::onOpenLink() -{ - const int modID = mod()->getNexusID(); - - if (isValidModID(modID)) { - const QString nexusLink = NexusInterface::instance(&plugin()) - ->getModURL(modID, mod()->getGameName()); - - MOBase::shell::OpenLink(QUrl(nexusLink)); - } -} - void NexusTab::onRefreshBrowser() { const auto modID = mod()->getNexusID(); @@ -265,28 +301,59 @@ void NexusTab::onRefreshBrowser() } } +void NexusTab::onVisitNexus() +{ + const int modID = mod()->getNexusID(); + + if (isValidModID(modID)) { + const QString nexusLink = NexusInterface::instance(&plugin()) + ->getModURL(modID, mod()->getGameName()); + + shell::OpenLink(QUrl(nexusLink)); + } +} + void NexusTab::onEndorse() { core().loggedInAction(parentWidget(), [m=mod()]{ m->endorse(true); }); } -void NexusTab::refreshData(int modID) +void NexusTab::onTrack() { - if (tryRefreshData(modID)) { - m_requestStarted = true; - } else { - onModChanged(); + core().loggedInAction(parentWidget(), [m=mod()] { + if (m->trackedState() == ModInfo::TRACKED_TRUE) { + m->track(false); + } else { + m->track(true); + } + }); +} + +void NexusTab::onCustomURLToggled() +{ + if (m_loading) { + return; } + + mod()->setHasCustomURL(ui->hasCustomURL->isChecked()); + ui->customURL->setEnabled(mod()->hasCustomURL()); + ui->visitCustomURL->setEnabled(mod()->hasCustomURL()); } -bool NexusTab::tryRefreshData(int modID) +void NexusTab::onCustomURLChanged() { - if (isValidModID(modID) && !m_requestStarted) { - if (mod()->updateNXMInfo()) { - ui->browser->setHtml(""); - return true; - } + if (m_loading) { + return; } - return false; + mod()->setCustomURL(ui->customURL->text()); + ui->visitCustomURL->setToolTip(mod()->parseCustomURL().toString()); +} + +void NexusTab::onVisitCustomURL() +{ + const auto url = mod()->parseCustomURL(); + if (url.isValid()) { + shell::OpenLink(url); + } } diff --git a/src/modinfodialognexus.h b/src/modinfodialognexus.h index 8528f0af..930c1ffc 100644 --- a/src/modinfodialognexus.h +++ b/src/modinfodialognexus.h @@ -53,17 +53,24 @@ private: void cleanup(); void updateVersionColor(); void updateWebpage(); + void updateTracking(); void refreshData(int modID); bool tryRefreshData(int modID); - void onModChanged(); - void onOpenLink(); + void onModIDChanged(); void onSourceGameChanged(); void onVersionChanged(); + void onRefreshBrowser(); + void onVisitNexus(); void onEndorse(); + void onTrack(); + + void onCustomURLToggled(); + void onCustomURLChanged(); + void onVisitCustomURL(); }; #endif // MODINFODIALOGNEXUS_H diff --git a/src/modinforegular.cpp b/src/modinforegular.cpp index 4333e351..448447e1 100644 --- a/src/modinforegular.cpp +++ b/src/modinforegular.cpp @@ -100,7 +100,70 @@ void ModInfoRegular::readMeta() m_Repository = metaFile.value("repository", "Nexus").toString(); m_Converted = metaFile.value("converted", false).toBool(); m_Validated = metaFile.value("validated", false).toBool(); - m_URL = metaFile.value("url", "").toString(); + + // this handles changes to how the URL works after 2.2.0 + // + // in 2.2.0, "hasCustomUrl" does not exist and "url" is only used when the mod + // id is invalid, although it can be set at any time in the mod info dialog + // + // post 2.2.0, a custom url can be set on any mod, whether the mod id is + // valid or not, so an additional flag "hasCustomURL" is required, with a + // corresponding checkbox in the mod info dialog + // + // there are several cases to handle to make sure no data is lost and to + // determine whether the user has set a custom url before: + // + // 1) some mods have an incorrect url set along with a valid mod id; + // there is apparently a bug with the fomod installer that can set the + // url of a mod to a value used by a _previous_ installation + // + // 2) it is possible to set the url even if the mod id is valid, in which + // case it is saved, but never used in 2.2.0 + // + // 3) opening the mod info dialog on the nexus tab for a mod that has a + // valid id will force the url to be the same as what the plugin gives + // back + // + // the algorithm is as follows: + // always read the url from the meta file and store it so this piece of data + // is never lost; the problem then only becomes about whether to enable + // hasCustomURL + // + // if hasCustomURL is present in the meta file, just read that and be + // done with it + // + // if not, then the flag depends on the mod id and the url + // if the mod id is valid, the custom url is disabled; although the url + // could be _set_ by the user when a mod id was valid, it was never + // _used_, so the behaviour won't change + // + // if the mod id is invalid, the url should normally be empty, unless the + // user specified one, in which case hasCustomURL should be true + // (the only case where this fails is if a mod id was valid before and + // the user visited the nexus tab, in which case the url was set + // automatically, but then the id was manually changed to 0 + // + // in that case, the mod id is invalid and the url is not empty, but it + // was never set by the user; this case is impossible to distinguish + // from a user manually entering a url, and so is handled as such) + + // always read the url + m_CustomURL = metaFile.value("url").toString(); + + if (metaFile.contains("hasCustomURL")) { + m_HasCustomURL = metaFile.value("hasCustomURL").toBool(); + } else { + if (m_NexusID > 0) { + // the mod id is valid, disable the custom url + m_HasCustomURL = false; + } else { + if (!m_CustomURL.isEmpty()) { + // the mod id is invalid and the url is not empty, enable it + m_HasCustomURL = true; + } + } + } + m_LastNexusQuery = QDateTime::fromString(metaFile.value("lastNexusQuery", "").toString(), Qt::ISODate); m_LastNexusUpdate = QDateTime::fromString(metaFile.value("lastNexusUpdate", "").toString(), Qt::ISODate); m_NexusLastModified = QDateTime::fromString(metaFile.value("nexusLastModified", QDateTime::currentDateTimeUtc()).toString(), Qt::ISODate); @@ -166,7 +229,8 @@ void ModInfoRegular::saveMeta() metaFile.setValue("comments", m_Comments); metaFile.setValue("notes", m_Notes); metaFile.setValue("nexusDescription", m_NexusDescription); - metaFile.setValue("url", m_URL); + metaFile.setValue("url", m_CustomURL); + metaFile.setValue("hasCustomURL", m_HasCustomURL); metaFile.setValue("nexusFileStatus", m_NexusFileStatus); metaFile.setValue("lastNexusQuery", m_LastNexusQuery.toString(Qt::ISODate)); metaFile.setValue("lastNexusUpdate", m_LastNexusUpdate.toString(Qt::ISODate)); @@ -769,18 +833,27 @@ void ModInfoRegular::setNexusLastModified(QDateTime time) emit modDetailsUpdated(true); } -void ModInfoRegular::setURL(QString const &url) +void ModInfoRegular::setCustomURL(QString const &url) { - m_URL = url; + m_CustomURL = url; m_MetaInfoChanged = true; } -QString ModInfoRegular::getURL() const +QString ModInfoRegular::getCustomURL() const { - return m_URL; + return m_CustomURL; } +void ModInfoRegular::setHasCustomURL(bool b) +{ + m_HasCustomURL = b; + m_MetaInfoChanged = true; +} +bool ModInfoRegular::hasCustomURL() const +{ + return m_HasCustomURL; +} QStringList ModInfoRegular::archives(bool checkOnDisk) { diff --git a/src/modinforegular.h b/src/modinforegular.h index cfe713ca..705e66a8 100644 --- a/src/modinforegular.h +++ b/src/modinforegular.h @@ -397,15 +397,10 @@ public: void readMeta(); - /** - * @brief set the URL for a mod - */ - virtual void setURL(QString const &); - - /** - * @returns the URL for a mod - */ - virtual QString getURL() const; + virtual void setHasCustomURL(bool b) override; + virtual bool hasCustomURL() const override; + virtual void setCustomURL(QString const &) override; + virtual QString getCustomURL() const override; private: @@ -432,7 +427,8 @@ private: QString m_Notes; QString m_NexusDescription; QString m_Repository; - QString m_URL; + QString m_CustomURL; + bool m_HasCustomURL; QString m_GameName; mutable QStringList m_Archives; -- cgit v1.3.1 From fe678559074f179d74753b16d682cfb72160bb33 Mon Sep 17 00:00:00 2001 From: Silarn Date: Wed, 3 Jul 2019 14:21:31 -0500 Subject: Month update check should calculate by day of month instead of 30 days --- src/modinfo.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/modinfo.cpp') diff --git a/src/modinfo.cpp b/src/modinfo.cpp index 585d4963..73ead71c 100644 --- a/src/modinfo.cpp +++ b/src/modinfo.cpp @@ -310,10 +310,10 @@ bool ModInfo::checkAllForUpdate(PluginContainer *pluginContainer, QObject *recei } } - if (latest < QDateTime::currentDateTimeUtc().addDays(-30)) { + if (latest < QDateTime::currentDateTimeUtc().addMonths(-1)) { std::set> organizedGames; for (auto mod : s_Collection) { - if (mod->canBeUpdated() && mod->getLastNexusUpdate() < QDateTime::currentDateTimeUtc().addDays(-30)) { + if (mod->canBeUpdated() && mod->getLastNexusUpdate() < QDateTime::currentDateTimeUtc().addMonths(-1)) { organizedGames.insert(std::make_pair(mod->getGameName().toLower(), mod->getNexusID())); } } @@ -330,7 +330,7 @@ bool ModInfo::checkAllForUpdate(PluginContainer *pluginContainer, QObject *recei for (auto game : organizedGames) NexusInterface::instance(pluginContainer)->requestUpdates(game.second, receiver, QVariant(), game.first, QString()); - } else if (earliest < QDateTime::currentDateTimeUtc().addDays(-30)) { + } else if (earliest < QDateTime::currentDateTimeUtc().addMonths(-1)) { for (auto gameName : games) NexusInterface::instance(pluginContainer)->requestUpdateInfo(gameName, NexusInterface::UpdatePeriod::MONTH, receiver, QVariant(true), QString()); } else if (earliest < QDateTime::currentDateTimeUtc().addDays(-7)) { @@ -362,7 +362,7 @@ std::set> ModInfo::filteredMods(QString gameName, QVaria if (addOldMods) for (auto mod : s_Collection) - if (mod->getLastNexusUpdate() < QDateTime::currentDateTimeUtc().addDays(-30) && mod->getGameName().compare(gameName, Qt::CaseInsensitive) == 0) + if (mod->getLastNexusUpdate() < QDateTime::currentDateTimeUtc().addMonths(-1) && mod->getGameName().compare(gameName, Qt::CaseInsensitive) == 0) finalMods.insert(mod); if (markUpdated) { -- cgit v1.3.1 From e73c309f08eff98f0dbd2590f594a83b67431eac Mon Sep 17 00:00:00 2001 From: Silarn Date: Tue, 9 Jul 2019 22:31:34 -0500 Subject: Update description for month instead of 30 days --- src/modinfo.cpp | 2 +- src/organizer_en.ts | 483 ++++++++++++++++++++++++++-------------------------- 2 files changed, 243 insertions(+), 242 deletions(-) (limited to 'src/modinfo.cpp') diff --git a/src/modinfo.cpp b/src/modinfo.cpp index 73ead71c..3484b644 100644 --- a/src/modinfo.cpp +++ b/src/modinfo.cpp @@ -323,7 +323,7 @@ bool ModInfo::checkAllForUpdate(PluginContainer *pluginContainer, QObject *recei updatesAvailable = false; } else { qInfo() << tr( - "You have mods that haven't been checked within 30 days using the new API. These mods must be checked before we can use the bulk update API. " + "You have mods that haven't been checked within the last month using the new API. These mods must be checked before we can use the bulk update API. " "This will consume significantly more API requests than usual. You will need to rerun the update check once complete in order to parse the remaining mods." ); } diff --git a/src/organizer_en.ts b/src/organizer_en.ts index 4fedd25f..1aa831a0 100644 --- a/src/organizer_en.ts +++ b/src/organizer_en.ts @@ -1664,7 +1664,7 @@ p, li { white-space: pre-wrap; } - + Create Backup @@ -1840,8 +1840,8 @@ p, li { white-space: pre-wrap; } - - + + Refresh @@ -2120,7 +2120,7 @@ p, li { white-space: pre-wrap; } - + Endorse Mod Organizer @@ -2254,8 +2254,8 @@ Error: %1 - - + + Endorse @@ -2400,680 +2400,680 @@ Error: %1 - + failed to spawn notepad.exe: %1 - + failed to change origin name: %1 - + failed to move "%1" from mod "%2" to "%3": %4 - + <Contains %1> - + <Checked> - + <Unchecked> - + <Update> - + <Mod Backup> - + <Managed by MO> - + <Managed outside MO> - + <No category> - + <Conflicted> - + <Not Endorsed> - + failed to rename mod: %1 - + Overwrite? - + This will replace the existing mod "%1". Continue? - + failed to remove mod "%1" - - - + + + failed to rename "%1" to "%2" - - - - + + + + Confirm - + Remove the following mods?<br><ul>%1</ul> - + failed to remove mod: %1 - - - + + + Failed - + Installation file no longer exists - + Mods installed with old versions of MO can't be reinstalled in this way. - + Failed to create backup. - + Endorsing multiple mods will take a while. Please wait... - + Unendorsing multiple mods will take a while. Please wait... - + Failed to display overwrite dialog: %1 - + Opening Nexus Links - + You are trying to open %1 links to Nexus Mods. Are you sure you want to do this? - + Nexus ID for this mod is unknown - + Opening Web Pages - + You are trying to open %1 Web Pages. Are you sure you want to do this? - + <table cellspacing="5"><tr><th>Type</th><th>All</th><th>Visible</th><tr><td>Enabled mods:&emsp;</td><td align=right>%1 / %2</td><td align=right>%3 / %4</td></tr><tr><td>Unmanaged/DLCs:&emsp;</td><td align=right>%5</td><td align=right>%6</td></tr><tr><td>Mod backups:&emsp;</td><td align=right>%7</td><td align=right>%8</td></tr><tr><td>Separators:&emsp;</td><td align=right>%9</td><td align=right>%10</td></tr></table> - + <table cellspacing="6"><tr><th>Type</th><th>Active </th><th>Total</th></tr><tr><td>All plugins:</td><td align=right>%1 </td><td align=right>%2</td></tr><tr><td>ESMs:</td><td align=right>%3 </td><td align=right>%4</td></tr><tr><td>ESPs:</td><td align=right>%7 </td><td align=right>%8</td></tr><tr><td>ESMs+ESPs:</td><td align=right>%9 </td><td align=right>%10</td></tr><tr><td>ESLs:</td><td align=right>%5 </td><td align=right>%6</td></tr></table> - - - + + + Create Mod... - + This will create an empty mod. Please enter a name: - - + + A mod with this name already exists - + Create Separator... - + This will create a new separator. Please enter a name: - + A separator with this name already exists - + This will move all files from overwrite into a new, regular mod. Please enter a name: - + Move successful. - - + + Are you sure? - + About to recursively delete: - + Continue? - + The versioning scheme decides which version is considered newer than another. This function will guess the versioning scheme under the assumption that the installed version is outdated. - + Sorry - + I don't know a versioning scheme where %1 is newer than %2. - + Really enable all visible mods? - + Really disable all visible mods? - + Export to csv - + CSV (Comma Separated Values) is a format that can be imported in programs like Excel to create a spreadsheet. You can also use online editors and converters instead. - + Select what mods you want export: - + All installed mods - + Only active (checked) mods from your current profile - + All currently visible mods in the mod list - + Choose what Columns to export: - + Mod_Priority - + Mod_Name - + Notes_column - + Mod_Status - + Primary_Category - + Nexus_ID - + Mod_Nexus_URL - + Mod_Version - + Install_Date - + Download_File_Name - + export failed: %1 - + Open Game folder - + Open MyGames folder - + Open INIs folder - + Open Instance folder - + Open Mods folder - + Open Profile folder - + Open Downloads folder - + Open MO2 Install folder - + Open MO2 Plugins folder - + Open MO2 Logs folder - + Install Mod... - + Create empty mod - + Create Separator - + Enable all visible - + Disable all visible - + Check for updates - + Export to csv... - - + + Send to - - + + Top - - + + Bottom - - + + Priority... - + Separator... - + All Mods - + Sync to Mods... - + Move content to Mod... - + Clear Overwrite... - - + + Open in Explorer - + Restore Backup - + Remove Backup... - - + + Change Categories - - + + Primary Category - + Rename Separator... - + Remove Separator... - + Select Color... - + Reset Color - + Change versioning scheme - + Force-check updates - + Un-ignore update - + Ignore update - - + + Enable selected - - + + Disable selected - + Rename Mod... - + Reinstall Mod - + Remove Mod... - + Un-Endorse - + Won't endorse - + Endorsement state unknown - + Start tracking - + Stop tracking - + Tracked state unknown - + Ignore missing data - + Mark as converted/working - + Visit on Nexus - + Visit on %1 - + Information... - - + + Exception: - - + + Unknown exception - + <All> - + <Multiple> - + %1 more - + Are you sure you want to remove the following %n save(s)?<br><ul>%1</ul><br>Removed saves will be sent to the Recycle Bin. @@ -3081,12 +3081,12 @@ You can also use online editors and converters instead. - + Enable Mods... - + Delete %n save(s) @@ -3094,12 +3094,12 @@ You can also use online editors and converters instead. - + Restarting MO - + Changing the managed game directory requires restarting MO. Any pending downloads will be paused. @@ -3107,348 +3107,348 @@ Click OK to restart MO now. - + Can't change download directory while downloads are in progress! - + failed to write to file %1 - + %1 written - + Enter Name - + Please enter a name for the executable - + Not an executable - + This is not a recognized executable. - - + + Replace file? - + There already is a hidden version of this file. Replace it? - - + + File operation failed - - + + Failed to remove "%1". Maybe you lack the required file permissions? - + There already is a visible version of this file. Replace it? - - + + Set Priority - + Set the priority of the selected plugins - + Update available - + Open/Execute - + Add as Executable - + Preview - + Un-Hide - + Hide - + Write To File... - + Do you want to endorse Mod Organizer on %1 now? - + Abstain from Endorsing Mod Organizer - + Are you sure you want to abstain from endorsing Mod Organizer 2? You will have to visit the mod page on the %1 Nexus site to change your mind. - - + + Thank you for endorsing MO2! :) - - + + Please reconsider endorsing MO2 on Nexus! - + Thank you! - + Thank you for your endorsement! - + Okay. - + This mod will not be endorsed and will no longer ask you to endorse. - + Mod ID %1 no longer seems to be available on Nexus. - + Request to Nexus failed: %1 - - + + failed to read %1: %2 - - + + Error - + failed to extract %1 (errorcode %2) - + Extract BSA - + This archive contains invalid hashes. Some files may be broken. - + Extract... - + This will restart MO, continue? - + Edit Categories... - + Deselect filter - + Remove '%1' from the toolbar - + Enable all - + Disable all - + Unlock load order - + Lock load order - + Open Origin in Explorer - + Open Origin Info... - + depends on missing "%1" - + incompatible with "%1" - + Please wait while LOOT is running - + loot failed. Exit code was: %1 - + failed to start loot - + failed to run loot: %1 - + Errors occurred - + Backup of load order created - + Choose backup to restore - + No Backups - + There are no backups to restore - - + + Restore failed - - + + Failed to restore the backup. Errorcode: %1 - + Backup of mod list created - + A file with the same name has already been downloaded. What would you like to do? - + Overwrite - + Rename new file - + Ignore file - + Set the priority of the selected mods @@ -3551,7 +3551,8 @@ You will have to visit the mod page on the %1 Nexus site to change your mind. - You have mods that haven't been checked within 30 days using the new API. These mods must be checked before we can use the bulk update API. This will consume significantly more API requests than usual. You will need to rerun the update check once complete in order to parse the remaining mods. + You have mods that haven't been checked within the last month using the new API. These mods must be checked before we can use the bulk update API. This will consume significantly more API requests than usual. You will need to rerun the update check once complete in order to parse the remaining mods. + You have mods that haven't been checked within 30 days using the new API. These mods must be checked before we can use the bulk update API. This will consume significantly more API requests than usual. You will need to rerun the update check once complete in order to parse the remaining mods. @@ -5862,7 +5863,7 @@ If the folder was still in use, restart MO and try again. - + <Manage...> -- cgit v1.3.1