diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml index 6b2a1881..17031814 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.yml +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -33,10 +33,10 @@ body: options: - 5.2.0 - Development build - - type: input + - type: textarea attributes: - label: Development build - description: A link to the development build, if applicable. + label: Build information + description: The build information from the Help -> Report an issue window. - type: textarea attributes: label: Description diff --git a/.github/ISSUE_TEMPLATE/new-game-bug.yml b/.github/ISSUE_TEMPLATE/new-game-bug.yml index bb4ad5cf..d2d8a40d 100644 --- a/.github/ISSUE_TEMPLATE/new-game-bug.yml +++ b/.github/ISSUE_TEMPLATE/new-game-bug.yml @@ -41,10 +41,10 @@ body: options: - 5.2.0 - Development build - - type: input + - type: textarea attributes: - label: Development build - description: A link to the development build, if applicable. + label: Build information + description: The build information from the Help -> Report an issue window. - type: input attributes: label: Campaign name diff --git a/game/version.py b/game/version.py index b2e76b5d..838c9066 100644 --- a/game/version.py +++ b/game/version.py @@ -4,6 +4,7 @@ from pathlib import Path MAJOR_VERSION = 6 MINOR_VERSION = 0 MICRO_VERSION = 0 +VERSION_NUMBER = ".".join(str(v) for v in (MAJOR_VERSION, MINOR_VERSION, MICRO_VERSION)) def _optional_build_id_component(path: Path) -> str | None: @@ -17,9 +18,7 @@ GIT_SHA = _optional_build_id_component(Path("resources/gitsha")) def _build_version_string() -> str: - components = [ - ".".join(str(v) for v in (MAJOR_VERSION, MINOR_VERSION, MICRO_VERSION)) - ] + components = [VERSION_NUMBER] if BUILD_NUMBER is not None: components.append(BUILD_NUMBER) if GIT_SHA is not None: diff --git a/qt_ui/uiconstants.py b/qt_ui/uiconstants.py index 6e0dfc60..9809ccd1 100644 --- a/qt_ui/uiconstants.py +++ b/qt_ui/uiconstants.py @@ -5,13 +5,6 @@ from PySide2.QtGui import QPixmap from .liberation_theme import get_theme_icons -URLS: Dict[str, str] = { - "Manual": "https://github.com/dcs-liberation/dcs_liberation/wiki", - "Repository": "https://github.com/dcs-liberation/dcs_liberation", - "ForumThread": "https://forums.eagle.ru/showthread.php?t=214834", - "Issues": "https://github.com/dcs-liberation/dcs_liberation/issues", -} - LABELS_OPTIONS = ["Full", "Abbreviated", "Dot Only", "Neutral Dot", "Off"] SKILL_OPTIONS = ["Average", "Good", "High", "Excellent"] diff --git a/qt_ui/windows/BugReportDialog.py b/qt_ui/windows/BugReportDialog.py new file mode 100644 index 00000000..7255dabe --- /dev/null +++ b/qt_ui/windows/BugReportDialog.py @@ -0,0 +1,58 @@ +import webbrowser + +from PySide2.QtCore import Qt +from PySide2.QtGui import QGuiApplication +from PySide2.QtWidgets import QDialog, QLabel, QPushButton, QVBoxLayout, QWidget + +from game.version import BUILD_NUMBER, GIT_SHA, VERSION_NUMBER + + +class BugReportDialog(QDialog): + def __init__(self, parent: QWidget) -> None: + super().__init__(parent) + self.setWindowTitle("Report an issue") + self.setModal(True) + self.setMaximumWidth(600) + + layout = QVBoxLayout() + self.setLayout(layout) + + components = [f"DCS Liberation {VERSION_NUMBER}"] + if BUILD_NUMBER is not None: + components.append(f"Build {BUILD_NUMBER}") + if GIT_SHA is not None: + components.append(f"Git revision {GIT_SHA}") + + self.report_data = "\n".join(components) + + label = QLabel( + "Use the button below to file a bug. The version information will be " + "automatically copied to your clipboard. Paste that information into the " + "box in the bug template that asks for the version.
" + "
" + "Look for duplicate bugs before filing.
" + "
" + "If the template asks for a save game, it is required. No matter " + "how easily reproducible the bug may appear, it rarely is. If it were " + "obvious you wouldn't be the first to find it.
" + "
" + f"{'
'.join(components)}
" + ) + label.setTextInteractionFlags( + Qt.TextSelectableByMouse + | Qt.LinksAccessibleByMouse + | Qt.LinksAccessibleByKeyboard + ) + label.setWordWrap(True) + label.setOpenExternalLinks(True) + layout.addWidget(label) + + copy_button = QPushButton("Copy details to clipboard and go to bug page") + copy_button.clicked.connect(self.on_file_bug) + layout.addWidget(copy_button) + + def on_file_bug(self) -> None: + QGuiApplication.clipboard().setText(self.report_data) + webbrowser.open_new_tab( + "https://github.com/dcs-liberation/dcs_liberation/issues/new/choose" + ) diff --git a/qt_ui/windows/QLiberationWindow.py b/qt_ui/windows/QLiberationWindow.py index 32d6456b..519f63a3 100644 --- a/qt_ui/windows/QLiberationWindow.py +++ b/qt_ui/windows/QLiberationWindow.py @@ -29,11 +29,11 @@ from qt_ui import liberation_install from qt_ui.dialogs import Dialog from qt_ui.models import GameModel from qt_ui.simcontroller import SimController -from qt_ui.uiconstants import URLS from qt_ui.uncaughtexceptionhandler import UncaughtExceptionHandler from qt_ui.widgets.QTopPanel import QTopPanel from qt_ui.widgets.ato import QAirTaskingOrderPanel from qt_ui.widgets.map.QLiberationMap import QLiberationMap +from qt_ui.windows.BugReportDialog import BugReportDialog from qt_ui.windows.GameUpdateSignal import GameUpdateSignal from qt_ui.windows.QDebriefingWindow import QDebriefingWindow from qt_ui.windows.basemenu.QBaseMenu2 import QBaseMenu2 @@ -193,6 +193,9 @@ class QLiberationWindow(QMainWindow): lambda: webbrowser.open_new_tab("https://shdwp.github.io/ukraine/") ) + self.bug_report_action = QAction("Report an &issue", self) + self.bug_report_action.triggered.connect(self.show_bug_report_dialog) + self.openLogsAction = QAction("Show &logs", self) self.openLogsAction.triggered.connect(self.showLogsDialog) @@ -268,14 +271,18 @@ class QLiberationWindow(QMainWindow): ), ) help_menu.addAction( - "&Online Manual", lambda: webbrowser.open_new_tab(URLS["Manual"]) + "&Online Manual", + lambda: webbrowser.open_new_tab( + "https://github.com/dcs-liberation/dcs_liberation/wiki" + ), ) help_menu.addAction( - "&ED Forum Thread", lambda: webbrowser.open_new_tab(URLS["ForumThread"]) - ) - help_menu.addAction( - "Report an &issue", lambda: webbrowser.open_new_tab(URLS["Issues"]) + "&ED Forum Thread", + lambda: webbrowser.open_new_tab( + "https://forums.eagle.ru/showthread.php?t=214834" + ), ) + help_menu.addAction(self.bug_report_action) help_menu.addAction(self.openLogsAction) help_menu.addSeparator() @@ -483,6 +490,10 @@ class QLiberationWindow(QMainWindow): def import_templates(self): LAYOUTS.import_templates() + def show_bug_report_dialog(self) -> None: + self.dialog = BugReportDialog(self) + self.dialog.show() + def showLogsDialog(self): self.dialog = QLogsWindow() self.dialog.show()