]> Devoid-pointer.net GitWeb - FFBChecker.git/commitdiff
Clear the UI properly before interface switch
authorMichal Malý <madcatxster@devoid-pointer.net>
Wed, 29 Jul 2015 22:51:36 +0000 (00:51 +0200)
committerMichal Malý <madcatxster@devoid-pointer.net>
Wed, 29 Jul 2015 22:51:36 +0000 (00:51 +0200)
mainwindow.cpp

index f8aa5488aa3cdb1f2534f7a5edc8b1238b6e4bc2..130d20e04d179c5419ac1eb5bde5117e2e777c68 100644 (file)
@@ -57,8 +57,12 @@ void MainWindow::createDeviceProber(const DeviceProber::DeviceInterfaces iface)
 {
   std::shared_ptr<DeviceProber> prober;
 
-  if (m_prober != nullptr)
+  if (m_prober != nullptr) {
+    if (m_prober->type == iface)
+      return;
+
     m_prober->closeAllDevices();
+  }
 
   switch (iface) {
   case DeviceProber::DeviceInterfaces::LINUX:
@@ -112,6 +116,9 @@ void MainWindow::fillDeviceList()
 {
   ui->cbox_devices->clear();
 
+  if (m_prober == nullptr)
+    return;
+
   for (const DeviceProber::DeviceInfo& dinfo : m_prober->listDevices()) {
     QString name;
     if (dinfo.name.length() == 0)
@@ -220,8 +227,11 @@ void MainWindow::onInterfaceSelected(const int cboxIdx)
     return;
   }
 
+  ui->cbox_effectSlots->clear();
+
   iface = static_cast<DeviceProber::DeviceInterfaces>(rawIface);
   createDeviceProber(iface);
+  fillDeviceList();
 }
 
 void MainWindow::onRefreshDevicesClicked()