// The actual callback function called by DAL static HRESULT myDalCallBack (DAL_CB_EVENT_MASK events, DAL_EVENTS * pExtEvents, uint32 data) { uint16 aesStatus; uint32 extStatus=0; //extended status to the driver DAL_STATUS dalStatus; // We want to tell the diceDriver about the locked status of the clock domain // and sample rate etc. // let's collect AES/ADAT/AVS interface lock status. // We pass this on to the driver. It is not needed for the driver/streaming operation // but it can be obtained by control panels to provide visual feedback to the user aesGetStatus (&aesStatus); if (aesStatus & AES_STAT_LOCK0) extStatus |= DD_EXT_STATUS_AES0_LOCKED; if (aesStatus & AES_STAT_LOCK1) extStatus |= DD_EXT_STATUS_AES1_LOCKED; if (aesStatus & AES_STAT_LOCK2) extStatus |= DD_EXT_STATUS_AES2_LOCKED; if (aesStatus & AES_STAT_LOCK3) extStatus |= DD_EXT_STATUS_AES3_LOCKED; //let's update the slip information if (pExtEvents->aes_events & (DAL_CB_AES0_SLIP | DAL_CB_AES0_RPT)) extStatus |= DD_EXT_STATUS_AES0_SLIP; if (pExtEvents->aes_events & (DAL_CB_AES1_SLIP | DAL_CB_AES1_RPT)) extStatus |= DD_EXT_STATUS_AES1_SLIP; if (pExtEvents->aes_events & (DAL_CB_AES2_SLIP | DAL_CB_AES2_RPT)) extStatus |= DD_EXT_STATUS_AES2_SLIP; if (pExtEvents->aes_events & (DAL_CB_AES3_SLIP | DAL_CB_AES3_RPT)) extStatus |= DD_EXT_STATUS_AES3_SLIP; //let's collect ADAT interface lock status. if (adatIsLocked()) extStatus |= DD_EXT_STATUS_ADAT_LOCKED; //let's update the slip information //if (pExtEvents->adat_events & (DAL_CB_ADAT_SLIP | DAL_CB_ADAT_RPT)) extStatus |= DD_EXT_STATUS_ADAT_SLIP; //let's collect AVS interface lock status (for debuggin purposes) if (avsRxIsLocked(AVS_PLUG_ID1)) extStatus |= DD_EXT_STATUS_ARX1_LOCKED; if (avsRxIsLocked(AVS_PLUG_ID2)) extStatus |= DD_EXT_STATUS_ARX2_LOCKED; //let's update the slip information if (pExtEvents->avs_events & (DAL_CB_AVS1_SLIP | DAL_CB_AVS1_RPT)) extStatus |= DD_EXT_STATUS_ARX1_SLIP; if (pExtEvents->avs_events & (DAL_CB_AVS2_SLIP | DAL_CB_AVS2_RPT)) extStatus |= DD_EXT_STATUS_ARX2_SLIP; // At last the most important thing, get the "dal" status and call diceDriver // The diceDriver must know when the device is unlocked and locked so it can perform // proper synchronization of streams. dalGetCurrentStatus (eDAL_INTERFACE_1, &dalStatus); diceDriverSetStatus (dalStatus.state == eDAL_STATE_LOCKED, dalStatus.lockedNominalRate, dalStatus.lockedRateHz, extStatus); // And make sure the codecs gets updated, see function defined above. updateCodec(&dalStatus); // Now some application specific stuff, we do the LED's updateStatusLEDs(); return NO_ERROR; }
// This thread handles the MIDI indicate LED's // It also makes sure that the codec gets initialized. static void myMidiIndicateThread(void *dummy) { //make sure update codec get's called if we already have lock DAL_STATUS dalStatus; dalGetCurrentStatus (eDAL_INTERFACE_1, &dalStatus); updateCodec(&dalStatus); DO_FOREVER { TCTaskWait(200); //every 200ms uint8 act = uart1_activity (); amDisplayLed (AM_LED_MIDI_IN,act&UART_RX_ACTIVITY); amDisplayLed (AM_LED_MIDI_OUT,act&UART_TX_ACTIVITY); } }
void KoCsvImportDialog::Private::loadSettings() { KConfigGroup configGroup = KGlobal::config()->group("CSVDialog Settings"); textQuote = configGroup.readEntry("textQuote", "\"")[0]; delimiter = configGroup.readEntry("delimiter", ","); ignoreDuplicates = configGroup.readEntry("ignoreDups", false); const QString codecText = configGroup.readEntry("codec", ""); // update widgets if (!codecText.isEmpty()) { dialog->comboBoxEncoding->setCurrentIndex(dialog->comboBoxEncoding->findText(codecText)); codec = updateCodec(); } q->setDelimiter(delimiter); dialog->m_ignoreDuplicates->setChecked(ignoreDuplicates); dialog->m_comboQuote->setCurrentIndex(textQuote == '\'' ? 1 : textQuote == '"' ? 0 : 2); }
void MusicListView::showContextMenu(const QPoint &pos, PlaylistPtr selectedPlaylist, PlaylistPtr favPlaylist, QList<PlaylistPtr> newPlaylists) { Q_D(MusicListView); QItemSelectionModel *selection = this->selectionModel(); if (selection->selectedRows().length() <= 0) { return; } QPoint globalPos = this->mapToGlobal(pos); QMenu playlistMenu; playlistMenu.setStyle(QStyleFactory::create("dlight")); auto newvar = QVariant::fromValue(PlaylistPtr()); auto createPlaylist = playlistMenu.addAction(tr("New playlist")); createPlaylist->setData(newvar); createPlaylist->setIcon(QIcon(":/light/image/plus.svg")); playlistMenu.addSeparator(); if (selectedPlaylist != favPlaylist) { auto act = playlistMenu.addAction(favPlaylist->displayName()); act->setData(QVariant::fromValue(favPlaylist)); } for (auto playlist : newPlaylists) { QFont font(playlistMenu.font()); QFontMetrics fm(font); auto text = fm.elidedText(QString(playlist->displayName().replace("&", "&&")), Qt::ElideMiddle, 160); auto act = playlistMenu.addAction(text); act->setData(QVariant::fromValue(playlist)); } connect(&playlistMenu, &QMenu::triggered, this, [ = ](QAction * action) { auto playlist = action->data().value<PlaylistPtr >(); qDebug() << playlist; MetaPtrList metalist; for (auto &index : selection->selectedRows()) { auto meta = d->model->meta(index); if (!meta.isNull()) { metalist << meta; } } Q_EMIT addToPlaylist(playlist, metalist); }); bool singleSelect = (1 == selection->selectedRows().length()); QMenu myMenu; myMenu.setStyle(QStyleFactory::create("dlight")); QAction *playAction = nullptr; if (singleSelect) { playAction = myMenu.addAction(tr("Play")); } myMenu.addAction(tr("Add to playlist"))->setMenu(&playlistMenu); myMenu.addSeparator(); QAction *displayAction = nullptr; if (singleSelect) { displayAction = myMenu.addAction(tr("Display in file manager")); } auto removeAction = myMenu.addAction(tr("Remove from playlist")); auto deleteAction = myMenu.addAction(tr("Delete from local disk")); QAction *songAction = nullptr; QMenu textCodecMenu; textCodecMenu.setStyle(QStyleFactory::create("dlight")); if (singleSelect) { auto index = selection->selectedRows().first(); auto meta = d->model->meta(index); QList<QByteArray> codecList = DMusic::detectMetaEncodings(meta); // codecList << "utf-8" ; for (auto codec : codecList) { auto act = textCodecMenu.addAction(codec); act->setData(QVariant::fromValue(codec)); } if (codecList.length() > 1) { myMenu.addSeparator(); myMenu.addAction(tr("Encoding"))->setMenu(&textCodecMenu); } myMenu.addSeparator(); songAction = myMenu.addAction(tr("Song info")); connect(&textCodecMenu, &QMenu::triggered, this, [ = ](QAction * action) { auto codec = action->data().toByteArray(); meta->updateCodec(codec); Q_EMIT updateMetaCodec(meta); }); } if (playAction) { connect(playAction, &QAction::triggered, this, [ = ](bool) { auto index = selection->selectedRows().first(); Q_EMIT playMedia(d->model->meta(index)); }); } if (displayAction) { connect(displayAction, &QAction::triggered, this, [ = ](bool) { auto index = selection->selectedRows().first(); auto meta = d->model->meta(index); auto dirUrl = QUrl::fromLocalFile(meta->localPath); Dtk::Widget::DDesktopServices::showFileItem(dirUrl); }); } if (removeAction) { connect(removeAction, &QAction::triggered, this, [ = ](bool) { d->removeSelection(selection); }); } if (deleteAction) { connect(deleteAction, &QAction::triggered, this, [ = ](bool) { bool containsCue = false; MetaPtrList metalist; for (auto index : selection->selectedRows()) { auto meta = d->model->meta(index); if (!meta->cuePath.isEmpty()) { containsCue = true; } metalist << meta; } Dtk::Widget::DDialog warnDlg(this); warnDlg.setStyle(QStyleFactory::create("dlight")); warnDlg.setTextFormat(Qt::RichText); warnDlg.addButton(tr("Cancel"), true, Dtk::Widget::DDialog::ButtonWarning); warnDlg.addButton(tr("Delete"), false, Dtk::Widget::DDialog::ButtonNormal); auto cover = QImage(QString(":/common/image/del_notify.svg")); if (1 == metalist.length()) { auto meta = metalist.first(); auto coverData = MetaSearchService::coverData(meta); if (coverData.length() > 0) { cover = QImage::fromData(coverData); } warnDlg.setMessage(QString(tr("Are you sure you want to delete %1?")).arg(meta->title)); } else { warnDlg.setMessage(QString(tr("Are you sure you want to delete the selected %1 songs?")).arg(metalist.length())); } if (containsCue) { warnDlg.setTitle(tr("Are you sure you want to delete the selected %1 songs?").arg(metalist.length())); warnDlg.setMessage(tr("Deleting the current song will also delete the song files contained")); } auto coverPixmap = QPixmap::fromImage(WidgetHelper::cropRect(cover, QSize(64, 64))); warnDlg.setIcon(QIcon(coverPixmap)); if (0 == warnDlg.exec()) { return; } Q_EMIT deleteMusicList(metalist); }); } if (songAction) { connect(songAction, &QAction::triggered, this, [ = ](bool) { auto index = selection->selectedRows().first(); auto meta = d->model->meta(index); Q_EMIT showInfoDialog(meta); }); } myMenu.exec(globalPos); }