2012-04-08 21:45:40 +02:00
|
|
|
/* ============================================================
|
|
|
|
* QupZilla - WebKit based browser
|
|
|
|
* Copyright (C) 2010-2012 Alexander Samilovskih <alexsamilovskih@gmail.com>
|
|
|
|
* David Rosca <nowrep@gmail.com>
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
* ============================================================ */
|
|
|
|
#ifndef TABPREVIEW_H
|
|
|
|
#define TABPREVIEW_H
|
|
|
|
|
|
|
|
#include <QFrame>
|
2012-04-11 16:38:46 +02:00
|
|
|
#include <QTimeLine>
|
|
|
|
#include <QGraphicsOpacityEffect>
|
2012-04-08 21:45:40 +02:00
|
|
|
|
|
|
|
class QupZilla;
|
|
|
|
class WebTab;
|
|
|
|
class QLabel;
|
|
|
|
|
|
|
|
class TabPreview : public QFrame
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit TabPreview(QupZilla* mainClass, QWidget* parent);
|
|
|
|
|
|
|
|
void setWebTab(WebTab* webTab, bool noPixmap);
|
|
|
|
void showOnRect(const QRect &rect);
|
|
|
|
|
2012-04-09 19:45:00 +02:00
|
|
|
int previewIndex();
|
|
|
|
void setPreviewIndex(int index);
|
|
|
|
|
2012-04-08 21:45:40 +02:00
|
|
|
void setAnimationsEnabled(bool enabled);
|
|
|
|
|
2012-04-09 14:09:40 +02:00
|
|
|
public slots:
|
|
|
|
void hideAnimated();
|
|
|
|
void hide();
|
|
|
|
|
|
|
|
void show();
|
|
|
|
|
2012-04-11 16:38:46 +02:00
|
|
|
private slots:
|
|
|
|
void setOpacity(int opacity);
|
|
|
|
void setAnimationFrame(int frame);
|
|
|
|
|
2012-04-08 21:45:40 +02:00
|
|
|
protected:
|
|
|
|
void paintEvent(QPaintEvent* pe);
|
|
|
|
|
|
|
|
private:
|
2012-04-09 14:09:40 +02:00
|
|
|
void showAnimated();
|
2012-04-11 16:38:46 +02:00
|
|
|
void calculateSteps(const QRect &oldGeometry, const QRect &newGeometry);
|
2012-04-08 21:45:40 +02:00
|
|
|
QPoint calculatePosition(const QRect &tabRect, const QSize &previewSize);
|
|
|
|
|
|
|
|
QupZilla* p_QupZilla;
|
2012-04-11 16:38:46 +02:00
|
|
|
QLabel* m_pixmapLabel;
|
2012-04-08 21:45:40 +02:00
|
|
|
QLabel* m_title;
|
|
|
|
|
2012-04-09 19:45:00 +02:00
|
|
|
int m_previewIndex;
|
2012-04-08 21:45:40 +02:00
|
|
|
bool m_animationsEnabled;
|
2012-04-11 16:38:46 +02:00
|
|
|
|
|
|
|
QTimeLine m_opacityTimeLine;
|
|
|
|
QGraphicsOpacityEffect m_opacityEffect;
|
|
|
|
|
|
|
|
QTimeLine m_animation;
|
|
|
|
QRect m_startGeometry;
|
|
|
|
qreal m_stepX;
|
|
|
|
qreal m_stepY;
|
|
|
|
qreal m_stepWidth;
|
|
|
|
qreal m_stepHeight;
|
2012-04-08 21:45:40 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // TABPREVIEW_H
|