void MusicConnectTransferWidget::createAllItems(const MusicSongs &songs) { ui->playListTableWidget->clear(); if(ui->allSelectedcheckBox->isChecked()) { ui->allSelectedcheckBox->click(); } ui->playListTableWidget->setRowCount(songs.count()); for(int i=0; i<songs.count(); ++i) { MusicSong song = songs[i]; QTableWidgetItem *item = new QTableWidgetItem; item->setData(MUSIC_CHECK_ROLE, false); ui->playListTableWidget->setItem(i, 0, item); item = new QTableWidgetItem; item->setText(QFontMetrics(font()).elidedText(song.getMusicName(), Qt::ElideRight, 280)); item->setToolTip(song.getMusicPath()); item->setTextAlignment(Qt::AlignLeft | Qt::AlignVCenter); ui->playListTableWidget->setItem(i, 1, item); item = new QTableWidgetItem; item->setText(QFontMetrics(font()).elidedText(song.getMusicTime(), Qt::ElideRight, 40)); item->setToolTip(song.getMusicTime()); item->setTextAlignment(Qt::AlignLeft | Qt::AlignVCenter); ui->playListTableWidget->setItem(i, 2, item); } }
void MusicSongsSummarizied::addMusicSongToLovestListAt(int row) { MusicSong song = m_musicFileNames[currentIndex()][row]; m_musicFileNames[1] << song; m_mainSongLists[1]->updateSongsFileName(m_musicFileNames[1]); if(m_currentIndexs == 1) { emit updatePlayLists(song.getMusicPath()); } MusicMessageBox message; message.setText(tr("add music to lovest list done!")); message.exec(); }
void MusicSongsListWidget::showTimeOut() { m_timerShow.stop(); if(m_musicSongsInfoWidget) { MusicSong song = (*m_musicSongs)[m_previousColorRow]; song.setMusicSize( QFileInfo(song.getMusicPath()).size() ); m_musicSongsInfoWidget->setMusicSongInformation( song ); m_musicSongsInfoWidget->setGeometry(mapToGlobal(QPoint(width(), 0)).x() + 5, QCursor::pos().y(), 264, 108); bool isCurrentIndex; emit isCurrentIndexs(isCurrentIndex); m_musicSongsInfoWidget->setVisible( isCurrentIndex ? (m_musicSongsPlayWidget && !m_musicSongsPlayWidget->getItemRenameState()) : true); } }
void MusicSongsSummarizied::setDeleteItemAt(const MIntList &index, bool fileRemove) { if(index.count() == 0) { return; } for(int i=index.count() - 1; i>=0; --i) { MusicSong song = m_musicFileNames[currentIndex()].takeAt(index[i]); if(fileRemove) { QFile::remove(song.getMusicPath()); } } if(currentIndex() == m_currentIndexs) { emit deleteItemAt(index); } }
void MusicSongsListItemInfoWidget::setMusicSongInformation(MusicSong &info) { QString musicArt = info.getMusicArtistFront(); QFontMetrics str(font()); ui->songNameValue->setText( info.getMusicName().isEmpty() ? "-" : str.elidedText( info.getMusicName(), Qt::ElideRight, ui->songNameValue->width()) ); ui->artlistValue->setText( musicArt.isEmpty() ? "-" : str.elidedText( musicArt, Qt::ElideRight, ui->artlistValue->width()) ); ui->sizeValue->setText( str.elidedText( QString::number(MusicTime::fileSizeByte2MByte( info.getMusicSize())).left(4) + "M", Qt::ElideRight, ui->sizeValue->width()) ); ui->typeValue->setText( info.getMusicType().isEmpty() ? "-" : str.elidedText( info.getMusicType(), Qt::ElideRight, ui->typeValue->width()) ); ui->timeValue->setText( str.elidedText( QString::number(info.getMusicPlayCount()), Qt::ElideRight, ui->timeValue->width()) ); if(!showArtPicture(musicArt) && !showArtPicture(info.getMusicArtistBack())) { ui->artPicture->setPixmap(QPixmap(":/share/defaultArt").scaled(60, 60)); } }
foreach(MusicSong song, musics[2]) { writeDomElementMutilText(netFilePath, "value", QStringList() << "name" << "playCount" << "time", QList<QVariant>() << song.getMusicName() << song.getMusicPlayCount() << song.getMusicTime(), song.getMusicPath()); }
bool MusicSong::operator== (const MusicSong &other) const { return m_musicPath == other.getMusicPath(); }