Hide buttons to menu part 1

This commit is contained in:
Tim Bentley 2010-06-26 07:24:38 +01:00
parent 89ccc8f390
commit 90cf4428c4

View File

@ -196,18 +196,25 @@ class SlideController(QtGui.QWidget):
self.onSlideSelectedLast) self.onSlideSelectedLast)
if self.isLive: if self.isLive:
self.Toolbar.addToolbarSeparator(u'Close Separator') self.Toolbar.addToolbarSeparator(u'Close Separator')
self.blankButton = self.Toolbar.addToolbarButton( self.HideMenu = QtGui.QToolButton(self.Toolbar)
u'Blank Screen', u':/slides/slide_blank.png', self.HideMenu.setText(translate('SlideController', 'Hide'))
translate('SlideController', 'Blank Screen'), self.HideMenu.setPopupMode(QtGui.QToolButton.MenuButtonPopup)
self.onBlankDisplay, True) self.Toolbar.addToolbarWidget(u'Hide Menu', self.HideMenu)
self.themeButton = self.Toolbar.addToolbarButton( self.HideMenu.setMenu(QtGui.QMenu(
u'Display Theme', u':/slides/slide_theme.png', translate('SlideController', 'Hide'), self.Toolbar))
translate('SlideController', 'Theme Screen'), self.BlankScreen = QtGui.QAction(QtGui.QIcon( u':/slides/slide_blank.png'), u'Blank Screen', self.HideMenu)
self.onThemeDisplay, True) self.BlankScreen.setCheckable(True)
self.hideButton = self.Toolbar.addToolbarButton( QtCore.QObject.connect(self.BlankScreen, QtCore.SIGNAL("triggered(bool)"), self.onBlankDisplay)
u'Hide screen', u':/slides/slide_desktop.png', self.ThemeScreen = QtGui.QAction(QtGui.QIcon(u':/slides/slide_theme.png'), u'Blank to Theme', self.HideMenu)
translate('SlideController', 'Hide Screen'), self.ThemeScreen.setCheckable(True)
self.onHideDisplay, True) QtCore.QObject.connect(self.BlankScreen, QtCore.SIGNAL("triggered(bool)"), self.onThemeDisplay)
self.DesktopScreen = QtGui.QAction(QtGui.QIcon(u':/slides/slide_desktop.png'), u'Show Desktop', self.HideMenu)
self.DesktopScreen.setCheckable(True)
QtCore.QObject.connect(self.BlankScreen, QtCore.SIGNAL("triggered(bool)"), self.onHideDisplay)
self.HideMenu.setDefaultAction(self.BlankScreen)
self.HideMenu.menu().addAction(self.BlankScreen)
self.HideMenu.menu().addAction(self.ThemeScreen)
self.HideMenu.menu().addAction(self.DesktopScreen)
if not self.isLive: if not self.isLive:
self.Toolbar.addToolbarSeparator(u'Close Separator') self.Toolbar.addToolbarSeparator(u'Close Separator')
self.Toolbar.addToolbarButton( self.Toolbar.addToolbarButton(
@ -252,29 +259,6 @@ class SlideController(QtGui.QWidget):
u'Media Stop', u':/slides/media_playback_stop.png', u'Media Stop', u':/slides/media_playback_stop.png',
translate('SlideController', 'Start playing media'), translate('SlideController', 'Start playing media'),
self.onMediaStop) self.onMediaStop)
if self.isLive:
self.button = QtGui.QToolButton(self.Toolbar)
self.Toolbar.addToolbarWidget(u'Hide Menu', self.button)
self.button.setText(translate('SlideController', 'Hide'))
self.menu = QtGui.QMenu(self.button)
blank_screen = QtGui.QAction(QtGui.QIcon( u':/slides/slide_blank.png'), u'Blank Screen', self.button)
theme_screen = QtGui.QAction(QtGui.QIcon(u':/slides/slide_theme.png'), u'Blank to Theme', self.button)
desktop_screen = QtGui.QAction(QtGui.QIcon(u':/slides/slide_desktop.png'), u'Show Desktop', self.button)
self.menu.addAction(blank_screen)
self.menu.addAction(theme_screen)
self.menu.addAction(desktop_screen)
self.blankButton = self.Mediabar.addToolbarButton(
u'Blank Screen', u':/slides/slide_blank.png',
translate('SlideController', 'Blank Screen'),
self.onBlankDisplay, True)
self.themeButton = self.Mediabar.addToolbarButton(
u'Display Theme', u':/slides/slide_theme.png',
translate('SlideController', 'Theme Screen'),
self.onThemeDisplay, True)
self.hideButton = self.Mediabar.addToolbarButton(
u'Hide screen', u':/slides/slide_desktop.png',
translate('SlideController', 'Hide Screen'),
self.onHideDisplay, True)
if not self.isLive: if not self.isLive:
self.seekSlider = Phonon.SeekSlider() self.seekSlider = Phonon.SeekSlider()
self.seekSlider.setGeometry(QtCore.QRect(90, 260, 221, 24)) self.seekSlider.setGeometry(QtCore.QRect(90, 260, 221, 24))
@ -686,8 +670,11 @@ class SlideController(QtGui.QWidget):
Handle the blank screen button actions Handle the blank screen button actions
""" """
log.debug(u'onBlankDisplay %d' % checked) log.debug(u'onBlankDisplay %d' % checked)
self.hideButton.setChecked(False) self.HideMenu.setDefaultAction(self.BlankScreen)
self.themeButton.setChecked(False) self.BlankScreen.setCheckable(True)
self.BlankScreen.setChecked(True)
self.ThemeScreen.setChecked(False)
self.DesktopScreen.setChecked(False)
self.canDisplay = not checked self.canDisplay = not checked
QtCore.QSettings().setValue( QtCore.QSettings().setValue(
self.parent.generalSettingsSection + u'/screen blank', self.parent.generalSettingsSection + u'/screen blank',
@ -704,8 +691,11 @@ class SlideController(QtGui.QWidget):
Handle the Theme screen button Handle the Theme screen button
""" """
log.debug(u'onThemeDisplay %d' % checked) log.debug(u'onThemeDisplay %d' % checked)
self.blankButton.setChecked(False) self.HideMenu.setDefaultAction(self.ThemeScreen)
self.hideButton.setChecked(False) self.ThemeScreen.setCheckable(True)
self.BlankScreen.setChecked(False)
self.ThemeScreen.setChecked(True)
self.DesktopScreen.setChecked(False)
self.canDisplay = False self.canDisplay = False
if checked: if checked:
Receiver.send_message(u'maindisplay_hide', HideMode.Theme) Receiver.send_message(u'maindisplay_hide', HideMode.Theme)
@ -719,8 +709,11 @@ class SlideController(QtGui.QWidget):
Handle the Hide screen button Handle the Hide screen button
""" """
log.debug(u'onHideDisplay %d' % checked) log.debug(u'onHideDisplay %d' % checked)
self.blankButton.setChecked(False) self.HideMenu.setDefaultAction(self.DesktopScreen)
self.themeButton.setChecked(False) self.DesktopScreen.setCheckable(True)
self.BlankScreen.setChecked(False)
self.ThemeScreen.setChecked(False)
self.DesktopScreen.setChecked(True)
self.canDisplay = False self.canDisplay = False
if checked: if checked:
Receiver.send_message(u'maindisplay_hide', HideMode.Screen) Receiver.send_message(u'maindisplay_hide', HideMode.Screen)