66 const QString filePath = configFilePath();
67 if ( !QFile::exists( filePath ) )
70 QFile file( filePath );
71 if ( !file.open( QIODevice::ReadOnly ) )
74 QTextStream in( &file );
75 const QString originalFileContent = in.readAll();
78 const QStringList lines = originalFileContent.split(
'\n' );
79 for (
const QString &line : lines )
81 const QStringList lineParts = line.split(
'|' );
82 if ( lineParts.size() < 3 )
85 const QString algorithmId = lineParts.at( 0 );
86 const QString outputName = lineParts.at( 1 );
87 if ( algorithmId.isEmpty() || outputName.isEmpty() )
90 const QString qmlFilePath = lineParts.mid( 2 ).join(
'|' );
92 mStyles[algorithmId][outputName] = qmlFilePath;
98 const QString filePath = configFilePath();
100 QFile file( filePath );
101 if ( !file.open( QIODevice::WriteOnly | QIODevice::Truncate ) )
107 QTextStream out( &file );
108 for (
auto algIt = mStyles.constBegin(); algIt != mStyles.constEnd(); ++algIt )
110 for (
auto outputIt = algIt->constBegin(); outputIt != algIt->constEnd(); ++outputIt )
112 out << algIt.key() <<
'|' << outputIt.key() <<
'|' << outputIt.value() <<
"\n";