Ticket #758: statusbox-avg2.patch
File statusbox-avg2.patch, 2.0 KB (added by , 18 years ago) |
---|
-
programs/mythfrontend/statusbox.cpp
80 80 my_parent = parent; 81 81 clicked(); 82 82 83 83 84 recordingProfilesBPS["HDTV"] = 19400000; 84 recordingProfilesBPS["average"] = 5500000; 85 86 MSqlQuery query(MSqlQuery::InitCon()); 87 QString querystr = QString("SELECT SUM(filesize), SUM(UNIX_TIMESTAMP(endtime) - UNIX_TIMESTAMP(starttime)) FROM recorded"); 88 query.prepare(querystr); 89 query.exec(); 90 int bitrate = 5500000; 91 if (query.isActive() && query.size()) 92 { 93 query.next(); 94 double szsum = query.value(0).toDouble(); 95 double tmsum = query.value(1).toDouble(); 96 if (tmsum > 1.0) 97 bitrate = (int)((szsum * 8) / tmsum); 98 } 99 recordingProfilesBPS["1 average"] = bitrate; 85 100 } 86 101 87 102 StatusBox::~StatusBox(void) … … 967 982 recprof2bps_t::const_iterator it = prof2bps.begin(); 968 983 for (; it != prof2bps.end(); ++it) 969 984 { 970 const QString pro = (it.key()==" average") ? avg : tail.arg(it.key());985 const QString pro = (it.key()=="1 average") ? avg : tail.arg(it.key()); 971 986 long long bytesPerMin = (it.data() >> 1) * 15; 972 987 uint minLeft = ((free<<5)/bytesPerMin)<<5; 973 988 minLeft = (minLeft/15)*15; 974 989 uint hoursLeft = minLeft/60; 975 990 if (hoursLeft > 3) 976 out<<QObject::tr("%1 hours left 991 out<<QObject::tr("%1 hours left%2").arg(hoursLeft).arg(pro); 977 992 else if (minLeft > 90) 978 out<<QObject::tr("%1 hours and %2 minutes left 993 out<<QObject::tr("%1 hours and %2 minutes left%3") 979 994 .arg(hoursLeft).arg(minLeft%60).arg(pro); 980 995 else 981 out<<QObject::tr("%1 minutes left 996 out<<QObject::tr("%1 minutes left%2").arg(minLeft).arg(pro); 982 997 } 983 998 } 984 999