Renamed some of the old panel classes and re-organized the whole panel structure
authorPekka Nissinen <pekka.nissinen@ixonos.com>
Tue, 10 Aug 2010 12:35:08 +0000 (15:35 +0300)
committerPekka Nissinen <pekka.nissinen@ixonos.com>
Tue, 10 Aug 2010 12:35:08 +0000 (15:35 +0300)
17 files changed:
src/src.pro
src/ui/friendlistpanel.cpp
src/ui/friendlistpanel.h
src/ui/panelbar.cpp [new file with mode: 0644]
src/ui/panelbar.h [new file with mode: 0644]
src/ui/panelbase.cpp [new file with mode: 0644]
src/ui/panelbase.h [new file with mode: 0644]
src/ui/panelcontent.cpp [new file with mode: 0644]
src/ui/panelcontent.h [new file with mode: 0644]
src/ui/panelsliderbar.cpp [deleted file]
src/ui/panelsliderbar.h [deleted file]
src/ui/sidepanel.cpp [deleted file]
src/ui/sidepanel.h [deleted file]
src/ui/sidepanelbase.cpp [deleted file]
src/ui/sidepanelbase.h [deleted file]
src/ui/tabbedpanel.cpp [new file with mode: 0644]
src/ui/tabbedpanel.h [new file with mode: 0644]

index 18b79dc..7f98fd5 100644 (file)
@@ -10,7 +10,10 @@ RESOURCES += ../images.qrc \
 TRANSLATIONS += ../res/languages/situare_fi.ts
 SOURCES += main.cpp \
     application.cpp \
+    coordinates/geocoordinate.cpp \
+    coordinates/scenecoordinate.cpp \
     engine/engine.cpp \
+    engine/mce.cpp \
     facebookservice/facebookauthentication.cpp \
     facebookservice/facebookcredentials.cpp \
     gps/gpsposition.cpp \
@@ -21,6 +24,7 @@ SOURCES += main.cpp \
     map/gpslocationitem.cpp \
     map/mapengine.cpp \
     map/mapfetcher.cpp \
+    map/maprouteitem.cpp \
     map/mapscene.cpp \
     map/mapscroller.cpp \
     map/maptile.cpp \
@@ -31,6 +35,11 @@ SOURCES += main.cpp \
     network/networkcookiejar.cpp \
     network/networkhandler.cpp \
     network/networkreply.cpp \
+    routing/geocodingservice.cpp \
+    routing/location.cpp \
+    routing/route.cpp \
+    routing/routesegment.cpp \
+    routing/routingservice.cpp \
     situareservice/imagefetcher.cpp \
     situareservice/situareservice.cpp \
     ui/updatelocation/texteditautoresizer.cpp \
@@ -38,39 +47,32 @@ SOURCES += main.cpp \
     ui/avatarimage.cpp \
     ui/friendlistitem.cpp \
     ui/friendlistpanel.cpp \
+    ui/fullscreenbutton.cpp \
     ui/imagebutton.cpp \
+    ui/indicatorbutton.cpp \
     ui/logindialog.cpp \
     ui/mainwindow.cpp \
     ui/mapscale.cpp \
-    ui/panelsidebar.cpp \
-    ui/panelsliderbar.cpp \
     ui/settingsdialog.cpp \
-    ui/sidepanel.cpp \
-    ui/sidepanelbase.cpp \
     ui/userinfo.cpp \
     ui/userinfopanel.cpp \
     ui/zoombutton.cpp \
     ui/zoombuttonpanel.cpp \
-    user/user.cpp \
-    ui/fullscreenbutton.cpp \
-    engine/mce.cpp \
-    ui/indicatorbutton.cpp \
-    routing/routingservice.cpp \
-    routing/routesegment.cpp \
-    routing/route.cpp \
-    routing/location.cpp \
-    map/maprouteitem.cpp \
-    coordinates/scenecoordinate.cpp \
-    coordinates/geocoordinate.cpp \
     ui/listview.cpp \
     ui/listitem.cpp \
     ui/listitemdelegate.cpp \
     ui/friendlistitemdelegate.cpp \
     ui/searchdialog.cpp \
-    routing/geocodingservice.cpp
+    ui/paneltab.cpp \
+    ui/tabbedpanel.cpp \
+    ui/panelbar.cpp \
+    ui/panelcontent.cpp \
+    ui/panelbase.cpp \
+    user/user.cpp
 HEADERS += application.h \
     common.h \
     engine/engine.h \
+    error.h \
     facebookservice/facebookauthentication.h \
     facebookservice/facebookcommon.h \
     facebookservice/facebookcredentials.h \
@@ -107,19 +109,16 @@ HEADERS += application.h \
     ui/mainwindow.h \
     ui/mapscale.h \
     ui/panelcommon.h \
-    ui/panelsidebar.h \
-    ui/panelsliderbar.h \
     ui/settingsdialog.h \
     ui/userinfo.h \
     ui/userinfopanel.h \
-    ui/sidepanel.h \
-    ui/sidepanelbase.h \
     ui/zoombutton.h \
     ui/zoombuttonpanel.h \
     user/user.h \
     ui/fullscreenbutton.h \
     engine/mce.h \
     ui/indicatorbutton.h \
+    routing/geocodingservice.h \
     routing/routingservice.h \
     routing/routingcommon.h \
     routing/routesegment.h \
@@ -135,8 +134,11 @@ HEADERS += application.h \
     ui/friendlistitemdelegate.h \
     ui/listcommon.h \
     ui/searchdialog.h \
-    error.h \
-    routing/geocodingservice.h
+    ui/paneltab.h \
+    ui/tabbedpanel.h \
+    ui/panelbar.h \
+    ui/panelcontent.h \
+    ui/panelbase.h
 QT += network \
     webkit
 
index 70aca8d..f6e9738 100644 (file)
 #include "friendlistitem.h"
 #include "friendlistitemdelegate.h"
 #include "panelcommon.h"
-#include "sidepanel.h"
 
 #include "friendlistpanel.h"
 
 FriendListPanel::FriendListPanel(QWidget *parent)
-    : SidePanel(parent)
+    : QWidget(parent)
 {
     qDebug() << __PRETTY_FUNCTION__;
-    setType(SidePanel::FriendPanel);
 
     QHBoxLayout *filterLayout = new QHBoxLayout;
     filterLayout->setContentsMargins(FRIENDPANEL_FILTER_MARGIN_LEFT, 0,
@@ -49,7 +47,7 @@ FriendListPanel::FriendListPanel(QWidget *parent)
     m_clearFilterButton = new QPushButton(tr("Show all"));
     filterLayout->addWidget(m_friendListLabel);
     filterLayout->addWidget(m_clearFilterButton);
-    m_panelVBox->addWidget(m_friendListHeaderWidget);
+//    m_panelVBox->addWidget(m_friendListHeaderWidget);
 
     QHBoxLayout *friendListLayout =  new QHBoxLayout;
     friendListLayout->setContentsMargins(FRIENDPANEL_MARGIN_LEFT, FRIENDPANEL_MARGIN_TOP,
@@ -62,7 +60,7 @@ FriendListPanel::FriendListPanel(QWidget *parent)
     m_friendListView->setItemDelegate(m_friendListItemDelegate);
 
     friendListLayout->addWidget(m_friendListView);
-    m_panelVBox->addLayout(friendListLayout);
+//    m_panelVBox->addLayout(friendListLayout);
 
     connect(m_friendListView, SIGNAL(listItemClicked(GeoCoordinate)),
             this, SIGNAL(findFriend(GeoCoordinate)));
@@ -126,7 +124,7 @@ void FriendListPanel::showFriendsInList(const QList<QString> &userIDs)
 
     m_friendListLabel->setText(tr("Selected: %1").arg(userIDs.count()));
 
-    openPanel();
+//    openPanel();
     m_friendListHeaderWidget->show();
     m_friendListView->filter(userIDs);
 }
index 6e83cb9..54b7164 100644 (file)
@@ -25,8 +25,6 @@
 
 #include <QtGui>
 
-#include "sidepanel.h"
-
 class QLabel;
 class QWidget;
 
@@ -41,7 +39,7 @@ class User;
 * @author Kaj Wallin - kaj.wallin (at) ixonos.com
 * @class FriendListPanel friendlistpanel.h "ui/friendlistpanel.h"
 */
-class FriendListPanel : public SidePanel
+class FriendListPanel : public QWidget
 {
     Q_OBJECT
 
diff --git a/src/ui/panelbar.cpp b/src/ui/panelbar.cpp
new file mode 100644 (file)
index 0000000..48955c3
--- /dev/null
@@ -0,0 +1,68 @@
+/*
+    Situare - A location system for Facebook
+    Copyright (C) 2010  Ixonos Plc. Authors:
+
+        Kaj Wallin - kaj.wallin@ixonos.com
+        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 <QDebug>
+#include <QPainter>
+#include <QRegion>
+
+#include "panelbar.h"
+
+#include "panelcommon.h"
+
+PanelBar::PanelBar(QWidget *parent) //, Side side)
+    : QWidget(parent)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    m_barTile.load(":/res/images/sliding_bar_tile.png");
+    m_menuDropShadowTile.load(":/res/images/menu_bar_drop_shadow.png");
+
+    m_barRect.setRect(0, 0, PANEL_BAR_WIDTH, PANEL_HEIGHT);
+
+//    m_sliderRegion = QRegion(m_buttonRect).united(QRegion(m_topRect).united(QRegion(m_bottomRect)));
+//    setMask(m_sliderRegion);
+
+    this->resize(PANEL_BAR_WIDTH, PANEL_HEIGHT);
+}
+
+void PanelBar::paintEvent(QPaintEvent *)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    QPainter painter(this);
+
+    painter.drawTiledPixmap(m_barRect, m_barTile);
+    painter.drawTiledPixmap(0, 0, PANEL_BAR_WIDTH, m_menuDropShadowTile.height(),
+                            m_menuDropShadowTile);
+}
+
+void PanelBar::resizeBar(const QSize &size)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    m_barRect.setRect(0, 0, PANEL_BAR_WIDTH, size.height());
+
+//    m_sliderRegion = QRegion(m_buttonRect).united(QRegion(m_topRect).united(QRegion(m_bottomRect)));
+//    setMask(m_sliderRegion);
+
+    this->resize(PANEL_BAR_WIDTH, size.height() - PANEL_TOP_PADDING - PANEL_BOTTOM_PADDING);
+}
diff --git a/src/ui/panelbar.h b/src/ui/panelbar.h
new file mode 100644 (file)
index 0000000..56e8240
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+    Situare - A location system for Facebook
+    Copyright (C) 2010  Ixonos Plc. Authors:
+
+        Kaj Wallin - kaj.wallin@ixonos.com
+        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 PANELBAR_H
+#define PANELBAR_H
+
+#include <QWidget>
+
+/**
+ * @brief Generic class for panel bars
+ *
+ * @author Kaj Wallin - kaj.wallin (at) ixonos.com
+ * @author Pekka Nissinen - pekka.nissinen@ixonos.com
+ *
+ * @class PanelBar panelbar.h "ui/panelbar.h"
+ */
+class PanelBar : public QWidget
+{
+    Q_OBJECT
+
+public:
+    /**
+     * @brief Constructor
+     *
+     * @param parent Parent
+     */
+    PanelBar(QWidget *parent);
+
+/*******************************************************************************
+ * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
+ ******************************************************************************/
+protected:
+    /**
+     * @brief Draws the bar
+     *
+     * @param * QPaintEvent unused
+     */
+    void paintEvent(QPaintEvent *);
+
+/*******************************************************************************
+ * MEMBER FUNCTIONS AND SLOTS
+ ******************************************************************************/
+public slots:
+    /**
+     * @brief Slot to redraw the bar after window resize event
+     *
+     * @param size Size of the new window
+     */
+    void resizeBar(const QSize &size);
+
+/*******************************************************************************
+ * DATA MEMBERS
+ ******************************************************************************/
+private:
+    QPixmap m_menuDropShadowTile;   ///< Pixmap for menu drop shadow
+    QPixmap m_barTile;              ///< Pixmap for panel bar
+
+    QRect m_barRect;                ///< Rect for the panel bar
+
+//    QRegion m_sliderRegion;             ///< Region of the slider bar
+};
+#endif // PANELBAR_H
diff --git a/src/ui/panelbase.cpp b/src/ui/panelbase.cpp
new file mode 100644 (file)
index 0000000..3771888
--- /dev/null
@@ -0,0 +1,50 @@
+/*
+    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 <QDebug>
+#include <QPainter>
+#include <QPalette>
+#include <QRect>
+
+#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 *)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    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
new file mode 100644 (file)
index 0000000..8130001
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+    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 <QPaintEvent>
+#include <QPixmap>
+#include <QWidget>
+
+/**
+ * @brief Base class for panel inner content
+ *
+ * @author Pekka Nissinen - pekka.nissinen@ixonos.com
+ *
+ * @class PanelBase panelbase.h "ui/panelbase.h"
+ */
+class PanelBase : public QWidget
+{
+    Q_OBJECT
+
+public:
+    /**
+     * @brief Constructor
+     *
+     * @param parent Parent
+     */
+    PanelBase(QWidget *parent);
+
+/*******************************************************************************
+ * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
+ ******************************************************************************/
+protected:
+    /**
+     * @brief Draws the panel content base
+     *
+     * @param * QPaintEvent unused
+     */
+    void paintEvent(QPaintEvent *);
+
+/*******************************************************************************
+ * DATA MEMBERS
+ *******************************************************************************/
+private:
+    QPixmap m_menuDropShadowTile; ///< Pixmap for menu drop shadow
+};
+
+#endif // PANELBASE_H
diff --git a/src/ui/panelcontent.cpp b/src/ui/panelcontent.cpp
new file mode 100644 (file)
index 0000000..a09eecb
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+    Situare - A location system for Facebook
+    Copyright (C) 2010  Ixonos Plc. Authors:
+
+        Kaj Wallin - kaj.wallin@ixonos.com
+        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 <QAbstractState>
+#include <QDebug>
+#include <QVBoxLayout>
+
+#include "panelcontent.h"
+
+#include "panelcommon.h"
+#include "panelbase.h"
+
+PanelContent::PanelContent(QWidget *parent)
+    : QWidget(parent)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    this->resize(PANEL_WIDTH, PANEL_HEIGHT);
+
+    m_panelVBox = new QVBoxLayout(this);
+    m_panelVBox->setMargin(0);
+    m_panelVBox->setSpacing(0);
+    m_panelVBox->setContentsMargins(USERPANEL_MARGIN_LEFT, 0, USERPANEL_MARGIN_RIGHT, 0);
+
+    m_panelBase = new PanelBase(this);
+    m_panelBase->setLayout(m_panelVBox);
+    m_panelBase->resize(this->size());
+}
+
+void PanelContent::setContentWidget(QWidget *widget)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    m_panelVBox->addWidget(widget);
+}
+
+void PanelContent::resizePanelContent(const QSize &size)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    this->resize(PANEL_WIDTH, size.height() - PANEL_TOP_PADDING - PANEL_BOTTOM_PADDING);
+
+    m_panelBase->resize(this->size());
+}
diff --git a/src/ui/panelcontent.h b/src/ui/panelcontent.h
new file mode 100644 (file)
index 0000000..de2b10c
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+    Situare - A location system for Facebook
+    Copyright (C) 2010  Ixonos Plc. Authors:
+
+        Kaj Wallin - kaj.wallin@ixonos.com
+        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 PANELCONTENT_H
+#define PANELCONTENT_H
+
+#include <QWidget>
+
+class QVBoxLayout;
+
+class PanelBase;
+
+/**
+ * @brief Base class for panel content area
+ *
+ * @author Kaj Wallin - kaj.wallin (at) ixonos.com
+ * @author Pekka Nissinen - pekka.nissinen@ixonos.com
+ *
+ * @class PanelContent panelcontent.h "ui/panelcontent.h"
+ */
+class PanelContent : public QWidget
+{
+    Q_OBJECT
+
+public:
+    /**
+     * @brief Constructor
+     *
+     * @param parent
+     */
+    PanelContent(QWidget *parent = 0);
+
+/*******************************************************************************
+ * MEMBER FUNCTIONS AND SLOTS
+ ******************************************************************************/
+public:
+    /**
+     * @brief
+     *
+     * @param
+     */
+    void setContentWidget(QWidget *widget);
+
+public slots:
+    /**
+     * @brief Slot to redraw the panel content area after window resize event
+     *
+     * @param size Size of the new window
+     */
+    void resizePanelContent(const QSize &size);
+
+/*******************************************************************************
+ * DATA MEMBERS
+ *******************************************************************************/
+private:
+    QVBoxLayout *m_panelVBox;   ///< Vertical layout inside the panel
+
+    PanelBase *m_panelBase;     ///< Widget for panel base
+};
+
+#endif // PANELCONTENT_H
diff --git a/src/ui/panelsliderbar.cpp b/src/ui/panelsliderbar.cpp
deleted file mode 100644 (file)
index fd6bf0b..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
-    Situare - A location system for Facebook
-    Copyright (C) 2010  Ixonos Plc. Authors:
-
-        Kaj Wallin - kaj.wallin@ixonos.com
-        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 <QDebug>
-#include <QPainter>
-#include <QRegion>
-
-#include "panelsliderbar.h"
-
-PanelSliderBar::PanelSliderBar(QWidget *parent, Side side)
-    : QWidget(parent)
-{
-    qDebug() << __PRETTY_FUNCTION__;
-
-    m_sliderButtonArrows[LEFT].load(":res/images/arrow_left.png");
-    m_sliderButtonArrows[RIGHT].load(":res/images/arrow_right.png");
-
-    if (side == LEFT) {
-        m_sliderSide = side;
-        m_sliderDirection = RIGHT;
-    } else if (side == RIGHT) {
-        m_sliderSide = side;
-        m_sliderDirection = LEFT;
-    } else {
-        qFatal("Illegal PanelSliderBar 2nd argument");
-    }
-
-    m_sliderTile.load(":res/images/sliding_bar_tile.png");
-    m_sliderButton.load(":res/images/sliding_bar_button.png");
-    m_menuDropShadowTile.load(":res/images/menu_bar_drop_shadow.png");
-
-    m_buttonRect.setRect(0, (SLIDER_HEIGHT / 2) - (m_sliderButton.height() / 2),
-                       SLIDER_WIDTH, m_sliderButton.height());
-    m_topRect.setRect(SLIDER_BUTTON_OFFSET, 0, SLIDER_BAR_WIDTH, m_buttonRect.top());
-    m_bottomRect.setRect(SLIDER_BUTTON_OFFSET, m_buttonRect.bottom() + 1,
-                       SLIDER_BAR_WIDTH, SLIDER_HEIGHT - m_topRect.height() - m_buttonRect.height());
-
-    m_sliderRegion = QRegion(m_buttonRect).united(QRegion(m_topRect).united(QRegion(m_bottomRect)));
-    setMask(m_sliderRegion);
-
-    resize(SLIDER_WIDTH, SLIDER_HEIGHT);
-}
-
-void PanelSliderBar::paintEvent(QPaintEvent *)
-{
-    qDebug() << __PRETTY_FUNCTION__;
-
-    QPainter painter(this);
-
-    painter.drawTiledPixmap(m_topRect, m_sliderTile);
-    painter.drawTiledPixmap(m_bottomRect, m_sliderTile);
-    painter.drawTiledPixmap(SLIDER_BUTTON_OFFSET, 0, SLIDER_BAR_WIDTH, m_menuDropShadowTile.height(),
-                            m_menuDropShadowTile);
-    painter.drawPixmap(m_buttonRect, m_sliderButton);
-    painter.drawPixmap((this->width() / 2) - (m_sliderButtonArrows[m_sliderDirection].width() / 2),
-                       (this->height() / 2) - (m_sliderButtonArrows[m_sliderDirection].height() / 2),
-                       m_sliderButtonArrows[m_sliderDirection]);
-}
-
-void PanelSliderBar::mouseReleaseEvent(QMouseEvent *)
-{
-    qDebug() << __PRETTY_FUNCTION__;
-
-    emit clicked();
-}
-
-void PanelSliderBar::changeDirection(SliderBarState state)
-{
-    qDebug() << __PRETTY_FUNCTION__;
-
-    if (state == PanelSliderBar::Open) {
-        if (m_sliderSide == LEFT)
-            m_sliderDirection = LEFT;
-        else
-            m_sliderDirection = RIGHT;
-    } else {
-        if (m_sliderSide == LEFT)
-            m_sliderDirection = RIGHT;
-        else
-            m_sliderDirection = LEFT;
-    }
-}
-
-void PanelSliderBar::resizeSliderBar(const QSize &size)
-{
-    qDebug() << __PRETTY_FUNCTION__;
-
-    m_buttonRect.setRect(0, (size.height() / 2) - (m_sliderButton.height() / 2),
-                       SLIDER_WIDTH, m_sliderButton.height());
-    m_topRect.setRect(SLIDER_BUTTON_OFFSET, 0, SLIDER_BAR_WIDTH, m_buttonRect.top());
-    m_bottomRect.setRect(SLIDER_BUTTON_OFFSET, m_buttonRect.bottom() + 1,
-                       SLIDER_BAR_WIDTH, size.height() - m_topRect.height() - m_buttonRect.height());
-
-    m_sliderRegion = QRegion(m_buttonRect).united(QRegion(m_topRect).united(QRegion(m_bottomRect)));
-    setMask(m_sliderRegion);
-
-    resize(SLIDER_WIDTH, size.height() - PANEL_TOP_PADDING - PANEL_BOTTOM_PADDING);
-}
diff --git a/src/ui/panelsliderbar.h b/src/ui/panelsliderbar.h
deleted file mode 100644 (file)
index 7ead7b1..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
-    Situare - A location system for Facebook
-    Copyright (C) 2010  Ixonos Plc. Authors:
-
-        Kaj Wallin - kaj.wallin@ixonos.com
-        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 PANELSLIDERBAR_H
-#define PANELSLIDERBAR_H
-
-#include <QMouseEvent>
-#include <QPaintEvent>
-#include <QPixmap>
-#include <QRect>
-#include <QWidget>
-
-#include "panelcommon.h"
-
-/**
- * @brief Generic class for panel slider bars
- *
- * @author Kaj Wallin - kaj.wallin (at) ixonos.com
- * @author Pekka Nissinen - pekka.nissinen@ixonos.com
- *
- * @class PanelSliderBar panelsliderbar.h "ui/panelsliderbar.h"
- */
-class PanelSliderBar : public QWidget
-{
-    Q_OBJECT
-
-public:
-    /**
-     * @brief Constructor
-     *
-     * @param parent Parent
-     * @param side Qstring for the sliderbar location. Accepts "LEFT" and "RIGHT"
-     */
-    PanelSliderBar(QWidget *parent, Side side);
-
-    /**
-     * @brief Enumerator for the slider bar state
-     * Defines values: Open, Closed
-     *
-     * @sa changeDirection
-     */
-    enum SliderBarState {Open, Closed};
-
-/*******************************************************************************
- * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
- ******************************************************************************/
-protected:
-    /**
-     * @brief Draws the slider
-     *
-     * @param * QPaintEvent unused
-     */
-    void paintEvent(QPaintEvent *);
-
-    /**
-     * @brief Mouse release event used to expand/collapse the panel
-     *
-     * @param * Event
-     *
-     * @sa clicked
-     */
-    void mouseReleaseEvent(QMouseEvent *);
-
-/*******************************************************************************
- * MEMBER FUNCTIONS AND SLOTS
- ******************************************************************************/
-public slots:
-    /**
-     * @brief Slot to change sliderbar direction
-     *
-     * @param state Current state of the panel
-     */
-    void changeDirection(SliderBarState state);
-
-    /**
-     * @brief Slot to redraw the slider bar after window resize event
-     *
-     * @param size Size of the new window
-     */
-    void resizeSliderBar(const QSize &size);
-
-/*******************************************************************************
- * SIGNALS
- ******************************************************************************/
-signals:
-    /**
-     * @brief Signal that is emitted the slider bar is clicked
-     *
-     * @sa mouseReleaseEvent
-     */
-    void clicked();
-
-/*******************************************************************************
- * DATA MEMBERS
- ******************************************************************************/
-private:
-    int m_sliderDirection;              ///< Direction of the slider bar
-
-    QPixmap m_menuDropShadowTile;       ///< Pixmap for menu drop shadow
-    QPixmap m_sliderButton;             ///< Pixmap for panel sliding bar button
-    QPixmap m_sliderButtonArrows[2];    ///< Pixmap array for panel sliding bar button arrows
-    QPixmap m_sliderTile;               ///< Pixmap for panel sliding bar
-    QRect m_bottomRect;                 ///< Rect for slider bar bottom
-    QRect m_buttonRect;                 ///< Rect for slider bar button
-    QRect m_topRect;                    ///< Rect for slider bar top
-    QRegion m_sliderRegion;             ///< Region of the slider bar
-
-    Side m_sliderSide;                  ///< Slider side
-};
-#endif // PANELSLIDERBAR_H
diff --git a/src/ui/sidepanel.cpp b/src/ui/sidepanel.cpp
deleted file mode 100644 (file)
index e3c5898..0000000
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
-    Situare - A location system for Facebook
-    Copyright (C) 2010  Ixonos Plc. Authors:
-
-        Kaj Wallin - kaj.wallin@ixonos.com
-        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 <QAbstractState>
-
-#include "sidepanel.h"
-
-#include "panelcommon.h"
-#include "panelsidebar.h"
-#include "panelsliderbar.h"
-#include "sidepanelbase.h"
-
-SidePanel::SidePanel(QWidget *parent) :
-    QWidget(parent),
-    m_isOpen(false),
-    currentType(SidePanel::None)
-{
-    qDebug() << __PRETTY_FUNCTION__;
-
-    m_panelVBox = new QVBoxLayout(this);
-    m_panelVBox->setMargin(0);
-    m_panelVBox->setSpacing(0);
-
-    m_panelBase = new SidePanelBase(this);
-    m_panelBase->setLayout(m_panelVBox);
-
-    m_panelStateMachine = new QStateMachine(this);
-    m_panelStateClosed = new QState(m_panelStateMachine);
-    m_panelStateOpened = new QState(m_panelStateMachine);
-
-    m_panelStateMachine->setInitialState(m_panelStateClosed);
-
-    m_panelTransitionOpen = m_panelStateClosed->addTransition(this, SIGNAL(toggleState()),
-                                                              m_panelStateOpened);
-    m_panelTransitionOpen->addAnimation(new QPropertyAnimation(this, "pos", this));
-
-    m_panelTransitionClose = m_panelStateOpened->addTransition(this, SIGNAL(toggleState()),
-                                                               m_panelStateClosed);
-    m_panelTransitionClose->addAnimation(new QPropertyAnimation(this, "pos", this));
-
-    connect(m_panelStateClosed, SIGNAL(entered()),
-            this, SLOT(stateChangedToClosed()));
-    connect(m_panelStateOpened, SIGNAL(entered()),
-            this, SLOT(stateChangedToOpen()));
-
-    hide();
-}
-
-void SidePanel::openPanel()
-{
-    qDebug() << __PRETTY_FUNCTION__;
-    
-    if(!m_isOpen)
-        emit toggleState();
-}
-
-void SidePanel::closePanel()
-{
-    qDebug() << __PRETTY_FUNCTION__;
-    
-    if(m_isOpen)
-        emit toggleState();
-}
-
-void SidePanel::resizePanel(const QSize &size)
-{
-    qDebug() << __PRETTY_FUNCTION__;
-
-    if(currentType == SidePanel::UserPanel) {
-        this->resize(USERPANEL_WIDTH + SLIDER_BAR_WIDTH + SLIDER_BUTTON_OFFSET,
-                     size.height() - PANEL_TOP_PADDING - PANEL_BOTTOM_PADDING);
-
-        m_panelBase->resize(USERPANEL_WIDTH,
-                            size.height() - PANEL_TOP_PADDING - PANEL_BOTTOM_PADDING);
-
-        m_panelSlidingBar->resizeSliderBar(size);
-    } else if(currentType == SidePanel::FriendPanel) {
-        this->resize(SLIDER_WIDTH + FRIENDPANEL_WIDTH,
-                     size.height() - PANEL_TOP_PADDING - PANEL_BOTTOM_PADDING);
-
-        if(!m_isOpen)
-            this->move(size.width() - SLIDER_BUTTON_OFFSET - PANEL_PEEK_AMOUNT, PANEL_TOP_PADDING);
-        else
-            this->move(size.width() - SLIDER_BUTTON_OFFSET - SLIDER_BAR_WIDTH - FRIENDPANEL_WIDTH,
-                       PANEL_TOP_PADDING);
-
-        m_panelBase->resize(FRIENDPANEL_WIDTH,
-                            size.height() - PANEL_TOP_PADDING - PANEL_BOTTOM_PADDING);
-
-        m_panelSlidingBar->resizeSliderBar(size);
-
-        m_panelStateClosed->assignProperty(this, "pos",
-                QPoint(size.width() - SLIDER_BUTTON_OFFSET - PANEL_PEEK_AMOUNT, PANEL_TOP_PADDING));
-        m_panelStateOpened->assignProperty(this, "pos",
-                QPoint(size.width() - SLIDER_BUTTON_OFFSET - SLIDER_BAR_WIDTH - FRIENDPANEL_WIDTH,
-                       PANEL_TOP_PADDING));
-    } else {
-        qFatal("Illegal panel type in SidePanel::screenResized");
-    }
-}
-
-void SidePanel::setType(SidePanel::PanelType type)
-{
-    qDebug() << __PRETTY_FUNCTION__;
-
-    if(currentType == SidePanel::None) {
-        if(type == SidePanel::UserPanel) {
-            currentType = type;
-            setObjectName("UserPanel");
-
-            this->resize(USERPANEL_WIDTH + SLIDER_BAR_WIDTH + SLIDER_BUTTON_OFFSET,
-                         USERPANEL_HEIGHT);
-            this->move(USERPANEL_CLOSED_X, PANEL_TOP_PADDING);
-
-            m_panelBase->resize(USERPANEL_WIDTH, SLIDER_HEIGHT);
-
-            m_panelSlidingBar = new PanelSliderBar(this, LEFT);
-            m_panelSlidingBar->move(USERPANEL_WIDTH - SLIDER_BUTTON_OFFSET, 0);
-
-            connect(m_panelSlidingBar, SIGNAL(clicked()),
-                    this, SIGNAL(toggleState()));
-
-            m_panelStateClosed->assignProperty(this, "pos",
-                                               QPoint(USERPANEL_CLOSED_X, PANEL_TOP_PADDING));
-            m_panelStateOpened->assignProperty(this, "pos",
-                                               QPoint(USERPANEL_OPENED_X, PANEL_TOP_PADDING));
-        } else if (type == SidePanel::FriendPanel) {
-            currentType = type;
-            setObjectName("FriendPanel");
-
-            this->resize(SLIDER_BUTTON_OFFSET + SLIDER_BAR_WIDTH + FRIENDPANEL_WIDTH,
-                         FRIENDPANEL_HEIGHT);
-            this->move(FRIENDPANEL_CLOSED_X, PANEL_TOP_PADDING);
-
-            m_panelBase->resize(FRIENDPANEL_WIDTH, FRIENDPANEL_HEIGHT);
-            m_panelBase->move(SLIDER_BUTTON_OFFSET + SLIDER_BAR_WIDTH, 0);
-
-            m_panelSlidingBar = new PanelSliderBar(this, RIGHT);
-
-            connect(m_panelSlidingBar, SIGNAL(clicked()),
-                    this, SIGNAL(toggleState()));
-
-            m_panelStateClosed->assignProperty(this, "pos",
-                                               QPoint(FRIENDPANEL_CLOSED_X, PANEL_TOP_PADDING));
-            m_panelStateOpened->assignProperty(this, "pos",
-                                               QPoint(FRIENDPANEL_OPENED_X, PANEL_TOP_PADDING));
-        } else {
-            qWarning() << "In" << __PRETTY_FUNCTION__ << ":" << type;
-            qFatal("Illegal type set for SidePanel::setType");
-        }
-        m_panelStateMachine->start();
-        show();
-    } else {
-        qWarning() << "Illegally tried to set type multiple times at SidePanel::setType";
-    }
-}
-
-void SidePanel::stateChangedToClosed()
-{
-    qDebug() << __PRETTY_FUNCTION__;
-
-    m_isOpen = false;
-    emit panelClosed();
-
-    m_panelSlidingBar->changeDirection(PanelSliderBar::Closed);
-}
-
-void SidePanel::stateChangedToOpen()
-{
-    qDebug() << __PRETTY_FUNCTION__;
-    
-    m_isOpen = true;
-    emit panelOpened();
-
-    m_panelSlidingBar->changeDirection(PanelSliderBar::Open);
-}
diff --git a/src/ui/sidepanel.h b/src/ui/sidepanel.h
deleted file mode 100644 (file)
index 072deb5..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
-    Situare - A location system for Facebook
-    Copyright (C) 2010  Ixonos Plc. Authors:
-
-        Kaj Wallin - kaj.wallin@ixonos.com
-        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 SIDEPANEL_H
-#define SIDEPANEL_H
-
-#include <QWidget>
-#include <QtGui>
-
-class PanelSliderBar;
-class SidePanelBase;
-
-/**
- * @brief Base class for sliding side panels
- *
- * @author Kaj Wallin - kaj.wallin (at) ixonos.com
- * @author Pekka Nissinen - pekka.nissinen@ixonos.com
- *
- * @class SidePanel sidepanel.h "ui/sidepanel.h"
- */
-class SidePanel : public QWidget
-{
-    Q_OBJECT
-
-public:
-    /**
-     * @brief Constructor
-     *
-     * @param parent
-     */
-    SidePanel(QWidget *parent = 0);
-
-    /**
-     * @brief Enumerator for the panel type
-     * Defines values: UserPanel, FriendPanel, None
-     *
-     * @sa setType
-     */
-    enum PanelType {UserPanel, FriendPanel, None};
-
-/******************************************************************************
- * MEMBER FUNCTIONS AND SLOTS
- ******************************************************************************/
-public:
-    /**
-     * @brief Type setter for the panel. Also sets panel visible
-     *
-     * Use to set panel type as UserPanel or FriendPanel. Panel type determines
-     * which side the panel will be rendered. UserPanel will always be rendered
-     * on the left side of the screen and FriendPanel on the right side. Type
-     * cannot be set twice.
-     *
-     * @param type Type of the panel, either UserPanel or FriendPanel
-     * @sa PanelType
-     */
-    void setType(SidePanel::PanelType type);
-
-public slots:
-    /**
-     * @brief Public slot that will open the panel unless already open
-     */
-    void openPanel();
-
-    /**
-     * @brief Public slot that will close the panel unless already closed
-     */
-    void closePanel();
-
-    /**
-     * @brief Slot to redraw the panel after window resize event
-     *
-     * @param size Size of the new window
-     */
-    void resizePanel(const QSize &size);
-
-private slots:
-    /**
-     * @brief Internal slot used to track statemachine state
-     */
-    void stateChangedToClosed();
-
-    /**
-     * @brief Internal slot used to track statemachine state
-     */
-    void stateChangedToOpen();
-
-/******************************************************************************
- * SIGNALS
- ******************************************************************************/
-signals:
-    /**
-     * @brief Signal that is sent to state machine when state must be changed
-     *
-     * @sa openPanel
-     * @sa closePanel
-     */
-    void toggleState();
-
-    /**
-     * @brief Signal that is sent when panel is closed
-     *
-     * @sa openPanel
-     * @sa closePanel
-     */
-    void panelClosed();
-
-    /**
-     * @brief Signal that is sent when panel is opened
-     *
-     * @sa openPanel
-     * @sa closePanel
-     */
-    void panelOpened();
-
-/*******************************************************************************
- * DATA MEMBERS
- *******************************************************************************/
-protected:
-    QVBoxLayout *m_panelVBox; ///< Vertical layout inside the panel
-
-private:
-    bool m_isOpen; ///< Boolean used to track the current state of the statemachine
-
-    QSignalTransition *m_panelTransitionClose;  ///< Transition signal for closing the panel
-    QSignalTransition *m_panelTransitionOpen;   ///< Transition signal for opening the panel
-    QState *m_panelStateClosed;                 ///< State of the closed panel
-    QState *m_panelStateOpened;                 ///< State of the opened panel
-    QStateMachine *m_panelStateMachine;         ///< State machine for sliding the panel
-
-    SidePanelBase *m_panelBase;         ///< Widget for panel base
-    PanelType currentType;              ///< Holder for the type of this panel
-    PanelSliderBar *m_panelSlidingBar;  ///< Widget for panel sliding bar item
-};
-
-#endif // SIDEPANEL_H
diff --git a/src/ui/sidepanelbase.cpp b/src/ui/sidepanelbase.cpp
deleted file mode 100644 (file)
index c999a6e..0000000
+++ /dev/null
@@ -1,50 +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 <QDebug>
-#include <QPainter>
-#include <QPalette>
-#include <QRect>
-
-#include "sidepanelbase.h"
-
-SidePanelBase::SidePanelBase(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 SidePanelBase::paintEvent(QPaintEvent *)
-{
-    qDebug() << __PRETTY_FUNCTION__;
-
-    QPainter painter(this);
-
-    QRect shadowRect = QRect(0, 0, this->rect().width(), m_menuDropShadowTile.height());
-    painter.drawTiledPixmap(shadowRect, m_menuDropShadowTile);
-}
diff --git a/src/ui/sidepanelbase.h b/src/ui/sidepanelbase.h
deleted file mode 100644 (file)
index 7011f27..0000000
+++ /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 SIDEPANELBASE_H
-#define SIDEPANELBASE_H
-
-#include <QPaintEvent>
-#include <QPixmap>
-#include <QWidget>
-
-/**
- * @brief Base class for panel inner content
- *
- * @author Pekka Nissinen - pekka.nissinen@ixonos.com
- *
- * @class SidePanelBase sidepanelbase.h "ui/sidepanelbase.h"
- */
-class SidePanelBase : public QWidget
-{
-    Q_OBJECT
-
-public:
-    /**
-     * @brief Constructor
-     *
-     * @param parent Parent
-     */
-    SidePanelBase(QWidget *parent);
-
-/*******************************************************************************
- * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
- ******************************************************************************/
-protected:
-    /**
-     * @brief Draws the panel content base
-     *
-     * @param * QPaintEvent unused
-     */
-    void paintEvent(QPaintEvent *);
-
-/*******************************************************************************
- * DATA MEMBERS
- *******************************************************************************/
-private:
-    QPixmap m_menuDropShadowTile; ///< Pixmap for menu drop shadow
-};
-
-#endif // SIDEPANELBASE_H
diff --git a/src/ui/tabbedpanel.cpp b/src/ui/tabbedpanel.cpp
new file mode 100644 (file)
index 0000000..e14edcf
--- /dev/null
@@ -0,0 +1,207 @@
+/*
+    Situare - A location system for Facebook
+    Copyright (C) 2010  Ixonos Plc. Authors:
+
+        Kaj Wallin - kaj.wallin@ixonos.com
+        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 <QButtonGroup>
+#include <QDebug>
+#include <QPainter>
+#include <QRegion>
+
+#include "tabbedpanel.h"
+
+#include "panelbar.h"
+#include "panelbase.h"
+#include "panelcontent.h"
+#include "paneltab.h"
+#include "userinfo.h"
+
+enum Tab {USER_INFO, FRIEND_LIST, ROUTING};
+
+TabbedPanel::TabbedPanel(QWidget *parent)
+    : QWidget(parent),
+      m_isOpen(false),
+      m_activeTab(-1)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    this->resize(PANEL_BAR_TABBED_WIDTH + PANEL_WIDTH, PANEL_HEIGHT);
+    this->move(PANEL_CLOSED_X, PANEL_TOP_PADDING);
+
+    // --- TABS ---
+    m_panelWidgetStack = new QStackedWidget(this);
+
+    m_tabButtonGroup = new QButtonGroup(this);
+
+    connect(m_tabButtonGroup, SIGNAL(buttonPressed(int)),
+            this, SLOT(setActiveTab(int)));
+
+    // --- BAR ---
+    m_panelBar = new PanelBar(this);
+    m_panelBar->move(PANEL_TAB_WIDTH, 0);
+
+    // --- PANEL CONTENT ---
+    m_panelContent = new PanelContent(this);
+    m_panelContent->setContentWidget(m_panelWidgetStack);
+    m_panelContent->move(PANEL_TAB_WIDTH + PANEL_BAR_WIDTH, 0);
+
+    // --- STATE MACHINE ---
+    m_panelStateMachine = new QStateMachine(this);
+    m_panelStateClosed = new QState(m_panelStateMachine);
+    m_panelStateOpened = new QState(m_panelStateMachine);
+
+    m_panelStateMachine->setInitialState(m_panelStateClosed);
+
+    m_panelTransitionOpen = m_panelStateClosed->addTransition(this, SIGNAL(toggleState()),
+                                                              m_panelStateOpened);
+    m_panelTransitionOpen->addAnimation(new QPropertyAnimation(this, "pos", this));
+
+    m_panelTransitionClose = m_panelStateOpened->addTransition(this, SIGNAL(toggleState()),
+                                                               m_panelStateClosed);
+    m_panelTransitionClose->addAnimation(new QPropertyAnimation(this, "pos", this));
+
+    connect(m_panelStateClosed, SIGNAL(entered()),
+            this, SLOT(stateChangedToClosed()));
+    connect(m_panelStateOpened, SIGNAL(entered()),
+            this, SLOT(stateChangedToOpen()));
+
+    m_panelStateClosed->assignProperty(this, "pos",
+                                       QPoint(PANEL_CLOSED_X, PANEL_TOP_PADDING));
+    m_panelStateOpened->assignProperty(this, "pos",
+                                       QPoint(PANEL_OPENED_X, PANEL_TOP_PADDING));
+
+    m_panelStateMachine->start();
+}
+
+int TabbedPanel::addTab(QWidget *widget, const QIcon& icon)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    return insertTab(-1, widget, icon);
+}
+
+int TabbedPanel::insertTab(int index, QWidget *widget, const QIcon& icon)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    if(!widget)
+        return -1;
+
+    int verticalStartPoint = 8;
+
+    index = m_panelWidgetStack->insertWidget(index, widget);
+    m_tabButtonGroup->addButton(new PanelTab(this), index);
+    m_tabButtonGroup->button(index)->setIcon(icon);
+
+    // [BEGIN]: Purkkaa (to be removed ASAP!!!)
+    if(index > 0)
+        verticalStartPoint += 65 * index;
+
+    m_tabButtonGroup->button(index)->move(0, verticalStartPoint);
+    // [END]: Purkkaa
+
+    return index;
+}
+
+void TabbedPanel::removeTab(int index)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    if(QWidget *widget = m_panelWidgetStack->widget(index)) {
+        m_panelWidgetStack->removeWidget(widget);
+
+        QAbstractButton *tab = m_tabButtonGroup->button(index);
+        m_tabButtonGroup->removeButton(tab);
+        delete tab;
+    }
+}
+
+void TabbedPanel::closePanel()
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    if(m_isOpen)
+        emit toggleState();
+}
+
+void TabbedPanel::openPanel()
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    if(!m_isOpen)
+        emit toggleState();
+}
+
+void TabbedPanel::setActiveTab(int index)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    if(m_activeTab == -1) {
+        m_activeTab = index;
+        m_panelWidgetStack->setCurrentIndex(index);
+        emit toggleState();
+    } else if(m_activeTab == index) {
+        m_activeTab = -1;
+        emit toggleState();
+    } else {
+        m_activeTab = index;
+        m_panelWidgetStack->setCurrentIndex(index);
+    }
+}
+
+void TabbedPanel::resizePanel(const QSize &size)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    this->resize(PANEL_BAR_TABBED_WIDTH + PANEL_WIDTH,
+                 size.height() - PANEL_TOP_PADDING - PANEL_BOTTOM_PADDING);
+
+    if(!m_isOpen)
+        this->move(size.width() - PANEL_TAB_WIDTH - PANEL_BAR_WIDTH, PANEL_TOP_PADDING);
+    else
+        this->move(size.width() - PANEL_TAB_WIDTH - PANEL_BAR_WIDTH - PANEL_WIDTH,
+                   PANEL_TOP_PADDING);
+
+    m_panelBar->resizeBar(size);
+
+    m_panelContent->resizePanelContent(size);
+
+    m_panelStateClosed->assignProperty(this, "pos",
+                        QPoint(size.width() - PANEL_TAB_WIDTH - PANEL_BAR_WIDTH, PANEL_TOP_PADDING));
+    m_panelStateOpened->assignProperty(this, "pos",
+                        QPoint(size.width() - PANEL_TAB_WIDTH - PANEL_BAR_WIDTH - PANEL_WIDTH,
+                               PANEL_TOP_PADDING));
+}
+
+void TabbedPanel::stateChangedToClosed()
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    m_isOpen = false;
+    emit panelClosed();
+}
+
+void TabbedPanel::stateChangedToOpen()
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    m_isOpen = true;
+    emit panelOpened();
+}
diff --git a/src/ui/tabbedpanel.h b/src/ui/tabbedpanel.h
new file mode 100644 (file)
index 0000000..a0063d5
--- /dev/null
@@ -0,0 +1,196 @@
+/*
+    Situare - A location system for Facebook
+    Copyright (C) 2010  Ixonos Plc. Authors:
+
+        Kaj Wallin - kaj.wallin@ixonos.com
+        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 TABBEDPANEL_H
+#define TABBEDPANEL_H
+
+#include <QWidget>
+
+#include "panelcommon.h"
+
+class QButtonGroup;
+class QMouseEvent;
+class QPaintEvent;
+class QPixmap;
+class QRect;
+class QSignalTransition;
+class QStackedWidget;
+class QState;
+class QStateMachine;
+
+class PanelBar;
+class PanelBase;
+class PanelContent;
+
+/**
+ * @brief Class for tabbed panels
+ *
+ * @author Kaj Wallin - kaj.wallin (at) ixonos.com
+ * @author Pekka Nissinen - pekka.nissinen@ixonos.com
+ *
+ * @class TabbedPanel tabbedpanel.h "ui/tabbedpanel.h"
+ */
+class TabbedPanel : public QWidget
+{
+    Q_OBJECT
+
+public:
+    /**
+     * @brief Constructor
+     *
+     * @param parent Parent
+     */
+    TabbedPanel(QWidget *parent);
+
+/*******************************************************************************
+ * MEMBER FUNCTIONS AND SLOTS
+ ******************************************************************************/
+public:
+    /**
+     * @brief Adds a tab to the panel
+     *
+     * Adds a tab with the given widget and icon into the tabbed panel and returns the index of the
+     * inserted tab.
+     *
+     * @param widget Widget to be added into the tab
+     * @param icon Icon of the tab
+     */
+    int addTab(QWidget *widget, const QIcon& icon);
+
+    /**
+     * @brief Inserts a tab to the panel
+     *
+     * Inserts a tab with the given widget and icon into the tabbed panel at the specified index,
+     * and returns the index of the inserted tab.
+     *
+     * If index is out of range, the tab is simply appended. Otherwise it is inserted at the
+     * specified position.
+     *
+     * @param index Index of the tab
+     * @param widget Widget to be inserted into the tab
+     * @param icon Icon of the tab
+     */
+    int insertTab(int index, QWidget *widget, const QIcon& icon);
+
+    /**
+     * @brief Removes a tab from the panel
+     *
+     * Removes a tab and its widget from the panel at index position. The widget itself is not
+     * deleted.
+     *
+     * TODO: Fix tab drawing order
+     *
+     * @param index Index of the tab
+     */
+    void removeTab(int index);
+
+public slots:
+    /**
+     * @brief Public slot that will close the panel unless already closed
+     */
+    void closePanel();
+
+    /**
+     * @brief Public slot that will open the panel unless already open
+     */
+    void openPanel();
+
+    /**
+     * @brief Sets the tab at given index active
+     *
+     * @param index Index of the tab
+     */
+    void setActiveTab(int index);
+
+    /**
+     * @brief Slot to redraw the panel after window resize event
+     *
+     * @param size Size of the new window
+     */
+    void resizePanel(const QSize &size);
+
+private slots:
+    /**
+     * @brief Internal slot used to track statemachine state
+     */
+    void stateChangedToClosed();
+
+    /**
+     * @brief Internal slot used to track statemachine state
+     */
+    void stateChangedToOpen();
+
+/*******************************************************************************
+ * SIGNALS
+ ******************************************************************************/
+signals:
+    /**
+     * @brief Signal that is sent when panel is closed
+     *
+     * @sa openPanel
+     * @sa closePanel
+     */
+    void panelClosed();
+
+    /**
+     * @brief Signal that is sent when panel is opened
+     *
+     * @sa openPanel
+     * @sa closePanel
+     */
+    void panelOpened();
+
+    /**
+     * @brief Signal that is sent to state machine when state must be changed
+     *
+     * @sa openPanel
+     * @sa closePanel
+     */
+    void toggleState();
+
+/*******************************************************************************
+ * DATA MEMBERS
+ ******************************************************************************/
+private:
+    bool m_isOpen;      ///< Boolean used to track the current state of the statemachine
+
+    int m_activeTab;    ///< Index of a active tab
+
+    QButtonGroup *m_tabButtonGroup;
+
+    QSignalTransition *m_panelTransitionClose;  ///< Transition signal for closing the panel
+    QSignalTransition *m_panelTransitionOpen;   ///< Transition signal for opening the panel
+
+    QStackedWidget *m_panelWidgetStack;         ///< Stack for panel widgets
+
+    QState *m_panelStateClosed;                 ///< State of the closed panel
+    QState *m_panelStateOpened;                 ///< State of the opened panel
+
+    QStateMachine *m_panelStateMachine;         ///< State machine for sliding the panel
+
+    PanelBar *m_panelBar;                       ///< Widget for panel bar
+    PanelBase *m_panelBase;                     ///< Widget for panel base
+    PanelContent *m_panelContent;               ///< Widget for panel content
+};
+
+#endif // TABBEDPANEL_H