void MusicSongsSummarizied::importOtherMusicSongs(const QStringList &filelist) { MusicProgressWidget progress; progress.show(); progress.setTitle(tr("Import File Mode")); progress.setRange(0, filelist.count()); MusicSongTag tag; for(int i=0; i<filelist.count(); ++i) { tag.readFile(filelist[i]); QString time(tag.getLengthString()); m_musicFileNames[0] << MusicSong(filelist[i], 0, time.left(time.lastIndexOf(':')), QString()); progress.setValue(i + 1); } m_mainSongLists[0]->updateSongsFileName(m_musicFileNames[0]); }
void MusicConnectTransferWidget::startToTransferFiles() { MIntList list(ui->playListTableWidget->getSelectedItems()); if(list.isEmpty()) { MusicMessageBox message; message.setText(tr("please select one item")); message.exec(); return; } if(m_currentIndex == -1 || m_currentIndex > m_currentSongs.count()) { return; } QStringList names; QString path = M_SETTING->value(MusicSettingManager::MobileDevicePathChoiced).toString(); foreach(int index, list) { if(!m_searchfileListCache.isEmpty()) { int count = ui->searchLineEdit->text().trimmed().count(); index = m_searchfileListCache.value(count)[index]; } names << m_currentSongs[index].getMusicPath(); } MusicProgressWidget progress; progress.show(); progress.setTitle(tr("Copy File Mode")); progress.setRange(0, names.count()); for(int i=0; i<names.count(); ++i) { QFile::copy(names[i], QString("%1/%2").arg(path).arg(names[i].split("/").last())); progress.setValue(i); } ui->allSelectedcheckBox->setChecked(false); ui->playListTableWidget->clearSelection(); }
void MusicSongsListWidget::setDeleteItemAt() { MusicMessageBox message; message.setText(tr("Are you sure to delete?")); if(message.exec() || rowCount() == 0 || currentRow() < 0) { return; } MusicProgressWidget progress; progress.show(); progress.setTitle(tr("Delete File Mode")); progress.setRange(0, selectedItems().count()/3*2); MIntSet deletedRow; //if selected multi rows for(int i=0; i<selectedItems().count(); ++i) { deletedRow.insert(selectedItems()[i]->row()); if(i%3 == 0) { progress.setValue(i/3); } } MIntList deleteList = deletedRow.toList(); if(deleteList.count() == 0) { return; } qSort(deleteList); if(deleteList.contains(m_playRowIndex) || deleteList[0] < m_playRowIndex) { replacePlayWidgetRow(); } for(int i=deleteList.count() - 1; i>=0; --i) { removeRow(deleteList[i]); //Delete the current row progress.setValue(deleteList.count()*2 - i); } emit deleteItemAt(deleteList, m_deleteItemWithFile); }