summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2018-01-28 21:32:38 +0800
committerruki <[email protected]>2018-01-28 21:32:38 +0800
commitf7c740be4a6af2f23c5c04a11e5807e3de563b46 (patch)
tree65f7e942643139d09506366c47771970cf59cd9f
parentc547689e9141b412ac5a45293538215a998b299d (diff)
include and exclude config item in mconfdialog
-rw-r--r--xmake/core/ui/mconfdialog.lua20
-rw-r--r--xmake/core/ui/menuconf.lua24
2 files changed, 43 insertions, 1 deletions
diff --git a/xmake/core/ui/mconfdialog.lua b/xmake/core/ui/mconfdialog.lua
index f23a81b3d..2824f6b1f 100644
--- a/xmake/core/ui/mconfdialog.lua
+++ b/xmake/core/ui/mconfdialog.lua
@@ -155,6 +155,16 @@ function mconfdialog:choicedialog()
return self._CHOICEDIALOG
end
+-- get search dialog
+function mconfdialog:searchdialog()
+ if not self._SEARCHDIALOG then
+ -- TODO
+ local dialog_search = nil
+ self._SEARCHDIALOG = dialog_search
+ end
+ return self._SEARCHDIALOG
+end
+
-- show help dialog
function mconfdialog:show_help()
if self:parent() then
@@ -186,6 +196,11 @@ function mconfdialog:show_help()
end
end
+-- show search dialog
+function mconfdialog:show_search()
+ -- TODO
+end
+
-- on event
function mconfdialog:event_on(e)
@@ -197,11 +212,14 @@ function mconfdialog:event_on(e)
end
-- select config
elseif e.type == event.ev_keyboard then
- if e.key_name == "Down" or e.key_name == "Up" or e.key_name == " " or e.key_name == "Esc" then
+ if e.key_name == "Down" or e.key_name == "Up" or e.key_name == " " or e.key_name == "Esc" or e.key_name:lower() == "y" or e.key_name:lower() == "n" then
return self:menuconf():event_on(e)
elseif e.key_name == "?" then
self:show_help()
return true
+ elseif e.key_name == "/" then
+ self:show_search()
+ return true
end
end
return boxdialog.event_on(self, e)
diff --git a/xmake/core/ui/menuconf.lua b/xmake/core/ui/menuconf.lua
index 635373ee0..c4beb9d24 100644
--- a/xmake/core/ui/menuconf.lua
+++ b/xmake/core/ui/menuconf.lua
@@ -58,6 +58,12 @@ function menuconf:event_on(e)
elseif e.key_name == "Enter" or e.key_name == " " then
self:_do_select()
return true
+ elseif e.key_name:lower() == "y" then
+ self:_do_include(true)
+ return true
+ elseif e.key_name:lower() == "n" then
+ self:_do_include(false)
+ return true
elseif e.key_name == "Esc" then
-- load the previous menu configs
local configs_prev = self._CONFIGS._PREV
@@ -146,6 +152,24 @@ function menuconf:_do_select()
end
end
+-- do include
+function menuconf:_do_include(enabled)
+
+ -- get the current item
+ local item = self:current()
+
+ -- get the current config
+ local config = item:extra("config")
+
+ -- clear new state
+ config.new = false
+
+ -- select the boolean config
+ if config.kind == "boolean" then
+ config.value = enabled
+ end
+end
+
-- init config object
--
-- kind