• Main Page
  • Classes
  • Files
  • File List

/home/bifh8/cs2009q3-i386/work/meegotouch-controlpanelapplets-0.20.61/src/wallpaperapplet/wallpapereditorwidget.h

00001 /****************************************************************************
00002 **
00003 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
00004 ** All rights reserved.
00005 ** Contact: Nokia Corporation (directui@nokia.com)
00006 **
00007 ** This file is part of meegotouch-controlpanelapplets.
00008 **
00009 ** If you have questions regarding the use of this file, please contact
00010 ** Nokia at directui@nokia.com.
00011 **
00012 ** This library is free software; you can redistribute it and/or
00013 ** modify it under the terms of the GNU Lesser General Public
00014 ** License version 2.1 as published by the Free Software Foundation
00015 ** and appearing in the file LICENSE.LGPL included in the packaging
00016 ** of this file.
00017 **
00018 ****************************************************************************/
00019 #ifndef WALLPAPEREDITORWIDGET_H
00020 #define WALLPAPEREDITORWIDGET_H
00021 
00022 #include <QPointer>
00023 #include <MPhysics2DPanning>
00024 #include <meegocontrolexport.h>
00025 #include <dcpwidget.h>
00026 
00027 #include "wallpaperbusinesslogic.h"
00028 #include "wallpaperitrans.h"
00029 
00030 class MContainer;
00031 class MLinearLayoutPolicy;
00032 class QGraphicsSceneMouseEvent;
00033 class QGraphicsSceneWheelEvent;
00034 class MAction;
00035 class QSize;
00036 class QPixmap;
00037 class QImage;
00038 class QPointF;
00039 class QGestureEvent;
00040 class WallpaperInfoHeader;
00041 
00042 // The editing feature is dropped. Further code-cleanup is necessary.
00043 #define NO_EDITING
00044 
00077 class MC_EXPORT WallpaperEditorWidget : public DcpWidget
00078 {
00079     Q_OBJECT
00080 
00081 public:
00082     WallpaperEditorWidget (
00083             WallpaperBusinessLogic *wallpaperBusinessLogic, 
00084             QGraphicsWidget        *parent = 0);
00085     ~WallpaperEditorWidget ();
00086 
00087     virtual bool pagePans () const;
00088     virtual bool back ();
00089     virtual void paint (
00090             QPainter                        *painter,
00091             const QStyleOptionGraphicsItem  *option,
00092             QWidget                         *widget = 0);
00093 
00094     void saveImage ();
00095     void dropImage ();
00096 
00097 protected:
00098     virtual void polishEvent ();
00099     virtual void retranslateUi();
00100 
00101 #ifndef NO_EDITING
00102     virtual void mousePressEvent (QGraphicsSceneMouseEvent *event);
00103     virtual void wheelEvent (QGraphicsSceneWheelEvent *event);
00104 
00105     void panGestureEvent (
00106             QGestureEvent *event, 
00107             QPanGesture   *panGesture);
00108 
00109     virtual void pinchGestureEvent (
00110             QGestureEvent *event, 
00111             QPinchGesture *gesture);
00112 
00113     virtual void pinchGestureStarted (
00114             QGestureEvent *event, 
00115             QPinchGesture *gesture);
00116 
00117     virtual void pinchGestureUpdate (
00118             QGestureEvent *event, 
00119             QPinchGesture *gesture);
00120     
00121     virtual void pinchGestureEnded (
00122             QGestureEvent *event, 
00123             QPinchGesture *gesture);
00124 #endif
00125 
00126 signals:
00127     void doneClicked ();
00128     void cancelClicked ();
00129     
00130 private slots:
00131     void redrawImage ();
00132     void queueRedrawImage ();
00133     void orientationChanged (M::Orientation orientation);
00134     void slotDoneActivated ();
00135     void slotCancelActivated ();
00136     void createContent ();
00137     void createWidgets ();
00138     void panningPhysicsPositionChanged (const QPointF &position);
00139     void panningPhysicsPanningStopped ();
00140     void scalePhysicsPositionChanged(const QPointF &position);
00141 
00142 private:
00143     QPointF toggleTitlebars (bool show);
00144     void setupPanningPhysics ();
00145     
00146     int  imageX () const;
00147     int  imageY () const;
00148     int  imageDX () const;
00149     int  imageDY () const;
00150     void gestureWorkaround (QPointF *point);
00151     bool supportsLandscape () const;
00152     bool supportsPortrait () const;
00153  
00154 private:
00155     QPointer<WallpaperBusinessLogic>  m_WallpaperBusinessLogic;
00156 
00157     // FIXME: The infoheader is not used any more, but removing this pointer
00158     // would cause ABI break.
00159     WallpaperInfoHeader  *m_InfoHeader;
00160     QImage                m_bgLandscape;
00161     QImage                m_bgPortrait;
00162     MAction              *m_DoneAction;
00163     MAction              *m_CancelAction;
00164     bool                  m_NoTitlebar;
00165     bool                  m_OrientationLocked;
00166     M::Orientation        m_Orientation;
00167 
00168     QPointF               m_LastClick;
00169     QPointF               m_UserOffset;
00170     QPointF               m_ImageFixpoint;
00171 
00172     WallpaperITrans       m_Trans;
00173     WallpaperITrans       m_LandscapeTrans;
00174     WallpaperITrans       m_PortraitTrans;
00175     
00176     qreal                 m_OriginalScaleFactor;
00177     bool                  m_PinchOngoing;
00178     bool                  m_PanOngoing;
00179     bool                  m_HasPendingRedraw;
00180     MPhysics2DPanning    *m_Physics;
00181     MPhysics2DPanning    *m_ScalePhysics;
00182 
00183     #ifdef UNIT_TEST
00184     friend class Ut_WallpaperEditorWidget;
00185     #endif
00186 };
00187 
00188 #endif

Generated on Mon Jul 11 2011 12:00:31 for libMeegoControl by  doxygen 1.7.1