CRe top status bar: ensure 12-hours clock setting

This commit is contained in:
poire-z
2021-01-29 01:02:15 +01:00
parent 8ff50a9e24
commit fbdff1c672
2 changed files with 7 additions and 0 deletions

View File

@@ -40,6 +40,8 @@ function ReaderCoptListener:onReadSettings(config)
self.ui.document._document:setIntProperty("window.status.battery.percent", self.battery_percent)
self.ui.document._document:setIntProperty("window.status.pos.percent", self.reading_percent)
self:onTimeFormatChanged()
local status_line = config:readSetting("copt_status_line") or G_reader_settings:readSetting("copt_status_line") or 1
self.ui:handleEvent(Event:new("SetStatusLine", status_line, true))
end
@@ -48,6 +50,10 @@ function ReaderCoptListener:onSetFontSize(font_size)
self.document.configurable.font_size = font_size
end
function ReaderCoptListener:onTimeFormatChanged()
self.ui.document._document:setIntProperty("window.status.clock.12hours", G_reader_settings:isTrue("twelve_hour_clock") and 1 or 0)
end
function ReaderCoptListener:setAndSave(setting, property, value)
self.ui.document._document:setIntProperty(property, value)
G_reader_settings:saveSetting(setting, value)

View File

@@ -81,6 +81,7 @@ common_settings.time = {
end,
callback = function()
G_reader_settings:flipNilOrFalse("twelve_hour_clock")
UIManager:broadcastEvent(Event:new("TimeFormatChanged"))
end,
}
}