connect(m_ui, SIGNAL(statusUpdate(QString,bool)), this, SLOT(requestUpdateLocation(QString,bool)));
connect(m_situareService, SIGNAL(userDataChanged(User*,QList<User*>&)),
this, SLOT(userDataChanged(User*,QList<User*>&)));
- connect(this, SIGNAL(userLocationReady(User*)), m_ui, SIGNAL(userLocationReady(User*)));
- connect(this, SIGNAL(friendsLocationsReady(QList<User*>&)), m_ui, SIGNAL(friendsLocationsReady(QList<User*>&)));
+ //connect(this, SIGNAL(userLocationReady(User*)), m_ui, SIGNAL(userLocationReady(User*)));
+ //connect(this, SIGNAL(friendsLocationsReady(QList<User*>&)), m_ui, SIGNAL(friendsLocationsReady(QList<User*>&)));
connect(m_situareService, SIGNAL(error(QString)), this, SLOT(error(QString)));
connect(m_situareService, SIGNAL(updateWasSuccessful()), this, SLOT(updateWasSuccessful()));
#include <QPixmap>
#include <QFormLayout>
#include <QSpacerItem>
+#include <QStylePainter>
+#include <math.h>
#include "friendlistitem.h"
#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 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 ITEM_MAX_WIDTH = 368; ///< Maximum width for item
const int ITEM_MIN_HEIGHT = 141; ///< Minimum height for item
const int ITEM_MIN_WIDTH = 368; ///< Minimum width for item
-const int LABEL_MAX_WIDTH = 350; ///< Label maximum width
+const int LABEL_MAX_WIDTH = 220; ///< Label maximum width
FriendListItem::FriendListItem(QWidget *parent)
: QWidget(parent)
infoLayout->setMargin(0);
infoLayout->setSpacing(0);
+ QPalette palette = this->palette();
+ palette.setColor(QPalette::Foreground, QColor::fromRgb(152, 152, 152));
+ setPalette(palette);
+ setFont(QFont( "Nokia Sans", 13, QFont::Normal));
+
+
QLabel *clockLabel = new QLabel();
clockLabel->setPixmap(QPixmap(CLOCK_PATH));
clockLabel->setContentsMargins(0, 0, ICON_MARGIN, 0);
m_imageLabel = new QLabel();
m_imageLabel->setFixedSize(IMAGE_WIDTH, IMAGE_HEIGHT);
+
m_nameLabel = new QLabel();
m_nameLabel->setFixedHeight(IMAGE_HEIGHT);
+ QPalette namePalette = m_nameLabel->palette();
+ namePalette.setColor(QPalette::Foreground, Qt::white);
+ m_nameLabel->setPalette(namePalette);
+ m_nameLabel->setFont(QFont( "Nokia Sans", 18, QFont::Normal));
+
m_updatedLabel = new QLabel();
m_updatedLabel->setWordWrap(true);
m_statusTextLabel = new QLabel();
setObjectName("listItem");
m_nameLabel->setObjectName("nameLabel");
- setStyleSheet("#listItem { border-image: url(:/res/images/list_item.png) 20%; " \
+ setStyleSheet("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 }");
setMinimumSize(ITEM_MIN_WIDTH, ITEM_MIN_HEIGHT);
- setMaximumSize(ITEM_MAX_WIDTH, ITEM_MAX_HEIGHT);
+ setMaximumSize(ITEM_MIN_WIDTH, ITEM_MAX_HEIGHT);
}
void FriendListItem::setData(User *user)
void FriendListItem::mousePressEvent(QMouseEvent *event)
{
- qDebug() << __PRETTY_FUNCTION__;
+ qDebug() << __PRETTY_FUNCTION__ << " " << event->pos();
m_mousePosition = event->pos();
}
void FriendListItem::mouseReleaseEvent(QMouseEvent *event)
{
- qDebug() << __PRETTY_FUNCTION__;
+ qDebug() << __PRETTY_FUNCTION__ << " " << event->pos();
- if (event->pos() == m_mousePosition) {
+ if (abs(m_mousePosition.y() - event->pos().y()) < 10) {
if (m_expanded) {
setText(false);
m_expanded = false;
}
}
-void FriendListItem::paintEvent(QPaintEvent *)
+void FriendListItem::paintEvent(QPaintEvent *event)
{
- qDebug() << __PRETTY_FUNCTION__;
+ qDebug() << __PRETTY_FUNCTION__ << " " << event->rect();
+
+// QStyleOption option;
+// option.init(this);
+
+// QStylePainter painter(this);
+// style()->drawPrimitive(QStyle::PE_Widget, &option, &painter, this);
+
+// QPainter painter(this);
+
+// painter.drawPixmap(event->rect(), QPixmap(BACKGROUND_PATH));
+
+// painter.drawPixmap(event->rect(), QPixmap(BACKGROUND_PATH), event->rect());
+
+// int topRectHeight = 20 - event->rect().top();
+
+// QRect topRect;
+
+// if (topRectHeight > 0) {
+// topRect = QRect(event->rect().left(), event->rect().top(), 368,
+// topRectHeight);
+
+// painter.drawPixmap(topRect, QPixmap(BACKGROUND_TOP_PATH), QRect(0, event->rect().top(), 368, topRect.height()));
+// }
+
+// int middleRectHeight = event->rect().height() - topRect.height();
+
+// int bottomRectHeight = 15 - (148 - event->rect().height());
+
+// if (bottomRectHeight > 0)
+// middleRectHeight -= bottomRectHeight;
+
+
+// QRect middleRect = QRect(event->rect().left(), topRect.bottom() + 1, 368, middleRectHeight);
+
+//// painter.drawPixmap(middleRect, QPixmap(BACKGROUND_MIDDLE_PATH));
+
+
+// if (bottomRectHeight > 0) {
+// QRect bottomRect = QRect(event->rect().left(), middleRect.bottom() + 1, 368,
+// bottomRectHeight);
+
+// painter.drawPixmap(bottomRect, QPixmap(BACKGROUND_BOTTOM_PATH), QRect(0, 0, 368,
+// bottomRectHeight));
+// }
- QStyleOption option;
- option.init(this);
+// qDebug() << __PRETTY_FUNCTION__ << " " << topRectHeight << " " << middleRectHeight << " " <<
+// bottomRectHeight;
- QPainter painter(this);
- style()->drawPrimitive(QStyle::PE_Widget, &option, &painter, this);
}
scene->addItem(m_arrowLeft);
//Friend list
- QGraphicsProxyWidget *scrollProxy = new QGraphicsProxyWidget();
- scrollProxy->setWidget(friendListScroll);
- scrollProxy->setZValue(m_personalInfoBackGround->zValue() - 3);
- scrollProxy->setMinimumSize(790 - 400, 480 - 56);
- scene->addItem(scrollProxy);
- scrollProxy->setPos(410, 0);
+// QGraphicsProxyWidget *scrollProxy = new QGraphicsProxyWidget();
+// scrollProxy->setWidget(friendListScroll);
+// scrollProxy->setZValue(m_personalInfoBackGround->zValue() - 3);
+// scrollProxy->setMinimumSize(790 - 400, 480 - 56);
+// scene->addItem(scrollProxy);
+// scrollProxy->setPos(410, 0);
//Friend list
m_leftSideBar->setPos(0,0);
machine->start();
m_vbox = new QVBoxLayout(this);
- m_vbox->addWidget(view);
+ //m_vbox->addWidget(view);
+ m_vbox->addWidget(friendListScroll);
m_vbox->setMargin(0);
connect(m_personalInfo,SIGNAL(launchMessageUpdate()),
connect(m_personalInfo,SIGNAL(launchUpdateFriendsStatus()),
this, SIGNAL(updateFriendsData()));
setObjectName("List view");
+
+ //DEBUG
+ QList<User *> list;
+ User *user1 = new User(QString("Address address"), QPointF(12.22, 23.33), QString("Name"),
+ QString("Note note note note Note note note note Note note note note "),
+ QUrl(""), QString("2 days ago"),false, QString(""));
+ User *user2 = new User(QString("Address address Address address Address address Address address " \
+ "Address address Address address Address address Address address " \
+ "Address address Address address Address address Address address "), QPointF(12.22, 23.33), QString("Name"),
+ QString("Note note note note"), QUrl(""), QString("2 days ago"),
+ false, QString(""));
+
+ list.append(user1);
+ list.append(user2);
+
+ friendInfoReceived(list);
}
ListViewScreen::~ListViewScreen()
{
qDebug() << __PRETTY_FUNCTION__;
- m_friendListView->clear();
+// m_friendListView->clear();
foreach (User *user, friendList) {
- FriendListItem *item = new FriendListItem(m_friendListView);
- item->setData(user);
- m_friendListView->addWidget(item);
+ FriendListItem *item1 = new FriendListItem(m_friendListView);
+ item1->setData(user);
+ m_friendListView->addWidget(item1);
+ 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);
}
}