Quantcast

Add an option to hide the total time. (Shown by default.)

Eyal Shilony [11-16-14 - 19:52]
Add an option to hide the total time. (Shown by default.)
Filename
CastingBar.lua
Core.lua
Options.lua
loc/enUS.lua
diff --git a/CastingBar.lua b/CastingBar.lua
index 7d3018f..587d50a 100644
--- a/CastingBar.lua
+++ b/CastingBar.lua
@@ -127,9 +127,14 @@ local function onUpdate(self, elapsed)
 	updateVisibility(self.barFlash, self.barFlash.left, self.barFlash.right)

 	if self.casting then
-		self.time:SetFormattedText('%.1f', self.maxValue - self.value)
+		local value = self.maxValue - self.value
+		if not addon.db.profile.hideTotalTime then
+			self.time:SetFormattedText("%.1f/%.2f", value, self.maxValue)
+		else
+			self.time:SetFormattedText("%.1f", value)
+		end
 	elseif self.channeling then
-		self.time:SetFormattedText('%.1f', self.value)
+		self.time:SetFormattedText("%.1f", self.value)
 	end
 end

diff --git a/Core.lua b/Core.lua
index f38fab1..0d7ee5d 100644
--- a/Core.lua
+++ b/Core.lua
@@ -30,10 +30,11 @@ local defaults = {
 	profile = {
 		width = 195,
         position = {"CENTER", "CENTER", 0, 0},
-		hideIcon = false,
         iconPosition = "Left",
+		hideIcon = false,
+		timePosition = "Outer Right",
+		hideTotalTime = false,
 		hideTime = false,
-		timePosition = "Outer Right"
 	}
 }

diff --git a/Options.lua b/Options.lua
index e48ca8c..a4f30b4 100644
--- a/Options.lua
+++ b/Options.lua
@@ -48,7 +48,7 @@ function options:OnInitialize()
 		},
 		{
 			type = "CheckButton",
-			text = L["Hide icon"],
+			text = L["Hide Icon"],
 			get = function()
 				return addon.db.profile.hideIcon
 			end,
@@ -74,7 +74,17 @@ function options:OnInitialize()
 		},
 		{
 			type = "CheckButton",
-			text = L["Hide time"],
+			text = L["Hide Total Time"],
+			get = function()
+				return addon.db.profile.hideTotalTime
+			end,
+			set = function()
+				addon.db.profile.hideTotalTime = not addon.db.profile.hideTotalTime
+			end
+		},
+		{
+			type = "CheckButton",
+			text = L["Hide Time"],
 			get = function()
 				return addon.db.profile.hideTime
 			end,
diff --git a/loc/enUS.lua b/loc/enUS.lua
index a483c27..1e63483 100644
--- a/loc/enUS.lua
+++ b/loc/enUS.lua
@@ -24,10 +24,11 @@
 local addonName = ...
 local L = LibStub("AceLocale-3.0"):NewLocale(addonName, "enUS", true, false)

-L["Hide icon"] = true
 L["Icon Position"] = true
-L["Hide time"] = true
+L["Hide Icon"] = true
 L["Time Position"] = true
+L["Hide Total Time"] = true
+L["Hide Time"] = true

 L["Profiles"] = true
 L["You can change the active database profile, so you can have different settings for every character."] = true
\ No newline at end of file