MCPcopy Create free account
hub / github.com/CE-Programming/CEmu / stringToView

Method stringToView

gui/qt/visualizerwidget.cpp:198–276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

196}
197
198void VisualizerWidget::stringToView() {
199 QStringList string = m_config->text().split(',');
200 QRegularExpression hex_reg("^[0-9A-F]{6}$", QRegularExpression::CaseInsensitiveOption);
201 QRegularExpression bpp_reg("^\\d{1,6}bpp$", QRegularExpression::CaseInsensitiveOption);
202 QRegularExpression fps_reg("^\\d+fps$", QRegularExpression::CaseInsensitiveOption);
203
204 m_fps = 30;
205 m_scale = 100;
206 m_grid = false;
207
208 set_reset(false, 0x400u, m_control);
209 set_reset(false, 0x200u, m_control);
210 set_reset(false, 0x100u, m_control);
211
212 foreach (QString str, string) {
213 str = str.toLower();
214 if (!str.compare(QLatin1String("grid"), Qt::CaseInsensitive)) {
215 m_grid = true;
216 }
217 if (!str.compare(QLatin1String("bepo"), Qt::CaseInsensitive)) {
218 set_reset(true, 0x400u, m_control);
219 }
220 if (!str.compare(QLatin1String("bebo"), Qt::CaseInsensitive)) {
221 set_reset(true, 0x200u, m_control);
222 }
223 if (!str.compare(QLatin1String("bgr"), Qt::CaseInsensitive)) {
224 set_reset(true, 0x100u, m_control);
225 }
226 if (str.contains('x')) {
227 QStringList wh = str.split('x');
228 if (wh.size() == 2) {
229 m_width = wh.at(0).toInt();
230 m_height = wh.at(1).toInt();
231 }
232 }
233 if (str.endsWith('%')) {
234 str.remove('%');
235 m_scale = str.toInt();
236 if (m_scale > 5000) {
237 m_scale = 5000;
238 }
239 }
240 if (str.length() == 8 && str.at(0) == '0' && str.at(1) == 'x') {
241 str.remove(0, 2);
242 }
243 if (str.length() == 7 && str.at(0) == '$') {
244 str.remove(0, 1);
245 }
246 if (hex_reg.match(str).hasMatch()) {
247 m_base = str.toUInt(Q_NULLPTR, 16);
248 }
249 if (bpp_reg.match(str).hasMatch()) {
250 str.chop(3);
251 uint8_t bpp;
252 switch (str.toUInt()) {
253 case 1: bpp = 0; break;
254 case 2: bpp = 1; break;
255 case 4: bpp = 2; break;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected