-void ChatScene::webPreviewNextStep() {
- // qDebug() << Q_FUNC_INFO << webPreview.previewState;
- switch(webPreview.previewState) {
- case WebPreview::NoPreview:
- break;
- case WebPreview::NewPreview:
- Q_ASSERT(!webPreview.previewItem);
- webPreview.previewItem = new WebPreviewItem(webPreview.url);
- webPreview.previewState = WebPreview::DelayPreview;
- webPreview.timer.start(1000);
- break;
- case WebPreview::DelayPreview:
- Q_ASSERT(webPreview.previewItem);
- // calc position and show
- {
- qreal previewY = webPreview.urlRect.bottom();
- qreal previewX = webPreview.urlRect.x();
- if(previewY + webPreview.previewItem->boundingRect().height() > sceneRect().bottom())
- previewY = webPreview.urlRect.y() - webPreview.previewItem->boundingRect().height();
-
- if(previewX + webPreview.previewItem->boundingRect().width() > sceneRect().width())
- previewX = sceneRect().right() - webPreview.previewItem->boundingRect().width();
-
- webPreview.previewItem->setPos(previewX, previewY);
- }
- addItem(webPreview.previewItem);
- webPreview.previewState = WebPreview::ShowPreview;
- break;
- case WebPreview::ShowPreview:
- qWarning() << "ChatScene::webPreviewNextStep() called while in ShowPreview Step!";
- qWarning() << "removing preview";
- if(webPreview.previewItem && webPreview.previewItem->scene())
- removeItem(webPreview.previewItem);
+
+void ChatScene::webPreviewNextStep()
+{
+ // qDebug() << Q_FUNC_INFO << webPreview.previewState;
+ switch (webPreview.previewState) {
+ case WebPreview::NoPreview:
+ break;
+ case WebPreview::NewPreview:
+ Q_ASSERT(!webPreview.previewItem);
+ webPreview.previewItem = new WebPreviewItem(webPreview.url);
+ webPreview.previewState = WebPreview::DelayPreview;
+ webPreview.timer.start(1000);
+ break;
+ case WebPreview::DelayPreview:
+ Q_ASSERT(webPreview.previewItem);
+ // calc position and show
+ {
+ qreal previewY = webPreview.urlRect.bottom();
+ qreal previewX = webPreview.urlRect.x();
+ if (previewY + webPreview.previewItem->boundingRect().height() > sceneRect().bottom())
+ previewY = webPreview.urlRect.y() - webPreview.previewItem->boundingRect().height();
+
+ if (previewX + webPreview.previewItem->boundingRect().width() > sceneRect().width())
+ previewX = sceneRect().right() - webPreview.previewItem->boundingRect().width();
+
+ webPreview.previewItem->setPos(previewX, previewY);
+ }
+ addItem(webPreview.previewItem);
+ webPreview.previewState = WebPreview::ShowPreview;
+ break;
+ case WebPreview::ShowPreview:
+ qWarning() << "ChatScene::webPreviewNextStep() called while in ShowPreview Step!";
+ qWarning() << "removing preview";
+ if (webPreview.previewItem && webPreview.previewItem->scene())
+ removeItem(webPreview.previewItem);