diff --git a/lib/lib_include.xml b/lib/lib_include.xml
index 3fdb57d..20388cd 100644
--- a/lib/lib_include.xml
+++ b/lib/lib_include.xml
@@ -10,4 +10,6 @@
<Include file="Ace3\AceGUI-3.0\AceGUI-3.0.xml"/>
<Include file="Ace3\AceHook-3.0\AceHook-3.0.xml"/>
<Include file="Ace3\AceTimer-3.0\AceTimer-3.0.xml"/>
+
+ <Include file="Ace3\AceConfig-3.0\AceConfig-3.0.xml"/>
</Ui>
\ No newline at end of file
diff --git a/src/gui.lua b/src/gui.lua
index cb89c77..09d8bda 100644
--- a/src/gui.lua
+++ b/src/gui.lua
@@ -147,7 +147,7 @@ end
function gui:CreateFilterContainer()
local filterContainer = AceGUI:Create("InlineGroup");
self.filterContainer = filterContainer;
- filterContainer:SetRelativeWidth(0.5);
+ filterContainer:SetRelativeWidth(0.75);
filterContainer:SetAutoAdjustHeight(false);
filterContainer:SetHeight(60);
filterContainer:SetLayout("Flow");
@@ -162,26 +162,19 @@ end
-- Report/Purge.
function gui:CreateActionContainer()
local actionContainer = AceGUI:Create("InlineGroup");
- actionContainer:SetRelativeWidth(0.5);
+ actionContainer:SetRelativeWidth(0.25);
actionContainer:SetAutoAdjustHeight(false);
actionContainer:SetHeight(60);
actionContainer:SetLayout("Flow");
actionContainer:SetTitle("Actions");
- local purgeBtn = AceGUI:Create("Button");
- purgeBtn:SetText("Purge (NYI)...");
- purgeBtn:SetDisabled(true);
- purgeBtn:SetRelativeWidth(0.5);
- purgeBtn:SetCallback("OnClick", function()
- end);
-
local reportBtn = AceGUI:Create("Button");
self.reportButton = reportBtn;
reportBtn:SetText("Report...");
reportBtn:SetDisabled(true);
- reportBtn:SetRelativeWidth(0.5);
+ reportBtn:SetRelativeWidth(1);
reportBtn:SetCallback("OnClick", function()
- addon.report:ShowReportWindow(
+ addon.report:ShowReportFrame(
self.selectedGuild,
self.selectedZone,
self.selectedDifficulty,
@@ -191,9 +184,7 @@ function gui:CreateActionContainer()
self.parseFilters);
end);
- actionContainer:AddChild(purgeBtn);
actionContainer:AddChild(reportBtn);
-
return actionContainer;
end
diff --git a/src/main.lua b/src/main.lua
index 247ab20..dfa6c26 100644
--- a/src/main.lua
+++ b/src/main.lua
@@ -32,7 +32,8 @@ addon:SetDefaultModulePrototype(modPrototype)
-- Db default settings
addon.dbDefaults = {
realm = {
- modules = {}
+ modules = {},
+ options = {}
},
global = {
dbVersion = 1
@@ -41,7 +42,7 @@ addon.dbDefaults = {
-- The current db version. Clear (migrate?) the database if
-- version of database doesn't match this version.
-addon.dbVersion = 2
+addon.dbVersion = 2;
-- Constants
DEBUG_PRINT = false;
@@ -193,8 +194,12 @@ function addon:OnEnable()
self:RegisterEvent("PLAYER_GUILD_UPDATE")
self:RegisterEvent("ZONE_CHANGED_NEW_AREA")
- self:RegisterChatCommand("gshs", function()
- self.gui:ShowMainFrame();
+ self:RegisterChatCommand("gshs", function(arg)
+ if arg == "config" then
+ self.options:ShowOptionsFrame();
+ else
+ self.gui:ShowMainFrame();
+ end
end)
self:UpdateMyGuildName();
diff --git a/src/options.lua b/src/options.lua
new file mode 100644
index 0000000..cf620d4
--- /dev/null
+++ b/src/options.lua
@@ -0,0 +1,94 @@
+local addonName, addonTable = ...
+
+-- Set up module
+local addon = addonTable[1];
+local options = addon:NewModule("options");
+addon.options = options;
+
+
+addon.dbDefaults.realm.options = {
+ purgeEnabled = true,
+ purgeMaxParseAge = 30,
+ purgeMinPlayerParsesPerFight = 2,
+}
+addon.dbVersion = addon.dbVersion + 0;
+
+local optionsTable;
+local function createOptionsTable()
+ optionsTable = {
+ name = "Guild Skada High Score",
+ handler = options,
+ get = "GetRealmOptionValue",
+ set = "SetRealmOptionValue",
+ type = 'group',
+ args = {
+ versionHeader = {
+ order = 1,
+ type = "header",
+ name = format("Version: %s", addon.versionName),
+ width = "Full",
+ },
+ purgeSettings = {
+ name = "Purge Settings",
+ type = "group",
+ inline = true,
+ args = {
+ purgeEnabled = {
+ order = 1,
+ type = "toggle",
+ name = "Enable Purging of Parses",
+ desc = "Enables purging of parses matching some specified condition.",
+ },
+ purgeMaxParseAge = {
+ order = 3,
+ type = "range",
+ min = 0,
+ max = 60,
+ step = 1,
+ name = "Max Parse Age (days)",
+ desc = "Number of days to keep parses.",
+ disabled = function() return not addon.db.realm.options.purgeEnabled; end,
+ },
+ purgeMinPlayerParsesPerFight = {
+ order = 5,
+ type = "range",
+ min = 0,
+ softMax = 20,
+ max = 100,
+ step = 1,
+ name = "Min Parses Per Player/Fight",
+ desc = "The minimum number of parses to keep for a specific player and fight. These parses will not be removed even if they are older than the max parse age.",
+ disabled = function() return not addon.db.realm.options.purgeEnabled; end,
+ }
+ },
+ order = 20,
+ },
+ },
+ };
+end
+
+function options.GetRealmOptionValue(self, info)
+ local key = info[#info];
+ return addon.db.realm.options[key];
+end
+
+function options.SetRealmOptionValue(self, info, value)
+ local key = info[#info];
+ addon.db.realm.options[key] = value;
+end
+
+function options:GetOptionsTable()
+ if not optionsTable then
+ createOptionsTable()
+ end
+ return optionsTable
+end
+
+function options:ShowOptionsFrame()
+ InterfaceOptionsFrame_OpenToCategory(self.optionsFrame);
+end
+
+function options:OnEnable()
+ LibStub("AceConfigRegistry-3.0"):RegisterOptionsTable(addonName, options.GetOptionsTable);
+ self.optionsFrame = LibStub("AceConfigDialog-3.0"):AddToBlizOptions(addonName);
+end
diff --git a/src/report.lua b/src/report.lua
index 7c8258f..472cfc4 100644
--- a/src/report.lua
+++ b/src/report.lua
@@ -153,18 +153,18 @@ function report:SendData(channelId, whisperToName, dataTitle, filterString, pars
end
end
--- Hides and releases the report window if it is show,
+-- Hides and releases the report frame if it is show,
-- if it is not shown this does nothing.
-function report:HideReportWindow()
+function report:HideReportFrame()
if self.currentFrame then
self.currentFrame:Release();
self.currentFrame = nil;
end
end
--- Shows the report window for the supplied encounter and parses.
-function report:ShowReportWindow(guildId, zoneId, difficultyId, encounterId, roleId, parses, filters)
- self:HideReportWindow();
+-- Shows the report frame for the supplied encounter and parses.
+function report:ShowReportFrame(guildId, zoneId, difficultyId, encounterId, roleId, parses, filters)
+ self:HideReportFrame();
local channelId = self.lastChannelId or "SELF";
local guildName = addon.highscore:GetGuildNameById(guildId);
@@ -219,7 +219,7 @@ function report:ShowReportWindow(guildId, zoneId, difficultyId, encounterId, rol
local numParses = numToSendSlider:GetValue();
local whisperToName = whisperToNameEditBox:GetText();
self:SendData(channelId, whisperToName, dataTitle, filterString, parses, numParses);
- report:HideReportWindow();
+ report:HideReportFrame();
end);
frame:AddChild(dataTitleLabel);
diff --git a/src/src_include.xml b/src/src_include.xml
index 28ad07e..0bb3dfd 100644
--- a/src/src_include.xml
+++ b/src/src_include.xml
@@ -4,5 +4,6 @@
<Script file="highscore.lua"/>
<Script file="gui.lua"/>
<Script file="report.lua"/>
+ <Script file="options.lua"/>
<Include file="parse_modules\parse_modules_include.xml"/>
</Ui>
\ No newline at end of file