MCPcopy Create free account
hub / github.com/IChooseYou/Reclass / attachViaPlugin

Method attachViaPlugin

src/controller.cpp:1836–1861  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1834}
1835
1836void 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
1863void RcxController::switchToSavedSource(int idx) {
1864 if (idx < 0 || idx >= m_savedSources.size()) return;

Callers 1

toolSourceSwitchMethod · 0.80

Calls 4

findProviderMethod · 0.80
clearMethod · 0.80
createProviderMethod · 0.45
baseMethod · 0.45

Tested by

no test coverage detected