browsercore/appfw/Common/FilmstripFlow.cpp
branchGCC_SURGE
changeset 8 2e16851ffecd
parent 6 1c3b8676e58c
child 15 73c48011b8c7
equal deleted inserted replaced
2:bf4420e9fa4d 8:2e16851ffecd
     1 /*
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
     4 *
     9 * Initial Contributors:
     5 * This program is free software: you can redistribute it and/or modify
    10 * Nokia Corporation - initial contribution.
     6 * it under the terms of the GNU Lesser General Public License as published by
       
     7 * the Free Software Foundation, version 2.1 of the License.
       
     8 * 
       
     9 * This program is distributed in the hope that it will be useful,
       
    10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    12 * GNU Lesser General Public License for more details.
    11 *
    13 *
    12 * Contributors:
    14 * You should have received a copy of the GNU Lesser General Public License
       
    15 * along with this program.  If not, 
       
    16 * see "http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html/".
    13 *
    17 *
    14 * Description: 
    18 * Description:
    15 *
    19 *
    16 */
    20 *   FilmstripFlow - animated image show widget
    17 
    21 */
    18 #include <QDebug>
    22 #include <QDebug>
    19 #include <QImage>
    23 #include <QImage>
    20 #include <QPainter>
    24 #include <QPainter>
    21 #include <QResizeEvent>
    25 #include <QResizeEvent>
    22 #include <QTimeLine>
    26 #include <QTimeLine>
   220 void Filmstrip::createEmptyImage()
   224 void Filmstrip::createEmptyImage()
   221 {
   225 {
   222     QRectF target = m_movie->movieClip(0);
   226     QRectF target = m_movie->movieClip(0);
   223     int w = target.width();
   227     int w = target.width();
   224     int h = target.height();
   228     int h = target.height();
   225     m_name =  qtTrId("txt_browser_windows_new_window");
   229     if (m_name.isEmpty())
       
   230         m_name =  qtTrId("txt_browser_windows_new_window");
   226     m_img = QImage(w, h, QImage::Format_RGB32);
   231     m_img = QImage(w, h, QImage::Format_RGB32);
   227 
   232 
   228     QPainter painter(&m_img);
   233     QPainter painter(&m_img);
   229     painter.fillRect(0, 0, w, h, Qt::white);
   234     painter.fillRect(0, 0, w, h, Qt::white);
   230     /*QPoint p1(w*4/10, 0);
   235     /*QPoint p1(w*4/10, 0);
  1248 /*!
  1253 /*!
  1249   Set center index
  1254   Set center index
  1250 */
  1255 */
  1251 void GraphicsFilmstripFlow::setCenterIndex(int i)
  1256 void GraphicsFilmstripFlow::setCenterIndex(int i)
  1252 {
  1257 {
  1253     qDebug() << "!!!Set Center Index:" << i;
  1258     //qDebug() << "!!!Set Center Index:" << i;
  1254     Q_ASSERT(d);
  1259     Q_ASSERT(d);
  1255     if (!d->m_films.size())
  1260     if (!d->m_films.size())
  1256         return;
  1261         return;
  1257     Q_ASSERT(i >= 0 && i < d->m_films.size());
  1262     Q_ASSERT(i >= 0 && i < d->m_films.size());
  1258     d->m_centerIndex = i;
  1263     d->m_centerIndex = i;
  1644 
  1649 
  1645     if (d->m_closeIcon && hitCloseIcon())
  1650     if (d->m_closeIcon && hitCloseIcon())
  1646         return;
  1651         return;
  1647 
  1652 
  1648     if(event->pos().x() > ( (size().width() - d->m_centerWindowSize.width())/ 2) &&
  1653     if(event->pos().x() > ( (size().width() - d->m_centerWindowSize.width())/ 2) &&
  1649        event->pos().x() < ( (size().width() + d->m_centerWindowSize.width())/ 2) )
  1654        event->pos().x() < ( (size().width() + d->m_centerWindowSize.width())/ 2) &&
       
  1655        event->pos().y() > d->m_centerTopSpace &&
       
  1656        event->pos().y() < d->m_centerTopSpace + d->m_centerWindowSize.height())
  1650     {
  1657     {
  1651         emit ok(d->m_centerIndex);
  1658         emit ok(d->m_centerIndex);
  1652     }
  1659     }
  1653 }
  1660 }
  1654 
  1661