From 4feb6a86457d66dd4f119b2324055167a373ae6c Mon Sep 17 00:00:00 2001 From: Hersi Date: Wed, 27 Apr 2022 12:29:54 +0200 Subject: [PATCH] page management code refactor --- scripts/{components/pager => api/page}/containerfield.lua | 2 +- scripts/{components/pager => api/page}/field.lua | 0 scripts/{components/pager => api/page}/linkfield.lua | 2 +- scripts/{components/pager => api/page}/page.lua | 0 scripts/{components/pager => api/page}/pageview.lua | 0 scripts/titlescreen/boot.lua | 2 +- .../{fields/boot => components}/checkupdatefield.lua | 2 +- .../{fields/service => components}/colorgradientfield.lua | 2 +- .../{fields/boot => components}/dialogfield.lua | 2 +- .../{fields/service => components}/inputbuttonfield.lua | 2 +- .../{fields/service => components}/inputknobfield.lua | 2 +- .../{fields/service => components}/listfield.lua | 4 ++-- .../{fields/boot => components}/selftestfield.lua | 2 +- .../{fields/service => components}/servicefield.lua | 2 +- .../{fields/service => components}/servicelinkfield.lua | 4 ++-- .../{fields/service => components}/updatefield.lua | 2 +- scripts/titlescreen/pages/boot/bootpage.lua | 8 ++++---- scripts/titlescreen/pages/boot/checkupdatepage.lua | 6 +++--- scripts/titlescreen/pages/service/colorcheckpage.lua | 4 ++-- scripts/titlescreen/pages/service/inputcheckpage.lua | 6 +++--- scripts/titlescreen/pages/service/mainmenupage.lua | 4 ++-- scripts/titlescreen/pages/service/servicepage.lua | 4 ++-- scripts/titlescreen/pages/service/versioninfopage.lua | 6 +++--- scripts/titlescreen/service.lua | 2 +- 24 files changed, 35 insertions(+), 35 deletions(-) rename scripts/{components/pager => api/page}/containerfield.lua (96%) rename scripts/{components/pager => api/page}/field.lua (100%) rename scripts/{components/pager => api/page}/linkfield.lua (96%) rename scripts/{components/pager => api/page}/page.lua (100%) rename scripts/{components/pager => api/page}/pageview.lua (100%) rename scripts/titlescreen/{fields/boot => components}/checkupdatefield.lua (96%) rename scripts/titlescreen/{fields/service => components}/colorgradientfield.lua (95%) rename scripts/titlescreen/{fields/boot => components}/dialogfield.lua (98%) rename scripts/titlescreen/{fields/service => components}/inputbuttonfield.lua (93%) rename scripts/titlescreen/{fields/service => components}/inputknobfield.lua (97%) rename scripts/titlescreen/{fields/service => components}/listfield.lua (96%) rename scripts/titlescreen/{fields/boot => components}/selftestfield.lua (97%) rename scripts/titlescreen/{fields/service => components}/servicefield.lua (98%) rename scripts/titlescreen/{fields/service => components}/servicelinkfield.lua (83%) rename scripts/titlescreen/{fields/service => components}/updatefield.lua (96%) diff --git a/scripts/components/pager/containerfield.lua b/scripts/api/page/containerfield.lua similarity index 96% rename from scripts/components/pager/containerfield.lua rename to scripts/api/page/containerfield.lua index 49a1426..1f7c3f8 100644 --- a/scripts/components/pager/containerfield.lua +++ b/scripts/api/page/containerfield.lua @@ -1,5 +1,5 @@ require("common.class") -local Field = require("components.pager.field") +local Field = require("api.page.field") ---@class ContainerField: Field ---@field content Field[] diff --git a/scripts/components/pager/field.lua b/scripts/api/page/field.lua similarity index 100% rename from scripts/components/pager/field.lua rename to scripts/api/page/field.lua diff --git a/scripts/components/pager/linkfield.lua b/scripts/api/page/linkfield.lua similarity index 96% rename from scripts/components/pager/linkfield.lua rename to scripts/api/page/linkfield.lua index 107d9a1..580f99c 100644 --- a/scripts/components/pager/linkfield.lua +++ b/scripts/api/page/linkfield.lua @@ -1,5 +1,5 @@ require("common.class") -local Field = require("components.pager.field") +local Field = require("api.page.field") ---@class LinkField: Field ---@field link Page diff --git a/scripts/components/pager/page.lua b/scripts/api/page/page.lua similarity index 100% rename from scripts/components/pager/page.lua rename to scripts/api/page/page.lua diff --git a/scripts/components/pager/pageview.lua b/scripts/api/page/pageview.lua similarity index 100% rename from scripts/components/pager/pageview.lua rename to scripts/api/page/pageview.lua diff --git a/scripts/titlescreen/boot.lua b/scripts/titlescreen/boot.lua index ce94260..d58684a 100644 --- a/scripts/titlescreen/boot.lua +++ b/scripts/titlescreen/boot.lua @@ -1,7 +1,7 @@ local Dim = require("common.dimensions") local Wallpaper = require("components.wallpaper") local BootPage = require("titlescreen.pages.boot.bootpage") -local PageView = require("components.pager.pageview") +local PageView = require("api.page.pageview") local bootpage = BootPage.new() local pageview = PageView.new(bootpage) diff --git a/scripts/titlescreen/fields/boot/checkupdatefield.lua b/scripts/titlescreen/components/checkupdatefield.lua similarity index 96% rename from scripts/titlescreen/fields/boot/checkupdatefield.lua rename to scripts/titlescreen/components/checkupdatefield.lua index 13b84e1..8c55176 100644 --- a/scripts/titlescreen/fields/boot/checkupdatefield.lua +++ b/scripts/titlescreen/components/checkupdatefield.lua @@ -1,6 +1,6 @@ require("common.class") local Util = require("common.util") -local ServiceField = require("titlescreen.fields.service.servicefield") +local ServiceField = require("titlescreen.components.servicefield") ---@class CheckUpdateField: ServiceField ---@field onUpdateAvailable nil|fun(url: string, version: string) diff --git a/scripts/titlescreen/fields/service/colorgradientfield.lua b/scripts/titlescreen/components/colorgradientfield.lua similarity index 95% rename from scripts/titlescreen/fields/service/colorgradientfield.lua rename to scripts/titlescreen/components/colorgradientfield.lua index 97302eb..da8ad79 100644 --- a/scripts/titlescreen/fields/service/colorgradientfield.lua +++ b/scripts/titlescreen/components/colorgradientfield.lua @@ -1,6 +1,6 @@ require("common.class") local Util = require("common.util") -local ServiceField = require("titlescreen.fields.service.servicefield") +local ServiceField = require("titlescreen.components.servicefield") ---@class ColorGradientField: ServiceField local ColorGradientField = { diff --git a/scripts/titlescreen/fields/boot/dialogfield.lua b/scripts/titlescreen/components/dialogfield.lua similarity index 98% rename from scripts/titlescreen/fields/boot/dialogfield.lua rename to scripts/titlescreen/components/dialogfield.lua index 6d1bc99..f5d0246 100644 --- a/scripts/titlescreen/fields/boot/dialogfield.lua +++ b/scripts/titlescreen/components/dialogfield.lua @@ -1,5 +1,5 @@ require("common.class") -local ContainerField = require("components.pager.containerfield") +local ContainerField = require("api.page.containerfield") ---@class DialogField: ContainerField ---@field _symbolMargin number diff --git a/scripts/titlescreen/fields/service/inputbuttonfield.lua b/scripts/titlescreen/components/inputbuttonfield.lua similarity index 93% rename from scripts/titlescreen/fields/service/inputbuttonfield.lua rename to scripts/titlescreen/components/inputbuttonfield.lua index 294a455..8435389 100644 --- a/scripts/titlescreen/fields/service/inputbuttonfield.lua +++ b/scripts/titlescreen/components/inputbuttonfield.lua @@ -1,5 +1,5 @@ require("common.class") -local ServiceField = require("titlescreen.fields.service.servicefield") +local ServiceField = require("titlescreen.components.servicefield") ---@class InputButtonField: ServiceField ---@field button integer diff --git a/scripts/titlescreen/fields/service/inputknobfield.lua b/scripts/titlescreen/components/inputknobfield.lua similarity index 97% rename from scripts/titlescreen/fields/service/inputknobfield.lua rename to scripts/titlescreen/components/inputknobfield.lua index e2840c0..b2fb8af 100644 --- a/scripts/titlescreen/fields/service/inputknobfield.lua +++ b/scripts/titlescreen/components/inputknobfield.lua @@ -1,6 +1,6 @@ require("common.class") local Util = require("common.util") -local ServiceField = require("titlescreen.fields.service.servicefield") +local ServiceField = require("titlescreen.components.servicefield") ---@class InputKnobField: ServiceField ---@field knob integer diff --git a/scripts/titlescreen/fields/service/listfield.lua b/scripts/titlescreen/components/listfield.lua similarity index 96% rename from scripts/titlescreen/fields/service/listfield.lua rename to scripts/titlescreen/components/listfield.lua index 554826b..05a7e44 100644 --- a/scripts/titlescreen/fields/service/listfield.lua +++ b/scripts/titlescreen/components/listfield.lua @@ -1,6 +1,6 @@ require("common.class") -local ContainerField = require("components.pager.containerfield") -local ServiceField = require("titlescreen.fields.service.servicefield") +local ContainerField = require("api.page.containerfield") +local ServiceField = require("titlescreen.components.servicefield") ---@class ListField: ContainerField, ServiceField ---@field selectedIndex integer diff --git a/scripts/titlescreen/fields/boot/selftestfield.lua b/scripts/titlescreen/components/selftestfield.lua similarity index 97% rename from scripts/titlescreen/fields/boot/selftestfield.lua rename to scripts/titlescreen/components/selftestfield.lua index 3c955d1..5ec5100 100644 --- a/scripts/titlescreen/fields/boot/selftestfield.lua +++ b/scripts/titlescreen/components/selftestfield.lua @@ -1,6 +1,6 @@ require("common.class") local Util = require("common.util") -local ServiceField = require("titlescreen.fields.service.servicefield") +local ServiceField = require("titlescreen.components.servicefield") ---@class SelfTestStatusEnum SelfTestStatusEnum = { diff --git a/scripts/titlescreen/fields/service/servicefield.lua b/scripts/titlescreen/components/servicefield.lua similarity index 98% rename from scripts/titlescreen/fields/service/servicefield.lua rename to scripts/titlescreen/components/servicefield.lua index 3c7f708..3c4dc9c 100644 --- a/scripts/titlescreen/fields/service/servicefield.lua +++ b/scripts/titlescreen/components/servicefield.lua @@ -1,6 +1,6 @@ require("common.class") local Dim = require("common.dimensions") -local Field = require("components.pager.field") +local Field = require("api.page.field") ---@class ServiceFieldState ServiceFieldState = { diff --git a/scripts/titlescreen/fields/service/servicelinkfield.lua b/scripts/titlescreen/components/servicelinkfield.lua similarity index 83% rename from scripts/titlescreen/fields/service/servicelinkfield.lua rename to scripts/titlescreen/components/servicelinkfield.lua index 384f10b..a5cf732 100644 --- a/scripts/titlescreen/fields/service/servicelinkfield.lua +++ b/scripts/titlescreen/components/servicelinkfield.lua @@ -1,6 +1,6 @@ require("common.class") -local LinkField = require("components.pager.linkfield") -local ServiceField = require("titlescreen.fields.service.servicefield") +local LinkField = require("api.page.linkfield") +local ServiceField = require("titlescreen.components.servicefield") ---@class ServiceLinkField: LinkField, ServiceField local ServiceLinkField = { diff --git a/scripts/titlescreen/fields/service/updatefield.lua b/scripts/titlescreen/components/updatefield.lua similarity index 96% rename from scripts/titlescreen/fields/service/updatefield.lua rename to scripts/titlescreen/components/updatefield.lua index 5564c4b..60cfa67 100644 --- a/scripts/titlescreen/fields/service/updatefield.lua +++ b/scripts/titlescreen/components/updatefield.lua @@ -1,5 +1,5 @@ require("common.class") -local ServiceField = require("titlescreen.fields.service.servicefield") +local ServiceField = require("titlescreen.components.servicefield") ---@class UpdateField: ServiceField ---@field _timer number diff --git a/scripts/titlescreen/pages/boot/bootpage.lua b/scripts/titlescreen/pages/boot/bootpage.lua index 770e3f0..11a88d9 100644 --- a/scripts/titlescreen/pages/boot/bootpage.lua +++ b/scripts/titlescreen/pages/boot/bootpage.lua @@ -2,11 +2,11 @@ require("common.class") require("common.filereader") local Dim = require("common.dimensions") local Version = require("common.version") -local Page = require("components.pager.page") +local Page = require("api.page.page") local CheckUpdatePage = require("titlescreen.pages.boot.checkupdatepage") -local ServiceField = require("titlescreen.fields.service.servicefield") -local ListField = require("titlescreen.fields.service.listfield") -local SelfTestField = require("titlescreen.fields.boot.selftestfield") +local ServiceField = require("titlescreen.components.servicefield") +local ListField = require("titlescreen.components.listfield") +local SelfTestField = require("titlescreen.components.selftestfield") ---@class BootPage: Page local BootPage = { diff --git a/scripts/titlescreen/pages/boot/checkupdatepage.lua b/scripts/titlescreen/pages/boot/checkupdatepage.lua index a87fb3d..20d1a94 100644 --- a/scripts/titlescreen/pages/boot/checkupdatepage.lua +++ b/scripts/titlescreen/pages/boot/checkupdatepage.lua @@ -1,8 +1,8 @@ require("common.class") local Dim = require("common.dimensions") -local Page = require("components.pager.page") -local CheckUpdateField = require("titlescreen.fields.boot.checkupdatefield") -local DialogField = require("titlescreen.fields.boot.dialogfield") +local Page = require("api.page.page") +local CheckUpdateField = require("titlescreen.components.checkupdatefield") +local DialogField = require("titlescreen.components.dialogfield") ---@class CheckUpdatePage: Page ---@field _focusedField CheckUpdateField diff --git a/scripts/titlescreen/pages/service/colorcheckpage.lua b/scripts/titlescreen/pages/service/colorcheckpage.lua index 5a3fdeb..044d29c 100644 --- a/scripts/titlescreen/pages/service/colorcheckpage.lua +++ b/scripts/titlescreen/pages/service/colorcheckpage.lua @@ -1,7 +1,7 @@ require("common.class") local ServicePage = require("titlescreen.pages.service.servicepage") -local ListField = require("titlescreen.fields.service.listfield") -local ColorGradientField = require("titlescreen.fields.service.colorgradientfield") +local ListField = require("titlescreen.components.listfield") +local ColorGradientField = require("titlescreen.components.colorgradientfield") ---@class ColorCheckPage: ServicePage local ColorCheckPage = { diff --git a/scripts/titlescreen/pages/service/inputcheckpage.lua b/scripts/titlescreen/pages/service/inputcheckpage.lua index 0606ccc..f1ecec2 100644 --- a/scripts/titlescreen/pages/service/inputcheckpage.lua +++ b/scripts/titlescreen/pages/service/inputcheckpage.lua @@ -1,8 +1,8 @@ require("common.class") local ServicePage = require("titlescreen.pages.service.servicepage") -local InputButtonField = require("titlescreen.fields.service.inputbuttonfield") -local InputKnobField = require("titlescreen.fields.service.inputknobfield") -local ListField = require("titlescreen.fields.service.listfield") +local InputButtonField = require("titlescreen.components.inputbuttonfield") +local InputKnobField = require("titlescreen.components.inputknobfield") +local ListField = require("titlescreen.components.listfield") ---@class InputCheckPage: ServicePage local InputCheckPage = { diff --git a/scripts/titlescreen/pages/service/mainmenupage.lua b/scripts/titlescreen/pages/service/mainmenupage.lua index 2613a79..c36961a 100644 --- a/scripts/titlescreen/pages/service/mainmenupage.lua +++ b/scripts/titlescreen/pages/service/mainmenupage.lua @@ -4,8 +4,8 @@ local InputCheckPage = require("titlescreen.pages.service.inputcheckpage") local ScreenCheckPage = require("titlescreen.pages.service.screencheckpage") local ColorCheckPage = require("titlescreen.pages.service.colorcheckpage") local VersionInfoPage = require("titlescreen.pages.service.versioninfopage") -local ServiceLinkField = require("titlescreen.fields.service.servicelinkfield") -local ListField = require("titlescreen.fields.service.listfield") +local ServiceLinkField = require("titlescreen.components.servicelinkfield") +local ListField = require("titlescreen.components.listfield") ---@class MainMenuPage: ServicePage local MainMenuPage = { diff --git a/scripts/titlescreen/pages/service/servicepage.lua b/scripts/titlescreen/pages/service/servicepage.lua index 753dc65..29d2b00 100644 --- a/scripts/titlescreen/pages/service/servicepage.lua +++ b/scripts/titlescreen/pages/service/servicepage.lua @@ -1,8 +1,8 @@ require("common.class") local Dim = require("common.dimensions") local Util = require("common.util") -local Page = require("components.pager.page") -local ServiceField = require("titlescreen.fields.service.servicefield") +local Page = require("api.page.page") +local ServiceField = require("titlescreen.components.servicefield") ---@class ServicePage: Page ---@field title string|string[] diff --git a/scripts/titlescreen/pages/service/versioninfopage.lua b/scripts/titlescreen/pages/service/versioninfopage.lua index 4aa9ef2..102ed7d 100644 --- a/scripts/titlescreen/pages/service/versioninfopage.lua +++ b/scripts/titlescreen/pages/service/versioninfopage.lua @@ -3,9 +3,9 @@ require("common.filereader") require("common.gameconfig") local Version = require("common.version") local ServicePage = require("titlescreen.pages.service.servicepage") -local ServiceField = require("titlescreen.fields.service.servicefield") -local UpdateField = require("titlescreen.fields.service.updatefield") -local ListField = require("titlescreen.fields.service.listfield") +local ServiceField = require("titlescreen.components.servicefield") +local UpdateField = require("titlescreen.components.updatefield") +local ListField = require("titlescreen.components.listfield") local function getGameLogValue(prefix, str) local pattern = prefix .. ":%s*([^\r\n]*)" diff --git a/scripts/titlescreen/service.lua b/scripts/titlescreen/service.lua index 074869f..ab17703 100644 --- a/scripts/titlescreen/service.lua +++ b/scripts/titlescreen/service.lua @@ -1,7 +1,7 @@ local Dim = require("common.dimensions") local Wallpaper = require("components.wallpaper") -local PageView = require("components.pager.pageview") +local PageView = require("api.page.pageview") local MainMenuPage = require("titlescreen.pages.service.mainmenupage") --[[ WIP: REIMPLEMENTATION