From b7b90c9e608f5f2d21c17c280183f66511627ccb Mon Sep 17 00:00:00 2001 From: Jaakko Keränen Date: Wed, 8 Sep 2021 17:30:21 +0300 Subject: Mobile: Added Identities, Help, About to Settings screens --- src/ui/mobile.c | 26 ++++++++++++++++---------- src/ui/util.c | 52 ++++++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 58 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/ui/mobile.c b/src/ui/mobile.c index ecfb83ed..48f17c9c 100644 --- a/src/ui/mobile.c +++ b/src/ui/mobile.c @@ -280,8 +280,8 @@ static void stripTrailingColon_(iLabelWidget *label) { static iLabelWidget *makePanelButton_(const char *text, const char *command) { iLabelWidget *btn = new_LabelWidget(text, command); setFlags_Widget(as_Widget(btn), - borderBottom_WidgetFlag | alignLeft_WidgetFlag | - frameless_WidgetFlag | extraPadding_WidgetFlag, + borderTop_WidgetFlag | borderBottom_WidgetFlag | alignLeft_WidgetFlag | + frameless_WidgetFlag | extraPadding_WidgetFlag, iTrue); checkIcon_LabelWidget(btn); setFont_LabelWidget(btn, labelFont_()); @@ -379,11 +379,13 @@ static size_t countItems_(const iMenuItem *itemsNullTerminated) { } void makePanelItem_Mobile(iWidget *panel, const iMenuItem *item) { - const char * spec = item->label; - const char * id = cstr_Rangecc(range_Command(spec, "id")); - const char * label = format_CStr("${%s}", id); iWidget * widget = NULL; iLabelWidget *heading = NULL; + const char * spec = item->label; + const char * id = cstr_Rangecc(range_Command(spec, "id")); + const char * label = hasLabel_Command(spec, "text") + ? suffixPtr_Command(spec, "text") + : format_CStr("${%s}", id); if (hasLabel_Command(spec, "device") && deviceType_App() != argLabel_Command(spec, "device")) { return; } @@ -486,6 +488,9 @@ void makePanelItem_Mobile(iWidget *panel, const iMenuItem *item) { as_Widget(input)); } } + else if (equal_Command(spec, "button")) { + widget = as_Widget(heading = makePanelButton_(label, item->command)); + } else if (equal_Command(spec, "padding")) { widget = makePadding_Widget(lineHeight_Text(labelFont_()) * 1.5f); } @@ -514,9 +519,8 @@ iWidget *makeSplitMultiPanel_Mobile(const iMenuItem *itemsNullTerminated) { iWidget *sheet = new_Widget(); setBackgroundColor_Widget(sheet, uiBackground_ColorId); setFlags_Widget(sheet, - resizeToParentWidth_WidgetFlag | - resizeToParentHeight_WidgetFlag | - frameless_WidgetFlag | focusRoot_WidgetFlag | commandOnClick_WidgetFlag | + resizeToParentWidth_WidgetFlag | resizeToParentHeight_WidgetFlag | + frameless_WidgetFlag | focusRoot_WidgetFlag | commandOnClick_WidgetFlag | overflowScrollable_WidgetFlag | leftEdgeDraggable_WidgetFlag, iTrue); /* The top-level split between main and detail panels. */ @@ -571,8 +575,10 @@ iWidget *makeSplitMultiPanel_Mobile(const iMenuItem *itemsNullTerminated) { const iMenuItem *item = &itemsNullTerminated[i]; if (equal_Command(item->label, "panel")) { const char *id = cstr_Rangecc(range_Command(item->label, "id")); - const iString *label = collectNewFormat_String("${%s}", id); - iLabelWidget *button = + const iString *label = hasLabel_Command(item->label, "text") + ? collect_String(suffix_Command(item->label, "text")) + : collectNewFormat_String("${%s}", id); + iLabelWidget * button = addChildFlags_Widget(topPanel, iClob(makePanelButton_(cstr_String(label), "panel.open")), chevron_WidgetFlag | borderTop_WidgetFlag); diff --git a/src/ui/util.c b/src/ui/util.c index 64d7ea2b..a53041c2 100644 --- a/src/ui/util.c +++ b/src/ui/util.c @@ -1734,7 +1734,7 @@ iWidget *makePreferences_Widget(void) { { "button id:prefs.mono.gopher" }, { NULL } }; - const iMenuItem boldLinkItems[] = { + const iMenuItem boldLinkItems[] = { { "button id:prefs.boldlink.dark" }, { "button id:prefs.boldlink.light" }, { NULL } @@ -1758,7 +1758,6 @@ iWidget *makePreferences_Widget(void) { { "heading id:prefs.searchurl" }, { "input id:prefs.searchurl url:1 noheading:1" }, { "padding" }, - { "toggle id:prefs.hoverlink" }, { "toggle id:prefs.archive.openindex" }, { "radio device:1 id:prefs.pinsplit", 0, 0, (const void *) pinSplitItems }, { "padding" }, @@ -1769,6 +1768,7 @@ iWidget *makePreferences_Widget(void) { { "title id:heading.prefs.interface" }, { "dropdown device:1 id:prefs.returnkey", 0, 0, (const void *) returnKeyBehaviors }, { "padding device:1" }, + { "toggle id:prefs.hoverlink" }, { "toggle device:2 id:prefs.hidetoolbarscroll" }, { "heading id:heading.prefs.sizing" }, { "input id:prefs.uiscale maxlen:8" }, @@ -1824,19 +1824,51 @@ iWidget *makePreferences_Widget(void) { { "input id:prefs.proxy.http noheading:1" }, { NULL } }; + const iMenuItem identityPanelItems[] = { + { "title id:sidebar.identities" }, + { NULL } + }; + iString *aboutText = collectNew_String(); { + setCStr_String(aboutText, "Lagrange " LAGRANGE_APP_VERSION); +#if defined (iPlatformAppleMobile) + appendCStr_String(aboutText, " (" LAGRANGE_IOS_VERSION ")"); +#endif + } + const iMenuItem aboutPanelItems[] = { + { format_CStr("heading text:%s", cstr_String(aboutText)) }, + { "button text:" globe_Icon " By @jk@skyjake.fi", 0, 0, + "!open url:https://skyjake.fi/@jk" }, + { "button text:" clock_Icon " ${menu.releasenotes}", 0, 0, + "!open url:about:version" }, + { "padding" }, + { "button text:" info_Icon " ${menu.aboutpages}", 0, 0, + "!open url:about:about" }, + { "button text:" bug_Icon " ${menu.debug}", 0, 0, + "!open url:about:debug" }, + { NULL } + }; const iMenuItem items[] = { { "panel icon:0x2699 id:heading.prefs.general", '1', 0, (const void *) generalPanelItems }, + { "panel icon:0x1f5a7 id:heading.prefs.network", + '2', 0, (const void *) networkPanelItems }, + { "panel text:" person_Icon " ${sidebar.identities}", + '3', 0, (const void *) identityPanelItems }, + { "padding" }, { "panel icon:0x1f4f1 id:heading.prefs.interface", - '2', 0, (const void *) uiPanelItems }, + '4', 0, (const void *) uiPanelItems }, { "panel icon:0x1f3a8 id:heading.prefs.colors", - '3', 0, (const void *) colorPanelItems }, + '5', 0, (const void *) colorPanelItems }, { "panel icon:0x1f5da id:heading.prefs.fonts", - '4', 0, (const void *) fontPanelItems }, + '6', 0, (const void *) fontPanelItems }, { "panel icon:0x1f660 id:heading.prefs.style", - '5', 0, (const void *) stylePanelItems }, - { "panel icon:0x1f5a7 id:heading.prefs.network", - '6', 0, (const void *) networkPanelItems }, - { NULL } }; + '7', 0, (const void *) stylePanelItems }, + { "padding" }, + { "button text:" info_Icon " ${menu.help}", + 0, 0, "!open url:about:help" }, + { "padding" }, + { "panel text:" planet_Icon " ${menu.about}", + 0, 0, (const void *) aboutPanelItems }, + { NULL } }; iWidget *dlg = makeSplitMultiPanel_Mobile(items); setupSheetTransition_Mobile(dlg, iTrue); return dlg; @@ -2159,7 +2191,7 @@ iWidget *makeBookmarkEditor_Widget(void) { /* Buttons for special tags. */ addChild_Widget(dlg, iClob(makePadding_Widget(gap_UI))); addChild_Widget(dlg, iClob(makeTwoColumns_Widget(&headings, &values))); - makeTwoColumnHeading_("SPECIAL TAGS", headings, values); + makeTwoColumnHeading_("${heading.bookmark.tags}", headings, values); addChild_Widget(headings, iClob(makeHeading_Widget("${bookmark.tag.home}"))); addChild_Widget(values, iClob(makeToggle_Widget("bmed.tag.home"))); addChild_Widget(headings, iClob(makeHeading_Widget("${bookmark.tag.remote}"))); -- cgit v1.2.3