| 1834 | } |
| 1835 | |
| 1836 | void RcxController::attachViaPlugin(const QString& providerIdentifier, const QString& target) { |
| 1837 | const auto* info = ProviderRegistry::instance().findProvider(providerIdentifier); |
| 1838 | if (!info || !info->plugin) { |
| 1839 | QMessageBox::warning(qobject_cast<QWidget*>(parent()), |
| 1840 | "Provider Error", |
| 1841 | QString("Provider '%1' not found. Is the plugin loaded?").arg(providerIdentifier)); |
| 1842 | return; |
| 1843 | } |
| 1844 | |
| 1845 | QString errorMsg; |
| 1846 | auto provider = info->plugin->createProvider(target, &errorMsg); |
| 1847 | if (!provider) { |
| 1848 | if (!errorMsg.isEmpty()) |
| 1849 | QMessageBox::warning(qobject_cast<QWidget*>(parent()), "Provider Error", errorMsg); |
| 1850 | return; |
| 1851 | } |
| 1852 | |
| 1853 | uint64_t newBase = provider->base(); |
| 1854 | m_doc->undoStack.clear(); |
| 1855 | m_doc->provider = std::move(provider); |
| 1856 | m_doc->dataPath.clear(); |
| 1857 | m_doc->tree.baseAddress = newBase; |
| 1858 | resetSnapshot(); |
| 1859 | emit m_doc->documentChanged(); |
| 1860 | refresh(); |
| 1861 | } |
| 1862 | |
| 1863 | void RcxController::switchToSavedSource(int idx) { |
| 1864 | if (idx < 0 || idx >= m_savedSources.size()) return; |
no test coverage detected