Quantcast

Added option for 12/24h time. This closes #310.

Darthpred [08-29-16 - 17:35]
Added option for 12/24h time. This closes #310.
Additionaly moved previously added options to their font groups
Filename
ElvUI_SLE/defaults/profile.lua
ElvUI_SLE/modules/afk.lua
ElvUI_SLE/options/afk_c.lua
diff --git a/ElvUI_SLE/defaults/profile.lua b/ElvUI_SLE/defaults/profile.lua
index 8c741f5..b38e9ba 100644
--- a/ElvUI_SLE/defaults/profile.lua
+++ b/ElvUI_SLE/defaults/profile.lua
@@ -605,6 +605,7 @@ P["sle"] = {
 				["outline"] = "OUTLINE",
 				["xOffset"] = 0,
 				["yOffset"] = 0,
+				["hour24"] = true,
 			},
 			["player"] = {
 				["font"] = "PT Sans Narrow",
diff --git a/ElvUI_SLE/modules/afk.lua b/ElvUI_SLE/modules/afk.lua
index e588d53..2929205 100644
--- a/ElvUI_SLE/modules/afk.lua
+++ b/ElvUI_SLE/modules/afk.lua
@@ -334,7 +334,11 @@ function S:UpdateTimer()
 	TipsElapsed = TipsElapsed + 1
 	month = SLE.Russian and SLE.RuMonths[T.tonumber(T.date("%m"))] or T.date("%B")
 	week = SLE.Russian and SLE.RuWeek[T.tonumber(T.date("%w"))+1] or T.date("%A")
-	SS.Time:SetText(T.format("%s", T.date("%H|cff00AAFF:|r%M|cff00AAFF:|r%S")))
+	if S.db.date.hour24 then
+		SS.Time:SetText(T.format("%s", T.date("%H|cff00AAFF:|r%M|cff00AAFF:|r%S")))
+	else
+		SS.Time:SetText(T.format("%s", T.date("%I|cff00AAFF:|r%M|cff00AAFF:|r%S %p")))
+	end
 	SS.Date:SetText(T.date("%d").." "..month..", |cff00AAFF"..week.."|r")

 	if TipsElapsed > S.db.tipThrottle then
diff --git a/ElvUI_SLE/options/afk_c.lua b/ElvUI_SLE/options/afk_c.lua
index 3ad37af..be85985 100644
--- a/ElvUI_SLE/options/afk_c.lua
+++ b/ElvUI_SLE/options/afk_c.lua
@@ -37,6 +37,48 @@ local function configTable()
 				},
 			},
 		}
+		if group == "date" then
+			config.args.xOffset = {
+				order = 4,
+				name = L["Date X-Offset"],
+				type = "range",
+				min = -(T.GetScreenWidth()/2), max = T.GetScreenWidth()/2, step = 1,
+				-- get = function(info) return E.db.sle.screensaver.date.xOffset end,
+				set = function(info, value) E.db.sle.screensaver.date.xOffset = value end,
+			}
+			config.args.yOffset = {
+				order = 5,
+				name = L["Date Y-Offset"],
+				type = "range",
+				min = -(T.GetScreenWidth()/2), max = T.GetScreenWidth()/2, step = 1,
+				-- get = function(info) return E.db.sle.screensaver.date.yOffset end,
+				set = function(info, value) E.db.sle.screensaver.date.yOffset = value end,
+			}
+			config.args.hour24 = {
+				order = 6,
+				name = L["24-Hour Time"],
+				type = "toggle",
+				-- get = function(info) return E.db.sle.screensaver.date.hour24 end,
+				set = function(info, value) E.db.sle.screensaver.date.hour24 = value end,
+			}
+		elseif group == "player" then
+			config.args.xOffset = {
+				order = 4,
+				name = L["Player Info X-Offset"],
+				type = "range",
+				min = -(T.GetScreenWidth()/2), max = T.GetScreenWidth()/2, step = 1,
+				-- get = function(info) return E.db.sle.screensaver.player.xOffset end,
+				set = function(info, value) E.db.sle.screensaver.player.xOffset = value end,
+			}
+			config.args.yOffset = {
+				order = 5,
+				name = L["Player Info Y-Offset"],
+				type = "range",
+				min = -(T.GetScreenWidth()/2), max = T.GetScreenWidth()/2, step = 1,
+				-- get = function(info) return E.db.sle.screensaver.player.yOffset end,
+				set = function(info, value) E.db.sle.screensaver.player.yOffset = value end,
+			}
+		end
 		return config
 	end
 	E.Options.args.sle.args.modules.args.screensaver = {
@@ -145,46 +187,6 @@ local function configTable()
 								get = function(info) return E.db.sle.screensaver.height end,
 								set = function(info, value) E.db.sle.screensaver.height = value end,
 							},
-							texts = {
-								order = 4,
-								type = "group",
-								name = L["Texts Positions"],
-								guiInline = true,
-								args = {
-									xOffset_date = {
-										order = 1,
-										name = L["Date X-Offset"],
-										type = "range",
-										min = -(T.GetScreenWidth()/2), max = T.GetScreenWidth()/2, step = 1,
-										get = function(info) return E.db.sle.screensaver.date.xOffset end,
-										set = function(info, value) E.db.sle.screensaver.date.xOffset = value end,
-									},
-									yOffset_date = {
-										order = 1,
-										name = L["Date Y-Offset"],
-										type = "range",
-										min = -(T.GetScreenWidth()/2), max = T.GetScreenWidth()/2, step = 1,
-										get = function(info) return E.db.sle.screensaver.date.yOffset end,
-										set = function(info, value) E.db.sle.screensaver.date.yOffset = value end,
-									},
-									xOffset_player = {
-										order = 1,
-										name = L["Player Info X-Offset"],
-										type = "range",
-										min = -(T.GetScreenWidth()/2), max = T.GetScreenWidth()/2, step = 1,
-										get = function(info) return E.db.sle.screensaver.player.xOffset end,
-										set = function(info, value) E.db.sle.screensaver.player.xOffset = value end,
-									},
-									yOffset_player = {
-										order = 1,
-										name = L["Player Info Y-Offset"],
-										type = "range",
-										min = -(T.GetScreenWidth()/2), max = T.GetScreenWidth()/2, step = 1,
-										get = function(info) return E.db.sle.screensaver.player.yOffset end,
-										set = function(info, value) E.db.sle.screensaver.player.yOffset = value end,
-									},
-								},
-							},
 							animType = {
 								order = 5,
 								name = L["Template"],