1 #include "raptorsliderviewgroup.h"
3 #include <plasma/phase.h>
5 class RaptorSliderViewGroup::Private
12 RaptorSlide
* currentLayer
;
15 RaptorSlide::Direction mode
;
18 RaptorSliderViewGroup::RaptorSliderViewGroup(QGraphicsScene
* parent
):QObject(),d(new Private
)
20 d
->currentLayer
= new RaptorSlide();
21 d
->mode
= RaptorSlide::Grid
;
22 d
->currentLayer
->setDirection(d
->mode
);
23 d
->currentLayer
->move(10.0,0.0);
25 d
->slideLayer
[0] = d
->currentLayer
;
28 d
->slideTimer
= new QTimer(this);
31 RaptorSliderViewGroup::~RaptorSliderViewGroup()
36 void RaptorSliderViewGroup::setMode(RaptorSlide::Direction m
)
40 bool RaptorSliderViewGroup::addItem(RaptorClaw
* item
)
43 if (!d
->currentLayer
->isFull()) {
44 d
->currentLayer
->addItem((RaptorClaw
*)item
);
45 canvas
->addItem(item
);
48 d
->currentLayer
= new RaptorSlide();
50 d
->currentLayer
->setDirection(d
->mode
);
51 d
->slideLayer
[++d
->slideCount
] = d
->currentLayer
;
52 d
->currentLayer
->addItem((RaptorClaw
*)item
);
53 canvas
->addItem(item
);
59 bool RaptorSliderViewGroup::deleteItem(QGraphicsItem
* item
)
63 QGraphicsItem
* RaptorSliderViewGroup::find (const QString
& key
)
67 int RaptorSliderViewGroup::slideCount()
72 void RaptorSliderViewGroup::view(int id
)
74 //we want to hide quick for now..
75 //TODO : add phase animation integration.here
76 for (int i
= 0; i
< d
->slideLayer
.count(); i
++) {
77 //Plasma::Phase().animateItem(d->slideLayer[i],Plasma::Phase::Disappear);
78 // Plasma::Phase().moveItem(d->slideLayer[i],Plasma::Phase::SlideOut,QPoint(400,400));
79 d
->slideLayer
[i
]->hide();
81 if (d
->slideLayer
[id
]) {
82 d
->slideLayer
[id
]->show();
88 void RaptorSliderViewGroup::swapNext()
90 if ((d
->currentViewId
) < d
->slideCount
)
92 d
->currentViewId
= d
->currentViewId
+ 1;
93 this->view(d
->currentViewId
);
95 qDebug("Now Swaping");
98 void RaptorSliderViewGroup::swapPrevious()
100 if ( d
->currentViewId
-1 >= 0) {
101 this->view(--d
->currentViewId
);
105 void RaptorSliderViewGroup::move(float x
, float y
)
107 for (int i
= 0; i
< d
->slideLayer
.count(); i
++) {
108 d
->slideLayer
[i
]->move(x
,y
);
113 float RaptorSliderViewGroup::height()
115 return d
->currentLayer
->height();
118 #include "raptorsliderviewgroup.moc"