MCPcopy Create free account
hub / github.com/cpvrlab/ImagePlay / readProcessFile

Method readProcessFile

ImagePlay/src/MainWindow.cpp:731–882  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

729}
730
731bool MainWindow::readProcessFile()
732{
733 _isPlaying = false;
734 _timer->stop();
735
736 QString errorString;
737
738 QString fileName = _currentProcessFileName;
739
740 if(fileName.length() < 1)
741 {
742 fileName = _pluginPath + "/_autosave.ipj";
743 }
744
745 // read json file
746 QFile file(fileName);
747
748 if(!file.open(QIODevice::ReadOnly | QIODevice::Text))
749 return false;
750
751 QString fileContents;
752 QTextStream in(&file);
753 while (!in.atEnd()) {
754 QString line = in.readLine();
755 fileContents.append(line);
756 }
757 file.close();
758
759 // clear current process
760 _allowChangeActiveProcessStep = false;
761
762 clearScene();
763
764 // parse file and create process
765 QJsonParseError error;
766 QJsonDocument document = QJsonDocument::fromJson(fileContents.toLatin1(), &error);
767 qWarning() << error.errorString();
768
769 QJsonObject root = document.object();
770
771 QMap<long, long> stepIdMap;
772
773 QJsonArray steps = root.value("steps").toArray();
774 for(auto it = steps.begin(); it != steps.end(); ++it)
775 {
776 QJsonObject stepObject = (*it).toObject();
777
778 long ID = stepObject.value("ID").toDouble();
779 int posX = stepObject.value("posX").toDouble();
780 int posY = stepObject.value("posY").toDouble();
781 QString type = stepObject.value("type").toString();
782
783 IPProcessStep* newStep = new IPProcessStep(this, type);
784 newStep->setPos(QPointF(posX, posY));
785
786 // check if valid
787 if(!newStep->process())
788 {

Callers 1

dropEventMethod · 0.80

Calls 14

stopMethod · 0.80
lengthMethod · 0.80
propertyMethod · 0.80
deserializeMethod · 0.80
stepIDMethod · 0.80
stepsMethod · 0.80
startMethod · 0.80
valueMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
toStringMethod · 0.45
processMethod · 0.45

Tested by

no test coverage detected