src/hbinput/inputwidgets/hbinputscreenshotwidget.cpp
changeset 2 06ff229162e9
parent 0 16d8024aca5e
child 5 627c4a0fd0e7
equal deleted inserted replaced
1:f7ac710697a9 2:06ff229162e9
    23 **
    23 **
    24 ****************************************************************************/
    24 ****************************************************************************/
    25 #include <QPixmap>
    25 #include <QPixmap>
    26 #include <QPainter>
    26 #include <QPainter>
    27 
    27 
    28 #include <hbframedrawer.h>
       
    29 #include <hbeffect.h>
    28 #include <hbeffect.h>
    30 #include <hbwidget_p.h>
    29 #include <hbwidget_p.h>
       
    30 #include "hbframedrawerpool_p.h"
    31 
    31 
    32 #include "hbinputscreenshotwidget.h"
    32 #include "hbinputscreenshotwidget.h"
    33 #include "hbinputvkbwidget.h"
    33 #include "hbinputvkbwidget.h"
    34 
    34 
    35 
    35 
    56     HbInputScreenshotWidgetPrivate();
    56     HbInputScreenshotWidgetPrivate();
    57     virtual ~HbInputScreenshotWidgetPrivate();
    57     virtual ~HbInputScreenshotWidgetPrivate();
    58 
    58 
    59     QPixmap mPixmap;
    59     QPixmap mPixmap;
    60     HbFrameDrawer *mIconDrawer;
    60     HbFrameDrawer *mIconDrawer;
       
    61     qreal mCloseHandleHeight;
       
    62     qreal mCloseHandleWidth;
    61 
    63 
    62 };
    64 };
    63 
    65 
    64 HbInputScreenshotWidgetPrivate::HbInputScreenshotWidgetPrivate()
    66 HbInputScreenshotWidgetPrivate::HbInputScreenshotWidgetPrivate()
       
    67  : mIconDrawer(0), mCloseHandleHeight(0), mCloseHandleWidth(0)
    65 {
    68 {
    66     mIconDrawer = new HbFrameDrawer();
       
    67 }
    69 }
    68 
    70 
    69 HbInputScreenshotWidgetPrivate::~HbInputScreenshotWidgetPrivate()
    71 HbInputScreenshotWidgetPrivate::~HbInputScreenshotWidgetPrivate()
    70 {
    72 {
    71     delete mIconDrawer;
    73     HbFrameDrawerPool::release(mIconDrawer);
    72 }
    74 }
    73 
    75 
    74 
    76 
    75 /// @endcond
    77 /// @endcond
    76 
    78 
   105 
   107 
   106 void HbInputScreenshotWidget::setScreenshot(QPixmap &pixmap)
   108 void HbInputScreenshotWidget::setScreenshot(QPixmap &pixmap)
   107 {
   109 {
   108     Q_D(HbInputScreenshotWidget);
   110     Q_D(HbInputScreenshotWidget);
   109     d->mPixmap = pixmap;
   111     d->mPixmap = pixmap;
       
   112 
       
   113     if (!d->mPixmap.isNull()) {
       
   114         HbFrameDrawerPool::release(d->mIconDrawer);
       
   115 
       
   116         qreal unitValue = HbDeviceProfile::profile(mainWindow()).unitValue();
       
   117         d->mCloseHandleHeight = HbCloseHandleHeightInUnits * unitValue;
       
   118         d->mCloseHandleWidth = HbCloseHandleWidthInUnits * unitValue;
       
   119         QSizeF handleSize = QSizeF(d->mCloseHandleWidth, d->mCloseHandleHeight);
       
   120         d->mIconDrawer = HbFrameDrawerPool::get(HbInputVkbHandleIcon, HbFrameDrawer::OnePiece, handleSize);
       
   121     }
   110 }
   122 }
   111 
   123 
   112 /*!
   124 /*!
   113 handles mouse press event.
   125 handles mouse press event.
   114 */
   126 */
   133     Q_UNUSED(option);
   145     Q_UNUSED(option);
   134     Q_UNUSED(widget);
   146     Q_UNUSED(widget);
   135 
   147 
   136     Q_D(HbInputScreenshotWidget);
   148     Q_D(HbInputScreenshotWidget);
   137     if (!d->mPixmap.isNull()){
   149     if (!d->mPixmap.isNull()){
   138         d->mIconDrawer->setFrameType(HbFrameDrawer::OnePiece);
       
   139         QRectF rect = boundingRect();
   150         QRectF rect = boundingRect();
   140         rect.setLeft(rect.width()/2 - HbCloseHandleHeight*3);
   151 
   141         rect.setWidth(HbCloseHandleHeight*6);
   152         painter->save();
   142         rect.setHeight(HbCloseHandleHeight);
   153         painter->translate(rect.width() / 2 - d->mCloseHandleWidth / 2, 0);
   143 		d->mIconDrawer->setFrameGraphicsName(HbInputVkbHandleIcon);
   154         rect.setWidth(d->mCloseHandleWidth);
       
   155         rect.setHeight(d->mCloseHandleHeight);
   144         d->mIconDrawer->paint(painter, rect);
   156         d->mIconDrawer->paint(painter, rect);
   145     	painter->drawPixmap(0, (int)HbCloseHandleHeight, d->mPixmap);
   157         painter->restore();
       
   158 
       
   159         painter->save();
       
   160         painter->translate(0, d->mCloseHandleHeight);
       
   161     	painter->drawPixmap(0, 0, d->mPixmap);
       
   162         painter->restore();
   146     }
   163     }
   147 }
   164 }
   148 
   165 
   149 
   166 
   150 /*!
   167 /*!