Quantcast

Incompatible System

Azilroka [03-15-14 - 17:10]
Incompatible System
Filename
ElvUI_SLE/ElvUI_SLE.lua
ElvUI_SLE/dev/staticpopups.lua
ElvUI_SLE/locales/english.lua
ElvUI_SLE/modules/minimap/minimapicons.lua
ElvUI_SLE/modules/minimap/options.lua
diff --git a/ElvUI_SLE/ElvUI_SLE.lua b/ElvUI_SLE/ElvUI_SLE.lua
index 0ee22da..a62a797 100755
--- a/ElvUI_SLE/ElvUI_SLE.lua
+++ b/ElvUI_SLE/ElvUI_SLE.lua
@@ -163,6 +163,27 @@ function SLE:GetOptions()
 	end
 end

+function SLE:IncompatibleAddOn(addon, module, optiontable, value)
+	E.PopupDialogs['SLE_INCOMPATIBLE_ADDON'].button1 = addon
+	E.PopupDialogs['SLE_INCOMPATIBLE_ADDON'].button2 = 'S&L: '..module
+	E.PopupDialogs['SLE_INCOMPATIBLE_ADDON'].addon = addon
+	E.PopupDialogs['SLE_INCOMPATIBLE_ADDON'].module = module
+	E.PopupDialogs['SLE_INCOMPATIBLE_ADDON'].optiontable = optiontable
+	E.PopupDialogs['SLE_INCOMPATIBLE_ADDON'].value = value
+	E.PopupDialogs['SLE_INCOMPATIBLE_ADDON'].showAlert = true
+	E:StaticPopup_Show('SLE_INCOMPATIBLE_ADDON', addon, module)
+end
+
+function SLE:CheckIncompatible()
+	if E.global.ignoreIncompatible then return; end
+	if IsAddOnLoaded('ElvUI_Enhanced') then
+		E:StaticPopup_Show('ENHANCED_SLE_INCOMPATIBLE')
+	end
+	if IsAddOnLoaded('SquareMinimapButtons') and E.private.sle.minimap.mapicons.enable then
+		SLE:IncompatibleAddOn('SquareMinimapButtons', 'SquareMinimapButtons', E.private.sle.minimap.mapicons, "enable")
+	end
+end
+
 function SLE:Initialize()
 	--Showing warning message about too old versions of ElvUI
 	if tonumber(E.version) < 6.55 then
@@ -182,9 +203,7 @@ function SLE:Initialize()
 	SLE:ConfigCats()
 	SLE:ChatPos()
 	SLE:RegisterCommands()
-	if select(4, GetAddOnInfo('ElvUI_Enhanced')) then
-		E:StaticPopup_Show('ENHANCED_SLE_INCOMPATIBLE')
-	end
+	SLE:CheckIncompatible()
 end

 E:RegisterModule(SLE:GetName())
\ No newline at end of file
diff --git a/ElvUI_SLE/dev/staticpopups.lua b/ElvUI_SLE/dev/staticpopups.lua
index 1cf63e6..6ddd32e 100755
--- a/ElvUI_SLE/dev/staticpopups.lua
+++ b/ElvUI_SLE/dev/staticpopups.lua
@@ -17,4 +17,13 @@ E.PopupDialogs['ENHANCED_SLE_INCOMPATIBLE'] = {
 	timeout = 0,
 	whileDead = 1,
 	hideOnEscape = false,
+}
+
+E.PopupDialogs['SLE_INCOMPATIBLE_ADDON'] = {
+	text = L["SLE_INCOMPATIBLE_ADDON"],
+	OnAccept = function(self) DisableAddOn(E.PopupDialogs['SLE_INCOMPATIBLE_ADDON'].addon); ReloadUI(); end,
+	OnCancel = function(self) E.PopupDialogs['SLE_INCOMPATIBLE_ADDON'].optiontable[E.PopupDialogs['SLE_INCOMPATIBLE_ADDON'].value] = false; ReloadUI(); end,
+	timeout = 0,
+	whileDead = 1,
+	hideOnEscape = false,
 }
\ No newline at end of file
diff --git a/ElvUI_SLE/locales/english.lua b/ElvUI_SLE/locales/english.lua
index 8190a09..512bc06 100755
--- a/ElvUI_SLE/locales/english.lua
+++ b/ElvUI_SLE/locales/english.lua
@@ -26,6 +26,7 @@ L["Reset All"] = true
 L["Reset all Shadow & Light options and movers to their defaults"] = true
 L["Reset these options to defaults"] = true
 L['Oh lord, you have got ElvUI Enhanced and Shadow & Light both enabled at the same time. Select an addon to disable.'] =  true
+L["SLE_INCOMPATIBLE_ADDON"] = "The addon %s is not compatible with Shadow & Light's %s module. Please select either the addon or the Shadow & Light module to disable."

 --Install--
 L["Shadow & Light Settings"] = true
diff --git a/ElvUI_SLE/modules/minimap/minimapicons.lua b/ElvUI_SLE/modules/minimap/minimapicons.lua
index 411362e..e2848a4 100755
--- a/ElvUI_SLE/modules/minimap/minimapicons.lua
+++ b/ElvUI_SLE/modules/minimap/minimapicons.lua
@@ -14,6 +14,7 @@ if E.private.sle == nil then E.private.sle = {} end
 if E.private.sle.minimap == nil then E.private.sle.minimap = {} end
 if E.private.sle.minimap.mapicons == nil then E.private.sle.minimap.mapicons = {} end
 if E.private.sle.minimap.mapicons.enable == nil then E.private.sle.minimap.mapicons.enable = false end
+if E.private.sle.minimap.mapicons.barenable == nil then E.private.sle.minimap.mapicons.barenable = false end

 if E.db.sle.minimap == nil then E.db.sle.minimap = {} end
 if E.db.sle.minimap.mapicons == nil then E.db.sle.minimap.mapicons = {} end
@@ -248,7 +249,7 @@ local function SkinButton(Button)
 end

 function SMB:Update(self)
-	if not E.private.sle.minimap.mapicons.enable then return end
+	if not E.private.sle.minimap.mapicons.barenable then return end

 	local AnchorX, AnchorY, MaxX = 0, 1, E.db.sle.minimap.mapicons.iconperrow
 	local ButtonsPerRow = E.db.sle.minimap.mapicons.iconperrow
@@ -316,6 +317,7 @@ function SMB:Update(self)
 end

 function SMB:Initialize()
+	if not E.private.sle.minimap.mapicons.enable then return end
 	SquareMinimapButtonBar = CreateFrame('Frame', 'SquareMinimapButtonBar', E.UIParent)
 	SquareMinimapButtonBar:RegisterEvent('ADDON_LOADED')
 	SquareMinimapButtonBar.Skin = function()
diff --git a/ElvUI_SLE/modules/minimap/options.lua b/ElvUI_SLE/modules/minimap/options.lua
index 90fcb01..ed5a647 100755
--- a/ElvUI_SLE/modules/minimap/options.lua
+++ b/ElvUI_SLE/modules/minimap/options.lua
@@ -77,10 +77,18 @@ local function configTable()
 						order = 1,
 						type = 'toggle',
 						name = L['Enable'],
-						desc = L['Enable/Disable Square Minimap Bar.'],
+						desc = L['Enable/Disable Square Minimap Buttons.'],
 						get = function(info) return E.private.sle.minimap.mapicons.enable end,
 						set = function(info, value) E.private.sle.minimap.mapicons.enable = value; E:StaticPopup_Show("PRIVATE_RL") end,
 					},
+					barenable = {
+						order = 2,
+						type = "toggle",
+						name = L["Bar Enable"],
+						desc = L['Enable/Disable Square Minimap Bar.'],
+						get = function(info) return E.private.sle.minimap.mapicons.barenable end,
+						set = function(info, value) E.private.sle.minimap.mapicons.barenable = value; E:StaticPopup_Show("PRIVATE_RL") end,
+					},
 					skindungeon = {
 						order = 3,
 						type = 'toggle',