videocollection/videocollectionwrapper/tsrc/testvideomodel/stub/src/videocollectionutils.cpp
changeset 36 8aed59de29f9
parent 34 bbb98528c666
child 20 b9e04db066d4
equal deleted inserted replaced
35:3738fe97f027 36:8aed59de29f9
    18 // INCLUDE FILES
    18 // INCLUDE FILES
    19 
    19 
    20 
    20 
    21 #include <qobject.h>
    21 #include <qobject.h>
    22 #include "videocollectionutils.h"
    22 #include "videocollectionutils.h"
       
    23 #include <QTime>
       
    24 #include <hbextendedlocale.h>
    23 
    25 
    24 QString VideoCollectionUtils::mPrepareLengthStringReturnValue = "test duration";
    26 QString VideoCollectionUtils::mPrepareLengthStringReturnValue = "test duration";
    25 QString VideoCollectionUtils::mPrepareSizeStringReturnValue = "test size";
    27 QString VideoCollectionUtils::mPrepareSizeStringReturnValue = "test size";
    26 
    28 
    27 // -----------------------------------------------------------------------------
    29 // -----------------------------------------------------------------------------
   108     
   110     
   109     return lengthStr;
   111     return lengthStr;
   110 }
   112 }
   111 
   113 
   112 // -----------------------------------------------------------------------------
   114 // -----------------------------------------------------------------------------
   113 // VideoCollectionUtils::prepareLengthStrings()
   115 // VideoCollectionUtils::prepareShortLengthString()
   114 // -----------------------------------------------------------------------------
   116 // -----------------------------------------------------------------------------
   115 //
   117 //
   116 const QStringList VideoCollectionUtils::prepareLengthStrings(quint32 total)
   118 const QString VideoCollectionUtils::prepareShortLengthString(quint32 total)
   117 {
   119 {
   118     const int secondsInMinute( 60 );
   120 	const int secondsInMinute( 60 );
       
   121     const int secondsInHour( 3600 );
   119 
   122 
   120     quint32 minutes(0);
   123     int hour = total / secondsInHour;
   121     quint32 seconds(0);
   124     total = total % secondsInHour;
   122     
   125     int minutes = total / secondsInMinute;
   123     if ( total > 0 )
   126     total = total % secondsInMinute;
   124     {
   127     int second = total;
   125         minutes = (total / secondsInMinute);
   128 
   126         seconds = (total % secondsInMinute);
   129     QTime time( hour ,minutes ,second );
   127     }
   130     QString str;
   128     
   131 
   129     QString mins("");
   132     HbExtendedLocale locale = HbExtendedLocale::system();
   130     QString secs("");
   133 
   131     
   134     str = locale.format( time, r_qtn_time_durat_long_with_zero );
   132     if (minutes < 10)
   135 
   133     {
   136     return str;
   134         mins = "0" + QString::number(minutes); 
       
   135         
       
   136     }
       
   137     else
       
   138     {
       
   139         mins = QString::number(minutes);
       
   140     }
       
   141       
       
   142     QString secondsStr("");
       
   143     
       
   144     if (seconds < 10)
       
   145     {
       
   146         secs = "0" + QString::number(seconds); 
       
   147         
       
   148     }
       
   149     else
       
   150     {
       
   151         secs = QString::number(seconds);
       
   152     }
       
   153     
       
   154     QStringList retVal;
       
   155     
       
   156     retVal.append(mins);
       
   157     retVal.append(secs);
       
   158     
       
   159     return retVal;
       
   160 }
   137 }
   161 
   138 
   162 
   139 
   163 // -----------------------------------------------------------------------------
   140 // -----------------------------------------------------------------------------
   164 // prepareSizeString
   141 // prepareSizeString