diff --git a/rare/app.py b/rare/app.py index a58d3bfc..96b4667a 100644 --- a/rare/app.py +++ b/rare/app.py @@ -7,14 +7,14 @@ import time from PyQt5.QtCore import QSettings, QTranslator from PyQt5.QtGui import QIcon -from PyQt5.QtWidgets import QApplication, QSystemTrayIcon +from PyQt5.QtWidgets import QApplication, QSystemTrayIcon, QStyleFactory from custom_legendary.core import LegendaryCore from rare import lang_path, style_path from rare.components.dialogs.launch_dialog import LaunchDialog from rare.components.main_window import MainWindow from rare.components.tray_icon import TrayIcon -from rare.utils.utils import get_lang +from rare.utils.utils import get_lang, load_color_scheme start_time = time.strftime('%y-%m-%d--%H:%M') # year-month-day-hour-minute file_name = os.path.expanduser(f"~/.cache/rare/logs/Rare_{start_time}.log") @@ -67,8 +67,14 @@ class App(QApplication): self.installTranslator(self.translator) # Style - self.setStyleSheet(open(style_path + "RareStyle.qss").read()) - self.setWindowIcon(QIcon(style_path + "Logo.png")) + self.setStyle(QStyleFactory.create("Fusion")) + if (color := settings.value("color_scheme", None)) is not None: + custom_palette = load_color_scheme(os.path.join(style_path, "colors", color + ".scheme")) + if custom_palette is not None: + self.setPalette(custom_palette) + if (style := settings.value("style_sheet", None)) is not None: + self.setStyleSheet(open(os.path.join(style_path, "qss", style + ".qss")).read()) + self.setWindowIcon(QIcon(os.path.join(style_path + "Logo.png"))) # launch app self.launch_dialog = LaunchDialog(self.core, args.offline) @@ -107,4 +113,4 @@ def start(args): if exit_code != -133742: break # restart app - del app \ No newline at end of file + del app diff --git a/rare/components/dialogs/install_dialog.py b/rare/components/dialogs/install_dialog.py index d3629725..dabb7654 100644 --- a/rare/components/dialogs/install_dialog.py +++ b/rare/components/dialogs/install_dialog.py @@ -26,7 +26,7 @@ class InstallDialog(QDialog): if not default_path: default_path = os.path.expanduser("~/legendary") if not update: - self.install_path_field = PathEdit(text=default_path, type_of_file=QFileDialog.DirectoryOnly) + self.install_path_field = PathEdit(text=default_path, file_type=QFileDialog.DirectoryOnly) self.form.addRow(QLabel("Install directory"), self.install_path_field) if self.core.lgd.config.has_option("Legendary", "max_workers"): diff --git a/rare/components/tabs/games/game_info/__init__.py b/rare/components/tabs/games/game_info/__init__.py index 7b6ad379..1dfb8fd1 100644 --- a/rare/components/tabs/games/game_info/__init__.py +++ b/rare/components/tabs/games/game_info/__init__.py @@ -3,8 +3,7 @@ import os from PyQt5.QtCore import Qt, pyqtSignal from PyQt5.QtGui import QPixmap, QKeyEvent -from PyQt5.QtWidgets import QWidget, QPushButton, QVBoxLayout, QLabel, QHBoxLayout, QTabWidget, QMessageBox, \ - QProgressBar, QStackedWidget, QGroupBox, QScrollArea +from PyQt5.QtWidgets import QWidget, QTabWidget, QMessageBox from qtawesome import icon from custom_legendary.core import LegendaryCore @@ -12,6 +11,7 @@ from custom_legendary.models.game import InstalledGame, Game from rare.components.dialogs.uninstall_dialog import UninstallDialog from rare.components.tabs.games.game_info.dlcs import DlcTab from rare.components.tabs.games.game_info.game_settings import GameSettings +from rare.ui.components.tabs.games.game_info.game_info import Ui_GameInfo from rare.utils import legendary_utils from rare.utils.extra_widgets import SideTabBar from rare.utils.legendary_utils import VerifyThread @@ -56,7 +56,7 @@ class InfoTabs(QTabWidget): self.parent().layout.setCurrentIndex(0) -class GameInfo(QScrollArea): +class GameInfo(QWidget, Ui_GameInfo): igame: InstalledGame game: Game update_list = pyqtSignal() @@ -67,6 +67,7 @@ class GameInfo(QScrollArea): def __init__(self, core: LegendaryCore, parent): super(GameInfo, self).__init__(parent=parent) + self.setupUi(self) self.ratings = {"platinum": self.tr("Platimum"), "gold": self.tr("Gold"), @@ -77,58 +78,14 @@ class GameInfo(QScrollArea): self.widget = QWidget() self.core = core - self.layout = QVBoxLayout() - self.setWidgetResizable(True) - top_layout = QHBoxLayout() + if os.name == "nt": + self.lbl_grade.setVisible(False) + self.grade.setVisible(False) - # No Game at start. Game is set when clicked info - self.image = QLabel() - top_layout.addWidget(self.image) - - right_layout = QVBoxLayout() - self.game_title = QLabel("Error") - self.game_title.setTextInteractionFlags(Qt.TextSelectableByMouse) - right_layout.addWidget(self.game_title) - - self.dev = QLabel("Error") - self.dev.setTextInteractionFlags(Qt.TextSelectableByMouse) - right_layout.addWidget(self.dev) - - self.app_name = QLabel("Error") - self.app_name.setTextInteractionFlags(Qt.TextSelectableByMouse) - right_layout.addWidget(self.app_name) - - if os.name != "nt": - self.grade = QLabel("Error") - right_layout.addWidget(self.grade) - self.grade.setTextInteractionFlags(Qt.TextSelectableByMouse) - - self.version = QLabel("Error") - self.version.setTextInteractionFlags(Qt.TextSelectableByMouse) - right_layout.addWidget(self.version) - - self.install_size = QLabel("Error") - right_layout.addWidget(self.install_size) - - self.install_path = QLabel("Error") - self.install_path.setTextInteractionFlags(Qt.TextSelectableByMouse) - self.install_path.setWordWrap(True) - right_layout.addWidget(self.install_path) - - top_layout.addLayout(right_layout) - top_layout.addStretch() - self.game_actions = GameActions() - - self.game_actions.uninstall_button.clicked.connect(self.uninstall) - self.game_actions.verify_button.clicked.connect(self.verify) - self.game_actions.repair_button.clicked.connect(self.repair) - - self.layout.addLayout(top_layout) - self.layout.addWidget(self.game_actions) - self.layout.addStretch() - self.widget.setLayout(self.layout) - self.setWidget(self.widget) + self.uninstall_button.clicked.connect(self.uninstall) + self.verify_button.clicked.connect(self.verify) + self.repair_button.clicked.connect(self.repair) def uninstall(self): infos = UninstallDialog(self.game).get_information() @@ -147,18 +104,18 @@ class GameInfo(QScrollArea): self.verify_game.emit(self.game.app_name) def verify(self): - self.game_actions.verify_widget.setCurrentIndex(1) + self.verify_widget.setCurrentIndex(1) verify_thread = VerifyThread(self.core, self.game.app_name) verify_thread.status.connect(self.verify_satistics) verify_thread.summary.connect(self.finish_verify) verify_thread.start() - self.game_actions.verify_progress_bar.setValue(0) + self.verify_progress.setValue(0) self.verify_threads[self.game.app_name] = verify_thread def verify_satistics(self, progress): # checked, max, app_name if progress[2] == self.game.app_name: - self.game_actions.verify_progress_bar.setValue(progress[0] * 100 / progress[1]) + self.verify_progress.setValue(progress[0] * 100 / progress[1]) def finish_verify(self, failed): failed, missing, app_name = failed @@ -171,7 +128,7 @@ class GameInfo(QScrollArea): failed, missing), QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes) if ans == QMessageBox.Yes: self.verify_game.emit(self.game.app_name) - self.game_actions.verify_widget.setCurrentIndex(0) + self.verify_widget.setCurrentIndex(0) self.verify_threads.pop(app_name) def update_game(self, app_name): @@ -193,62 +150,23 @@ class GameInfo(QScrollArea): w = 200 pixmap = pixmap.scaled(w, int(w * 4 / 3)) self.image.setPixmap(pixmap) - self.app_name.setText("App name: " + self.game.app_name) - self.version.setText("Version: " + self.game.app_version) - self.dev.setText(self.tr("Developer: ") + self.game.metadata["developer"]) - self.install_size.setText( - self.tr("Install size: ") + get_size(self.igame.install_size)) - self.install_path.setText(self.tr("Install path: ") + self.igame.install_path) + self.app_name.setText(self.game.app_name) + self.version.setText(self.game.app_version) + self.dev.setText(self.game.metadata["developer"]) + self.install_size.setText(get_size(self.igame.install_size)) + self.install_path.setText(self.igame.install_path) if os.name != "nt": - if grade := self.ratings.get(self.grade_table[app_name].get("grade")): - self.grade.setText(self.tr("ProtonDB rating: ") + grade) - else: - self.grade.setText(self.tr("ProtonDB rating: Error")) + try: + grade = self.ratings.get(self.grade_table[app_name].get("grade")) + except KeyError: + grade = (self.tr("Error")) + self.grade.setText(grade) if len(self.verify_threads.keys()) == 0 or not self.verify_threads.get(app_name): - self.game_actions.verify_widget.setCurrentIndex(0) + self.verify_widget.setCurrentIndex(0) elif self.verify_threads.get(app_name): - self.game_actions.verify_widget.setCurrentIndex(1) - self.game_actions.verify_progress_bar.setValue( + self.verify_widget.setCurrentIndex(1) + self.verify_progress.setValue( self.verify_threads[app_name].num / self.verify_threads[app_name].total * 100) - -class GameActions(QGroupBox): - def __init__(self): - super(GameActions, self).__init__() - self.setTitle(f"{self.tr('Game actions')}") - self.setStyleSheet("QGroupBox{font-size: 20px}") - self.layout = QVBoxLayout() - - uninstall_layout = QHBoxLayout() - self.uninstall_game = QLabel(self.tr("Uninstall game")) - uninstall_layout.addWidget(self.uninstall_game) - self.uninstall_button = QPushButton(self.tr("Uninstall")) - self.uninstall_button.setFixedWidth(250) - uninstall_layout.addWidget(self.uninstall_button) - self.layout.addLayout(uninstall_layout) - - verify_layout = QHBoxLayout() - self.verify_game = QLabel(self.tr("Verify Game")) - verify_layout.addWidget(self.verify_game) - self.verify_widget = QStackedWidget() - self.verify_widget.setMaximumHeight(20) - self.verify_widget.setFixedWidth(250) - self.verify_button = QPushButton(self.tr("Verify")) - self.verify_widget.addWidget(self.verify_button) - self.verify_progress_bar = QProgressBar() - self.verify_progress_bar.setMaximum(100) - self.verify_widget.addWidget(self.verify_progress_bar) - verify_layout.addWidget(self.verify_widget) - self.layout.addLayout(verify_layout) - - repair_layout = QHBoxLayout() - repair_info = QLabel(self.tr("Repair Game")) - repair_layout.addWidget(repair_info) - self.repair_button = QPushButton(self.tr("Repair")) - self.repair_button.setFixedWidth(250) - repair_layout.addWidget(self.repair_button) - self.layout.addLayout(repair_layout) - - self.setLayout(self.layout) diff --git a/rare/components/tabs/games/game_info/game_settings.py b/rare/components/tabs/games/game_info/game_settings.py index 062ff766..ddb5e468 100644 --- a/rare/components/tabs/games/game_info/game_settings.py +++ b/rare/components/tabs/games/game_info/game_settings.py @@ -1,17 +1,36 @@ import os from PyQt5.QtCore import QSettings -from PyQt5.QtWidgets import QWidget, QLabel, QVBoxLayout, QComboBox, QFileDialog, QPushButton, QMessageBox, QLineEdit, \ - QScrollArea, QCheckBox +from PyQt5.QtWidgets import QWidget, QFileDialog, QMessageBox from custom_legendary.core import LegendaryCore from custom_legendary.models.game import InstalledGame, Game from rare.components.tabs.settings.linux import LinuxSettings -from rare.components.tabs.settings.settings_widget import SettingsWidget +from rare.ui.components.tabs.games.game_info.game_settings import Ui_GameSettings from rare.utils.extra_widgets import PathEdit -class GameSettings(QScrollArea): +def find_proton_wrappers(): + possible_proton_wrappers = [] + compatibilitytools_dirs = [ + os.path.expanduser("~/.steam/steam/steamapps/common"), + "/usr/share/steam/compatibilitytools.d" + ] + for c in compatibilitytools_dirs: + if os.path.exists(c): + for i in os.listdir(c): + proton = os.path.join(c, i, "proton") + compatibilitytool = os.path.join(c, i, "compatibilitytool.vdf") + toolmanifest = os.path.join(c, i, "toolmanifest.vdf") + if os.path.exists(proton) and (os.path.exists(compatibilitytool) or os.path.exists(toolmanifest)): + wrapper = '"' + proton + '" run' + possible_proton_wrappers.append(wrapper) + if not possible_proton_wrappers: + print("Unable to find any Proton version") + return possible_proton_wrappers + + +class GameSettings(QWidget, Ui_GameSettings): game: Game igame: InstalledGame @@ -20,138 +39,103 @@ class GameSettings(QScrollArea): def __init__(self, core: LegendaryCore, parent): super(GameSettings, self).__init__(parent=parent) + self.setupUi(self) + self.core = core - self.widget = QWidget() self.settings = QSettings() - self.setWidgetResizable(True) - self.layout = QVBoxLayout() - self.title = QLabel("Error") - self.layout.addWidget(self.title) - - self.offline = QComboBox() - self.offline.addItems(["unset", "true", "false"]) - self.offline_widget = SettingsWidget(self.tr("Launch Game offline"), self.offline) - self.offline.currentIndexChanged.connect(lambda x: self.update_combobox(x, "offline")) - - self.skip_update = QComboBox() - self.skip_update.addItems(["unset", "true", "false"]) - self.skip_update_widget = SettingsWidget(self.tr("Skip update check before launching"), self.skip_update) - self.layout.addWidget(self.skip_update_widget) - self.skip_update.currentIndexChanged.connect(lambda x: self.update_combobox(x, "skip_update_check")) - - self.launch_params = QLineEdit("") - self.launch_params.setPlaceholderText(self.tr("Start parameter")) - self.launch_params_accept_button = QPushButton(self.tr("Save")) - self.launch_params_widget = SettingsWidget(self.tr("Launch parameters"), self.launch_params, - self.launch_params_accept_button) - self.layout.addWidget(self.launch_params_widget) - self.launch_params_accept_button.clicked.connect( - lambda: self.save_line_edit("start_params", self.launch_params.text())) - - self.cloud_sync = QCheckBox("Sync with cloud") - self.cloud_sync_widget = SettingsWidget(self.tr("Auto sync with cloud"), self.cloud_sync) - self.layout.addWidget(self.cloud_sync_widget) - self.cloud_sync.stateChanged.connect(lambda: self.settings.setValue(f"{self.game.app_name}/auto_sync_cloud", - self.cloud_sync.isChecked())) - - self.layout.addWidget(self.offline_widget) - - self.wrapper = QLineEdit("") - self.wrapper.setPlaceholderText("Wrapper") - self.wrapper_save_button = QPushButton(self.tr("Save")) - self.wrapper_save_button.clicked.connect(lambda: self.save_line_edit("wrapper", self.wrapper.text())) - self.wrapper_widget = SettingsWidget(self.tr("Wrapper (e.g. optirun)"), self.wrapper, self.wrapper_save_button) - self.layout.addWidget(self.wrapper_widget) + self.offline.currentIndexChanged.connect( + lambda x: self.update_combobox(x, "offline") + ) + self.skip_update.currentIndexChanged.connect( + lambda x: self.update_combobox(x, "skip_update_check") + ) + self.cloud_sync.stateChanged.connect( + lambda: self.settings.setValue(f"{self.game.app_name}/auto_sync_cloud", self.cloud_sync.isChecked()) + ) + self.launch_params.textChanged.connect(lambda: self.launch_params_button.setEnabled(True)) + self.launch_params_button.clicked.connect( + lambda: self.save_line_edit("start_params", self.launch_params.text()) + ) + self.launch_params_button.setEnabled(False) + self.wrapper.textChanged.connect(lambda: self.wrapper_button.setEnabled(True)) + self.wrapper_button.clicked.connect( + lambda: self.save_line_edit("wrapper", self.wrapper.text()) + ) + self.wrapper_button.setEnabled(False) if os.name != "nt": + self.possible_proton_wrappers = find_proton_wrappers() + + self.proton_wrapper.addItems(self.possible_proton_wrappers) + self.proton_wrapper.currentIndexChanged.connect(self.change_proton) + + self.proton_prefix = PathEdit("None", QFileDialog.DirectoryOnly, save_func=self.update_prefix) + self.proton_prefix_layout.addWidget(self.proton_prefix) + self.linux_settings = LinuxAppSettings(core) - self.layout.addWidget(self.linux_settings) - - self.possible_proton_wrappers = [] - try: - for i in os.listdir(os.path.expanduser("~/.steam/steam/steamapps/common")): - if i.startswith("Proton"): - wrapper = '"' + os.path.join(os.path.expanduser("~/.steam/steam/steamapps/common"), i, - "proton") + '" run' - self.possible_proton_wrappers.append(wrapper) - except FileNotFoundError as e: - print("Unable to find any Proton version") - - self.select_proton = QComboBox() - self.select_proton.addItems(["Don't use Proton"] + self.possible_proton_wrappers) - self.select_proton.currentIndexChanged.connect(self.change_proton) - self.select_proton_widget = SettingsWidget(self.tr("Proton Wrapper"), self.select_proton) - self.linux_settings.layout.addWidget(self.select_proton_widget) - - self.proton_prefix = PathEdit("x", QFileDialog.DirectoryOnly) - self.proton_prefix_accept_button = QPushButton(self.tr("Save")) - self.proton_prefix_accept_button.clicked.connect(self.update_prefix) - self.proton_prefix_widget = SettingsWidget(self.tr("Proton prefix"), self.proton_prefix, - self.proton_prefix_accept_button) - self.linux_settings.layout.addWidget(self.proton_prefix_widget) + self.linux_layout.addWidget(self.linux_settings) # startparams, skip_update_check - self.layout.addStretch(1) - self.widget.setLayout(self.layout) - self.setWidget(self.widget) - def save_line_edit(self, option, value): - if value != "": - if not self.game.app_name in self.core.lgd.config.sections(): + if value: + if self.game.app_name not in self.core.lgd.config.sections(): self.core.lgd.config.add_section(self.game.app_name) self.core.lgd.config.set(self.game.app_name, option, value) else: if self.game.app_name in self.core.lgd.config.sections() and self.core.lgd.config.get( - f"{self.game.app_name}", option, fallback="") != "": + f"{self.game.app_name}", option, fallback=None) is not None: self.core.lgd.config.remove_option(self.game.app_name, option) - if not self.core.lgd.config.get(self.game.app_name): + if not self.core.lgd.config[self.game.app_name]: self.core.lgd.config.remove_section(self.game.app_name) self.core.lgd.save_config() + self.sender().setEnabled(False) def update_combobox(self, i, option): if self.change: # remove section - if i == 0: + if i: + if self.game.app_name not in self.core.lgd.config.sections(): + self.core.lgd.config.add_section(self.game.app_name) + if i == 1: + self.core.lgd.config.set(self.game.app_name, option, "true") + if i == 2: + self.core.lgd.config.set(self.game.app_name, option, "false") + else: if self.game.app_name in self.core.lgd.config.sections(): - if self.core.lgd.config.get(f"{self.game.app_name}", option, fallback="") != "": + if self.core.lgd.config.get(f"{self.game.app_name}", option, fallback=False): self.core.lgd.config.remove_option(self.game.app_name, option) - if self.core.lgd.config[self.game.app_name] == {}: + if not self.core.lgd.config[self.game.app_name]: self.core.lgd.config.remove_section(self.game.app_name) - elif i == 1: - self.core.lgd.config.add_section(self.game.app_name) - self.core.lgd.config.set(self.game.app_name, option, "true") - elif i == 2: - self.core.lgd.config.add_section(self.game.app_name) - self.core.lgd.config.set(self.game.app_name, option, "false") self.core.lgd.save_config() def change_proton(self, i): if self.change: # Dont use Proton if i == 0: - self.proton_prefix_widget.setVisible(False) - self.wrapper_widget.setVisible(True) + self.proton_prefix.setEnabled(False) + self.wrapper_widget.setEnabled(True) + self.linux_settings.wine_groupbox.setEnabled(True) if f"{self.game.app_name}" in self.core.lgd.config.sections(): - if self.core.lgd.config.get(f"{self.game.app_name}", "wrapper", fallback="") != "": + if self.core.lgd.config.get(f"{self.game.app_name}", "wrapper", fallback=False): self.core.lgd.config.remove_option(self.game.app_name, "wrapper") - if self.core.lgd.config.get(f"{self.game.app_name}", "no_wine", fallback="") != "": + if self.core.lgd.config.get(f"{self.game.app_name}", "no_wine", fallback=False): self.core.lgd.config.remove_option(self.game.app_name, "no_wine") - if self.core.lgd.config[self.game.app_name] == {}: + if not self.core.lgd.config[self.game.app_name]: self.core.lgd.config.remove_section(self.game.app_name) if f"{self.game.app_name}.env" in self.core.lgd.config.sections(): - if self.core.lgd.config.get(f"{self.game.app_name}.env", "STEAM_COMPAT_DATA_PATH", - fallback="") != "": + if self.core.lgd.config.get(f"{self.game.app_name}.env", "STEAM_COMPAT_DATA_PATH", fallback=False): self.core.lgd.config.remove_option(f"{self.game.app_name}.env", "STEAM_COMPAT_DATA_PATH") - if self.core.lgd.config[self.game.app_name + ".env"] == {}: + if not self.core.lgd.config[self.game.app_name + ".env"]: self.core.lgd.config.remove_section(self.game.app_name + ".env") else: - self.proton_prefix_widget.setVisible(True) - self.wrapper_widget.setVisible(False) + self.proton_prefix.setEnabled(True) + self.wrapper_widget.setEnabled(False) + self.linux_settings.wine_groupbox.setEnabled(False) wrapper = self.possible_proton_wrappers[i - 1] - if not self.game.app_name in self.core.lgd.config.sections(): + if self.game.app_name not in self.core.lgd.config.sections(): self.core.lgd.config[self.game.app_name] = {} - if not self.game.app_name + ".env" in self.core.lgd.config.sections(): + if self.game.app_name + ".env" not in self.core.lgd.config.sections(): self.core.lgd.config[self.game.app_name + ".env"] = {} self.core.lgd.config.set(self.game.app_name, "wrapper", wrapper) self.core.lgd.config.set(self.game.app_name, "no_wine", "true") @@ -160,16 +144,16 @@ class GameSettings(QScrollArea): self.proton_prefix.text_edit.setText(os.path.expanduser("~/.proton")) # Dont use Wine - self.linux_settings.select_wine_exec.setText("") - self.linux_settings.save_setting(self.linux_settings.select_wine_exec, "wine_exec") - self.linux_settings.select_path.text_edit.setText("") - self.linux_settings.save_setting(self.linux_settings.select_path, "wine_prefix") + self.linux_settings.wine_exec.text_edit.setText("") + self.linux_settings.save_setting(self.linux_settings.wine_exec, "wine_exec") + self.linux_settings.wine_prefix.text_edit.setText("") + self.linux_settings.save_setting(self.linux_settings.wine_prefix, "wine_prefix") self.core.lgd.save_config() def update_prefix(self): text = self.proton_prefix.text() - if text == "": + if not text: text = os.path.expanduser("~/.proton") self.proton_prefix.text_edit.setText(text) if not os.path.exists(text): @@ -197,9 +181,9 @@ class GameSettings(QScrollArea): else: self.offline.setCurrentIndex(0) - self.offline_widget.setVisible(True) + self.offline.setEnabled(True) else: - self.offline_widget.setVisible(False) + self.offline.setEnabled(False) skip_update = self.core.lgd.config.get(self.game.app_name, "skip_update_check", fallback="unset") if skip_update == "true": @@ -215,25 +199,25 @@ class GameSettings(QScrollArea): self.title.setText(f"

{self.game.app_title}

") if os.name != "nt": self.linux_settings.update_game(app_name) - self.linux_settings.dxvk_widget.update_settings(app_name) + self.linux_settings.dxvk.update_settings(app_name) proton = self.core.lgd.config.get(f"{app_name}", "wrapper", fallback="").replace('"', "") if proton != "": - self.proton_prefix_widget.setVisible(True) - self.select_proton.setCurrentText(f'"{proton.replace(" run", "")}" run') + self.proton_prefix.setEnabled(True) + self.proton_wrapper.setCurrentText(f'"{proton.replace(" run", "")}" run') proton_prefix = self.core.lgd.config.get(f"{app_name}.env", "STEAM_COMPAT_DATA_PATH", fallback=self.tr( "Please select path for proton prefix")) self.proton_prefix.text_edit.setText(proton_prefix) - self.wrapper_widget.setVisible(False) + self.wrapper_widget.setEnabled(False) else: - self.select_proton.setCurrentIndex(0) - self.proton_prefix_widget.setVisible(False) - self.wrapper_widget.setVisible(True) + self.proton_wrapper.setCurrentIndex(0) + self.proton_prefix.setEnabled(False) + self.wrapper_widget.setEnabled(True) if not self.game.supports_cloud_saves: - self.cloud_sync_widget.setVisible(False) + self.cloud_sync.setEnabled(False) else: - self.cloud_sync_widget.setVisible(True) + self.cloud_sync.setEnabled(True) sync_cloud = self.settings.value(f"{self.game.app_name}/auto_sync_cloud", True, bool) self.cloud_sync.setChecked(sync_cloud) @@ -247,7 +231,7 @@ class LinuxAppSettings(LinuxSettings): def update_game(self, app_name): self.name = app_name - self.select_path.text_edit.setText(self.core.lgd.config.get(self.name, "wine_prefix", fallback="")) - self.select_wine_exec.setText(self.core.lgd.config.get(self.name, "wine_executable", fallback="")) - self.dxvk_widget.name = app_name - self.dxvk_widget.more_settings_widget.name = app_name + self.wine_prefix.text_edit.setText(self.core.lgd.config.get(self.name, "wine_prefix", fallback="")) + self.wine_exec.text_edit.setText(self.core.lgd.config.get(self.name, "wine_executable", fallback="")) + self.dxvk.name = app_name + self.dxvk.more_settings_widget.name = app_name diff --git a/rare/components/tabs/games/import_widget.py b/rare/components/tabs/games/import_widget.py index 0cd15230..93fe9126 100644 --- a/rare/components/tabs/games/import_widget.py +++ b/rare/components/tabs/games/import_widget.py @@ -55,8 +55,7 @@ class ImportWidget(QWidget): self.app_name_input.setLayout(minilayout) self.app_name_input.textChanged.connect(self.app_name_changed) - self.path_edit = PathEdit(os.path.expanduser("~"), QFileDialog.DirectoryOnly) - self.path_edit.text_edit.textChanged.connect(self.path_changed) + self.path_edit = PathEdit(os.path.expanduser("~"), QFileDialog.DirectoryOnly, edit_func=self.path_changed) self.gb_layout.addWidget(self.path_edit) self.gb_layout.addWidget(self.override_app_name_label) diff --git a/rare/components/tabs/settings/about.py b/rare/components/tabs/settings/about.py index 67d33993..446b4ca8 100644 --- a/rare/components/tabs/settings/about.py +++ b/rare/components/tabs/settings/about.py @@ -1,8 +1,9 @@ import webbrowser -from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel, QPushButton +from PyQt5.QtWidgets import QWidget from rare import __version__ +from rare.ui.components.tabs.settings.about import Ui_About from rare.utils.utils import get_latest_version @@ -13,45 +14,27 @@ def versiontuple(v): return tuple((9, 9, 9)) # It is a beta version and newer -class About(QWidget): +class About(QWidget, Ui_About): def __init__(self): super(About, self).__init__() - self.layout = QVBoxLayout() + self.setupUi(self) - self.title = QLabel("

About

") - self.layout.addWidget(self.title) + self.version.setText(__version__) + + self.update_label.setVisible(False) + self.update.setVisible(False) + self.open_browser.setVisible(False) - self.version = QLabel("Version: " + __version__) - self.layout.addWidget(self.version) latest_tag = get_latest_version() self.update_available = versiontuple(latest_tag) > versiontuple(__version__) + + self.update.setText("{} -> {}".format(__version__, latest_tag)) + + self.open_browser.clicked.connect( + lambda: webbrowser.open("https://github.com/Dummerle/Rare/releases/latest")) + if self.update_available: print(f"Update available: {__version__} -> {latest_tag}") - self.update_available = QLabel(self.tr("Update available: {} -> {}").format(__version__, latest_tag)) - self.layout.addWidget(self.update_available) - self.open_browser = QPushButton(self.tr("Download latest release")) - self.layout.addWidget(self.open_browser) - self.open_browser.clicked.connect( - lambda: webbrowser.open("https://github.com/Dummerle/Rare/releases/latest")) - - self.dev = QLabel(self.tr("Developer:") + "Dummerle") - self.dev.setToolTip("Github") - self.dev.setOpenExternalLinks(True) - self.dev.setWordWrap(True) - self.layout.addWidget(self.dev) - self.lgd_dev = QLabel(self.tr("Legendary developer:") + "derrod") - self.lgd_dev.setOpenExternalLinks(True) - self.lgd_dev.setToolTip("Github") - self.layout.addWidget(self.lgd_dev) - self.license = QLabel("License: GNU General Public License v3.0") - self.layout.addWidget(self.license) - self.info_text = QLabel( - self.tr("This is a beta version, so you can get bugs. If you get a bug, please report it by creating a " - "Issue on Github. You can also contact me " - "on Discord (Dummerle#7419). Or you can join the Discord server")) - self.info_text.setWordWrap(True) - self.info_text.setOpenExternalLinks(True) - self.layout.addWidget(self.info_text) - - self.layout.addStretch() - self.setLayout(self.layout) + self.update_label.setVisible(True) + self.update.setVisible(True) + self.open_browser.setVisible(True) diff --git a/rare/components/tabs/settings/dxvk.py b/rare/components/tabs/settings/dxvk.py index 9aae6b8e..59bbd89f 100644 --- a/rare/components/tabs/settings/dxvk.py +++ b/rare/components/tabs/settings/dxvk.py @@ -1,16 +1,102 @@ from logging import getLogger from PyQt5.QtCore import pyqtSignal -from PyQt5.QtWidgets import QWidget, QCheckBox, QVBoxLayout, QWidgetAction, QMenu, QToolButton, QHBoxLayout, QGroupBox +from PyQt5.QtWidgets import QGroupBox +from PyQt5.QtWidgets import QWidget, QCheckBox, QVBoxLayout, QWidgetAction, QMenu, QToolButton, QHBoxLayout from custom_legendary.core import LegendaryCore +from rare.ui.components.tabs.settings.dxvk import Ui_DxvkSettings logger = getLogger("DXVK Settings") +class DxvkSettings(QGroupBox, Ui_DxvkSettings): + + def __init__(self, core: LegendaryCore, name=None): + super(DxvkSettings, self).__init__() + self.setupUi(self) + + self.name = name if name is not None else "default" + self.core = core + + self.dxvk_options_map = { + "devinfo": self.devinfo, + "fps": self.fps, + "frametime": self.frametime, + "memory": self.memory, + "gpuload": self.gpuload, + "version": self.version, + "api": self.api, + } + + self.load_settings() + self.show_dxvk.currentIndexChanged.connect(self.store_settings) + for opt in self.dxvk_options_map: + self.dxvk_options_map[opt].stateChanged.connect(self.store_settings) + + # Show HUD ComboBox + # System Default, index 0, removes DXVK_HUD to use setting from env + # Hidden , index 1, adds DXVK_HUD=0 to override system configuration + # Visible , index 2, adds DXVK_HUD=1 to override system configuration + # Custom Options, index 3, adds DXVK_HUD=devinfo,fps and enables the customization panel + + def load_settings(self): + dxvk_options = self.core.lgd.config.get(f"{self.name}.env", "DXVK_HUD", fallback=None) + self.gb_dxvk_options.setDisabled(True) + if dxvk_options is not None: + if dxvk_options == "0": + self.show_dxvk.setCurrentIndex(1) + elif dxvk_options == "1": + self.show_dxvk.setCurrentIndex(2) + else: + self.show_dxvk.setCurrentIndex(3) + self.gb_dxvk_options.setDisabled(False) + for opt in dxvk_options.split(","): + try: + self.dxvk_options_map[opt].setChecked(True) + except KeyError: + print("Malformed DXVK Option: " + opt) + continue + else: + self.show_dxvk.setCurrentIndex(0) + + def store_settings(self): + show_dxvk_index = self.show_dxvk.currentIndex() + if show_dxvk_index: + if f"{self.name}.env" not in self.core.lgd.config.sections(): + print("add section dxvk") + self.core.lgd.config.add_section(f"{self.name}.env") + if show_dxvk_index == 1: + self.core.lgd.config[f"{self.name}.env"]["DXVK_HUD"] = "0" + if show_dxvk_index == 2: + self.core.lgd.config[f"{self.name}.env"]["DXVK_HUD"] = "1" + if show_dxvk_index == 3: + dxvk_options = [] + for opt in self.dxvk_options_map: + if self.dxvk_options_map[opt].isChecked(): + dxvk_options.append(opt) + if not dxvk_options: + # Check if this is the first activation + stored = self.core.lgd.config.get(f"{self.name}.env", "DXVK_HUD", fallback=None) + if stored not in [None, "0", "1"]: + self.core.lgd.config[f"{self.name}.env"]["DXVK_HUD"] = "0" + else: + dxvk_options = ["devinfo", "fps"] + # Check again if dxvk_options changed due to first activation + if dxvk_options: + self.core.lgd.config[f"{self.name}.env"]["DXVK_HUD"] = ",".join(dxvk_options) + else: + if self.core.lgd.config.get(f"{self.name}.env", "DXVK_HUD", fallback=None) is not None: + self.core.lgd.config.remove_option(f"{self.name}.env", "DXVK_HUD") + if not self.core.lgd.config[f"{self.name}.env"]: + self.core.lgd.config.remove_section(f"{self.name}.env") + self.core.lgd.save_config() + self.load_settings() + + class DxvkWidget(QGroupBox): - def __init__(self, core: LegendaryCore): + def __init__(self, core: LegendaryCore, name=None): super(DxvkWidget, self).__init__() self.core = core self.setObjectName("settings_widget") @@ -23,7 +109,7 @@ class DxvkWidget(QGroupBox): "api": [False, self.tr("D3D Level of application")], "frametime": [False, self.tr("Frame time graph")] } - self.name = "default" + self.name = name self.layout = QVBoxLayout() self.child_layout = QHBoxLayout() self.setTitle(self.tr("dxvk settings")) diff --git a/rare/components/tabs/settings/legendary.py b/rare/components/tabs/settings/legendary.py index 83053709..256aec25 100644 --- a/rare/components/tabs/settings/legendary.py +++ b/rare/components/tabs/settings/legendary.py @@ -1,71 +1,47 @@ from logging import getLogger -from PyQt5.QtCore import Qt -from PyQt5.QtGui import QIntValidator -from PyQt5.QtWidgets import QVBoxLayout, QFileDialog, QPushButton, QLineEdit, QGroupBox, QMessageBox, \ - QScrollArea +from PyQt5.QtWidgets import QFileDialog, QMessageBox, QWidget from custom_legendary.core import LegendaryCore -from rare.components.tabs.settings.settings_widget import SettingsWidget +from rare.ui.components.tabs.settings.legendary import Ui_LegendarySettings from rare.utils.extra_widgets import PathEdit from rare.utils.utils import get_size logger = getLogger("LegendarySettings") -class LegendarySettings(QScrollArea): +class LegendarySettings(QWidget, Ui_LegendarySettings): def __init__(self, core: LegendaryCore): super(LegendarySettings, self).__init__() - self.widget = QGroupBox(self.tr("Legendary settings")) - self.setWidgetResizable(True) - self.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded) - self.layout = QVBoxLayout() + self.setupUi(self) + self.core = core - self.widget.setObjectName("group") # Default installation directory - self.select_path = PathEdit(core.get_default_install_dir(), type_of_file=QFileDialog.DirectoryOnly, - infotext="Default") - self.select_path.text_edit.textChanged.connect(lambda t: self.save_path_button.setDisabled(False)) - self.save_path_button = QPushButton("Save") - self.save_path_button.clicked.connect(self.save_path) - self.install_dir_widget = SettingsWidget(self.tr("Default installation directory"), self.select_path, - self.save_path_button) - self.layout.addWidget(self.install_dir_widget) + self.install_dir = PathEdit(core.get_default_install_dir(), + file_type=QFileDialog.DirectoryOnly, + save_func=self.save_path) + self.layout_install_dir.addWidget(self.install_dir) # Max Workers - self.max_worker_select = QLineEdit(self.core.lgd.config["Legendary"].get("max_workers")) - self.max_worker_select.setValidator(QIntValidator()) - self.max_worker_select.setPlaceholderText("Default") - self.max_worker_select.textChanged.connect(self.max_worker_save) - self.max_worker_widget = SettingsWidget(self.tr("Max workers for Download (Less: slower download)(0: Default)"), - self.max_worker_select) - self.layout.addWidget(self.max_worker_widget) + max_workers = self.core.lgd.config["Legendary"].get("max_workers", fallback=0) + self.max_worker_select.setValue(int(max_workers)) + self.max_worker_select.valueChanged.connect(self.max_worker_save) - # cleanup - self.clean_layout = QVBoxLayout() - self.cleanup_widget = QGroupBox(self.tr("Cleanup")) - self.clean_button = QPushButton(self.tr("Remove everything")) - self.clean_button.clicked.connect(lambda: self.cleanup(False)) - self.clean_layout.addWidget(self.clean_button) - - self.clean_button_without_manifests = QPushButton(self.tr("Clean, but keep manifests")) - self.clean_button_without_manifests.clicked.connect(lambda: self.cleanup(True)) - self.clean_layout.addWidget(self.clean_button_without_manifests) - - self.cleanup_widget.setLayout(self.clean_layout) - self.layout.addWidget(self.cleanup_widget) - - self.layout.addStretch(1) - self.widget.setLayout(self.layout) - self.setWidget(self.widget) + # Cleanup + self.clean_button.clicked.connect( + lambda: self.cleanup(False) + ) + self.clean_button_without_manifests.clicked.connect( + lambda: self.cleanup(True) + ) def save_path(self): - self.core.lgd.config["Legendary"]["install_dir"] = self.select_path.text() - if self.select_path.text() == "" and "install_dir" in self.core.lgd.config["Legendary"].keys(): + self.core.lgd.config["Legendary"]["install_dir"] = self.install_dir.text() + if self.install_dir.text() == "" and "install_dir" in self.core.lgd.config["Legendary"].keys(): self.core.lgd.config["Legendary"].pop("install_dir") else: - logger.info("Set config install_dir to " + self.select_path.text()) + logger.info("Set config install_dir to " + self.install_dir.text()) self.core.lgd.save_config() def max_worker_save(self, num_workers: str): diff --git a/rare/components/tabs/settings/linux.py b/rare/components/tabs/settings/linux.py index 01ea32f3..57109767 100644 --- a/rare/components/tabs/settings/linux.py +++ b/rare/components/tabs/settings/linux.py @@ -1,55 +1,50 @@ from logging import getLogger -from PyQt5.QtWidgets import QVBoxLayout, QPushButton, QFileDialog, QLineEdit, QGroupBox +from PyQt5.QtWidgets import QFileDialog, QWidget from custom_legendary.core import LegendaryCore -from rare.components.tabs.settings.dxvk import DxvkWidget -from rare.components.tabs.settings.settings_widget import SettingsWidget +from rare.components.tabs.settings.dxvk import DxvkSettings, DxvkWidget +from rare.ui.components.tabs.settings.linux import Ui_LinuxSettings from rare.utils.extra_widgets import PathEdit logger = getLogger("LinuxSettings") -class LinuxSettings(QGroupBox): - def __init__(self, core: LegendaryCore, name="default"): +class LinuxSettings(QWidget, Ui_LinuxSettings): + def __init__(self, core: LegendaryCore, name=None): super(LinuxSettings, self).__init__() - self.layout = QVBoxLayout() - self.name = name + self.setupUi(self) + + self.name = name if name is not None else "default" self.core = core - self.setTitle(self.tr("Linux settings")) - self.setObjectName("group") - # Wineprefix - self.select_path = PathEdit(self.core.lgd.config.get(self.name, "wine_prefix", fallback=""), - type_of_file=QFileDialog.DirectoryOnly, - infotext="Default") - self.select_path.text_edit.textChanged.connect(lambda t: self.save_path_button.setDisabled(False)) - self.save_path_button = QPushButton("Save") - self.save_path_button.clicked.connect(lambda: self.save_setting(self.select_path, "wine_prefix")) - self.install_dir_widget = SettingsWidget(self.tr("Default Wine Prefix"), self.select_path, - self.save_path_button) - self.layout.addWidget(self.install_dir_widget) + + # Wine prefix + self.wine_prefix = PathEdit(self.core.lgd.config.get(self.name, "wine_prefix", fallback=""), + file_type=QFileDialog.DirectoryOnly, + save_func=lambda: self.save_setting(self.wine_prefix, "wine_prefix")) + self.prefix_layout.addWidget(self.wine_prefix) # Wine executable - self.select_wine_exec = QLineEdit(self.core.lgd.config.get(self.name, "wine_executable", fallback="")) - self.save_wine_exec = QPushButton("Save") - self.save_wine_exec.clicked.connect(lambda: self.save_setting(self.select_wine_exec, "wine_executable")) - self.install_dir_widget = SettingsWidget(self.tr("Default Wine executable"), self.select_wine_exec, - self.save_wine_exec) - self.layout.addWidget(self.install_dir_widget) + self.wine_exec = PathEdit(self.core.lgd.config.get(self.name, "wine_executable", fallback=""), + file_type=QFileDialog.ExistingFile, + name_filter="Wine executable (wine wine64)", + save_func=lambda: self.save_setting(self.wine_exec, "wine_executable")) + self.exec_layout.addWidget(self.wine_exec) # dxvk - self.dxvk_widget = DxvkWidget(core) - self.layout.addWidget(self.dxvk_widget) - if name == "default": - self.layout.addStretch(1) - self.setLayout(self.layout) + # FIXME: Remove this check when done with per game settings + if name is None: + self.dxvk = DxvkSettings(core, self.name) + else: + self.dxvk = DxvkWidget(core) + self.dxvk_layout.addWidget(self.dxvk) - def save_setting(self, widget: QLineEdit, setting_name: str): - if not self.name in self.core.lgd.config.sections(): + def save_setting(self, widget: PathEdit, setting_name: str): + if self.name not in self.core.lgd.config.sections(): self.core.lgd.config.add_section(self.name) self.core.lgd.config.set(self.name, setting_name, widget.text()) - if widget.text() == "": + if not widget.text(): self.core.lgd.config.remove_option(self.name, setting_name) else: logger.info("Set config of wine_prefix to " + widget.text()) diff --git a/rare/components/tabs/settings/rare.py b/rare/components/tabs/settings/rare.py index 31184b90..e067f142 100644 --- a/rare/components/tabs/settings/rare.py +++ b/rare/components/tabs/settings/rare.py @@ -4,13 +4,13 @@ import subprocess import sys from logging import getLogger -from PyQt5.QtCore import QSettings, Qt -from PyQt5.QtWidgets import QVBoxLayout, QFileDialog, QComboBox, QPushButton, QCheckBox, QGroupBox, QScrollArea +from PyQt5.QtCore import QSettings +from PyQt5.QtWidgets import QFileDialog, QWidget from rare.components.tabs.settings.rpc_settings import RPCSettings -from rare.components.tabs.settings.settings_widget import SettingsWidget +from rare.ui.components.tabs.settings.rare import Ui_RareSettings from rare.utils.extra_widgets import PathEdit -from rare.utils.utils import get_lang, get_possible_langs +from rare.utils.utils import get_lang, get_possible_langs, get_color_schemes, get_style_sheets logger = getLogger("RareSettings") @@ -21,89 +21,130 @@ languages = [ ] -class RareSettings(QScrollArea): +class RareSettings(QWidget, Ui_RareSettings): def __init__(self): super(RareSettings, self).__init__() - self.widget = QGroupBox(self.tr("Rare settings")) - self.widget.setObjectName("group") - self.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded) - self.setWidgetResizable(True) - # (option_name, group_text, checkbox_text, default - self.checkboxes = [ - ("sys_tray", self.tr("Hide to System Tray Icon"), self.tr("Exit to System Tray Icon"), True), - ("auto_update", self.tr("Automatically update Games on startup"), self.tr("Auto updates"), - False), - ("confirm_start", self.tr("Confirm launch of game"), self.tr("Confirm launch of game"), - False), - ("auto_sync_cloud", self.tr("Auto sync with cloud"), self.tr("Sync with cloud"), True), - ("notification", self.tr("Show Notifications after Downloads"), self.tr("Show notification"), - True), - ("save_size", self.tr("Save size of window after restart"), self.tr("Save size"), False) - ] + self.setupUi(self) + + # (widget_name, option_name, default) + self.checkboxes = [ + (self.sys_tray, "sys_tray", True), + (self.auto_update, "auto_update", False), + (self.confirm_start, "confirm_start", False), + (self.auto_sync_cloud, "auto_sync_cloud", True), + (self.notification, "notification", True), + (self.save_size, "save_size", False) + ] - self.layout = QVBoxLayout() self.settings = QSettings() - img_dir = self.settings.value("img_dir", os.path.expanduser("~/.cache/rare/images/"), type=str) + self.img_dir_path = self.settings.value("img_dir", os.path.expanduser("~/.cache/rare/images/"), type=str) language = self.settings.value("language", get_lang(), type=str) - # select Image dir - self.select_path = PathEdit(img_dir, type_of_file=QFileDialog.DirectoryOnly) - self.select_path.text_edit.textChanged.connect(lambda t: self.save_path_button.setDisabled(False)) - self.save_path_button = QPushButton(self.tr("Save")) - self.save_path_button.clicked.connect(self.save_path) - self.img_dir = SettingsWidget(self.tr("Image Directory"), self.select_path, self.save_path_button) - self.layout.addWidget(self.img_dir) + self.logdir = os.path.expanduser("~/.cache/rare/logs") + + # Select Image directory + self.img_dir = PathEdit(self.img_dir_path, file_type=QFileDialog.DirectoryOnly, save_func=self.save_path) + self.img_dir_layout.addWidget(self.img_dir) # Select lang - self.select_lang = QComboBox() - self.select_lang.addItems([i[1] for i in languages]) + self.lang_select.addItems([i[1] for i in languages]) if language in get_possible_langs(): index = [lang[0] for lang in languages].index(language) - self.select_lang.setCurrentIndex(index) + self.lang_select.setCurrentIndex(index) else: - self.select_lang.setCurrentIndex(0) - self.lang_widget = SettingsWidget(self.tr("Language"), self.select_lang) - self.select_lang.currentIndexChanged.connect(self.update_lang) - self.layout.addWidget(self.lang_widget) + self.lang_select.setCurrentIndex(0) + self.lang_select.currentIndexChanged.connect(self.update_lang) + + colors = get_color_schemes() + self.color_select.addItems(colors) + if (color := self.settings.value("color_scheme")) in colors: + self.color_select.setCurrentIndex(self.color_select.findText(color)) + self.color_select.setDisabled(False) + self.style_select.setDisabled(True) + else: + self.color_select.setCurrentIndex(0) + self.color_select.currentIndexChanged.connect(self.on_color_select_changed) + + styles = get_style_sheets() + self.style_select.addItems(styles) + if (style := self.settings.value("style_sheet")) in styles: + self.style_select.setCurrentIndex(self.style_select.findText(style)) + self.style_select.setDisabled(False) + self.color_select.setDisabled(True) + else: + self.style_select.setCurrentIndex(0) + self.style_select.currentIndexChanged.connect(self.on_style_select_changed) + + self.interface_info.setVisible(False) self.rpc = RPCSettings() - self.layout.addWidget(self.rpc) + self.rpc_layout.addWidget(self.rpc) - for option, head_text, text, default in self.checkboxes: - checkbox = SettingsCheckbox(option, text, default) - settings_widget = SettingsWidget(head_text, checkbox) - self.layout.addWidget(settings_widget) + self.init_checkboxes(self.checkboxes) + self.sys_tray.stateChanged.connect( + lambda: self.settings.setValue("sys_tray", self.sys_tray.isChecked()) + ) + self.auto_update.stateChanged.connect( + lambda: self.settings.setValue("auto_update", self.auto_update.isChecked()) + ) + self.confirm_start.stateChanged.connect( + lambda: self.settings.setValue("confirm_start", self.confirm_start.isChecked()) + ) + self.auto_sync_cloud.stateChanged.connect( + lambda: self.settings.setValue("auto_sync_cloud", self.auto_sync_cloud.isChecked()) + ) + self.notification.stateChanged.connect( + lambda: self.settings.setValue("notification", self.notification.isChecked()) + ) + self.save_size.stateChanged.connect( + lambda: self.settings.setValue("save_size", self.save_size.isChecked()) + ) - self.open_log_dir = QPushButton(self.tr("Open Log directory")) - self.layout.addWidget(self.open_log_dir) - self.open_log_dir.clicked.connect(self.open_dir) + self.log_dir_open_button.clicked.connect(self.open_dir) + # TODO: Implement + self.log_dir_clean_button.setVisible(False) + self.log_dir_size_label.setVisible(False) - self.layout.addStretch() - self.widget.setLayout(self.layout) - self.setWidget(self.widget) + def on_color_select_changed(self, color): + if color: + self.style_select.setCurrentIndex(0) + self.style_select.setDisabled(True) + self.settings.setValue("color_scheme", self.color_select.currentText()) + else: + self.settings.remove("color_scheme") + self.style_select.setDisabled(False) + self.interface_info.setVisible(True) + + def on_style_select_changed(self, style): + if style: + self.color_select.setCurrentIndex(0) + self.color_select.setDisabled(True) + self.settings.setValue("style_sheet", self.style_select.currentText()) + else: + self.settings.remove("style_sheet") + self.color_select.setDisabled(False) + self.interface_info.setVisible(True) def open_dir(self): - logdir = os.path.expanduser("~/.cache/rare/logs") if os.name == "nt": - os.startfile(logdir) + os.startfile(self.logdir) else: opener = "open" if sys.platform == "darwin" else "xdg-open" - subprocess.Popen([opener, logdir]) + subprocess.Popen([opener, self.logdir]) def save_window_size(self): self.settings.setValue("save_size", self.save_size.isChecked()) self.settings.remove("window_size") def save_path(self): - self.save_path_button.setDisabled(True) self.update_path() def update_lang(self, i: int): self.settings.setValue("language", languages[i][0]) - self.lang_widget.info_text.setText(self.tr("Restart Application to activate changes")) + self.interface_info.setVisible(True) def update_path(self): - old_path = self.settings.value("img_dir", type=str) - new_path = self.select_path.text() + old_path = self.img_dir_path + new_path = self.img_dir.text() if old_path != new_path: if not os.path.exists(new_path): @@ -115,13 +156,10 @@ class RareSettings(QScrollArea): for i in os.listdir(old_path): shutil.move(os.path.join(old_path, i), os.path.join(new_path, i)) os.rmdir(old_path) + self.img_dir_path = new_path self.settings.setValue("img_dir", new_path) - -class SettingsCheckbox(QCheckBox): - def __init__(self, option, text, default): - super(SettingsCheckbox, self).__init__(text) - self.option = option - self.settings = QSettings() - self.setChecked(self.settings.value(option, default, bool)) - self.stateChanged.connect(lambda: self.settings.setValue(option, self.isChecked())) + def init_checkboxes(self, checkboxes): + for cb in checkboxes: + widget, option, default = cb + widget.setChecked(self.settings.value(option, default, bool)) diff --git a/rare/components/tabs/settings/rpc_settings.py b/rare/components/tabs/settings/rpc_settings.py index 35acb13d..1602f4b5 100644 --- a/rare/components/tabs/settings/rpc_settings.py +++ b/rare/components/tabs/settings/rpc_settings.py @@ -1,40 +1,35 @@ from PyQt5.QtCore import QSettings, pyqtSignal -from PyQt5.QtWidgets import QGroupBox, QCheckBox, QVBoxLayout, QComboBox +from PyQt5.QtWidgets import QGroupBox + +from rare.ui.components.tabs.settings.rpc_settings import Ui_RPCSettings -class RPCSettings(QGroupBox): +class RPCSettings(QGroupBox, Ui_RPCSettings): update_settings = pyqtSignal() def __init__(self): super(RPCSettings, self).__init__() - self.setTitle(self.tr("Discord RPC")) - self.setObjectName("settings_widget") - self.settings = QSettings() - self.layout = QVBoxLayout() + self.setupUi(self) + + self.settings = QSettings() - self.enable = QComboBox() - self.enable_states = [self.tr("Show when playing"), self.tr("Show always"), self.tr("Show never")] - self.enable.addItems(self.enable_states) self.enable.setCurrentIndex(self.settings.value("rpc_enable", 0, int)) - self.layout.addWidget(self.enable) self.enable.currentIndexChanged.connect(self.changed) - self.show_game = QCheckBox(self.tr("Show Game")) self.show_game.setChecked((self.settings.value("rpc_name", True, bool))) - self.layout.addWidget(self.show_game) - self.show_game.stateChanged.connect(lambda: self.settings.setValue("rpc_game", self.show_game.isChecked())) + self.show_game.stateChanged.connect( + lambda: self.settings.setValue("rpc_game", self.show_game.isChecked()) + ) - self.show_os = QCheckBox(self.tr("Show OS")) - self.layout.addWidget(self.show_os) self.show_os.setChecked((self.settings.value("rpc_os", True, bool))) - self.show_os.stateChanged.connect(lambda: self.settings.setValue("rpc_os", self.show_os.isChecked())) + self.show_os.stateChanged.connect( + lambda: self.settings.setValue("rpc_os", self.show_os.isChecked()) + ) - self.show_time = QCheckBox(self.tr("Show Time playing")) - self.layout.addWidget(self.show_time) self.show_time.setChecked((self.settings.value("rpc_time", True, bool))) - self.show_time.stateChanged.connect(lambda: self.settings.setValue("rpc_time", self.show_time.isChecked())) - - self.setLayout(self.layout) + self.show_time.stateChanged.connect( + lambda: self.settings.setValue("rpc_time", self.show_time.isChecked()) + ) def changed(self, i): self.settings.setValue("rpc_enable", i) diff --git a/rare/styles/RareStyle.qss b/rare/styles/RareStyle.qss deleted file mode 100644 index e2b79158..00000000 --- a/rare/styles/RareStyle.qss +++ /dev/null @@ -1,153 +0,0 @@ -QWidget { - background-color: #202225; - color: white; -} - -QLabel { - background-color: transparent; -} - -QTabBar#main_tab_bar { - border-bottom: none; - background-color: #2b2b2c; -} - -QTabBar::tab#main_tab_bar { - border-bottom: none; -} - -QTabBar::tab#main_tab_bar { - border-bottom: none; - padding: 5px -} - -QTabBar::tab:selected#main_tab_bar { - background-color: gray; -} - -QTabBar::tab:hover#main_tab_bar { - border-bottom: 2px solid black; - -} - -QGroupBox { - padding: 4px; - margin: 8px; -} - -QGroupBox#settings_widget { - border: 1px solid gray; - font-size: 13px; - border-radius: 3px; - margin-top: 1ex; - padding-top: 4px; - padding-bottom: 4px; -} - -QGroupBox#game_widget_icon { - border: none; - padding: 0; - margin: 0; -} - -QGroupBox#group { - font-size: 15px; - font-weight: bold; - border: 1px solid white; - margin-top: 10px; - padding: 8px; -} - - -QToolButton { - padding: 6px; -} - - -QPushButton { - border: 1px solid white; - border-radius: 4px; - background-color: #3c3f41; - padding: 3px; -} - -QPushButton:hover { - background-color: #223; -} - -QPushButton::menu-indicator { - subcontrol-position: right center; - subcontrol-origin: padding; - left: -2px; - border-style: none; -} - -QPushButton#menu { - padding: 0px; - margin: 0px; - border-style: none; -} - -QPushButton#menu_button { - background-color: transparent; - border: none; -} - -QPushButton:hover#menu_button { - background-color: #334; -} - -QLineEdit { - border: 1px solid white; -} - -QCheckBox { - color: #F0F0F0; - background-color: none; -} - -QCheckBox::indicator { - -} - - -#list_widget { - border-top: 2px solid white; -} - -QPushButton:hover#installed_menu_button { - background-color: green; -} - -QTabBar::tab#settings_bar { - border-radius: 0; -} - -QTabBar::tab:hover#settings_bar { - border-left: 2px solid white; -} - -QTabBar::tab::selected#settings_bar { - background-color: darkslategrey; -} - -#search_bar { - padding: 3px; - border-radius: 5px; - background-color: #334; -} - -QTabBar::tab:disabled#settings_bar { - color: transparent; - background-color: transparent; -} - -/* -QScrollBar:vertical{ - border: 1px solid white; -} -QScrollBar::handle:vertical{ - background-color: gray; - border-radius: 4px; -} -*/ diff --git a/rare/styles/colors/Numix-Dark.scheme b/rare/styles/colors/Numix-Dark.scheme new file mode 100644 index 00000000..7aa182da --- /dev/null +++ b/rare/styles/colors/Numix-Dark.scheme @@ -0,0 +1,61 @@ +[ColorScheme] +Active\AlternateBase=#2f2f2f +Active\Base=#333333 +Active\BrightText=#ffffff +Active\Button=#525252 +Active\ButtonText=#dddddd +Active\Dark=#333333 +Active\Highlight=#f0544c +Active\HighlightedText=#ffffff +Active\Light=#555555 +Active\Link=#fc6f5d +Active\LinkVisited=#853931 +Active\Mid=#a0a0a4 +Active\Midlight=#e9e7e3 +Active\PlaceholderText=#eeeeee +Active\Shadow=#343434 +Active\Text=#eeeeee +Active\ToolTipBase=#444444 +Active\ToolTipText=#eeeeee +Active\Window=#444444 +Active\WindowText=#dddddd +Disabled\AlternateBase=#2f2f2f +Disabled\Base=#333333 +Disabled\BrightText=#ffffff +Disabled\Button=#525252 +Disabled\ButtonText=#808080 +Disabled\Dark=#333333 +Disabled\Highlight=#f0544c +Disabled\HighlightedText=#808080 +Disabled\Light=#555555 +Disabled\Link=#fc6f5d +Disabled\LinkVisited=#853931 +Disabled\Mid=#a0a0a4 +Disabled\Midlight=#e9e7e3 +Disabled\PlaceholderText=#eeeeee +Disabled\Shadow=#343434 +Disabled\Text=#808080 +Disabled\ToolTipBase=#444444 +Disabled\ToolTipText=#eeeeee +Disabled\Window=#444444 +Disabled\WindowText=#808080 +Inactive\AlternateBase=#2f2f2f +Inactive\Base=#333333 +Inactive\BrightText=#ffffff +Inactive\Button=#525252 +Inactive\ButtonText=#dddddd +Inactive\Dark=#333333 +Inactive\Highlight=#f0544c +Inactive\HighlightedText=#ffffff +Inactive\Light=#555555 +Inactive\Link=#fc6f5d +Inactive\LinkVisited=#853931 +Inactive\Mid=#a0a0a4 +Inactive\Midlight=#e9e7e3 +Inactive\PlaceholderText=#eeeeee +Inactive\Shadow=#343434 +Inactive\Text=#eeeeee +Inactive\ToolTipBase=#444444 +Inactive\ToolTipText=#eeeeee +Inactive\Window=#444444 +Inactive\WindowText=#dddddd diff --git a/rare/styles/colors/Rare.scheme b/rare/styles/colors/Rare.scheme new file mode 100644 index 00000000..1b954210 --- /dev/null +++ b/rare/styles/colors/Rare.scheme @@ -0,0 +1,61 @@ +[ColorScheme] +Active\AlternateBase=#f7f7f7 +Active\Base=#333344 +Active\BrightText=#ffffff +Active\Button=#3c3f41 +Active\ButtonText=#eeeeee +Active\Dark=#9f0910 +Active\Highlight=#2f4f4f +Active\HighlightedText=#eeeeee +Active\Light=#ffffff +Active\Link=#0000ff +Active\LinkVisited=#ff00ff +Active\Mid=#b80e35 +Active\Midlight=#ca0651 +Active\PlaceholderText=#eeeeee +Active\Shadow=#767676 +Active\Text=#eeeeee +Active\ToolTipBase=#ffffdc +Active\ToolTipText=#eeeeee +Active\Window=#202225 +Active\WindowText=#eeeeee +Disabled\AlternateBase=#f7f7f7 +Disabled\Base=#333344 +Disabled\BrightText=#ffffff +Disabled\Button=#3c3f41 +Disabled\ButtonText=#808080 +Disabled\Dark=#9f0910 +Disabled\Highlight=#2f4f4f +Disabled\HighlightedText=#808080 +Disabled\Light=#ffffff +Disabled\Link=#0000ff +Disabled\LinkVisited=#ff00ff +Disabled\Mid=#b80e35 +Disabled\Midlight=#ca0651 +Disabled\PlaceholderText=#eeeeee +Disabled\Shadow=#767676 +Disabled\Text=#808080 +Disabled\ToolTipBase=#ffffdc +Disabled\ToolTipText=#eeeeee +Disabled\Window=#202225 +Disabled\WindowText=#808080 +Inactive\AlternateBase=#f7f7f7 +Inactive\Base=#333344 +Inactive\BrightText=#ffffff +Inactive\Button=#3c3f41 +Inactive\ButtonText=#eeeeee +Inactive\Dark=#9f0910 +Inactive\Highlight=#2f4f4f +Inactive\HighlightedText=#eeeeee +Inactive\Light=#ffffff +Inactive\Link=#0000ff +Inactive\LinkVisited=#ff00ff +Inactive\Mid=#b80e35 +Inactive\Midlight=#ca0651 +Inactive\PlaceholderText=#eeeeee +Inactive\Shadow=#767676 +Inactive\Text=#eeeeee +Inactive\ToolTipBase=#ffffdc +Inactive\ToolTipText=#eeeeee +Inactive\Window=#202225 +Inactive\WindowText=#eeeeee diff --git a/rare/styles/colors/ia_ora.scheme b/rare/styles/colors/ia_ora.scheme new file mode 100644 index 00000000..5fbbc868 --- /dev/null +++ b/rare/styles/colors/ia_ora.scheme @@ -0,0 +1,61 @@ +[ColorScheme] +Active\AlternateBase=#eff3f7 +Active\Base=#eff3f7 +Active\BrightText=#ffffff +Active\Button=#eff3f7 +Active\ButtonText=#000000 +Active\Dark=#c7cbce +Active\Highlight=#4965ae +Active\HighlightedText=#ffffff +Active\Light=#ffffff +Active\Link=#0000ff +Active\LinkVisited=#ff00ff +Active\Mid=#a0a0a4 +Active\Midlight=#e9e7e3 +Active\PlaceholderText=#000000 +Active\Shadow=#b8bbbe +Active\Text=#000000 +Active\ToolTipBase=#ffffdc +Active\ToolTipText=#000000 +Active\Window=#eff3f7 +Active\WindowText=#000000 +Disabled\AlternateBase=#eff3f7 +Disabled\Base=#eff3f7 +Disabled\BrightText=#ffffff +Disabled\Button=#eff3f7 +Disabled\ButtonText=#808080 +Disabled\Dark=#c7cbce +Disabled\Highlight=#4965ae +Disabled\HighlightedText=#808080 +Disabled\Light=#ffffff +Disabled\Link=#0000ff +Disabled\LinkVisited=#ff00ff +Disabled\Mid=#a0a0a4 +Disabled\Midlight=#e9e7e3 +Disabled\PlaceholderText=#000000 +Disabled\Shadow=#b8bbbe +Disabled\Text=#808080 +Disabled\ToolTipBase=#ffffdc +Disabled\ToolTipText=#000000 +Disabled\Window=#eff3f7 +Disabled\WindowText=#808080 +Inactive\AlternateBase=#eff3f7 +Inactive\Base=#eff3f7 +Inactive\BrightText=#ffffff +Inactive\Button=#eff3f7 +Inactive\ButtonText=#000000 +Inactive\Dark=#c7cbce +Inactive\Highlight=#4965ae +Inactive\HighlightedText=#ffffff +Inactive\Light=#ffffff +Inactive\Link=#0000ff +Inactive\LinkVisited=#ff00ff +Inactive\Mid=#a0a0a4 +Inactive\Midlight=#e9e7e3 +Inactive\PlaceholderText=#000000 +Inactive\Shadow=#b8bbbe +Inactive\Text=#000000 +Inactive\ToolTipBase=#ffffdc +Inactive\ToolTipText=#000000 +Inactive\Window=#eff3f7 +Inactive\WindowText=#000000 diff --git a/rare/styles/qss/RareStyle.qss b/rare/styles/qss/RareStyle.qss new file mode 100644 index 00000000..4f110abf --- /dev/null +++ b/rare/styles/qss/RareStyle.qss @@ -0,0 +1,256 @@ +QWidget { + background-color: #202225; + color: #eee; +} + +QLabel { + background-color: transparent; + padding: 4px; +} + +QLineEdit { + border: 1px solid darkslategrey; + border-radius: 2px; + background-color: #334; + padding: 2px; +} + +QScrollBar { + border: 1px solid darkslategrey; + border-radius: 4px; + background-color: #334; + padding: 1px; +} + +QScrollBar::add-line:vertical { + border: none; + background: transparent; + height: 0px; + subcontrol-position: bottom; + subcontrol-origin: margin; +} + +QScrollBar::sub-line:vertical { + border: none; + background: transparent; + height: 0px; + subcontrol-position: top; + subcontrol-origin: margin; +} + +QScrollBar::add-line:horizontal { + border: none; + background: transparent; + height: 0px; + subcontrol-position: right; + subcontrol-origin: margin; +} + +QScrollBar::sub-line:horizontal { + border: none; + background: green; + height: 0px; + subcontrol-position: left; + subcontrol-origin: margin; +} + +QScrollBar::handle{ + border: 1px solid darkslategrey; + background-color: gray; + border-radius: 4px; + min-height: 20px; + min-width: 20px; +} + +QTabBar#main_tab_bar { + border-bottom: none; + background-color: #2b2b2c; +} + +QTabBar::tab#main_tab_bar { + border-bottom: none; +} + +QTabBar::tab#main_tab_bar { + border-bottom: none; + padding: 5px +} + +QTabBar::tab:selected#main_tab_bar { + background-color: gray; +} + +QTabBar::tab:hover#main_tab_bar { + border-bottom: 2px solid black; +} + +QGroupBox { + border: 1px solid gray; + font-size: 13px; + font-weight: bold; + border-radius: 6px; + margin-top: 3ex; + padding-top: 0px; + padding-bottom: 0px; + padding-left: 0px; + padding-right: 0px; +} + +QGroupBox#settings_widget { + border: 1px solid gray; + font-size: 13px; + border-radius: 3px; + margin-top: 1ex; + padding-top: 4px; + padding-bottom: 4px; +} + +QGroupBox#game_widget_icon { + border: none; + padding: 0; + margin: 0; +} + +QGroupBox#group { + font-size: 15px; + font-weight: bold; + border: 1px solid white; + margin-top: 10px; + padding: 8px; +} + + +QToolButton { + border: 1px solid gray; + border-radius: 2px; + background-color: #3c3f41; + padding: 4px; +} + +QToolButton:hover { + background-color: #223; +} + +QPushButton { + border: 1px solid gray; + border-radius: 2px; + background-color: #3c3f41; + padding: 5px; +} + +QPushButton:hover { + background-color: #223; +} + +QPushButton::menu-indicator { + subcontrol-position: right center; + subcontrol-origin: padding; + left: -2px; + border-style: none; +} + +QPushButton#menu { + padding: 0px; + margin: 0px; + border-style: none; +} + +QPushButton#menu_button { + background-color: transparent; + border: none; +} + +QPushButton:hover#menu_button { + background-color: #334; +} + +QRadioButton { + background-color: none; + border-radius: 50%; +} + +QRadioButton::indicator { + border: 1px solid gray; + border-radius: 5%; +} + +QCheckBox { + background-color: none; +} + +QCheckBox::indicator { + border: 1px solid gray; + border-radius: 2px; +} + +QCheckBox::indicator:checked { + width: -20ex; + height: -20ex; + background: #5F5F80; + border-radius: 10px; + +} + +QSpinBox { + border: 1px solid darkslategrey; + border-radius: 2px; + background-color: #334; + padding: 2px; +} + +/* +QCheckBox::indicator { + border: 1px solid gray; +} +*/ + +QComboBox { + border: 1px solid gray; + border-radius: 2px; + background-color: #3c3f41; + padding: 5px; +} + +QComboBox::drop-down { + subcontrol-origin: padding; + subcontrol-position: top right; + width: 15px; +/* + border-left-width: 1px; + border-left-color: darkgray; + border-left-style: solid; +*/ + border-top-right-radius: 3px; + border-bottom-right-radius: 3px; +} + +#list_widget { + border-top: 2px solid white; +} + +QPushButton:hover#installed_menu_button { + background-color: green; +} + +QTabBar::tab#settings_bar { + border-radius: 0; +} + +QTabBar::tab:hover#settings_bar { + border-left: 2px solid white; +} + +QTabBar::tab::selected#settings_bar { + background-color: darkslategrey; +} + +#search_bar { + padding: 3px; + border-radius: 5px; + background-color: #334; +} + +QTabBar::tab:disabled#settings_bar { + color: transparent; + background-color: transparent; +} diff --git a/rare/ui/components/tabs/games/game_info/game_info.py b/rare/ui/components/tabs/games/game_info/game_info.py new file mode 100644 index 00000000..b5bad854 --- /dev/null +++ b/rare/ui/components/tabs/games/game_info/game_info.py @@ -0,0 +1,213 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'game_info.ui' +# +# Created by: PyQt5 UI code generator 5.15.4 +# +# WARNING: Any manual changes made to this file will be lost when pyuic5 is +# run again. Do not edit this file unless you know what you are doing. + + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_GameInfo(object): + def setupUi(self, GameInfo): + GameInfo.setObjectName("GameInfo") + self.layout_game_info = QtWidgets.QGridLayout(GameInfo) + self.layout_game_info.setObjectName("layout_game_info") + self.layout_game_info_form = QtWidgets.QGridLayout() + self.layout_game_info_form.setContentsMargins(6, 6, 6, 6) + self.layout_game_info_form.setSpacing(12) + self.layout_game_info_form.setObjectName("layout_game_info_form") + self.install_size = QtWidgets.QLabel(GameInfo) + self.install_size.setText("error") + self.install_size.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByMouse) + self.install_size.setObjectName("install_size") + self.layout_game_info_form.addWidget(self.install_size, 4, 1, 1, 1) + self.lbl_dev = QtWidgets.QLabel(GameInfo) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.lbl_dev.sizePolicy().hasHeightForWidth()) + self.lbl_dev.setSizePolicy(sizePolicy) + font = QtGui.QFont() + font.setBold(True) + font.setWeight(75) + self.lbl_dev.setFont(font) + self.lbl_dev.setObjectName("lbl_dev") + self.layout_game_info_form.addWidget(self.lbl_dev, 0, 0, 1, 1, QtCore.Qt.AlignRight) + self.version = QtWidgets.QLabel(GameInfo) + self.version.setText("error") + self.version.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByMouse) + self.version.setObjectName("version") + self.layout_game_info_form.addWidget(self.version, 2, 1, 1, 1) + self.lbl_install_path = QtWidgets.QLabel(GameInfo) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.lbl_install_path.sizePolicy().hasHeightForWidth()) + self.lbl_install_path.setSizePolicy(sizePolicy) + font = QtGui.QFont() + font.setBold(True) + font.setWeight(75) + self.lbl_install_path.setFont(font) + self.lbl_install_path.setObjectName("lbl_install_path") + self.layout_game_info_form.addWidget(self.lbl_install_path, 5, 0, 1, 1, QtCore.Qt.AlignRight) + self.lbl_install_size = QtWidgets.QLabel(GameInfo) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.lbl_install_size.sizePolicy().hasHeightForWidth()) + self.lbl_install_size.setSizePolicy(sizePolicy) + font = QtGui.QFont() + font.setBold(True) + font.setWeight(75) + self.lbl_install_size.setFont(font) + self.lbl_install_size.setObjectName("lbl_install_size") + self.layout_game_info_form.addWidget(self.lbl_install_size, 4, 0, 1, 1, QtCore.Qt.AlignRight) + spacerItem = QtWidgets.QSpacerItem(0, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.layout_game_info_form.addItem(spacerItem, 7, 1, 1, 1) + spacerItem1 = QtWidgets.QSpacerItem(20, 0, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + self.layout_game_info_form.addItem(spacerItem1, 7, 0, 1, 1) + self.wg_game_actions = QtWidgets.QWidget(GameInfo) + self.wg_game_actions.setMinimumSize(QtCore.QSize(250, 0)) + self.wg_game_actions.setObjectName("wg_game_actions") + self.layout_game_actions = QtWidgets.QVBoxLayout(self.wg_game_actions) + self.layout_game_actions.setContentsMargins(0, 0, 0, 0) + self.layout_game_actions.setObjectName("layout_game_actions") + self.uninstall_button = QtWidgets.QPushButton(self.wg_game_actions) + self.uninstall_button.setObjectName("uninstall_button") + self.layout_game_actions.addWidget(self.uninstall_button) + self.verify_widget = QtWidgets.QStackedWidget(self.wg_game_actions) + self.verify_widget.setObjectName("verify_widget") + self.page_verify_button = QtWidgets.QWidget() + self.page_verify_button.setObjectName("page_verify_button") + self.layout_verify_button = QtWidgets.QVBoxLayout(self.page_verify_button) + self.layout_verify_button.setContentsMargins(0, 0, 0, 0) + self.layout_verify_button.setSpacing(0) + self.layout_verify_button.setObjectName("layout_verify_button") + self.verify_button = QtWidgets.QPushButton(self.page_verify_button) + self.verify_button.setObjectName("verify_button") + self.layout_verify_button.addWidget(self.verify_button) + self.verify_widget.addWidget(self.page_verify_button) + self.page_verify_progress = QtWidgets.QWidget() + self.page_verify_progress.setObjectName("page_verify_progress") + self.layout_verify_progress = QtWidgets.QVBoxLayout(self.page_verify_progress) + self.layout_verify_progress.setContentsMargins(0, 0, 0, 0) + self.layout_verify_progress.setSpacing(0) + self.layout_verify_progress.setObjectName("layout_verify_progress") + self.verify_progress = QtWidgets.QProgressBar(self.page_verify_progress) + self.verify_progress.setProperty("value", 24) + self.verify_progress.setObjectName("verify_progress") + self.layout_verify_progress.addWidget(self.verify_progress) + self.verify_widget.addWidget(self.page_verify_progress) + self.layout_game_actions.addWidget(self.verify_widget) + self.repair_button = QtWidgets.QPushButton(self.wg_game_actions) + self.repair_button.setObjectName("repair_button") + self.layout_game_actions.addWidget(self.repair_button) + self.layout_game_info_form.addWidget(self.wg_game_actions, 6, 1, 1, 1, QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) + self.lbl_version = QtWidgets.QLabel(GameInfo) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.lbl_version.sizePolicy().hasHeightForWidth()) + self.lbl_version.setSizePolicy(sizePolicy) + font = QtGui.QFont() + font.setBold(True) + font.setWeight(75) + self.lbl_version.setFont(font) + self.lbl_version.setObjectName("lbl_version") + self.layout_game_info_form.addWidget(self.lbl_version, 2, 0, 1, 1, QtCore.Qt.AlignRight) + self.lbl_app_name = QtWidgets.QLabel(GameInfo) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.lbl_app_name.sizePolicy().hasHeightForWidth()) + self.lbl_app_name.setSizePolicy(sizePolicy) + font = QtGui.QFont() + font.setBold(True) + font.setWeight(75) + self.lbl_app_name.setFont(font) + self.lbl_app_name.setObjectName("lbl_app_name") + self.layout_game_info_form.addWidget(self.lbl_app_name, 1, 0, 1, 1, QtCore.Qt.AlignRight) + self.dev = QtWidgets.QLabel(GameInfo) + self.dev.setText("error") + self.dev.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByMouse) + self.dev.setObjectName("dev") + self.layout_game_info_form.addWidget(self.dev, 0, 1, 1, 1) + self.app_name = QtWidgets.QLabel(GameInfo) + self.app_name.setText("error") + self.app_name.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByMouse) + self.app_name.setObjectName("app_name") + self.layout_game_info_form.addWidget(self.app_name, 1, 1, 1, 1) + self.install_path = QtWidgets.QLabel(GameInfo) + self.install_path.setText("error") + self.install_path.setWordWrap(True) + self.install_path.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByMouse) + self.install_path.setObjectName("install_path") + self.layout_game_info_form.addWidget(self.install_path, 5, 1, 1, 1) + self.lbl_game_actions = QtWidgets.QLabel(GameInfo) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.lbl_game_actions.sizePolicy().hasHeightForWidth()) + self.lbl_game_actions.setSizePolicy(sizePolicy) + font = QtGui.QFont() + font.setBold(True) + font.setWeight(75) + self.lbl_game_actions.setFont(font) + self.lbl_game_actions.setObjectName("lbl_game_actions") + self.layout_game_info_form.addWidget(self.lbl_game_actions, 6, 0, 1, 1, QtCore.Qt.AlignRight) + self.lbl_grade = QtWidgets.QLabel(GameInfo) + font = QtGui.QFont() + font.setBold(True) + font.setWeight(75) + self.lbl_grade.setFont(font) + self.lbl_grade.setObjectName("lbl_grade") + self.layout_game_info_form.addWidget(self.lbl_grade, 3, 0, 1, 1, QtCore.Qt.AlignRight) + self.grade = QtWidgets.QLabel(GameInfo) + self.grade.setText("error") + self.grade.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByMouse) + self.grade.setObjectName("grade") + self.layout_game_info_form.addWidget(self.grade, 3, 1, 1, 1) + self.layout_game_info.addLayout(self.layout_game_info_form, 2, 1, 1, 1) + self.image = QtWidgets.QLabel(GameInfo) + self.image.setFrameShape(QtWidgets.QFrame.StyledPanel) + self.image.setFrameShadow(QtWidgets.QFrame.Sunken) + self.image.setText("") + self.image.setObjectName("image") + self.layout_game_info.addWidget(self.image, 2, 0, 1, 1, QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) + self.game_title = QtWidgets.QLabel(GameInfo) + self.game_title.setText("error") + self.game_title.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByMouse) + self.game_title.setObjectName("game_title") + self.layout_game_info.addWidget(self.game_title, 0, 0, 1, 3) + + self.retranslateUi(GameInfo) + self.verify_widget.setCurrentIndex(0) + QtCore.QMetaObject.connectSlotsByName(GameInfo) + + def retranslateUi(self, GameInfo): + _translate = QtCore.QCoreApplication.translate + GameInfo.setWindowTitle(_translate("GameInfo", "Game Info")) + self.lbl_dev.setText(_translate("GameInfo", "Developer")) + self.lbl_install_path.setText(_translate("GameInfo", "Installation Path")) + self.lbl_install_size.setText(_translate("GameInfo", "Installation Size")) + self.uninstall_button.setText(_translate("GameInfo", "Uninstall Game")) + self.verify_button.setText(_translate("GameInfo", "Verify Installation")) + self.repair_button.setText(_translate("GameInfo", "Repair Instalation")) + self.lbl_version.setText(_translate("GameInfo", "Version")) + self.lbl_app_name.setText(_translate("GameInfo", "Application Name")) + self.lbl_game_actions.setText(_translate("GameInfo", "Actions")) + self.lbl_grade.setText(_translate("GameInfo", "ProtonDB Grade")) + + +if __name__ == "__main__": + import sys + app = QtWidgets.QApplication(sys.argv) + GameInfo = QtWidgets.QWidget() + ui = Ui_GameInfo() + ui.setupUi(GameInfo) + GameInfo.show() + sys.exit(app.exec_()) diff --git a/rare/ui/components/tabs/games/game_info/game_info.ui b/rare/ui/components/tabs/games/game_info/game_info.ui new file mode 100644 index 00000000..d20c92fa --- /dev/null +++ b/rare/ui/components/tabs/games/game_info/game_info.ui @@ -0,0 +1,376 @@ + + + GameInfo + + + + 0 + 0 + 436 + 317 + + + + Game Info + + + + + + 6 + + + 6 + + + 6 + + + 6 + + + 12 + + + + + error + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + + 0 + 0 + + + + + 75 + true + + + + Developer + + + + + + + error + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + + 0 + 0 + + + + + 75 + true + + + + Installation Path + + + + + + + + 0 + 0 + + + + + 75 + true + + + + Installation Size + + + + + + + Qt::Horizontal + + + + 0 + 20 + + + + + + + + Qt::Vertical + + + + 20 + 0 + + + + + + + + + 250 + 0 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Uninstall Game + + + + + + + 0 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Verify Installation + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + 24 + + + + + + + + + + + Repair Instalation + + + + + + + + + + + 0 + 0 + + + + + 75 + true + + + + Version + + + + + + + + 0 + 0 + + + + + 75 + true + + + + Application Name + + + + + + + error + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + error + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + error + + + true + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + + 0 + 0 + + + + + 75 + true + + + + Actions + + + + + + + + 75 + true + + + + ProtonDB Grade + + + + + + + error + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + + + QFrame::StyledPanel + + + QFrame::Sunken + + + + + + + + + + error + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + + diff --git a/rare/ui/components/tabs/games/game_info/game_settings.py b/rare/ui/components/tabs/games/game_info/game_settings.py new file mode 100644 index 00000000..bed1ca0c --- /dev/null +++ b/rare/ui/components/tabs/games/game_info/game_settings.py @@ -0,0 +1,153 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'game_settings.ui' +# +# Created by: PyQt5 UI code generator 5.15.4 +# +# WARNING: Any manual changes made to this file will be lost when pyuic5 is +# run again. Do not edit this file unless you know what you are doing. + + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_GameSettings(object): + def setupUi(self, GameSettings): + GameSettings.setObjectName("GameSettings") + self.game_settings_layout = QtWidgets.QVBoxLayout(GameSettings) + self.game_settings_layout.setObjectName("game_settings_layout") + self.title = QtWidgets.QLabel(GameSettings) + self.title.setText("error") + self.title.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByMouse) + self.title.setObjectName("title") + self.game_settings_layout.addWidget(self.title) + self.launch_settings_groupbox = QtWidgets.QGroupBox(GameSettings) + self.launch_settings_groupbox.setObjectName("launch_settings_groupbox") + self.launch_settings_layout = QtWidgets.QGridLayout(self.launch_settings_groupbox) + self.launch_settings_layout.setObjectName("launch_settings_layout") + self.skip_update = QtWidgets.QComboBox(self.launch_settings_groupbox) + self.skip_update.setObjectName("skip_update") + self.skip_update.addItem("") + self.skip_update.addItem("") + self.skip_update.addItem("") + self.launch_settings_layout.addWidget(self.skip_update, 0, 1, 1, 1, QtCore.Qt.AlignLeft) + self.cloud_sync = QtWidgets.QCheckBox(self.launch_settings_groupbox) + self.cloud_sync.setText("") + self.cloud_sync.setObjectName("cloud_sync") + self.launch_settings_layout.addWidget(self.cloud_sync, 2, 1, 1, 1, QtCore.Qt.AlignLeft) + self.launch_params_label = QtWidgets.QLabel(self.launch_settings_groupbox) + self.launch_params_label.setObjectName("launch_params_label") + self.launch_settings_layout.addWidget(self.launch_params_label, 3, 0, 1, 1, QtCore.Qt.AlignRight) + self.wrapper_label = QtWidgets.QLabel(self.launch_settings_groupbox) + self.wrapper_label.setObjectName("wrapper_label") + self.launch_settings_layout.addWidget(self.wrapper_label, 4, 0, 1, 1, QtCore.Qt.AlignRight) + self.skip_update_label = QtWidgets.QLabel(self.launch_settings_groupbox) + self.skip_update_label.setObjectName("skip_update_label") + self.launch_settings_layout.addWidget(self.skip_update_label, 0, 0, 1, 1, QtCore.Qt.AlignRight) + self.wrapper_widget = QtWidgets.QWidget(self.launch_settings_groupbox) + self.wrapper_widget.setObjectName("wrapper_widget") + self.wrapper_layout = QtWidgets.QHBoxLayout(self.wrapper_widget) + self.wrapper_layout.setContentsMargins(0, 0, 0, 0) + self.wrapper_layout.setObjectName("wrapper_layout") + self.wrapper = QtWidgets.QLineEdit(self.wrapper_widget) + self.wrapper.setMinimumSize(QtCore.QSize(400, 0)) + self.wrapper.setObjectName("wrapper") + self.wrapper_layout.addWidget(self.wrapper) + self.wrapper_button = QtWidgets.QPushButton(self.wrapper_widget) + self.wrapper_button.setObjectName("wrapper_button") + self.wrapper_layout.addWidget(self.wrapper_button) + self.launch_settings_layout.addWidget(self.wrapper_widget, 4, 1, 1, 1) + self.offline_label = QtWidgets.QLabel(self.launch_settings_groupbox) + self.offline_label.setObjectName("offline_label") + self.launch_settings_layout.addWidget(self.offline_label, 1, 0, 1, 1, QtCore.Qt.AlignRight) + self.offline = QtWidgets.QComboBox(self.launch_settings_groupbox) + self.offline.setObjectName("offline") + self.offline.addItem("") + self.offline.addItem("") + self.offline.addItem("") + self.launch_settings_layout.addWidget(self.offline, 1, 1, 1, 1, QtCore.Qt.AlignLeft) + self.launch_params_widget = QtWidgets.QWidget(self.launch_settings_groupbox) + self.launch_params_widget.setObjectName("launch_params_widget") + self.launch_params_layout = QtWidgets.QHBoxLayout(self.launch_params_widget) + self.launch_params_layout.setContentsMargins(0, 0, 0, 0) + self.launch_params_layout.setObjectName("launch_params_layout") + self.launch_params = QtWidgets.QLineEdit(self.launch_params_widget) + self.launch_params.setMinimumSize(QtCore.QSize(400, 0)) + self.launch_params.setObjectName("launch_params") + self.launch_params_layout.addWidget(self.launch_params) + self.launch_params_button = QtWidgets.QPushButton(self.launch_params_widget) + self.launch_params_button.setObjectName("launch_params_button") + self.launch_params_layout.addWidget(self.launch_params_button) + self.launch_settings_layout.addWidget(self.launch_params_widget, 3, 1, 1, 1) + self.cloud_sync_label = QtWidgets.QLabel(self.launch_settings_groupbox) + self.cloud_sync_label.setObjectName("cloud_sync_label") + self.launch_settings_layout.addWidget(self.cloud_sync_label, 2, 0, 1, 1, QtCore.Qt.AlignRight) + self.game_settings_layout.addWidget(self.launch_settings_groupbox) + self.proton_groupbox = QtWidgets.QGroupBox(GameSettings) + self.proton_groupbox.setObjectName("proton_groupbox") + self.proton_layout = QtWidgets.QGridLayout(self.proton_groupbox) + self.proton_layout.setObjectName("proton_layout") + self.proton_wrapper = QtWidgets.QComboBox(self.proton_groupbox) + self.proton_wrapper.setObjectName("proton_wrapper") + self.proton_wrapper.addItem("") + self.proton_layout.addWidget(self.proton_wrapper, 0, 1, 1, 1, QtCore.Qt.AlignLeft) + self.proton_wrapper_label = QtWidgets.QLabel(self.proton_groupbox) + self.proton_wrapper_label.setObjectName("proton_wrapper_label") + self.proton_layout.addWidget(self.proton_wrapper_label, 0, 0, 1, 1, QtCore.Qt.AlignRight) + self.proton_prefix_label = QtWidgets.QLabel(self.proton_groupbox) + self.proton_prefix_label.setObjectName("proton_prefix_label") + self.proton_layout.addWidget(self.proton_prefix_label, 1, 0, 1, 1, QtCore.Qt.AlignRight) + spacerItem = QtWidgets.QSpacerItem(20, 0, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Maximum) + self.proton_layout.addItem(spacerItem, 4, 1, 1, 1) + self.proton_prefix_layout = QtWidgets.QVBoxLayout() + self.proton_prefix_layout.setObjectName("proton_prefix_layout") + self.proton_layout.addLayout(self.proton_prefix_layout, 1, 1, 2, 1) + self.proton_prefix_alignment_label = QtWidgets.QLabel(self.proton_groupbox) + self.proton_prefix_alignment_label.setEnabled(False) + self.proton_prefix_alignment_label.setText("") + self.proton_prefix_alignment_label.setObjectName("proton_prefix_alignment_label") + self.proton_layout.addWidget(self.proton_prefix_alignment_label, 2, 0, 1, 1) + self.linux_layout = QtWidgets.QVBoxLayout() + self.linux_layout.setSpacing(0) + self.linux_layout.setObjectName("linux_layout") + self.proton_layout.addLayout(self.linux_layout, 3, 0, 1, 2) + self.game_settings_layout.addWidget(self.proton_groupbox) + spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + self.game_settings_layout.addItem(spacerItem1) + + self.retranslateUi(GameSettings) + QtCore.QMetaObject.connectSlotsByName(GameSettings) + + def retranslateUi(self, GameSettings): + _translate = QtCore.QCoreApplication.translate + GameSettings.setWindowTitle(_translate("GameSettings", "Game Settings")) + self.launch_settings_groupbox.setTitle(_translate("GameSettings", "Launch Settings")) + self.skip_update.setItemText(0, _translate("GameSettings", "Default")) + self.skip_update.setItemText(1, _translate("GameSettings", "Yes")) + self.skip_update.setItemText(2, _translate("GameSettings", "No")) + self.launch_params_label.setText(_translate("GameSettings", "Launch parameters")) + self.wrapper_label.setText(_translate("GameSettings", "Wrapper")) + self.skip_update_label.setText(_translate("GameSettings", "Skip update check")) + self.wrapper.setPlaceholderText(_translate("GameSettings", "e.g. optirun")) + self.wrapper_button.setText(_translate("GameSettings", "Save")) + self.offline_label.setText(_translate("GameSettings", "Offline mode")) + self.offline.setItemText(0, _translate("GameSettings", "Default")) + self.offline.setItemText(1, _translate("GameSettings", "Yes")) + self.offline.setItemText(2, _translate("GameSettings", "No")) + self.launch_params.setPlaceholderText(_translate("GameSettings", "parameters")) + self.launch_params_button.setText(_translate("GameSettings", "Save")) + self.cloud_sync_label.setText(_translate("GameSettings", "Sync with cloud")) + self.proton_groupbox.setTitle(_translate("GameSettings", "Linux Settings")) + self.proton_wrapper.setItemText(0, _translate("GameSettings", "Don\'t use Proton")) + self.proton_wrapper_label.setText(_translate("GameSettings", "Proton")) + self.proton_prefix_label.setText(_translate("GameSettings", "Prefix")) + + +if __name__ == "__main__": + import sys + app = QtWidgets.QApplication(sys.argv) + GameSettings = QtWidgets.QWidget() + ui = Ui_GameSettings() + ui.setupUi(GameSettings) + GameSettings.show() + sys.exit(app.exec_()) diff --git a/rare/ui/components/tabs/games/game_info/game_settings.ui b/rare/ui/components/tabs/games/game_info/game_settings.ui new file mode 100644 index 00000000..b33b20a3 --- /dev/null +++ b/rare/ui/components/tabs/games/game_info/game_settings.ui @@ -0,0 +1,277 @@ + + + GameSettings + + + + 0 + 0 + 759 + 617 + + + + Game Settings + + + + + + error + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + Launch Settings + + + + + + + Default + + + + + Yes + + + + + No + + + + + + + + + + + + + + + Launch parameters + + + + + + + Wrapper + + + + + + + Skip update check + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 400 + 0 + + + + e.g. optirun + + + + + + + Save + + + + + + + + + + Offline mode + + + + + + + + Default + + + + + Yes + + + + + No + + + + + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + + 400 + 0 + + + + parameters + + + + + + + Save + + + + + + + + + + Sync with cloud + + + + + + + + + + Linux Settings + + + + + + + Don't use Proton + + + + + + + + Proton + + + + + + + Prefix + + + + + + + Qt::Vertical + + + QSizePolicy::Maximum + + + + 20 + 0 + + + + + + + + + + + false + + + + + + + + + + 0 + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + diff --git a/rare/ui/components/tabs/settings/about.py b/rare/ui/components/tabs/settings/about.py new file mode 100644 index 00000000..e98ac7f9 --- /dev/null +++ b/rare/ui/components/tabs/settings/about.py @@ -0,0 +1,118 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'about.ui' +# +# Created by: PyQt5 UI code generator 5.15.4 +# +# WARNING: Any manual changes made to this file will be lost when pyuic5 is +# run again. Do not edit this file unless you know what you are doing. + + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_About(object): + def setupUi(self, About): + About.setObjectName("About") + About.resize(499, 396) + self.gridLayout = QtWidgets.QGridLayout(About) + self.gridLayout.setObjectName("gridLayout") + self.open_browser = QtWidgets.QPushButton(About) + self.open_browser.setObjectName("open_browser") + self.gridLayout.addWidget(self.open_browser, 4, 1, 1, 1) + self.version_label = QtWidgets.QLabel(About) + font = QtGui.QFont() + font.setBold(True) + font.setWeight(75) + self.version_label.setFont(font) + self.version_label.setObjectName("version_label") + self.gridLayout.addWidget(self.version_label, 2, 0, 1, 1, QtCore.Qt.AlignRight) + self.license_label = QtWidgets.QLabel(About) + font = QtGui.QFont() + font.setBold(True) + font.setWeight(75) + self.license_label.setFont(font) + self.license_label.setObjectName("license_label") + self.gridLayout.addWidget(self.license_label, 7, 0, 1, 1, QtCore.Qt.AlignRight) + self.lgd_dev_label = QtWidgets.QLabel(About) + font = QtGui.QFont() + font.setBold(True) + font.setWeight(75) + self.lgd_dev_label.setFont(font) + self.lgd_dev_label.setObjectName("lgd_dev_label") + self.gridLayout.addWidget(self.lgd_dev_label, 6, 0, 1, 1, QtCore.Qt.AlignRight) + self.dev = QtWidgets.QLabel(About) + self.dev.setText("Dummerle") + self.dev.setOpenExternalLinks(True) + self.dev.setObjectName("dev") + self.gridLayout.addWidget(self.dev, 5, 1, 1, 1) + self.update_label = QtWidgets.QLabel(About) + font = QtGui.QFont() + font.setBold(True) + font.setWeight(75) + self.update_label.setFont(font) + self.update_label.setObjectName("update_label") + self.gridLayout.addWidget(self.update_label, 3, 0, 1, 1, QtCore.Qt.AlignRight) + self.version = QtWidgets.QLabel(About) + self.version.setText("error") + self.version.setObjectName("version") + self.gridLayout.addWidget(self.version, 2, 1, 1, 1) + self.dev_label = QtWidgets.QLabel(About) + font = QtGui.QFont() + font.setBold(True) + font.setWeight(75) + self.dev_label.setFont(font) + self.dev_label.setObjectName("dev_label") + self.gridLayout.addWidget(self.dev_label, 5, 0, 1, 1, QtCore.Qt.AlignRight) + self.license = QtWidgets.QLabel(About) + self.license.setObjectName("license") + self.gridLayout.addWidget(self.license, 7, 1, 1, 1) + self.update = QtWidgets.QLabel(About) + self.update.setText("error") + self.update.setObjectName("update") + self.gridLayout.addWidget(self.update, 3, 1, 1, 1) + self.lgd_dev = QtWidgets.QLabel(About) + self.lgd_dev.setText("derrod") + self.lgd_dev.setOpenExternalLinks(True) + self.lgd_dev.setObjectName("lgd_dev") + self.gridLayout.addWidget(self.lgd_dev, 6, 1, 1, 1) + self.info_text = QtWidgets.QLabel(About) + self.info_text.setWordWrap(True) + self.info_text.setOpenExternalLinks(True) + self.info_text.setObjectName("info_text") + self.gridLayout.addWidget(self.info_text, 14, 0, 1, 3) + spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + self.gridLayout.addItem(spacerItem, 15, 0, 1, 3) + self.title = QtWidgets.QLabel(About) + self.title.setObjectName("title") + self.gridLayout.addWidget(self.title, 1, 0, 1, 3) + spacerItem1 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.gridLayout.addItem(spacerItem1, 2, 2, 6, 1) + + self.retranslateUi(About) + QtCore.QMetaObject.connectSlotsByName(About) + + def retranslateUi(self, About): + _translate = QtCore.QCoreApplication.translate + About.setWindowTitle(_translate("About", "About")) + self.open_browser.setText(_translate("About", "Download latest release")) + self.version_label.setText(_translate("About", "Version")) + self.license_label.setText(_translate("About", "License")) + self.lgd_dev_label.setText(_translate("About", "Legendary Developer")) + self.dev.setToolTip(_translate("About", "Github")) + self.update_label.setText(_translate("About", "Update available")) + self.dev_label.setText(_translate("About", "Rare Developer")) + self.license.setText(_translate("About", "GNU General Public License v3.0")) + self.lgd_dev.setToolTip(_translate("About", "Github")) + self.info_text.setText(_translate("About", "This is a beta version, so you can get bugs. If you get a bug, please report it by creating an Issue on Github. You can also contact me on Discord (Dummerle#7419). Or you can join the Discord server")) + self.title.setText(_translate("About", "

About

")) + + +if __name__ == "__main__": + import sys + app = QtWidgets.QApplication(sys.argv) + About = QtWidgets.QWidget() + ui = Ui_About() + ui.setupUi(About) + About.show() + sys.exit(app.exec_()) diff --git a/rare/ui/components/tabs/settings/about.ui b/rare/ui/components/tabs/settings/about.ui new file mode 100644 index 00000000..eb21f288 --- /dev/null +++ b/rare/ui/components/tabs/settings/about.ui @@ -0,0 +1,186 @@ + + + About + + + + 0 + 0 + 499 + 396 + + + + About + + + + + + Download latest release + + + + + + + + 75 + true + + + + Version + + + + + + + + 75 + true + + + + License + + + + + + + + 75 + true + + + + Legendary Developer + + + + + + + Github + + + <a href='https://github.com/Dummerle'>Dummerle</a> + + + true + + + + + + + + 75 + true + + + + Update available + + + + + + + error + + + + + + + + 75 + true + + + + Rare Developer + + + + + + + GNU General Public License v3.0 + + + + + + + error + + + + + + + Github + + + <a href='https://github.com/derrod/'>derrod</a> + + + true + + + + + + + This is a beta version, so you can get bugs. If you get a bug, please report it by creating an Issue on <a href='https://github.com/Dummerle/Rare/issues'>Github</a>. You can also contact me on Discord (Dummerle#7419). Or you can join the <a href='https://discord.gg/YvmABK9YSk'>Discord server</a> + + + true + + + true + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + <h2>About</h2> + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + diff --git a/rare/ui/components/tabs/settings/dxvk.py b/rare/ui/components/tabs/settings/dxvk.py new file mode 100644 index 00000000..56b0f335 --- /dev/null +++ b/rare/ui/components/tabs/settings/dxvk.py @@ -0,0 +1,97 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'dxvk.ui' +# +# Created by: PyQt5 UI code generator 5.15.4 +# +# WARNING: Any manual changes made to this file will be lost when pyuic5 is +# run again. Do not edit this file unless you know what you are doing. + + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_DxvkSettings(object): + def setupUi(self, DxvkSettings): + DxvkSettings.setObjectName("DxvkSettings") + self.gridLayout = QtWidgets.QGridLayout(DxvkSettings) + self.gridLayout.setObjectName("gridLayout") + self.gb_dxvk_options = QtWidgets.QGroupBox(DxvkSettings) + self.gb_dxvk_options.setObjectName("gb_dxvk_options") + self.layout_dxvk_options = QtWidgets.QGridLayout(self.gb_dxvk_options) + self.layout_dxvk_options.setObjectName("layout_dxvk_options") + self.version = QtWidgets.QCheckBox(self.gb_dxvk_options) + self.version.setObjectName("version") + self.layout_dxvk_options.addWidget(self.version, 0, 2, 1, 1) + self.fps = QtWidgets.QCheckBox(self.gb_dxvk_options) + self.fps.setObjectName("fps") + self.layout_dxvk_options.addWidget(self.fps, 1, 0, 1, 1) + self.memory = QtWidgets.QCheckBox(self.gb_dxvk_options) + self.memory.setObjectName("memory") + self.layout_dxvk_options.addWidget(self.memory, 0, 1, 1, 1) + self.devinfo = QtWidgets.QCheckBox(self.gb_dxvk_options) + self.devinfo.setObjectName("devinfo") + self.layout_dxvk_options.addWidget(self.devinfo, 0, 0, 1, 1) + self.gpuload = QtWidgets.QCheckBox(self.gb_dxvk_options) + self.gpuload.setObjectName("gpuload") + self.layout_dxvk_options.addWidget(self.gpuload, 1, 1, 1, 1) + self.frametime = QtWidgets.QCheckBox(self.gb_dxvk_options) + self.frametime.setObjectName("frametime") + self.layout_dxvk_options.addWidget(self.frametime, 2, 0, 1, 1) + spacerItem = QtWidgets.QSpacerItem(0, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.layout_dxvk_options.addItem(spacerItem, 0, 3, 3, 1) + self.api = QtWidgets.QCheckBox(self.gb_dxvk_options) + self.api.setObjectName("api") + self.layout_dxvk_options.addWidget(self.api, 1, 2, 1, 1) + self.gridLayout.addWidget(self.gb_dxvk_options, 2, 0, 1, 3) + self.lbl_show_dxvk = QtWidgets.QLabel(DxvkSettings) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.lbl_show_dxvk.sizePolicy().hasHeightForWidth()) + self.lbl_show_dxvk.setSizePolicy(sizePolicy) + self.lbl_show_dxvk.setObjectName("lbl_show_dxvk") + self.gridLayout.addWidget(self.lbl_show_dxvk, 0, 0, 1, 1) + self.show_dxvk = QtWidgets.QComboBox(DxvkSettings) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.show_dxvk.sizePolicy().hasHeightForWidth()) + self.show_dxvk.setSizePolicy(sizePolicy) + self.show_dxvk.setObjectName("show_dxvk") + self.show_dxvk.addItem("") + self.show_dxvk.addItem("") + self.show_dxvk.addItem("") + self.show_dxvk.addItem("") + self.gridLayout.addWidget(self.show_dxvk, 0, 1, 1, 2) + + self.retranslateUi(DxvkSettings) + QtCore.QMetaObject.connectSlotsByName(DxvkSettings) + + def retranslateUi(self, DxvkSettings): + _translate = QtCore.QCoreApplication.translate + DxvkSettings.setWindowTitle(_translate("DxvkSettings", "DxvkSettings")) + DxvkSettings.setTitle(_translate("DxvkSettings", "DXVK Settings")) + self.gb_dxvk_options.setTitle(_translate("DxvkSettings", "DXVK HUD Options")) + self.version.setText(_translate("DxvkSettings", "DXVK Version")) + self.fps.setText(_translate("DxvkSettings", "FPS")) + self.memory.setText(_translate("DxvkSettings", "Memory Usage")) + self.devinfo.setText(_translate("DxvkSettings", "Device Info")) + self.gpuload.setText(_translate("DxvkSettings", "GPU Usage")) + self.frametime.setText(_translate("DxvkSettings", "Frame Time graph")) + self.api.setText(_translate("DxvkSettings", "D3D Version")) + self.lbl_show_dxvk.setText(_translate("DxvkSettings", "Show HUD")) + self.show_dxvk.setItemText(0, _translate("DxvkSettings", "System Default")) + self.show_dxvk.setItemText(1, _translate("DxvkSettings", "Hidden")) + self.show_dxvk.setItemText(2, _translate("DxvkSettings", "Visible")) + self.show_dxvk.setItemText(3, _translate("DxvkSettings", "Custom Options")) + + +if __name__ == "__main__": + import sys + app = QtWidgets.QApplication(sys.argv) + DxvkSettings = QtWidgets.QGroupBox() + ui = Ui_DxvkSettings() + ui.setupUi(DxvkSettings) + DxvkSettings.show() + sys.exit(app.exec_()) diff --git a/rare/ui/components/tabs/settings/dxvk.ui b/rare/ui/components/tabs/settings/dxvk.ui new file mode 100644 index 00000000..dfa9eceb --- /dev/null +++ b/rare/ui/components/tabs/settings/dxvk.ui @@ -0,0 +1,138 @@ + + + DxvkSettings + + + + 0 + 0 + 419 + 185 + + + + DxvkSettings + + + DXVK Settings + + + + + + DXVK HUD Options + + + + + + DXVK Version + + + + + + + FPS + + + + + + + Memory Usage + + + + + + + Device Info + + + + + + + GPU Usage + + + + + + + Frame Time graph + + + + + + + Qt::Horizontal + + + + 0 + 20 + + + + + + + + D3D Version + + + + + + + + + + + 0 + 0 + + + + Show HUD + + + + + + + + 0 + 0 + + + + + System Default + + + + + Hidden + + + + + Visible + + + + + Custom Options + + + + + + + + + diff --git a/rare/ui/components/tabs/settings/legendary.py b/rare/ui/components/tabs/settings/legendary.py new file mode 100644 index 00000000..c2a0c8c8 --- /dev/null +++ b/rare/ui/components/tabs/settings/legendary.py @@ -0,0 +1,85 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'legendary.ui' +# +# Created by: PyQt5 UI code generator 5.15.4 +# +# WARNING: Any manual changes made to this file will be lost when pyuic5 is +# run again. Do not edit this file unless you know what you are doing. + + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_LegendarySettings(object): + def setupUi(self, LegendarySettings): + LegendarySettings.setObjectName("LegendarySettings") + LegendarySettings.resize(647, 476) + self.layout_legendary = QtWidgets.QGridLayout(LegendarySettings) + self.layout_legendary.setObjectName("layout_legendary") + self.gb_install_dir = QtWidgets.QGroupBox(LegendarySettings) + self.gb_install_dir.setObjectName("gb_install_dir") + self.layout_install_dir = QtWidgets.QVBoxLayout(self.gb_install_dir) + self.layout_install_dir.setObjectName("layout_install_dir") + self.layout_legendary.addWidget(self.gb_install_dir, 0, 0, 1, 1) + self.gb_downloads = QtWidgets.QGroupBox(LegendarySettings) + self.gb_downloads.setObjectName("gb_downloads") + self.layout_downloads = QtWidgets.QGridLayout(self.gb_downloads) + self.layout_downloads.setObjectName("layout_downloads") + self.lbl_max_workers = QtWidgets.QLabel(self.gb_downloads) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.lbl_max_workers.sizePolicy().hasHeightForWidth()) + self.lbl_max_workers.setSizePolicy(sizePolicy) + self.lbl_max_workers.setObjectName("lbl_max_workers") + self.layout_downloads.addWidget(self.lbl_max_workers, 0, 0, 1, 1, QtCore.Qt.AlignRight) + spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.layout_downloads.addItem(spacerItem, 0, 3, 1, 1) + self.max_worker_select = QtWidgets.QSpinBox(self.gb_downloads) + self.max_worker_select.setObjectName("max_worker_select") + self.layout_downloads.addWidget(self.max_worker_select, 0, 1, 1, 1) + self.lbl_max_workers_info = QtWidgets.QLabel(self.gb_downloads) + font = QtGui.QFont() + font.setItalic(True) + self.lbl_max_workers_info.setFont(font) + self.lbl_max_workers_info.setObjectName("lbl_max_workers_info") + self.layout_downloads.addWidget(self.lbl_max_workers_info, 0, 2, 1, 1) + self.layout_legendary.addWidget(self.gb_downloads, 1, 0, 1, 1) + spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + self.layout_legendary.addItem(spacerItem1, 2, 0, 1, 2) + self.gb_clean = QtWidgets.QGroupBox(LegendarySettings) + self.gb_clean.setObjectName("gb_clean") + self.layout_clean = QtWidgets.QVBoxLayout(self.gb_clean) + self.layout_clean.setObjectName("layout_clean") + self.clean_button_without_manifests = QtWidgets.QPushButton(self.gb_clean) + self.clean_button_without_manifests.setObjectName("clean_button_without_manifests") + self.layout_clean.addWidget(self.clean_button_without_manifests) + self.clean_button = QtWidgets.QPushButton(self.gb_clean) + self.clean_button.setObjectName("clean_button") + self.layout_clean.addWidget(self.clean_button) + self.layout_legendary.addWidget(self.gb_clean, 0, 1, 1, 1) + + self.retranslateUi(LegendarySettings) + QtCore.QMetaObject.connectSlotsByName(LegendarySettings) + + def retranslateUi(self, LegendarySettings): + _translate = QtCore.QCoreApplication.translate + LegendarySettings.setWindowTitle(_translate("LegendarySettings", "LegendarySettings")) + self.gb_install_dir.setTitle(_translate("LegendarySettings", "Default Installation Directory")) + self.gb_downloads.setTitle(_translate("LegendarySettings", "Download Settings")) + self.lbl_max_workers.setText(_translate("LegendarySettings", "Max Workers")) + self.lbl_max_workers_info.setText(_translate("LegendarySettings", "Less is slower (0: Default)")) + self.gb_clean.setTitle(_translate("LegendarySettings", "Cleanup")) + self.clean_button_without_manifests.setText(_translate("LegendarySettings", "Clean, but keep manifests")) + self.clean_button.setText(_translate("LegendarySettings", "Remove everything")) + + +if __name__ == "__main__": + import sys + app = QtWidgets.QApplication(sys.argv) + LegendarySettings = QtWidgets.QWidget() + ui = Ui_LegendarySettings() + ui.setupUi(LegendarySettings) + LegendarySettings.show() + sys.exit(app.exec_()) diff --git a/rare/ui/components/tabs/settings/legendary.ui b/rare/ui/components/tabs/settings/legendary.ui new file mode 100644 index 00000000..50481a31 --- /dev/null +++ b/rare/ui/components/tabs/settings/legendary.ui @@ -0,0 +1,115 @@ + + + LegendarySettings + + + + 0 + 0 + 647 + 476 + + + + LegendarySettings + + + + + + Default Installation Directory + + + + + + + + Download Settings + + + + + + + 0 + 0 + + + + Max Workers + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + true + + + + Less is slower (0: Default) + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Cleanup + + + + + + Clean, but keep manifests + + + + + + + Remove everything + + + + + + + + + + + diff --git a/rare/ui/components/tabs/settings/linux.py b/rare/ui/components/tabs/settings/linux.py new file mode 100644 index 00000000..4c23dec1 --- /dev/null +++ b/rare/ui/components/tabs/settings/linux.py @@ -0,0 +1,71 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'linux.ui' +# +# Created by: PyQt5 UI code generator 5.15.4 +# +# WARNING: Any manual changes made to this file will be lost when pyuic5 is +# run again. Do not edit this file unless you know what you are doing. + + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_LinuxSettings(object): + def setupUi(self, LinuxSettings): + LinuxSettings.setObjectName("LinuxSettings") + LinuxSettings.resize(569, 454) + self.linux_layout = QtWidgets.QGridLayout(LinuxSettings) + self.linux_layout.setObjectName("linux_layout") + spacerItem = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + self.linux_layout.addItem(spacerItem, 3, 0, 1, 1) + self.wine_groupbox = QtWidgets.QGroupBox(LinuxSettings) + self.wine_groupbox.setObjectName("wine_groupbox") + self.wine_layout = QtWidgets.QGridLayout(self.wine_groupbox) + self.wine_layout.setObjectName("wine_layout") + self.exec_label = QtWidgets.QLabel(self.wine_groupbox) + self.exec_label.setObjectName("exec_label") + self.wine_layout.addWidget(self.exec_label, 2, 0, 1, 1, QtCore.Qt.AlignRight) + self.prefix_label = QtWidgets.QLabel(self.wine_groupbox) + self.prefix_label.setObjectName("prefix_label") + self.wine_layout.addWidget(self.prefix_label, 0, 0, 1, 1, QtCore.Qt.AlignRight) + self.prefix_alignment_label = QtWidgets.QLabel(self.wine_groupbox) + self.prefix_alignment_label.setEnabled(False) + self.prefix_alignment_label.setText("") + self.prefix_alignment_label.setObjectName("prefix_alignment_label") + self.wine_layout.addWidget(self.prefix_alignment_label, 1, 0, 1, 1) + self.exec_alignment_label = QtWidgets.QLabel(self.wine_groupbox) + self.exec_alignment_label.setEnabled(False) + self.exec_alignment_label.setText("") + self.exec_alignment_label.setObjectName("exec_alignment_label") + self.wine_layout.addWidget(self.exec_alignment_label, 3, 0, 1, 1) + self.prefix_layout = QtWidgets.QVBoxLayout() + self.prefix_layout.setObjectName("prefix_layout") + self.wine_layout.addLayout(self.prefix_layout, 0, 1, 2, 1) + self.exec_layout = QtWidgets.QVBoxLayout() + self.exec_layout.setObjectName("exec_layout") + self.wine_layout.addLayout(self.exec_layout, 2, 1, 2, 1) + self.linux_layout.addWidget(self.wine_groupbox, 0, 0, 1, 1) + self.dxvk_layout = QtWidgets.QVBoxLayout() + self.dxvk_layout.setObjectName("dxvk_layout") + self.linux_layout.addLayout(self.dxvk_layout, 1, 0, 1, 1) + + self.retranslateUi(LinuxSettings) + QtCore.QMetaObject.connectSlotsByName(LinuxSettings) + + def retranslateUi(self, LinuxSettings): + _translate = QtCore.QCoreApplication.translate + LinuxSettings.setWindowTitle(_translate("LinuxSettings", "LinuxSettings")) + self.wine_groupbox.setTitle(_translate("LinuxSettings", "Wine Settings")) + self.exec_label.setText(_translate("LinuxSettings", "Executable")) + self.prefix_label.setText(_translate("LinuxSettings", "Prefix")) + + +if __name__ == "__main__": + import sys + app = QtWidgets.QApplication(sys.argv) + LinuxSettings = QtWidgets.QWidget() + ui = Ui_LinuxSettings() + ui.setupUi(LinuxSettings) + LinuxSettings.show() + sys.exit(app.exec_()) diff --git a/rare/ui/components/tabs/settings/linux.ui b/rare/ui/components/tabs/settings/linux.ui new file mode 100644 index 00000000..4cee6742 --- /dev/null +++ b/rare/ui/components/tabs/settings/linux.ui @@ -0,0 +1,86 @@ + + + LinuxSettings + + + + 0 + 0 + 569 + 454 + + + + LinuxSettings + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Wine Settings + + + + + + Executable + + + + + + + Prefix + + + + + + + false + + + + + + + + + + false + + + + + + + + + + + + + + + + + + + + + + + diff --git a/rare/ui/components/tabs/settings/rare.py b/rare/ui/components/tabs/settings/rare.py new file mode 100644 index 00000000..12ee9ddd --- /dev/null +++ b/rare/ui/components/tabs/settings/rare.py @@ -0,0 +1,141 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'rare.ui' +# +# Created by: PyQt5 UI code generator 5.15.4 +# +# WARNING: Any manual changes made to this file will be lost when pyuic5 is +# run again. Do not edit this file unless you know what you are doing. + + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_RareSettings(object): + def setupUi(self, RareSettings): + RareSettings.setObjectName("RareSettings") + self.rare_layout = QtWidgets.QGridLayout(RareSettings) + self.rare_layout.setObjectName("rare_layout") + self.rpc_layout = QtWidgets.QVBoxLayout() + self.rpc_layout.setObjectName("rpc_layout") + self.rare_layout.addLayout(self.rpc_layout, 1, 2, 1, 1) + self.img_dir_group = QtWidgets.QGroupBox(RareSettings) + self.img_dir_group.setObjectName("img_dir_group") + self.img_dir_layout = QtWidgets.QVBoxLayout(self.img_dir_group) + self.img_dir_layout.setObjectName("img_dir_layout") + self.rare_layout.addWidget(self.img_dir_group, 0, 0, 1, 2, QtCore.Qt.AlignTop) + self.interface_group = QtWidgets.QGroupBox(RareSettings) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.interface_group.sizePolicy().hasHeightForWidth()) + self.interface_group.setSizePolicy(sizePolicy) + self.interface_group.setObjectName("interface_group") + self.interface_layout = QtWidgets.QGridLayout(self.interface_group) + self.interface_layout.setObjectName("interface_layout") + self.lang_label = QtWidgets.QLabel(self.interface_group) + self.lang_label.setObjectName("lang_label") + self.interface_layout.addWidget(self.lang_label, 0, 1, 1, 1, QtCore.Qt.AlignRight) + self.style_label = QtWidgets.QLabel(self.interface_group) + self.style_label.setObjectName("style_label") + self.interface_layout.addWidget(self.style_label, 2, 1, 1, 1, QtCore.Qt.AlignRight) + self.color_label = QtWidgets.QLabel(self.interface_group) + self.color_label.setObjectName("color_label") + self.interface_layout.addWidget(self.color_label, 1, 1, 1, 1, QtCore.Qt.AlignRight) + self.lang_select = QtWidgets.QComboBox(self.interface_group) + self.lang_select.setObjectName("lang_select") + self.interface_layout.addWidget(self.lang_select, 0, 2, 1, 1) + self.interface_info = QtWidgets.QLabel(self.interface_group) + font = QtGui.QFont() + font.setItalic(True) + self.interface_info.setFont(font) + self.interface_info.setWordWrap(True) + self.interface_info.setObjectName("interface_info") + self.interface_layout.addWidget(self.interface_info, 3, 0, 1, 4) + self.style_select = QtWidgets.QComboBox(self.interface_group) + self.style_select.setObjectName("style_select") + self.style_select.addItem("") + self.interface_layout.addWidget(self.style_select, 2, 2, 1, 1) + self.color_select = QtWidgets.QComboBox(self.interface_group) + self.color_select.setObjectName("color_select") + self.color_select.addItem("") + self.interface_layout.addWidget(self.color_select, 1, 2, 1, 1) + self.rare_layout.addWidget(self.interface_group, 1, 0, 1, 1, QtCore.Qt.AlignTop) + self.settings_group = QtWidgets.QGroupBox(RareSettings) + self.settings_group.setObjectName("settings_group") + self.behaviour_layout = QtWidgets.QGridLayout(self.settings_group) + self.behaviour_layout.setObjectName("behaviour_layout") + self.auto_sync_cloud = QtWidgets.QCheckBox(self.settings_group) + self.auto_sync_cloud.setObjectName("auto_sync_cloud") + self.behaviour_layout.addWidget(self.auto_sync_cloud, 3, 0, 1, 1) + self.auto_update = QtWidgets.QCheckBox(self.settings_group) + self.auto_update.setObjectName("auto_update") + self.behaviour_layout.addWidget(self.auto_update, 1, 0, 1, 1) + self.confirm_start = QtWidgets.QCheckBox(self.settings_group) + self.confirm_start.setObjectName("confirm_start") + self.behaviour_layout.addWidget(self.confirm_start, 2, 0, 1, 1) + self.sys_tray = QtWidgets.QCheckBox(self.settings_group) + self.sys_tray.setObjectName("sys_tray") + self.behaviour_layout.addWidget(self.sys_tray, 0, 0, 1, 1) + spacerItem = QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.behaviour_layout.addItem(spacerItem, 0, 2, 4, 1) + self.notification = QtWidgets.QCheckBox(self.settings_group) + self.notification.setObjectName("notification") + self.behaviour_layout.addWidget(self.notification, 0, 1, 1, 1) + self.save_size = QtWidgets.QCheckBox(self.settings_group) + self.save_size.setObjectName("save_size") + self.behaviour_layout.addWidget(self.save_size, 1, 1, 1, 1) + self.rare_layout.addWidget(self.settings_group, 1, 1, 1, 1, QtCore.Qt.AlignTop) + self.log_dir_group = QtWidgets.QGroupBox(RareSettings) + self.log_dir_group.setObjectName("log_dir_group") + self.log_dir_layout = QtWidgets.QVBoxLayout(self.log_dir_group) + self.log_dir_layout.setObjectName("log_dir_layout") + self.log_dir_open_button = QtWidgets.QPushButton(self.log_dir_group) + self.log_dir_open_button.setObjectName("log_dir_open_button") + self.log_dir_layout.addWidget(self.log_dir_open_button) + self.log_dir_clean_button = QtWidgets.QPushButton(self.log_dir_group) + self.log_dir_clean_button.setObjectName("log_dir_clean_button") + self.log_dir_layout.addWidget(self.log_dir_clean_button) + self.log_dir_size_label = QtWidgets.QLabel(self.log_dir_group) + self.log_dir_size_label.setText("") + self.log_dir_size_label.setWordWrap(True) + self.log_dir_size_label.setObjectName("log_dir_size_label") + self.log_dir_layout.addWidget(self.log_dir_size_label) + self.rare_layout.addWidget(self.log_dir_group, 0, 2, 1, 1, QtCore.Qt.AlignTop) + spacerItem1 = QtWidgets.QSpacerItem(20, 40, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding) + self.rare_layout.addItem(spacerItem1, 2, 1, 1, 1) + + self.retranslateUi(RareSettings) + QtCore.QMetaObject.connectSlotsByName(RareSettings) + + def retranslateUi(self, RareSettings): + _translate = QtCore.QCoreApplication.translate + RareSettings.setWindowTitle(_translate("RareSettings", "RareSettings")) + self.img_dir_group.setTitle(_translate("RareSettings", "Image Cache Directory")) + self.interface_group.setTitle(_translate("RareSettings", "Interface")) + self.lang_label.setText(_translate("RareSettings", "Language")) + self.style_label.setText(_translate("RareSettings", "Style Sheet")) + self.color_label.setText(_translate("RareSettings", "Color Scheme")) + self.interface_info.setText(_translate("RareSettings", "Restart Rare to apply.")) + self.style_select.setItemText(0, _translate("RareSettings", "None")) + self.color_select.setItemText(0, _translate("RareSettings", "None")) + self.settings_group.setTitle(_translate("RareSettings", "Behaviour")) + self.auto_sync_cloud.setText(_translate("RareSettings", "Automatically sync with cloud")) + self.auto_update.setText(_translate("RareSettings", "Update games on application startup")) + self.confirm_start.setText(_translate("RareSettings", "Confirm game launch")) + self.sys_tray.setText(_translate("RareSettings", "Exit to System tray")) + self.notification.setText(_translate("RareSettings", "Show notification on download completion")) + self.save_size.setText(_translate("RareSettings", "Restore window size on application startup")) + self.log_dir_group.setTitle(_translate("RareSettings", "Logs")) + self.log_dir_open_button.setText(_translate("RareSettings", "Open Log directory")) + self.log_dir_clean_button.setText(_translate("RareSettings", "Clean Log directory")) + + +if __name__ == "__main__": + import sys + app = QtWidgets.QApplication(sys.argv) + RareSettings = QtWidgets.QWidget() + ui = Ui_RareSettings() + ui.setupUi(RareSettings) + RareSettings.show() + sys.exit(app.exec_()) diff --git a/rare/ui/components/tabs/settings/rare.ui b/rare/ui/components/tabs/settings/rare.ui new file mode 100644 index 00000000..a2ff7ab7 --- /dev/null +++ b/rare/ui/components/tabs/settings/rare.ui @@ -0,0 +1,206 @@ + + + RareSettings + + + RareSettings + + + + + + + + + Image Cache Directory + + + + + + + + + 0 + 0 + + + + Interface + + + + + + Language + + + + + + + Style Sheet + + + + + + + Color Scheme + + + + + + + + + + + true + + + + Restart Rare to apply. + + + true + + + + + + + + None + + + + + + + + + None + + + + + + + + + + + Behaviour + + + + + + Automatically sync with cloud + + + + + + + Update games on application startup + + + + + + + Confirm game launch + + + + + + + Exit to System tray + + + + + + + Qt::Horizontal + + + + 0 + 0 + + + + + + + + Show notification on download completion + + + + + + + Restore window size on application startup + + + + + + + + + + Logs + + + + + + Open Log directory + + + + + + + Clean Log directory + + + + + + + + + + true + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + diff --git a/rare/ui/components/tabs/settings/rpc_settings.py b/rare/ui/components/tabs/settings/rpc_settings.py new file mode 100644 index 00000000..3005e246 --- /dev/null +++ b/rare/ui/components/tabs/settings/rpc_settings.py @@ -0,0 +1,66 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'rpc_settings.ui' +# +# Created by: PyQt5 UI code generator 5.15.4 +# +# WARNING: Any manual changes made to this file will be lost when pyuic5 is +# run again. Do not edit this file unless you know what you are doing. + + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_RPCSettings(object): + def setupUi(self, RPCSettings): + RPCSettings.setObjectName("RPCSettings") + self.gridLayout = QtWidgets.QGridLayout(RPCSettings) + self.gridLayout.setObjectName("gridLayout") + self.enable = QtWidgets.QComboBox(RPCSettings) + self.enable.setObjectName("enable") + self.enable.addItem("") + self.enable.addItem("") + self.enable.addItem("") + self.gridLayout.addWidget(self.enable, 0, 1, 1, 1) + self.label = QtWidgets.QLabel(RPCSettings) + sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Preferred) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth()) + self.label.setSizePolicy(sizePolicy) + self.label.setObjectName("label") + self.gridLayout.addWidget(self.label, 0, 0, 1, 1) + self.show_game = QtWidgets.QCheckBox(RPCSettings) + self.show_game.setObjectName("show_game") + self.gridLayout.addWidget(self.show_game, 1, 0, 1, 2) + self.show_os = QtWidgets.QCheckBox(RPCSettings) + self.show_os.setObjectName("show_os") + self.gridLayout.addWidget(self.show_os, 2, 0, 1, 2) + self.show_time = QtWidgets.QCheckBox(RPCSettings) + self.show_time.setObjectName("show_time") + self.gridLayout.addWidget(self.show_time, 3, 0, 1, 2) + + self.retranslateUi(RPCSettings) + QtCore.QMetaObject.connectSlotsByName(RPCSettings) + + def retranslateUi(self, RPCSettings): + _translate = QtCore.QCoreApplication.translate + RPCSettings.setWindowTitle(_translate("RPCSettings", "Discord RPC")) + RPCSettings.setTitle(_translate("RPCSettings", "Discord RPC")) + self.enable.setItemText(0, _translate("RPCSettings", "When Playing")) + self.enable.setItemText(1, _translate("RPCSettings", "Always")) + self.enable.setItemText(2, _translate("RPCSettings", "Never")) + self.label.setText(_translate("RPCSettings", "Show")) + self.show_game.setText(_translate("RPCSettings", "Show Game")) + self.show_os.setText(_translate("RPCSettings", "Show OS")) + self.show_time.setText(_translate("RPCSettings", "Show Time playing")) + + +if __name__ == "__main__": + import sys + app = QtWidgets.QApplication(sys.argv) + RPCSettings = QtWidgets.QGroupBox() + ui = Ui_RPCSettings() + ui.setupUi(RPCSettings) + RPCSettings.show() + sys.exit(app.exec_()) diff --git a/rare/ui/components/tabs/settings/rpc_settings.ui b/rare/ui/components/tabs/settings/rpc_settings.ui new file mode 100644 index 00000000..ff480e58 --- /dev/null +++ b/rare/ui/components/tabs/settings/rpc_settings.ui @@ -0,0 +1,69 @@ + + + RPCSettings + + + Discord RPC + + + Discord RPC + + + + + + + When Playing + + + + + Always + + + + + Never + + + + + + + + + 0 + 0 + + + + Show + + + + + + + Show Game + + + + + + + Show OS + + + + + + + Show Time playing + + + + + + + + diff --git a/rare/ui/utils/pathedit.py b/rare/ui/utils/pathedit.py new file mode 100644 index 00000000..0752f0b1 --- /dev/null +++ b/rare/ui/utils/pathedit.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file 'pathedit.ui' +# +# Created by: PyQt5 UI code generator 5.15.4 +# +# WARNING: Any manual changes made to this file will be lost when pyuic5 is +# run again. Do not edit this file unless you know what you are doing. + + +from PyQt5 import QtCore, QtGui, QtWidgets + + +class Ui_PathEdit(object): + def setupUi(self, PathEdit): + PathEdit.setObjectName("PathEdit") + self.layout_pathedit = QtWidgets.QGridLayout(PathEdit) + self.layout_pathedit.setContentsMargins(0, 0, 0, 0) + self.layout_pathedit.setObjectName("layout_pathedit") + self.path_select = QtWidgets.QToolButton(PathEdit) + self.path_select.setObjectName("path_select") + self.layout_pathedit.addWidget(self.path_select, 0, 1, 1, 1) + self.text_edit = QtWidgets.QLineEdit(PathEdit) + self.text_edit.setMinimumSize(QtCore.QSize(300, 0)) + self.text_edit.setObjectName("text_edit") + self.layout_pathedit.addWidget(self.text_edit, 0, 0, 1, 1) + self.layout_pathedit_save = QtWidgets.QHBoxLayout() + self.layout_pathedit_save.setObjectName("layout_pathedit_save") + spacerItem = QtWidgets.QSpacerItem(40, 0, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) + self.layout_pathedit_save.addItem(spacerItem) + self.save_path_button = QtWidgets.QPushButton(PathEdit) + self.save_path_button.setEnabled(True) + self.save_path_button.setObjectName("save_path_button") + self.layout_pathedit_save.addWidget(self.save_path_button) + self.layout_pathedit.addLayout(self.layout_pathedit_save, 1, 0, 1, 2) + + self.retranslateUi(PathEdit) + QtCore.QMetaObject.connectSlotsByName(PathEdit) + + def retranslateUi(self, PathEdit): + _translate = QtCore.QCoreApplication.translate + PathEdit.setWindowTitle(_translate("PathEdit", "PathEdit")) + self.path_select.setText(_translate("PathEdit", "Browse...")) + self.text_edit.setPlaceholderText(_translate("PathEdit", "Default")) + self.save_path_button.setText(_translate("PathEdit", "Save")) + + +if __name__ == "__main__": + import sys + app = QtWidgets.QApplication(sys.argv) + PathEdit = QtWidgets.QWidget() + ui = Ui_PathEdit() + ui.setupUi(PathEdit) + PathEdit.show() + sys.exit(app.exec_()) diff --git a/rare/ui/utils/pathedit.ui b/rare/ui/utils/pathedit.ui new file mode 100644 index 00000000..a297a6d0 --- /dev/null +++ b/rare/ui/utils/pathedit.ui @@ -0,0 +1,72 @@ + + + PathEdit + + + PathEdit + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Browse... + + + + + + + + 300 + 0 + + + + Default + + + + + + + + + Qt::Horizontal + + + + 40 + 0 + + + + + + + + true + + + Save + + + + + + + + + + diff --git a/rare/utils/extra_widgets.py b/rare/utils/extra_widgets.py index eb8d70ba..31db79cf 100644 --- a/rare/utils/extra_widgets.py +++ b/rare/utils/extra_widgets.py @@ -2,11 +2,12 @@ import os from PyQt5.QtCore import Qt, QRect, QSize, QPoint, pyqtSignal from PyQt5.QtGui import QMovie -from PyQt5.QtWidgets import QLayout, QStyle, QSizePolicy, QLabel, QFileDialog, QHBoxLayout, QWidget, QLineEdit, \ - QPushButton, QStyleOptionTab, QStylePainter, QTabBar +from PyQt5.QtWidgets import QLayout, QStyle, QSizePolicy, QLabel, QFileDialog, QHBoxLayout, QWidget, QPushButton, \ + QStyleOptionTab, QStylePainter, QTabBar from qtawesome import icon from rare import style_path +from rare.ui.utils.pathedit import Ui_PathEdit class FlowLayout(QLayout): @@ -120,33 +121,51 @@ class ClickableLabel(QLabel): super(ClickableLabel, self).__init__() -class PathEdit(QWidget): - def __init__(self, text: str = "", - type_of_file: QFileDialog.FileType = QFileDialog.AnyFile, - infotext: str = "", filter: str = None): +class PathEdit(QWidget, Ui_PathEdit): + def __init__(self, + text: str = "", + file_type: QFileDialog.FileType = QFileDialog.AnyFile, + type_filter: str = None, + name_filter: str = None, + edit_func: callable = None, + save_func: callable = None): super(PathEdit, self).__init__() - self.filter = filter - self.type_of_file = type_of_file - self.info_text = infotext - self.layout = QHBoxLayout() - self.text_edit = QLineEdit(text) - self.path_select = QPushButton(self.tr("Select Path")) - self.path_select.clicked.connect(self.set_path) - self.layout.addWidget(self.text_edit) - self.layout.addWidget(self.path_select) - self.setLayout(self.layout) + self.setupUi(self) - def setPlaceholderText(self, text: str): - self.text_edit.setPlaceholderText(text) + self.type_filter = type_filter + self.name_filter = name_filter + self.file_type = file_type + self.edit_func = edit_func + self.save_func = save_func + if text: + self.text_edit.setText(text) + if self.edit_func is not None: + self.text_edit.textChanged.connect(self.edit_func) + if self.save_func is None: + self.save_path_button.setVisible(False) + else: + self.text_edit.textChanged.connect(lambda t: self.save_path_button.setDisabled(False)) + self.save_path_button.clicked.connect(self.save) + self.save_path_button.setDisabled(True) + self.path_select.clicked.connect(self.set_path) def text(self): return self.text_edit.text() + def save(self): + self.save_func() + self.save_path_button.setDisabled(True) + def set_path(self): - dlg = QFileDialog(self, self.tr("Choose Path"), os.path.expanduser("~/")) - dlg.setFileMode(self.type_of_file) - if self.filter: - dlg.setFilter([self.filter]) + dlg_path = self.text_edit.text() + if not dlg_path: + dlg_path = os.path.expanduser("~/") + dlg = QFileDialog(self, self.tr("Choose Path"), dlg_path) + dlg.setFileMode(self.file_type) + if self.type_filter: + dlg.setFilter([self.type_filter]) + if self.name_filter: + dlg.setNameFilter(self.name_filter) if dlg.exec_(): names = dlg.selectedFiles() self.text_edit.setText(names[0]) diff --git a/rare/utils/utils.py b/rare/utils/utils.py index 7b618588..9f99d140 100644 --- a/rare/utils/utils.py +++ b/rare/utils/utils.py @@ -7,6 +7,8 @@ from logging import getLogger import requests from PIL import Image, UnidentifiedImageError from PyQt5.QtCore import pyqtSignal, QLocale, QSettings +from PyQt5.QtGui import QPalette, QColor +from rare import style_path # Windows if os.name == "nt": @@ -122,6 +124,77 @@ def get_lang(): return QLocale.system().name().split("_")[0] +color_role_map = { + 0: "WindowText", + 1: "Button", + 2: "Light", + 3: "Midlight", + 4: "Dark", + 5: "Mid", + 6: "Text", + 7: "BrightText", + 8: "ButtonText", + 9: "Base", + 10: "Window", + 11: "Shadow", + 12: "Highlight", + 13: "HighlightedText", + 14: "Link", + 15: "LinkVisited", + 16: "AlternateBase", + # 17: "NoRole", + 18: "ToolTipBase", + 19: "ToolTipText", + 20: "PlaceholderText", + # 21: "NColorRoles", +} + +color_group_map = { + 0: "Active", + 1: "Disabled", + 2: "Inactive", +} + + +def load_color_scheme(path: str): + custom_palette = QPalette() + settings = QSettings(path, QSettings.IniFormat) + try: + settings.beginGroup("ColorScheme") + for g in color_group_map: + settings.beginGroup(color_group_map[g]) + group = QPalette.ColorGroup(g) + for r in color_role_map: + role = QPalette.ColorRole(r) + custom_palette.setColor(group, role, QColor(settings.value(color_role_map[r]))) + settings.endGroup() + settings.endGroup() + text_color = custom_palette.text().color() + text_color.setAlpha(128) + custom_palette.setColor(custom_palette.Active, custom_palette.PlaceholderText, text_color) + custom_palette.setColor(custom_palette.Inactive, custom_palette.PlaceholderText, text_color) + custom_palette.setColor(custom_palette.Disabled, custom_palette.PlaceholderText, text_color) + except: + custom_palette = None + return custom_palette + + +def get_color_schemes(): + colors = [] + for file in os.listdir(os.path.join(style_path, "colors")): + if file.endswith(".scheme") and os.path.isfile(os.path.join(style_path, "colors", file)): + colors.append(file.replace(".scheme", "")) + return colors + + +def get_style_sheets(): + styles = [] + for file in os.listdir(os.path.join(style_path, "qss")): + if file.endswith(".qss") and os.path.isfile(os.path.join(style_path, "qss", file)): + styles.append(file.replace(".qss", "")) + return styles + + def get_possible_langs(): langs = ["en"] for i in os.listdir(lang_path):