diff options
| author | Mikaƫl Capelle <capelle.mikael@gmail.com> | 2020-12-07 08:40:23 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-07 08:40:23 +0100 |
| commit | 904264e231a9aef485025cb45f1eb006b017aa1a (patch) | |
| tree | c3ff682de4ac4761b8d36f0e96a96dce6a034706 /src/mainwindow.cpp | |
| parent | 0a6a5eb7868dde908e07ea12c7eb674b2063b950 (diff) | |
| parent | 3264d7899e2560bce4591ab2142ee9d51bc7890c (diff) | |
Merge pull request #1313 from Holt59/load-plugin-without-restart
Implement loading/unloading of plugins without restarting
Diffstat (limited to 'src/mainwindow.cpp')
| -rw-r--r-- | src/mainwindow.cpp | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d0ed5029..a270fd10 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -474,7 +474,8 @@ MainWindow::MainWindow(Settings &settings if (m_PluginContainer.implementInterface<IPluginModPage>(plugin)) { updateModPageMenu(); } }); connect(&m_PluginContainer, &PluginContainer::pluginDisabled, this, [this](IPlugin* plugin) { if (m_PluginContainer.implementInterface<IPluginModPage>(plugin)) { updateModPageMenu(); } }); - + connect(&m_PluginContainer, &PluginContainer::pluginRegistered, this, &MainWindow::onPluginRegistrationChanged); + connect(&m_PluginContainer, &PluginContainer::pluginUnregistered, this, &MainWindow::onPluginRegistrationChanged); connect(&m_OrganizerCore, &OrganizerCore::modInstalled, this, &MainWindow::modInstalled); connect(&m_OrganizerCore, &OrganizerCore::close, this, &QMainWindow::close); @@ -511,8 +512,6 @@ MainWindow::MainWindow(Settings &settings m_Tutorial.expose("espList", m_OrganizerCore.pluginList()); m_OrganizerCore.setUserInterface(this); - m_PluginContainer.setUserInterface(this); - connect(this, &MainWindow::userInterfaceInitialized, &m_OrganizerCore, &OrganizerCore::userInterfaceInitialized); for (const QString &fileName : m_PluginContainer.pluginFileNames()) { installTranslator(QFileInfo(fileName).baseName()); } @@ -704,7 +703,6 @@ MainWindow::~MainWindow() try { cleanup(); - m_PluginContainer.setUserInterface(nullptr); m_OrganizerCore.setUserInterface(nullptr); if (m_IntegratedBrowser) { @@ -743,14 +741,6 @@ void MainWindow::onRequestsChanged(const APIStats& stats, const APIUserAccount& } -void MainWindow::disconnectPlugins() -{ - if (ui->actionTool->menu() != nullptr) { - ui->actionTool->menu()->clear(); - } -} - - void MainWindow::resizeLists(bool pluginListCustom) { // ensure the columns aren't so small you can't see them any more @@ -1412,8 +1402,8 @@ void MainWindow::showEvent(QShowEvent *event) m_WasVisible = true; updateProblemsButton(); - // Notify plugin that the UI is initialized: - emit userInterfaceInitialized(); + // Notify plugin that the MO2 is ready: + m_PluginContainer.startPlugins(this); } } @@ -5190,6 +5180,13 @@ void MainWindow::on_actionSettings_triggered() } } +void MainWindow::onPluginRegistrationChanged() +{ + updateModPageMenu(); + scheduleCheckForProblems(); + updateDownloadView(); +} + void MainWindow::on_actionNexus_triggered() { const IPluginGame *game = m_OrganizerCore.managedGame(); |
