126 |
126 |
127 // themes without icon are supposed to be hidden |
127 // themes without icon are supposed to be hidden |
128 QString iconpath = QString("physfs://Themes/%1/icon.png").arg(theme); |
128 QString iconpath = QString("physfs://Themes/%1/icon.png").arg(theme); |
129 |
129 |
130 if (!QFile::exists(iconpath)) |
130 if (!QFile::exists(iconpath)) |
|
131 { |
131 dataset.insert(IsHiddenRole, true); |
132 dataset.insert(IsHiddenRole, true); |
|
133 } |
|
134 else |
|
135 { |
|
136 // themes with the key “hidden” in theme.cfg are hidden, too |
|
137 QFile themeCfgFile(QString("physfs://Themes/%1/theme.cfg").arg(theme)); |
|
138 if (themeCfgFile.open(QFile::ReadOnly)) |
|
139 { |
|
140 QTextStream stream(&themeCfgFile); |
|
141 QString line = stream.readLine(); |
|
142 QString key; |
|
143 while (!line.isNull()) |
|
144 { |
|
145 key = QString(line); |
|
146 int equalsPos = line.indexOf('='); |
|
147 key.truncate(equalsPos - 1); |
|
148 key = key.simplified(); |
|
149 if (!line.startsWith(';') && key == "hidden") |
|
150 { |
|
151 dataset.insert(IsHiddenRole, true); |
|
152 break; |
|
153 } |
|
154 line = stream.readLine(); |
|
155 } |
|
156 } |
|
157 } |
132 |
158 |
133 // detect if theme is dlc |
159 // detect if theme is dlc |
134 QString themeDir = PHYSFS_getRealDir(QString("Themes/%1").arg(theme).toLocal8Bit().data()); |
160 QString themeDir = PHYSFS_getRealDir(QString("Themes/%1").arg(theme).toLocal8Bit().data()); |
135 bool isDLC = !themeDir.startsWith(datadir->absolutePath()); |
161 bool isDLC = !themeDir.startsWith(datadir->absolutePath()); |
136 dataset.insert(IsDlcRole, isDLC); |
162 dataset.insert(IsDlcRole, isDLC); |