add class CustomLineEdit & new icons for context menu #22

Manually merged
Dervart merged 5 commits from Dervart/PortProtonQt:context_menu into main 2025-07-02 16:19:00 +00:00
11 changed files with 96 additions and 27 deletions
Showing only changes of commit 0ee25a7bf6 - Show all commits

View File

@ -3,7 +3,7 @@ import tempfile
from typing import cast, TYPE_CHECKING
from PySide6.QtGui import QPixmap, QIcon
from PySide6.QtWidgets import (
QDialog, QLineEdit, QFormLayout, QHBoxLayout, QLabel, QVBoxLayout, QListWidget, QScrollArea, QWidget, QListWidgetItem, QSizePolicy, QApplication
QDialog, QFormLayout, QHBoxLayout, QLabel, QVBoxLayout, QListWidget, QScrollArea, QWidget, QListWidgetItem, QSizePolicy, QApplication
)
from PySide6.QtCore import Qt, QObject, Signal, QMimeDatabase, QTimer
from icoextract import IconExtractor, IconExtractorError
@ -442,6 +442,7 @@ class FileExplorer(QDialog):
class AddGameDialog(QDialog):
def __init__(self, parent=None, theme=None, edit_mode=False, game_name=None, exe_path=None, cover_path=None):
super().__init__(parent)
from portprotonqt.context_menu_manager import CustomLineEdit # Локальный импорт
self.theme = theme if theme else default_styles
self.theme_manager = ThemeManager()
self.edit_mode = edit_mode
@ -461,7 +462,7 @@ class AddGameDialog(QDialog):
layout.setFieldGrowthPolicy(QFormLayout.FieldGrowthPolicy.ExpandingFieldsGrow)
# Game name
self.nameEdit = QLineEdit(self)
self.nameEdit = CustomLineEdit(self, theme=self.theme)
self.nameEdit.setStyleSheet(self.theme.ADDGAME_INPUT_STYLE)
if game_name:
self.nameEdit.setText(game_name)
@ -474,7 +475,7 @@ class AddGameDialog(QDialog):
exe_label.setStyleSheet(
self.theme.PARAMS_TITLE_STYLE)
self.exeEdit = QLineEdit(self)
self.exeEdit = CustomLineEdit(self, theme=self.theme)
self.exeEdit.setStyleSheet(self.theme.ADDGAME_INPUT_STYLE)
if exe_path:
self.exeEdit.setText(exe_path)
@ -496,7 +497,7 @@ class AddGameDialog(QDialog):
cover_label = QLabel(_("Custom Cover:"))
cover_label.setStyleSheet(self.theme.PARAMS_TITLE_STYLE)
self.coverEdit = QLineEdit(self)
self.coverEdit = CustomLineEdit(self, theme=self.theme)
self.coverEdit.setStyleSheet(self.theme.ADDGAME_INPUT_STYLE)
if cover_path:
self.coverEdit.setText(cover_path)

View File

@ -1117,7 +1117,7 @@ class MainWindow(QMainWindow):
self.legendaryAuthTitle.setFocusPolicy(Qt.FocusPolicy.NoFocus)
formLayout.addRow(self.legendaryAuthTitle, self.legendaryAuthButton)
self.legendaryCodeEdit = QLineEdit()
self.legendaryCodeEdit = CustomLineEdit(self, theme=self.theme)
self.legendaryCodeEdit.setPlaceholderText(_("Enter Legendary Authorization Code"))
self.legendaryCodeEdit.setStyleSheet(self.theme.PROXY_INPUT_STYLE)
self.legendaryCodeEdit.setFocusPolicy(Qt.FocusPolicy.StrongFocus)