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