| 4873 | } |
| 4874 | |
| 4875 | void ShaderViewer::updateWatchVariables() |
| 4876 | { |
| 4877 | QSignalBlocker block(ui->watch); |
| 4878 | |
| 4879 | RDTreeViewExpansionState expansion; |
| 4880 | ui->watch->saveExpansion(expansion, 0); |
| 4881 | |
| 4882 | ui->watch->beginUpdate(); |
| 4883 | |
| 4884 | for(int i = 0; i < ui->watch->topLevelItemCount() - 1; i++) |
| 4885 | { |
| 4886 | RDTreeWidgetItem *item = ui->watch->topLevelItem(i); |
| 4887 | |
| 4888 | QString expr = item->text(0).trimmed(); |
| 4889 | |
| 4890 | QRegularExpression exprRE( |
| 4891 | lit("^" // beginning of the line |
| 4892 | "([^,]+)" // variable path |
| 4893 | "(,[iduxbocf])?" // optional typecast |
| 4894 | "$")); // end of the line |
| 4895 | |
| 4896 | QRegularExpressionMatch match = exprRE.match(expr); |
| 4897 | |
| 4898 | QString error = tr("Error evaluating expression"); |
| 4899 | |
| 4900 | if(match.hasMatch()) |
| 4901 | { |
| 4902 | QString path = match.captured(1); |
| 4903 | QChar regcast = QLatin1Char(' '); |
| 4904 | if(!match.captured(2).isEmpty()) |
| 4905 | regcast = match.captured(2)[1]; |
| 4906 | |
| 4907 | SourceVariableMapping mapping; |
| 4908 | ShaderVariable var; |
| 4909 | uint32_t swizzle = ~0U; |
| 4910 | const RDTreeWidgetItem *varItem = getVarFromPath(path, &var, &swizzle, &mapping); |
| 4911 | if(varItem) |
| 4912 | { |
| 4913 | if(updateWatchVariable(item, varItem, path, swizzle, mapping, var, regcast)) |
| 4914 | continue; |
| 4915 | |
| 4916 | error = tr("Couldn't evaluate watch for '%1'").arg(expr); |
| 4917 | } |
| 4918 | else if(item->childCount()) |
| 4919 | { |
| 4920 | markWatchStale(item); |
| 4921 | continue; |
| 4922 | } |
| 4923 | else |
| 4924 | { |
| 4925 | error = tr("Couldn't find variable for '%1'").arg(path); |
| 4926 | } |
| 4927 | } |
| 4928 | |
| 4929 | // if we got here, something went wrong. |
| 4930 | VariableTag tag; |
| 4931 | item->setItalic(false); |
| 4932 | item->setText(1, QString()); |
nothing calls this directly
no test coverage detected