Added a few missing comment blocks and cleaned up code a bit
[situare] / src / ui / panelcontent.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 <QAbstractState>
24 #include <QDebug>
25 #include <QVBoxLayout>
26
27 #include "panelcontent.h"
28
29 #include "panelcommon.h"
30 #include "panelbase.h"
31
32 PanelContent::PanelContent(QWidget *parent)
33     : QWidget(parent)
34 {
35     qDebug() << __PRETTY_FUNCTION__;
36
37     this->resize(PANEL_WIDTH, PANEL_HEIGHT);
38
39     m_panelVBox = new QVBoxLayout(this);
40     m_panelVBox->setMargin(0);
41     m_panelVBox->setSpacing(0);
42
43     m_panelBase = new PanelBase(this);
44     m_panelBase->setLayout(m_panelVBox);
45     m_panelBase->resize(this->size());
46 }
47
48 void PanelContent::setContentWidget(QWidget *widget)
49 {
50     qDebug() << __PRETTY_FUNCTION__;
51
52     m_panelVBox->addWidget(widget);
53 }
54
55 void PanelContent::resizePanelContent(const QSize &size)
56 {
57     qDebug() << __PRETTY_FUNCTION__;
58
59     this->resize(PANEL_WIDTH, size.height() - PANEL_TOP_PADDING - PANEL_BOTTOM_PADDING);
60
61     m_panelBase->resize(this->size());
62 }