From: Pekka Nissinen Date: Mon, 16 Aug 2010 13:22:01 +0000 (+0300) Subject: Simplified panel structure yet again by merging PanelBase class into PanelContentStac... X-Git-Tag: v2.0b-1~71 X-Git-Url: https://vcs.maemo.org/git/?p=situare;a=commitdiff_plain;h=08e941d53e08f773beb524cfd235fdcfb65023ae Simplified panel structure yet again by merging PanelBase class into PanelContentStack class. Deleted the old unused class files. --- diff --git a/src/src.pro b/src/src.pro index 4085e45..81e5c75 100644 --- a/src/src.pro +++ b/src/src.pro @@ -64,7 +64,6 @@ SOURCES += main.cpp \ ui/listitemdelegate.cpp \ ui/friendlistitemdelegate.cpp \ ui/searchdialog.cpp \ - ui/panelbase.cpp \ ui/panelbar.cpp \ ui/panelcontentstack.cpp \ ui/paneltab.cpp \ @@ -135,7 +134,6 @@ HEADERS += application.h \ ui/listitem.h \ ui/listitemdelegate.h \ ui/searchdialog.h \ - ui/panelbase.h \ ui/panelbar.h \ ui/panelcommon.h \ ui/panelcontentstack.h \ diff --git a/src/ui/panelbase.cpp b/src/ui/panelbase.cpp deleted file mode 100644 index 5186828..0000000 --- a/src/ui/panelbase.cpp +++ /dev/null @@ -1,52 +0,0 @@ -/* - Situare - A location system for Facebook - Copyright (C) 2010 Ixonos Plc. Authors: - - Pekka Nissinen - pekka.nissinen@ixonos.com - - Situare is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Situare 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 Situare; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#include -#include -#include -#include - -#include "panelbase.h" - -PanelBase::PanelBase(QWidget *parent) - : QWidget(parent) -{ - qDebug() << __PRETTY_FUNCTION__; - - m_menuDropShadowTile.load(":res/images/menu_bar_drop_shadow.png"); - - QPalette pal = palette(); - pal.setColor(QPalette::Background, QColor(0, 0, 0, 128)); - setPalette(pal); - setAutoFillBackground(true); -} - -void PanelBase::paintEvent(QPaintEvent *event) -{ - qDebug() << __PRETTY_FUNCTION__; - - Q_UNUSED(event); - - QPainter painter(this); - - QRect shadowRect = QRect(0, 0, this->rect().width(), m_menuDropShadowTile.height()); - painter.drawTiledPixmap(shadowRect, m_menuDropShadowTile); -} diff --git a/src/ui/panelbase.h b/src/ui/panelbase.h deleted file mode 100644 index f0a7db2..0000000 --- a/src/ui/panelbase.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - Situare - A location system for Facebook - Copyright (C) 2010 Ixonos Plc. Authors: - - Pekka Nissinen - pekka.nissinen@ixonos.com - - Situare is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - version 2 as published by the Free Software Foundation. - - Situare 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 Situare; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, - USA. -*/ - -#ifndef PANELBASE_H -#define PANELBASE_H - -#include -#include -#include - -///< @todo Base class? Might be misleading comment and does not tell about what this class does -///< @todo Why not directly inheriting QStackedWidget? -/** - * @brief Base class for panel inner content - * - * @author Pekka Nissinen - pekka.nissinen@ixonos.com - */ -class PanelBase : public QWidget -{ - Q_OBJECT - -public: - /** - * @brief Constructor - * - * @param parent Parent - */ - PanelBase(QWidget *parent = 0); - -/******************************************************************************* - * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS - ******************************************************************************/ -protected: - /** - * @brief Draws the panel content base - * - * @param event Paint event - */ - void paintEvent(QPaintEvent *event); - -/******************************************************************************* - * DATA MEMBERS - *******************************************************************************/ -private: - QPixmap m_menuDropShadowTile; ///< Pixmap for menu drop shadow -}; - -#endif // PANELBASE_H diff --git a/src/ui/panelcontentstack.cpp b/src/ui/panelcontentstack.cpp index b23af29..d59e401 100644 --- a/src/ui/panelcontentstack.cpp +++ b/src/ui/panelcontentstack.cpp @@ -20,11 +20,9 @@ USA. */ -#include #include -#include +#include -#include "panelbase.h" #include "panelcommon.h" #include "panelcontentstack.h" @@ -36,13 +34,24 @@ PanelContentStack::PanelContentStack(QWidget *parent) resize(PANEL_WIDTH, PANEL_HEIGHT); - m_panelVBox = new QVBoxLayout(this); - m_panelVBox->setMargin(0); - m_panelVBox->setSpacing(0); + m_menuDropShadowTile.load(":res/images/menu_bar_drop_shadow.png"); - m_panelBase = new PanelBase(this); - m_panelBase->setLayout(m_panelVBox); - m_panelBase->resize(this->size()); + QPalette pal = palette(); + pal.setColor(QPalette::Background, QColor(0, 0, 0, 128)); + setPalette(pal); + setAutoFillBackground(true); +} + +void PanelContentStack::paintEvent(QPaintEvent *event) +{ + qDebug() << __PRETTY_FUNCTION__; + + Q_UNUSED(event); + + QPainter painter(this); + + QRect shadowRect = QRect(0, 0, this->rect().width(), m_menuDropShadowTile.height()); + painter.drawTiledPixmap(shadowRect, m_menuDropShadowTile); } void PanelContentStack::resizePanelContentStack(const QSize &size) @@ -50,6 +59,4 @@ void PanelContentStack::resizePanelContentStack(const QSize &size) qDebug() << __PRETTY_FUNCTION__; resize(PANEL_WIDTH, size.height() - PANEL_TOP_PADDING - PANEL_BOTTOM_PADDING); - - m_panelBase->resize(this->size()); } diff --git a/src/ui/panelcontentstack.h b/src/ui/panelcontentstack.h index 9715035..e8515a8 100644 --- a/src/ui/panelcontentstack.h +++ b/src/ui/panelcontentstack.h @@ -25,10 +25,6 @@ #include -class QVBoxLayout; - -class PanelBase; - /** * @brief Stack class for tabbed pabel widgets * @@ -48,6 +44,17 @@ public: PanelContentStack(QWidget *parent = 0); /******************************************************************************* + * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS + ******************************************************************************/ +protected: + /** + * @brief Draws the panel content base + * + * @param event Paint event + */ + void paintEvent(QPaintEvent *event); + +/******************************************************************************* * MEMBER FUNCTIONS AND SLOTS ******************************************************************************/ public slots: @@ -62,9 +69,7 @@ public slots: * DATA MEMBERS *******************************************************************************/ private: - QVBoxLayout *m_panelVBox; ///< Vertical layout inside the panel - - PanelBase *m_panelBase; ///< Widget for panel base + QPixmap m_menuDropShadowTile; ///< Pixmap for menu drop shadow }; #endif // PANELCONTENTSTACK_H