| 477 | } |
| 478 | |
| 479 | void |
| 480 | Singleton::init_plugins(void) |
| 481 | { |
| 482 | Plugin *defPlug = Plugin::getDefaultPlugin(); |
| 483 | QStringList plugins; |
| 484 | |
| 485 | if (!defPlug->load()) |
| 486 | throw Exception( |
| 487 | "Failed to load the default plugin. " |
| 488 | "Please report this error to " |
| 489 | "<a href=\"https://github.com/BatchDrake/SigDigger/issues\">" |
| 490 | "https://github.com/BatchDrake/SigDigger/issues" |
| 491 | "</a>"); |
| 492 | |
| 493 | plugins << suscan_confdb_get_local_path() + QString("/../plugins") |
| 494 | << suscan_confdb_get_system_path() + QString("/../plugins"); |
| 495 | |
| 496 | for (auto path : plugins) { |
| 497 | QDir dir(path); |
| 498 | QStringList files = dir.entryList(QStringList() << "*", QDir::Files); |
| 499 | auto asStd = path.toStdString(); |
| 500 | |
| 501 | for (auto file : files) { |
| 502 | auto fullPath = (path + "/" + file).toStdString(); |
| 503 | auto plugin = Suscan::Plugin::make(fullPath.c_str()); |
| 504 | |
| 505 | if (plugin != nullptr) { |
| 506 | if (!plugin->load()) { |
| 507 | SU_WARNING("Plugin %s failed to load\n", fullPath.c_str()); |
| 508 | delete plugin; |
| 509 | } |
| 510 | |
| 511 | // TODO: register plugin here!! |
| 512 | } else { |
| 513 | printf("Failed to make plugin.\n"); |
| 514 | } |
| 515 | } |
| 516 | } |
| 517 | } |
| 518 | |
| 519 | void |
| 520 | Singleton::refreshDevices(void) |
no test coverage detected