forked from Blendman974/faceclaw
Migrate things into new UI design
This commit is contained in:
1 parent
1133f952e9
commit
68ab599856
21 files changed
+1262
-602
No files matched your search
@@ -1,16 +1,18 @@
|
||||
import { getDefaultSmallFont } from "~/graphics/bdffont";
|
||||
import { G2_LENS_HEIGHT, G2_LENS_WIDTH, GrayImage } from "~/graphics/image";
|
||||
import { GrayImage } from "~/graphics/image";
|
||||
import { getDashboardLogo } from "~/graphics/logo";
|
||||
import { DashboardInputEvent, Layer, LayerStack } from "../layers";
|
||||
import { DashboardInputEvent, Layer, LayerContext, LayerStack } from "../layers";
|
||||
|
||||
export class AboutPage implements Layer {
|
||||
paint(): GrayImage {
|
||||
const image = new GrayImage(G2_LENS_WIDTH, G2_LENS_HEIGHT, 0);
|
||||
paint(ctx: LayerContext): GrayImage {
|
||||
// Sized to the hosting stack (the Settings app viewport).
|
||||
const { width, height } = ctx.stack.getBaseSize();
|
||||
const image = new GrayImage(width, height, 0);
|
||||
const logo = getDashboardLogo();
|
||||
const dashboardFont = getDefaultSmallFont();
|
||||
image.drawText(dashboardFont, 22, 16, "About Faceclaw", 220);
|
||||
if (logo) {
|
||||
image.bitBlt(logo, 22, 42);
|
||||
image.bitBlt(logo, 22, 42, { transparentZero: true });
|
||||
}
|
||||
image.drawText(dashboardFont, 108, 48, "Faceclaw", 220);
|
||||
image.drawText(dashboardFont, 108, 64, "Dashboard prototype", 180);
|
||||
@@ -18,7 +20,7 @@ export class AboutPage implements Layer {
|
||||
image.drawTextWrapped({
|
||||
font: dashboardFont,
|
||||
x: 22, y: 128,
|
||||
width: G2_LENS_WIDTH - 44,
|
||||
width: width - 44,
|
||||
text: "By James Babcock. Distributed under the GNU General Public License, version 3. Version 0.1.0. Too much of an early janky development prototype to have proper numbered releases.",
|
||||
value: 180
|
||||
});
|
||||
|
||||
@@ -4,14 +4,11 @@ import { getDashboardPlugin, isBlankDashboardPlugin } from "../dashboard-plugins
|
||||
import { DashboardSlotId, dashboardSlotIds, isNightscoutSettingsConfigured } from "../dashboard-settings";
|
||||
import { DashboardInputEvent, LayerContext } from "../layers";
|
||||
import { MenuLayer } from "../menu";
|
||||
import { NotificationsListLayer } from "../notifications";
|
||||
import { createNightscoutSettingsMenuLayer, createSettingsMenuLayer } from "./settings-menus";
|
||||
import { createNightscoutSettingsMenuLayer } from "./settings-menus";
|
||||
import { TelepromptLayer } from "../apps/teleprompt";
|
||||
import { TerminalAppLayer } from "../apps/terminal";
|
||||
import { TranscribeLayer } from "../apps/transcribe";
|
||||
import { ScreenTestLayer } from "../apps/screen-test";
|
||||
import { BuzzerDemoLayer } from "../apps/buzzer-demo";
|
||||
import { AboutPage } from "./about-page";
|
||||
import { GrayImage } from "~/graphics/image";
|
||||
import { shell } from "../shell/shell";
|
||||
|
||||
@@ -38,21 +35,6 @@ export function createRootMenuLayer(): MenuLayer {
|
||||
ctx.stack.push(createAppsMenuLayer());
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Notifications",
|
||||
onSelect: (ctx) => {
|
||||
ctx.stack.push(new NotificationsListLayer((ctx) => {
|
||||
ctx.stack.clearToBase();
|
||||
ctx.stack.push(createRootMenuLayer());
|
||||
}));
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Settings",
|
||||
onSelect: (ctx) => {
|
||||
ctx.stack.push(createSettingsMenuLayer());
|
||||
},
|
||||
},
|
||||
...dashboardSlotIds
|
||||
.filter((slot) => !isBlankDashboardPlugin(getPluginIdForSlot(slot)))
|
||||
.map((slot) => ({
|
||||
@@ -64,12 +46,6 @@ export function createRootMenuLayer(): MenuLayer {
|
||||
image.drawText(rootMenuFont, x, y + 3, pluginLabelForSlot(slot), 200);
|
||||
},
|
||||
})),
|
||||
{
|
||||
label: "System",
|
||||
onSelect: (ctx) => {
|
||||
ctx.stack.push(createSystemMenuLayer());
|
||||
},
|
||||
},
|
||||
],
|
||||
TOP_LEFT_MENU_LAYOUT,
|
||||
);
|
||||
@@ -93,12 +69,6 @@ function createAppsMenuLayer(): MenuLayer {
|
||||
layer.start(ctx);
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Terminal",
|
||||
onSelect: (ctx) => {
|
||||
ctx.stack.push(new TerminalAppLayer(ctx.actions));
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Screen test",
|
||||
onSelect: (ctx) => {
|
||||
@@ -116,28 +86,6 @@ function createAppsMenuLayer(): MenuLayer {
|
||||
);
|
||||
}
|
||||
|
||||
function createSystemMenuLayer(): MenuLayer {
|
||||
return new MenuLayer(
|
||||
"System",
|
||||
[
|
||||
{
|
||||
label: "About",
|
||||
onSelect: (ctx) => {
|
||||
ctx.stack.push(new AboutPage());
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Quit / Disconnect",
|
||||
onSelect: async (ctx) => {
|
||||
ctx.stack.clearToBase();
|
||||
await ctx.actions.disconnect();
|
||||
},
|
||||
},
|
||||
],
|
||||
TOP_LEFT_MENU_LAYOUT,
|
||||
);
|
||||
}
|
||||
|
||||
function openDashboardSlot(slot: DashboardSlotId, ctx: LayerContext): void {
|
||||
const pluginId = getPluginIdForSlot(slot);
|
||||
if (isBlankDashboardPlugin(pluginId)) {
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
import { TOP_LEFT_MENU_LAYOUT } from "../dashboard";
|
||||
import { APP_VIEWPORT } from "../shell/geometry";
|
||||
import { type MenuLayout } from "../menu";
|
||||
|
||||
// Settings menus render in both the dashboard window (full lens) and the
|
||||
// Settings app window (viewport-sized); cap heights to the smaller of the two.
|
||||
const SETTINGS_MENU_LAYOUT: MenuLayout = { x: 8, y: 8, width: 272, maxHeight: APP_VIEWPORT.height - 16 };
|
||||
import { shell } from "../shell/shell";
|
||||
import { batteryDisplayModeSetting, dashboardSlotIds, elevenLabsApiKeySetting, enumSettingMenuItem, firmwareDebugFlagsSetting, rawScreenshotsEnabledSetting, saveVoiceRecordingsSetting, showSignalStrengthSetting, showAndroidNotificationsSetting, showBatteryIndicatorsSetting, showFaceclawLogoSetting, systemCardNameSetting, textSettingMenuItem, toggleSettingMenuItem, voiceProviderSetting, dashboardSlotSettings, nightscoutSiteUrlSetting, nightscoutApiTokenSetting, screenTimeoutSetting } from "../dashboard-settings";
|
||||
import { batteryDisplayModeSetting, dashboardSlotIds, elevenLabsApiKeySetting, enumSettingMenuItem, firmwareDebugFlagsSetting, rawScreenshotsEnabledSetting, saveVoiceRecordingsSetting, showSignalStrengthSetting, showAndroidNotificationsSetting, showBatteryIndicatorsSetting, showFaceclawLogoSetting, systemCardNameSetting, terminalAuthTokenSetting, terminalHostSetting, terminalPortSetting, textSettingMenuItem, toggleSettingMenuItem, voiceProviderSetting, dashboardSlotSettings, nightscoutSiteUrlSetting, nightscoutApiTokenSetting, screenTimeoutSetting } from "../dashboard-settings";
|
||||
import { MenuLayer } from "../menu";
|
||||
import { AboutPage } from "./about-page";
|
||||
|
||||
export function createSettingsMenuLayer(): MenuLayer {
|
||||
return new MenuLayer(
|
||||
@@ -31,14 +37,45 @@ export function createSettingsMenuLayer(): MenuLayer {
|
||||
ctx.stack.push(createIntegrationsMenuLayer());
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Terminal",
|
||||
onSelect: (ctx) => {
|
||||
ctx.stack.push(createTerminalSettingsMenuLayer());
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Developer",
|
||||
onSelect: (ctx) => {
|
||||
ctx.stack.push(createDeveloperSettingsMenuLayer());
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "About",
|
||||
onSelect: (ctx) => {
|
||||
ctx.stack.push(new AboutPage());
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "Quit / Disconnect",
|
||||
onSelect: async (ctx) => {
|
||||
ctx.stack.clearToBase();
|
||||
await ctx.actions.disconnect();
|
||||
},
|
||||
},
|
||||
],
|
||||
TOP_LEFT_MENU_LAYOUT,
|
||||
SETTINGS_MENU_LAYOUT,
|
||||
);
|
||||
}
|
||||
|
||||
function createTerminalSettingsMenuLayer(): MenuLayer {
|
||||
return new MenuLayer(
|
||||
"Settings > Terminal",
|
||||
[
|
||||
textSettingMenuItem(terminalHostSetting),
|
||||
textSettingMenuItem(terminalPortSetting),
|
||||
textSettingMenuItem(terminalAuthTokenSetting),
|
||||
],
|
||||
SETTINGS_MENU_LAYOUT,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -50,7 +87,7 @@ function createDeveloperSettingsMenuLayer(): MenuLayer {
|
||||
toggleSettingMenuItem(saveVoiceRecordingsSetting),
|
||||
toggleSettingMenuItem(firmwareDebugFlagsSetting),
|
||||
],
|
||||
TOP_LEFT_MENU_LAYOUT,
|
||||
SETTINGS_MENU_LAYOUT,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -64,7 +101,7 @@ function createDisplaySettingsMenuLayer(): MenuLayer {
|
||||
},
|
||||
}),
|
||||
],
|
||||
TOP_LEFT_MENU_LAYOUT,
|
||||
SETTINGS_MENU_LAYOUT,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -75,7 +112,7 @@ function createVoiceSettingsMenuLayer(): MenuLayer {
|
||||
enumSettingMenuItem(voiceProviderSetting),
|
||||
textSettingMenuItem(elevenLabsApiKeySetting),
|
||||
],
|
||||
TOP_LEFT_MENU_LAYOUT,
|
||||
SETTINGS_MENU_LAYOUT,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -93,7 +130,7 @@ function createDashboardSettingsMenuLayer(): MenuLayer {
|
||||
style: "submenu",
|
||||
})),
|
||||
],
|
||||
TOP_LEFT_MENU_LAYOUT,
|
||||
SETTINGS_MENU_LAYOUT,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -108,7 +145,7 @@ function createSystemCardSettingsMenuLayer(): MenuLayer {
|
||||
toggleSettingMenuItem(showAndroidNotificationsSetting),
|
||||
toggleSettingMenuItem(showSignalStrengthSetting),
|
||||
],
|
||||
TOP_LEFT_MENU_LAYOUT,
|
||||
SETTINGS_MENU_LAYOUT,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -123,7 +160,7 @@ function createIntegrationsMenuLayer(): MenuLayer {
|
||||
},
|
||||
},
|
||||
],
|
||||
TOP_LEFT_MENU_LAYOUT,
|
||||
SETTINGS_MENU_LAYOUT,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -134,6 +171,6 @@ export function createNightscoutSettingsMenuLayer(): MenuLayer {
|
||||
textSettingMenuItem(nightscoutSiteUrlSetting),
|
||||
textSettingMenuItem(nightscoutApiTokenSetting),
|
||||
],
|
||||
TOP_LEFT_MENU_LAYOUT,
|
||||
SETTINGS_MENU_LAYOUT,
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user