@@ -230,6 +230,7 @@ class WelcomePanel : public Component
230230
231231 String creationTimeDescription = String();
232232 String modifiedTimeDescription = String();
233+ String accessedTimeDescription = String();
233234 String fileSizeDescription = String();
234235
235236 File patchFile;
@@ -246,24 +247,33 @@ class WelcomePanel : public Component
246247
247248 auto is24Hour = OSUtils::is24HourTimeFormat ();
248249
249- auto formatTimeDescription = [is24Hour](const Time& openTime) {
250- auto diff = Time::getCurrentTime () - openTime ;
250+ auto formatTimeDescription = [is24Hour](const Time& openTime, bool showDayAndDate = false ) {
251+ auto const now = Time::getCurrentTime ();
251252
252- String date;
253- auto days = diff.inDays ();
254- if (days < 1 )
255- date = " Today" ;
256- else if (days > 1 && days < 2 )
257- date = " Yesterday" ;
258- else
259- date = openTime.toString (true , false );
253+ // Extract just the date part (YYYY-MM-DD) for comparison
254+ auto const openDate = openTime.toISO8601 (true ).substring (0 , 10 );
255+ auto const currentDate = now.toISO8601 (true ).substring (0 , 10 );
256+ auto const yesterday = (now - RelativeTime::days (1 )).toISO8601 (true ).substring (0 , 10 );
257+
258+ String dateOrDay;
259+ if (openDate == currentDate) {
260+ dateOrDay = " Today" ;
261+ } else if (openDate == yesterday) {
262+ dateOrDay = " Yesterday" ;
263+ }
260264
261265 String time = openTime.toString (false , true , false , is24Hour);
262266
263- return date + " , " + time;
267+ if (showDayAndDate)
268+ return (dateOrDay.isNotEmpty () ? dateOrDay + " , " : " " ) + openTime.toString (true , false ) + " , " + time;
269+
270+ return (dateOrDay.isNotEmpty () ? dateOrDay : openTime.toString (true , false )) + " , " + time;
271+
264272 };
265273
266- tileSubtitle = formatTimeDescription (Time (static_cast <int64>(subTree.getProperty (" Time" ))));
274+ auto const accessedInPlugdasta = Time (static_cast <int64>(subTree.getProperty (" Time" )));
275+
276+ tileSubtitle = formatTimeDescription (accessedInPlugdasta);
267277
268278 auto const fileSize = patchFile.getSize ();
269279
@@ -275,8 +285,13 @@ class WelcomePanel : public Component
275285 fileSizeDescription = String (fileSize / (1024.0 * 1024.0 ), 2 ) + " MiB" ; // 1 MiB or more
276286 }
277287
278- creationTimeDescription = formatTimeDescription (patchFile.getCreationTime ());
279- modifiedTimeDescription = formatTimeDescription (patchFile.getLastModificationTime ());
288+ creationTimeDescription = formatTimeDescription (patchFile.getCreationTime (), true );
289+ modifiedTimeDescription = formatTimeDescription (patchFile.getLastModificationTime (), true );
290+ // Accessed time will show the last time the file was read, which is when the Home panel has been refreshed.
291+ // We need to show the time accessed from plugdata, which is saved in the settings XML
292+ // We want to show this again as well as in the subtile, but format it differently (with both Today/Yesterday and date)
293+ // because the popup menu may occlude the tile + subtitle
294+ accessedTimeDescription = formatTimeDescription (accessedInPlugdasta, true );
280295
281296 updateGeneratedThumbnailIfNeeded (thumbImage, svgImage, iconColour);
282297 }
@@ -331,7 +346,7 @@ class WelcomePanel : public Component
331346 patchInfoSubMenu.addSeparator ();
332347 patchInfoSubMenu.addItem (String (" Created: " + creationTimeDescription), false , false , nullptr );
333348 patchInfoSubMenu.addItem (String (" Modified: " + modifiedTimeDescription), false , false , nullptr );
334- patchInfoSubMenu.addItem (String (" Accessed: " + tileSubtitle ), false , false , nullptr );
349+ patchInfoSubMenu.addItem (String (" Accessed: " + accessedTimeDescription ), false , false , nullptr );
335350 tileMenu.addSubMenu (String (tileName + " .pd file info" ), patchInfoSubMenu, true );
336351 tileMenu.addSeparator ();
337352 // TODO: we may want to be clearer about this - that it doesn't delete the file on disk
0 commit comments