| 502 | } |
| 503 | |
| 504 | void DeviceImpl::disconnectDev() |
| 505 | { |
| 506 | DebugTimer pluginDisconnBm; |
| 507 | DebugTimer disconnectDevBm; |
| 508 | m_state = DEV_DISCONNECTING; |
| 509 | Q_EMIT disconnecting(); |
| 510 | |
| 511 | if(m_connectionLostWidget) { |
| 512 | m_connectionLostWidget->hide(); |
| 513 | delete m_connectionLostWidget; |
| 514 | m_connectionLostWidget = nullptr; |
| 515 | } |
| 516 | |
| 517 | unbindPing(); |
| 518 | connbtn->show(); |
| 519 | discbtn->hide(); |
| 520 | Preferences *pref = Preferences::GetInstance(); |
| 521 | for(auto &&p : m_connectedPlugins) { |
| 522 | if(pref->get("general_save_session").toBool()) { |
| 523 | QSettings s = QSettings(scopy::config::settingsFolderPath() + "/" + p->name() + ".ini", |
| 524 | QSettings::IniFormat); |
| 525 | p->saveSettings(s); |
| 526 | } |
| 527 | pluginDisconnBm.startTimer(); |
| 528 | p->onDisconnect(); |
| 529 | DEBUGTIMER_LOG(pluginDisconnBm, p->name() + " disconnection took:"); |
| 530 | } |
| 531 | m_connectedPlugins.clear(); |
| 532 | connbtn->setFocus(); |
| 533 | m_state = DEV_IDLE; |
| 534 | DEBUGTIMER_LOG(disconnectDevBm, this->displayName() + " device disconnection took:"); |
| 535 | Q_EMIT disconnected(); |
| 536 | } |
| 537 | |
| 538 | DeviceImpl::~DeviceImpl() { qDebug(CAT_DEVICEIMPL) << m_id << "dtor"; } |
| 539 |
no test coverage detected