void PresentationAudioPage::addItems(const QList<QUrl>& fileList) { if (fileList.isEmpty()) return; QList<QUrl> Files = fileList; for (QList<QUrl>::ConstIterator it = Files.constBegin(); it != Files.constEnd(); ++it) { QUrl currentFile = *it; d->sharedData->soundtrackPath = currentFile; PresentationAudioListItem* const item = new PresentationAudioListItem(m_SoundFilesListBox, currentFile); item->setName(currentFile.fileName()); m_SoundFilesListBox->insertItem(m_SoundFilesListBox->count() - 1, item); d->soundItems->insert(currentFile, item); connect(d->soundItems->value(currentFile), SIGNAL(signalTotalTimeReady(QUrl,QTime)), this, SLOT(slotAddNewTime(QUrl,QTime))); d->urlList.append(currentFile); } m_SoundFilesListBox->setCurrentItem(m_SoundFilesListBox->item(m_SoundFilesListBox->count() - 1)) ; slotSoundFilesSelected(m_SoundFilesListBox->currentRow()); m_SoundFilesListBox->scrollToItem(m_SoundFilesListBox->currentItem()); m_previewButton->setEnabled(true); }
void SoundtrackDialog::addItems(const KUrl::List& fileList) { if (fileList.isEmpty()) return; KUrl::List Files = fileList; for (KUrl::List::ConstIterator it = Files.constBegin(); it != Files.constEnd(); ++it) { KUrl currentFile = *it; KUrl path = KUrl(currentFile.path().section('/', 0, -1)); m_sharedData->soundtrackPath = path; SoundItem *item = new SoundItem(m_SoundFilesListBox, path); item->setName(currentFile.path().section('/', -1)); m_SoundFilesListBox->insertItem(m_SoundFilesListBox->count() - 1, item); m_soundItems->insert(path, item); connect(m_soundItems->value(path), SIGNAL(signalTotalTimeReady(const KUrl&, const QTime&)), this, SLOT(slotAddNewTime(const KUrl&, const QTime&))); m_urlList.append(path); } m_SoundFilesListBox->setCurrentItem(m_SoundFilesListBox->item(m_SoundFilesListBox->count() - 1)) ; slotSoundFilesSelected(m_SoundFilesListBox->currentRow()); m_SoundFilesListBox->scrollToItem(m_SoundFilesListBox->currentItem()); m_previewButton->setEnabled(true); }
void SoundtrackDialog::slotSoundFilesButtonDelete() { int Index = m_SoundFilesListBox->currentRow(); if( Index < 0 ) return; SoundItem* pitem = static_cast<SoundItem*>(m_SoundFilesListBox->takeItem(Index)); m_urlList.removeAll(pitem->url()); m_soundItems->remove(pitem->url()); m_timeMutex->lock(); m_tracksTime->remove(pitem->url()); updateTracksNumber(); m_timeMutex->unlock(); delete pitem; slotSoundFilesSelected(m_SoundFilesListBox->currentRow()); if (m_SoundFilesListBox->count() == 0) m_previewButton->setEnabled(false); updateFileList(); }
void PresentationAudioPage::slotSoundFilesButtonDelete() { int Index = m_SoundFilesListBox->currentRow(); if( Index < 0 ) return; PresentationAudioListItem* const pitem = static_cast<PresentationAudioListItem*>(m_SoundFilesListBox->takeItem(Index)); d->urlList.removeAll(pitem->url()); d->soundItems->remove(pitem->url()); d->timeMutex->lock(); d->tracksTime->remove(pitem->url()); updateTracksNumber(); d->timeMutex->unlock(); delete pitem; slotSoundFilesSelected(m_SoundFilesListBox->currentRow()); if (m_SoundFilesListBox->count() == 0) m_previewButton->setEnabled(false); updateFileList(); }