| 162 | } |
| 163 | |
| 164 | void UEFITool::search() |
| 165 | { |
| 166 | if (searchDialog->exec() != QDialog::Accepted) |
| 167 | return; |
| 168 | |
| 169 | QModelIndex rootIndex = ffsEngine->treeModel()->index(0, 0); |
| 170 | |
| 171 | int index = searchDialog->ui->tabWidget->currentIndex(); |
| 172 | if (index == 0) { // Hex pattern |
| 173 | searchDialog->ui->hexEdit->setFocus(); |
| 174 | QByteArray pattern = searchDialog->ui->hexEdit->text().toLatin1().replace(" ", ""); |
| 175 | if (pattern.isEmpty()) |
| 176 | return; |
| 177 | UINT8 mode; |
| 178 | if (searchDialog->ui->hexScopeHeaderRadioButton->isChecked()) |
| 179 | mode = SEARCH_MODE_HEADER; |
| 180 | else if (searchDialog->ui->hexScopeBodyRadioButton->isChecked()) |
| 181 | mode = SEARCH_MODE_BODY; |
| 182 | else |
| 183 | mode = SEARCH_MODE_ALL; |
| 184 | ffsEngine->findHexPattern(rootIndex, pattern, mode); |
| 185 | showMessages(); |
| 186 | } |
| 187 | else if (index == 1) { // GUID |
| 188 | searchDialog->ui->guidEdit->setFocus(); |
| 189 | searchDialog->ui->guidEdit->setCursorPosition(0); |
| 190 | QByteArray pattern = searchDialog->ui->guidEdit->text().toLatin1(); |
| 191 | if (pattern.isEmpty()) |
| 192 | return; |
| 193 | UINT8 mode; |
| 194 | if (searchDialog->ui->guidScopeHeaderRadioButton->isChecked()) |
| 195 | mode = SEARCH_MODE_HEADER; |
| 196 | else if (searchDialog->ui->guidScopeBodyRadioButton->isChecked()) |
| 197 | mode = SEARCH_MODE_BODY; |
| 198 | else |
| 199 | mode = SEARCH_MODE_ALL; |
| 200 | ffsEngine->findGuidPattern(rootIndex, pattern, mode); |
| 201 | showMessages(); |
| 202 | } |
| 203 | else if (index == 2) { // Text string |
| 204 | searchDialog->ui->textEdit->setFocus(); |
| 205 | QString pattern = searchDialog->ui->textEdit->text(); |
| 206 | if (pattern.isEmpty()) |
| 207 | return; |
| 208 | ffsEngine->findTextPattern(rootIndex, pattern, searchDialog->ui->textUnicodeCheckBox->isChecked(), |
| 209 | (Qt::CaseSensitivity) searchDialog->ui->textCaseSensitiveCheckBox->isChecked()); |
| 210 | showMessages(); |
| 211 | } |
| 212 | } |
| 213 | |
| 214 | void UEFITool::rebuild() |
| 215 | { |
nothing calls this directly
no test coverage detected