<file>res/images/list_item_bottom.png</file>
<file>res/images/list_item_middle.png</file>
<file>res/images/list_item_top.png</file>
+ <file>res/images/show_position.png</file>
+ <file>res/images/show_position_s.png</file>
+ <file>res/images/face.gif</file>
</qresource>
</RCC>
ui/friendlistitem.cpp \
user/user.cpp \
ui/buttonitem.cpp \
- ui/situareuser.cpp \
+ ui/avatarimage.cpp \
engine/engine.cpp \
ui/settingsdialog.cpp \
map/maptilerequest.cpp \
ui/friendlistitem.h \
user/user.h \
ui/buttonitem.h \
- ui/situareuser.h \
+ ui/avatarimage.h \
engine/engine.h \
ui/settingsdialog.h \
map/maptilerequest.h \
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Jukka Saastamoinen - jukka.saastamoinen@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 "avatarimage.h"
+#include <QPainter>
+#include <QDebug>
+
+const int BORDER_X_OFFSET = 7;
+const int BORDER_Y_OFFSET = 7;
+const int RECT_WIDTH_OFFSET = 1;
+const int RECT_HEIGHT_OFFSET = 1;
+const int ROUNDNESS = 9;
+const int IMAGE_SIZE_X = 60;
+const int IMAGE_SIZE_Y = 60;
+
+
+QPixmap AvatarImage::make(const QPixmap &image)
+{
+ QPixmap avatarImage; // = QPixmap(IMAGE_SIZE_X, IMAGE_SIZE_Y);
+ QPainter painter(&avatarImage);
+// QLabel label;
+// label.setPixmap(image);
+
+ QRect widgetRect = QRect(0, 0, image.width(), image.height());
+
+ painter.setRenderHint(QPainter::Antialiasing);
+ QPainterPath roundedRect;
+ roundedRect.addRoundedRect(5, 5, widgetRect.width()+RECT_WIDTH_OFFSET,
+ widgetRect.height()+RECT_HEIGHT_OFFSET,ROUNDNESS,ROUNDNESS);
+ painter.setClipPath(roundedRect);
+ //QRegion maskRegion = painter.clipRegion();
+
+ //label.setMask(maskRegion);
+
+ painter.drawPixmap(QPointF(5, 5), image);
+ //label.clearMask();
+
+ painter.drawPixmap(QPoint(0, 0), QPixmap(":/res/images/profile_pic_border.png"));
+
+
+ return avatarImage;
+}
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Jukka Saastamoinen - jukka.saastamoinen@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 SITUAREUSER_H
+#define SITUAREUSER_H
+
+#include <QLabel>
+#include <QPixmap>
+
+/**
+* @brief User class for personal information tab
+*
+* @class SituareUser situareuser.h "ui/situareuser.h"
+*/
+class AvatarImage
+{
+public:
+ static QPixmap make(const QPixmap &image);
+};
+
+#endif // SITUAREUSER_H
#include "friendlistitem.h"
#include "../user/user.h"
+#include "avatarimage.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 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
-const int ICON_MARGIN = 5; ///< Icon margin
+const int MARGIN = 5; ///< Icon margin
const int IMAGE_HEIGHT = 60; ///< Friend image height
const int IMAGE_WIDTH = 60; ///< Friend image width
const int MOUSE_PRESS_AREA_WIDTH = 20; ///< Area width for item height toggling
const int MOUSE_PRESS_AREA_HEIGHT = 20; ///< Area height for item height toggling
-const QFont NOKIA_FONT_NORMAL = QFont( "Nokia Sans", 18, QFont::Normal); ///< Normal font
-const QFont NOKIA_FONT_SMALL = QFont( "Nokia Sans", 13, QFont::Normal); ///< Small font
+const QFont NOKIA_FONT_NORMAL = QFont("Nokia Sans", 18, QFont::Normal); ///< Normal font
+const QFont NOKIA_FONT_SMALL = QFont("Nokia Sans", 13, QFont::Normal); ///< Small font
-/**
-* @var STYLESHEET
-* @brief Stylesheet for FriendListItem
-*/
-const QString STYLESHEET = "QWidget#listItem { border-image: url(:/res/images/list_item.png) 20%; " \
- "border-width: 20px 14px 16px 14px; } " \
- "QLabel { font-size: 13pt; color: #989898; }" \
- "#nameLabel { font-size: 18pt; color: #ffffff }";
+const QColor COLOR_GRAY = QColor(152, 152, 152);
FriendListItem::FriendListItem(QWidget *parent)
: QWidget(parent)
qDebug() << __PRETTY_FUNCTION__;
QVBoxLayout *layout = new QVBoxLayout(this);
+ layout->setContentsMargins(MARGIN, 0, MARGIN*2, MARGIN*2);
+ layout->setSpacing(0);
this->setLayout(layout);
QHBoxLayout *topLayout = new QHBoxLayout();
QLabel *clockLabel = new QLabel();
clockLabel->setPixmap(QPixmap(CLOCK_PATH));
- clockLabel->setContentsMargins(0, 0, ICON_MARGIN, 0);
+ clockLabel->setContentsMargins(0, 0, MARGIN, 0);
QLabel *envelopeLabel = new QLabel();
envelopeLabel->setPixmap(QPixmap(ENVELOPE_PATH));
- envelopeLabel->setContentsMargins(0, 0, ICON_MARGIN, 0);
+ envelopeLabel->setContentsMargins(0, 0, MARGIN, 0);
QLabel *compassLabel = new QLabel();
compassLabel->setPixmap(QPixmap(COMPASS_PATH));
- compassLabel->setContentsMargins(0, 0, ICON_MARGIN, 0);
+ compassLabel->setContentsMargins(0, 0, MARGIN, 0);
m_imageLabel = new QLabel();
m_imageLabel->setFixedSize(IMAGE_WIDTH, IMAGE_HEIGHT);
m_nameLabel = new QLabel();
m_nameLabel->setFixedHeight(IMAGE_HEIGHT);
+ m_distanceLabel = new QLabel();
+ m_distanceLabel->setFixedHeight(IMAGE_HEIGHT);
+ //m_distanceLabel->setAlignment(Qt::AlignHCenter | Qt::AlignRight);
+// m_distanceLabel->setMinimumWidth(IMAGE_WIDTH + 15);
+// m_distanceLabel->setMaximumWidth(IMAGE_WIDTH + 15);
+
+ QLabel *button = new QLabel();
+ button->setPixmap(QPixmap("res/images/show_position.png"));
+ button->setFixedSize(IMAGE_WIDTH, IMAGE_HEIGHT);
+
m_updatedLabel = new QLabel();
m_updatedLabel->setWordWrap(true);
m_statusTextLabel = new QLabel();
infoLayout->addRow(clockLabel, m_updatedLabel);
topLayout->addWidget(m_imageLabel);
- topLayout->addWidget(m_nameLabel);
+ topLayout->addWidget(m_nameLabel, 1);
+ topLayout->addWidget(m_distanceLabel);
- bottomLayout->addSpacing(IMAGE_WIDTH);
- bottomLayout->addLayout(infoLayout, 1);
+ bottomLayout->addWidget(button, 0, Qt::AlignTop);
+ bottomLayout->addLayout(infoLayout);
layout->addLayout(topLayout, 0);
layout->addLayout(bottomLayout, 1);
setFont(NOKIA_FONT_SMALL);
m_nameLabel->setFont(NOKIA_FONT_NORMAL);
QPalette itemPalette = palette();
- itemPalette.setColor(QPalette::Foreground, QColor(152, 152, 152));
+ itemPalette.setColor(QPalette::Foreground, COLOR_GRAY);
setPalette(itemPalette);
QPalette namePalette = m_nameLabel->palette();
namePalette.setColor(QPalette::Foreground, Qt::white);
if (user) {
m_user = user;
shortenTexts();
-
- m_imageLabel->setPixmap(m_user->profileImage());
+ m_imageLabel->setPixmap(AvatarImage::make(m_user->profileImage()));
+ QString unit;
+ double value;
+ user->distance(value, unit);
+ m_distanceLabel->setText(QString::number(value) + " " + unit);
setText(false);
}
}
qDebug() << __PRETTY_FUNCTION__;
if (expanded) {
+ setUpdatesEnabled(false);
m_nameLabel->setText(m_shortenedName);
m_updatedLabel->setText(m_user->timestamp());
m_statusTextLabel->setText(m_user->note());
m_locationLabel->setText(m_user->address());
+ setUpdatesEnabled(true);
}
else {
+ setUpdatesEnabled(false);
m_nameLabel->setText(m_shortenedName);
m_updatedLabel->setText(m_shortenedUpdated);
m_statusTextLabel->setText(m_shortenedStatusText);
m_locationLabel->setText(m_shortenedLocation);
+ setUpdatesEnabled(true);
}
}
QPainter painter(this);
- int height = event->rect().height();
-
QRect topRect = QRect(0, 0, event->rect().width(), 20);
- QRect middleRect = QRect(0, topRect.bottom() + 1, event->rect().width(),
- height + event->rect().top() - 20 - 15);
- QRect bottomRect = QRect(topRect.left(), middleRect.bottom() + 1, event->rect().width(),
+ QRect middleRect = QRect(0, topRect.bottom(), event->rect().width(),
+ height() - 20 - 15);
+ QRect bottomRect = QRect(topRect.left(), middleRect.bottom(), event->rect().width(),
15);
painter.drawPixmap(topRect, m_backgroundTopImage);
#include <QListWidgetItem>
#include "../user/user.h"
-#include "situareuser.h"
class QLabel;
void setText(bool expanded);
/******************************************************************************
+* SIGNALS
+******************************************************************************/
+signals:
+ void findButtonClicked(const QPointF &coordinates);
+
+/******************************************************************************
* DATA MEMBERS
******************************************************************************/
private:
bool m_expanded; ///< Item expanded state
+ QLabel *m_distanceLabel; ///< Distance to friend label
QLabel *m_imageLabel; ///< Image label
QLabel *m_locationLabel; ///< Location label
QPoint m_mousePosition; ///< Current mouse press position
//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")));
+ for (int i = 0; i < 10; ++i) {
+ User *user = new User(QString("Address"), QPointF(12.22, 23.33), QString("Name Name Name Naem"),
+ QString("Hello world! Hello world! Hello world! Hello world! "),
+ QUrl(), QString("2 days ago"), false, QString("id"), QString("km"),
+ 10000);
+ user->setProfileImage(QPixmap("res/images/face.gif"));
+ friendList.append(user);
+ }
friendInfoReceived(friendList);
this->setObjectName("UserPanel");
verticalLayout = new QVBoxLayout(widget);
horizontalLayout = new QHBoxLayout(widget);
m_layout = new QGridLayout(widget);
- situUser = new SituareUser(widget);
//Tex color settings
QPalette textPalette;
m_clockLabel->setPixmap(QPixmap(":/res/images/clock.png"));
m_envelopeLabel->setPixmap(QPixmap(":/res/images/envelope.png"));
m_compassLabel->setPixmap(QPixmap(":/res/images/compass.png"));
- m_layout->addWidget(situUser,0,0,1,2,Qt::AlignHCenter);
+// m_layout->addWidget(situUser,0,0,1,2,Qt::AlignHCenter);
m_layout->addWidget(m_userNameLabel,1,1,1,2);
m_layout->addWidget(m_clockLabel,3,0,1,1);
m_layout->addWidget(m_envelopeLabel,2,0,1,1);
void InfoTab::setAvatar(const QPixmap &avat)
{
m_avatar = avat;
- situUser->setPixmap(m_avatar);
}
void InfoTab::setUserName(const QString &usernam)
#include <QtGui>
#include <QWidget>
-#include "situareuser.h"
+#include "avatarimage.h"
/**
* @brief InfoTab class.
QString m_userName; ///< User's name
QPixmap m_avatar; ///< User's avatar
QWidget *widget; ///< Parent of all widgets.
- SituareUser *situUser; ///< Situare user's framed picture
QVBoxLayout *verticalLayout; ///< Vertical layout for personal infotab
QHBoxLayout *horizontalLayout; ///< Horizontal layout for personal infotab
QGridLayout *m_layout; ///< Grid layout for personal infotab
#include "friendlistview.h"
#include "friendlistitem.h"
#include "user/user.h"
-#include "situareuser.h"
#include "mainwindow.h"
const int INFOTAB_Y_LOC_STATE1 = 71;
+++ /dev/null
-/*
- Situare - A location system for Facebook
- Copyright (C) 2010 Ixonos Plc. Authors:
-
- Jukka Saastamoinen - jukka.saastamoinen@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 "situareuser.h"
-#include <QPainter>
-#include <QDebug>
-
-const int BORDER_X_OFFSET = 7;
-const int BORDER_Y_OFFSET = 7;
-const int RECT_WIDTH_OFFSET = 1;
-const int RECT_HEIGHT_OFFSET = 1;
-const int ROUNDNESS = 9;
-const int PIC_SIZE_X = 50;
-const int PIC_SIZE_Y = 50;
-
-SituareUser::SituareUser(QWidget *parent)
- : QLabel(parent)
-{
- this->setAlignment(Qt::AlignHCenter|Qt::AlignVCenter);
- this->setMargin(1);
-}
-
-void SituareUser::paintEvent(QPaintEvent *aPaintEvent)
-{
- Q_UNUSED(aPaintEvent);
-
- QRect widgetRect = QRect(0,0,this->pixmap()->width(),this->pixmap()->height());
-
- QPainter painter(this);
- painter.save();
-
- painter.setRenderHint(QPainter::Antialiasing);
- QPainterPath roundedRect;
- roundedRect.addRoundedRect(0,0,widgetRect.width()+RECT_WIDTH_OFFSET,
- widgetRect.height()+RECT_HEIGHT_OFFSET,ROUNDNESS,ROUNDNESS);
- painter.setClipPath(roundedRect);
- QRegion maskRegion = painter.clipRegion();
-
- setMask(maskRegion);
-
- painter.drawPixmap(QPointF(0, 0), (*(this->pixmap())));
- clearMask();
-
- painter.drawPixmap(QPointF(-BORDER_X_OFFSET,-BORDER_Y_OFFSET),
- (QPixmap(":/res/images/profile_pic_border.png")));
-
- painter.restore();
-}
-
-QSize SituareUser::sizeHint() const
-{
- return QSize(PIC_SIZE_X, PIC_SIZE_Y);
-}
+++ /dev/null
-/*
- Situare - A location system for Facebook
- Copyright (C) 2010 Ixonos Plc. Authors:
-
- Jukka Saastamoinen - jukka.saastamoinen@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 SITUAREUSER_H
-#define SITUAREUSER_H
-
-#include <QLabel>
-#include <QPixmap>
-
-/**
-* @brief User class for personal information tab
-*
-* @class SituareUser situareuser.h "ui/situareuser.h"
-*/
-class SituareUser : public QLabel
-{
- Q_OBJECT
-public:
- /**
- * @brief Constructor
- *
- * @param parent Parent
- */
- SituareUser(QWidget *parent=0);
-/*******************************************************************************
-* BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
-*******************************************************************************/
-protected:
- /**
- * @brief This function is called when the widget is drawn
- *
- * @param aPaintEvent Pointer to paint event
- */
- void paintEvent(QPaintEvent *aPaintEvent);
- /**
- * @brief This function suggests layouter correct size.
- *
- * @return QSize Size of the label
- */
- QSize sizeHint() const;
-};
-
-#endif // SITUAREUSER_H