示例#1
0
void EncoderLame::fillSongInfo( KCDDB::CDInfo info, int track, const QString &comment ){
	trackInfo.clear();
	trackInfo.append("--tt");
	trackInfo.append(info.track(track-1).get(Title).toString());

	trackInfo.append("--ta");
	trackInfo.append(info.track(track-1).get(Artist).toString());

	trackInfo.append("--tl");
	trackInfo.append(info.get(Title).toString());

	trackInfo.append("--ty");
	trackInfo.append(QString("%1").arg(info.get(Year).toString()));

	trackInfo.append("--tc");
	trackInfo.append(comment);

	trackInfo.append("--tn");
	trackInfo.append(QString("%1").arg(track));

	const QString genre = info.get(Genre).toString();
	if ( d->genreList.indexOf( genre ) != -1 )
	{
	trackInfo.append("--tg");
		trackInfo.append(genre);
	}
}
示例#2
0
  void CDInfoDialog::setInfo( const KCDDB::CDInfo &info, const KCDDB::TrackOffsetList &trackStartFrames )
  {
      d->info = info;

      d->ui->m_artist->setText(info.get(Artist).toString().trimmed());
      d->ui->m_title->setText(info.get(Title).toString().trimmed());
      d->ui->m_category->setItemText(d->ui->m_category->currentIndex(), d->categories.cddb2i18n(info.get(Category).toString()));

      // Make sure the revision is set before the genre to allow the genreChanged() handler to fire.
      d->ui->m_revision->setText(QString::number(info.get(QLatin1String( "revision" )).toInt()));
      d->ui->m_genre->setItemText(d->ui->m_genre->currentIndex(), d->genres.cddb2i18n(info.get(Genre).toString()));
      d->ui->m_year->setValue(info.get(Year).toInt());
      d->ui->m_comment->setText(info.get(Comment).toString().trimmed());
      d->ui->m_id->setText(info.get(QLatin1String( "discid" )).toString().trimmed());

      // Now do the individual tracks.
      unsigned tracks = info.numberOfTracks();
      if (tracks > 0)
      {
         d->ui->m_length->setText(framesTime(trackStartFrames[tracks] - trackStartFrames[0]));
      }

      m_trackModel->clear();
      QStringList labels;
      labels << i18n("Track") << i18n("Length") << i18n("Title") << i18n("Artist") << i18n("Comment");
      m_trackModel->setHorizontalHeaderLabels(labels);
      for (unsigned i = 0; i < tracks; i++) {
          QList<QStandardItem *> trackItems = QList<QStandardItem *>();
          TrackInfo ti(info.track(i));
          QStandardItem *trackNumberItem = new QStandardItem(QString().sprintf("%02d", i + 1));
		  trackNumberItem->setEditable(false);
          trackItems << trackNumberItem;
          QStandardItem *trackLengthItem = new QStandardItem(framesTime(trackStartFrames[i + 1] - trackStartFrames[i]));
		  trackLengthItem->setEditable(false);
          trackItems << trackLengthItem;
          QStandardItem *trackTitleItem = new QStandardItem(ti.get(Title).toString());
          trackItems << trackTitleItem;
          QStandardItem *trackArtistItem = new QStandardItem(ti.get(Artist).toString());
          trackItems << trackArtistItem;
          QStandardItem *trackCommentItem = new QStandardItem(ti.get(Comment).toString());
          trackItems << trackCommentItem;

          m_trackModel->appendRow(trackItems);
      }
      // FIXME KDE4: handle playorder here too, once KCDDBInfo::CDInfo is updated.

      if (info.get(Artist).toString() == QLatin1String( "Various" ) || d->ui->m_multiple->isChecked()){
          d->ui->m_trackList->resizeColumnToContents(Private::TRACK_ARTIST);
    }
  }
示例#3
0
  KCDDB::CDInfo CDInfoDialog::info() const
  {
      KCDDB::CDInfo info = d->info;

      info.set(Artist, d->ui->m_artist->text().trimmed());
      info.set(Title, d->ui->m_title->text().trimmed());
      info.set(Category, d->categories.i18n2cddb(d->ui->m_category->currentText()));
      info.set(Genre, d->genres.i18n2cddb(d->ui->m_genre->currentText()));
      info.set(Year, d->ui->m_year->value());
      info.set(Comment, d->ui->m_comment->text().trimmed());
      info.set(QLatin1String( "revision" ), d->ui->m_revision->text().trimmed().toUInt());
      info.set(QLatin1String( "discid" ), d->ui->m_id->text().trimmed());

    for (int t = 0; t < m_trackModel->rowCount(); ++t) {
          TrackInfo& track = info.track(t);
          track.set(Artist, m_trackModel->index(t, Private::TRACK_ARTIST).data().toString().trimmed());
          track.set(Title, m_trackModel->index(t, Private::TRACK_TITLE).data().toString().trimmed());
          track.set(Comment, m_trackModel->index(t, Private::TRACK_COMMENT).data().toString().trimmed());
          // FIXME KDE4: handle track lengths here too, once KCDDBInfo::CDInfo is updated.
      }
      // FIXME KDE4: handle playorder here too, once KCDDBInfo::CDInfo is updated.
      return info;
  }