big filter refactoring, filter tab changes

This commit is contained in:
Manuel Simon Hirsig
2016-08-02 02:19:31 +02:00
parent 440c6b5ab0
commit 40c144ef51
2 changed files with 9 additions and 5 deletions
+5 -1
View File
@@ -171,9 +171,12 @@ end
function private.clear_form()
m.name_input:SetText('')
m.name_input:ClearFocus()
m.exact_checkbox:SetChecked(nil)
m.min_level_input:SetText('')
m.min_level_input:ClearFocus()
m.max_level_input:SetText('')
m.max_level_input:ClearFocus()
m.usable_checkbox:SetChecked(nil)
UIDropDownMenu_ClearAll(m.class_dropdown)
UIDropDownMenu_ClearAll(m.subclass_dropdown)
@@ -841,6 +844,7 @@ function private.export_query_string()
if components then
m.search_box:SetText(Aux.filter.query_string({blizzard=components.blizzard, post=m.post_components}))
m.clear_form()
m.filter_input:ClearFocus()
m.post_components = {}
m.filter_display:SetText('')
else
@@ -852,7 +856,7 @@ private.post_components = {}
function private.add_post_filter()
local name = UIDropDownMenu_GetSelectedValue(m.filter_dropdown)
if name and not strfind(Aux.filter.indented_post_query_string(m.post_components), '|n', 20) then
if name and getn(Aux.util.filter(m.post_components, function(component) return component[1] == 'operator' end)) < 20 then
local filter = name
if Aux.filter.filters[name] and Aux.filter.filters[name].input_type ~= '' then
filter = filter..'/'..m.filter_input:GetText()
+4 -4
View File
@@ -387,7 +387,7 @@ function public.query(query_string)
for _, component in components.post do
if component[1] == 'operator' then
polish_notation_counter = max(polish_notation_counter, 1)
polish_notation_counter = polish_notation_counter + (component[2] or 1) - 1
polish_notation_counter = polish_notation_counter + (tonumber(component[2]) or 1) - 1
elseif component[1] == 'filter' then
polish_notation_counter = polish_notation_counter - 1
end
@@ -469,7 +469,7 @@ function private.suggestions(components)
end
-- subclasses
local class_index = Aux.info.item_class_index(blizzard_filters.class or '')
local class_index = blizzard_filters.class and Aux.info.item_class_index(blizzard_filters.class)
if class_index and not blizzard_filters.subclass then
for _, subclass in ipairs({ GetAuctionItemSubClasses(class_index) }) do
tinsert(suggestions, subclass)
@@ -477,9 +477,9 @@ function private.suggestions(components)
end
-- slots
local subclass_index = Aux.info.item_subclass_index(class_index, blizzard_filters.subclass or '')
local subclass_index = class_index and blizzard_filters.subclass and Aux.info.item_subclass_index(class_index, blizzard_filters.subclass)
if subclass_index and not blizzard_filters.slot then
for _, invtype in ipairs({ GetAuctionInvTypes(class_index, Aux.info.item_subclass_index(Aux.info.item_class_index(blizzard_filters.class), blizzard_filters.subclass)) }) do
for _, invtype in ipairs({ GetAuctionInvTypes(class_index, Aux.info.item_subclass_index(class_index, blizzard_filters.subclass)) }) do
tinsert(suggestions, getglobal(invtype))
end
end