* @brief Sets up external signal/slot connections after all singletons are initialized. */
| 763 | * @brief Sets up external signal/slot connections after all singletons are initialized. |
| 764 | */ |
| 765 | void IO::ConnectionManager::setupExternalConnections() |
| 766 | { |
| 767 | auto savedBusType = m_settings.value("IOManager/busType", 0).toInt(); |
| 768 | if (savedBusType < 0 || savedBusType >= availableBuses().count()) |
| 769 | savedBusType = 0; |
| 770 | |
| 771 | if (!m_settings.contains("IOManager/userBusType")) |
| 772 | m_settings.setValue("IOManager/userBusType", savedBusType); |
| 773 | |
| 774 | setBusType(static_cast<SerialStudio::BusType>(savedBusType)); |
| 775 | |
| 776 | m_uartUi->setupExternalConnections(); |
| 777 | #ifdef BUILD_COMMERCIAL |
| 778 | m_modbusUi->setupExternalConnections(); |
| 779 | m_canBusUi->setupExternalConnections(); |
| 780 | m_usbUi->setupExternalConnections(); |
| 781 | #endif |
| 782 | |
| 783 | connect(&Misc::Translator::instance(), |
| 784 | &Misc::Translator::languageChanged, |
| 785 | this, |
| 786 | &IO::ConnectionManager::busListChanged); |
| 787 | |
| 788 | connect(&DataModel::ProjectModel::instance(), |
| 789 | &DataModel::ProjectModel::sourceStructureChanged, |
| 790 | this, |
| 791 | &IO::ConnectionManager::rebuildDevices, |
| 792 | Qt::DirectConnection); |
| 793 | |
| 794 | connect(&DataModel::ProjectModel::instance(), |
| 795 | &DataModel::ProjectModel::sourceChanged, |
| 796 | this, |
| 797 | &IO::ConnectionManager::onProjectSourceChanged, |
| 798 | Qt::DirectConnection); |
| 799 | |
| 800 | connect( |
| 801 | &AppState::instance(), |
| 802 | &AppState::frameConfigChanged, |
| 803 | this, |
| 804 | [this](const IO::FrameConfig&) { resetFrameReader(); }, |
| 805 | Qt::QueuedConnection); |
| 806 | |
| 807 | connect(&AppState::instance(), |
| 808 | &AppState::operationModeChanged, |
| 809 | this, |
| 810 | &IO::ConnectionManager::rebuildDevices, |
| 811 | Qt::QueuedConnection); |
| 812 | |
| 813 | #ifdef BUILD_COMMERCIAL |
| 814 | connect(&Licensing::LemonSqueezy::instance(), |
| 815 | &Licensing::LemonSqueezy::activatedChanged, |
| 816 | this, |
| 817 | &IO::ConnectionManager::rebuildDevices, |
| 818 | Qt::QueuedConnection); |
| 819 | #endif |
| 820 | |
| 821 | wireUiDriver(m_uartUi.get()); |
| 822 | wireUiDriver(m_networkUi.get()); |