1 #include "raptorsliderviewgroup.h"
3 #include <plasma/phase.h>
5 class RaptorSliderViewGroup::Private
12 RaptorSlide
*currentLayer
;
15 RaptorSlide::Direction mode
;
18 RaptorSliderViewGroup::RaptorSliderViewGroup(QGraphicsScene
*scene
)
20 d
->currentLayer
= new RaptorSlide();
21 d
->mode
= RaptorSlide::Grid
; // Default is 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
)
41 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();
49 d
->currentLayer
->setDirection(d
->mode
);
50 d
->slideLayer
[++d
->slideCount
] = d
->currentLayer
;
51 d
->currentLayer
->addItem(item
);
52 canvas
->addItem(item
);
58 void RaptorSliderViewGroup::clearItems()
60 while (d
->slideCount
== 0) {
61 delete d
->slideLayer
[d
->slideCount
];
66 QGraphicsItem
* RaptorSliderViewGroup::find(const QString
& key
)
70 int RaptorSliderViewGroup::slideCount()
75 void RaptorSliderViewGroup::view(int id
)
77 // we want to hide quick for now..
78 // TODO : add phase animation integration.here
79 for (int i
= 0; i
< d
->slideLayer
.count(); i
++) {
80 // Plasma::Phase().animateItem(d->slideLayer[i],Plasma::Phase::Disappear);
81 // Plasma::Phase().moveItem(d->slideLayer[i],Plasma::Phase::SlideOut,QPoint(400,400));
82 d
->slideLayer
[i
]->hide();
84 if (d
->slideLayer
[id
]) {
85 d
->slideLayer
[id
]->show();
91 void RaptorSliderViewGroup::swapNext()
93 if ((d
->currentViewId
) < d
->slideCount
)
95 d
->currentViewId
= d
->currentViewId
+ 1;
96 this->view(d
->currentViewId
);
98 qDebug("Now Swapping");
101 void RaptorSliderViewGroup::swapPrevious()
103 if ( d
->currentViewId
-1 >= 0) {
104 this->view(--d
->currentViewId
);
108 void RaptorSliderViewGroup::move(float x
, float y
)
110 for (int i
= 0; i
< d
->slideLayer
.count(); i
++) {
111 d
->slideLayer
[i
]->move(x
,y
);
115 float RaptorSliderViewGroup::height()
117 return d
->currentLayer
->height();
120 #include "raptorsliderviewgroup.moc"