LunaSysMgr
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DockModeLaunchPoint.h
Go to the documentation of this file.
1 /* @@@LICENSE
2 *
3 * Copyright (c) 2010-2012 Hewlett-Packard Development Company, L.P.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 * LICENSE@@@ */
18 
19 
20 
21 
22 #ifndef DOCKMODELAUNCHPOINT_H
23 #define DOCKMODELAUNCHPOINT_H
24 
25 #include "Common.h"
26 
27 #include <set>
28 #include "DockModeWindowManager.h"
29 #include "PtrArray.h"
30 #include <QPropertyAnimation>
31 #include <QParallelAnimationGroup>
32 #include <QGraphicsSceneMouseEvent>
33 #include <QGestureEvent>
34 #include <QList>
35 #include <QTextLayout>
36 #include <QPointer>
37 
38 class Window;
39 class DockModeWindow;
40 class LaunchPoint;
41 
43 {
44  Q_OBJECT
45 public:
46 
47  enum State {
53  };
54 
55  DockModeLaunchPoint(int width, int height, const LaunchPoint* lp, bool isPermanent = false);
57 
58  QRectF boundingRect() const;
59 
60  bool isPermanent() const { return m_isPermanent; }
61 
62  void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
63 
64  void setState(State newState);
65  State state() { return m_state; }
66 
67  const LaunchPoint* launchPoint() { return m_launchPoint; }
68 
69  void setOrientation(OrientationEvent::Orientation orient);
70 
71  void setOpenWindow(Window* win);
72  Window* openWindow();
73 
75  bool loadingTimedOut();
76 
77  void setAnchorPos(int x, int y) {m_anchorPos = QPoint(x, y);}
78 
79  void createAppScreenshot(bool closing = false);
80  void deleteScreenShot();
81  void createSplashImage( QPixmap* img, OrientationEvent::Orientation imgOrientation);
82  QPixmap* splashImage() { return m_splashImage; }
83 
84  void setPressedState(bool pressed) { m_buttonPressed = pressed; }
85 
86  static void deleteStaticImages();
87 
88  void resize (int width, int height);
89 
90 public :
91 
92 
93 private Q_SLOTS:
94  void positionAnimationValueChanged(const QVariant& value);
95 
96 private:
97 
98  static QPainter imagePainter;
99  static QPixmap *s_removeIcon, *s_removeIconHighlight;
100  static QPixmap *s_scrimPixmap;
101  static QPixmap* s_defaultSplash;
102 
103  static QPixmap* defaultSplashImage();
104  static QPixmap* scrimImage();
105 
106 private:
107 
108  void copyAndRotateImage(QPixmap* source, OrientationEvent::Orientation srcOrient,
109  QPixmap* destination, OrientationEvent::Orientation dstOrient, qreal scaleFactor);
110 
111 
112  int m_width, m_height;
113 
114  qreal m_textHeight;
115  QRect m_bounds, m_imageBounds;
116  QRect m_removeHitArea;
117  QPoint m_anchorPos;
118  bool m_beingDeleted;
119  bool m_buttonHighlight;
120  bool m_buttonPressed;
121  bool m_isPermanent;
122 
123  State m_state;
124  bool m_hasScreenshot;
125  const LaunchPoint* m_launchPoint;
126  std::string m_splashImgPath;
127  QPixmap* m_splashImage;
128  QPixmap* m_appScreenShot;
129  OrientationEvent::Orientation m_screenShotOrientation;
130  OrientationEvent::Orientation m_orientation;
131  Window* m_openWindow;
132  QFont* m_font;
133  QTextLayout m_textLayout;
134  qreal m_rotation;
135  QPointer<QPropertyAnimation> m_positionAnimationPtr;
136 
137 };
138 
139 
140 #endif /* DOCKMODELAUNCHPOINT_H */