This commit is contained in:
恍兮惚兮 2024-12-28 12:48:14 +08:00
parent bbb2b23d4c
commit 3efca3b5ad
3 changed files with 20 additions and 42 deletions

View File

@ -354,57 +354,40 @@ class ItemWidget(QWidget):
def resizeEvent(self, a0: QResizeEvent) -> None: def resizeEvent(self, a0: QResizeEvent) -> None:
self.bottommask.resize(a0.size()) self.bottommask.resize(a0.size())
self.maskshowfileexists.resize(a0.size()) self.maskshowfileexists.resize(a0.size())
self._imgsz()
def others(self): def others(self):
self._lb.setText(self.file if globalconfig["showgametitle"] else "") self.l.setContentsMargins(
self._img.switch() *([globalconfig["dialog_savegame_layout"]["margin2"]] * 4)
self._imgsz()
def _imgsz(self):
textH = (
globalconfig["dialog_savegame_layout"]["textH"]
if globalconfig["showgametitle"]
else 0
)
margin = globalconfig["dialog_savegame_layout"]["margin2"]
self._img.setGeometry(
margin,
margin,
self.width() - 2 * margin,
self.height() - textH - 2 * margin,
) )
if self._img._pixmap.isNull(): if self._img._pixmap.isNull():
self._lb.setGeometry( pass
margin,
max(
margin,
self.height() - self._lb.heightForWidth(self.width()) - margin,
),
self.width() - 2 * margin,
min(self.height() - 2 * margin, self._lb.heightForWidth(self.width())),
)
else: else:
self._lb.setFixedHeight(globalconfig["dialog_savegame_layout"]["textH"])
self._lb.setGeometry( self._img.switch()
margin,
self.height() - textH - margin,
self.width() - 2 * margin,
textH,
)
def __init__(self, gameuid, pixmap, file) -> None: def __init__(self, gameuid, pixmap, file) -> None:
super().__init__() super().__init__()
self.gameuid = gameuid self.gameuid = gameuid
self.file = file self.file = file
self.maskshowfileexists = QLabel(self) self.maskshowfileexists = QLabel(self)
self.l = QVBoxLayout(self)
self.l.setSpacing(0)
self.l.setContentsMargins(
*([globalconfig["dialog_savegame_layout"]["margin2"]] * 4)
)
self._img = IMGWidget(self, pixmap) self._img = IMGWidget(self, pixmap)
self._lb = QLabel(self) self._lb = QLabel(self)
self._lb.setText(file if globalconfig["showgametitle"] else "") if self._img._pixmap.isNull():
self.l.setAlignment(Qt.AlignmentFlag.AlignBottom)
else:
self._lb.setFixedHeight(globalconfig["dialog_savegame_layout"]["textH"])
self.l.addWidget(self._img)
self._lb.setText(file)
self._lb.setWordWrap(True) self._lb.setWordWrap(True)
self._lb.setObjectName("savegame_textfont1") self._lb.setObjectName("savegame_textfont1")
self._lb.setAlignment(Qt.AlignmentFlag.AlignHCenter) self._lb.setAlignment(Qt.AlignmentFlag.AlignHCenter)
self.l.addWidget(self._lb)
exists = os.path.exists(get_launchpath(gameuid)) exists = os.path.exists(get_launchpath(gameuid))
self.maskshowfileexists.setObjectName("savegame_exists" + str(exists)) self.maskshowfileexists.setObjectName("savegame_exists" + str(exists))
if not exists: if not exists:

View File

@ -403,10 +403,6 @@ class dialog_syssetting(LDialog):
isfontselector=True, isfontselector=True,
), ),
) )
formLayout.addRow(
"显示标题",
getsimpleswitch(globalconfig, "showgametitle"),
)
formLayout.addRow( formLayout.addRow(
"缩放", "缩放",
getsimplecombobox( getsimplecombobox(

View File

@ -441,7 +441,6 @@
"localeswitchmethod": 0, "localeswitchmethod": 0,
"hide_not_exists": false, "hide_not_exists": false,
"startgamenototop": true, "startgamenototop": true,
"showgametitle": true,
"extra_space": 0, "extra_space": 0,
"extra_space_trans": 0, "extra_space_trans": 0,
"fonttype": "", "fonttype": "",
@ -521,8 +520,8 @@
"dialog_savegame_layout": { "dialog_savegame_layout": {
"itemw": 130, "itemw": 130,
"itemh": 190, "itemh": 190,
"margin": 8, "margin": 6,
"margin2": 8, "margin2": 6,
"textH": 0, "textH": 0,
"backcolor2": "#40ffffff", "backcolor2": "#40ffffff",
"onselectcolor2": "#40007fff", "onselectcolor2": "#40007fff",