|
24 | 24 | from fastflix.exceptions import FastFlixInternalException, FlixError |
25 | 25 | from fastflix.ui_scale import scaler |
26 | 26 | from fastflix.ui_constants import WIDTHS, HEIGHTS, ICONS |
| 27 | +from fastflix.ui_styles import ONYX_COLORS, get_onyx_combobox_style, get_onyx_button_style |
27 | 28 | from fastflix.flix import ( |
28 | 29 | detect_hdr10_plus, |
29 | 30 | detect_interlaced, |
@@ -300,16 +301,7 @@ def __init__(self, parent, app: FastFlixApp): |
300 | 301 | spacer.setFixedHeight(scaler.scale(HEIGHTS.SPACER_SMALL)) |
301 | 302 | self.grid.addWidget(spacer, 8, 0, 1, 14) |
302 | 303 |
|
303 | | - # Add separator line above tabs for onyx theme |
304 | | - if self.app.fastflix.config.theme == "onyx": |
305 | | - tab_separator = QtWidgets.QFrame() |
306 | | - tab_separator.setFrameShape(QtWidgets.QFrame.HLine) |
307 | | - tab_separator.setFixedHeight(1) |
308 | | - tab_separator.setStyleSheet("background-color: #567781;") |
309 | | - self.grid.addWidget(tab_separator, 9, 0, 1, 14) |
310 | | - self.grid.addWidget(self.video_options, 10, 0, 10, 14) |
311 | | - else: |
312 | | - self.grid.addWidget(self.video_options, 9, 0, 10, 14) |
| 304 | + self.grid.addWidget(self.video_options, 9, 0, 10, 14) |
313 | 305 |
|
314 | 306 | self.grid.setSpacing(5) |
315 | 307 | self.paused = False |
@@ -559,9 +551,7 @@ def init_video_area(self): |
559 | 551 | self.widgets.output_type_combo.addItems(self.current_encoder.video_extensions) |
560 | 552 | self.widgets.output_type_combo.setFixedHeight(scaler.scale(HEIGHTS.COMBO_BOX)) |
561 | 553 | if self.app.fastflix.config.theme == "onyx": |
562 | | - self.widgets.output_type_combo.setStyleSheet( |
563 | | - "background-color: #4a555e; color: white; border: 1px solid #4a555e; border-radius: 0px;" |
564 | | - ) |
| 554 | + self.widgets.output_type_combo.setStyleSheet(get_onyx_combobox_style()) |
565 | 555 | self.widgets.output_type_combo.currentIndexChanged.connect(lambda: self.page_update(build_thumbnail=False)) |
566 | 556 |
|
567 | 557 | output_layout.addWidget(self.widgets.output_type_combo) |
@@ -628,9 +618,7 @@ def init_options_tabs(self): |
628 | 618 | self.widgets.resolution_drop_down.addItems(list(resolutions.keys())) |
629 | 619 | self.widgets.resolution_drop_down.currentIndexChanged.connect(self.update_resolution) |
630 | 620 | if self.app.fastflix.config.theme == "onyx": |
631 | | - self.widgets.resolution_drop_down.setStyleSheet( |
632 | | - "background-color: #4a555e; color: white; border: 1px solid #4a555e; border-radius: 0px;" |
633 | | - ) |
| 621 | + self.widgets.resolution_drop_down.setStyleSheet(get_onyx_combobox_style()) |
634 | 622 | res_row.addWidget(self.widgets.resolution_drop_down) |
635 | 623 |
|
636 | 624 | self.widgets.resolution_custom = QtWidgets.QLineEdit() |
@@ -675,19 +663,15 @@ def init_options_tabs(self): |
675 | 663 | time_reset.setToolTip(t("Reset start and end times")) |
676 | 664 | time_reset.clicked.connect(self.reset_time) |
677 | 665 | if self.app.fastflix.config.theme == "onyx": |
678 | | - time_reset.setStyleSheet( |
679 | | - "background-color: #4a555e; color: white; border: 1px solid #4a555e; border-radius: 0px;" |
680 | | - ) |
| 666 | + time_reset.setStyleSheet(get_onyx_button_style()) |
681 | 667 | self.buttons.append(time_reset) |
682 | 668 |
|
683 | 669 | self.widgets.fast_time = QtWidgets.QComboBox() |
684 | 670 | self.widgets.fast_time.addItems([t("Fast"), t("Exact")]) |
685 | 671 | self.widgets.fast_time.setCurrentIndex(0) |
686 | 672 | self.widgets.fast_time.setFixedHeight(scaler.scale(22)) |
687 | 673 | if self.app.fastflix.config.theme == "onyx": |
688 | | - self.widgets.fast_time.setStyleSheet( |
689 | | - "background-color: #4a555e; color: white; border: 1px solid #4a555e; border-radius: 0px;" |
690 | | - ) |
| 674 | + self.widgets.fast_time.setStyleSheet(get_onyx_combobox_style()) |
691 | 675 | self.widgets.fast_time.setToolTip( |
692 | 676 | t( |
693 | 677 | "uses [fast] seek to a rough position ahead of timestamp, " |
@@ -744,18 +728,14 @@ def init_options_tabs(self): |
744 | 728 | auto_crop.setToolTip(t("Automatically detect black borders")) |
745 | 729 | auto_crop.clicked.connect(self.get_auto_crop) |
746 | 730 | if self.app.fastflix.config.theme == "onyx": |
747 | | - auto_crop.setStyleSheet( |
748 | | - "background-color: #4a555e; color: white; border: 1px solid #4a555e; border-radius: 0px;" |
749 | | - ) |
| 731 | + auto_crop.setStyleSheet(get_onyx_button_style()) |
750 | 732 | self.buttons.append(auto_crop) |
751 | 733 | reset = QtWidgets.QPushButton(t("Reset")) |
752 | 734 | reset.setFixedHeight(scaler.scale(22)) |
753 | 735 | reset.setToolTip(t("Reset crop")) |
754 | 736 | reset.clicked.connect(self.reset_crop) |
755 | 737 | if self.app.fastflix.config.theme == "onyx": |
756 | | - reset.setStyleSheet( |
757 | | - "background-color: #4a555e; color: white; border: 1px solid #4a555e; border-radius: 0px;" |
758 | | - ) |
| 738 | + reset.setStyleSheet(get_onyx_button_style()) |
759 | 739 | self.buttons.append(reset) |
760 | 740 | col1.addWidget(auto_crop) |
761 | 741 | col1.addWidget(reset) |
@@ -982,9 +962,7 @@ def init_flip(self): |
982 | 962 | self.widgets.flip.setIconSize(scaler.scale_size(ICONS.MEDIUM, ICONS.MEDIUM)) |
983 | 963 | self.widgets.flip.currentIndexChanged.connect(lambda: self.page_update()) |
984 | 964 | if self.app.fastflix.config.theme == "onyx": |
985 | | - self.widgets.flip.setStyleSheet( |
986 | | - "background-color: #4a555e; color: white; border: 1px solid #4a555e; border-radius: 0px;" |
987 | | - ) |
| 965 | + self.widgets.flip.setStyleSheet(get_onyx_combobox_style()) |
988 | 966 | return self.widgets.flip |
989 | 967 |
|
990 | 968 | def get_flips(self) -> Tuple[bool, bool]: |
@@ -1023,9 +1001,7 @@ def init_rotate(self): |
1023 | 1001 | self.widgets.rotate.setIconSize(scaler.scale_size(ICONS.MEDIUM, ICONS.MEDIUM)) |
1024 | 1002 | self.widgets.rotate.currentIndexChanged.connect(lambda: self.page_update()) |
1025 | 1003 | if self.app.fastflix.config.theme == "onyx": |
1026 | | - self.widgets.rotate.setStyleSheet( |
1027 | | - "background-color: #4a555e; color: white; border: 1px solid #4a555e; border-radius: 0px;" |
1028 | | - ) |
| 1004 | + self.widgets.rotate.setStyleSheet(get_onyx_combobox_style()) |
1029 | 1005 | return self.widgets.rotate |
1030 | 1006 |
|
1031 | 1007 | def change_output_types(self): |
@@ -1220,7 +1196,7 @@ def _update_scaled_sizes(self): |
1220 | 1196 | ) |
1221 | 1197 | border_width = scaler.scale(2) |
1222 | 1198 | margin = scaler.scale(7) |
1223 | | - self.setStyleSheet(f"border: {border_width}px solid #567781; margin: {margin}px;") |
| 1199 | + self.setStyleSheet(f"border: {border_width}px solid {ONYX_COLORS['primary']}; margin: {margin}px;") |
1224 | 1200 |
|
1225 | 1201 | def _on_scale_changed(self, factors): |
1226 | 1202 | """Called when scale factors change.""" |
@@ -1563,18 +1539,11 @@ def build_crop(self) -> Union[Crop, None]: |
1563 | 1539 | self.widgets.crop.right.setStyleSheet("color: red") |
1564 | 1540 | # error_message(f"{t('Invalid Crop')}: {err}") |
1565 | 1541 | return None |
1566 | | - self.widgets.crop.left.setStyleSheet( |
1567 | | - "color: black" if self.app.fastflix.config.theme != "dark" else "color: white" |
1568 | | - ) |
1569 | | - self.widgets.crop.right.setStyleSheet( |
1570 | | - "color: black" if self.app.fastflix.config.theme != "dark" else "color: white" |
1571 | | - ) |
1572 | | - self.widgets.crop.top.setStyleSheet( |
1573 | | - "color: black" if self.app.fastflix.config.theme != "dark" else "color: white" |
1574 | | - ) |
1575 | | - self.widgets.crop.bottom.setStyleSheet( |
1576 | | - "color: black" if self.app.fastflix.config.theme != "dark" else "color: white" |
1577 | | - ) |
| 1542 | + crop_text_color = "color: white" if self.app.fastflix.config.theme in ("dark", "onyx") else "color: black" |
| 1543 | + self.widgets.crop.left.setStyleSheet(crop_text_color) |
| 1544 | + self.widgets.crop.right.setStyleSheet(crop_text_color) |
| 1545 | + self.widgets.crop.top.setStyleSheet(crop_text_color) |
| 1546 | + self.widgets.crop.bottom.setStyleSheet(crop_text_color) |
1578 | 1547 | return crop |
1579 | 1548 |
|
1580 | 1549 | def disable_all(self): |
|
0 commit comments