| 564 | # ── options card ───────────────────────────────────────────────────── |
| 565 | |
| 566 | def _build_options_card(self) -> QGroupBox: |
| 567 | card = QGroupBox(_("Options")) |
| 568 | grid = QGridLayout(card) |
| 569 | grid.setHorizontalSpacing(20) |
| 570 | grid.setVerticalSpacing(6) |
| 571 | |
| 572 | def make(field, label, tip): |
| 573 | sw = _Switch(_(label), getattr(modules.globals, field), _(tip)) |
| 574 | sw.toggled.connect( |
| 575 | lambda v, f=field: ( |
| 576 | setattr(modules.globals, f, v), |
| 577 | save_switch_states(), |
| 578 | ) |
| 579 | ) |
| 580 | return sw |
| 581 | |
| 582 | self.sw_keep_fps = make("keep_fps", "Keep fps", |
| 583 | "Output video keeps the original frame rate") |
| 584 | self.sw_keep_audio = make("keep_audio", "Keep audio", |
| 585 | "Copy audio track from the source video to output") |
| 586 | self.sw_keep_frames = make("keep_frames", "Keep frames", |
| 587 | "Keep extracted frames on disk after processing") |
| 588 | self.sw_many_faces = make("many_faces", "Many faces", |
| 589 | "Swap every detected face, not just the primary one") |
| 590 | self.sw_poisson = make("poisson_blend", "Poisson Blend", |
| 591 | "Blend face edges smoothly using Poisson blending") |
| 592 | self.sw_color_fix = make("color_correction", "Fix Blueish Cam", |
| 593 | "Fix blue/green color cast from some webcams") |
| 594 | self.sw_show_fps = make("show_fps", "Show FPS", |
| 595 | "Display frames-per-second counter on the live preview") |
| 596 | |
| 597 | # Map faces is special — closes mapper when toggled off. |
| 598 | self.sw_map_faces = _Switch(_("Map faces"), modules.globals.map_faces, |
| 599 | _("Manually assign which source face maps to which target face")) |
| 600 | self.sw_map_faces.toggled.connect(self._on_map_faces_toggled) |
| 601 | |
| 602 | # Layout: 2 columns of switches |
| 603 | items = [ |
| 604 | self.sw_keep_fps, self.sw_keep_audio, |
| 605 | self.sw_keep_frames, self.sw_many_faces, |
| 606 | self.sw_map_faces, self.sw_show_fps, |
| 607 | self.sw_poisson, self.sw_color_fix, |
| 608 | ] |
| 609 | for i, w in enumerate(items): |
| 610 | grid.addWidget(w, i // 2, i % 2) |
| 611 | |
| 612 | # Face enhancer dropdown |
| 613 | enhancer_label = QLabel(_("Face Enhancer:")) |
| 614 | grid.addWidget(enhancer_label, len(items) // 2, 0) |
| 615 | |
| 616 | self.cb_enhancer = QComboBox() |
| 617 | self.cb_enhancer.addItems(["None", "GFPGAN", "GPEN-512", "GPEN-256"]) |
| 618 | initial = "None" |
| 619 | if modules.globals.fp_ui.get("face_enhancer", False): |
| 620 | initial = "GFPGAN" |
| 621 | elif modules.globals.fp_ui.get("face_enhancer_gpen512", False): |
| 622 | initial = "GPEN-512" |
| 623 | elif modules.globals.fp_ui.get("face_enhancer_gpen256", False): |