DevicesModel::DevicesModel(QObject *parent) : QAbstractListModel(parent) , m_dbusInterface(new DaemonDbusInterface(this)) , m_displayFilter(StatusFilterFlag::NoFilter) { //new ModelTest(this, this); connect(this, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SIGNAL(rowsChanged())); connect(this, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SIGNAL(rowsChanged())); connect(m_dbusInterface, SIGNAL(deviceAdded(QString)), this, SLOT(deviceAdded(QString))); connect(m_dbusInterface, SIGNAL(deviceVisibilityChanged(QString,bool)), this, SLOT(deviceUpdated(QString,bool))); connect(m_dbusInterface, SIGNAL(deviceRemoved(QString)), this, SLOT(deviceRemoved(QString))); QDBusServiceWatcher* watcher = new QDBusServiceWatcher(DaemonDbusInterface::activatedService(), QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForOwnerChange, this); connect(watcher, &QDBusServiceWatcher::serviceRegistered, this, &DevicesModel::refreshDeviceList); connect(watcher, &QDBusServiceWatcher::serviceUnregistered, this, &DevicesModel::clearDevices); //refresh the view, acquireDiscoveryMode if necessary setDisplayFilter(NoFilter); }
InspectorOutputWidget::InspectorOutputWidget(QWidget* parent) : QWidget(parent), command(NULL), model(NULL), delayType("") { setupUi(this); this->comboBoxAtemDevice->setVisible(false); this->comboBoxTriCasterDevice->setVisible(false); this->delayType = DatabaseManager::getInstance().getConfigurationByName("DelayType").getValue(); this->comboBoxTarget->lineEdit()->setStyleSheet("background-color: transparent; border-width: 0px;"); QObject::connect(&DeviceManager::getInstance(), SIGNAL(deviceRemoved()), this, SLOT(deviceRemoved())); QObject::connect(&DeviceManager::getInstance(), SIGNAL(deviceAdded(CasparDevice&)), this, SLOT(deviceAdded(CasparDevice&))); QObject::connect(&AtemDeviceManager::getInstance(), SIGNAL(deviceRemoved()), this, SLOT(atemDeviceRemoved())); QObject::connect(&AtemDeviceManager::getInstance(), SIGNAL(deviceAdded(AtemDevice&)), this, SLOT(atemDeviceAdded(AtemDevice&))); QObject::connect(&TriCasterDeviceManager::getInstance(), SIGNAL(deviceRemoved()), this, SLOT(tricasterDeviceRemoved())); QObject::connect(&TriCasterDeviceManager::getInstance(), SIGNAL(deviceAdded(TriCasterDevice&)), this, SLOT(tricasterDeviceAdded(TriCasterDevice&))); QObject::connect(&EventManager::getInstance(), SIGNAL(rundownItemSelected(const RundownItemSelectedEvent&)), this, SLOT(rundownItemSelected(const RundownItemSelectedEvent&))); QObject::connect(&EventManager::getInstance(), SIGNAL(libraryItemSelected(const LibraryItemSelectedEvent&)), this, SLOT(libraryItemSelected(const LibraryItemSelectedEvent&))); QObject::connect(&EventManager::getInstance(), SIGNAL(emptyRundown(const EmptyRundownEvent&)), this, SLOT(emptyRundown(const EmptyRundownEvent&))); QObject::connect(&EventManager::getInstance(), SIGNAL(deviceChanged(const DeviceChangedEvent&)), this, SLOT(deviceChanged(const DeviceChangedEvent&))); QObject::connect(&EventManager::getInstance(), SIGNAL(mediaChanged(const MediaChangedEvent&)), this, SLOT(mediaChanged(const MediaChangedEvent&))); QObject::connect(&EventManager::getInstance(), SIGNAL(templateChanged(const TemplateChangedEvent&)), this, SLOT(templateChanged(const TemplateChangedEvent&))); }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); setWindowTitle(QString("XKSimulator %1").arg(getVersionString())); m_serial = new SerialPort(); connect(m_serial, SIGNAL(serialError(QString)), this, SLOT(serialError(QString))); connect(m_serial, SIGNAL(serialStatus(QString)), this, SLOT(serialStatus(QString))); m_error = new QLabel(""); statusBar()->addWidget(m_error); m_enum = new QextSerialEnumerator(); #ifdef Q_OS_WIN connect(m_enum, SIGNAL(deviceDiscovered(QextPortInfo)), this, SLOT(deviceDiscovered(QextPortInfo))); connect(m_enum, SIGNAL(deviceRemoved(QextPortInfo)), this, SLOT(deviceRemoved(QextPortInfo))); m_enum->setUpNotifications(); #endif m_gpsTimer = new QTimer(this); connect(m_gpsTimer, SIGNAL(timeout()), this, SLOT(gpsTimer())); // Load the application settings (not the command settings) loadAppSettings(); // Load the list of available serial ports loadComPorts(); m_serial->open(m_tty); // Open the selected serial port }
void SolidDeviceEngine::listenForNewDevices() { if (m_notifier) { return; } //detect when new devices are added m_notifier = Solid::DeviceNotifier::instance(); connect(m_notifier, SIGNAL(deviceAdded(QString)), this, SLOT(deviceAdded(QString))); connect(m_notifier, SIGNAL(deviceRemoved(QString)), this, SLOT(deviceRemoved(QString))); }
/** * \brief Constructor * * \note * */ RawHIDConnection::RawHIDConnection() { RawHidHandle = NULL; enablePolling = true; m_usbMonitor = USBMonitor::instance(); #ifndef __APPLE__ connect(m_usbMonitor, SIGNAL(deviceDiscovered(USBPortInfo)), this, SLOT(onDeviceConnected())); connect(m_usbMonitor, SIGNAL(deviceRemoved(USBPortInfo)), this, SLOT(onDeviceDisconnected())); #else connect(m_usbMonitor, SIGNAL(deviceDiscovered()), this, SLOT(onDeviceConnected())); connect(m_usbMonitor, SIGNAL(deviceRemoved()), this, SLOT(onDeviceDisconnected())); #endif }
SerialPortControl::SerialPortControl(QObject *parent) : QObject(parent) { serialPort = new QextSerialPort(QextSerialPort::EventDriven, this); serialEnum = new QextSerialEnumerator; //The following only works in OSX and Win. For other OSs use refresh button: serialEnum->setUpNotifications(); buffer = new QByteArray; buffer->clear(); input = new QByteArray; input->clear(); //Inicializamos a los valores por defecto: this->set_baudRate (BAUD9600); this->set_dataBits (DATA_8); this->set_parityBits (PAR_NONE); this->set_stopBits (STOP_1); this->set_flowControl (FLOW_OFF); this->set_openMode (QIODevice::ReadWrite); connect (serialPort, SIGNAL(readyRead()), this, SLOT(onDataAvailable())); connect (serialEnum, SIGNAL(deviceDiscovered(QextPortInfo)) ,this ,SLOT(devicesListModified())); connect (serialEnum, SIGNAL(deviceRemoved(QextPortInfo)) ,this ,SLOT(devicesListModified())); }
bool QNetworkManagerInterface::setConnections() { if (!isValid()) return false; QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE), QLatin1String(NM_DBUS_PATH), QLatin1String(NM_DBUS_INTERFACE), QLatin1String("PropertiesChanged"), this,SLOT(propertiesSwap(QMap<QString,QVariant>))); bool allOk = false; if (QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE), QLatin1String(NM_DBUS_PATH), QLatin1String(NM_DBUS_INTERFACE), QLatin1String("DeviceAdded"), this,SIGNAL(deviceAdded(QDBusObjectPath)))) { allOk = true; } if (QDBusConnection::systemBus().connect(QLatin1String(NM_DBUS_SERVICE), QLatin1String(NM_DBUS_PATH), QLatin1String(NM_DBUS_INTERFACE), QLatin1String("DeviceRemoved"), this,SIGNAL(deviceRemoved(QDBusObjectPath)))) { allOk = true; } return allOk; }
void Popup::onDeviceRemoved(QString const & udi) { MenuDiskItem* item = nullptr; const int size = layout()->count() - 1; for (int i = size; 0 <= i; --i) { QWidget *w = layout()->itemAt(i)->widget(); if (w == mPlaceholder) continue; MenuDiskItem *it = static_cast<MenuDiskItem *>(w); if (udi == it->deviceUdi()) { item = it; break; } } if (item != nullptr) { layout()->removeWidget(item); item->deleteLater(); --mDisplayCount; if (mDisplayCount == 0) mPlaceholder->show(); emit deviceRemoved(Solid::Device{udi}); } }
void ConnectionWaiter::quit() { disconnect(USBMonitor::instance(), SIGNAL(deviceDiscovered(USBPortInfo)), this, SLOT(deviceEvent())); disconnect(USBMonitor::instance(), SIGNAL(deviceRemoved(USBPortInfo)), this, SLOT(deviceEvent())); timer.stop(); eventLoop.exit(); }
SerialManagerView::SerialManagerView(QWidget *parent) : QWidget(parent) { /// Timer for Polling timer = new QTimer(this); timer->setInterval(1000); PortSettings settings = {BAUD115200, DATA_8, PAR_NONE, STOP_1, FLOW_OFF, 10}; port = new QextSerialPort(QLatin1String("/dev/tty.usbmodem622"), settings, QextSerialPort::Polling); connect(timer, SIGNAL(timeout()), SLOT(onReadyRead())); /// protocoles connect(port, SIGNAL(readyRead()), SLOT(onReadyRead())); /// Enumerator /// enumerator = new QextSerialEnumerator(this); enumerator->setUpNotifications(); connect(enumerator, SIGNAL(deviceDiscovered(QextPortInfo)), SLOT(onPortAddedOrRemoved())); connect(enumerator, SIGNAL(deviceRemoved(QextPortInfo)), SLOT(onPortAddedOrRemoved())); message = new QLineEdit(this); setupGUI(); }
void SolidHwTest::testManagerSignals() { fakeManager->unplug("/org/kde/solid/fakehw/acpi_CPU0"); // Heh, we missed a processor in this system ;-) // We're going to add this device, and check that the signal has been // properly emitted by the manager QSignalSpy added(Solid::DeviceNotifier::instance(), SIGNAL(deviceAdded(QString))); fakeManager->plug("/org/kde/solid/fakehw/acpi_CPU0"); QCOMPARE(added.count(), 1); QCOMPARE(added.at(0).at(0).toString(), QString("/org/kde/solid/fakehw/acpi_CPU0")); // Moreover we check that the device is really available Solid::Device cpu("/org/kde/solid/fakehw/acpi_CPU0"); QVERIFY(cpu.isValid()); // Finally we remove the device and spy the corresponding signal again QSignalSpy removed(Solid::DeviceNotifier::instance(), SIGNAL(deviceRemoved(QString))); fakeManager->unplug("/org/kde/solid/fakehw/acpi_CPU0"); QCOMPARE(added.count(), 1); QCOMPARE(added.at(0).at(0).toString(), QString("/org/kde/solid/fakehw/acpi_CPU0")); // The Device object should become automatically invalid QVERIFY(!cpu.isValid()); // Restore original state fakeManager->plug("/org/kde/solid/fakehw/acpi_CPU0"); }
bool Joystick::handleSDLEvent(const SDL_Event *event) { switch (event->type) { case SDL_CONTROLLERDEVICEADDED: case SDL_JOYDEVICEADDED: if (!device_attached) return deviceAdded(event); break; case SDL_CONTROLLERDEVICEREMOVED: case SDL_JOYDEVICEREMOVED: if (device_attached) return deviceRemoved(event); break; case SDL_CONTROLLERBUTTONDOWN: case SDL_CONTROLLERBUTTONUP: controllerButtonChanged(event); break; case SDL_JOYBUTTONDOWN: case SDL_JOYBUTTONUP: // joyButtonChanged(event); break; case SDL_CONTROLLERAXISMOTION: controllerAxisChanged(event); break; case SDL_JOYAXISMOTION: case SDL_JOYHATMOTION: break; } return false; }
HotplugWatcher_GUI::HotplugWatcher_GUI(QWidget *parent) : QWidget(parent) { QVBoxLayout *vbl = new QVBoxLayout(this); setLayout(vbl); state = new QLabel(this); button = new QPushButton(tr("Start"), this); detail_button = new QToolButton(this); detail_button->setText(tr("Detail")); detail_button->setCheckable(true); detail_button->setChecked(true); msg_view = new QTextBrowser(this); msg_view->setLineWrapMode(QTextEdit::NoWrap); QHBoxLayout *hbl = new QHBoxLayout(this); hbl->addWidget(button); hbl->addWidget(detail_button); vbl->addWidget(state); vbl->addLayout(hbl); vbl->addWidget(msg_view); tray = new QSystemTrayIcon(this); tray->show(); watcher = new QDeviceWatcher; watcher->appendEventReceiver(this); connect(watcher, SIGNAL(deviceAdded(QString)), this, SLOT(slotDeviceAdded(QString)), Qt::DirectConnection); connect(watcher, SIGNAL(deviceChanged(QString)), this, SLOT(slotDeviceChanged(QString)), Qt::DirectConnection); connect(watcher, SIGNAL(deviceRemoved(QString)), this, SLOT(slotDeviceRemoved(QString)), Qt::DirectConnection); connect(button, SIGNAL(clicked()), SLOT(toggleWatch())); connect(detail_button, SIGNAL(toggled(bool)), SLOT(showDetail(bool))); }
UDisks2Plugin::UDisks2Plugin(QObject *parent) : QObject(parent) { qDBusRegisterMetaType<QVariantMapMap>(); qDBusRegisterMetaType<QByteArrayList>(); m_manager = new UDisks2Manager(this); m_actions = new QActionGroup(this); connect(m_manager,SIGNAL(deviceAdded(QDBusObjectPath)), SLOT(addDevice(QDBusObjectPath))); connect(m_manager,SIGNAL(deviceRemoved(QDBusObjectPath)), SLOT(removeDevice(QDBusObjectPath))); connect(m_actions,SIGNAL(triggered (QAction *)), SLOT(processAction(QAction *))); //load settings QSettings settings(Qmmp::configFile(), QSettings::IniFormat); settings.beginGroup("UDisks2"); m_detectCDA = settings.value("cda", true).toBool(); m_detectRemovable = settings.value("removable", true).toBool(); m_addTracks = false; //do not load tracks on startup m_addFiles = false; //find existing devices QList<QDBusObjectPath> devs = m_manager->findAllDevices(); foreach(QDBusObjectPath o, devs) addDevice(o); //load remaining settings m_addTracks = settings.value("add_tracks", false).toBool(); m_removeTracks = settings.value("remove_tracks", false).toBool(); m_addFiles = settings.value("add_files", false).toBool(); m_removeFiles = settings.value("remove_files", false).toBool(); settings.endGroup(); }
NetworkManager::NetworkManager(QIODevice *serial, QObject *parent) : QObject(parent), serial(serial) { QObject::connect(this, SIGNAL(deviceAdded(node_id,MacAddress)), this, SLOT(onDeviceAdded(node_id,MacAddress))); QObject::connect(this, SIGNAL(deviceRemoved(node_id)), this, SLOT(onDeviceRemoved(node_id))); }
bool QextSerialEnumerator::matchAndDispatchChangedDevice(const QString & deviceID, const GUID & guid, WPARAM wParam) { bool rv = false; DWORD dwFlag = (DBT_DEVICEARRIVAL == wParam) ? DIGCF_PRESENT : DIGCF_ALLCLASSES; HDEVINFO devInfo; if( (devInfo = SetupDiGetClassDevs(&guid,NULL,NULL,dwFlag)) != INVALID_HANDLE_VALUE ) { SP_DEVINFO_DATA spDevInfoData; spDevInfoData.cbSize = sizeof(SP_DEVINFO_DATA); for(int i=0; SetupDiEnumDeviceInfo(devInfo, i, &spDevInfoData); i++) { DWORD nSize=0 ; TCHAR buf[MAX_PATH]; if ( SetupDiGetDeviceInstanceId(devInfo, &spDevInfoData, buf, MAX_PATH, &nSize) && deviceID.contains(TCHARToQString(buf))) // we found a match { rv = true; QextPortInfo info; info.productID = info.vendorID = 0; getDeviceDetailsWin( &info, devInfo, &spDevInfoData, wParam ); if( wParam == DBT_DEVICEARRIVAL ) emit deviceDiscovered(info); else if( wParam == DBT_DEVICEREMOVECOMPLETE ) emit deviceRemoved(info); break; } } SetupDiDestroyDeviceInfoList(devInfo); } return rv; }
DialogBare::DialogBare(QWidget *parent) : QWidget(parent), loading(false), ui(new Ui::DialogBare), worker(NULL), boardFoundWidget(NULL) { ui->setupUi(this); foreach (QextPortInfo info, QextSerialEnumerator::getPorts()) if (!info.portName.isEmpty()) ui->portBox->addItem(info.portName); //make sure user can input their own port name! ui->portBox->setEditable(true); // ui->led->turnOff(); PortSettings settings = {BAUD9600, DATA_8, PAR_NONE, STOP_1, FLOW_OFF, 10}; port = new QextSerialPort(ui->portBox->currentText(), settings, QextSerialPort::Polling); enumerator = new QextSerialEnumerator(this); enumerator->setUpNotifications(); ui->boardComboBox->addItem("PX4FMU v1.6+", 5); ui->boardComboBox->addItem("PX4FLOW v1.1+", 6); ui->boardComboBox->addItem("PX4IO v1.3+", 7); ui->boardComboBox->addItem("PX4 board #8", 8); ui->boardComboBox->addItem("PX4 board #9", 9); ui->boardComboBox->addItem("PX4 board #10", 10); ui->boardComboBox->addItem("PX4 board #11", 11); connect(ui->portBox, SIGNAL(editTextChanged(QString)), SLOT(onPortNameChanged(QString))); connect(ui->flashButton, SIGNAL(clicked()), SLOT(onUploadButtonClicked())); connect(ui->scanButton, SIGNAL(clicked()), SLOT(onDetect())); connect(ui->selectFileButton, SIGNAL(clicked()), SLOT(onFileSelectRequested())); connect(ui->cancelButton, SIGNAL(clicked()), SLOT(onCancelButtonClicked())); connect(ui->advancedCheckBox, SIGNAL(clicked(bool)), this, SLOT(onToggleAdvancedMode(bool))); connect(enumerator, SIGNAL(deviceDiscovered(QextPortInfo)), SLOT(onPortAddedOrRemoved())); connect(enumerator, SIGNAL(deviceRemoved(QextPortInfo)), SLOT(onPortAddedOrRemoved())); setWindowTitle(tr("QUpgrade Firmware Upload / Configuration Tool")); // Adjust the size const int screenHeight = qMin(1000, QApplication::desktop()->height() - 100); resize(700, qMax(screenHeight, 550)); // load settings loadSettings(); // Set up initial state if (!lastFilename.isEmpty()) { ui->flashButton->setEnabled(true); } else { ui->flashButton->setEnabled(false); } }
void DeviceManager::removeDeviceById(int id) { if (!devices.contains(id)) return; emit deviceRemoved(devices[id]); devices.remove(id); changedTimer.start(); }
/* Notification via IOKit that a device has been removed. Create a QextPortInfo if possible, and emit the signal indicating that it's gone. */ void QextSerialEnumerator::onDeviceTerminatedOSX( io_object_t service ) { QextPortInfo info; info.vendorID = 0; info.productID = 0; if( getServiceDetailsOSX( service, &info ) ) emit deviceRemoved( info ); }
void MIDIOut::removeDevice(MIDIDevice* device) { Q_ASSERT(device != NULL); m_devices.removeAll(device); emit deviceRemoved(device); delete device; }
void DeviceManager::delDevice(const QString &ifName) { Device *d = m_devices.value(ifName, 0); if (!d) return; // log << QString("delDevice(%1)").arg(ifName) << endl; d->disable(); emit deviceRemoved(ifName, d); d->deleteLater(); m_devices.remove(ifName); }
NetworkInterfaceMonitor::NetworkInterfaceMonitor(ConnectionList * connectionList, ActivatableList * activatableList, QObject * parent) :QObject(parent), d_ptr(new NetworkInterfaceMonitorPrivate) { Q_D(NetworkInterfaceMonitor); d->connectionList = connectionList; d->activatableList = activatableList; d->dialog.clear(); QObject::connect(NetworkManager::notifier(), SIGNAL(deviceAdded(QString)), this, SLOT(deviceAdded(QString))); QObject::connect(NetworkManager::notifier(), SIGNAL(deviceRemoved(QString)), this, SLOT(deviceRemoved(QString))); foreach (const NetworkManager::Device::Ptr &iface, NetworkManager::networkInterfaces()) { deviceAdded(iface->uni()); }
void UDiskProvider::dbusDeviceRemoved(const QDBusObjectPath &path) { UDiskMountDevice *device = getDevice(path); if (device) { emit deviceRemoved(device); delDevice(device); } }
bool QUsbHidEnumerator::matchAndDispatchChangedDevice(const QString & deviceID, const GUID & guid, WPARAM wParam) { bool rv = false; DWORD dwFlag = (DBT_DEVICEARRIVAL == wParam) ? DIGCF_PRESENT : DIGCF_ALLCLASSES; dwFlag |= DIGCF_INTERFACEDEVICE; HDEVINFO devInfo; QString s; if(m_vid && m_pid){ s = QString("VID_%1&PID_%2").arg((ulong)m_vid,4,16,QChar('0')).arg((ulong)m_pid,4,16,QChar('0')); }else if(m_vid){ s = QString("VID_%1").arg((ulong)m_vid,4,16,QChar('0')); }else if(m_pid){ s = QString("PID_%1").arg((ulong)m_pid,4,16,QChar('0')); } QRegExp idRx(s.toUpper()); if( (devInfo = SetupDiGetClassDevs(&guid,NULL,NULL,dwFlag)) != INVALID_HANDLE_VALUE ) { SP_INTERFACE_DEVICE_DATA ifData; ifData.cbSize=sizeof(ifData); for(int i=0; SetupDiEnumDeviceInterfaces(devInfo, NULL, &guid, i, &ifData); i++) { DWORD needed; SetupDiGetDeviceInterfaceDetail(devInfo, &ifData, NULL, 0, &needed, NULL); PSP_INTERFACE_DEVICE_DETAIL_DATA detail=(PSP_INTERFACE_DEVICE_DETAIL_DATA)new BYTE[needed]; detail->cbSize=sizeof(SP_INTERFACE_DEVICE_DETAIL_DATA); SP_DEVINFO_DATA did={sizeof(SP_DEVINFO_DATA)}; if (SetupDiGetDeviceInterfaceDetail(devInfo, &ifData, detail, needed, NULL, &did)){ QString path = TCHARToQString(detail->DevicePath); if(deviceID.toUpper().contains(path.toUpper())){ rv = true; QUsbHidInfo info; info.path = path; bool ready = false; if(m_vid || m_pid){ ready = (info.path.toUpper().contains(idRx)); }else{ ready = true; } if(ready){ info.productID = info.vendorID = info.version = 0; getDeviceDetailsWin( &info, devInfo, &did, wParam ); if( wParam == DBT_DEVICEARRIVAL ) emit deviceDiscovered(info); else if( wParam == DBT_DEVICEREMOVECOMPLETE ) emit deviceRemoved(info); } break; } } delete [] detail; } SetupDiDestroyDeviceInfoList(devInfo); } return rv; }
void HID::removeDevice(HIDDevice* device) { Q_ASSERT(device != NULL); m_devices.removeAll(device); emit deviceRemoved(device); delete device; emit configurationChanged(); }
InspectorOutputWidget::InspectorOutputWidget(QWidget* parent) : QWidget(parent), command(NULL), model(NULL), delayType("") { setupUi(this); this->comboBoxTriCasterDevice->setVisible(false); this->delayType = DatabaseManager::getInstance().getConfigurationByName("DelayType").getValue(); this->comboBoxTarget->lineEdit()->setStyleSheet("background-color: transparent; border-width: 0px;"); QObject::connect(&DeviceManager::getInstance(), SIGNAL(deviceRemoved()), this, SLOT(deviceRemoved())); QObject::connect(&DeviceManager::getInstance(), SIGNAL(deviceAdded(CasparDevice&)), this, SLOT(deviceAdded(CasparDevice&))); QObject::connect(&TriCasterDeviceManager::getInstance(), SIGNAL(deviceRemoved()), this, SLOT(tricasterDeviceRemoved())); QObject::connect(&TriCasterDeviceManager::getInstance(), SIGNAL(deviceAdded(TriCasterDevice&)), this, SLOT(tricasterDeviceAdded(TriCasterDevice&))); qApp->installEventFilter(this); }
InspectorMetadataWidget::InspectorMetadataWidget(QWidget* parent) : QWidget(parent), preview(false), model(NULL) { setupUi(this); this->animation = new BorderAnimation(this->comboBoxDevice); QObject::connect(&DeviceManager::getInstance(), SIGNAL(deviceRemoved()), this, SLOT(deviceRemoved())); QObject::connect(&DeviceManager::getInstance(), SIGNAL(deviceAdded(CasparDevice&)), this, SLOT(deviceAdded(CasparDevice&))); qApp->installEventFilter(this); }
UsbExample::UsbExample(QObject *parent) : QObject(parent) { QObject::connect(&m_usb_manager, SIGNAL(deviceInserted(QUsbDevice::IdList)), this, SLOT(onDevInserted(QUsbDevice::IdList))); QObject::connect(&m_usb_manager, SIGNAL(deviceRemoved(QUsbDevice::IdList)), this, SLOT(onDevRemoved(QUsbDevice::IdList))); m_usb_manager.setLogLevel(QUsbDevice::logDebug); qInfo("Starting..."); qInfo("Press CTRL+C to close."); }
void DeviceModel::removeDevice(QString ipAddress) { int index = m_deviceMap.keys().indexOf(ipAddress); beginRemoveRows(QModelIndex(), index, index); Device *device = m_deviceMap.value(ipAddress); m_deviceMap.remove(ipAddress); emit deviceRemoved(device->toString()); delete device; endRemoveRows(); }
Solid::DeviceManagerPrivate::DeviceManagerPrivate() : m_nullDevice(new DevicePrivate(QString())) { loadBackends(); QList<QObject*> backends = managerBackends(); foreach (QObject *backend, backends) { connect(backend, SIGNAL(deviceAdded(QString)), this, SLOT(_k_deviceAdded(QString))); connect(backend, SIGNAL(deviceRemoved(QString)), this, SLOT(_k_deviceRemoved(QString))); }