summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-10-01 16:31:08 +0300
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-10-01 16:31:08 +0300
commit5c7417c547b84c30eee42fce57cb09e0552ac34f (patch)
treed9ceff958b3fa5e82234cfc9eb407b2f8f4c4b46
parentb60715722cceea893167a619613f79945f346885 (diff)
Added feeds update progress indicator
Show some status info about the progress of feed refresh. The search query and feeds indicators now use the small UI font size.
-rw-r--r--src/app.c35
-rw-r--r--src/ui/root.c12
-rw-r--r--src/ui/widget.c2
3 files changed, 33 insertions, 16 deletions
diff --git a/src/app.c b/src/app.c
index df4a8b0d..012eb697 100644
--- a/src/app.c
+++ b/src/app.c
@@ -2827,19 +2827,28 @@ iBool handleCommand_App(const char *cmd) {
2827 refresh_Feeds(); 2827 refresh_Feeds();
2828 return iTrue; 2828 return iTrue;
2829 } 2829 }
2830 else if (equal_Command(cmd, "feeds.update.started")) { 2830 else if (startsWith_CStr(cmd, "feeds.update.")) {
2831 iAnyObject *prog = findWidget_Root("feeds.progress"); 2831 const iWidget *navBar = findChild_Widget(get_Window()->roots[0]->widget, "navbar");
2832 const iWidget *navBar = findWidget_Root("navbar"); 2832 iAnyObject *prog = findChild_Widget(navBar, "feeds.progress");
2833 updateTextAndResizeWidthCStr_LabelWidget( 2833 if (equal_Command(cmd, "feeds.update.started") ||
2834 prog, flags_Widget(navBar) & tight_WidgetFlag || deviceType_App() == phone_AppDeviceType ? 2834 equal_Command(cmd, "feeds.update.progress")) {
2835 "\u2605" : "\u2605 ${status.feeds}"); 2835 const int num = arg_Command(cmd);
2836 showCollapsed_Widget(prog, iTrue); 2836 const int total = argLabel_Command(cmd, "total");
2837 return iFalse; 2837 updateTextAndResizeWidthCStr_LabelWidget(prog,
2838 } 2838 flags_Widget(navBar) & tight_WidgetFlag ||
2839 else if (equal_Command(cmd, "feeds.update.finished")) { 2839 deviceType_App() == phone_AppDeviceType
2840 showCollapsed_Widget(findWidget_Root("feeds.progress"), iFalse); 2840 ? star_Icon
2841 refreshFinished_Feeds(); 2841 : star_Icon " ${status.feeds}");
2842 refresh_Widget(findWidget_App("url")); 2842 showCollapsed_Widget(prog, iTrue);
2843 setFixedSize_Widget(findChild_Widget(prog, "feeds.progressbar"),
2844 init_I2(width_Widget(prog) * num / total, -1));
2845 }
2846 else if (equal_Command(cmd, "feeds.update.finished")) {
2847 showCollapsed_Widget(prog, iFalse);
2848 refreshFinished_Feeds();
2849 refresh_Widget(findWidget_App("url"));
2850 return iFalse;
2851 }
2843 return iFalse; 2852 return iFalse;
2844 } 2853 }
2845 else if (equal_Command(cmd, "visited.changed")) { 2854 else if (equal_Command(cmd, "visited.changed")) {
diff --git a/src/ui/root.c b/src/ui/root.c
index adc18870..253d0cfb 100644
--- a/src/ui/root.c
+++ b/src/ui/root.c
@@ -1149,9 +1149,10 @@ void createUserInterface_Root(iRoot *d) {
1149 iLabelWidget *queryInd = new_LabelWidget("${status.query} " return_Icon, NULL); 1149 iLabelWidget *queryInd = new_LabelWidget("${status.query} " return_Icon, NULL);
1150 setId_Widget(as_Widget(queryInd), "input.indicator.search"); 1150 setId_Widget(as_Widget(queryInd), "input.indicator.search");
1151 setTextColor_LabelWidget(queryInd, uiTextAction_ColorId); 1151 setTextColor_LabelWidget(queryInd, uiTextAction_ColorId);
1152 setFont_LabelWidget(queryInd, defaultSmall_FontId);
1152 setBackgroundColor_Widget(as_Widget(queryInd), uiBackground_ColorId); 1153 setBackgroundColor_Widget(as_Widget(queryInd), uiBackground_ColorId);
1153 setFrameColor_Widget(as_Widget(queryInd), uiTextAction_ColorId); 1154 setFrameColor_Widget(as_Widget(queryInd), uiTextAction_ColorId);
1154 setAlignVisually_LabelWidget(queryInd, iTrue); 1155// setAlignVisually_LabelWidget(queryInd, iTrue);
1155 setNoAutoMinHeight_LabelWidget(queryInd, iTrue); 1156 setNoAutoMinHeight_LabelWidget(queryInd, iTrue);
1156 addChildFlags_Widget(rightEmbed, 1157 addChildFlags_Widget(rightEmbed,
1157 iClob(queryInd), 1158 iClob(queryInd),
@@ -1161,9 +1162,16 @@ void createUserInterface_Root(iRoot *d) {
1161 iLabelWidget *fprog = new_LabelWidget("", NULL); 1162 iLabelWidget *fprog = new_LabelWidget("", NULL);
1162 setId_Widget(as_Widget(fprog), "feeds.progress"); 1163 setId_Widget(as_Widget(fprog), "feeds.progress");
1163 setTextColor_LabelWidget(fprog, uiTextCaution_ColorId); 1164 setTextColor_LabelWidget(fprog, uiTextCaution_ColorId);
1165 setFont_LabelWidget(fprog, defaultSmall_FontId);
1164 setBackgroundColor_Widget(as_Widget(fprog), uiBackground_ColorId); 1166 setBackgroundColor_Widget(as_Widget(fprog), uiBackground_ColorId);
1165 setAlignVisually_LabelWidget(fprog, iTrue); 1167// setAlignVisually_LabelWidget(fprog, iTrue);
1166 setNoAutoMinHeight_LabelWidget(fprog, iTrue); 1168 setNoAutoMinHeight_LabelWidget(fprog, iTrue);
1169 iWidget *progBar = new_Widget();
1170 setBackgroundColor_Widget(progBar, uiTextCaution_ColorId);
1171 setFixedSize_Widget(progBar, init_I2(0, gap_UI / 4));
1172 setId_Widget(addChildFlags_Widget(as_Widget(fprog), iClob(progBar),
1173 moveToParentBottomEdge_WidgetFlag),
1174 "feeds.progressbar");
1167 addChildFlags_Widget(rightEmbed, 1175 addChildFlags_Widget(rightEmbed,
1168 iClob(fprog), 1176 iClob(fprog),
1169 collapse_WidgetFlag | hidden_WidgetFlag | frameless_WidgetFlag); 1177 collapse_WidgetFlag | hidden_WidgetFlag | frameless_WidgetFlag);
diff --git a/src/ui/widget.c b/src/ui/widget.c
index bdc5f090..ec92ac5a 100644
--- a/src/ui/widget.c
+++ b/src/ui/widget.c
@@ -289,7 +289,7 @@ void showCollapsed_Widget(iWidget *d, iBool show) {
289 setFlags_Widget(d, hidden_WidgetFlag, !show); 289 setFlags_Widget(d, hidden_WidgetFlag, !show);
290 /* The entire UI may be affected, if parents are resized due to the (un)collapsing. */ 290 /* The entire UI may be affected, if parents are resized due to the (un)collapsing. */
291 arrange_Widget(root_Widget(d)); 291 arrange_Widget(root_Widget(d));
292 postRefresh_App(); 292 refresh_Widget(d);
293 } 293 }
294} 294}
295 295