forked from openlp/openlp
started work on slidecontroller resize
This commit is contained in:
parent
e6a89652e4
commit
304f7b406d
@ -55,7 +55,7 @@ class SettingsManager(object):
|
|||||||
self.mainwindow_left = mainwindow_docbars
|
self.mainwindow_left = mainwindow_docbars
|
||||||
self.mainwindow_right = mainwindow_docbars
|
self.mainwindow_right = mainwindow_docbars
|
||||||
self.slidecontroller = (self.width - (
|
self.slidecontroller = (self.width - (
|
||||||
self.mainwindow_left + self.mainwindow_right) - 100 ) / 2
|
self.mainwindow_left + self.mainwindow_right) - 100) / 2
|
||||||
self.slidecontroller_image = self.slidecontroller - 50
|
self.slidecontroller_image = self.slidecontroller - 50
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -76,7 +76,7 @@ class Ui_MainWindow(object):
|
|||||||
MainIcon = build_icon(u':/icon/openlp-logo-16x16.png')
|
MainIcon = build_icon(u':/icon/openlp-logo-16x16.png')
|
||||||
MainWindow.setWindowIcon(MainIcon)
|
MainWindow.setWindowIcon(MainIcon)
|
||||||
self.setDockNestingEnabled(True)
|
self.setDockNestingEnabled(True)
|
||||||
# Set up the main container, which contains all the other form widgets
|
# Set up the main container, which contains all the other form widgets.
|
||||||
self.MainContent = QtGui.QWidget(MainWindow)
|
self.MainContent = QtGui.QWidget(MainWindow)
|
||||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
|
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
|
||||||
QtGui.QSizePolicy.Expanding)
|
QtGui.QSizePolicy.Expanding)
|
||||||
@ -272,7 +272,7 @@ class Ui_MainWindow(object):
|
|||||||
self.SettingsPluginListItem.setObjectName(u'SettingsPluginListItem')
|
self.SettingsPluginListItem.setObjectName(u'SettingsPluginListItem')
|
||||||
MainWindow.actionList.add_action(self.SettingsPluginListItem,
|
MainWindow.actionList.add_action(self.SettingsPluginListItem,
|
||||||
u'Settings')
|
u'Settings')
|
||||||
#i18n Language Items
|
# i18n Language Items
|
||||||
self.AutoLanguageItem = QtGui.QAction(MainWindow)
|
self.AutoLanguageItem = QtGui.QAction(MainWindow)
|
||||||
self.AutoLanguageItem.setObjectName(u'AutoLanguageItem')
|
self.AutoLanguageItem.setObjectName(u'AutoLanguageItem')
|
||||||
self.AutoLanguageItem.setCheckable(True)
|
self.AutoLanguageItem.setCheckable(True)
|
||||||
@ -331,7 +331,7 @@ class Ui_MainWindow(object):
|
|||||||
None, self.ViewMediaManagerItem, self.ViewServiceManagerItem,
|
None, self.ViewMediaManagerItem, self.ViewServiceManagerItem,
|
||||||
self.ViewThemeManagerItem, None, self.ViewPreviewPanel,
|
self.ViewThemeManagerItem, None, self.ViewPreviewPanel,
|
||||||
self.ViewLivePanel))
|
self.ViewLivePanel))
|
||||||
#i18n add Language Actions
|
# i18n add Language Actions
|
||||||
add_actions(self.SettingsLanguageMenu, (self.AutoLanguageItem, None))
|
add_actions(self.SettingsLanguageMenu, (self.AutoLanguageItem, None))
|
||||||
add_actions(self.SettingsLanguageMenu, self.LanguageGroup.actions())
|
add_actions(self.SettingsLanguageMenu, self.LanguageGroup.actions())
|
||||||
add_actions(self.SettingsMenu, (self.SettingsPluginListItem,
|
add_actions(self.SettingsMenu, (self.SettingsPluginListItem,
|
||||||
@ -354,17 +354,8 @@ class Ui_MainWindow(object):
|
|||||||
QtCore.SIGNAL(u'aboutToShow()'), self.updateFileMenu)
|
QtCore.SIGNAL(u'aboutToShow()'), self.updateFileMenu)
|
||||||
QtCore.QObject.connect(self.FileExitItem,
|
QtCore.QObject.connect(self.FileExitItem,
|
||||||
QtCore.SIGNAL(u'triggered()'), MainWindow.close)
|
QtCore.SIGNAL(u'triggered()'), MainWindow.close)
|
||||||
QtCore.QObject.connect(self.ControlSplitter,
|
|
||||||
QtCore.SIGNAL(u'splitterMoved(int, int)'), self.trackSplitter)
|
|
||||||
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||||
|
|
||||||
def trackSplitter(self, tab, pos):
|
|
||||||
"""
|
|
||||||
Splitter between the Preview and Live Controllers.
|
|
||||||
"""
|
|
||||||
self.liveController.widthChanged()
|
|
||||||
self.previewController.widthChanged()
|
|
||||||
|
|
||||||
def retranslateUi(self, MainWindow):
|
def retranslateUi(self, MainWindow):
|
||||||
"""
|
"""
|
||||||
Set up the translation system
|
Set up the translation system
|
||||||
@ -998,8 +989,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
The service filename to add
|
The service filename to add
|
||||||
"""
|
"""
|
||||||
# The maxRecentFiles value does not have an interface and so never gets
|
# The maxRecentFiles value does not have an interface and so never gets
|
||||||
# actually stored in the settings therefore the default value of 20
|
# actually stored in the settings therefore the default value of 20 will
|
||||||
# will always be used.
|
# always be used.
|
||||||
maxRecentFiles = QtCore.QSettings().value(u'advanced/max recent files',
|
maxRecentFiles = QtCore.QSettings().value(u'advanced/max recent files',
|
||||||
QtCore.QVariant(20)).toInt()[0]
|
QtCore.QVariant(20)).toInt()[0]
|
||||||
if filename:
|
if filename:
|
||||||
|
@ -73,6 +73,7 @@ class SlideList(QtGui.QTableWidget):
|
|||||||
else:
|
else:
|
||||||
event.ignore()
|
event.ignore()
|
||||||
|
|
||||||
|
|
||||||
class SlideController(QtGui.QWidget):
|
class SlideController(QtGui.QWidget):
|
||||||
"""
|
"""
|
||||||
SlideController is the slide controller widget. This widget is what the
|
SlideController is the slide controller widget. This widget is what the
|
||||||
@ -217,7 +218,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
translate('OpenLP.SlideController',
|
translate('OpenLP.SlideController',
|
||||||
'Edit and reload song preview'),
|
'Edit and reload song preview'),
|
||||||
self.onEditSong)
|
self.onEditSong)
|
||||||
if isLive:
|
if self.isLive:
|
||||||
self.Toolbar.addToolbarSeparator(u'Loop Separator')
|
self.Toolbar.addToolbarSeparator(u'Loop Separator')
|
||||||
self.Toolbar.addToolbarButton(
|
self.Toolbar.addToolbarButton(
|
||||||
u'Start Loop', u':/media/media_time.png',
|
u'Start Loop', u':/media/media_time.png',
|
||||||
@ -272,7 +273,7 @@ class SlideController(QtGui.QWidget):
|
|||||||
self.Mediabar.addToolbarWidget(u'Audio Volume', self.volumeSlider)
|
self.Mediabar.addToolbarWidget(u'Audio Volume', self.volumeSlider)
|
||||||
self.ControllerLayout.addWidget(self.Mediabar)
|
self.ControllerLayout.addWidget(self.Mediabar)
|
||||||
# Build the Song Toolbar
|
# Build the Song Toolbar
|
||||||
if isLive:
|
if self.isLive:
|
||||||
self.SongMenu = QtGui.QToolButton(self.Toolbar)
|
self.SongMenu = QtGui.QToolButton(self.Toolbar)
|
||||||
self.SongMenu.setText(translate('OpenLP.SlideController',
|
self.SongMenu.setText(translate('OpenLP.SlideController',
|
||||||
'Go To'))
|
'Go To'))
|
||||||
@ -284,9 +285,10 @@ class SlideController(QtGui.QWidget):
|
|||||||
self.Toolbar.makeWidgetsInvisible([u'Song Menu'])
|
self.Toolbar.makeWidgetsInvisible([u'Song Menu'])
|
||||||
# Screen preview area
|
# Screen preview area
|
||||||
self.PreviewFrame = QtGui.QFrame(self.Splitter)
|
self.PreviewFrame = QtGui.QFrame(self.Splitter)
|
||||||
self.PreviewFrame.setGeometry(QtCore.QRect(0, 0, 300, 225))
|
self.PreviewFrame.setGeometry(QtCore.QRect(0, 0, 300, 300 * self.ratio))
|
||||||
|
self.PreviewFrame.setMinimumHeight(100)
|
||||||
self.PreviewFrame.setSizePolicy(QtGui.QSizePolicy(
|
self.PreviewFrame.setSizePolicy(QtGui.QSizePolicy(
|
||||||
QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Minimum,
|
QtGui.QSizePolicy.Ignored, QtGui.QSizePolicy.Ignored,
|
||||||
QtGui.QSizePolicy.Label))
|
QtGui.QSizePolicy.Label))
|
||||||
self.PreviewFrame.setFrameShape(QtGui.QFrame.StyledPanel)
|
self.PreviewFrame.setFrameShape(QtGui.QFrame.StyledPanel)
|
||||||
self.PreviewFrame.setFrameShadow(QtGui.QFrame.Sunken)
|
self.PreviewFrame.setFrameShadow(QtGui.QFrame.Sunken)
|
||||||
@ -334,11 +336,10 @@ class SlideController(QtGui.QWidget):
|
|||||||
QtCore.QObject.connect(self.PreviewListWidget,
|
QtCore.QObject.connect(self.PreviewListWidget,
|
||||||
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
|
QtCore.SIGNAL(u'doubleClicked(QModelIndex)'),
|
||||||
self.onGoLiveClick)
|
self.onGoLiveClick)
|
||||||
if isLive:
|
if self.isLive:
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'slidecontroller_live_spin_delay'),
|
QtCore.SIGNAL(u'slidecontroller_live_spin_delay'),
|
||||||
self.receiveSpinDelay)
|
self.receiveSpinDelay)
|
||||||
if isLive:
|
|
||||||
self.Toolbar.makeWidgetsInvisible(self.loopList)
|
self.Toolbar.makeWidgetsInvisible(self.loopList)
|
||||||
self.Toolbar.actions[u'Stop Loop'].setVisible(False)
|
self.Toolbar.actions[u'Stop Loop'].setVisible(False)
|
||||||
else:
|
else:
|
||||||
@ -381,8 +382,10 @@ class SlideController(QtGui.QWidget):
|
|||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'slidecontroller_%s_text_request' % self.typePrefix),
|
QtCore.SIGNAL(u'slidecontroller_%s_text_request' % self.typePrefix),
|
||||||
self.onTextRequest)
|
self.onTextRequest)
|
||||||
|
QtCore.QObject.connect(self.parent.ControlSplitter,
|
||||||
|
QtCore.SIGNAL(u'splitterMoved(int, int)'), self.previewSizeChanged)
|
||||||
QtCore.QObject.connect(self.Splitter,
|
QtCore.QObject.connect(self.Splitter,
|
||||||
QtCore.SIGNAL(u'splitterMoved(int, int)'), self.trackSplitter)
|
QtCore.SIGNAL(u'splitterMoved(int, int)'), self.previewSizeChanged)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'config_updated'), self.refreshServiceItem)
|
QtCore.SIGNAL(u'config_updated'), self.refreshServiceItem)
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
@ -403,32 +406,35 @@ class SlideController(QtGui.QWidget):
|
|||||||
self.display = MainDisplay(self, self.screens, self.isLive)
|
self.display = MainDisplay(self, self.screens, self.isLive)
|
||||||
self.display.imageManager = self.parent.renderManager.image_manager
|
self.display.imageManager = self.parent.renderManager.image_manager
|
||||||
self.display.alertTab = self.alertTab
|
self.display.alertTab = self.alertTab
|
||||||
|
self.display.setup()
|
||||||
|
self.previewSizeChanged()
|
||||||
|
|
||||||
|
def previewSizeChanged(self):
|
||||||
|
"""
|
||||||
|
Takes care of the SlidePreview's size. Is called when one of the the
|
||||||
|
splitters is moved or when the screen size is changed.
|
||||||
|
"""
|
||||||
|
log.debug(u'previewSizeChanged live = %s' % self.isLive)
|
||||||
|
# The SlidePreview's ratio.
|
||||||
self.ratio = float(self.screens.current[u'size'].width()) / \
|
self.ratio = float(self.screens.current[u'size'].width()) / \
|
||||||
float(self.screens.current[u'size'].height())
|
float(self.screens.current[u'size'].height())
|
||||||
self.display.setup()
|
if self.ratio < float(self.PreviewFrame.width()) / float(
|
||||||
self.SlidePreview.setFixedSize(
|
self.PreviewFrame.height()):
|
||||||
QtCore.QSize(self.settingsmanager.slidecontroller_image,
|
# We have to take the height as limit.
|
||||||
self.settingsmanager.slidecontroller_image / self.ratio))
|
max_height = self.PreviewFrame.height() - self.grid.margin() * 2
|
||||||
|
self.SlidePreview.setFixedSize(QtCore.QSize(max_height * self.ratio,
|
||||||
def widthChanged(self):
|
max_height))
|
||||||
"""
|
else:
|
||||||
Handle changes of width from the splitter between the live and preview
|
# We have to take the width as limit.
|
||||||
controller. Event only issues when changes have finished
|
max_width = self.PreviewFrame.width() - self.grid.margin() * 2
|
||||||
"""
|
self.SlidePreview.setFixedSize(QtCore.QSize(max_width,
|
||||||
log.debug(u'widthChanged live = %s' % self.isLive)
|
max_width / self.ratio))
|
||||||
width = self.parent.ControlSplitter.sizes()[self.split]
|
width = self.parent.ControlSplitter.sizes()[self.split]
|
||||||
height = width * self.parent.renderManager.screen_ratio
|
|
||||||
self.PreviewListWidget.setColumnWidth(0, width)
|
self.PreviewListWidget.setColumnWidth(0, width)
|
||||||
# Sort out image heights (Songs, bibles excluded)
|
# Sort out image heights (Songs, bibles excluded)
|
||||||
if self.serviceItem and not self.serviceItem.is_text():
|
if self.serviceItem and not self.serviceItem.is_text():
|
||||||
for framenumber in range(len(self.serviceItem.get_frames())):
|
for framenumber in range(len(self.serviceItem.get_frames())):
|
||||||
self.PreviewListWidget.setRowHeight(framenumber, height)
|
self.PreviewListWidget.setRowHeight(framenumber, width / self.ratio)
|
||||||
|
|
||||||
def trackSplitter(self, tab, pos):
|
|
||||||
"""
|
|
||||||
Splitter between the slide list and the preview panel
|
|
||||||
"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
def onSongBarHandler(self):
|
def onSongBarHandler(self):
|
||||||
request = unicode(self.sender().text())
|
request = unicode(self.sender().text())
|
||||||
|
Loading…
Reference in New Issue
Block a user