@@ -155,6 +155,7 @@ def __init__(self, MainController: "MainController") -> None:
155
155
self ._actionLastPage : QAction = QAction (self )
156
156
self ._actionPreviousComic : QAction = QAction (self )
157
157
self ._actionNextComic : QAction = QAction (self )
158
+ self ._actionFullscreen : QAction = QAction (self )
158
159
self ._actionFitVertical : QAction = QAction (self )
159
160
self ._actionFitHorizontal : QAction = QAction (self )
160
161
self ._actionFitOriginal : QAction = QAction (self )
@@ -371,10 +372,7 @@ def _setupActions(self) -> None:
371
372
self ._setupNavigationActions ()
372
373
373
374
# Fit actions
374
- self ._setupFitActions ()
375
-
376
- # Rotate actions
377
- self ._setupRotateActions ()
375
+ self ._setupViewActions ()
378
376
379
377
# About action
380
378
self ._actionAbout = self ._createAction (
@@ -460,12 +458,23 @@ def _setupNavigationActions(self) -> None:
460
458
enable = False ,
461
459
)
462
460
463
- def _setupFitActions (self ) -> None :
461
+ def _setupViewActions (self ) -> None :
464
462
"""
465
463
Configures fit actions for adjusting the content display.
466
464
"""
467
465
logger .debug ("Setting up fit actions" )
468
466
467
+ # Set Fullscreen action
468
+ self ._actionFullscreen = self ._createAction (
469
+ iconName = "fullscreen" ,
470
+ text = self .tr ("Fullscreen" ),
471
+ objectName = "actionFullscreen" ,
472
+ shortcut = "F" ,
473
+ slot = self .onActionFullscreenTriggered ,
474
+ checkable = True ,
475
+ enable = True ,
476
+ )
477
+
469
478
# Fit Vertical action
470
479
self ._actionFitVertical = self ._createAction (
471
480
iconName = "fit_page_height" ,
@@ -526,10 +535,6 @@ def _setupFitActions(self) -> None:
526
535
for act in self ._actionFitGroup .actions ():
527
536
act .setChecked (self ._mainController .getCurrentFitMode () == act .objectName ())
528
537
529
- def _setupRotateActions (self ) -> None :
530
- """
531
- Configures rotate actions for rotating the content.
532
- """
533
538
logger .debug ("Setting up rotate actions" )
534
539
535
540
# Rotate Left action
@@ -567,6 +572,8 @@ def _setupMenuBar(self) -> None:
567
572
self ._menuFile .addAction (self ._actionExit )
568
573
569
574
self ._menuView = QMenu (self ._menuBar , title = self .tr ("&View" ))
575
+ self ._menuView .addAction (self ._actionFullscreen )
576
+ self ._menuView .addSeparator ()
570
577
self ._menuView .addActions (self ._actionFitGroup .actions ())
571
578
self ._menuView .addSeparator ()
572
579
self ._menuView .addAction (self ._actionRotateLeft )
@@ -681,10 +688,10 @@ def _setupGlobalShortcuts(self) -> None:
681
688
logger .debug ("Setting up global shortcuts" )
682
689
683
690
# Shortcut to toggle fullscreen mode using the "F" key
684
- self .fullScreenShortcut = QShortcut (
685
- QKeySequence ("F" ), self , self .onActionFullscreenTriggered
686
- )
687
- self .fullScreenShortcut .setEnabled (True )
691
+ # self.fullScreenShortcut = QShortcut(
692
+ # QKeySequence("F"), self, self.onActionFullscreenTriggered
693
+ # )
694
+ # self.fullScreenShortcut.setEnabled(True)
688
695
689
696
# Shortcut to close the application using "Ctrl+Q"
690
697
self .closeShortcut = QShortcut (QKeySequence ("Ctrl+Q" ), self , self .close )
@@ -699,6 +706,8 @@ def _setupGlobalShortcuts(self) -> None:
699
706
"Ctrl+Right" : self ._mainController .onActionLastPageTriggered , # Navigate to last page
700
707
"Right" : self ._mainController .onActionNextPageTriggered , # Navigate to next page
701
708
"Left" : self ._mainController .onActionPreviousPageTriggered , # Navigate to previous page
709
+ "F" : self .onActionFullscreenTriggered , # Toggle fullscreen
710
+ "ESC" : self .onActionFullscreenTriggered , # Out fullscreen
702
711
}
703
712
704
713
# Create and configure shortcuts, initially disabled for fullscreen mode
@@ -943,6 +952,7 @@ def onActionFullscreenTriggered(self):
943
952
# Check if the window is currently in fullscreen mode
944
953
if self .isFullScreen ():
945
954
self ._toolBar .show () # Show the toolbar
955
+ self ._menuBar .show ()
946
956
self .showNormal () # Restore the window to normal mode
947
957
self ._mainController .updateCentralWidgetContent () # Update the central widget content
948
958
@@ -954,6 +964,7 @@ def onActionFullscreenTriggered(self):
954
964
# Enter fullscreen mode
955
965
self .showFullScreen () # Switch the window to fullscreen mode
956
966
self ._toolBar .hide ()
967
+ self ._menuBar .hide ()
957
968
self ._mainController .updateCentralWidgetContent () # Update the central widget content
958
969
959
970
# Enable global shortcuts when entering fullscreen mode
0 commit comments