示例#1
0
void MainWindow::slotRemoveDevice() {
    CDEmu::Result result = CDEmu::instance()->removeDevice();
    if (!result == CDEmu::Success) {
        MessageBox::error(result);
        return;
    }
    updateDeviceList();
}
 //==============================================================================
 AndroidBluetoothMidiDevicesListBox()
     : timerPeriodInMs (1000)
 {
     setRowHeight (40);
     setModel (this);
     setOutlineThickness (1);
     updateDeviceList();
     startTimer (timerPeriodInMs);
 }
QDeclarativeInputDeviceModel::QDeclarativeInputDeviceModel(QObject *parent) :
    QAbstractListModel(parent),
    deviceInfo(new QInputDeviceManager),
    currentFilter(QInputDevice::Unknown)
{
    connect(deviceInfo,SIGNAL(ready()),this,SLOT(updateDeviceList()));
    connect(deviceInfo, &QInputDeviceManager::deviceAdded,this,&QDeclarativeInputDeviceModel::addedDevice);
    connect(deviceInfo, &QInputDeviceManager::deviceRemoved,this,&QDeclarativeInputDeviceModel::removedDevice);
}
示例#4
0
void ConnectionWidget::onReady()
{
    QObject::connect(RTLSDisplayApplication::serialConnection(), SIGNAL(connectionStateChanged(SerialConnection::ConnectionState)),
                     this, SLOT(connectionStateChanged(SerialConnection::ConnectionState)));

    updateDeviceList();

    //connectionStateChanged(SerialConnection::Disconnected);
}
示例#5
0
void MainWindow::slotDaemonChanged(bool running)
{
    m_ui.deviceList->setEnabled(running);
//    m_ui.SelectImageBox->setEnabled(running);
//    m_ui.MountButton->setEnabled(running);
//    m_ui.UnmountButton->setEnabled(running);

    if (running)
    {
        updateDeviceList();
        m_statusLabel->setText(i18n("CDEmu daemon running."));
    }
    else
        m_statusLabel->setText(i18n("CDEmu daemon not running."));
}
void DeviceManager::update()
{
	// Update the list of connected Device (if needed)
	if ( mEnumerationTrigger->enumerationNeeded() )
		updateDeviceList();

	// Update the devices
	for ( std::size_t i=0; i<mDevices.size(); ++i )
	{
		Device* device = mDevices[i].second;
		device->update();
		
/*		Device* dev = static_cast<Device*>(device);
		printf("name:%s\n", dev->getDeviceInstance().getInstanceName() );//, dev->getDeviceInstance().getInstanceId()
		for ( std::size_t i=0; i<dev->getObjects().size(); ++i )
		{
			Object* obj = dev->getObjects()[i];
			printf("%s\n", obj->toString().c_str() );
		}*/	
	}
}
 void timerCallback() override
 {
     updateDeviceList();
 }
 void pairDeviceThreadFinished() // callback from PairDeviceThread
 {
     updateDeviceList();
     startTimer (timerPeriodInMs);
 }
MediaListsManager::MediaListsManager(MainWindow* parent) : QObject(parent)
{
    m_application = (BangarangApplication*)KApplication::kApplication();
    Ui::MainWindowClass* ui = m_application->mainWindow()->ui;

    //Set up Audio lists view
    MediaListProperties audioListsProperties;
    audioListsProperties.lri = "medialists://audio";
    m_audioListsModel = new MediaItemModel(this);
    m_audioListsModel->setMediaListProperties(audioListsProperties);
    QListView* audioLists = m_application->mainWindow()->audioListsStack()->ui->audioLists;
    audioLists->setModel(m_audioListsModel);
    connect(audioLists->selectionModel(), SIGNAL(selectionChanged(const QItemSelection, const QItemSelection)), this, SLOT(audioListsSelectionChanged(const QItemSelection, const QItemSelection)));
    connect(m_audioListsModel, SIGNAL(mediaListChanged()), this, SLOT(audioListsChanged()));
    m_audioListsModel->load();
    QToolButton* audioListSelect = m_application->mainWindow()->ui->audioListSelect;
    connect(audioListSelect, SIGNAL(clicked()), this, SLOT(selectAudioList()));

    //Set up Video lists view
    MediaListProperties videoListsProperties;
    videoListsProperties.lri = "medialists://video";
    m_videoListsModel = new MediaItemModel(this);
    m_videoListsModel->setMediaListProperties(videoListsProperties);
    QListView* videoLists = m_application->mainWindow()->videoListsStack()->ui->videoLists;
    videoLists->setModel(m_videoListsModel);
    connect(videoLists->selectionModel(), SIGNAL(selectionChanged(const QItemSelection, const QItemSelection)), this, SLOT(videoListsSelectionChanged(const QItemSelection, const QItemSelection)));
    connect(m_videoListsModel, SIGNAL(mediaListChanged()), this, SLOT(videoListsChanged()));
    m_videoListsModel->load();
    QToolButton* videoListSelect = m_application->mainWindow()->ui->videoListSelect;
    connect(videoListSelect, SIGNAL(clicked()), this, SLOT(selectVideoList()));

    //Set up media list view
    m_loadingProgress = 0;
    MediaView* mediaView = ui->mediaView;
    mediaView->setMainWindow(m_application->mainWindow());
    mediaView->setSourceModel(m_application->browsingModel());
    connect(m_application->browsingModel(), SIGNAL(mediaListChanged()), this, SLOT(mediaListChanged()));
    connect(m_application->browsingModel(), SIGNAL(mediaListPropertiesChanged()), this, SLOT(mediaListPropertiesChanged()));
    connect(m_application->browsingModel(), SIGNAL(loading()), this, SLOT(mediaListLoading()));
    connect(m_application->browsingModel(), SIGNAL(loadingStateChanged(bool)), this, SLOT(mediaListLoadingStateChanged(bool)));
    connect(m_application->browsingModel(), SIGNAL(propertiesChanged()), this, SLOT(updateListHeader()));
    connect((MediaItemDelegate *)mediaView->itemDelegate(), SIGNAL(categoryActivated(QModelIndex)), this, SLOT(mediaListCategoryActivated(QModelIndex)));
    connect((MediaItemDelegate *)mediaView->itemDelegate(), SIGNAL(actionActivated(QModelIndex)), this, SLOT(mediaListActionActivated(QModelIndex)));
    connect(mediaView->selectionModel(), SIGNAL(selectionChanged(const QItemSelection, const QItemSelection)), this, SLOT(mediaSelectionChanged(const QItemSelection, const QItemSelection)));
    connect(ui->previous, SIGNAL(clicked()), this, SLOT(loadPreviousList()));
    connect(m_application->playlist()->nowPlayingModel(), SIGNAL(mediaListChanged()), this, SLOT(nowPlayingChanged()));
    connect(m_application->mainWindow(), SIGNAL(switchedMainWidget(MainWindow::MainWidget)), this, SLOT(defaultListLoad(MainWindow::MainWidget)));

    //Setup media list filter
    ui->mediaListFilterProxyLine->lineEdit()->setClickMessage(QString());
    ui->mediaListFilterProxyLine->setProxy(ui->mediaView->filterProxyModel());
    ui->mediaListFilter->setVisible(false);
    connect(ui->closeMediaListFilter, SIGNAL(clicked()), this, SLOT(closeMediaListFilter()));

    //Set up play select/all buttons
    connect(ui->playAll, SIGNAL(clicked()), this, SLOT(playAll()));
    connect(ui->playSelected, SIGNAL(clicked()), this, SLOT(playSelected()));

    //Setup browsing model status notifications
    connect(m_application->browsingModel(), SIGNAL(statusUpdated()), this, SLOT(browsingModelStatusUpdated()));

    //Set up search
    KLineEdit* searchField = m_application->mainWindow()->ui->Filter;
    connect(searchField, SIGNAL(returnPressed()), this, SLOT(loadSearch()));

    //Set up device notifier
    connect(DeviceManager::instance(), SIGNAL(deviceListChanged(DeviceManager::RelatedType)),
            this, SLOT(updateDeviceList(DeviceManager::RelatedType)));

    //Set default media list selection
    showMediaList(AudioList);

}
示例#10
0
//==============================================================================
void MainContentComponent::timerCallback ()
{
    updateDeviceList (true);
    updateDeviceList (false);
}
示例#11
0
static void workLoop()
{
    deviceList *list;
    int ctlSock = INVALID_PIPE;

    /* initialize the driver and device list */
    if ((list = initServer(&srvSettings)) == NULL)
        message(LOG_ERROR, "failed to initialize the device list.\n");
    else if (signal(SIGINT, quitHandler) == SIG_ERR)
        message(LOG_ERROR, "failed to install SIGINT handler.\n");
    else if (signal(SIGTERM, quitHandler) == SIG_ERR)
        message(LOG_ERROR, "failed to install SIGTERM handler.\n");
    else if (signal(SIGHUP, scanHandler) == SIG_ERR)
        message(LOG_ERROR, "failed to install SIGHUP handler.\n");
    else if (signal(SIGPIPE, SIG_IGN) == SIG_ERR)
        message(LOG_ERROR, "failed to ignore SIGPIPE messages.\n");
    else if (! srvSettings.justDescribe && (ctlSock = startListening(NULL)) == INVALID_PIPE)
        message(LOG_ERROR, "failed to open the control socket.\n");
    else
    {
        bool quit = false;

#if DEBUG
printf("OPEN %d %s(%d)\n", srvSettings.commPipe[0], __FILE__, __LINE__);
printf("OPEN %d %s(%d)\n", srvSettings.commPipe[1], __FILE__, __LINE__);
#endif

        /* trigger the initial device scan */
        scanHandler(SIGHUP);

#ifdef __APPLE__
        /* Support hot plug in on Mac OS X -- returns non-zero for error */
        daemon_osx_support(ids);
#endif

        /* loop, waiting for commands */
        while(! quit)
        {
            THREAD_PTR thread = INVALID_THREAD_PTR;
            void *exitVal;

            /* wait for a new ctl connection, a command from an
               existing ctl connection, or a message from an exiting
               child thread. */

            /* read a command and check for error */
            if (readPipe(srvSettings.commPipe[READ], &thread,
                         sizeof(THREAD_PTR)) != sizeof(THREAD_PTR))
            {
                message(LOG_ERROR,
                        "CommPipe read failed: %s\n", translateError(errno));
                quit = true;
            }
            /* threads trigger a join by telling the main thread their id */
            else if (thread != INVALID_THREAD_PTR)
                joinThread(thread, &exitVal);
            /* read the actual command (came from a signal handler) */
            else if (readPipe(srvSettings.commPipe[READ], &thread,
                              sizeof(THREAD_PTR)) != sizeof(THREAD_PTR))
            {
                message(LOG_ERROR,
                        "Command read failed: %s\n", translateError(errno));
                quit = true;
            }
            /* handle the shutdown command */
            else if (thread == QUIT_TRIGGER)
                quit = true;
            /* complain about unknown commands */
            else if (thread != SCAN_TRIGGER)
                message(LOG_ERROR,
                        "Unknown command from commPipe: %d\n", thread);
            /* handle the scan/rescan command */
            else
            {
                if (srvSettings.justDescribe)
                    message(LOG_NORMAL, "Detected Iguanaworks devices:\n");
                if (! updateDeviceList(list))
                    message(LOG_ERROR, "scan failed.\n");
                if (srvSettings.justDescribe)
                    break;
            }
        }

        /* wait for all the workers to finish */
        reapAllChildren(list);

        /* close up the server socket */
        stopListening(ctlSock, NULL);
    }
}