Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow setting a limit for export, up to unlimited (well, 2.147.483.646) #400

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 56 additions & 16 deletions Modules/exportDKP.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ local L = core.L;



local function GenerateDKPTables(table, format)
local function GenerateDKPTables(table, format, limit)
local ExportString;
local ExportDefinition;

Expand All @@ -29,8 +29,8 @@ local function GenerateDKPTables(table, format)
elseif table == MonDKP_DKPHistory then
local numrows;

if #MonDKP_DKPHistory > 200 then
numrows = 200;
if #MonDKP_DKPHistory > limit then
numrows = limit;
else
numrows = #MonDKP_DKPHistory
end
Expand All @@ -45,8 +45,8 @@ local function GenerateDKPTables(table, format)
elseif table == MonDKP_Loot then
local numrows;

if #MonDKP_Loot > 200 then
numrows = 200;
if #MonDKP_Loot > limit then
numrows = limit;
else
numrows = #MonDKP_Loot
end
Expand All @@ -72,8 +72,8 @@ local function GenerateDKPTables(table, format)
elseif table == MonDKP_DKPHistory then
local numrows;

if #MonDKP_DKPHistory > 200 then
numrows = 200;
if #MonDKP_DKPHistory > limit then
numrows = limit;
else
numrows = #MonDKP_DKPHistory
end
Expand All @@ -92,8 +92,8 @@ local function GenerateDKPTables(table, format)
elseif table == MonDKP_Loot then
local numrows;

if #MonDKP_Loot > 200 then
numrows = 200;
if #MonDKP_Loot > limit then
numrows = limit;
else
numrows = #MonDKP_Loot
end
Expand Down Expand Up @@ -122,8 +122,8 @@ local function GenerateDKPTables(table, format)
elseif table == MonDKP_DKPHistory then
local numrows;

if #MonDKP_DKPHistory > 200 then
numrows = 200;
if #MonDKP_DKPHistory > limit then
numrows = limit;
else
numrows = #MonDKP_DKPHistory
end
Expand All @@ -150,8 +150,8 @@ local function GenerateDKPTables(table, format)
elseif table == MonDKP_Loot then
local numrows;

if #MonDKP_Loot > 200 then
numrows = 200;
if #MonDKP_Loot > limit then
numrows = limit;
else
numrows = #MonDKP_Loot
end
Expand Down Expand Up @@ -329,11 +329,51 @@ function MonDKPExportBox_Show(text)
preferredIndex = 3,
}

-- Limit Box
-- Format DROPDOWN box
local CurLimit = 200;

f.LimitDropDown = CreateFrame("FRAME", "MonDKPLimitSelectDropDown", f, "MonolithDKPUIDropDownMenuTemplate")
f.LimitDropDown:SetPoint("BOTTOMLEFT", f, "BOTTOMLEFT", 150, 55)
UIDropDownMenu_SetWidth(f.LimitDropDown, 100)
UIDropDownMenu_SetText(f.LimitDropDown, "Select Limit")

-- Create and bind the initialization function to the dropdown menu
UIDropDownMenu_Initialize(f.LimitDropDown, function(self, level, menuList)
local Format = UIDropDownMenu_CreateInfo()
Format.func = self.SetValue
Format.fontObject = "MonDKPSmallCenter"
Format.text, Format.arg1, Format.checked, Format.isNotRadio = "200", 200, 200 == CurLimit, false
UIDropDownMenu_AddButton(Format)
Format.text, Format.arg1, Format.checked, Format.isNotRadio = "500", 500, 500 == CurLimit, false
UIDropDownMenu_AddButton(Format)
Format.text, Format.arg1, Format.checked, Format.isNotRadio = "unlimited (basically)", 2147483646, 2147483646 == CurLimit, false
UIDropDownMenu_AddButton(Format)
end)

-- Dropdown Menu Function
function f.LimitDropDown:SetValue(arg1)
CurLimit = arg1;
UIDropDownMenu_SetText(f.LimitDropDown, CurLimit)
CloseDropDownMenus()
end

f.LimitDropDown:SetScript("OnEnter", function(self)
GameTooltip:SetOwner(self, "ANCHOR_RIGHT");
GameTooltip:SetText("Export Limit", 0.25, 0.75, 0.90, 1, true);
GameTooltip:AddLine("Select the amount of data you wish to export.", 1.0, 1.0, 1.0, true);
GameTooltip:Show();
end)
f.LimitDropDown:SetScript("OnLeave", function(self)
GameTooltip:Hide()
end)
-- /limit Box

f.GenerateDKPButton = MonDKP:CreateButton("BOTTOMRIGHT", f, "BOTTOMRIGHT", -355, 20, "1) "..L["GENDKPTABLE"]);
f.GenerateDKPButton:SetSize(150, 24)
f.GenerateDKPButton:SetScript("OnClick", function()
if CurFormat then
GenerateDKPTables(MonDKP_DKPTable, CurFormat)
GenerateDKPTables(MonDKP_DKPTable, CurFormat, CurLimit)
else
StaticPopup_Show ("NO_FORMAT")
end
Expand All @@ -343,7 +383,7 @@ function MonDKPExportBox_Show(text)
f.GenerateDKPHistoryButton:SetSize(150, 24)
f.GenerateDKPHistoryButton:SetScript("OnClick", function()
if CurFormat then
GenerateDKPTables(MonDKP_DKPHistory, CurFormat)
GenerateDKPTables(MonDKP_DKPHistory, CurFormat, CurLimit)
else
StaticPopup_Show ("NO_FORMAT")
end
Expand All @@ -353,7 +393,7 @@ function MonDKPExportBox_Show(text)
f.GenerateDKPLootButton:SetSize(150, 24)
f.GenerateDKPLootButton:SetScript("OnClick", function()
if CurFormat then
GenerateDKPTables(MonDKP_Loot, CurFormat)
GenerateDKPTables(MonDKP_Loot, CurFormat, CurLimit)
else
StaticPopup_Show ("NO_FORMAT")
end
Expand Down