mirror of
https://github.com/minetest/minetest.git
synced 2024-11-23 08:03:45 +01:00
Rework main menu confirmation dialogs (#12356)
This commit is contained in:
parent
b72932b445
commit
6d163b72dc
@ -242,3 +242,11 @@ function menu_worldmt_legacy(selected)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function confirmation_formspec(message, confirm_id, confirm_label, cancel_id, cancel_label)
|
||||||
|
return "size[10,2.5,true]" ..
|
||||||
|
"label[0.5,0.5;" .. message .. "]" ..
|
||||||
|
"style[" .. confirm_id .. ";bgcolor=red]" ..
|
||||||
|
"button[0.5,1.5;2.5,0.5;" .. confirm_id .. ";" .. confirm_label .. "]" ..
|
||||||
|
"button[7.0,1.5;2.5,0.5;" .. cancel_id .. ";" .. cancel_label .. "]"
|
||||||
|
end
|
||||||
|
@ -488,12 +488,10 @@ local confirm_overwrite = {}
|
|||||||
function confirm_overwrite.get_formspec()
|
function confirm_overwrite.get_formspec()
|
||||||
local package = confirm_overwrite.package
|
local package = confirm_overwrite.package
|
||||||
|
|
||||||
return "size[11.5,4.5,true]" ..
|
return confirmation_formspec(
|
||||||
"label[2,2;" ..
|
fgettext("\"$1\" already exists. Would you like to overwrite it?", package.name),
|
||||||
fgettext("\"$1\" already exists. Would you like to overwrite it?", package.name) .. "]"..
|
'install', fgettext("Overwrite"),
|
||||||
"style[install;bgcolor=red]" ..
|
'cancel', fgettext("Cancel"))
|
||||||
"button[3.25,3.5;2.5,0.5;install;" .. fgettext("Overwrite") .. "]" ..
|
|
||||||
"button[5.75,3.5;2.5,0.5;cancel;" .. fgettext("Cancel") .. "]"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function confirm_overwrite.handle_submit(this, fields)
|
function confirm_overwrite.handle_submit(this, fields)
|
||||||
|
@ -18,15 +18,10 @@
|
|||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
local function delete_content_formspec(dialogdata)
|
local function delete_content_formspec(dialogdata)
|
||||||
local retval =
|
return confirmation_formspec(
|
||||||
"size[11.5,4.5,true]" ..
|
fgettext("Are you sure you want to delete \"$1\"?", dialogdata.content.name),
|
||||||
"label[2,2;" ..
|
'dlg_delete_content_confirm', fgettext("Delete"),
|
||||||
fgettext("Are you sure you want to delete \"$1\"?", dialogdata.content.name) .. "]"..
|
'dlg_delete_content_cancel', fgettext("Cancel"))
|
||||||
"style[dlg_delete_content_confirm;bgcolor=red]" ..
|
|
||||||
"button[3.25,3.5;2.5,0.5;dlg_delete_content_confirm;" .. fgettext("Delete") .. "]" ..
|
|
||||||
"button[5.75,3.5;2.5,0.5;dlg_delete_content_cancel;" .. fgettext("Cancel") .. "]"
|
|
||||||
|
|
||||||
return retval
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
@ -17,14 +17,10 @@
|
|||||||
|
|
||||||
|
|
||||||
local function delete_world_formspec(dialogdata)
|
local function delete_world_formspec(dialogdata)
|
||||||
local retval =
|
return confirmation_formspec(
|
||||||
"size[10,2.5,true]" ..
|
fgettext("Delete World \"$1\"?", dialogdata.delete_name),
|
||||||
"label[0.5,0.5;" ..
|
'world_delete_confirm', fgettext("Delete"),
|
||||||
fgettext("Delete World \"$1\"?", dialogdata.delete_name) .. "]" ..
|
'world_delete_cancel', fgettext("Cancel"))
|
||||||
"style[world_delete_confirm;bgcolor=red]" ..
|
|
||||||
"button[0.5,1.5;2.5,0.5;world_delete_confirm;" .. fgettext("Delete") .. "]" ..
|
|
||||||
"button[7.0,1.5;2.5,0.5;world_delete_cancel;" .. fgettext("Cancel") .. "]"
|
|
||||||
return retval
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function delete_world_buttonhandler(this, fields)
|
local function delete_world_buttonhandler(this, fields)
|
||||||
|
Loading…
Reference in New Issue
Block a user