diff options
| author | Mikaël Capelle <capelle.mikael@gmail.com> | 2020-11-11 16:14:55 +0100 |
|---|---|---|
| committer | Mikaël Capelle <capelle.mikael@gmail.com> | 2020-11-11 20:30:34 +0100 |
| commit | a449098db96527f8ac772cd518657d8e22018468 (patch) | |
| tree | 4fcef836ac8e7c430bec07a13d11a8990140e640 /src | |
| parent | e528d8b0ad843bf2e728f26c3a1bade145e5ad07 (diff) | |
Cleaner IPluginRequirement.
Diffstat (limited to 'src')
| -rw-r--r-- | src/plugincontainer.cpp | 9 | ||||
| -rw-r--r-- | src/plugincontainer.h | 21 | ||||
| -rw-r--r-- | src/settingsdialogplugins.cpp | 2 |
3 files changed, 7 insertions, 25 deletions
diff --git a/src/plugincontainer.cpp b/src/plugincontainer.cpp index 030fdb31..a218b1f0 100644 --- a/src/plugincontainer.cpp +++ b/src/plugincontainer.cpp @@ -74,12 +74,13 @@ MOBase::IPluginProxy* PluginRequirements::proxy() const return m_PluginProxy;
}
-std::vector<PluginRequirements::Problem> PluginRequirements::problems() const
+std::vector<IPluginRequirement::Problem> PluginRequirements::problems() const
{
- std::vector<Problem> result;
+ std::vector<IPluginRequirement::Problem> result;
for (auto& requirement : m_Requirements) {
- for (auto p : requirement->problems(m_Organizer)) {
- result.push_back(Problem(requirement.get(), p));
+ auto p = requirement->check(m_Organizer);
+ if (p) {
+ result.push_back(*p);
}
}
return result;
diff --git a/src/plugincontainer.h b/src/plugincontainer.h index cd1d03ca..520ee83e 100644 --- a/src/plugincontainer.h +++ b/src/plugincontainer.h @@ -34,25 +34,6 @@ class OrganizerProxy; class PluginRequirements {
public:
- // Small intermediate class.
- struct Problem {
- public:
-
- QString description() const { return m_Requirement->description(m_Id); }
-
-
- private:
- Problem(const MOBase::IPluginRequirement* requirement, unsigned int id) :
- m_Requirement(requirement), m_Id(id) { }
-
- const MOBase::IPluginRequirement* m_Requirement;
- unsigned int m_Id;
-
- friend class PluginRequirements;
- };
-
-public:
-
/**
* @return true if the plugin can be enabled (all requirements are met).
*/
@@ -66,7 +47,7 @@ public: /**
* @return the list of problems to be resolved before enabling the plugin.
*/
- std::vector<Problem> problems() const;
+ std::vector<MOBase::IPluginRequirement::Problem> problems() const;
/**
* @return the name of the games (gameName()) this plugin can be used with, or an empty
diff --git a/src/settingsdialogplugins.cpp b/src/settingsdialogplugins.cpp index 0c02ffb0..1e2117cf 100644 --- a/src/settingsdialogplugins.cpp +++ b/src/settingsdialogplugins.cpp @@ -187,7 +187,7 @@ void PluginsSettingsTab::on_checkboxEnabled_clicked(bool checked) if (!problems.empty()) { QStringList descriptions; for (auto& problem : problems) { - descriptions.append(problem.description()); + descriptions.append(problem.shortDescription()); } QMessageBox::warning( parentWidget(), QObject::tr("Cannot enable plugin"), |
