31 #include "ui_controllerpage.h"
44 Q_ASSERT(m_connectionManager);
46 &ControllerPage::devicesChanged);
49 Q_ASSERT(pluginManager);
51 Q_ASSERT(m_telemetryManager);
53 &ControllerPage::connectionStatusChanged);
58 &ControllerPage::connectionStatusChanged);
60 connect(ui->connectButton, &QAbstractButton::clicked,
this, &ControllerPage::connectDisconnect);
72 if (anyControllerConnected()) {
74 setControllerType(type);
76 setControllerType(NULL);
78 emit completeChanged();
104 bool ControllerPage::anyControllerConnected()
109 void ControllerPage::setupDeviceList()
112 connectionStatusChanged();
118 ui->boardTypeLabel->setText(
"Unknown");
120 ui->boardTypeLabel->setText(board->
shortName());
123 void ControllerPage::devicesChanged(QLinkedList<Core::DevListItem> devices)
126 QString currSelectedDeviceName = ui->deviceCombo->currentIndex() != -1
127 ? ui->deviceCombo->itemData(ui->deviceCombo->currentIndex(), Qt::ToolTipRole).toString()
131 ui->deviceCombo->clear();
133 int indexOfSelectedItem = -1;
141 if ((deviceName != refName) &&
142 (!deviceName.startsWith(
"USB:", Qt::CaseInsensitive))) {
145 ui->deviceCombo->addItem(deviceName);
146 ui->deviceCombo->setItemData(ui->deviceCombo->count() - 1, deviceName, Qt::ToolTipRole);
147 if (currSelectedDeviceName !=
"" && currSelectedDeviceName == deviceName) {
148 indexOfSelectedItem = ui->deviceCombo->count() - 1;
153 if (indexOfSelectedItem != -1) {
154 ui->deviceCombo->setCurrentIndex(indexOfSelectedItem);
158 void ControllerPage::connectionStatusChanged()
161 ui->deviceCombo->setEnabled(
false);
162 ui->connectButton->setText(tr(
"Disconnect"));
164 for (
int i = 0;
i < ui->deviceCombo->count(); ++
i) {
165 if (connectedDeviceName == ui->deviceCombo->itemData(
i, Qt::ToolTipRole).toString()) {
166 ui->deviceCombo->setCurrentIndex(
i);
172 qDebug() <<
"Connection status changed: Connected, controller type: "
175 ui->deviceCombo->setEnabled(
true);
176 ui->connectButton->setText(tr(
"Connect"));
177 setControllerType(NULL);
178 qDebug() <<
"Connection status changed: Disconnected";
180 emit completeChanged();
183 void ControllerPage::connectDisconnect()
189 ui->deviceCombo->itemData(ui->deviceCombo->currentIndex(), Qt::ToolTipRole)
192 emit completeChanged();
The SetupWizard class is the main interface to the setup wizard. It provides selects the sequence of ...
SetupWizard * getWizard() const
Core plugin system that manages the plugins, their life cycle and their registered objects...
DevListItem findDevice(const QString &devName)
DevListItem getCurrentDevice()
ControllerPage(SetupWizard *wizard, QWidget *parent=nullptr)
QLinkedList< DevListItem > getAvailableDevices()
Core::ConnectionManager * getConnectionManager()
void availableDevicesChanged(const QLinkedList< Core::DevListItem > devices)
virtual bool isUSBSupported()
void setControllerType(Core::IBoardType *type)
void deviceDisconnected()
virtual QString shortName()=0
bool connectDevice(DevListItem device)
Core::IBoardType * getControllerType() const
ControllerPage::getControllerType get the interface for the connected board.