summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-11-28 07:48:48 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-11-28 07:48:48 +0200
commite05a704154712184d73d85a3033e01337a11b380 (patch)
tree3aff6fcdda0a4a05dfc49e412eccd4dcc84dece9
parent7c18495eb995f5c5997c201a8eef70b134fa5152 (diff)
Fixed page timestamp; 24-hour time preference
IssueID #349
-rw-r--r--po/en.po3
-rw-r--r--res/about/version.gmi2
-rw-r--r--res/lang/cs.binbin30829 -> 30857 bytes
-rw-r--r--res/lang/de.binbin29836 -> 29864 bytes
-rw-r--r--res/lang/en.binbin25933 -> 25961 bytes
-rw-r--r--res/lang/eo.binbin24885 -> 24913 bytes
-rw-r--r--res/lang/es.binbin29663 -> 29691 bytes
-rw-r--r--res/lang/es_MX.binbin26992 -> 27020 bytes
-rw-r--r--res/lang/fi.binbin29489 -> 29517 bytes
-rw-r--r--res/lang/fr.binbin29873 -> 29901 bytes
-rw-r--r--res/lang/gl.binbin28845 -> 28873 bytes
-rw-r--r--res/lang/hu.binbin30665 -> 30693 bytes
-rw-r--r--res/lang/ia.binbin27992 -> 28020 bytes
-rw-r--r--res/lang/ie.binbin28580 -> 28608 bytes
-rw-r--r--res/lang/isv.binbin24653 -> 24681 bytes
-rw-r--r--res/lang/pl.binbin29268 -> 29296 bytes
-rw-r--r--res/lang/ru.binbin44028 -> 44056 bytes
-rw-r--r--res/lang/sk.binbin24989 -> 25017 bytes
-rw-r--r--res/lang/sr.binbin43416 -> 43444 bytes
-rw-r--r--res/lang/tok.binbin26702 -> 26730 bytes
-rw-r--r--res/lang/tr.binbin28905 -> 28933 bytes
-rw-r--r--res/lang/uk.binbin43373 -> 43401 bytes
-rw-r--r--res/lang/zh_Hans.binbin24887 -> 24915 bytes
-rw-r--r--res/lang/zh_Hant.binbin25085 -> 25113 bytes
-rw-r--r--src/app.c6
-rw-r--r--src/lang.c16
-rw-r--r--src/lang.h2
-rw-r--r--src/prefs.c1
-rw-r--r--src/prefs.h1
-rw-r--r--src/ui/documentwidget.c6
-rw-r--r--src/ui/util.c1
31 files changed, 36 insertions, 2 deletions
diff --git a/po/en.po b/po/en.po
index b8dc8964..b95d3c5a 100644
--- a/po/en.po
+++ b/po/en.po
@@ -1379,6 +1379,9 @@ msgstr "Orange"
1379msgid "prefs.uilang" 1379msgid "prefs.uilang"
1380msgstr "Language:" 1380msgstr "Language:"
1381 1381
1382msgid "prefs.time.24h"
1383msgstr "24-Hour Time"
1384
1382msgid "prefs.uiscale" 1385msgid "prefs.uiscale"
1383msgstr "UI scale factor:" 1386msgstr "UI scale factor:"
1384 1387
diff --git a/res/about/version.gmi b/res/about/version.gmi
index 61ea4476..c510d07a 100644
--- a/res/about/version.gmi
+++ b/res/about/version.gmi
@@ -7,6 +7,8 @@
7# Release notes 7# Release notes
8 8
9## 1.9.1 9## 1.9.1
10* Added "24-Hour Time" preference.
11* Fixed drawing the page timestamp (bottom left corner) that was always hidden.
10* Heading level 3 is indented like regular text lines, making the difference to level 2 evident. 12* Heading level 3 is indented like regular text lines, making the difference to level 2 evident.
11 13
12## 1.9 14## 1.9
diff --git a/res/lang/cs.bin b/res/lang/cs.bin
index ebeb9323..beb44264 100644
--- a/res/lang/cs.bin
+++ b/res/lang/cs.bin
Binary files differ
diff --git a/res/lang/de.bin b/res/lang/de.bin
index 5ed89b6e..2bd48e02 100644
--- a/res/lang/de.bin
+++ b/res/lang/de.bin
Binary files differ
diff --git a/res/lang/en.bin b/res/lang/en.bin
index b9535bb1..2e95dd20 100644
--- a/res/lang/en.bin
+++ b/res/lang/en.bin
Binary files differ
diff --git a/res/lang/eo.bin b/res/lang/eo.bin
index 134ef668..f9dc80e6 100644
--- a/res/lang/eo.bin
+++ b/res/lang/eo.bin
Binary files differ
diff --git a/res/lang/es.bin b/res/lang/es.bin
index ef450137..29d94600 100644
--- a/res/lang/es.bin
+++ b/res/lang/es.bin
Binary files differ
diff --git a/res/lang/es_MX.bin b/res/lang/es_MX.bin
index aac305ba..2d6ea258 100644
--- a/res/lang/es_MX.bin
+++ b/res/lang/es_MX.bin
Binary files differ
diff --git a/res/lang/fi.bin b/res/lang/fi.bin
index bf5772dc..631a6497 100644
--- a/res/lang/fi.bin
+++ b/res/lang/fi.bin
Binary files differ
diff --git a/res/lang/fr.bin b/res/lang/fr.bin
index bc332333..8d292ef8 100644
--- a/res/lang/fr.bin
+++ b/res/lang/fr.bin
Binary files differ
diff --git a/res/lang/gl.bin b/res/lang/gl.bin
index 029e3533..ec7e0502 100644
--- a/res/lang/gl.bin
+++ b/res/lang/gl.bin
Binary files differ
diff --git a/res/lang/hu.bin b/res/lang/hu.bin
index d00d1b44..d4dc0811 100644
--- a/res/lang/hu.bin
+++ b/res/lang/hu.bin
Binary files differ
diff --git a/res/lang/ia.bin b/res/lang/ia.bin
index 0c80ba38..43b8e871 100644
--- a/res/lang/ia.bin
+++ b/res/lang/ia.bin
Binary files differ
diff --git a/res/lang/ie.bin b/res/lang/ie.bin
index d0b05aaa..79f370d2 100644
--- a/res/lang/ie.bin
+++ b/res/lang/ie.bin
Binary files differ
diff --git a/res/lang/isv.bin b/res/lang/isv.bin
index 65581678..2af9a9d7 100644
--- a/res/lang/isv.bin
+++ b/res/lang/isv.bin
Binary files differ
diff --git a/res/lang/pl.bin b/res/lang/pl.bin
index 6f67a909..9e1590a6 100644
--- a/res/lang/pl.bin
+++ b/res/lang/pl.bin
Binary files differ
diff --git a/res/lang/ru.bin b/res/lang/ru.bin
index 88f89856..1fbd1097 100644
--- a/res/lang/ru.bin
+++ b/res/lang/ru.bin
Binary files differ
diff --git a/res/lang/sk.bin b/res/lang/sk.bin
index de3772c9..b4603c7d 100644
--- a/res/lang/sk.bin
+++ b/res/lang/sk.bin
Binary files differ
diff --git a/res/lang/sr.bin b/res/lang/sr.bin
index 743909a6..2e8d131c 100644
--- a/res/lang/sr.bin
+++ b/res/lang/sr.bin
Binary files differ
diff --git a/res/lang/tok.bin b/res/lang/tok.bin
index 89314f0f..582b24de 100644
--- a/res/lang/tok.bin
+++ b/res/lang/tok.bin
Binary files differ
diff --git a/res/lang/tr.bin b/res/lang/tr.bin
index 7463b776..d7788667 100644
--- a/res/lang/tr.bin
+++ b/res/lang/tr.bin
Binary files differ
diff --git a/res/lang/uk.bin b/res/lang/uk.bin
index 80ed9cb4..62d480a7 100644
--- a/res/lang/uk.bin
+++ b/res/lang/uk.bin
Binary files differ
diff --git a/res/lang/zh_Hans.bin b/res/lang/zh_Hans.bin
index 1a8dc868..0b9b3360 100644
--- a/res/lang/zh_Hans.bin
+++ b/res/lang/zh_Hans.bin
Binary files differ
diff --git a/res/lang/zh_Hant.bin b/res/lang/zh_Hant.bin
index 344bd848..b6e7b5d0 100644
--- a/res/lang/zh_Hant.bin
+++ b/res/lang/zh_Hant.bin
Binary files differ
diff --git a/src/app.c b/src/app.c
index 75e37a0b..a2de03ca 100644
--- a/src/app.c
+++ b/src/app.c
@@ -240,6 +240,7 @@ static iString *serializePrefs_App_(const iApp *d) {
240 const char * id; 240 const char * id;
241 const iBool *value; 241 const iBool *value;
242 } boolPrefs[] = { 242 } boolPrefs[] = {
243 { "prefs.time.24h", &d->prefs.time24h },
243 { "prefs.animate", &d->prefs.uiAnimations }, 244 { "prefs.animate", &d->prefs.uiAnimations },
244 { "prefs.font.smooth", &d->prefs.fontSmoothing }, 245 { "prefs.font.smooth", &d->prefs.fontSmoothing },
245 { "prefs.mono.gemini", &d->prefs.monospaceGemini }, 246 { "prefs.mono.gemini", &d->prefs.monospaceGemini },
@@ -2573,6 +2574,10 @@ iBool handleCommand_App(const char *cmd) {
2573 d->prefs.uiAnimations = arg_Command(cmd) != 0; 2574 d->prefs.uiAnimations = arg_Command(cmd) != 0;
2574 return iTrue; 2575 return iTrue;
2575 } 2576 }
2577 else if (equal_Command(cmd, "prefs.time.24h.changed")) {
2578 d->prefs.time24h = arg_Command(cmd) != 0;
2579 return iTrue;
2580 }
2576 else if (equal_Command(cmd, "saturation.set")) { 2581 else if (equal_Command(cmd, "saturation.set")) {
2577 d->prefs.saturation = (float) arg_Command(cmd) / 100.0f; 2582 d->prefs.saturation = (float) arg_Command(cmd) / 100.0f;
2578 if (!isFrozen) { 2583 if (!isFrozen) {
@@ -2892,6 +2897,7 @@ iBool handleCommand_App(const char *cmd) {
2892 updateScrollSpeedButtons_(dlg, mouse_ScrollType, d->prefs.smoothScrollSpeed[mouse_ScrollType]); 2897 updateScrollSpeedButtons_(dlg, mouse_ScrollType, d->prefs.smoothScrollSpeed[mouse_ScrollType]);
2893 updateScrollSpeedButtons_(dlg, keyboard_ScrollType, d->prefs.smoothScrollSpeed[keyboard_ScrollType]); 2898 updateScrollSpeedButtons_(dlg, keyboard_ScrollType, d->prefs.smoothScrollSpeed[keyboard_ScrollType]);
2894 updateDropdownSelection_LabelWidget(findChild_Widget(dlg, "prefs.uilang"), cstr_String(&d->prefs.strings[uiLanguage_PrefsString])); 2899 updateDropdownSelection_LabelWidget(findChild_Widget(dlg, "prefs.uilang"), cstr_String(&d->prefs.strings[uiLanguage_PrefsString]));
2900 setToggle_Widget(findChild_Widget(dlg, "prefs.time.24h"), d->prefs.time24h);
2895 updateDropdownSelection_LabelWidget( 2901 updateDropdownSelection_LabelWidget(
2896 findChild_Widget(dlg, "prefs.returnkey"), 2902 findChild_Widget(dlg, "prefs.returnkey"),
2897 format_CStr("returnkey.set arg:%d", d->prefs.returnKey)); 2903 format_CStr("returnkey.set arg:%d", d->prefs.returnKey));
diff --git a/src/lang.c b/src/lang.c
index 905601ca..831fa58f 100644
--- a/src/lang.c
+++ b/src/lang.c
@@ -22,6 +22,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
22 22
23#include "lang.h" 23#include "lang.h"
24#include "resources.h" 24#include "resources.h"
25#include "prefs.h"
26#include "app.h"
25 27
26#include <the_Foundation/sortedarray.h> 28#include <the_Foundation/sortedarray.h>
27#include <the_Foundation/string.h> 29#include <the_Foundation/string.h>
@@ -261,3 +263,17 @@ const char *format_Lang(const char *formatTextWithIds, ...) {
261 va_end(args); 263 va_end(args);
262 return cstr_Block(collect_Block(msg)); 264 return cstr_Block(collect_Block(msg));
263} 265}
266
267iString *timeFormatHourPreference_Lang(const char *formatMsgId) {
268 iString *str = newCStr_String(cstr_Lang(formatMsgId));
269 translate_Lang(str);
270 if (prefs_App()->time24h) {
271 replace_String(str, "%I", "%H");
272 replace_String(str, " %p", "");
273 replace_String(str, "%p", "");
274 }
275 else {
276 replace_String(str, "%H:%M", "%I:%M %p");
277 }
278 return str;
279}
diff --git a/src/lang.h b/src/lang.h
index e3e6c433..8ed5eca9 100644
--- a/src/lang.h
+++ b/src/lang.h
@@ -40,3 +40,5 @@ const char * cstrCount_Lang (const char *msgId, int count);
40const char * formatCStr_Lang (const char *formatMsgId, int count); 40const char * formatCStr_Lang (const char *formatMsgId, int count);
41const char * formatCStrs_Lang (const char *formatMsgId, size_t count); 41const char * formatCStrs_Lang (const char *formatMsgId, size_t count);
42const char * format_Lang (const char *formatTextWithIds, ...); 42const char * format_Lang (const char *formatTextWithIds, ...);
43
44iString * timeFormatHourPreference_Lang (const char *formatMsgId);
diff --git a/src/prefs.c b/src/prefs.c
index 956a75ae..10df9ade 100644
--- a/src/prefs.c
+++ b/src/prefs.c
@@ -43,6 +43,7 @@ void init_Prefs(iPrefs *d) {
43 d->sideIcon = iTrue; 43 d->sideIcon = iTrue;
44 d->hideToolbarOnScroll = iTrue; 44 d->hideToolbarOnScroll = iTrue;
45 d->pinSplit = 1; 45 d->pinSplit = 1;
46 d->time24h = iTrue;
46 d->returnKey = default_ReturnKeyBehavior; 47 d->returnKey = default_ReturnKeyBehavior;
47 d->hoverLink = iFalse; 48 d->hoverLink = iFalse;
48 d->smoothScrolling = iTrue; 49 d->smoothScrolling = iTrue;
diff --git a/src/prefs.h b/src/prefs.h
index d7712c9d..2fbff9de 100644
--- a/src/prefs.h
+++ b/src/prefs.h
@@ -73,6 +73,7 @@ struct Impl_Prefs {
73 iBool sideIcon; 73 iBool sideIcon;
74 iBool hideToolbarOnScroll; 74 iBool hideToolbarOnScroll;
75 int pinSplit; /* 0: no pinning, 1: left doc, 2: right doc */ 75 int pinSplit; /* 0: no pinning, 1: left doc, 2: right doc */
76 iBool time24h;
76 /* Behavior */ 77 /* Behavior */
77 int returnKey; 78 int returnKey;
78 iBool hoverLink; 79 iBool hoverLink;
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index c41c77d6..aac77572 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -1038,10 +1038,12 @@ static void updateTimestampBuf_DocumentWidget_(const iDocumentWidget *d) {
1038 d->drawBufs->timestampBuf = NULL; 1038 d->drawBufs->timestampBuf = NULL;
1039 } 1039 }
1040 if (isValid_Time(&d->sourceTime)) { 1040 if (isValid_Time(&d->sourceTime)) {
1041 iString *fmt = timeFormatHourPreference_Lang("page.timestamp");
1041 d->drawBufs->timestampBuf = newRange_TextBuf( 1042 d->drawBufs->timestampBuf = newRange_TextBuf(
1042 uiLabel_FontId, 1043 uiLabel_FontId,
1043 white_ColorId, 1044 white_ColorId,
1044 range_String(collect_String(format_Time(&d->sourceTime, cstr_Lang("page.timestamp"))))); 1045 range_String(collect_String(format_Time(&d->sourceTime, cstr_String(fmt)))));
1046 delete_String(fmt);
1045 } 1047 }
1046 d->drawBufs->flags &= ~updateTimestampBuf_DrawBufsFlag; 1048 d->drawBufs->flags &= ~updateTimestampBuf_DrawBufsFlag;
1047} 1049}
@@ -4792,7 +4794,7 @@ static void drawSideElements_DocumentWidget_(const iDocumentWidget *d) {
4792 bottomLeft_Rect(bounds), 4794 bottomLeft_Rect(bounds),
4793 init_I2(margin, 4795 init_I2(margin,
4794 -margin + -dbuf->timestampBuf->size.y + 4796 -margin + -dbuf->timestampBuf->size.y +
4795 iMax(0, d->scrollY.max + viewPos_DocumentWidget_(d)))), 4797 iMax(0, d->scrollY.max - pos_SmoothScroll(&d->scrollY)))),
4796 tmQuoteIcon_ColorId); 4798 tmQuoteIcon_ColorId);
4797 } 4799 }
4798 unsetClip_Paint(&p); 4800 unsetClip_Paint(&p);
diff --git a/src/ui/util.c b/src/ui/util.c
index 57fa9f3d..baa05082 100644
--- a/src/ui/util.c
+++ b/src/ui/util.c
@@ -2507,6 +2507,7 @@ iWidget *makePreferences_Widget(void) {
2507 alignLeft_WidgetFlag), 2507 alignLeft_WidgetFlag),
2508 "prefs.uilang"); 2508 "prefs.uilang");
2509 } 2509 }
2510 addDialogToggle_(headings, values, "${prefs.time.24h}", "prefs.time.24h");
2510 } 2511 }
2511 /* User Interface. */ { 2512 /* User Interface. */ {
2512 appendTwoColumnTabPage_Widget(tabs, "${heading.prefs.interface}", '2', &headings, &values); 2513 appendTwoColumnTabPage_Widget(tabs, "${heading.prefs.interface}", '2', &headings, &values);