Changeset 14509


Ignore:
Timestamp:
Apr 22, 2015, 9:04:49 PM (6 years ago)
Author:
mikedld
Message:

Even better (and unified) torrent origin logic for GTK+, Qt and web clients

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/details.c

    r14241 r14509  
    691691        }
    692692
    693       if (mixed_date && mixed_creator)
     693      const gboolean empty_creator = !*creator;
     694      const gboolean empty_date = date == 0;
     695
     696      if (mixed_date || mixed_creator)
    694697        {
    695698          str = mixed;
    696699        }
     700      else if (empty_date && empty_creator)
     701        {
     702          str = _("N/A");
     703        }
    697704      else
    698705        {
    699           if (mixed_date)
     706          if (empty_date && !empty_creator)
    700707            g_snprintf (buf, sizeof (buf), _("Created by %1$s"), creator);
    701           else if (mixed_creator || !*creator)
     708          else if (empty_creator && !empty_date)
    702709            g_snprintf (buf, sizeof (buf), _("Created on %1$s"), datestr);
    703710          else
  • trunk/qt/details.cc

    r14499 r14509  
    749749        }
    750750
    751       if (mixed_creator && mixed_date)
     751      const bool empty_creator = creator.isEmpty ();
     752      const bool empty_date = date.isEmpty ();
     753
     754      if (mixed_creator || mixed_date)
    752755        string = mixed;
    753       else if (mixed_date && !creator.isEmpty ())
     756      else if (empty_creator && empty_date)
     757        string = tr ("N/A");
     758      else if (empty_date && !empty_creator)
    754759        string = tr ("Created by %1").arg (creator);
    755       else if (mixed_creator && !date.isEmpty ())
     760      else if (empty_creator && !empty_date)
    756761        string = tr ("Created on %1").arg (date);
    757       else if (creator.isEmpty () && date.isEmpty ())
    758         string = tr ("N/A");
    759762      else
    760763        string = tr ("Created by %1 on %2").arg (creator).arg (date);
  • trunk/web/javascript/inspector.js

    r14508 r14509  
    425425            var empty_creator = !creator || !creator.length,
    426426                empty_date = !date;
    427             if(mixed_creator && mixed_date)
     427            if(mixed_creator || mixed_date)
    428428                str = mixed;
    429429            else if(empty_creator && empty_date)
    430430                str = unknown;
    431             else if((mixed_date || empty_date) && !empty_creator)
     431            else if(empty_date && !empty_creator)
    432432                str = 'Created by ' + creator;
    433             else if((mixed_creator || empty_creator) && !empty_date)
     433            else if(empty_creator && !empty_date)
    434434                str = 'Created on ' + (new Date(date*1000)).toDateString();
    435435            else
Note: See TracChangeset for help on using the changeset viewer.