//--------------------------------------------------------------------------- void GUI_Main_Core_Table::contextMenuEvent (QContextMenuEvent* Event) { //Retrieving data QTableWidgetItem* Item=itemAt(Event->pos()); if (Item==NULL) return; string FileName=FileName_Before+item(Item->row(), 0)->text().toLocal8Bit().data(); string Field=horizontalHeaderItem(Item->column())->text().toLocal8Bit().data(); ZtringList History; History.Write(C->History(FileName, Field)); Ztring Date; if (Field=="OriginationDate" || Field=="OriginationTime" || Field=="ICRD") { Date=C->FileDate_Get(FileName); if (Date.size()>=10+1+8) { if (Date.size()>=10+1+8) Date.resize(10+1+8); if (Field=="ICRD") Date.insert(0, "&Set ICRD to file creation timestamp ("); //If you change this, change at the end of method too else Date.insert(0, "&Set originationDate and Time to file creation timestamp ("); //If you change this, change at the end of method too Date.append(")"); } else Date.clear(); } //Creating menu QMenu menu(this); //Handling AllFiles display { menu.addAction(new QAction("Fill all open files with this field value", this)); //If you change this, change the test text too menu.addSeparator(); } //Handling Clear display if (!item(Item->row(), Item->column())->text().isEmpty() && C->IsValid(FileName, Field, string())) { menu.addAction(new QAction("Clear this value", this)); //If you change this, change the test text too menu.addSeparator(); } //Handling date display if (!Date.empty()) { menu.addAction(new QAction(QString().fromUtf8(Date.To_Local().c_str()), this)); menu.addSeparator(); } //Handling history display size_t Pos=History.size(); if (!History.empty()) do { Pos--; QString Text=QString().fromUtf8(History[Pos].To_Local().c_str()); if (!Text.isEmpty()) { QAction* Action=new QAction(Text, this); menu.addAction(Action); } } while (Pos>0); //Displaying QAction* Action=menu.exec(Event->globalPos()); if (Action==NULL) return; //Retrieving data QString Text=Action->text(); //Special cases if (Text=="Fill all open files with this field value") //If you change this, change the creation text too { for (int Row=0; Row<rowCount(); Row++) { item(Row, Item->column())->setText(QString().fromUtf8(Ztring(C->Get(FileName, Field)).To_Local().c_str())); dataChanged(indexFromItem(item(Row, Item->column())), indexFromItem(item(Row, Item->column()))); //Special cases if (Field=="UMID" || Field=="LoudnessValue" || Field=="LoudnessRange" || Field=="MaxTruePeakLevel" || Field=="MaxMomentaryLoudness" || Field=="MaxShortTermLoudness") { //Changing BextVersion Enabled value SetText (*Item, "BextVersion"); SetEnabled(*Item, "BextVersion"); } } return; } if (Text=="Clear this value") //If you change this, change the creation text too Text.clear(); //Filling if (Text.contains("&Set ")) //If you change this, change the creation text too { Text=Text.remove("&Set ICRD to file creation timestamp ("); //If you change this, change the creation text too Text=Text.remove("&Set originationDate and Time to file creation timestamp ("); //If you change this, change the creation text too Text=Text.remove(")"); //If you change this, change the creation text too if (horizontalHeaderItem(Item->column())->text()==QString().fromUtf8("ICRD")) { item(Item->row(), Item->column())->setText(Text); dataChanged(indexFromItem(item(Item->row(), Item->column())), indexFromItem(item(Item->row(), Item->column()))); } else { QString Date=Text; Date.remove(10, 1+12); QString Time=Text; Time.remove(0, 10+1); Time.remove(8, 4); int Date_Pos=Item->column()+(horizontalHeaderItem(Item->column())->text()==QString().fromUtf8("OriginationDate")?0:-1); int Time_Pos=Item->column()+(horizontalHeaderItem(Item->column())->text()==QString().fromUtf8("OriginationTime")?0:1); item(Item->row(), Date_Pos)->setText(Date); dataChanged(indexFromItem(item(Item->row(), Date_Pos)), indexFromItem(item(Item->row(), Date_Pos))); item(Item->row(), Time_Pos)->setText(Time); dataChanged(indexFromItem(item(Item->row(), Time_Pos)), indexFromItem(item(Item->row(), Time_Pos))); } } else { item(Item->row(), Item->column())->setText(Text); dataChanged(indexFromItem(item(Item->row(), Item->column())), indexFromItem(item(Item->row(), Item->column()))); } //Menu Main->Menu_Update(); }
//--------------------------------------------------------------------------- bool File_DcpCpl::FileHeader_Begin() { XMLDocument document; if (!FileHeader_Begin_XML(document)) return false; bool IsDcp=false, IsImf=false; XMLElement* Root=document.FirstChildElement("CompositionPlaylist"); if (!Root) { Reject("DcpCpl"); return false; } const char* Attribute=Root->Attribute("xmlns"); if (!Attribute) { Reject("DcpCpl"); return false; } if (!strcmp(Attribute, "http://www.digicine.com/PROTO-ASDCP-CPL-20040511#")) IsDcp=true; if (!strcmp(Attribute, "http://www.smpte-ra.org/schemas/2067-3/XXXX") //Some muxers use XXXX instead of year || !strcmp(Attribute, "http://www.smpte-ra.org/schemas/2067-3/2013")) IsImf=true; if (!IsDcp && !IsImf) { Reject("DcpCpl"); return false; } Accept("DcpCpl"); Fill(Stream_General, 0, General_Format, IsDcp?"DCP CPL":"IMF CPL"); Config->File_ID_OnlyRoot_Set(false); ReferenceFiles=new File__ReferenceFilesHelper(this, Config); //Parsing main elements for (XMLElement* Root_Item=Root->FirstChildElement(); Root_Item; Root_Item=Root_Item->NextSiblingElement()) { //ReelList / SegmentList if ((IsDcp && !strcmp(Root_Item->Value(), "ReelList")) || (IsImf && !strcmp(Root_Item->Value(), "SegmentList"))) { for (XMLElement* ReelList_Item=Root_Item->FirstChildElement(); ReelList_Item; ReelList_Item=ReelList_Item->NextSiblingElement()) { //Reel if ((IsDcp && !strcmp(ReelList_Item->Value(), "Reel")) || (IsImf && !strcmp(ReelList_Item->Value(), "Segment"))) { for (XMLElement* Reel_Item=ReelList_Item->FirstChildElement(); Reel_Item; Reel_Item=Reel_Item->NextSiblingElement()) { //AssetList if ((IsDcp && !strcmp(Reel_Item->Value(), "AssetList")) || (IsImf && !strcmp(Reel_Item->Value(), "SequenceList"))) { for (XMLElement* AssetList_Item=Reel_Item->FirstChildElement(); AssetList_Item; AssetList_Item=AssetList_Item->NextSiblingElement()) { //File //if ((IsDcp && (!strcmp(AssetList_Item->Value(), "MainPicture") || !strcmp(AssetList_Item->Value(), "MainSound"))) // || (IsImf && (!strcmp(AssetList_Item->Value(), "cc:MainImageSequence") || !strcmp(AssetList_Item->Value(), "cc:MainImage")))) { File__ReferenceFilesHelper::reference ReferenceFile; Ztring Asset_Id; if ((IsDcp && !strcmp(AssetList_Item->Value(), "MainPicture")) || (IsImf && !strcmp(AssetList_Item->Value(), "cc:MainImageSequence"))) ReferenceFile.StreamKind=Stream_Video; if ((IsDcp && !strcmp(AssetList_Item->Value(), "MainSound")) || (IsImf && !strcmp(AssetList_Item->Value(), "cc:MainAudioSequence"))) ReferenceFile.StreamKind=Stream_Audio; for (XMLElement* File_Item=AssetList_Item->FirstChildElement(); File_Item; File_Item=File_Item->NextSiblingElement()) { //Id if (!strcmp(File_Item->Value(), "Id") && Asset_Id.empty()) Asset_Id.From_UTF8(File_Item->GetText()); //ResourceList if (IsImf && !strcmp(File_Item->Value(), "ResourceList")) { for (XMLElement* ResourceList_Item=File_Item->FirstChildElement(); ResourceList_Item; ResourceList_Item=ResourceList_Item->NextSiblingElement()) { //Resource if (!strcmp(ResourceList_Item->Value(), "Resource")) { Ztring Resource_Id; File__ReferenceFilesHelper::reference::completeduration Resource; for (XMLElement* Resource_Item=ResourceList_Item->FirstChildElement(); Resource_Item; Resource_Item=Resource_Item->NextSiblingElement()) { //EditRate if (!strcmp(Resource_Item->Value(), "EditRate")) { const char* EditRate=Resource_Item->GetText(); Resource.IgnoreFramesRate=atof(EditRate); const char* EditRate2=strchr(EditRate, ' '); if (EditRate2!=NULL) { float64 EditRate2f=atof(EditRate2); if (EditRate2f) Resource.IgnoreFramesRate/=EditRate2f; } } //EntryPoint if (!strcmp(Resource_Item->Value(), "EntryPoint")) Resource.IgnoreFramesBefore=atoi(Resource_Item->GetText()); //Id if (!strcmp(File_Item->Value(), "Id") && Resource_Id.empty()) Resource_Id.From_UTF8(File_Item->GetText()); //SourceDuration if (!strcmp(Resource_Item->Value(), "SourceDuration")) Resource.IgnoreFramesAfterDuration=atoi(Resource_Item->GetText()); //TrackFileId if (!strcmp(Resource_Item->Value(), "TrackFileId")) Resource.FileName.From_UTF8(Resource_Item->GetText()); } if (Resource.FileName.empty()) Resource.FileName=Resource_Id; ReferenceFile.CompleteDuration.push_back(Resource); } } } } if (ReferenceFile.CompleteDuration.empty()) { File__ReferenceFilesHelper::reference::completeduration Resource; Resource.FileName=Asset_Id; ReferenceFile.CompleteDuration.push_back(Resource); } ReferenceFile.StreamID=ReferenceFiles->References.size()+1; ReferenceFiles->References.push_back(ReferenceFile); } } } } } } } } Element_Offset=File_Size; //Getting files names if (!Config->File_IsReferenced_Get()) { FileName Directory(File_Name); ZtringList List; if (IsImf) List=Dir::GetAllFileNames(Directory.Path_Get()+PathSeparator+__T("PKL_*.xml"), Dir::Include_Files); if (IsDcp || List.empty()) List=Dir::GetAllFileNames(Directory.Path_Get()+PathSeparator+__T("*_pkl.xml"), Dir::Include_Files); for (size_t Pos=0; Pos<List.size(); Pos++) { MediaInfo_Internal MI; MI.Option(__T("File_KeepInfo"), __T("1")); Ztring ParseSpeed_Save=MI.Option(__T("ParseSpeed_Get"), __T("")); Ztring Demux_Save=MI.Option(__T("Demux_Get"), __T("")); MI.Option(__T("ParseSpeed"), __T("0")); MI.Option(__T("Demux"), Ztring()); MI.Option(__T("File_IsReferenced"), __T("1")); size_t MiOpenResult=MI.Open(List[Pos]); MI.Option(__T("ParseSpeed"), ParseSpeed_Save); //This is a global value, need to reset it. TODO: local value MI.Option(__T("Demux"), Demux_Save); //This is a global value, need to reset it. TODO: local value if (MiOpenResult && ((IsDcp && MI.Get(Stream_General, 0, General_Format)==__T("DCP PKL")) || (IsImf && MI.Get(Stream_General, 0, General_Format)==__T("IMF PKL")))) { DcpCpl_MergeFromPkl(ReferenceFiles, ((File_DcpCpl*)MI.Info)->ReferenceFiles); } } } ReferenceFiles->FilesForStorage=true; //All should be OK... return true; }