forked from openlp/openlp
Just add a couple of links...
This commit is contained in:
parent
1a3626ef13
commit
7103d98dba
@ -24,10 +24,12 @@
|
||||
# Temple Place, Suite 330, Boston, MA 02111-1307 USA #
|
||||
###############################################################################
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from PyQt4 import QtCore, QtGui, QtNetwork
|
||||
|
||||
from openlp.core.lib import SettingsTab, translate
|
||||
|
||||
ZERO_URL = u'0.0.0.0'
|
||||
|
||||
class RemoteTab(SettingsTab):
|
||||
"""
|
||||
RemoteTab is the Remotes settings tab in the settings dialog.
|
||||
@ -51,13 +53,29 @@ class RemoteTab(SettingsTab):
|
||||
self.addressEdit.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp(
|
||||
u'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}'), self))
|
||||
self.addressEdit.setObjectName(u'addressEdit')
|
||||
QtCore.QObject.connect(self.addressEdit,
|
||||
QtCore.SIGNAL(u'textChanged(const QString&)'), self.setUrls)
|
||||
self.serverSettingsLayout.addRow(self.addressLabel, self.addressEdit)
|
||||
self.portLabel = QtGui.QLabel(self.serverSettingsGroupBox)
|
||||
self.portLabel.setObjectName(u'portLabel')
|
||||
self.portSpinBox = QtGui.QSpinBox(self.serverSettingsGroupBox)
|
||||
self.portSpinBox.setMaximum(32767)
|
||||
self.portSpinBox.setObjectName(u'portSpinBox')
|
||||
QtCore.QObject.connect(self.portSpinBox,
|
||||
QtCore.SIGNAL(u'valueChanged(int)'), self.setUrls)
|
||||
self.serverSettingsLayout.addRow(self.portLabel, self.portSpinBox)
|
||||
self.remoteUrlLabel = QtGui.QLabel(self.serverSettingsGroupBox)
|
||||
self.remoteUrlLabel.setObjectName(u'remoteUrlLabel')
|
||||
self.remoteUrl = QtGui.QLabel(self.serverSettingsGroupBox)
|
||||
self.remoteUrl.setObjectName(u'remoteUrl')
|
||||
self.remoteUrl.setOpenExternalLinks(True)
|
||||
self.serverSettingsLayout.addRow(self.remoteUrlLabel, self.remoteUrl)
|
||||
self.stageUrlLabel = QtGui.QLabel(self.serverSettingsGroupBox)
|
||||
self.stageUrlLabel.setObjectName(u'stageUrlLabel')
|
||||
self.stageUrl = QtGui.QLabel(self.serverSettingsGroupBox)
|
||||
self.stageUrl.setObjectName(u'stageUrl')
|
||||
self.stageUrl.setOpenExternalLinks(True)
|
||||
self.serverSettingsLayout.addRow(self.stageUrlLabel, self.stageUrl)
|
||||
self.leftLayout.addWidget(self.serverSettingsGroupBox)
|
||||
self.leftLayout.addStretch()
|
||||
self.rightLayout.addStretch()
|
||||
@ -69,6 +87,34 @@ class RemoteTab(SettingsTab):
|
||||
'Serve on IP address:'))
|
||||
self.portLabel.setText(translate('RemotePlugin.RemoteTab',
|
||||
'Port number:'))
|
||||
self.remoteUrlLabel.setText(translate('RemotePlugin.RemoteTab',
|
||||
'Remote URL:'))
|
||||
self.stageUrlLabel.setText(translate('RemotePlugin.RemoteTab',
|
||||
'Stage view URL:'))
|
||||
|
||||
def setUrls(self):
|
||||
ipAddress = None
|
||||
if self.addressEdit.text() == ZERO_URL:
|
||||
for ip in QtNetwork.QNetworkInterface.allAddresses():
|
||||
if ip.protocol() == 0 and ip != QtNetwork.QHostAddress.LocalHost:
|
||||
ipAddress = ip.toString()
|
||||
break
|
||||
else:
|
||||
ipAddress = self.addressEdit.text()
|
||||
if not ipAddress:
|
||||
self.remoteUrlLabel.setVisible(False)
|
||||
self.remoteUrl.setVisible(False)
|
||||
self.stageUrlLabel.setVisible(False)
|
||||
self.stageUrl.setVisible(False)
|
||||
return
|
||||
self.remoteUrlLabel.setVisible(True)
|
||||
self.remoteUrl.setVisible(True)
|
||||
self.stageUrlLabel.setVisible(True)
|
||||
self.stageUrl.setVisible(True)
|
||||
url = u'http://%s:%s/' % (ipAddress, self.portSpinBox.value())
|
||||
self.remoteUrl.setText(u'<a href="%s">%s</a>' % (url, url))
|
||||
url = url + u'stage'
|
||||
self.stageUrl.setText(u'<a href="%s">%s</a>' % (url, url))
|
||||
|
||||
def load(self):
|
||||
self.portSpinBox.setValue(
|
||||
@ -76,7 +122,8 @@ class RemoteTab(SettingsTab):
|
||||
QtCore.QVariant(4316)).toInt()[0])
|
||||
self.addressEdit.setText(
|
||||
QtCore.QSettings().value(self.settingsSection + u'/ip address',
|
||||
QtCore.QVariant(u'0.0.0.0')).toString())
|
||||
QtCore.QVariant(ZERO_URL)).toString())
|
||||
self.setUrls()
|
||||
|
||||
def save(self):
|
||||
QtCore.QSettings().setValue(self.settingsSection + u'/port',
|
||||
|
Loading…
Reference in New Issue
Block a user