const DeviceInterfaces type;
protected:
- explicit DeviceProber() : type(DeviceInterfaces::NONE) {}
+ explicit DeviceProber(DeviceInterfaces _type) : type(_type) {}
};
class LinuxDeviceProber : public DeviceProber
{
public:
- explicit LinuxDeviceProber() {}
+ explicit LinuxDeviceProber() : DeviceProber(DeviceProber::DeviceInterfaces::LINUX) {}
void closeAllDevices();
DeviceList listDevices();
std::shared_ptr<FFBDevice> openDevice(const QString& id);
connect(ui->qpb_upload, SIGNAL(clicked()), this, SLOT(onUploadEffectClicked()));
}
-void MainWindow::createDeviceProber(const DeviceProber::DeviceInterfaces iface)
+bool MainWindow::createDeviceProber(const DeviceProber::DeviceInterfaces iface)
{
std::shared_ptr<DeviceProber> prober;
if (m_prober != nullptr) {
if (m_prober->type == iface)
- return;
+ return false;
m_prober->closeAllDevices();
}
}
m_prober = prober;
+ return true;
}
EffectSettings* MainWindow::effectSettingsByType(FFBEffectTypes type)
return;
}
- ui->cbox_effectSlots->clear();
iface = static_cast<DeviceProber::DeviceInterfaces>(rawIface);
- createDeviceProber(iface);
+ if (!createDeviceProber(iface))
+ return;
+
+ ui->cbox_effectSlots->clear();
fillDeviceList();
}
void MainWindow::onRefreshDevicesClicked()
{
- //fillDeviceList();
+ fillDeviceList();
}
void MainWindow::onRemoveEffectClicked()
CANT_UPLOAD_EFFECT
};
- void createDeviceProber(const DeviceProber::DeviceInterfaces iface);
+ bool createDeviceProber(const DeviceProber::DeviceInterfaces iface);
EffectSettings* effectSettingsByType(FFBEffectTypes type);
QString effectTypeToEffectName(const FFBEffectTypes type) const;
void fillDeviceList();