tercio@0: --- AceDBOptions-3.0 provides a universal AceConfig options screen for managing AceDB-3.0 profiles. tercio@0: -- @class file tercio@0: -- @name AceDBOptions-3.0 Tercio@11: -- @release $Id: AceDBOptions-3.0.lua 1140 2016-07-03 07:53:29Z nevcairiel $ Tercio@11: local ACEDBO_MAJOR, ACEDBO_MINOR = "AceDBOptions-3.0", 15 tercio@0: local AceDBOptions, oldminor = LibStub:NewLibrary(ACEDBO_MAJOR, ACEDBO_MINOR) tercio@0: tercio@0: if not AceDBOptions then return end -- No upgrade needed tercio@0: tercio@0: -- Lua APIs tercio@0: local pairs, next = pairs, next tercio@0: tercio@0: -- WoW APIs tercio@0: local UnitClass = UnitClass tercio@0: tercio@0: -- Global vars/functions that we don't upvalue since they might get hooked, or upgraded tercio@0: -- List them here for Mikk's FindGlobals script tercio@0: -- GLOBALS: NORMAL_FONT_COLOR_CODE, FONT_COLOR_CODE_CLOSE tercio@0: tercio@0: AceDBOptions.optionTables = AceDBOptions.optionTables or {} tercio@0: AceDBOptions.handlers = AceDBOptions.handlers or {} tercio@0: tercio@0: --[[ tercio@0: Localization of AceDBOptions-3.0 tercio@0: ]] tercio@0: tercio@0: local L = { tercio@0: choose = "Existing Profiles", tercio@0: choose_desc = "You can either create a new profile by entering a name in the editbox, or choose one of the already existing profiles.", tercio@0: choose_sub = "Select one of your currently available profiles.", tercio@0: copy = "Copy From", tercio@0: copy_desc = "Copy the settings from one existing profile into the currently active profile.", tercio@0: current = "Current Profile:", tercio@0: default = "Default", tercio@0: delete = "Delete a Profile", tercio@0: delete_confirm = "Are you sure you want to delete the selected profile?", tercio@0: delete_desc = "Delete existing and unused profiles from the database to save space, and cleanup the SavedVariables file.", tercio@0: delete_sub = "Deletes a profile from the database.", tercio@0: intro = "You can change the active database profile, so you can have different settings for every character.", tercio@0: new = "New", tercio@0: new_sub = "Create a new empty profile.", tercio@0: profiles = "Profiles", tercio@0: profiles_sub = "Manage Profiles", tercio@0: reset = "Reset Profile", tercio@0: reset_desc = "Reset the current profile back to its default values, in case your configuration is broken, or you simply want to start over.", tercio@0: reset_sub = "Reset the current profile to the default", tercio@0: } tercio@0: tercio@0: local LOCALE = GetLocale() tercio@0: if LOCALE == "deDE" then tercio@0: L["choose"] = "Vorhandene Profile" tercio@0: L["choose_desc"] = "Du kannst ein neues Profil erstellen, indem du einen neuen Namen in der Eingabebox 'Neu' eingibst, oder wähle eines der vorhandenen Profile aus." tercio@0: L["choose_sub"] = "Wählt ein bereits vorhandenes Profil aus." tercio@0: L["copy"] = "Kopieren von..." tercio@0: L["copy_desc"] = "Kopiere die Einstellungen von einem vorhandenen Profil in das aktive Profil." Tercio@11: L["current"] = "Aktuelles Profil:" tercio@0: L["default"] = "Standard" tercio@0: L["delete"] = "Profil löschen" tercio@0: L["delete_confirm"] = "Willst du das ausgewählte Profil wirklich löschen?" Tercio@11: L["delete_desc"] = "Lösche vorhandene oder unbenutzte Profile aus der Datenbank, um Platz zu sparen und die SavedVariables-Datei 'sauber' zu halten." tercio@0: L["delete_sub"] = "Löscht ein Profil aus der Datenbank." Tercio@11: L["intro"] = "Hier kannst du das aktive Datenbankprofil ändern, damit du verschiedene Einstellungen für jeden Charakter erstellen kannst, wodurch eine sehr flexible Konfiguration möglich wird." tercio@0: L["new"] = "Neu" tercio@0: L["new_sub"] = "Ein neues Profil erstellen." tercio@0: L["profiles"] = "Profile" tercio@0: L["profiles_sub"] = "Profile verwalten" tercio@0: L["reset"] = "Profil zurücksetzen" Tercio@11: L["reset_desc"] = "Setzt das momentane Profil auf Standardwerte zurück, für den Fall, dass mit der Konfiguration etwas schief lief oder weil du einfach neu starten willst." tercio@0: L["reset_sub"] = "Das aktuelle Profil auf Standard zurücksetzen." tercio@0: elseif LOCALE == "frFR" then tercio@0: L["choose"] = "Profils existants" tercio@0: L["choose_desc"] = "Vous pouvez créer un nouveau profil en entrant un nouveau nom dans la boîte de saisie, ou en choississant un des profils déjà existants." tercio@0: L["choose_sub"] = "Permet de choisir un des profils déjà disponibles." tercio@0: L["copy"] = "Copier à partir de" tercio@0: L["copy_desc"] = "Copie les paramètres d'un profil déjà existant dans le profil actuellement actif." Tercio@11: L["current"] = "Profil actuel :" tercio@0: L["default"] = "Défaut" tercio@0: L["delete"] = "Supprimer un profil" tercio@0: L["delete_confirm"] = "Etes-vous sûr de vouloir supprimer le profil sélectionné ?" tercio@0: L["delete_desc"] = "Supprime les profils existants inutilisés de la base de données afin de gagner de la place et de nettoyer le fichier SavedVariables." tercio@0: L["delete_sub"] = "Supprime un profil de la base de données." tercio@0: L["intro"] = "Vous pouvez changer le profil actuel afin d'avoir des paramètres différents pour chaque personnage, permettant ainsi d'avoir une configuration très flexible." tercio@0: L["new"] = "Nouveau" tercio@0: L["new_sub"] = "Créée un nouveau profil vierge." tercio@0: L["profiles"] = "Profils" tercio@0: L["profiles_sub"] = "Gestion des profils" tercio@0: L["reset"] = "Réinitialiser le profil" tercio@0: L["reset_desc"] = "Réinitialise le profil actuel au cas où votre configuration est corrompue ou si vous voulez tout simplement faire table rase." tercio@0: L["reset_sub"] = "Réinitialise le profil actuel avec les paramètres par défaut." tercio@0: elseif LOCALE == "koKR" then Tercio@11: L["choose"] = "저장 중인 프로필" Tercio@11: L["choose_desc"] = "입력창에 새로운 이름을 입력하거나 저장 중인 프로필 중 하나를 선택하여 새로운 프로필을 만들 수 있습니다." Tercio@11: L["choose_sub"] = "현재 이용할 수 있는 프로필 중 하나를 선택합니다." Tercio@11: L["copy"] = "복사해오기" Tercio@11: L["copy_desc"] = "현재 사용 중인 프로필에 선택한 프로필의 설정을 복사합니다." Tercio@11: L["current"] = "현재 프로필:" tercio@0: L["default"] = "기본값" tercio@0: L["delete"] = "프로필 삭제" Tercio@11: L["delete_confirm"] = "정말로 선택한 프로필을 삭제할까요?" Tercio@11: L["delete_desc"] = "저장 공간 절약과 SavedVariables 파일의 정리를 위해 데이터베이스에서 사용하지 않는 프로필을 삭제하세요." tercio@0: L["delete_sub"] = "데이터베이스의 프로필을 삭제합니다." Tercio@11: L["intro"] = "활성 데이터베이스 프로필을 변경할 수 있고, 각 캐릭터 별로 다른 설정을 할 수 있습니다." tercio@0: L["new"] = "새로운 프로필" tercio@0: L["new_sub"] = "새로운 프로필을 만듭니다." tercio@0: L["profiles"] = "프로필" Tercio@11: L["profiles_sub"] = "프로필 관리" tercio@0: L["reset"] = "프로필 초기화" Tercio@11: L["reset_desc"] = "설정이 깨졌거나 처음부터 다시 설정을 원하는 경우, 현재 프로필을 기본값으로 초기화하세요." Tercio@11: L["reset_sub"] = "현재 프로필을 기본값으로 초기화합니다" tercio@0: elseif LOCALE == "esES" or LOCALE == "esMX" then tercio@0: L["choose"] = "Perfiles existentes" tercio@0: L["choose_desc"] = "Puedes crear un nuevo perfil introduciendo un nombre en el recuadro o puedes seleccionar un perfil de los ya existentes." tercio@0: L["choose_sub"] = "Selecciona uno de los perfiles disponibles." tercio@0: L["copy"] = "Copiar de" tercio@0: L["copy_desc"] = "Copia los ajustes de un perfil existente al perfil actual." Tercio@11: L["current"] = "Perfil actual:" tercio@0: L["default"] = "Por defecto" tercio@0: L["delete"] = "Borrar un Perfil" tercio@0: L["delete_confirm"] = "¿Estas seguro que quieres borrar el perfil seleccionado?" tercio@0: L["delete_desc"] = "Borra los perfiles existentes y sin uso de la base de datos para ganar espacio y limpiar el archivo SavedVariables." tercio@0: L["delete_sub"] = "Borra un perfil de la base de datos." tercio@0: L["intro"] = "Puedes cambiar el perfil activo de tal manera que cada personaje tenga diferentes configuraciones." tercio@0: L["new"] = "Nuevo" tercio@0: L["new_sub"] = "Crear un nuevo perfil vacio." tercio@0: L["profiles"] = "Perfiles" tercio@0: L["profiles_sub"] = "Manejar Perfiles" tercio@0: L["reset"] = "Reiniciar Perfil" tercio@0: L["reset_desc"] = "Reinicia el perfil actual a los valores por defectos, en caso de que se haya estropeado la configuración o quieras volver a empezar de nuevo." tercio@0: L["reset_sub"] = "Reinicar el perfil actual al de por defecto" tercio@0: elseif LOCALE == "zhTW" then tercio@0: L["choose"] = "現有的設定檔" Tercio@11: L["choose_desc"] = "您可以在文字方塊內輸入名字以建立新的設定檔,或是選擇一個現有的設定檔使用。" Tercio@11: L["choose_sub"] = "從當前可用的設定檔裡面選擇一個。" tercio@0: L["copy"] = "複製自" Tercio@11: L["copy_desc"] = "從一個現有的設定檔,將設定複製到現在使用中的設定檔。" Tercio@11: L["current"] = "目前設定檔:" tercio@0: L["default"] = "預設" tercio@0: L["delete"] = "刪除一個設定檔" Tercio@11: L["delete_confirm"] = "確定要刪除所選擇的設定檔嗎?" Tercio@11: L["delete_desc"] = "從資料庫裡刪除不再使用的設定檔,以節省空間,並且清理 SavedVariables 檔案。" Tercio@11: L["delete_sub"] = "從資料庫裡刪除一個設定檔。" Tercio@11: L["intro"] = "您可以從資料庫中選擇一個設定檔來使用,如此就可以讓每個角色使用不同的設定。" tercio@0: L["new"] = "新建" tercio@0: L["new_sub"] = "新建一個空的設定檔。" tercio@0: L["profiles"] = "設定檔" tercio@0: L["profiles_sub"] = "管理設定檔" tercio@0: L["reset"] = "重置設定檔" Tercio@11: L["reset_desc"] = "將現用的設定檔重置為預設值;用於設定檔損壞,或者單純想要重來的情況。" Tercio@11: L["reset_sub"] = "將目前的設定檔重置為預設值" tercio@0: elseif LOCALE == "zhCN" then tercio@0: L["choose"] = "现有的配置文件" tercio@0: L["choose_desc"] = "你可以通过在文本框内输入一个名字创立一个新的配置文件,也可以选择一个已经存在的配置文件。" tercio@0: L["choose_sub"] = "从当前可用的配置文件里面选择一个。" tercio@0: L["copy"] = "复制自" tercio@0: L["copy_desc"] = "从当前某个已保存的配置文件复制到当前正使用的配置文件。" Tercio@11: L["current"] = "当前配置文件:" tercio@0: L["default"] = "默认" tercio@0: L["delete"] = "删除一个配置文件" tercio@0: L["delete_confirm"] = "你确定要删除所选择的配置文件么?" tercio@0: L["delete_desc"] = "从数据库里删除不再使用的配置文件,以节省空间,并且清理SavedVariables文件。" tercio@0: L["delete_sub"] = "从数据库里删除一个配置文件。" tercio@0: L["intro"] = "你可以选择一个活动的数据配置文件,这样你的每个角色就可以拥有不同的设置值,可以给你的插件配置带来极大的灵活性。" tercio@0: L["new"] = "新建" tercio@0: L["new_sub"] = "新建一个空的配置文件。" tercio@0: L["profiles"] = "配置文件" tercio@0: L["profiles_sub"] = "管理配置文件" tercio@0: L["reset"] = "重置配置文件" tercio@0: L["reset_desc"] = "将当前的配置文件恢复到它的默认值,用于你的配置文件损坏,或者你只是想重来的情况。" tercio@0: L["reset_sub"] = "将当前的配置文件恢复为默认值" tercio@0: elseif LOCALE == "ruRU" then tercio@0: L["choose"] = "Существующие профили" tercio@0: L["choose_desc"] = "Вы можете создать новый профиль, введя название в поле ввода, или выбрать один из уже существующих профилей." tercio@0: L["choose_sub"] = "Выбор одиного из уже доступных профилей" tercio@0: L["copy"] = "Скопировать из" tercio@0: L["copy_desc"] = "Скопировать настройки из выбранного профиля в активный." Tercio@11: L["current"] = "Текущий профиль:" tercio@0: L["default"] = "По умолчанию" tercio@0: L["delete"] = "Удалить профиль" tercio@0: L["delete_confirm"] = "Вы уверены, что вы хотите удалить выбранный профиль?" tercio@0: L["delete_desc"] = "Удалить существующий и неиспользуемый профиль из БД для сохранения места, и очистить SavedVariables файл." tercio@0: L["delete_sub"] = "Удаление профиля из БД" tercio@0: L["intro"] = "Изменяя активный профиль, вы можете задать различные настройки модификаций для каждого персонажа." tercio@0: L["new"] = "Новый" tercio@0: L["new_sub"] = "Создать новый чистый профиль" tercio@0: L["profiles"] = "Профили" tercio@0: L["profiles_sub"] = "Управление профилями" tercio@0: L["reset"] = "Сброс профиля" Tercio@11: L["reset_desc"] = "Сбросить текущий профиль к стандартным настройкам, если ваша конфигурация испорчена или вы хотите настроить всё заново." tercio@0: L["reset_sub"] = "Сброс текущего профиля на стандартный" tercio@0: elseif LOCALE == "itIT" then Tercio@11: L["choose"] = "Profili Esistenti" Tercio@11: L["choose_desc"] = "Puoi creare un nuovo profilo digitando il nome della casella di testo, oppure scegliendone uno tra i profili già esistenti." Tercio@11: L["choose_sub"] = "Seleziona uno dei profili attualmente disponibili." tercio@0: L["copy"] = "Copia Da" tercio@0: L["copy_desc"] = "Copia le impostazioni da un profilo esistente, nel profilo attivo in questo momento." tercio@0: L["current"] = "Profilo Attivo:" tercio@0: L["default"] = "Standard" Tercio@11: L["delete"] = "Cancella un Profilo" tercio@0: L["delete_confirm"] = "Sei sicuro di voler cancellare il profilo selezionato?" tercio@0: L["delete_desc"] = "Cancella i profili non utilizzati dal database per risparmiare spazio e mantenere puliti i file di configurazione SavedVariables." tercio@0: L["delete_sub"] = "Cancella un profilo dal Database." tercio@0: L["intro"] = "Puoi cambiare il profilo attivo, in modo da usare impostazioni diverse per ogni personaggio." tercio@0: L["new"] = "Nuovo" tercio@0: L["new_sub"] = "Crea un nuovo profilo vuoto." tercio@0: L["profiles"] = "Profili" tercio@0: L["profiles_sub"] = "Gestisci Profili" tercio@0: L["reset"] = "Reimposta Profilo" Tercio@11: L["reset_desc"] = "Riporta il tuo profilo attivo alle sue impostazioni predefinite, nel caso in cui la tua configurazione si sia corrotta, o semplicemente tu voglia re-inizializzarla." Tercio@11: L["reset_sub"] = "Reimposta il profilo ai suoi valori predefiniti." Tercio@11: elseif LOCALE == "ptBR" then Tercio@11: L["choose"] = "Perfis Existentes" Tercio@11: L["choose_desc"] = "Você pode tanto criar um perfil novo tanto digitando um nome na caixa de texto, quanto escolher um dos perfis já existentes." Tercio@11: L["choose_sub"] = "Selecione um de seus perfis atualmente disponíveis." Tercio@11: L["copy"] = "Copiar De" Tercio@11: L["copy_desc"] = "Copia as definições de um perfil existente no perfil atualmente ativo." Tercio@11: L["current"] = "Perfil Autal:" Tercio@11: L["default"] = "Padrão" Tercio@11: L["delete"] = "Remover um Perfil" Tercio@11: L["delete_confirm"] = "Tem certeza que deseja remover o perfil selecionado?" Tercio@11: L["delete_desc"] = "Remove perfis existentes e inutilizados do banco de dados para economizar espaço, e limpar o arquivo SavedVariables." Tercio@11: L["delete_sub"] = "Remove um perfil do banco de dados." Tercio@11: L["intro"] = "Você pode alterar o perfil do banco de dados ativo, para que possa ter definições diferentes para cada personagem." Tercio@11: L["new"] = "Novo" Tercio@11: L["new_sub"] = "Cria um novo perfil vazio." Tercio@11: L["profiles"] = "Perfis" Tercio@11: L["profiles_sub"] = "Gerenciar Perfis" Tercio@11: L["reset"] = "Resetar Perfil" Tercio@11: L["reset_desc"] = "Reseta o perfil atual para os valores padrões, no caso de sua configuração estar quebrada, ou simplesmente se deseja começar novamente." Tercio@11: L["reset_sub"] = "Resetar o perfil atual ao padrão" tercio@0: end tercio@0: tercio@0: local defaultProfiles tercio@0: local tmpprofiles = {} tercio@0: tercio@0: -- Get a list of available profiles for the specified database. tercio@0: -- You can specify which profiles to include/exclude in the list using the two boolean parameters listed below. tercio@0: -- @param db The db object to retrieve the profiles from tercio@0: -- @param common If true, getProfileList will add the default profiles to the return list, even if they have not been created yet tercio@0: -- @param nocurrent If true, then getProfileList will not display the current profile in the list tercio@0: -- @return Hashtable of all profiles with the internal name as keys and the display name as value. tercio@0: local function getProfileList(db, common, nocurrent) tercio@0: local profiles = {} tercio@0: tercio@0: -- copy existing profiles into the table tercio@0: local currentProfile = db:GetCurrentProfile() tercio@0: for i,v in pairs(db:GetProfiles(tmpprofiles)) do tercio@0: if not (nocurrent and v == currentProfile) then tercio@0: profiles[v] = v tercio@0: end tercio@0: end tercio@0: tercio@0: -- add our default profiles to choose from ( or rename existing profiles) tercio@0: for k,v in pairs(defaultProfiles) do tercio@0: if (common or profiles[k]) and not (nocurrent and k == currentProfile) then tercio@0: profiles[k] = v tercio@0: end tercio@0: end tercio@0: tercio@0: return profiles tercio@0: end tercio@0: tercio@0: --[[ tercio@0: OptionsHandlerPrototype tercio@0: prototype class for handling the options in a sane way tercio@0: ]] tercio@0: local OptionsHandlerPrototype = {} tercio@0: tercio@0: --[[ Reset the profile ]] tercio@0: function OptionsHandlerPrototype:Reset() tercio@0: self.db:ResetProfile() tercio@0: end tercio@0: tercio@0: --[[ Set the profile to value ]] tercio@0: function OptionsHandlerPrototype:SetProfile(info, value) tercio@0: self.db:SetProfile(value) tercio@0: end tercio@0: tercio@0: --[[ returns the currently active profile ]] tercio@0: function OptionsHandlerPrototype:GetCurrentProfile() tercio@0: return self.db:GetCurrentProfile() tercio@0: end tercio@0: tercio@0: --[[ tercio@0: List all active profiles tercio@0: you can control the output with the .arg variable tercio@0: currently four modes are supported tercio@0: tercio@0: (empty) - return all available profiles tercio@0: "nocurrent" - returns all available profiles except the currently active profile tercio@0: "common" - returns all avaialble profiles + some commonly used profiles ("char - realm", "realm", "class", "Default") tercio@0: "both" - common except the active profile tercio@0: ]] tercio@0: function OptionsHandlerPrototype:ListProfiles(info) tercio@0: local arg = info.arg tercio@0: local profiles tercio@0: if arg == "common" and not self.noDefaultProfiles then tercio@0: profiles = getProfileList(self.db, true, nil) tercio@0: elseif arg == "nocurrent" then tercio@0: profiles = getProfileList(self.db, nil, true) tercio@0: elseif arg == "both" then -- currently not used tercio@0: profiles = getProfileList(self.db, (not self.noDefaultProfiles) and true, true) tercio@0: else tercio@0: profiles = getProfileList(self.db) tercio@0: end tercio@0: tercio@0: return profiles tercio@0: end tercio@0: tercio@0: function OptionsHandlerPrototype:HasNoProfiles(info) tercio@0: local profiles = self:ListProfiles(info) tercio@0: return ((not next(profiles)) and true or false) tercio@0: end tercio@0: tercio@0: --[[ Copy a profile ]] tercio@0: function OptionsHandlerPrototype:CopyProfile(info, value) tercio@0: self.db:CopyProfile(value) tercio@0: end tercio@0: tercio@0: --[[ Delete a profile from the db ]] tercio@0: function OptionsHandlerPrototype:DeleteProfile(info, value) tercio@0: self.db:DeleteProfile(value) tercio@0: end tercio@0: tercio@0: --[[ fill defaultProfiles with some generic values ]] tercio@0: local function generateDefaultProfiles(db) tercio@0: defaultProfiles = { tercio@0: ["Default"] = L["default"], tercio@0: [db.keys.char] = db.keys.char, tercio@0: [db.keys.realm] = db.keys.realm, tercio@0: [db.keys.class] = UnitClass("player") tercio@0: } tercio@0: end tercio@0: tercio@0: --[[ create and return a handler object for the db, or upgrade it if it already existed ]] tercio@0: local function getOptionsHandler(db, noDefaultProfiles) tercio@0: if not defaultProfiles then tercio@0: generateDefaultProfiles(db) tercio@0: end tercio@0: tercio@0: local handler = AceDBOptions.handlers[db] or { db = db, noDefaultProfiles = noDefaultProfiles } tercio@0: tercio@0: for k,v in pairs(OptionsHandlerPrototype) do tercio@0: handler[k] = v tercio@0: end tercio@0: tercio@0: AceDBOptions.handlers[db] = handler tercio@0: return handler tercio@0: end tercio@0: tercio@0: --[[ tercio@0: the real options table tercio@0: ]] tercio@0: local optionsTable = { tercio@0: desc = { tercio@0: order = 1, tercio@0: type = "description", tercio@0: name = L["intro"] .. "\n", tercio@0: }, tercio@0: descreset = { tercio@0: order = 9, tercio@0: type = "description", tercio@0: name = L["reset_desc"], tercio@0: }, tercio@0: reset = { tercio@0: order = 10, tercio@0: type = "execute", tercio@0: name = L["reset"], tercio@0: desc = L["reset_sub"], tercio@0: func = "Reset", tercio@0: }, tercio@0: current = { tercio@0: order = 11, tercio@0: type = "description", tercio@0: name = function(info) return L["current"] .. " " .. NORMAL_FONT_COLOR_CODE .. info.handler:GetCurrentProfile() .. FONT_COLOR_CODE_CLOSE end, tercio@0: width = "default", tercio@0: }, tercio@0: choosedesc = { tercio@0: order = 20, tercio@0: type = "description", tercio@0: name = "\n" .. L["choose_desc"], tercio@0: }, tercio@0: new = { tercio@0: name = L["new"], tercio@0: desc = L["new_sub"], tercio@0: type = "input", tercio@0: order = 30, tercio@0: get = false, tercio@0: set = "SetProfile", tercio@0: }, tercio@0: choose = { tercio@0: name = L["choose"], tercio@0: desc = L["choose_sub"], tercio@0: type = "select", tercio@0: order = 40, tercio@0: get = "GetCurrentProfile", tercio@0: set = "SetProfile", tercio@0: values = "ListProfiles", tercio@0: arg = "common", tercio@0: }, tercio@0: copydesc = { tercio@0: order = 50, tercio@0: type = "description", tercio@0: name = "\n" .. L["copy_desc"], tercio@0: }, tercio@0: copyfrom = { tercio@0: order = 60, tercio@0: type = "select", tercio@0: name = L["copy"], tercio@0: desc = L["copy_desc"], tercio@0: get = false, tercio@0: set = "CopyProfile", tercio@0: values = "ListProfiles", tercio@0: disabled = "HasNoProfiles", tercio@0: arg = "nocurrent", tercio@0: }, tercio@0: deldesc = { tercio@0: order = 70, tercio@0: type = "description", tercio@0: name = "\n" .. L["delete_desc"], tercio@0: }, tercio@0: delete = { tercio@0: order = 80, tercio@0: type = "select", tercio@0: name = L["delete"], tercio@0: desc = L["delete_sub"], tercio@0: get = false, tercio@0: set = "DeleteProfile", tercio@0: values = "ListProfiles", tercio@0: disabled = "HasNoProfiles", tercio@0: arg = "nocurrent", tercio@0: confirm = true, tercio@0: confirmText = L["delete_confirm"], tercio@0: }, tercio@0: } tercio@0: tercio@0: --- Get/Create a option table that you can use in your addon to control the profiles of AceDB-3.0. tercio@0: -- @param db The database object to create the options table for. tercio@0: -- @return The options table to be used in AceConfig-3.0 tercio@0: -- @usage tercio@0: -- -- Assuming `options` is your top-level options table and `self.db` is your database: tercio@0: -- options.args.profiles = LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db) tercio@0: function AceDBOptions:GetOptionsTable(db, noDefaultProfiles) tercio@0: local tbl = AceDBOptions.optionTables[db] or { tercio@0: type = "group", tercio@0: name = L["profiles"], tercio@0: desc = L["profiles_sub"], tercio@0: } tercio@0: tercio@0: tbl.handler = getOptionsHandler(db, noDefaultProfiles) tercio@0: tbl.args = optionsTable tercio@0: tercio@0: AceDBOptions.optionTables[db] = tbl tercio@0: return tbl tercio@0: end tercio@0: tercio@0: -- upgrade existing tables tercio@0: for db,tbl in pairs(AceDBOptions.optionTables) do tercio@0: tbl.handler = getOptionsHandler(db) tercio@0: tbl.args = optionsTable tercio@0: end