mirror of https://gitlab.com/openlp/openlp.git
Allow the stageview time to be formatted between 12 and 24 hours
Fixes: https://launchpad.net/bugs/863841
This commit is contained in:
parent
128b6b80bf
commit
648c5159a1
|
@ -121,11 +121,11 @@ window.OpenLP = {
|
|||
$("#nextslide").html(text);
|
||||
}
|
||||
},
|
||||
updateClock: function() {
|
||||
updateClock: function(data) {
|
||||
var div = $("#clock");
|
||||
var t = new Date();
|
||||
var h = t.getHours();
|
||||
if (h > 12)
|
||||
if (data.results.twelve && h > 12)
|
||||
h = h - 12;
|
||||
var m = t.getMinutes();
|
||||
if (m < 10)
|
||||
|
@ -136,7 +136,7 @@ window.OpenLP = {
|
|||
$.getJSON(
|
||||
"/api/poll",
|
||||
function (data, status) {
|
||||
OpenLP.updateClock();
|
||||
OpenLP.updateClock(data);
|
||||
if (OpenLP.currentItem != data.results.item) {
|
||||
OpenLP.currentItem = data.results.item;
|
||||
OpenLP.loadSlides();
|
||||
|
|
|
@ -397,7 +397,9 @@ class HttpConnection(object):
|
|||
result = {
|
||||
u'slide': self.parent.current_slide or 0,
|
||||
u'item': self.parent.current_item._uuid \
|
||||
if self.parent.current_item else u''
|
||||
if self.parent.current_item else u'',
|
||||
u'twelve':QtCore.QSettings().value(
|
||||
u'remotes/twelve hour', QtCore.QVariant(True)).toBool()
|
||||
}
|
||||
return HttpResponse(json.dumps({u'results': result}),
|
||||
{u'Content-Type': u'application/json'})
|
||||
|
|
|
@ -57,6 +57,9 @@ class RemoteTab(SettingsTab):
|
|||
QtCore.QObject.connect(self.addressEdit,
|
||||
QtCore.SIGNAL(u'textChanged(const QString&)'), self.setUrls)
|
||||
self.serverSettingsLayout.addRow(self.addressLabel, self.addressEdit)
|
||||
self.twelveHourCheckBox = QtGui.QCheckBox(self.serverSettingsGroupBox)
|
||||
self.twelveHourCheckBox.setObjectName(u'twelveHourCheckBox')
|
||||
self.serverSettingsLayout.addRow(self.twelveHourCheckBox)
|
||||
self.portLabel = QtGui.QLabel(self.serverSettingsGroupBox)
|
||||
self.portLabel.setObjectName(u'portLabel')
|
||||
self.portSpinBox = QtGui.QSpinBox(self.serverSettingsGroupBox)
|
||||
|
@ -80,6 +83,9 @@ class RemoteTab(SettingsTab):
|
|||
self.leftLayout.addWidget(self.serverSettingsGroupBox)
|
||||
self.leftLayout.addStretch()
|
||||
self.rightLayout.addStretch()
|
||||
QtCore.QObject.connect(self.twelveHourCheckBox,
|
||||
QtCore.SIGNAL(u'stateChanged(int)'),
|
||||
self.onTwelveHourCheckBoxChanged)
|
||||
|
||||
def retranslateUi(self):
|
||||
self.serverSettingsGroupBox.setTitle(
|
||||
|
@ -92,6 +98,9 @@ class RemoteTab(SettingsTab):
|
|||
'Remote URL:'))
|
||||
self.stageUrlLabel.setText(translate('RemotePlugin.RemoteTab',
|
||||
'Stage view URL:'))
|
||||
self.twelveHourCheckBox.setText(
|
||||
translate('RemotePlugin.RemoteTab',
|
||||
'Display stage time in 12hr format'))
|
||||
|
||||
def setUrls(self):
|
||||
ipAddress = u'localhost'
|
||||
|
@ -123,6 +132,10 @@ class RemoteTab(SettingsTab):
|
|||
self.addressEdit.setText(
|
||||
QtCore.QSettings().value(self.settingsSection + u'/ip address',
|
||||
QtCore.QVariant(ZERO_URL)).toString())
|
||||
self.twelveHour = QtCore.QSettings().value(
|
||||
self.settingsSection + u'/twelve hour',
|
||||
QtCore.QVariant(True)).toBool()
|
||||
self.twelveHourCheckBox.setChecked(self.twelveHour)
|
||||
self.setUrls()
|
||||
|
||||
def save(self):
|
||||
|
@ -130,3 +143,11 @@ class RemoteTab(SettingsTab):
|
|||
QtCore.QVariant(self.portSpinBox.value()))
|
||||
QtCore.QSettings().setValue(self.settingsSection + u'/ip address',
|
||||
QtCore.QVariant(self.addressEdit.text()))
|
||||
QtCore.QSettings().setValue(self.settingsSection + u'/twelve hour',
|
||||
QtCore.QVariant(self.twelveHour))
|
||||
|
||||
def onTwelveHourCheckBoxChanged(self, check_state):
|
||||
self.twelveHour = False
|
||||
# we have a set value convert to True/False
|
||||
if check_state == QtCore.Qt.Checked:
|
||||
self.twelveHour = True
|
||||
|
|
Loading…
Reference in New Issue