示例#1
0
/*!
  Releases and destroyes all camera resources.
*/
void CustomCamera::destroyResources()
{
    if (m_camera) {
        m_camera->stop();
    }
    
    m_imageFrame = QImage();
    
    if (m_cameraImageCapture) {
        delete m_cameraImageCapture;
        m_cameraImageCapture = 0;
    }
    
    if (m_mediaRecorder) {
        delete m_mediaRecorder;
        m_mediaRecorder = 0;
    }
    
    delete m_camera;
    m_camera = 0;
    
    m_incomingFrameCounter = 0;
    m_processedFrameCounter = 0;
    
    m_currentDevice = "";
    emit currentDeviceChanged();
}
void SeverSelectionWidget::currentChanged(int index)
{
    QWidget *widget = ui->tabWidget->widget(index);
    ServerInformationWidget *server = qobject_cast<ServerInformationWidget *>(widget);
    GatewayDevice *device = d->devices.key(server, 0);
    if (device)
        emit currentDeviceChanged(device);
}
void SeverSelectionWidget::setCurrentDevice(GatewayDevice *device)
{
    ServerInformationWidget *widget = d->devices.value(device);
    if (widget) {
        if (ui->tabWidget->currentWidget() != widget) {
            ui->tabWidget->setCurrentWidget(widget);
        } else {
            emit currentDeviceChanged(device);
        }
    }
}