summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikaƫl Capelle <capelle.mikael@gmail.com>2020-10-14 18:44:35 +0200
committerGitHub <noreply@github.com>2020-10-14 18:44:35 +0200
commitef82ddd36ae30e654841257634b26fa563319f9b (patch)
treee75dfc6c59c3c55c3098998d2f33172406a38ba9
parent35b4aa1024bb6904846c36cdbbb638b3e6031cda (diff)
parent9d7d55918c065d5d7f615cbd89e20ab7227f54ff (diff)
Merge pull request #1259 from Holt59/imodinterface-seturl
Add IModInterface::setUrl and remove IInstallationManager::setURL.
-rw-r--r--src/installationmanager.cpp12
-rw-r--r--src/installationmanager.h4
-rw-r--r--src/modinfo.h13
3 files changed, 13 insertions, 16 deletions
diff --git a/src/installationmanager.cpp b/src/installationmanager.cpp
index a755b0cb..e4937ed9 100644
--- a/src/installationmanager.cpp
+++ b/src/installationmanager.cpp
@@ -122,11 +122,6 @@ void InstallationManager::setParentWidget(QWidget *widget)
}
}
-void InstallationManager::setURL(QString const &url)
-{
- m_URL = url;
-}
-
void InstallationManager::queryPassword() {
m_Password = QInputDialog::getText(m_ParentWidget, tr("Password required"),
tr("Password"), QLineEdit::Password);
@@ -534,13 +529,6 @@ IPluginInstaller::EInstallResult InstallationManager::doInstall(GuessedValue<QSt
settingsFile.setValue("installationFile", m_CurrentFile);
settingsFile.setValue("repository", repository);
- if (!m_URL.isEmpty() || !settingsFile.contains("url")) {
- settingsFile.setValue("url", m_URL);
- }
-
- //cleanup of m_URL or this will persist across installs.
- m_URL = "";
-
if (!merge) {
// this does not clear the list we have in memory but the mod is going to have to be re-read anyway
// btw.: installedFiles were written with beginWriteArray but we can still clear it with beginGroup. nice
diff --git a/src/installationmanager.h b/src/installationmanager.h
index 149295a6..66f11eae 100644
--- a/src/installationmanager.h
+++ b/src/installationmanager.h
@@ -62,8 +62,6 @@ public:
void setParentWidget(QWidget *widget);
- void setURL(const QString &url);
-
/**
* @brief Notify all installer plugins that an installation is about to start.
*
@@ -300,8 +298,6 @@ private:
// paths to temporary files:
std::map<std::shared_ptr<const MOBase::FileTreeEntry>, QString> m_CreatedFiles;
std::set<QString> m_TempFilesToDelete;
-
- QString m_URL;
};
diff --git a/src/modinfo.h b/src/modinfo.h
index 0533d9fe..7223cece 100644
--- a/src/modinfo.h
+++ b/src/modinfo.h
@@ -790,6 +790,19 @@ public: // Methods after this do not come from IModInterface:
virtual void setCustomURL(QString const&) {}
/**
+ * @brief Sets the URL for this mod.
+ *
+ * In practice, this is a shortcut for setHasCustomURL followed by
+ * setCustomURL.
+ *
+ * @param url The new URL.
+ */
+ void setUrl(QString const& url) override {
+ setHasCustomURL(true);
+ setCustomURL(url);
+ }
+
+ /**
* 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.