Fixed FacebookLoginBrowser::destroyed() signal handling
[situare] / src / ui / panelcontentstack.cpp
1 /*
2     Situare - A location system for Facebook
3     Copyright (C) 2010  Ixonos Plc. Authors:
4
5         Kaj Wallin - kaj.wallin@ixonos.com
6         Pekka Nissinen - pekka.nissinen@ixonos.com
7
8     Situare is free software; you can redistribute it and/or
9     modify it under the terms of the GNU General Public License
10     version 2 as published by the Free Software Foundation.
11
12     Situare is distributed in the hope that it will be useful,
13     but WITHOUT ANY WARRANTY; without even the implied warranty of
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15     GNU General Public License for more details.
16
17     You should have received a copy of the GNU General Public License
18     along with Situare; if not, write to the Free Software
19     Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301,
20     USA.
21 */
22
23 #include <QDebug>
24 #include <QPainter>
25
26 #include "panelcommon.h"
27
28 #include "panelcontentstack.h"
29
30 PanelContentStack::PanelContentStack(QWidget *parent)
31     : QStackedWidget(parent)
32 {
33     qDebug() << __PRETTY_FUNCTION__;
34
35     const QColor SEMI_TRANSPARENT_BLACK(0, 0, 0, 128);
36
37     resize(PANEL_WIDTH, PANEL_HEIGHT);
38
39     m_menuDropShadowTile.load(":res/images/menu_bar_drop_shadow.png");
40
41     QPalette pal = palette();
42     pal.setColor(QPalette::Background, SEMI_TRANSPARENT_BLACK);
43     setPalette(pal);
44     setAutoFillBackground(true);
45 }
46
47 void PanelContentStack::paintEvent(QPaintEvent *event)
48 {
49     qDebug() << __PRETTY_FUNCTION__;
50
51     Q_UNUSED(event);
52
53     const int SHADOW_RECT_X = 0;
54     const int SHADOW_RECT_Y = 0;
55
56     QPainter painter(this);
57     QRect shadowRect = QRect(SHADOW_RECT_X, SHADOW_RECT_Y,
58                              rect().width(), m_menuDropShadowTile.height());
59     painter.drawTiledPixmap(shadowRect, m_menuDropShadowTile);
60 }
61
62 void PanelContentStack::resizeContentStack(const QSize &size)
63 {
64     qDebug() << __PRETTY_FUNCTION__;
65
66     resize(PANEL_WIDTH, size.height() - PANEL_TOP_PADDING - PANEL_BOTTOM_PADDING);
67 }