Skip to content

Commit

Permalink
Update for extensions.
Browse files Browse the repository at this point in the history
  • Loading branch information
Holt59 committed Jul 9, 2023
1 parent c7154aa commit a488364
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 19 deletions.
1 change: 0 additions & 1 deletion src/instancemanagerdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#include "createinstancedialog.h"
#include "filesystemutilities.h"
#include "instancemanager.h"
#include "plugincontainer.h"
#include "selectiondialog.h"
#include "settings.h"
#include "shared/appconfig.h"
Expand Down
1 change: 0 additions & 1 deletion src/mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "modinfo.h"
#include "modlistbypriorityproxy.h"
#include "modlistsortproxy.h"
#include "plugincontainer.h" //class PluginManager;
#include "shared/fileregisterfwd.h"
#include "thememanager.h"
#include "tutorialcontrol.h"
Expand Down
1 change: 0 additions & 1 deletion src/modinfodialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
#include "modinfodialogtextfiles.h"
#include "modlistview.h"
#include "organizercore.h"
#include "plugincontainer.h"
#include "shared/directoryentry.h"
#include "shared/filesorigin.h"
#include "ui_modinfodialog.h"
Expand Down
1 change: 0 additions & 1 deletion src/modinfodialogimages.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "filterwidget.h"
#include "modinfodialogtab.h"
#include "organizercore.h"
#include "plugincontainer.h"
#include <QScrollBar>

using namespace MOBase;
Expand Down
1 change: 0 additions & 1 deletion src/modinforegular.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "messagedialog.h"
#include "moddatacontent.h"
#include "organizercore.h"
#include "plugincontainer.h"
#include "report.h"
#include "settings.h"
#include <iplugingame.h>
Expand Down
9 changes: 5 additions & 4 deletions src/pluginmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,8 @@ IPlugin* PluginManager::registerPlugin(const PluginExtension& extension,

void PluginManager::loadPlugins()
{
unloadPlugins();

// TODO: order based on dependencies
for (auto& extension : m_extensions.extensions()) {
if (auto* pluginExtension = dynamic_cast<const PluginExtension*>(extension.get())) {
Expand All @@ -474,7 +476,7 @@ void PluginManager::loadPlugins()

bool PluginManager::loadPlugins(const MOBase::PluginExtension& extension)
{
unloadPlugins();
unloadPlugins(extension);

// load plugins
QList<QList<QObject*>> objects;
Expand Down Expand Up @@ -605,14 +607,13 @@ void PluginManager::unloadPlugins()
m_supportedGames.clear();

for (auto& loader : m_loaders) {
// TODO:
// loader->unloadAll();
loader->unloadAll();
}
}

bool PluginManager::reloadPlugins(const MOBase::PluginExtension& extension)
{
unloadPlugins(extension);
// load plugin already unload(), so no need to manually do it here
return loadPlugins(extension);
}

Expand Down
2 changes: 0 additions & 2 deletions src/problemsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
#include <iplugindiagnose.h>
#include <utility.h>

#include "plugincontainer.h"

using namespace MOBase;

ProblemsDialog::ProblemsDialog(const PluginManager& pluginManager, QWidget* parent)
Expand Down
16 changes: 8 additions & 8 deletions src/settingsdialogplugins.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,14 @@ IPlugin* PluginsSettingsTab::plugin(QTreeWidgetItem* pluginItem) const
void PluginsSettingsTab::update()
{
// transfer plugin settings to in-memory structure
for (int i = 0; i < ui->pluginsList->topLevelItemCount(); ++i) {
auto* topLevelItem = ui->pluginsList->topLevelItem(i);
for (int j = 0; j < topLevelItem->childCount(); ++j) {
auto* item = topLevelItem->child(j);
settings().plugins().setSettings(plugin(item)->name(),
item->data(0, SettingsRole).toMap());
}
}
// for (int i = 0; i < ui->pluginsList->topLevelItemCount(); ++i) {
// auto* topLevelItem = ui->pluginsList->topLevelItem(i);
// for (int j = 0; j < topLevelItem->childCount(); ++j) {
// auto* item = topLevelItem->child(j);
// settings().plugins().setSettings(plugin(item)->name(),
// item->data(0, SettingsRole).toMap());
// }
//}

// set plugin blacklist
QStringList names;
Expand Down

0 comments on commit a488364

Please sign in to comment.