Updated list_item images with new ones.
authorJussi Laitinen <jupe@l3l7588.ixonos.local>
Fri, 7 May 2010 12:38:29 +0000 (15:38 +0300)
committerJussi Laitinen <jupe@l3l7588.ixonos.local>
Fri, 7 May 2010 12:38:29 +0000 (15:38 +0300)
12 files changed:
res/images/list_item.png
res/images/list_item_bottom.png
res/images/list_item_middle.png
res/images/list_item_top.png
src/situareservice/situareservice.cpp
src/src.pro
src/ui/friendlistitem.cpp
src/ui/friendlistitem.h
src/ui/friendlistpanel.cpp
src/ui/friendlistpanel.h
src/ui/mapviewscreen.cpp
src/ui/panelcommon.h

index 84c9466..9ecf8fd 100755 (executable)
Binary files a/res/images/list_item.png and b/res/images/list_item.png differ
index 7dde747..20af095 100755 (executable)
Binary files a/res/images/list_item_bottom.png and b/res/images/list_item_bottom.png differ
index 41eddde..7ed13d1 100755 (executable)
Binary files a/res/images/list_item_middle.png and b/res/images/list_item_middle.png differ
index e3b946b..b717b30 100755 (executable)
Binary files a/res/images/list_item_top.png and b/res/images/list_item_top.png differ
index fdd9714..abd8ac8 100644 (file)
@@ -221,7 +221,8 @@ void SituareService::requestFinished(QNetworkReply *reply)
         }
         else if(replyArray == "") {
             qDebug() << "No error, update was successful";
-            emit updateWasSuccessful();
+            if (url.toString().contains(UPDATE_LOCATION.toAscii()))
+                emit updateWasSuccessful();
         }
         else {
             // Street address ready
index 22ebbde..f53c88c 100644 (file)
@@ -77,7 +77,7 @@ HEADERS += ui/mainwindow.h \
     ui/panelcommon.h
 QT += network \
     webkit
-DEFINES += QT_NO_DEBUG_OUTPUT
+#DEFINES += QT_NO_DEBUG_OUTPUT
 !maemo5 { 
     message(QJson built in)
     message(Make sure you have QJson development headers installed)
index 24b76c7..eb3e8e3 100644 (file)
@@ -35,9 +35,9 @@
 #include "../user/user.h"
 
 const QString BACKGROUND_PATH = ":/res/images/list_item.png";   ///< Background image path
-const QString BACKGROUND_TOP_PATH = ":/res/images/list_item_top.png";   ///< Background image path
-const QString BACKGROUND_MIDDLE_PATH = ":/res/images/list_item_middle.png";   ///< Background image path
-const QString BACKGROUND_BOTTOM_PATH = ":/res/images/list_item_bottom.png";   ///< Background image path
+//const QString BACKGROUND_TOP_PATH = ":/res/images/list_item_top.png";   ///< Background image path
+//const QString BACKGROUND_MIDDLE_PATH = ":/res/images/list_item_middle.png";   ///< Background image path
+//const QString BACKGROUND_BOTTOM_PATH = ":/res/images/list_item_bottom.png";   ///< Background image path
 const QString CLOCK_PATH = ":/res/images/clock.png";        ///< Clock image path
 const QString COMPASS_PATH = ":/res/images/compass.png";    ///< Compass image path
 const QString ENVELOPE_PATH = ":/res/images/envelope.png";  ///< Envelope image path
@@ -64,8 +64,8 @@ const QFont NOKIA_FONT_SMALL = QFont( "Nokia Sans", 13, QFont::Normal);     ///<
 */
 const QString STYLESHEET = "QWidget#listItem { border-image: url(:/res/images/list_item.png) 20%; " \
                            "border-width: 20px 14px 16px 14px; } " \
-                           "QLabel { color: #989898; }" \
-                           "#nameLabel { color: #ffffff }";
+                           "QLabel { font-size: 13pt; color: #989898; }" \
+                           "#nameLabel { font-size: 18pt; color: #ffffff }";
 
 FriendListItem::FriendListItem(QWidget *parent)
     : QWidget(parent)
@@ -131,10 +131,14 @@ FriendListItem::FriendListItem(QWidget *parent)
 
     setFont(NOKIA_FONT_SMALL);
 
-    setStyleSheet(STYLESHEET);
+//    setStyleSheet(STYLESHEET);
 
     setMinimumSize(ITEM_MIN_WIDTH, ITEM_MIN_HEIGHT);
     setMaximumSize(ITEM_MIN_WIDTH, ITEM_MAX_HEIGHT);
+
+    BACKGROUND_TOP_PATH.load(":/res/images/list_item_top.png");   ///< Background image path
+    BACKGROUND_MIDDLE_PATH.load(":/res/images/list_item_middle.png");   ///< Background image path
+    BACKGROUND_BOTTOM_PATH.load(":/res/images/list_item_bottom.png");   ///< Background image path
 }
 
 void FriendListItem::setData(User *user)
@@ -236,12 +240,28 @@ void FriendListItem::mouseReleaseEvent(QMouseEvent *event)
 
 void FriendListItem::paintEvent(QPaintEvent *event)
 {
-//    qDebug() << __PRETTY_FUNCTION__ << " " << event->rect();
-    Q_UNUSED(event);
+    qDebug() << __PRETTY_FUNCTION__ << " " << event->rect();
+
+    QPainter painter(this);
+
+//        QRect topRect = QRect(event->rect().left(), event->rect().y(), event->rect().width(), 20);
+//        QRect middleRect = QRect(topRect.left(), topRect.bottom() + 1, event->rect().width(),
+//                                 event->rect().height() - 20 - 15);
+//        QRect bottomRect = QRect(topRect.left(), middleRect.bottom() + 1, event->rect().width(),
+//                                 15);
+
+    int height = event->rect().height();
+
+    if (event->rect().height() < 148)
+        height = 148;
 
-    QStyleOption option;
-    option.init(this);
+    QRect topRect = QRect(0, 0, event->rect().width(), 20);
+    QRect middleRect = QRect(0, topRect.bottom() + 1, event->rect().width(),
+                             height - 20 - 15);
+    QRect bottomRect = QRect(topRect.left(), middleRect.bottom() + 1, event->rect().width(),
+                             15);
 
-    QStylePainter painter(this);
-    style()->drawPrimitive(QStyle::PE_Widget, &option, &painter, this);
+    painter.drawPixmap(topRect, BACKGROUND_TOP_PATH);
+    painter.drawPixmap(middleRect, BACKGROUND_MIDDLE_PATH);
+    painter.drawPixmap(bottomRect, BACKGROUND_BOTTOM_PATH);
 }
index f5b6536..f4ab453 100644 (file)
@@ -119,6 +119,10 @@ private:
     QLabel *m_updatedLabel;         ///< Updated label
 
     User *m_user;                    ///< User data
+
+    QPixmap BACKGROUND_TOP_PATH;   ///< Background image path
+    QPixmap BACKGROUND_MIDDLE_PATH;   ///< Background image path
+    QPixmap BACKGROUND_BOTTOM_PATH;   ///< Background image path
 };
 
 #endif // FRIENDLISTITEM_H
index 830f0e2..d61c9a5 100644 (file)
@@ -29,6 +29,8 @@ FriendListPanel::FriendListPanel(QWidget *parent)
 {
     qDebug() << __PRETTY_FUNCTION__;
     m_friendsPanelVBox = new QVBoxLayout(this);
+    m_friendsPanelVBox->setMargin(0);
+    m_friendsPanelVBox->setSpacing(0);
     this->setLayout(m_friendsPanelVBox);
     m_friendsPanelExpandButton = new QPushButton("Friends", this);
     m_friendsPanelVBox->addWidget(m_friendsPanelExpandButton);
@@ -38,8 +40,7 @@ FriendListPanel::FriendListPanel(QWidget *parent)
     friendListScroll->setWidget(m_friendListView);
     friendListScroll->setWidgetResizable(true);
     friendListScroll->viewport()->setAutoFillBackground(false);
-
-    this->setAutoFillBackground(true);
+    friendListScroll->widget()->setAutoFillBackground(false);
 
     m_friendsPanelVBox->addWidget(friendListScroll);
 
@@ -62,6 +63,22 @@ FriendListPanel::FriendListPanel(QWidget *parent)
     m_friendsPanelTransitionClose->addAnimation(new QPropertyAnimation(this, "pos"));
 
     m_friendsPanelStateMachine->start();
+
+    //Debug
+    QList<User *> friendList;
+    for (int i = 0; i < 10; ++i)
+        friendList.append(new User(QString("Address"), QPointF(12.22, 23.33), QString("Name"),
+                                   QString("Hello world! Hello world! Hello world! Hello world! "),
+                                   QUrl(), QString("2 days ago"), false, QString("id")));
+    friendInfoReceived(friendList);
+
+    this->setObjectName("UserPanel");
+    //this->setStyleSheet(QString("#UserPanel{background-image: url(:/res/images/personal_info_bckgrnd.png)}"));
+
+    this->setAutoFillBackground(true);
+    QPalette pal = palette();
+    pal.setColor(QPalette::Background, QColor(0, 0, 0, 128));
+    setPalette(pal);
 }
 
 void FriendListPanel::friendInfoReceived(QList<User *> &friendList)
@@ -74,6 +91,15 @@ void FriendListPanel::friendInfoReceived(QList<User *> &friendList)
         FriendListItem *item = new FriendListItem(m_friendListView);
         item->setData(user);
         m_friendListView->addWidget(item);
+        FriendListItem *item2 = new FriendListItem(m_friendListView);
+        item2->setData(user);
+        m_friendListView->addWidget(item2);
+        FriendListItem *item3 = new FriendListItem(m_friendListView);
+        item3->setData(user);
+        m_friendListView->addWidget(item3);
+        FriendListItem *item4 = new FriendListItem(m_friendListView);
+        item4->setData(user);
+        m_friendListView->addWidget(item4);
     }
 }
 
@@ -87,3 +113,12 @@ void FriendListPanel::reDrawFriendsPanel(int width, int height)
             width - FRIENDPANEL_WIDTH + MARGIN_CORRECTION, PANEL_TOP_Y));
     this->move(width-PANEL_PEEK_AMOUNT, PANEL_TOP_Y);
 }
+
+void FriendListPanel::paintEvent(QPaintEvent *)
+{
+    QStyleOption option;
+    option.init(this);
+
+    QStylePainter painter(this);
+    style()->drawPrimitive(QStyle::PE_Widget, &option, &painter, this);
+}
index 4b45597..32a28bb 100644 (file)
@@ -45,6 +45,9 @@ public:
     */
     FriendListPanel(QWidget *parent = 0);
 
+protected:
+    void paintEvent(QPaintEvent *);
+
 /*******************************************************************************
  * MEMBER FUNCTIONS AND SLOTS
  ******************************************************************************/
index 7508e62..6ff420d 100644 (file)
@@ -63,23 +63,6 @@ MapViewScreen::MapViewScreen(QWidget *parent)
 
 
     QHBoxLayout *mapViewLayout = new QHBoxLayout;
-    //DEBUG
-//    QVBoxLayout *mapControlLayout = new QVBoxLayout;
-//    QWidget *mapControl = new QWidget(this);
-//    mapControl->setLayout(mapControlLayout);
-//    search = new QPushButton("Search", this);
-//    zoomOut = new QPushButton("-", this);
-//    zoomIn = new QPushButton("+", this);
-//    mapControlLayout->addWidget(&latLine);
-//    mapControlLayout->addWidget(&lonLine);
-//    mapControlLayout->addWidget(search);
-//    mapControlLayout->addWidget(zoomIn);
-//    mapControlLayout->addWidget(zoomOut);
-//    mapViewLayout->addWidget(mapControl);
-//    connect(search, SIGNAL(clicked()), this, SLOT(searchMap()));
-//    connect(zoomIn, SIGNAL(clicked()), mapEngine, SLOT(zoomIn()));
-//    connect(zoomOut, SIGNAL(clicked()), mapEngine, SLOT(zoomOut()));
-    //DEBUG
 
     osmLicense = new QLabel(this);
     osmLicense->setAttribute(Qt::WA_TranslucentBackground, true);
index a12837e..0d3eccd 100644 (file)
@@ -25,7 +25,7 @@
 #include <QtCore>
 #include "map/mapcommon.h"
 
-const int PANEL_PEEK_AMOUNT = 30; ///< Amount of pixels shown when panel is closed
+const int PANEL_PEEK_AMOUNT = 60; ///< Amount of pixels shown when panel is closed
 
 const int FRIENDPANEL_WIDTH  = 420; ///< Width of the friends list panel
 const int FRIENDPANEL_HEIGHT = DEFAULT_SCREEN_HEIGHT; ///< Height of the friends list panel