Added some graphics to the panels. Very rudimentary implementation at
authorKaj Wallin <kaj.wallin@ixonos.com>
Fri, 7 May 2010 10:52:32 +0000 (13:52 +0300)
committerKaj Wallin <kaj.wallin@ixonos.com>
Fri, 7 May 2010 10:52:32 +0000 (13:52 +0300)
this point.

Reviewed by:

src/src.pro
src/ui/mapviewscreen.cpp
src/ui/panelsidebar.cpp [new file with mode: 0644]
src/ui/panelsidebar.h [new file with mode: 0644]
src/ui/userpanel.cpp
src/ui/userpanel.h

index 22ebbde..b6c6233 100644 (file)
@@ -38,7 +38,8 @@ SOURCES += main.cpp \
     ui/settingsdialog.cpp \
     map/maptilerequest.cpp \
     ui/friendlistpanel.cpp \
-    ui/userpanel.cpp
+    ui/userpanel.cpp \
+    ui/panelsidebar.cpp
 HEADERS += ui/mainwindow.h \
     ui/mapviewscreen.h \
     ui/listviewscreen.h \
@@ -74,7 +75,8 @@ HEADERS += ui/mainwindow.h \
     map/maptilerequest.h \
     ui/friendlistpanel.h \
     ui/userpanel.h \
-    ui/panelcommon.h
+    ui/panelcommon.h \
+    ui/panelsidebar.h
 QT += network \
     webkit
 DEFINES += QT_NO_DEBUG_OUTPUT
index a2f2580..54517e1 100644 (file)
@@ -28,6 +28,8 @@
 #include "userpanel.h"
 #include "panelcommon.h"
 
+#include "panelsidebar.h"
+
 MapViewScreen::MapViewScreen(QWidget *parent)
    : QWidget(parent)
 {
@@ -37,6 +39,8 @@ MapViewScreen::MapViewScreen(QWidget *parent)
 
     FriendListPanel *friendsListPanel = new FriendListPanel(this);
     UserInfoPanel *userPanel = new UserInfoPanel(this);
+    PanelSideBar *userPanelSidebar = new PanelSideBar(this, "left");
+    PanelSideBar *friendsListPanelSidebar = new PanelSideBar(this, "right");
 
     connect(mapView, SIGNAL(viewScrolled(QPoint)),
             mapEngine, SLOT(setLocation(QPoint)));
@@ -58,6 +62,9 @@ MapViewScreen::MapViewScreen(QWidget *parent)
             friendsListPanel, SLOT(reDrawFriendsPanel(int,int)));
     connect(mapView, SIGNAL(viewResizedNewSize(int,int)),
             userPanel, SLOT(reDrawUserPanel(int,int)));
+    connect(mapView, SIGNAL(viewResizedNewSize(int,int)),
+            friendsListPanelSidebar, SLOT(reDrawSidebar(int,int)));
+
 
     connect(this, SIGNAL(SIG_friendsLocationsReady(QList<User*>&)),
             friendsListPanel, SLOT(friendInfoReceived(QList<User*>&)));
@@ -90,7 +97,9 @@ MapViewScreen::MapViewScreen(QWidget *parent)
     osmLicense->resize(osmLicense->fontMetrics().width(OSM_LICENSE),
                        osmLicense->fontMetrics().height());
 
-    userPanel->stackUnder(friendsListPanel);
+    friendsListPanel->stackUnder(friendsListPanelSidebar);
+    userPanelSidebar->stackUnder(friendsListPanel);
+    userPanel->stackUnder(userPanelSidebar);
     osmLicense->stackUnder(userPanel);
     mapView->stackUnder(osmLicense);
 
diff --git a/src/ui/panelsidebar.cpp b/src/ui/panelsidebar.cpp
new file mode 100644 (file)
index 0000000..1865933
--- /dev/null
@@ -0,0 +1,64 @@
+ /*
+    Situare - A location system for Facebook
+    Copyright (C) 2010  Ixonos Plc. Authors:
+
+        Kaj Wallin - kaj.wallin@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 <QtGui>
+#include "panelsidebar.h"
+#include "panelcommon.h"
+
+PanelSideBar::PanelSideBar(QWidget *parent, QString side)
+    : QWidget(parent)
+{
+    if(side == "left") {
+        this->setObjectName("SidePanelLeft");
+        this->setStyleSheet(QString(
+                "#SidePanelLeft{background-image: url(:/res/images/side_bar_left.png)}"));
+        this->move(QPoint(0,0));
+    }
+    else if(side == "right"){
+        this->setObjectName("SidePanelRight");
+        this->setStyleSheet(QString(
+                "#SidePanelRight{background-image: url(:/res/images/side_bar_right.png)}"));
+        this->move(QPoint(851-21,0));
+    }
+    else {
+        qFatal("Illegal PanelSideBar 2nd argument");
+    }
+    this->resize(23,424);
+    this->setAttribute(Qt::WA_TransparentForMouseEvents, true);
+}
+
+void PanelSideBar::paintEvent(QPaintEvent *)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    QStyleOption option;
+    option.init(this);
+
+    QStylePainter painter(this);
+    style()->drawPrimitive(QStyle::PE_Widget, &option, &painter, this);
+}
+
+void PanelSideBar::reDrawSidebar(int width, int height)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+    if(this->objectName() == "left");
+    this->move(width-21,0);
+}
diff --git a/src/ui/panelsidebar.h b/src/ui/panelsidebar.h
new file mode 100644 (file)
index 0000000..51671b4
--- /dev/null
@@ -0,0 +1,58 @@
+ /*
+    Situare - A location system for Facebook
+    Copyright (C) 2010  Ixonos Plc. Authors:
+
+        Kaj Wallin - kaj.wallin@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 PANELSIDEBAR_H
+#define PANELSIDEBAR_H
+
+#include <QWidget>
+
+class PanelSideBar : public QWidget
+{
+    Q_OBJECT
+
+public:
+    PanelSideBar(QWidget *parent, QString side);
+
+/*******************************************************************************
+ * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
+ ******************************************************************************/
+protected:
+    /**
+    * @brief Draws stylesheet used in this class.
+    *
+    * @param * QPaintEvent unused
+    */
+    void paintEvent(QPaintEvent *);
+
+/*******************************************************************************
+ * MEMBER FUNCTIONS AND SLOTS
+ ******************************************************************************/
+public slots:
+    /**
+    * @brief Slot to redraw the sidebar after window resize event
+    *
+    * @param width Width of the window after resize
+    * @param height Height of the window after resize
+    */
+    void reDrawSidebar(int width, int height);
+};
+
+#endif // PANELSIDEBAR_H
index 92e3b6e..3e8913f 100644 (file)
@@ -33,10 +33,15 @@ UserInfoPanel::UserInfoPanel(QWidget *parent)
     m_userPanelVBox->addWidget(m_userPanelExpandButton);
     m_userPanelVBox->addWidget(m_userPanelLabel);
 
-    this->setAutoFillBackground(true);
+ //   this->setAutoFillBackground(true);
 //    this->setAttribute(Qt::WA_TranslucentBackground);
 //    this->setWindowOpacity(0.5); //DEFUNCT
 
+//    QPalette userPanelPalette;
+//    userPanelPalette.setBrush(this->backgroundRole(),
+//                              QBrush(QImage(":/res/personal_info_bckgrnd.png")));
+//    this->setPalette(userPanelPalette);
+
     m_userPanelStateMachine = new QStateMachine(this);
     m_userPanelStateClosed = new QState(m_userPanelStateMachine);
     m_userPanelStateClosed->assignProperty(this, "pos", QPoint(
@@ -56,6 +61,9 @@ UserInfoPanel::UserInfoPanel(QWidget *parent)
     m_userPanelTransitionClose->addAnimation(new QPropertyAnimation(this, "pos"));
 
     m_userPanelStateMachine->start();
+    this->setObjectName("UserPanel");
+    this->setStyleSheet(QString(
+            "#UserPanel{background-image: url(:/res/images/personal_info_bckgrnd.png)}"));
 }
 
 void UserInfoPanel::reDrawUserPanel(int width, int height)
@@ -64,3 +72,14 @@ void UserInfoPanel::reDrawUserPanel(int width, int height)
     Q_UNUSED(width);
     this->resize(USERPANEL_WIDTH,height + MARGIN_CORRECTION);
 }
+
+void UserInfoPanel::paintEvent(QPaintEvent *)
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    QStyleOption option;
+    option.init(this);
+
+    QStylePainter painter(this);
+    style()->drawPrimitive(QStyle::PE_Widget, &option, &painter, this);
+}
index 2e25ba7..2629864 100644 (file)
@@ -43,6 +43,17 @@ public:
     UserInfoPanel(QWidget *parent = 0);
 
 /*******************************************************************************
+ * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
+ ******************************************************************************/
+protected:
+    /**
+    * @brief Draws stylesheet used in this class.
+    *
+    * @param * QPaintEvent unused
+    */
+    void paintEvent(QPaintEvent *);
+
+/*******************************************************************************
  * MEMBER FUNCTIONS AND SLOTS
  ******************************************************************************/
 public slots: