/branches
--[[ |
**************************************************************************************** |
LibAboutPanel |
File date: 2009-03-06T19:03:08Z |
File revision: @file-revision@ |
Project version: v1.33-1-g687a309 |
File date: 2009-06-23T02:04:30Z |
Project version: v1.43 |
Author: Tekkub |
Modifications: Ackis |
Author: Tekkub, Ackis |
**************************************************************************************** |
]]-- |
local lib, oldminor = LibStub:NewLibrary("LibAboutPanel", 1) |
local lib, oldminor = LibStub:NewLibrary("LibAboutPanel", 2) |
if not lib then return end |
function lib.new(parent, addonname) |
return frame |
end |
--[[ |
local GAME_LOCALE = GetLocale() |
if GAME_LOCALE ~= "frFR" then |
GAME_LOCALE = "enUS" |
end |
local L = {} |
if GAME_LOCALE == "enUS" then |
L["About"] = true |
L["Click and press Ctrl-C to copy"] = true |
elseif GAME_LOCALE == "frFR" then |
-- frFR |
if GAME_LOCALE == "frFR" then |
L["About"] = "Ã propos de" |
L["Click and press Ctrl-C to copy"] = true |
L["Click and press Ctrl-C to copy"] = "Click and press Ctrl-C to copy" |
-- deDE |
elseif GAME_LOCALE == "deDE" then |
L["About"] = "Ãber" |
L["Click and press Ctrl-C to copy"] = "Klicken und Strg-C drücken zum kopieren" |
-- esES |
elseif GAME_LOCALE == "esES" then |
L["About"] = "Acerca de" |
L["Click and press Ctrl-C to copy"] = "Click and press Ctrl-C to copy" |
-- esMX |
elseif GAME_LOCALE == "esMX" then |
L["About"] = "Sobre" |
L["Click and press Ctrl-C to copy"] = "Click and press Ctrl-C to copy" |
-- koKR |
elseif GAME_LOCALE == "koKR" then |
L["About"] = "ëíì¬" |
L["Click and press Ctrl-C to copy"] = "Click and press Ctrl-C to copy" |
-- ruRU |
elseif GAME_LOCALE == "ruRU" then |
L["About"] = "Ðб аддоне" |
L["Click and press Ctrl-C to copy"] = "Click and press Ctrl-C to copy" |
-- zhCN |
elseif GAME_LOCALE == "zhCN" then |
L["About"] = "å ³äº" |
L["Click and press Ctrl-C to copy"] = "ç¹å»å¹¶ Ctrl-C å¤å¶" |
-- zhTW |
elseif GAME_LOCALE == "zhTW" then |
L["About"] = "éæ¼" |
L["Click and press Ctrl-C to copy"] = "é»æ並 Ctrl-C 復å¶" |
-- enUS and non-localized |
else |
L["About"] ="About" |
L["Click and press Ctrl-C to copy"] = "Click and press Ctrl-C to copy" |
end |
]]-- |
local editbox = CreateFrame('EditBox', nil, UIParent) |
editbox:Hide() |
editbox:SetAutoFocus(true) |
local fields = {"Version", "Author", "X-Category", "X-License", "X-Email", "Email", "eMail", "X-Website", "X-Credits", "X-Localizations", "X-Donate"} |
local haseditbox = {["Version"] = true, ["X-Website"] = true, ["X-Email"] = true, ["X-Donate"] = true, ["Email"] = true, ["eMail"] = true} |
local haseditbox = {["X-Website"] = true, ["X-Email"] = true, ["X-Donate"] = true, ["Email"] = true, ["eMail"] = true} |
local function HideTooltip() GameTooltip:Hide() end |
local function ShowTooltip(self) |
GameTooltip:SetOwner(self, "ANCHOR_TOPRIGHT") |
--GameTooltip:SetText(L["Click and press Ctrl-C to copy"]) |
GameTooltip:SetText("Click and press Ctrl-C to copy") |
GameTooltip:SetText(L["Click and press Ctrl-C to copy"]) |
--GameTooltip:SetText("Click and press Ctrl-C to copy") |
end |
function lib.OnShow(frame) |
--[[ |
local notefield = "Notes" |
if (GAME_LOCALE ~= "enUS") then |
notefield = notefield .. "-" .. GAME_LOCALE |
end |
-- Get the localized version of notes if it exists or fall back to the english one. |
local notes = GetAddOnMetadata(frame.addonname, notefield) or GetAddOnMetadata(frame.addonname, "Notes") |
]]-- |
local notes = GetAddOnMetadata(frame.addonname, "Notes") |
local title = frame:CreateFontString(nil, "ARTWORK", "GameFontNormalLarge") |
title:SetPoint("TOPLEFT", 16, -16) |
title:SetText(frame.parent and (frame.parent.." - About") or frame.name) |
title:SetText(frame.parent and (frame.parent.." - " .. L["About"]) or frame.name) |
local subtitle = frame:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall") |
subtitle:SetHeight(32) |
detail:SetJustifyH("LEFT") |
if (field == "Author") then |
local authorservername = GetAddOnMetadata(frame.addonname, "X-Author-Server") |
local authorfaction = GetAddOnMetadata(frame.addonname, "X-Author-Faction") |
else |
detail:SetText((haseditbox[field] and "|cff9999ff" or "").. val) |
end |
elseif (field == "Version") then |
local addonversion = GetAddOnMetadata(frame.addonname, field) |
-- Remove @project-revision@ and replace it with Repository |
addonversion = string.gsub(addonversion,"@project.revision@","Repository") |
detail:SetText((haseditbox[field] and "|cff9999ff" or "").. addonversion) |
else |
detail:SetText((haseditbox[field] and "|cff9999ff" or "").. val) |
end |