Mercurial > wow > hotcorners
comparison Libs/AceDBOptions-3.0/AceDBOptions-3.0.lua @ 0:fc346da3afd9
First commit Hot Corners standalone.
| author | tercio |
|---|---|
| date | Fri, 08 Aug 2014 12:35:17 -0300 |
| parents | |
| children | 371e14cd2feb |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:fc346da3afd9 |
|---|---|
| 1 --- AceDBOptions-3.0 provides a universal AceConfig options screen for managing AceDB-3.0 profiles. | |
| 2 -- @class file | |
| 3 -- @name AceDBOptions-3.0 | |
| 4 -- @release $Id: AceDBOptions-3.0.lua 1066 2012-09-18 14:36:49Z nevcairiel $ | |
| 5 local ACEDBO_MAJOR, ACEDBO_MINOR = "AceDBOptions-3.0", 14 | |
| 6 local AceDBOptions, oldminor = LibStub:NewLibrary(ACEDBO_MAJOR, ACEDBO_MINOR) | |
| 7 | |
| 8 if not AceDBOptions then return end -- No upgrade needed | |
| 9 | |
| 10 -- Lua APIs | |
| 11 local pairs, next = pairs, next | |
| 12 | |
| 13 -- WoW APIs | |
| 14 local UnitClass = UnitClass | |
| 15 | |
| 16 -- Global vars/functions that we don't upvalue since they might get hooked, or upgraded | |
| 17 -- List them here for Mikk's FindGlobals script | |
| 18 -- GLOBALS: NORMAL_FONT_COLOR_CODE, FONT_COLOR_CODE_CLOSE | |
| 19 | |
| 20 AceDBOptions.optionTables = AceDBOptions.optionTables or {} | |
| 21 AceDBOptions.handlers = AceDBOptions.handlers or {} | |
| 22 | |
| 23 --[[ | |
| 24 Localization of AceDBOptions-3.0 | |
| 25 ]] | |
| 26 | |
| 27 local L = { | |
| 28 choose = "Existing Profiles", | |
| 29 choose_desc = "You can either create a new profile by entering a name in the editbox, or choose one of the already existing profiles.", | |
| 30 choose_sub = "Select one of your currently available profiles.", | |
| 31 copy = "Copy From", | |
| 32 copy_desc = "Copy the settings from one existing profile into the currently active profile.", | |
| 33 current = "Current Profile:", | |
| 34 default = "Default", | |
| 35 delete = "Delete a Profile", | |
| 36 delete_confirm = "Are you sure you want to delete the selected profile?", | |
| 37 delete_desc = "Delete existing and unused profiles from the database to save space, and cleanup the SavedVariables file.", | |
| 38 delete_sub = "Deletes a profile from the database.", | |
| 39 intro = "You can change the active database profile, so you can have different settings for every character.", | |
| 40 new = "New", | |
| 41 new_sub = "Create a new empty profile.", | |
| 42 profiles = "Profiles", | |
| 43 profiles_sub = "Manage Profiles", | |
| 44 reset = "Reset Profile", | |
| 45 reset_desc = "Reset the current profile back to its default values, in case your configuration is broken, or you simply want to start over.", | |
| 46 reset_sub = "Reset the current profile to the default", | |
| 47 } | |
| 48 | |
| 49 local LOCALE = GetLocale() | |
| 50 if LOCALE == "deDE" then | |
| 51 L["choose"] = "Vorhandene Profile" | |
| 52 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." | |
| 53 L["choose_sub"] = "Wählt ein bereits vorhandenes Profil aus." | |
| 54 L["copy"] = "Kopieren von..." | |
| 55 L["copy_desc"] = "Kopiere die Einstellungen von einem vorhandenen Profil in das aktive Profil." | |
| 56 -- L["current"] = "Current Profile:" | |
| 57 L["default"] = "Standard" | |
| 58 L["delete"] = "Profil löschen" | |
| 59 L["delete_confirm"] = "Willst du das ausgewählte Profil wirklich löschen?" | |
| 60 L["delete_desc"] = "Lösche vorhandene oder unbenutzte Profile aus der Datenbank um Platz zu sparen und um die SavedVariables Datei 'sauber' zu halten." | |
| 61 L["delete_sub"] = "Löscht ein Profil aus der Datenbank." | |
| 62 L["intro"] = "Hier kannst du das aktive Datenbankprofile ändern, damit du verschiedene Einstellungen für jeden Charakter erstellen kannst, wodurch eine sehr flexible Konfiguration möglich wird." | |
| 63 L["new"] = "Neu" | |
| 64 L["new_sub"] = "Ein neues Profil erstellen." | |
| 65 L["profiles"] = "Profile" | |
| 66 L["profiles_sub"] = "Profile verwalten" | |
| 67 L["reset"] = "Profil zurücksetzen" | |
| 68 L["reset_desc"] = "Setzt das momentane Profil auf Standardwerte zurück, für den Fall das mit der Konfiguration etwas schief lief oder weil du einfach neu starten willst." | |
| 69 L["reset_sub"] = "Das aktuelle Profil auf Standard zurücksetzen." | |
| 70 elseif LOCALE == "frFR" then | |
| 71 L["choose"] = "Profils existants" | |
| 72 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." | |
| 73 L["choose_sub"] = "Permet de choisir un des profils déjà disponibles." | |
| 74 L["copy"] = "Copier à partir de" | |
| 75 L["copy_desc"] = "Copie les paramètres d'un profil déjà existant dans le profil actuellement actif." | |
| 76 -- L["current"] = "Current Profile:" | |
| 77 L["default"] = "Défaut" | |
| 78 L["delete"] = "Supprimer un profil" | |
| 79 L["delete_confirm"] = "Etes-vous sûr de vouloir supprimer le profil sélectionné ?" | |
| 80 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." | |
| 81 L["delete_sub"] = "Supprime un profil de la base de données." | |
| 82 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." | |
| 83 L["new"] = "Nouveau" | |
| 84 L["new_sub"] = "Créée un nouveau profil vierge." | |
| 85 L["profiles"] = "Profils" | |
| 86 L["profiles_sub"] = "Gestion des profils" | |
| 87 L["reset"] = "Réinitialiser le profil" | |
| 88 L["reset_desc"] = "Réinitialise le profil actuel au cas où votre configuration est corrompue ou si vous voulez tout simplement faire table rase." | |
| 89 L["reset_sub"] = "Réinitialise le profil actuel avec les paramètres par défaut." | |
| 90 elseif LOCALE == "koKR" then | |
| 91 L["choose"] = "프로필 선택" | |
| 92 L["choose_desc"] = "새로운 이름을 입력하거나, 이미 있는 프로필중 하나를 선택하여 새로운 프로필을 만들 수 있습니다." | |
| 93 L["choose_sub"] = "당신이 현재 이용할수 있는 프로필을 선택합니다." | |
| 94 L["copy"] = "복사" | |
| 95 L["copy_desc"] = "현재 사용중인 프로필에, 선택한 프로필의 설정을 복사합니다." | |
| 96 -- L["current"] = "Current Profile:" | |
| 97 L["default"] = "기본값" | |
| 98 L["delete"] = "프로필 삭제" | |
| 99 L["delete_confirm"] = "정말로 선택한 프로필의 삭제를 원하십니까?" | |
| 100 L["delete_desc"] = "데이터베이스에 사용중이거나 저장된 프로파일 삭제로 SavedVariables 파일의 정리와 공간 절약이 됩니다." | |
| 101 L["delete_sub"] = "데이터베이스의 프로필을 삭제합니다." | |
| 102 L["intro"] = "모든 캐릭터의 다양한 설정과 사용중인 데이터베이스 프로필, 어느것이던지 매우 다루기 쉽게 바꿀수 있습니다." | |
| 103 L["new"] = "새로운 프로필" | |
| 104 L["new_sub"] = "새로운 프로필을 만듭니다." | |
| 105 L["profiles"] = "프로필" | |
| 106 L["profiles_sub"] = "프로필 설정" | |
| 107 L["reset"] = "프로필 초기화" | |
| 108 L["reset_desc"] = "단순히 다시 새롭게 구성을 원하는 경우, 현재 프로필을 기본값으로 초기화 합니다." | |
| 109 L["reset_sub"] = "현재의 프로필을 기본값으로 초기화 합니다" | |
| 110 elseif LOCALE == "esES" or LOCALE == "esMX" then | |
| 111 L["choose"] = "Perfiles existentes" | |
| 112 L["choose_desc"] = "Puedes crear un nuevo perfil introduciendo un nombre en el recuadro o puedes seleccionar un perfil de los ya existentes." | |
| 113 L["choose_sub"] = "Selecciona uno de los perfiles disponibles." | |
| 114 L["copy"] = "Copiar de" | |
| 115 L["copy_desc"] = "Copia los ajustes de un perfil existente al perfil actual." | |
| 116 -- L["current"] = "Current Profile:" | |
| 117 L["default"] = "Por defecto" | |
| 118 L["delete"] = "Borrar un Perfil" | |
| 119 L["delete_confirm"] = "¿Estas seguro que quieres borrar el perfil seleccionado?" | |
| 120 L["delete_desc"] = "Borra los perfiles existentes y sin uso de la base de datos para ganar espacio y limpiar el archivo SavedVariables." | |
| 121 L["delete_sub"] = "Borra un perfil de la base de datos." | |
| 122 L["intro"] = "Puedes cambiar el perfil activo de tal manera que cada personaje tenga diferentes configuraciones." | |
| 123 L["new"] = "Nuevo" | |
| 124 L["new_sub"] = "Crear un nuevo perfil vacio." | |
| 125 L["profiles"] = "Perfiles" | |
| 126 L["profiles_sub"] = "Manejar Perfiles" | |
| 127 L["reset"] = "Reiniciar Perfil" | |
| 128 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." | |
| 129 L["reset_sub"] = "Reinicar el perfil actual al de por defecto" | |
| 130 elseif LOCALE == "zhTW" then | |
| 131 L["choose"] = "現有的設定檔" | |
| 132 L["choose_desc"] = "你可以通過在文本框內輸入一個名字創立一個新的設定檔,也可以選擇一個已經存在的設定檔。" | |
| 133 L["choose_sub"] = "從當前可用的設定檔裏面選擇一個。" | |
| 134 L["copy"] = "複製自" | |
| 135 L["copy_desc"] = "從當前某個已保存的設定檔複製到當前正使用的設定檔。" | |
| 136 -- L["current"] = "Current Profile:" | |
| 137 L["default"] = "預設" | |
| 138 L["delete"] = "刪除一個設定檔" | |
| 139 L["delete_confirm"] = "你確定要刪除所選擇的設定檔嗎?" | |
| 140 L["delete_desc"] = "從資料庫裏刪除不再使用的設定檔,以節省空間,並且清理SavedVariables檔。" | |
| 141 L["delete_sub"] = "從資料庫裏刪除一個設定檔。" | |
| 142 L["intro"] = "你可以選擇一個活動的資料設定檔,這樣你的每個角色就可以擁有不同的設定值,可以給你的插件設定帶來極大的靈活性。" | |
| 143 L["new"] = "新建" | |
| 144 L["new_sub"] = "新建一個空的設定檔。" | |
| 145 L["profiles"] = "設定檔" | |
| 146 L["profiles_sub"] = "管理設定檔" | |
| 147 L["reset"] = "重置設定檔" | |
| 148 L["reset_desc"] = "將當前的設定檔恢復到它的預設值,用於你的設定檔損壞,或者你只是想重來的情況。" | |
| 149 L["reset_sub"] = "將當前的設定檔恢復為預設值" | |
| 150 elseif LOCALE == "zhCN" then | |
| 151 L["choose"] = "现有的配置文件" | |
| 152 L["choose_desc"] = "你可以通过在文本框内输入一个名字创立一个新的配置文件,也可以选择一个已经存在的配置文件。" | |
| 153 L["choose_sub"] = "从当前可用的配置文件里面选择一个。" | |
| 154 L["copy"] = "复制自" | |
| 155 L["copy_desc"] = "从当前某个已保存的配置文件复制到当前正使用的配置文件。" | |
| 156 -- L["current"] = "Current Profile:" | |
| 157 L["default"] = "默认" | |
| 158 L["delete"] = "删除一个配置文件" | |
| 159 L["delete_confirm"] = "你确定要删除所选择的配置文件么?" | |
| 160 L["delete_desc"] = "从数据库里删除不再使用的配置文件,以节省空间,并且清理SavedVariables文件。" | |
| 161 L["delete_sub"] = "从数据库里删除一个配置文件。" | |
| 162 L["intro"] = "你可以选择一个活动的数据配置文件,这样你的每个角色就可以拥有不同的设置值,可以给你的插件配置带来极大的灵活性。" | |
| 163 L["new"] = "新建" | |
| 164 L["new_sub"] = "新建一个空的配置文件。" | |
| 165 L["profiles"] = "配置文件" | |
| 166 L["profiles_sub"] = "管理配置文件" | |
| 167 L["reset"] = "重置配置文件" | |
| 168 L["reset_desc"] = "将当前的配置文件恢复到它的默认值,用于你的配置文件损坏,或者你只是想重来的情况。" | |
| 169 L["reset_sub"] = "将当前的配置文件恢复为默认值" | |
| 170 elseif LOCALE == "ruRU" then | |
| 171 L["choose"] = "Существующие профили" | |
| 172 L["choose_desc"] = "Вы можете создать новый профиль, введя название в поле ввода, или выбрать один из уже существующих профилей." | |
| 173 L["choose_sub"] = "Выбор одиного из уже доступных профилей" | |
| 174 L["copy"] = "Скопировать из" | |
| 175 L["copy_desc"] = "Скопировать настройки из выбранного профиля в активный." | |
| 176 -- L["current"] = "Current Profile:" | |
| 177 L["default"] = "По умолчанию" | |
| 178 L["delete"] = "Удалить профиль" | |
| 179 L["delete_confirm"] = "Вы уверены, что вы хотите удалить выбранный профиль?" | |
| 180 L["delete_desc"] = "Удалить существующий и неиспользуемый профиль из БД для сохранения места, и очистить SavedVariables файл." | |
| 181 L["delete_sub"] = "Удаление профиля из БД" | |
| 182 L["intro"] = "Изменяя активный профиль, вы можете задать различные настройки модификаций для каждого персонажа." | |
| 183 L["new"] = "Новый" | |
| 184 L["new_sub"] = "Создать новый чистый профиль" | |
| 185 L["profiles"] = "Профили" | |
| 186 L["profiles_sub"] = "Управление профилями" | |
| 187 L["reset"] = "Сброс профиля" | |
| 188 L["reset_desc"] = "Если ваша конфигурации испорчена или если вы хотите настроить всё заново - сбросьте текущий профиль на стандартные значения." | |
| 189 L["reset_sub"] = "Сброс текущего профиля на стандартный" | |
| 190 elseif LOCALE == "itIT" then | |
| 191 L["choose"] = "Profili esistenti" | |
| 192 L["choose_desc"] = "Puoi creare un nuovo profilo digitando il nome della casella di testo, oppure scegliendone uno tra i profili gia' esistenti." | |
| 193 L["choose_sub"] = "Seleziona uno dei profili disponibili." | |
| 194 L["copy"] = "Copia Da" | |
| 195 L["copy_desc"] = "Copia le impostazioni da un profilo esistente, nel profilo attivo in questo momento." | |
| 196 L["current"] = "Profilo Attivo:" | |
| 197 L["default"] = "Standard" | |
| 198 L["delete"] = "Cancella un profilo" | |
| 199 L["delete_confirm"] = "Sei sicuro di voler cancellare il profilo selezionato?" | |
| 200 L["delete_desc"] = "Cancella i profili non utilizzati dal database per risparmiare spazio e mantenere puliti i file di configurazione SavedVariables." | |
| 201 L["delete_sub"] = "Cancella un profilo dal Database." | |
| 202 L["intro"] = "Puoi cambiare il profilo attivo, in modo da usare impostazioni diverse per ogni personaggio." | |
| 203 L["new"] = "Nuovo" | |
| 204 L["new_sub"] = "Crea un nuovo profilo vuoto." | |
| 205 L["profiles"] = "Profili" | |
| 206 L["profiles_sub"] = "Gestisci Profili" | |
| 207 L["reset"] = "Reimposta Profilo" | |
| 208 L["reset_desc"] = "Riporta il tuo profilo attivo alle sue impostazioni di default, nel caso in cui la tua configurazione si sia corrotta, o semplicemente tu voglia re-inizializzarla." | |
| 209 L["reset_sub"] = "Reimposta il profilo ai suoi valori di default." | |
| 210 end | |
| 211 | |
| 212 local defaultProfiles | |
| 213 local tmpprofiles = {} | |
| 214 | |
| 215 -- Get a list of available profiles for the specified database. | |
| 216 -- You can specify which profiles to include/exclude in the list using the two boolean parameters listed below. | |
| 217 -- @param db The db object to retrieve the profiles from | |
| 218 -- @param common If true, getProfileList will add the default profiles to the return list, even if they have not been created yet | |
| 219 -- @param nocurrent If true, then getProfileList will not display the current profile in the list | |
| 220 -- @return Hashtable of all profiles with the internal name as keys and the display name as value. | |
| 221 local function getProfileList(db, common, nocurrent) | |
| 222 local profiles = {} | |
| 223 | |
| 224 -- copy existing profiles into the table | |
| 225 local currentProfile = db:GetCurrentProfile() | |
| 226 for i,v in pairs(db:GetProfiles(tmpprofiles)) do | |
| 227 if not (nocurrent and v == currentProfile) then | |
| 228 profiles[v] = v | |
| 229 end | |
| 230 end | |
| 231 | |
| 232 -- add our default profiles to choose from ( or rename existing profiles) | |
| 233 for k,v in pairs(defaultProfiles) do | |
| 234 if (common or profiles[k]) and not (nocurrent and k == currentProfile) then | |
| 235 profiles[k] = v | |
| 236 end | |
| 237 end | |
| 238 | |
| 239 return profiles | |
| 240 end | |
| 241 | |
| 242 --[[ | |
| 243 OptionsHandlerPrototype | |
| 244 prototype class for handling the options in a sane way | |
| 245 ]] | |
| 246 local OptionsHandlerPrototype = {} | |
| 247 | |
| 248 --[[ Reset the profile ]] | |
| 249 function OptionsHandlerPrototype:Reset() | |
| 250 self.db:ResetProfile() | |
| 251 end | |
| 252 | |
| 253 --[[ Set the profile to value ]] | |
| 254 function OptionsHandlerPrototype:SetProfile(info, value) | |
| 255 self.db:SetProfile(value) | |
| 256 end | |
| 257 | |
| 258 --[[ returns the currently active profile ]] | |
| 259 function OptionsHandlerPrototype:GetCurrentProfile() | |
| 260 return self.db:GetCurrentProfile() | |
| 261 end | |
| 262 | |
| 263 --[[ | |
| 264 List all active profiles | |
| 265 you can control the output with the .arg variable | |
| 266 currently four modes are supported | |
| 267 | |
| 268 (empty) - return all available profiles | |
| 269 "nocurrent" - returns all available profiles except the currently active profile | |
| 270 "common" - returns all avaialble profiles + some commonly used profiles ("char - realm", "realm", "class", "Default") | |
| 271 "both" - common except the active profile | |
| 272 ]] | |
| 273 function OptionsHandlerPrototype:ListProfiles(info) | |
| 274 local arg = info.arg | |
| 275 local profiles | |
| 276 if arg == "common" and not self.noDefaultProfiles then | |
| 277 profiles = getProfileList(self.db, true, nil) | |
| 278 elseif arg == "nocurrent" then | |
| 279 profiles = getProfileList(self.db, nil, true) | |
| 280 elseif arg == "both" then -- currently not used | |
| 281 profiles = getProfileList(self.db, (not self.noDefaultProfiles) and true, true) | |
| 282 else | |
| 283 profiles = getProfileList(self.db) | |
| 284 end | |
| 285 | |
| 286 return profiles | |
| 287 end | |
| 288 | |
| 289 function OptionsHandlerPrototype:HasNoProfiles(info) | |
| 290 local profiles = self:ListProfiles(info) | |
| 291 return ((not next(profiles)) and true or false) | |
| 292 end | |
| 293 | |
| 294 --[[ Copy a profile ]] | |
| 295 function OptionsHandlerPrototype:CopyProfile(info, value) | |
| 296 self.db:CopyProfile(value) | |
| 297 end | |
| 298 | |
| 299 --[[ Delete a profile from the db ]] | |
| 300 function OptionsHandlerPrototype:DeleteProfile(info, value) | |
| 301 self.db:DeleteProfile(value) | |
| 302 end | |
| 303 | |
| 304 --[[ fill defaultProfiles with some generic values ]] | |
| 305 local function generateDefaultProfiles(db) | |
| 306 defaultProfiles = { | |
| 307 ["Default"] = L["default"], | |
| 308 [db.keys.char] = db.keys.char, | |
| 309 [db.keys.realm] = db.keys.realm, | |
| 310 [db.keys.class] = UnitClass("player") | |
| 311 } | |
| 312 end | |
| 313 | |
| 314 --[[ create and return a handler object for the db, or upgrade it if it already existed ]] | |
| 315 local function getOptionsHandler(db, noDefaultProfiles) | |
| 316 if not defaultProfiles then | |
| 317 generateDefaultProfiles(db) | |
| 318 end | |
| 319 | |
| 320 local handler = AceDBOptions.handlers[db] or { db = db, noDefaultProfiles = noDefaultProfiles } | |
| 321 | |
| 322 for k,v in pairs(OptionsHandlerPrototype) do | |
| 323 handler[k] = v | |
| 324 end | |
| 325 | |
| 326 AceDBOptions.handlers[db] = handler | |
| 327 return handler | |
| 328 end | |
| 329 | |
| 330 --[[ | |
| 331 the real options table | |
| 332 ]] | |
| 333 local optionsTable = { | |
| 334 desc = { | |
| 335 order = 1, | |
| 336 type = "description", | |
| 337 name = L["intro"] .. "\n", | |
| 338 }, | |
| 339 descreset = { | |
| 340 order = 9, | |
| 341 type = "description", | |
| 342 name = L["reset_desc"], | |
| 343 }, | |
| 344 reset = { | |
| 345 order = 10, | |
| 346 type = "execute", | |
| 347 name = L["reset"], | |
| 348 desc = L["reset_sub"], | |
| 349 func = "Reset", | |
| 350 }, | |
| 351 current = { | |
| 352 order = 11, | |
| 353 type = "description", | |
| 354 name = function(info) return L["current"] .. " " .. NORMAL_FONT_COLOR_CODE .. info.handler:GetCurrentProfile() .. FONT_COLOR_CODE_CLOSE end, | |
| 355 width = "default", | |
| 356 }, | |
| 357 choosedesc = { | |
| 358 order = 20, | |
| 359 type = "description", | |
| 360 name = "\n" .. L["choose_desc"], | |
| 361 }, | |
| 362 new = { | |
| 363 name = L["new"], | |
| 364 desc = L["new_sub"], | |
| 365 type = "input", | |
| 366 order = 30, | |
| 367 get = false, | |
| 368 set = "SetProfile", | |
| 369 }, | |
| 370 choose = { | |
| 371 name = L["choose"], | |
| 372 desc = L["choose_sub"], | |
| 373 type = "select", | |
| 374 order = 40, | |
| 375 get = "GetCurrentProfile", | |
| 376 set = "SetProfile", | |
| 377 values = "ListProfiles", | |
| 378 arg = "common", | |
| 379 }, | |
| 380 copydesc = { | |
| 381 order = 50, | |
| 382 type = "description", | |
| 383 name = "\n" .. L["copy_desc"], | |
| 384 }, | |
| 385 copyfrom = { | |
| 386 order = 60, | |
| 387 type = "select", | |
| 388 name = L["copy"], | |
| 389 desc = L["copy_desc"], | |
| 390 get = false, | |
| 391 set = "CopyProfile", | |
| 392 values = "ListProfiles", | |
| 393 disabled = "HasNoProfiles", | |
| 394 arg = "nocurrent", | |
| 395 }, | |
| 396 deldesc = { | |
| 397 order = 70, | |
| 398 type = "description", | |
| 399 name = "\n" .. L["delete_desc"], | |
| 400 }, | |
| 401 delete = { | |
| 402 order = 80, | |
| 403 type = "select", | |
| 404 name = L["delete"], | |
| 405 desc = L["delete_sub"], | |
| 406 get = false, | |
| 407 set = "DeleteProfile", | |
| 408 values = "ListProfiles", | |
| 409 disabled = "HasNoProfiles", | |
| 410 arg = "nocurrent", | |
| 411 confirm = true, | |
| 412 confirmText = L["delete_confirm"], | |
| 413 }, | |
| 414 } | |
| 415 | |
| 416 --- Get/Create a option table that you can use in your addon to control the profiles of AceDB-3.0. | |
| 417 -- @param db The database object to create the options table for. | |
| 418 -- @return The options table to be used in AceConfig-3.0 | |
| 419 -- @usage | |
| 420 -- -- Assuming `options` is your top-level options table and `self.db` is your database: | |
| 421 -- options.args.profiles = LibStub("AceDBOptions-3.0"):GetOptionsTable(self.db) | |
| 422 function AceDBOptions:GetOptionsTable(db, noDefaultProfiles) | |
| 423 local tbl = AceDBOptions.optionTables[db] or { | |
| 424 type = "group", | |
| 425 name = L["profiles"], | |
| 426 desc = L["profiles_sub"], | |
| 427 } | |
| 428 | |
| 429 tbl.handler = getOptionsHandler(db, noDefaultProfiles) | |
| 430 tbl.args = optionsTable | |
| 431 | |
| 432 AceDBOptions.optionTables[db] = tbl | |
| 433 return tbl | |
| 434 end | |
| 435 | |
| 436 -- upgrade existing tables | |
| 437 for db,tbl in pairs(AceDBOptions.optionTables) do | |
| 438 tbl.handler = getOptionsHandler(db) | |
| 439 tbl.args = optionsTable | |
| 440 end |
