-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathsceenbase.h
More file actions
304 lines (267 loc) · 8.17 KB
/
Copy pathsceenbase.h
File metadata and controls
304 lines (267 loc) · 8.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
#ifndef SCEENBASE_H
#define SCEENBASE_H
#include <QObject>
#include <QGraphicsScene>
#include <QGraphicsWidget>
//#include<QtGui>
#include <QGraphicsWidget>
#include <QPainter>
#include <QLocale>
#include <QTextEdit>
#include <QLabel>
#include <QLabel>
#include <QToolBar>
class ButtonG : public QGraphicsWidget
{
Q_OBJECT
public:
ButtonG(const QPixmap &pix, QGraphicsItem *parent = 0)
: QGraphicsWidget(parent), orig(pix), p(pix)
{
setCacheMode(DeviceCoordinateCache);
setAcceptHoverEvents(true);
}
QPainterPath shape() const
{
// path.addEllipse(boundingRect());
//path.addRect(0,0, 100, 100);
// path.addRect(20,20,250,250);
return path;
}
void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
{
painter->drawPixmap(QPointF(), p);
}
virtual void setGeometry(const QRectF &rect)
{
QGraphicsWidget::setGeometry(rect);
p = orig.scaled(rect.size().toSize());
// if (rect.size().width() > orig.size().width())
// p = orig.scaled(rect.size().toSize());
// else
// p = orig;
}
virtual void setPixmap(QPixmap pix)
{
orig=pix;
}
void setPath(QPainterPath pt)
{
path=pt;
}
signals:
void pressed();
void release();
void enter();
void leave();
void mouseMove();
protected:
void mousePressEvent(QGraphicsSceneMouseEvent *)
{
emit pressed();
update();
}
void mouseReleaseEvent(QGraphicsSceneMouseEvent *)
{
emit release();
update();
}
void hoverEnterEvent( QGraphicsSceneHoverEvent *)
{
emit enter();
update();
}
void hoverLeaveEvent ( QGraphicsSceneHoverEvent *)
{
emit leave();
update();
}
void mouseMoveEvent(QGraphicsSceneMouseEvent *)
{
emit mouseMove();
update();
}
private:
QPixmap orig;
QPixmap p;
QPainterPath path;
};
class PixmapS : public QGraphicsWidget
{
Q_OBJECT
public:
PixmapS(const QPixmap &pix, QGraphicsItem *parent = 0)
: QGraphicsWidget(parent), orig(pix), p(pix)
{
setCacheMode(DeviceCoordinateCache);
setAcceptHoverEvents(true);
}
void paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
{
painter->drawPixmap(QPointF(), p);
}
virtual void setGeometry(const QRectF &rect)
{
QGraphicsWidget::setGeometry(rect);
p = orig.scaled(rect.size().toSize());
// if (rect.size().width() > orig.size().width())
// p = orig.scaled(rect.size().toSize());
// else
// p = orig;
}
virtual void setPixmap(QPixmap pix)
{
orig=pix;
}
signals:
void pressed();
void release();
void enter();
void leave();
void mouseMove();
protected:
void mousePressEvent(QGraphicsSceneMouseEvent *)
{
emit pressed();
update();
}
void mouseReleaseEvent(QGraphicsSceneMouseEvent *)
{
emit release();
update();
}
void hoverEnterEvent( QGraphicsSceneHoverEvent *)
{
emit enter();
update();
}
void hoverLeaveEvent ( QGraphicsSceneHoverEvent *)
{
emit leave();
update();
}
void mouseMoveEvent(QGraphicsSceneMouseEvent *)
{
emit mouseMove();
update();
}
private:
QPixmap orig;
QPixmap p;
};
class Sceenbase : public QGraphicsScene
{
Q_OBJECT
public:
Sceenbase( QWidget *parent=0) ;
// Sceenbase();
QToolBar *toolbarPopup;
QToolBar *toolbarMedia;
QTextEdit *textEdit;
QStringList myListSafhat;
signals:
void setPos(int );
public slots:
void setAppPath(QString path);
void setwinLocal(QLocale arg);
void setMoveSelection(int top,int hight,int x1,int x2, int px);
// void setCurentPages(int left,int right,int curent);
void setCurentPages(int safha,int y, bool istafsir);
void setPage(int p);
void updatPopup(qreal poY,qreal poX1,qreal poX2,int px,bool istefsir);
void setParentSize(int with,int hieght,int x);
void setParentLeft(int x);
void setHifdh(bool hifdh);
void setPopupVisible(bool visible);
void setMediaControleVisible(bool visible);
void setColorSelection(QColor color);
void setThemeFolder(QString themeFolder);
void setRewayat(QString rewayat);
void setAnimationEnabled(bool enabled);
void setStandardTools(bool st);
void setShowSelection(bool show);
void updatePages();
private:
//sceen object
QPixmap m_pixRigtMoved;
QPixmap m_pixLeftMoved;
QGraphicsPixmapItem *picMoved;
PixmapS * itemRefletLeft;
PixmapS * itemRefletRigt;
PixmapS * btnLeft; //زر على الصفحة اليسرى لسحب الصفحة
PixmapS * btnRight; //زر على الصفحة اليمنى لسحب الصفحة
PixmapS * btnMedia;// زر عرض واخفاء لوحة ادوات الوسائط
QGraphicsPixmapItem *pageLeft;//مربع الصفحة اليسرى
QGraphicsPixmapItem *pageRight;//مربع الصفحة اليمنى
PixmapS *itemSelection; //مربع التحديد
QGraphicsWidget *panelParent ;
QGraphicsWidget *panelPopup ;
QGraphicsWidget *panelMedia;
QGraphicsWidget *panelNavig;
QGraphicsPixmapItem *ItemPopup;
QGraphicsPixmapItem * ItemPopupBlure;
QLabel *m_labMask;
QList<PixmapS *> items;
QList<ButtonG *> buttons;
// QLabel *labelTransTefsir;
//--variable--
int m_pHieght;
int m_pWith;
int m_px; // موضع الصور س
// bool isTefsirPopup;//--------------------------------------------------------------------------------move to public
QString m_curentRiwaya;
QString m_themeFolder;
QColor m_selectColor;
bool m_animEnabled;
bool m_showSelection;
bool m_showPopup;
//----privat
QString appPath;
QLocale Lc;
QStringList myListArbaa;
int m_difer;
bool m_standardTool;
int safhaLeft;
int safhaRight;
int safhaCurent;
bool m_bLeft; //اذا كان التحريك لليسار مفعل
bool m_bRight; //اذا كان التحريك لليمين مفعل
int m_parentHeight;
int m_parentWidth;
int m_parentLeft;
bool m_isHifdh;
private slots:
void animePageLeft();
void animePageRight();
void openData();
void creatPagesAndPopup();
void creatMediaControles();
void moveMediaControle();
void newPages();
QPixmap disignePage(QString safha);
QPixmap updatePixSelect(int h,int x1 ,int x2,int type,int item);
void goAyaSelected();
void itemAyaEntered();
void itemAyaLived();
//go left to right عند سحب الصفحة الى اليمين
void goNextEenter();//عند ادخال مؤشر الفأرة على الحافة اليسرى
void goNextLeave();//عند خروج مؤشر الفأرة من الحافة اليسرى
void goNextPrissed( );//عند نقر مؤشر الفأرة على الحافة اليسرى
void goNextMoved();//عند تحريك مؤشر الفأرة من الحافة اليسرى
void goNextRelease( );//عند ارسال مؤشر الفأرة من الحافة اليسرى
void moveLeftToRight();// تحريك الصفحة بواسطة مؤشر الفأرة نحوى اليمين
// go right to left عند سحب الصفحة الى اليسار
void goPrevEenter();//عند ادخال مؤشر الفأرة على الحافة اليمنى
void goPrevLeave();//عند خروج مؤشر الفأرة من الحافة اليمنى
void goPrevPrissed( );//عند نقر مؤشر الفأرة على الحافة اليمنى
void goPrevMoved();//عند تحريك مؤشر الفأرة من الحافة اليمنى
void goPrevRelease( );//عند ارسال مؤشر الفأرة من الحافة اليمنى
void moveRightToLeft();//تحريك الصفحة بواسطة مؤشر الفأرةنحوى اليسار
//-----------------------------hifdh----------------------------------------
void hifdhType();
void readType();
void itemHifdhCliked();
void itemHifdhEntered();
void itemHifdhLived();
};
#endif // SCEENBASE_H