void MainWindow::on_tableWidget_cellChanged(int row, int column)
{  
    if (flag) {
        QTableWidgetItem* item = ui->tableWidget->item(row, column);

        switch (row) {
        case 0:
            ID3_AddTitle(&myTag, item->text().toStdString().c_str(), true);
            break;
        case 1:
            ID3_AddArtist(&myTag, item->text().toStdString().c_str(), true);
            break;
        case 2:
            ID3_AddAlbum(&myTag, item->text().toStdString().c_str(), true);
            break;
        case 3:
            ID3_AddYear(&myTag, item->text().toStdString().c_str(), true);
            break;
        case 4:
            ID3_AddGenre(&myTag, item->text().toStdString().c_str(), true);
            break;
        }

    }
}
Exemple #2
0
ID3_Frame* ID3_AddGenre(ID3_Tag *tag, size_t genreNum, bool replace)
{
  if(0xFF != genreNum)
  {
    char sGenre[6];
    sprintf(sGenre, "(%lu)", (luint) genreNum);
    return(ID3_AddGenre(tag, sGenre, replace));
  }
  else
  {
    return(NULL);
  }
}
Exemple #3
0
// returns buffer len; caller frees
int Tags::ExportID3(char **buffer, bool *endOfFile)
{
#ifdef USE_ID3LIB
    ID3_Tag tag;

    ID3_AddTitle(&tag, (const char *)mTitle);
    ID3_AddArtist(&tag, (const char *)mArtist);
    ID3_AddAlbum(&tag, (const char *)mAlbum);
    if (mTrackNum >=0 && mTrackNum<=255)
        ID3_AddTrack(&tag, (uchar)mTrackNum);
    ID3_AddGenre(&tag, mGenre);
    ID3_AddComment(&tag, (const char *)mComments, STR_V1_COMMENT_DESC);
    ID3_AddYear(&tag, (const char *)mYear);

    if (mID3V2) {
        int tagSize = tag.Size();
        *buffer = new char[tagSize];
        tag.Render((uchar *)*buffer, ID3TT_ID3V2);
        *endOfFile = false;
        return tagSize;
    }
    else {
        *buffer = new char[128];
        for(int i=0; i<128; i++)
            (*buffer)[i] = 0;
        tag.Render((uchar *)*buffer, ID3TT_ID3V1);
        *endOfFile = true;
        return 128;
    }

#else
    *buffer = new char[0];
    *endOfFile = true;
    return 0;
#endif // USE_ID3LIB
}