MCPcopy Create free account
hub / github.com/baumgarr/nixnote2 / getThemeNamesFromFile

Method getThemeNamesFromFile

global.cpp:1020–1041  ·  view source on GitHub ↗

Get themes contained in a given file

Source from the content-addressed store, hash-verified

1018
1019// Get themes contained in a given file
1020void Global::getThemeNamesFromFile(QFile &file, QStringList &values) {
1021 if (!file.exists())
1022 return;
1023 if(!file.open(QIODevice::ReadOnly))
1024 return;
1025
1026 QTextStream in(&file);
1027 while(!in.atEnd()) {
1028 QString line = in.readLine().simplified();
1029 if (line.startsWith("[")) {
1030 QString name = line.mid(1);
1031 name.chop(1);
1032 if (name.simplified() != "") {
1033 if (!values.contains(name, Qt::CaseInsensitive)) {
1034 values.append(name);
1035 }
1036 }
1037 }
1038 }
1039
1040 file.close();
1041}
1042
1043
1044// Get the full path of a resource in a theme file

Callers 1

getThemeNamesMethod · 0.95

Calls 3

openMethod · 0.80
existsMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected