phoneplugins/hsdialerwidgetplugin/src/hsdialerwidget.cpp
changeset 30 ebdbd102c78a
parent 27 2f8f8080a020
equal deleted inserted replaced
27:2f8f8080a020 30:ebdbd102c78a
    18 
    18 
    19 #include <QPainter>
    19 #include <QPainter>
    20 #include <hbframedrawer.h>
    20 #include <hbframedrawer.h>
    21 #include <hbframeitem.h>
    21 #include <hbframeitem.h>
    22 #include <hbtextitem.h>
    22 #include <hbtextitem.h>
       
    23 #include <QLocale>
    23 #ifdef Q_OS_SYMBIAN
    24 #ifdef Q_OS_SYMBIAN
    24 #include <logsdomaincrkeys.h>
    25 #include <logsdomaincrkeys.h>
    25 #include "qtphonelog.h"
    26 #include "qtphonelog.h"
    26 #include <xqservicerequest.h>
    27 #include <xqservicerequest.h>
    27 #include <xqcallinfo.h>
    28 #include <xqcallinfo.h>
    32 
    33 
    33 #include "hsdialerwidget.h"
    34 #include "hsdialerwidget.h"
    34 
    35 
    35 namespace
    36 namespace
    36 {
    37 {
    37     const char KDialerWidgetIcon[] = "qtg_graf_hs_dialer";
    38     const char KDialerWidgetIcon[] = ":/icons/resource/qtg_graf_hs_dialer";
    38     const char KMissedCallShortcutBadge[] = ":/icons/resource/qtg_fr_shortcut_badge_bg";
    39     const char KMissedCallShortcutBadge[] = ":/icons/resource/qtg_fr_shortcut_badge_bg";
    39 }
    40 }
    40 
    41 
    41 /*!
    42 /*!
    42     \class HsDialerWidget
    43     \class HsDialerWidget
    78     drawer = new HbFrameDrawer(KMissedCallShortcutBadge,
    79     drawer = new HbFrameDrawer(KMissedCallShortcutBadge,
    79             HbFrameDrawer::ThreePiecesHorizontal );
    80             HbFrameDrawer::ThreePiecesHorizontal );
    80 
    81 
    81     m_shortcutBadge = new HbFrameItem(drawer, this);
    82     m_shortcutBadge = new HbFrameItem(drawer, this);
    82     m_shortcutBadge->setZValue(2);
    83     m_shortcutBadge->setZValue(2);
    83     m_shortcutBadge->setVisible(true);
    84     m_shortcutBadge->setVisible(false);
    84     m_missedCalls=2;
    85     m_missedCalls=0;
    85     setItemPositions();
    86     setItemPositions();
    86     resize(preferredSize());
    87     resize(preferredSize());
    87 }
    88 }
    88 
    89 
    89 /*!
    90 /*!
   118         badgefont.setPointSize( 4 );
   119         badgefont.setPointSize( 4 );
   119 #else
   120 #else
   120         badgefont.setPointSize( 8 );
   121         badgefont.setPointSize( 8 );
   121 #endif
   122 #endif
   122         text->setFont(badgefont);
   123         text->setFont(badgefont);
   123         text->setText(QString::number(m_missedCalls));
   124         text->setText(QLocale::system().toString(m_missedCalls));
   124         text->setZValue(3);
   125         text->setZValue(3);
   125         text->setTextColor(Qt::white);
   126         text->setTextColor(Qt::white);
   126        // text->font().setPointSizeF(2);
   127        
   127 
       
   128         text->setX( ( rect.toRect().width() / 2 ) - 2);
   128         text->setX( ( rect.toRect().width() / 2 ) - 2);
   129         text->setY( ( rect.toRect().height() / 5 ) - 1);
   129         text->setY( ( rect.toRect().height() / 5 ) - 1);
   130 
   130 
   131         painter->drawRect( (int)m_shortcutBadge->pos().x(),
   131         painter->drawRect( (int)m_shortcutBadge->pos().x(),
   132                            (int)m_shortcutBadge->pos().y(),
   132                            (int)m_shortcutBadge->pos().y(),
   224 }
   224 }
   225 
   225 
   226 void HsDialerWidget::setItemPositions()
   226 void HsDialerWidget::setItemPositions()
   227 {
   227 {
   228     HbIcon icon(KDialerWidgetIcon);
   228     HbIcon icon(KDialerWidgetIcon);
   229     setPreferredWidth( icon.width());
   229     setPreferredWidth(icon.width());
   230     int badgeSize = 20;
   230     int badgeSize = 20;
   231     if ( m_shortcutBadge->isVisible()){
   231     if ( m_shortcutBadge->isVisible()){
   232         m_backgroud->setGeometry(QRectF(QPointF(0,badgeSize / 2 ), 
   232         m_backgroud->setGeometry(QRectF(QPointF(0,badgeSize / 2 ), 
   233                 QSizeF(icon.width(),icon.height())));
   233                 QSizeF(icon.width(),icon.height())));
   234         m_shortcutBadge->setGeometry(QRectF(
   234         m_shortcutBadge->setGeometry(QRectF(