camerauis/cameraxui/cxui/src/cxuivideoprecaptureview.cpp
changeset 60 a289dde0a1d6
parent 56 01e205c615b9
child 63 415ff50d2eca
equal deleted inserted replaced
56:01e205c615b9 60:a289dde0a1d6
    31 #include <hbdialog.h>
    31 #include <hbdialog.h>
    32 #include <hbnotificationdialog.h>
    32 #include <hbnotificationdialog.h>
    33 #include <hbfeedbacksettings.h>
    33 #include <hbfeedbacksettings.h>
    34 #include <hbfeedbacknamespace.h>
    34 #include <hbfeedbacknamespace.h>
    35 #include <hbactivitymanager.h>
    35 #include <hbactivitymanager.h>
       
    36 #include <hbextendedlocale.h>
    36 
    37 
    37 #include "cxuivideoprecaptureview.h"
    38 #include "cxuivideoprecaptureview.h"
    38 #include "cxeengine.h"
    39 #include "cxeengine.h"
    39 #include "cxeviewfindercontrol.h"
    40 #include "cxeviewfindercontrol.h"
    40 #include "cxevideocapturecontrol.h"
    41 #include "cxevideocapturecontrol.h"
    66 {
    67 {
    67     static const int CXUI_ELAPSED_TIME_TIMEOUT = 1000; // 1 second
    68     static const int CXUI_ELAPSED_TIME_TIMEOUT = 1000; // 1 second
    68     static const int CXUI_RECORD_ANIMATION_DURATION = 3000; // milliseconds
    69     static const int CXUI_RECORD_ANIMATION_DURATION = 3000; // milliseconds
    69     static const int CXUI_PAUSE_TIMEOUT = 60*1000;   // 60 seconds
    70     static const int CXUI_PAUSE_TIMEOUT = 60*1000;   // 60 seconds
    70 
    71 
    71     //!@todo Localization?
       
    72     static const char* VIDEO_TIME_FORMAT = "%02d:%02d";
       
    73     const int POSTCAPTURE_ON = -1;
    72     const int POSTCAPTURE_ON = -1;
    74 }
    73 }
    75 
    74 
    76 
    75 
    77 CxuiVideoPrecaptureView::CxuiVideoPrecaptureView(QGraphicsItem *parent) :
    76 CxuiVideoPrecaptureView::CxuiVideoPrecaptureView(QGraphicsItem *parent) :
   713 */
   712 */
   714 void CxuiVideoPrecaptureView::setVideoTime(HbLabel* label,
   713 void CxuiVideoPrecaptureView::setVideoTime(HbLabel* label,
   715                                            int elapsedTime,
   714                                            int elapsedTime,
   716                                            int remainingTime)
   715                                            int remainingTime)
   717 {
   716 {
   718     // Convert time (seconds) into mm:ss
   717     QString elapsed;
   719     // HbExtendedLocale wraps minutes at 60 so we can't use that.
   718     QString remaining;
   720     // We need to show times over 1 hour, e.g. "90:00".
   719     QString number;
   721     QString elapsed, remaining;
   720 
   722     elapsed.sprintf(VIDEO_TIME_FORMAT, elapsedTime/60, elapsedTime%60);
   721     // Convert time (seconds) into mm:ss in localised form
   723     remaining.sprintf(VIDEO_TIME_FORMAT, remainingTime/60, remainingTime%60);
   722     // Since we need to show also times over 1 hour (upto "90:00")
   724 
   723     // we cannot use time to string conversions directly
   725     label->setPlainText(hbTrId("txt_cam_info_redorcding_time").arg(elapsed).arg(remaining));
   724 
       
   725     HbExtendedLocale locale = HbExtendedLocale::system();
       
   726 
       
   727     number = locale.toString(elapsedTime/60);
       
   728     if (number.length() <= 1) {
       
   729         number.prepend(locale.zeroDigit());
       
   730     }
       
   731     elapsed.append(number);
       
   732     elapsed.append(locale.timeSeparator(2));
       
   733     number = locale.toString(elapsedTime%60);
       
   734     if (number.length() <= 1) {
       
   735         number.prepend(locale.zeroDigit());
       
   736     }
       
   737     elapsed.append(number);
       
   738 
       
   739     number = locale.toString(remainingTime/60);
       
   740     if (number.length() <= 1) {
       
   741         number.prepend(locale.zeroDigit());
       
   742     }
       
   743     remaining.append(number);
       
   744     remaining.append(locale.timeSeparator(2));
       
   745     number = locale.toString(remainingTime%60);
       
   746     if (number.length() <= 1) {
       
   747         number.prepend(locale.zeroDigit());
       
   748     }
       
   749     remaining.append(number);
       
   750 
       
   751     label->setPlainText(hbTrId("txt_cam_info_recording_time").arg(elapsed).arg(remaining));
   726 }
   752 }
   727 
   753 
   728 bool CxuiVideoPrecaptureView::getElapsedTime()
   754 bool CxuiVideoPrecaptureView::getElapsedTime()
   729 {
   755 {
   730     CX_DEBUG_ENTER_FUNCTION();
   756     CX_DEBUG_ENTER_FUNCTION();