MCPcopy Create free account
hub / github.com/D4stiny/PeaceMaker / AddFilterSummary

Method AddFilterSummary

PeaceMakerGUI/mainwindow.cpp:490–547  ·  view source on GitHub ↗

* @brief MainWindow::AddFilterSummary - Add a filter to the filters table. * @param FilterInfo - The filter to add. * @param FilterType - The type of filter to add. */

Source from the content-addressed store, hash-verified

488 * @param FilterType - The type of filter to add.
489 */
490void MainWindow::AddFilterSummary(FILTER_INFO FilterInfo, STRING_FILTER_TYPE FilterType)
491{
492 std::string filterType;
493 std::string filterFlags;
494
495 //
496 // Depending on the filter type, make the enum value a string.
497 //
498 switch(FilterType)
499 {
500 case FilesystemFilter:
501 filterType = "Filesystem Filter";
502 this->FilesystemFiltersCount++;
503 break;
504 case RegistryFilter:
505 filterType = "Registry Filter";
506 this->RegistryFiltersCount++;
507 break;
508 }
509
510 //
511 // Now convert the flags.
512 //
513 if(FlagOn(FilterInfo.Flags, FILTER_FLAG_DELETE))
514 {
515 filterFlags = "Delete";
516 }
517 if(FlagOn(FilterInfo.Flags, FILTER_FLAG_WRITE))
518 {
519 //
520 // Add a comma if this is the second flag.
521 //
522 if(FlagOn(FilterInfo.Flags, FILTER_FLAG_DELETE))
523 {
524 filterFlags += ", ";
525 }
526 filterFlags += "Write";
527 }
528 if(FlagOn(FilterInfo.Flags, FILTER_FLAG_EXECUTE))
529 {
530 //
531 // Add a comma if this is the third flag.
532 //
533 if(FlagOn(FilterInfo.Flags, FILTER_FLAG_DELETE) || FlagOn(FilterInfo.Flags, FILTER_FLAG_WRITE))
534 {
535 filterFlags += ", ";
536 }
537 filterFlags += "Execute";
538 }
539
540 this->ui->FiltersTable->setRowCount(this->FiltersTableSize + 1);
541 this->ui->FiltersTable->setItem(this->FiltersTableSize, 0, new QTableWidgetItem(QString::fromStdString(filterType)));
542 this->ui->FiltersTable->setItem(this->FiltersTableSize, 1, new QTableWidgetItem(QString::fromStdString(filterFlags)));
543 this->ui->FiltersTable->setItem(this->FiltersTableSize, 2, new QTableWidgetItem(QString::fromWCharArray(FilterInfo.MatchString)));
544 this->FiltersTableSize++;
545
546 filters.push_back(FilterInfo);
547}

Callers 1

ThreadUpdateTablesMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected