740
* Create dialog to edit the selected frame and update the fields if Ok is
746
* Create dialog to edit a frame and update the fields if Ok is
749
* @param frame frame to edit
743
751
* @return TRUE if Ok selected in dialog.
746
bool Mp3FrameList::editFrame(void)
753
bool Mp3FrameList::editFrame(ID3_Frame* frame)
748
755
bool result = FALSE;
749
ID3_Frame *frame = getSelectedFrame();
751
ID3_Frame::Iterator* iter = frame->CreateIterator();
753
while ((field = iter->GetNext()) != NULL) {
754
ID3_FieldID id = field->GetID();
755
ID3_FieldType type = field->GetType();
756
if (type == ID3FTY_INTEGER) {
757
if (id == ID3FN_TEXTENC) {
758
static const char *strlst[] = {
759
I18N_NOOP("ISO-8859-1"),
760
I18N_NOOP("Unicode"),
761
I18N_NOOP("UTF16BE"),
765
IntComboBoxControl *cbox =
766
new IntComboBoxControl(this, id, field, strlst);
768
fieldcontrols.append(cbox);
771
else if (id == ID3FN_PICTURETYPE) {
772
static const char *strlst[] = {
774
I18N_NOOP("32x32 pixels PNG file icon"),
775
I18N_NOOP("Other file icon"),
776
I18N_NOOP("Cover (front)"),
777
I18N_NOOP("Cover (back)"),
778
I18N_NOOP("Leaflet page"),
780
I18N_NOOP("Lead artist/lead performer/soloist"),
781
I18N_NOOP("Artist/performer"),
782
I18N_NOOP("Conductor"),
783
I18N_NOOP("Band/Orchestra"),
784
I18N_NOOP("Composer"),
785
I18N_NOOP("Lyricist/text writer"),
786
I18N_NOOP("Recording Location"),
787
I18N_NOOP("During recording"),
788
I18N_NOOP("During performance"),
789
I18N_NOOP("Movie/video screen capture"),
790
I18N_NOOP("A bright coloured fish"),
791
I18N_NOOP("Illustration"),
792
I18N_NOOP("Band/artist logotype"),
793
I18N_NOOP("Publisher/Studio logotype"),
796
IntComboBoxControl *cbox =
797
new IntComboBoxControl(this, id, field, strlst);
799
fieldcontrols.append(cbox);
802
else if (id == ID3FN_TIMESTAMPFORMAT) {
803
static const char *strlst[] = {
805
I18N_NOOP("MPEG frames as unit"),
806
I18N_NOOP("Milliseconds as unit"),
809
IntComboBoxControl *cbox =
810
new IntComboBoxControl(this, id, field, strlst);
812
fieldcontrols.append(cbox);
815
else if (id == ID3FN_CONTENTTYPE) {
816
static const char *strlst[] = {
819
I18N_NOOP("Text transcription"),
820
I18N_NOOP("Movement/part name"),
823
I18N_NOOP("Trivia/pop up"),
826
IntComboBoxControl *cbox =
827
new IntComboBoxControl(this, id, field, strlst);
829
fieldcontrols.append(cbox);
833
IntFieldControl *intctl =
834
new IntFieldControl(this, id, field);
836
fieldcontrols.append(intctl);
840
else if (type == ID3FTY_BINARY) {
841
BinFieldControl *binctl =
842
new BinFieldControl(this, id, field);
844
fieldcontrols.append(binctl);
847
else if (type == ID3FTY_TEXTSTRING) {
848
ID3_TextEnc enc = field->GetEncoding();
849
if (id == ID3FN_TEXT ||
756
ID3_Frame::Iterator* iter = frame->CreateIterator();
758
while ((field = iter->GetNext()) != NULL) {
759
ID3_FieldID id = field->GetID();
760
ID3_FieldType type = field->GetType();
761
if (type == ID3FTY_INTEGER) {
762
if (id == ID3FN_TEXTENC) {
763
static const char *strlst[] = {
764
I18N_NOOP("ISO-8859-1"),
765
I18N_NOOP("Unicode"),
766
I18N_NOOP("UTF16BE"),
770
IntComboBoxControl *cbox =
771
new IntComboBoxControl(this, id, field, strlst);
773
fieldcontrols.append(cbox);
776
else if (id == ID3FN_PICTURETYPE) {
777
static const char *strlst[] = {
779
I18N_NOOP("32x32 pixels PNG file icon"),
780
I18N_NOOP("Other file icon"),
781
I18N_NOOP("Cover (front)"),
782
I18N_NOOP("Cover (back)"),
783
I18N_NOOP("Leaflet page"),
785
I18N_NOOP("Lead artist/lead performer/soloist"),
786
I18N_NOOP("Artist/performer"),
787
I18N_NOOP("Conductor"),
788
I18N_NOOP("Band/Orchestra"),
789
I18N_NOOP("Composer"),
790
I18N_NOOP("Lyricist/text writer"),
791
I18N_NOOP("Recording Location"),
792
I18N_NOOP("During recording"),
793
I18N_NOOP("During performance"),
794
I18N_NOOP("Movie/video screen capture"),
795
I18N_NOOP("A bright coloured fish"),
796
I18N_NOOP("Illustration"),
797
I18N_NOOP("Band/artist logotype"),
798
I18N_NOOP("Publisher/Studio logotype"),
801
IntComboBoxControl *cbox =
802
new IntComboBoxControl(this, id, field, strlst);
804
fieldcontrols.append(cbox);
807
else if (id == ID3FN_TIMESTAMPFORMAT) {
808
static const char *strlst[] = {
810
I18N_NOOP("MPEG frames as unit"),
811
I18N_NOOP("Milliseconds as unit"),
814
IntComboBoxControl *cbox =
815
new IntComboBoxControl(this, id, field, strlst);
817
fieldcontrols.append(cbox);
820
else if (id == ID3FN_CONTENTTYPE) {
821
static const char *strlst[] = {
824
I18N_NOOP("Text transcription"),
825
I18N_NOOP("Movement/part name"),
828
I18N_NOOP("Trivia/pop up"),
831
IntComboBoxControl *cbox =
832
new IntComboBoxControl(this, id, field, strlst);
834
fieldcontrols.append(cbox);
838
IntFieldControl *intctl =
839
new IntFieldControl(this, id, field);
841
fieldcontrols.append(intctl);
845
else if (type == ID3FTY_BINARY) {
846
BinFieldControl *binctl =
847
new BinFieldControl(this, id, field);
849
fieldcontrols.append(binctl);
852
else if (type == ID3FTY_TEXTSTRING) {
853
ID3_TextEnc enc = field->GetEncoding();
854
if (id == ID3FN_TEXT ||
850
855
// (ID3TE_IS_DOUBLE_BYTE_ENC(enc))
851
856
enc == ID3TE_UTF16 || enc == ID3TE_UTF16BE) {
852
// Large textedit for text fields
853
TextFieldControl *textctl =
854
new TextFieldControl(this, id, field);
856
fieldcontrols.append(textctl);
857
// Large textedit for text fields
858
TextFieldControl *textctl =
859
new TextFieldControl(this, id, field);
861
fieldcontrols.append(textctl);
860
LineFieldControl *textctl =
861
new LineFieldControl(this, id, field);
863
fieldcontrols.append(textctl);
865
LineFieldControl *textctl =
866
new LineFieldControl(this, id, field);
868
fieldcontrols.append(textctl);
869
/* allocated in Windows DLL => must be freed in the same DLL */
870
ID3TagIterator_Delete(reinterpret_cast<ID3TagIterator*>(iter));
874
/* allocated in Windows DLL => must be freed in the same DLL */
875
ID3TagIterator_Delete(reinterpret_cast<ID3TagIterator*>(iter));
874
const char *idstr = getIdString(frame->GetID());
875
QString caption = idstr ? i18n(idstr) : QString(frame->GetTextID());
876
EditMp3FrameDialog *dialog =
877
new EditMp3FrameDialog(NULL, caption, fieldcontrols);
878
if (dialog && dialog->exec() == QDialog::Accepted) {
879
FieldControl *fld_ctl = fieldcontrols.first();
880
// will be set if there is an encoding selector
881
setSelectedEncoding(ID3TE_NONE);
882
while (fld_ctl != NULL) {
883
fld_ctl->updateTag();
884
fld_ctl = fieldcontrols.next();
887
m_file->changedV2 = TRUE;
891
fieldcontrols.clear();
879
const char *idstr = getIdString(frame->GetID());
880
QString caption = idstr ? i18n(idstr) : QString(frame->GetTextID());
881
EditMp3FrameDialog *dialog =
882
new EditMp3FrameDialog(NULL, caption, fieldcontrols);
883
if (dialog && dialog->exec() == QDialog::Accepted) {
884
FieldControl *fld_ctl = fieldcontrols.first();
885
// will be set if there is an encoding selector
886
setSelectedEncoding(ID3TE_NONE);
887
while (fld_ctl != NULL) {
888
fld_ctl->updateTag();
889
fld_ctl = fieldcontrols.next();
892
m_file->changedV2 = TRUE;
896
fieldcontrols.clear();
901
* Create dialog to edit the selected frame and update the fields if Ok is
904
* @return TRUE if Ok selected in dialog.
907
bool Mp3FrameList::editFrame(void)
909
ID3_Frame* frame = getSelectedFrame();
911
return editFrame(frame);
897
917
* Delete selected frame.
899
919
* @return FALSE if frame not found.