Skip to content

The only downloader you need. 下载器的集大成者。

feat: 在设置界面引入设置项折叠分类

XiaoYouChR9670160eaae2
diff --git a/app/supports/config.py b/app/supports/config.py
index 9c053885..9257775c 100644
--- a/app/supports/config.py
+++ b/app/supports/config.py
@@ -121,6 +121,18 @@ class LanguageSerializer(ConfigSerializer):
return Language(QLocale(value)) if value != "Auto" else Language.AUTO
+class StringListValidator(ConfigValidator):
+ """字符串列表验证器"""
+
+ def validate(self, value) -> bool:
+ return isinstance(value, list) and all(isinstance(i, str) for i in value)
+
+ def correct(self, value) -> list:
+ if not isinstance(value, list):
+ return []
+ return [i for i in value if isinstance(i, str)]
+
+
class HeadersValidator(ConfigValidator):
"""Headers 验证器"""
@@ -247,6 +259,14 @@ class Config(QConfig):
GeometrySerializer(),
) # 由于 QScreen 必须在 QApplication 初始化之后调用, 所以由 MainWindow 处理特殊情况
+ # 设置页 UI 状态
+ collapsedSettingGroups = ConfigItem(
+ "UI", "CollapsedSettingGroups", [], StringListValidator()
+ )
+ settingGroupOrder = ConfigItem(
+ "UI", "SettingGroupOrder", [], StringListValidator()
+ )
+
# 网络设置
# headers = ConfigItem(
# "Network",
diff --git a/app/view/components/setting_card_group.py b/app/view/components/setting_card_group.py
new file mode 100644
index 00000000..fe16793c
--- /dev/null
+++ b/app/view/components/setting_card_group.py
@@ -0,0 +1,243 @@
+from typing import TYPE_CHECKING, Final
+
+from PySide6.QtCore import (
+ QByteArray,
+ QEasingCurve,
+ QEvent,
+ QObject,
+ QPropertyAnimation,
+ QRectF,
+ QSize,
+ Qt,
+ Signal,
+)
+from PySide6.QtGui import QColor, QPainter
+from PySide6.QtWidgets import QHBoxLayout, QVBoxLayout, QWidget
+from qfluentwidgets import (
+ FluentIcon,
+ SettingCard,
+ StrongBodyLabel,
+ TransparentToolButton,
+ isDarkTheme,
+ FluentStyleSheet,
+)
+from qfluentwidgets.components.settings.expand_setting_card import (
+ ExpandBorderWidget,
+ ExpandSettingCard,
+ GroupSeparator,
+)
+
+from app.supports.config import cfg
+
+if TYPE_CHECKING:
+ from PySide6.QtGui import QMouseEvent, QPaintEvent
+
+_QWIDGETSIZE_MAX: Final[int] = (1 << 24) - 1
+_BUTTON_SIZE: Final[QSize] = QSize(26, 26)
+_ICON_SIZE: Final[QSize] = QSize(12, 12)
+_BORDER_RADIUS: Final[int] = 5
+
+
+class _CardPaintSuppressor(QObject):
+ """吞掉 watched widget 的 paintEvent。
+
+ 子控件(icon/label/switch)有自己的 paintEvent 不受影响,结果是
+ widget 自身背景消失但子内容照常显示。配合外层 group 的 paintEvent
+ 画整体卡片背景,把 qfluentwidgets SettingCard 的圆角背景"压平"。
+ """
+
+ def eventFilter(self, obj: QObject, event: QEvent) -> bool:
+ return event.type() == QEvent.Type.Paint
+
+
+class CollapsibleSettingCardGroup(QWidget):
+ orderChanged = Signal() # sibling 顺序变化
+
+ def __init__(self, title: str, key: str, parent: QWidget | None = None) -> None:
+ super().__init__(parent)
+ self.setObjectName(key)
+
+ # instant widget
+ self.titleLabel = StrongBodyLabel(title, self)
+ self.moveUpButton = TransparentToolButton(FluentIcon.UP, self)
+ self.moveDownButton = TransparentToolButton(FluentIcon.DOWN, self)
+ self.expandButton = TransparentToolButton(FluentIcon.CHEVRON_DOWN_MED, self)
+ self.cardContainer = QWidget(self)
+ self._cardPaintSuppressor = _CardPaintSuppressor(self)
+ self._collapseAnim = QPropertyAnimation(
+ self.cardContainer, QByteArray(b"maximumHeight"), self
+ )
+
+ # instant layout
+ self.headerLayout = QHBoxLayout()
+ self.cardLayout = QVBoxLayout(self.cardContainer)
+ self.vBoxLayout = QVBoxLayout(self)
+
+ # init
+ self._initWidget()
+ self._initLayout()
+
+ # bind
+ self._bind()
+
+ def _initWidget(self) -> None:
+ for btn in (self.moveUpButton, self.moveDownButton, self.expandButton):
+ btn.setFixedSize(_BUTTON_SIZE)
+ btn.setIconSize(_ICON_SIZE)
+ self.moveUpButton.setVisible(False)
+ self.moveDownButton.setVisible(False)
+
+ self._collapseAnim.setDuration(200)
+ self._collapseAnim.setEasingCurve(QEasingCurve.Type.OutCubic)
+
+ FluentStyleSheet.SETTING_CARD_GROUP.apply(self)
+ # WA_Hover 基于"光标是否在 widget 几何内(含子孙)"判定,
+ # 子控件抢不抢事件都不影响 HoverEnter/HoverLeave 的派发
+ self.setAttribute(Qt.WidgetAttribute.WA_Hover, True)
+
+ self._setCollapsed(
+ self.objectName() in cfg.collapsedSettingGroups.value,
+ animated=False,
+ )
+
+ def _initLayout(self) -> None:
+ self.headerLayout.setContentsMargins(16, 4, 8, 4)
+ self.headerLayout.setSpacing(4)
+ self.headerLayout.addWidget(self.titleLabel)
+ self.headerLayout.addStretch(1)
+ self.headerLayout.addWidget(self.moveUpButton)
+ self.headerLayout.addWidget(self.moveDownButton)
+ self.headerLayout.addWidget(self.expandButton)
+
+ self.cardLayout.setContentsMargins(0, 0, 0, 0)
+ self.cardLayout.setSpacing(0)
+
+ self.vBoxLayout.setContentsMargins(0, 0, 0, 0)
+ self.vBoxLayout.setSpacing(0)
+ self.vBoxLayout.setAlignment(Qt.AlignmentFlag.AlignTop)
+ self.vBoxLayout.addLayout(self.headerLayout)
+ self.vBoxLayout.addWidget(self.cardContainer, 1)
+
+ def _bind(self) -> None:
+ self.expandButton.clicked.connect(self._onExpandButtonClicked)
+ self.moveUpButton.clicked.connect(lambda: self._move(-1))
+ self.moveDownButton.clicked.connect(lambda: self._move(1))
+ self._collapseAnim.finished.connect(self._onCollapseAnimFinished)
+
+ def addSettingCard(self, card: QWidget) -> None:
+ self.cardLayout.addWidget(card)
+ card.installEventFilter(self._cardPaintSuppressor)
+ # ExpandSettingCard 内部有 HeaderSettingCard / ExpandBorderWidget /
+ # GroupSeparator 各自画背景或分隔线,吞掉 QScrollArea 自己的 paintEvent 不够
+ if isinstance(card, ExpandSettingCard):
+ for sub in card.findChildren(QWidget):
+ if isinstance(sub, (SettingCard, ExpandBorderWidget, GroupSeparator)):
+ sub.installEventFilter(self._cardPaintSuppressor)
+
+ def addSettingCards(self, cards: list[QWidget]) -> None:
+ for card in cards:
+ self.addSettingCard(card)
+
+ def updateArrows(self) -> None:
+ siblings = self._children()
+ idx = siblings.index(self)
+ self.moveUpButton.setEnabled(idx > 0)
+ self.moveDownButton.setEnabled(idx < len(siblings) - 1)
+
+ def mousePressEvent(self, event: "QMouseEvent") -> None:
+ # 子按钮 accept 事件不冒泡所以不会误触
+ if (
+ event.button() == Qt.MouseButton.LeftButton
+ and event.position().y() < self.cardContainer.geometry().top()
+ ):
+ self._onExpandButtonClicked()
+ super().mousePressEvent(event)
+
+ def _onExpandButtonClicked(self) -> None:
+ self._setCollapsed(not self._collapsed)
+ key = self.objectName()
+ items = list(cfg.collapsedSettingGroups.value)
+ if self._collapsed and key not in items:
+ items.append(key)
+ elif not self._collapsed and key in items:
+ items.remove(key)
+ cfg.set(cfg.collapsedSettingGroups, items)
+
+ def _setCollapsed(self, collapsed: bool, animated: bool = True) -> None:
+ self._collapsed = collapsed
+ self.expandButton.setIcon(
+ FluentIcon.CHEVRON_RIGHT_MED if collapsed else FluentIcon.CHEVRON_DOWN_MED
+ )
+
+ if not animated:
+ self.cardContainer.setMaximumHeight(0 if collapsed else _QWIDGETSIZE_MAX)
+ return
+
+ self._collapseAnim.stop()
+ self._collapseAnim.setStartValue(self.cardContainer.height())
+ self._collapseAnim.setEndValue(
+ 0 if collapsed else self.cardContainer.sizeHint().height()
+ )
+ self._collapseAnim.start()
+
+ def _onCollapseAnimFinished(self) -> None:
+ # 展开动画结束后解除 maxHeight 上限,让 cardContainer 能跟随子卡片自由生长
+ if not self._collapsed:
+ self.cardContainer.setMaximumHeight(_QWIDGETSIZE_MAX)
+
+ def _move(self, delta: int) -> None:
+ siblings = self._children()
+ target = siblings[siblings.index(self) + delta]
+
+ # insertWidget 对同 layout 已有子项语义是"移动到该索引",邻居被挤一格正好换位
+ layout = self.parentWidget().layout()
+ layout.insertWidget(layout.indexOf(target), self)
+
+ self._saveOrder()
+ for s in self._children():
+ s.updateArrows()
+ self.orderChanged.emit()
+
+ def _children(self) -> list["CollapsibleSettingCardGroup"]:
+ layout = self.parentWidget().layout()
+ result: list[CollapsibleSettingCardGroup] = []
+ for i in range(layout.count()):
+ w = layout.itemAt(i).widget()
+ if isinstance(w, CollapsibleSettingCardGroup):
+ result.append(w)
+ return result
+
+ def _saveOrder(self) -> None:
+ # 保留 stored 中的 stale key——它们对应尚未加载(如未启用的 feature pack)
+ # 的 group,下次启动时仍要恢复顺序,移除会丢失这部分信息
+ currentKeys = [s.objectName() for s in self._children()]
+ stored = list(cfg.settingGroupOrder.value)
+ stale = [k for k in stored if k not in currentKeys]
+ cfg.set(cfg.settingGroupOrder, currentKeys + stale)
+
+ def event(self, event: QEvent) -> bool:
+ et = event.type()
+ if et == QEvent.Type.HoverEnter:
+ self.moveUpButton.setVisible(True)
+ self.moveDownButton.setVisible(True)
+ elif et == QEvent.Type.HoverLeave:
+ self.moveUpButton.setVisible(False)
+ self.moveDownButton.setVisible(False)
+ return super().event(event)
+
+ def paintEvent(self, event: "QPaintEvent") -> None:
+ super().paintEvent(event)
+ with QPainter(self) as painter:
+ painter.setRenderHint(QPainter.RenderHint.Antialiasing)
+
+ isDark = isDarkTheme()
+ bg = QColor(255, 255, 255, 13) if isDark else QColor(255, 255, 255, 200)
+ border = QColor(0, 0, 0, 96) if isDark else QColor(0, 0, 0, 24)
+
+ painter.setBrush(bg)
+ painter.setPen(border)
+ painter.drawRoundedRect(
+ QRectF(self.rect()).adjusted(0.5, 0.5, -0.5, -0.5),
+ _BORDER_RADIUS,
+ _BORDER_RADIUS,
+ )
diff --git a/app/view/components/setting_cards.py b/app/view/components/setting_cards.py
index 800ac529..b2f3fe56 100644
--- a/app/view/components/setting_cards.py
+++ b/app/view/components/setting_cards.py
@@ -176,7 +176,7 @@ class ProxySettingCard(ExpandGroupSettingCard):
self.radioLayout.setSpacing(19)
self.radioLayout.setAlignment(Qt.AlignmentFlag.AlignTop)
- self.radioLayout.setContentsMargins(48, 18, 0, 18)
+ self.radioLayout.setContentsMargins(48, 5, 0, 18)
self.buttonGroup.addButton(self.offRadioButton)
self.buttonGroup.addButton(self.defaultRadioButton)
@@ -187,7 +187,7 @@ class ProxySettingCard(ExpandGroupSettingCard):
self.radioLayout.addWidget(self.customRadioButton)
self.radioLayout.setSizeConstraint(QVBoxLayout.SizeConstraint.SetMinimumSize)
- self.customProxyLayout.setContentsMargins(48, 18, 44, 18)
+ self.customProxyLayout.setContentsMargins(48, 5, 44, 10)
self.customProxyLayout.addWidget(
self.customLabel, 0, Qt.AlignmentFlag.AlignLeft
)
@@ -209,7 +209,7 @@ class ProxySettingCard(ExpandGroupSettingCard):
QHBoxLayout.SizeConstraint.SetMinimumSize
)
- self.credentialsLayout.setContentsMargins(48, 18, 44, 18)
+ self.credentialsLayout.setContentsMargins(48, 5, 44, 18)
self.credentialsLayout.addWidget(
self.credentialsLabel, 0, Qt.AlignmentFlag.AlignLeft
)
diff --git a/app/view/pages/setting_page.py b/app/view/pages/setting_page.py
index a5405d7f..d3229013 100644
--- a/app/view/pages/setting_page.py
+++ b/app/view/pages/setting_page.py
@@ -6,7 +6,7 @@ from typing import TYPE_CHECKING
from PySide6.QtCore import Qt, QResource, QCoreApplication, QUrl
from PySide6.QtGui import QDesktopServices
from PySide6.QtWidgets import QWidget, QVBoxLayout, QFileDialog, QApplication
-from qfluentwidgets import SettingCardGroup, RangeSettingCard, FluentIcon, SwitchSettingCard, PushSettingCard, \
+from qfluentwidgets import RangeSettingCard, FluentIcon, SwitchSettingCard, PushSettingCard, \
HyperlinkButton, ComboBoxSettingCard, HyperlinkCard, PrimaryPushSettingCard, InfoBar, FlyoutView, Flyout, \
InfoBarPosition, ToolButton, ToolTipFilter
@@ -14,6 +14,7 @@ from app.services.browser_service import BrowserService
from app.supports.config import cfg, EDGE_ADDONS_URL, FIREFOX_ADDONS_URL, AUTHOR_URL, AUTHOR, YEAR, \
VERSION, FEEDBACK_URL
from app.supports.utils import openAppLogFolder
+from app.view.components.setting_card_group import CollapsibleSettingCardGroup
from app.view.components.setting_cards import SpinBoxSettingCard, SelectFolderSettingCard, ProxySettingCard
if TYPE_CHECKING:
@@ -30,20 +31,45 @@ class SettingPage(ScrollArea):
def __init__(self, parent=None):
super().__init__(parent)
- # Initialize
self.container = QWidget()
self.vBoxLayout = QVBoxLayout(self.container)
- self.generalDownloadGroup = SettingCardGroup(self.tr("综合下载设置"), self.container)
- self.browserGroup = SettingCardGroup(self.tr("浏览器扩展"), self.container)
- self.personalGroup = SettingCardGroup(self.tr("个性化"), self.container)
- self.softwareGroup = SettingCardGroup(self.tr("应用"), self.container)
- self.aboutGroup = SettingCardGroup(self.tr("关于"), self.container)
+ # stretch 永远是 vBoxLayout 的最后一个 item,吸收多余高度让 group 顶部对齐
+ self.vBoxLayout.addStretch(1)
+ self.generalDownloadGroup = CollapsibleSettingCardGroup(self.tr("综合下载设置"), "general", self.container)
+ self.browserGroup = CollapsibleSettingCardGroup(self.tr("浏览器扩展"), "browser", self.container)
+ self.personalGroup = CollapsibleSettingCardGroup(self.tr("个性化"), "personalization", self.container)
+ self.softwareGroup = CollapsibleSettingCardGroup(self.tr("应用"), "software", self.container)
+ self.aboutGroup = CollapsibleSettingCardGroup(self.tr("关于"), "about", self.container)
self.initWidget()
self.initCards()
self.initLayout()
self.connectSignalToSlot()
+ def addSettingGroup(self, group: CollapsibleSettingCardGroup):
+ self.vBoxLayout.insertWidget(self.vBoxLayout.count() - 1, group)
+
+ def showEvent(self, event):
+ self._restoreOrder()
+ super().showEvent(event)
+
+ def _restoreOrder(self):
+ groups = []
+ for i in range(self.vBoxLayout.count()):
+ w = self.vBoxLayout.itemAt(i).widget()
+ if w:
+ groups.append(w)
+
+ keyToWidget = {g.objectName(): g for g in groups}
+ order = [k for k in cfg.settingGroupOrder.value if k in keyToWidget]
+ order += [k for k in keyToWidget if k not in order]
+
+ for idx, key in enumerate(order):
+ self.vBoxLayout.insertWidget(idx, keyToWidget[key])
+
+ for g in groups:
+ g.updateArrows()
+
def initWidget(self):
self.setWidget(self.container)
self.setWidgetResizable(True)
@@ -307,11 +333,11 @@ class SettingPage(ScrollArea):
self.aboutGroup.addSettingCard(self.aboutCard)
def initLayout(self):
- self.vBoxLayout.addWidget(self.generalDownloadGroup)
- self.vBoxLayout.addWidget(self.browserGroup)
- self.vBoxLayout.addWidget(self.personalGroup)
- self.vBoxLayout.addWidget(self.softwareGroup)
- self.vBoxLayout.addWidget(self.aboutGroup)
+ self.addSettingGroup(self.generalDownloadGroup)
+ self.addSettingGroup(self.browserGroup)
+ self.addSettingGroup(self.personalGroup)
+ self.addSettingGroup(self.softwareGroup)
+ self.addSettingGroup(self.aboutGroup)
def connectSignalToSlot(self):
cfg.appRestartSig.connect(self._showRestartTooltip)
diff --git a/features/bili_pack/config.py b/features/bili_pack/config.py
index c397ae4c..c721c12d 100644
--- a/features/bili_pack/config.py
+++ b/features/bili_pack/config.py
@@ -14,7 +14,6 @@ from qfluentwidgets import (
OptionsValidator,
BoolValidator,
ConfigItem,
- SettingCardGroup,
ComboBoxSettingCard,
SettingCard,
FluentIcon,
@@ -28,6 +27,7 @@ from qfluentwidgets import (
from qrcode.image.pure import PyPNGImage
from app.bases.models import PackConfig
+from app.view.components.setting_card_group import CollapsibleSettingCardGroup
from app.services.core_service import coreService
from app.supports.config import cfg
from .login import (
@@ -432,7 +432,7 @@ class BilibiliConfig(PackConfig):
userCookie = ConfigItem("Download", "UserCookie", "", CookieValidator())
def setupSettings(self, settingPage: "SettingPage"):
- self.parseBilibiliGroup = SettingCardGroup(self.tr("哔哩哔哩视频下载"), settingPage.container)
+ self.parseBilibiliGroup = CollapsibleSettingCardGroup(self.tr("哔哩哔哩视频下载"), "bili", settingPage.container)
self.defaultQualityCard = ComboBoxSettingCard(
self.defaultQuality,
@@ -479,7 +479,7 @@ class BilibiliConfig(PackConfig):
self.parseBilibiliGroup.addSettingCard(self.parseDolbyCard)
self.parseBilibiliGroup.addSettingCard(self.loginCard)
- settingPage.vBoxLayout.addWidget(self.parseBilibiliGroup)
+ settingPage.addSettingGroup(self.parseBilibiliGroup)
bilibiliConfig = BilibiliConfig()
diff --git a/features/bittorrent_pack/config.py b/features/bittorrent_pack/config.py
index 85a37c8c..5b783b9b 100644
--- a/features/bittorrent_pack/config.py
+++ b/features/bittorrent_pack/config.py
@@ -17,7 +17,6 @@ from qfluentwidgets import (
RangeSettingCard,
RangeValidator,
SettingCard,
- SettingCardGroup,
SwitchSettingCard,
ToolButton,
ToolTipFilter,
@@ -26,6 +25,7 @@ from qfluentwidgets import (
from app.bases.models import PackConfig
from app.services.core_service import coreService
from app.supports.config import cfg
+from app.view.components.setting_card_group import CollapsibleSettingCardGroup
from app.view.components.editors import AutoSizingEdit
from app.view.components.setting_cards import SpinBoxSettingCard
from .trackers import fetchWebTrackers, formatTrackers, toTrackers, parseTrackerText
@@ -224,7 +224,7 @@ class BitTorrentConfig(PackConfig):
)
def setupSettings(self, settingPage: "SettingPage"):
- self.bittorrentGroup = SettingCardGroup(self.tr("BitTorrent 下载"), settingPage.container)
+ self.bittorrentGroup = CollapsibleSettingCardGroup(self.tr("BitTorrent 下载"), "bittorrent", settingPage.container)
self.listenPortCard = SpinBoxSettingCard(
FluentIcon.GLOBE,
self.tr("监听端口"),
@@ -375,7 +375,7 @@ class BitTorrentConfig(PackConfig):
):
self.bittorrentGroup.addSettingCard(card)
- settingPage.vBoxLayout.addWidget(self.bittorrentGroup)
+ settingPage.addSettingGroup(self.bittorrentGroup)
bittorrentConfig = BitTorrentConfig()
diff --git a/features/ffmpeg_pack/config.py b/features/ffmpeg_pack/config.py
index a614a834..9a5ff3d2 100644
--- a/features/ffmpeg_pack/config.py
+++ b/features/ffmpeg_pack/config.py
@@ -11,11 +11,11 @@ from qfluentwidgets import (
FluentIcon,
FolderValidator,
SettingCard,
- SettingCardGroup,
ToolButton, PrimaryPushButton, InfoBar, ToolTipFilter
)
from app.bases.models import PackConfig
+from app.view.components.setting_card_group import CollapsibleSettingCardGroup
from app.services.core_service import coreService
from app.supports.config import cfg
from app.supports.paths import APP_DATA_DIR
@@ -173,7 +173,7 @@ class FFmpegConfig(PackConfig):
installFolder = ConfigItem("FFmpeg", "InstallFolder", f"{APP_DATA_DIR}/FFmpeg", FolderValidator())
def setupSettings(self, settingPage: "SettingPage"):
- self.ffmpegGroup = SettingCardGroup(self.tr("FFmpeg"), settingPage.container)
+ self.ffmpegGroup = CollapsibleSettingCardGroup(self.tr("FFmpeg"), "ffmpeg", settingPage.container)
self.installFolderCard = FFmpegInstallFolderCard(self.ffmpegGroup)
self.runtimeCard = FFmpegRuntimeCard(self.ffmpegGroup)
@@ -181,7 +181,7 @@ class FFmpegConfig(PackConfig):
self.ffmpegGroup.addSettingCard(self.installFolderCard)
self.ffmpegGroup.addSettingCard(self.runtimeCard)
- settingPage.vBoxLayout.addWidget(self.ffmpegGroup)
+ settingPage.addSettingGroup(self.ffmpegGroup)
self.runtimeCard.refreshStatus()
diff --git a/features/github_pack/config.py b/features/github_pack/config.py
index 157cc2c7..c56c54de 100644
--- a/features/github_pack/config.py
+++ b/features/github_pack/config.py
@@ -19,7 +19,6 @@ from qfluentwidgets import (
OptionsValidator,
PlainTextEdit,
SettingCard,
- SettingCardGroup,
SubtitleLabel,
SwitchSettingCard,
ToolButton,
@@ -28,6 +27,7 @@ from qfluentwidgets import (
from app.bases.models import PackConfig
from app.services.core_service import coreService
+from app.view.components.setting_card_group import CollapsibleSettingCardGroup
from app.supports.config import cfg
from app.supports.utils import getProxies
@@ -290,7 +290,7 @@ class GitHubConfig(PackConfig):
)
def setupSettings(self, settingPage: "SettingPage"):
- self.githubGroup = SettingCardGroup(self.tr("GitHub 加速"), settingPage.container)
+ self.githubGroup = CollapsibleSettingCardGroup(self.tr("GitHub 加速"), "github", settingPage.container)
self.enableCard = SwitchSettingCard(
FluentIcon.LINK,
self.tr("启用 GitHub 加速"),
@@ -307,7 +307,7 @@ class GitHubConfig(PackConfig):
self.githubGroup.addSettingCard(self.enableCard)
self.githubGroup.addSettingCard(self.proxySiteCard)
- settingPage.vBoxLayout.addWidget(self.githubGroup)
+ settingPage.addSettingGroup(self.githubGroup)
self.enableCard.checkedChanged.connect(self._onEnabledChanged)
self.viewAgreementButton.clicked.connect(self._showAgreement)
diff --git a/features/m3u8_pack/config.py b/features/m3u8_pack/config.py
index 0cda560d..7fc8850e 100644
--- a/features/m3u8_pack/config.py
+++ b/features/m3u8_pack/config.py
@@ -20,7 +20,6 @@ from qfluentwidgets import (
RangeSettingCard,
RangeValidator,
SettingCard,
- SettingCardGroup,
SwitchSettingCard,
ToolButton,
ToolTipFilter,
@@ -31,6 +30,7 @@ from app.services.core_service import coreService
from app.supports.config import cfg
from app.supports.paths import APP_DATA_DIR
from app.supports.utils import toExecutable, toPosixPath
+from app.view.components.setting_card_group import CollapsibleSettingCardGroup
from app.view.components.setting_cards import SpinBoxSettingCard
if TYPE_CHECKING:
@@ -199,7 +199,7 @@ class M3U8Config(PackConfig):
livePipeMux = ConfigItem("M3U8", "LivePipeMux", False, BoolValidator())
def setupSettings(self, settingPage: "SettingPage"):
- self.m3u8Group = SettingCardGroup(self.tr("流媒体下载"), settingPage.container)
+ self.m3u8Group = CollapsibleSettingCardGroup(self.tr("流媒体下载"), "m3u8", settingPage.container)
self.installFolderCard = M3U8InstallFolderCard(self.m3u8Group)
self.runtimeCard = M3U8RuntimeCard(self.m3u8Group)
self.outputFormatCard = ComboBoxSettingCard(
@@ -310,7 +310,7 @@ class M3U8Config(PackConfig):
):
self.m3u8Group.addSettingCard(card)
- settingPage.vBoxLayout.addWidget(self.m3u8Group)
+ settingPage.addSettingGroup(self.m3u8Group)
self.runtimeCard.refreshStatus()