Skip to content

Commit 01ae4e7

Browse files
committed
add preview button to both setting pages
1 parent 121e61a commit 01ae4e7

File tree

1 file changed

+29
-26
lines changed

1 file changed

+29
-26
lines changed

UI.lua

Lines changed: 29 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -175,57 +175,76 @@ function MPT:CreateSpace(order)
175175
end
176176

177177

178+
local PreviewButton = {
179+
type = "execute",
180+
order = 1,
181+
name = "Preview/Unlock",
182+
desc = "Show a preview of the Display, this also unlocks the Frame so you can move it around",
183+
func = function()
184+
if not MPT.IsPreview then -- not currently in preview
185+
MPT:Init(true) -- Frame is set to movable in here as well
186+
elseif C_ChallengeMode.IsChallengeModeActive() then -- in preview and currently in m+ so we display real states
187+
MPT:Init(false)
188+
MPT:MoveFrame(false)
189+
elseif MPT.Frame and MPT.Frame:IsShown() then -- in preview but not in m+ so we hide the frame
190+
MPT:MoveFrame(false)
191+
MPT:ShowFrame(false)
192+
end
193+
end,
194+
}
195+
178196
local MainOptions = {
179197
type = "group",
180198
name = "Non-Display Settings",
181199
args = {
200+
Preview = PreviewButton,
182201
ViewBestTimes = {
183202
type = "execute",
184-
order = 1,
203+
order = 2,
185204
name = "View Best Times",
186205
desc = "View your stored Best Times",
187206
func = function()
188207
MPT:ShowPBFrame()
189208
end,
190209
},
191-
UpdateRate = MPT:CreateRange(2, "Update Interval", "How often the timer updates", 0.1, 3, 0.1, "UpdateRate"),
192-
Gap = MPT:CreateSpace(3),
210+
UpdateRate = MPT:CreateRange(3, "Update Interval", "How often the timer updates", 0.1, 3, 0.1, "UpdateRate"),
211+
Gap = MPT:CreateSpace(4),
193212
LowerKey = {
194213
type = "toggle",
195-
order = 4,
214+
order = 5,
196215
name = "Data from Lower Level",
197216
desc = "Get Split Timers from one key level lower if no data for current level exists",
198217
set = function(_, value) MPTSV.LowerKey = value end,
199218
get = function() return MPTSV.LowerKey end,
200219
},
201220
CloseBags = {
202221
type = "toggle",
203-
order = 5,
222+
order = 6,
204223
name = "Close Bags",
205224
desc = "Automatically close bags after inserting the Keystone",
206225
set = function(_, value) MPTSV.CloseBags = value end,
207226
get = function() return MPTSV.CloseBags end,
208227
},
209228
KeySlot = {
210229
type = "toggle",
211-
order = 6,
230+
order = 7,
212231
name = "Automatic Keyslot",
213232
desc = "Automatically insert Keystone when interacting with the Keystone Interface",
214233
set = function(_, value) MPTSV.KeySlot = value end,
215234
get = function() return MPTSV.KeySlot end,
216235
},
217236
MinimapIcon = {
218237
type = "toggle",
219-
order = 7,
238+
order = 8,
220239
name = "Hide Minimap Icon",
221240
desc = "Hide the Minimap Icon",
222241
set = function(_, value) MPTSV.MinimapIcon.hide = value LDBIcon:Refresh("MPlusTimer", MPTSV.MinimapIcon) end,
223242
get = function() return MPTSV.MinimapIcon.hide end,
224243
},
225-
Gap2 = MPT:CreateSpace(8),
244+
Gap2 = MPT:CreateSpace(9),
226245
ImportFromWA = {
227246
type = "execute",
228-
order = 9,
247+
order = 10,
229248
name = "Import WA Times",
230249
desc = "Import Best Times from the M+ WA. This is only possible until Pre-Patch hits.",
231250
func = function()
@@ -263,23 +282,7 @@ local GeneralOptions = {
263282
name = "General Options",
264283
order = 1,
265284
args = {
266-
Preview = {
267-
type = "execute",
268-
order = 1,
269-
name = "Preview",
270-
desc = "Show a preview of the Display, this also unlocks the Frame so you can move it around",
271-
func = function()
272-
if not MPT.IsPreview then -- not currently in preview
273-
MPT:Init(true) -- Frame is set to movable in here as well
274-
elseif C_ChallengeMode.IsChallengeModeActive() then -- in preview and currently in m+ so we display real states
275-
MPT:Init(false)
276-
MPT:MoveFrame(false)
277-
elseif MPT.Frame and MPT.Frame:IsShown() then -- in preview but not in m+ so we hide the frame
278-
MPT:MoveFrame(false)
279-
MPT:ShowFrame(false)
280-
end
281-
end,
282-
},
285+
Preview = PreviewButton,
283286
FrameStrata = MPT:CreateDropDown(2, {["BACKGROUND"] = "BACKGROUND", ["LOW"] = "LOW", ["MEDIUM"] = "MEDIUM", ["HIGH"] = "HIGH", ["DIALOG"] = "DIALOG", ["FULLSCREEN"] = "FULLSCREEN", ["FULLSCREEN_DIALOG"] = "FULLSCREEN_DIALOG", ["TOOLTIP"] = "TOOLTIP"}, "Frame Strata", "Strata of the entire Display. High is the default because this makes it appear above the options window.", "FrameStrata", true),
284287
Gap = MPT:CreateSpace(3),
285288
Scale = MPT:CreateRange(4, "Group Scale", "Scale of the entire Display", 0.1, 3, 0.01, "Scale", true),

0 commit comments

Comments
 (0)