mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Added display settings to the toolbar.
This commit is contained in:
@@ -50,7 +50,6 @@ class DisplayOptions:
|
||||
ground_objects = DisplayRule("Ground Objects", True)
|
||||
control_points = DisplayRule("Control Points", True)
|
||||
lines = DisplayRule("Lines", True)
|
||||
events = DisplayRule("Events", True)
|
||||
sam_ranges = DisplayRule("Ally SAM Threat Range", False)
|
||||
enemy_sam_ranges = DisplayRule("Enemy SAM Threat Range", True)
|
||||
detection_range = DisplayRule("SAM Detection Range", False)
|
||||
|
||||
@@ -78,6 +78,24 @@ def load_icons():
|
||||
ICONS["New"] = QPixmap("./resources/ui/misc/"+get_theme_icons()+"/new.png")
|
||||
ICONS["Open"] = QPixmap("./resources/ui/misc/"+get_theme_icons()+"/open.png")
|
||||
ICONS["Save"] = QPixmap("./resources/ui/misc/"+get_theme_icons()+"/save.png")
|
||||
ICONS["Discord"] = QPixmap("./resources/ui/misc/"+get_theme_icons()+"/discord.png")
|
||||
ICONS["Github"] = QPixmap("./resources/ui/misc/"+get_theme_icons()+"/github.png")
|
||||
|
||||
|
||||
ICONS["Control Points"] = QPixmap("./resources/ui/misc/" + get_theme_icons() + "/circle.png")
|
||||
ICONS["Ground Objects"] = QPixmap("./resources/ui/misc/" + get_theme_icons() + "/industry.png")
|
||||
ICONS["Lines"] = QPixmap("./resources/ui/misc/" + get_theme_icons() + "/arrows-h.png")
|
||||
ICONS["Waypoint Information"] = QPixmap("./resources/ui/misc/" + get_theme_icons() + "/info.png")
|
||||
ICONS["Map Polygon Debug Mode"] = QPixmap("./resources/ui/misc/" + get_theme_icons() + "/map.png")
|
||||
ICONS["Ally SAM Threat Range"] = QPixmap("./resources/ui/misc/blue-sam.png")
|
||||
ICONS["Enemy SAM Threat Range"] = QPixmap("./resources/ui/misc/red-sam.png")
|
||||
ICONS["SAM Detection Range"] = QPixmap("./resources/ui/misc/detection-sam.png")
|
||||
ICONS["Display Culling Zones"] = QPixmap("./resources/ui/misc/" + get_theme_icons() + "/eraser.png")
|
||||
ICONS["Hide Flight Paths"] = QPixmap("./resources/ui/misc/hide-flight-path.png")
|
||||
ICONS["Show Selected Flight Path"] = QPixmap("./resources/ui/misc/flight-path.png")
|
||||
ICONS["Show All Flight Paths"] = QPixmap("./resources/ui/misc/all-flight-paths.png")
|
||||
|
||||
|
||||
ICONS["Hangar"] = QPixmap("./resources/ui/misc/hangar.png")
|
||||
|
||||
ICONS["Terrain_Caucasus"] = QPixmap("./resources/ui/terrain_caucasus.gif")
|
||||
|
||||
@@ -52,8 +52,8 @@ class QLiberationWindow(QMainWindow):
|
||||
|
||||
self.initUi()
|
||||
self.initActions()
|
||||
self.initMenuBar()
|
||||
self.initToolbar()
|
||||
self.initMenuBar()
|
||||
self.connectSignals()
|
||||
|
||||
screen = QDesktopWidget().screenGeometry()
|
||||
@@ -120,12 +120,27 @@ class QLiberationWindow(QMainWindow):
|
||||
self.showLiberationPrefDialogAction.setIcon(QIcon.fromTheme("help-about"))
|
||||
self.showLiberationPrefDialogAction.triggered.connect(self.showLiberationDialog)
|
||||
|
||||
self.openDiscordAction = QAction("&Discord Server", self)
|
||||
self.openDiscordAction.setIcon(CONST.ICONS["Discord"])
|
||||
self.openDiscordAction.triggered.connect(lambda: webbrowser.open_new_tab("https://" + "discord.gg" + "/" + "bKrt" + "rkJ"))
|
||||
|
||||
self.openGithubAction = QAction("&Github Repo", self)
|
||||
self.openGithubAction.setIcon(CONST.ICONS["Github"])
|
||||
self.openGithubAction.triggered.connect(lambda: webbrowser.open_new_tab("https://github.com/khopa/dcs_liberation"))
|
||||
|
||||
def initToolbar(self):
|
||||
self.tool_bar = self.addToolBar("File")
|
||||
self.tool_bar.addAction(self.newGameAction)
|
||||
self.tool_bar.addAction(self.openAction)
|
||||
self.tool_bar.addAction(self.saveGameAction)
|
||||
|
||||
self.links_bar = self.addToolBar("Links")
|
||||
self.links_bar.addAction(self.openDiscordAction)
|
||||
self.links_bar.addAction(self.openGithubAction)
|
||||
|
||||
self.display_bar = self.addToolBar("Display")
|
||||
|
||||
|
||||
def initMenuBar(self):
|
||||
self.menu = self.menuBar()
|
||||
|
||||
@@ -145,20 +160,26 @@ class QLiberationWindow(QMainWindow):
|
||||
last_was_group = True
|
||||
for item in DisplayOptions.menu_items():
|
||||
if isinstance(item, DisplayRule):
|
||||
displayMenu.addAction(self.make_display_rule_action(item))
|
||||
action = self.make_display_rule_action(item)
|
||||
displayMenu.addAction(action)
|
||||
if action.icon():
|
||||
self.display_bar.addAction(action)
|
||||
last_was_group = False
|
||||
elif isinstance(item, DisplayGroup):
|
||||
if not last_was_group:
|
||||
displayMenu.addSeparator()
|
||||
self.display_bar.addSeparator()
|
||||
group = QActionGroup(displayMenu)
|
||||
for display_rule in item:
|
||||
displayMenu.addAction(
|
||||
self.make_display_rule_action(display_rule, group))
|
||||
action = self.make_display_rule_action(display_rule, group)
|
||||
displayMenu.addAction(action)
|
||||
if action.icon():
|
||||
self.display_bar.addAction(action)
|
||||
last_was_group = True
|
||||
|
||||
help_menu = self.menu.addMenu("&Help")
|
||||
help_menu.addAction("&Discord Server", lambda: webbrowser.open_new_tab("https://" + "discord.gg" + "/" + "bKrt" + "rkJ"))
|
||||
help_menu.addAction("&Github Repository", lambda: webbrowser.open_new_tab("https://github.com/khopa/dcs_liberation"))
|
||||
help_menu.addAction(self.openDiscordAction)
|
||||
help_menu.addAction(self.openGithubAction)
|
||||
help_menu.addAction("&Releases", lambda: webbrowser.open_new_tab("https://github.com/Khopa/dcs_liberation/releases"))
|
||||
help_menu.addAction("&Online Manual", lambda: webbrowser.open_new_tab(URLS["Manual"]))
|
||||
help_menu.addAction("&ED Forum Thread", lambda: webbrowser.open_new_tab(URLS["ForumThread"]))
|
||||
@@ -177,6 +198,10 @@ class QLiberationWindow(QMainWindow):
|
||||
return closure
|
||||
|
||||
action = QAction(f"&{display_rule.menu_text}", group)
|
||||
|
||||
if display_rule.menu_text in CONST.ICONS.keys():
|
||||
action.setIcon(CONST.ICONS[display_rule.menu_text])
|
||||
|
||||
action.setCheckable(True)
|
||||
action.setChecked(display_rule.value)
|
||||
action.toggled.connect(make_check_closure())
|
||||
|
||||
Reference in New Issue
Block a user