*/
#include <QVBoxLayout>
+#include <QPushButton>
+#include <QPainter>
+#include <QDebug>
+#include <QPaintEvent>
+#include <QLabel>
+#include <QPixmap>
#include "friendlistitem.h"
+const int BACKGROUND_TOP_WIDTH = 368;
+const int BACKGROUND_TOP_HEIGHT = 20;
+const int BACKGROUND_MIDDLE_X = 0;
+const int BACKGROUND_MIDDLE_Y = BACKGROUND_TOP_HEIGHT;
+const int BACKGROUND_MIDDLE_WIDTH = 368;
+const int BACKGROUND_MIDDLE_HEIGHT = 106;
+const int BACKGROUND_BOTTOM_X = 0;
+const int BACKGROUND_BOTTOM_Y = BACKGROUND_MIDDLE_Y + BACKGROUND_MIDDLE_HEIGHT;
+const int BACKGROUND_BOTTOM_WIDTH = 368;
+const int BACKGROUND_BOTTOM_HEIGHT = 15;
+const int IMAGE_X = 9;
+const int IMAGE_Y = 0;
+const int IMAGE_WIDTH = 60;
+const int IMAGE_HEIGHT = 60;
+const int CLOCK_X = 75;
+const int CLOCK_Y = 53;
+const int ENVELOPE_X = 75;
+const int ENVELOPE_Y = 77;
+const int COMPASS_X = 75;
+const int COMPASS_Y = 101;
+const int ICON_WIDTH = 24;
+const int ICON_HEIGHT = 24;
+
+const QString BACKGROUND_TOP_PATH = QString(":/resources/list_item_top.png");
+const QString BACKGROUND_MIDDLE_PATH = QString(":/resources/list_item_middle.png");
+const QString BACKGROUND_BOTTOM_PATH = QString(":/resources/list_item_bottom.png");
+const QString CLOCK_PATH = QString(":/resources/clock.png");
+const QString ENVELOPE_PATH = QString(":/resources/envelope.png");
+const QString COMPASS_PATH = QString(":/resources/compass.png");
+
FriendListItem::FriendListItem()
{
+ QVBoxLayout *layout = new QVBoxLayout(this);
+
+ QWidget *childWidget = new QWidget(this);
+ QPalette palette = childWidget->palette();
+ palette.setColor(QPalette::Foreground, QColor::fromRgb(152,152,152));
+ childWidget->setPalette(palette);
+ QFont font = QFont("Nokia Sans", 13, QFont::Normal);
+ childWidget->setFont(font);
+
+ QGridLayout *infoLayout = new QGridLayout(this);
+ infoLayout->setSpacing(0);
+ infoLayout->setMargin(0);
+ childWidget->setLayout(infoLayout);
+
+ QLabel *clockLabel = new QLabel(this);
+ clockLabel->setPixmap(QPixmap(CLOCK_PATH));
+ QLabel *envelopeLabel = new QLabel(this);
+ envelopeLabel->setPixmap(QPixmap(ENVELOPE_PATH));
+ QLabel *compassLabel = new QLabel(this);
+ compassLabel->setPixmap(QPixmap(COMPASS_PATH));
+
+ updatedLabel = new QLabel("22 min ago", this);
+ statusTextLabel = new QLabel("Just testing Situare...", this);
+ locationLabel = new QLabel("Some address 10, 1234 City", this);
+
+ infoLayout->setColumnStretch(1, 1);
+ infoLayout->setColumnMinimumWidth(0, 28);
+
+ infoLayout->addWidget(clockLabel, 0, 0);
+ infoLayout->addWidget(updatedLabel, 0, 1);
+ infoLayout->addWidget(envelopeLabel, 1, 0);
+ infoLayout->addWidget(statusTextLabel, 1, 1);
+ infoLayout->addWidget(compassLabel, 2, 0);
+ infoLayout->addWidget(locationLabel, 2, 1);
+
+ childWidget->setGeometry(75, 53, 250, 70);
+
+ this->setMinimumSize(368, 141);
+}
+
+void FriendListItem::paintEvent(QPaintEvent *)
+{
+ QPainter painter(this);
+
+ QRect itemRect = QRect(0, 0, 368, 141);
+
+ //Draw background
+ QRect topRect = QRect(itemRect.left(), itemRect.top(), BACKGROUND_TOP_WIDTH,
+ BACKGROUND_TOP_HEIGHT);
+ painter.drawPixmap(topRect, QPixmap(BACKGROUND_TOP_PATH));
+
+ QRect middleRect = QRect(topRect.left(), topRect.bottom() + 1, BACKGROUND_MIDDLE_WIDTH,
+ BACKGROUND_MIDDLE_HEIGHT);
+ painter.drawPixmap(middleRect, QPixmap(BACKGROUND_MIDDLE_PATH));
+
+ QRect bottomRect = QRect(topRect.left(), middleRect.bottom() + 1, BACKGROUND_BOTTOM_WIDTH,
+ BACKGROUND_BOTTOM_HEIGHT);
+ painter.drawPixmap(bottomRect, QPixmap(BACKGROUND_BOTTOM_PATH));
+
+ //Draw image
+ QString image = QString(":/resources/dummy_Avatar.png");
+ QRect imageRect = QRect(itemRect.left() + IMAGE_X, itemRect.top() + IMAGE_Y,
+ IMAGE_WIDTH, IMAGE_HEIGHT);
+ painter.drawPixmap(imageRect, QPixmap(image));
+
+ //Draw name
+ QRect nameRect = QRect(itemRect.left() + IMAGE_WIDTH + 11, itemRect.top() + 15, itemRect.width(),
+ itemRect.height());
+ QString name = QString("This is friend item");
+ QPen whitePen(QColor(Qt::white), 1, Qt::SolidLine);
+ painter.setPen(whitePen);
+ painter.setFont(QFont( "Nokia Sans", 18, QFont::Normal));
+ painter.drawText(nameRect, Qt::AlignLeft | Qt::AlignTop | Qt::TextWordWrap, name, &nameRect);
}
#include <QStateMachine>
#include <QListView>
#include <QDebug>
+#include <QScrollArea>
#include "listviewscreen.h"
#include "friendlistitemdelegate.h"
ListViewScreen::ListViewScreen(QWidget *parent)
: QWidget(parent)
{
- QPalette pal = this->palette();
- pal.setColor(QPalette::Background, Qt::blue);
- this->setPalette(pal);
-
//DEBUG
- FriendListView *friendListView = new FriendListView(this);
- friendListView->setItemDelegate(new FriendListItemDelegate());
-
+// FriendListView *friendListView = new FriendListView(this);
+// friendListView->setItemDelegate(new FriendListItemDelegate());
+
+// FriendListItem *item1 = new FriendListItem();
+// item1->setData(FriendListItem::Name, "Name 1");
+// item1->setData(FriendListItem::Updated, "2 days ago");
+// QString test = QString("Hello Maemo Situare! Hello Maemo Situare! ");
+// test.append("Hello Maemo Situare! ");
+// test.append("Hello Maemo Situare! ");
+// test.append("Hello Maemo Situare! ");
+// test.append("Hello Maemo Situare! ");
+// item1->setData(FriendListItem::StatusText, test);
+// item1->setData(FriendListItem::Location, "Kiviharjunlenkki 1E, 91910 Oulu");
+// item1->setData(FriendListItem::Image, ":/resources/dummy_Avatar.png");
+// FriendListItem *item2 = new FriendListItem();
+// item2->setData(FriendListItem::Name, "Name 2");
+// item2->setData(FriendListItem::Updated, "2 days ago");
+// item2->setData(FriendListItem::StatusText, "Hello Maemo Situare!");
+// item2->setData(FriendListItem::Location, "Kiviharjunlenkki 1E, 91910 Oulu");
+// item2->setData(FriendListItem::Image, ":/resources/dummy_Avatar.png");
+// FriendListItem *item3 = new FriendListItem();
+// item3->setData(FriendListItem::Name, "Name 3");
+// item3->setData(FriendListItem::Updated, "2 days ago");
+// item3->setData(FriendListItem::StatusText, "Hello Maemo Situare!");
+// item3->setData(FriendListItem::Location, "Kiviharjunlenkki 1E, 91910 Oulu");
+// item3->setData(FriendListItem::Image, ":/resources/dummy_Avatar.png");
+// FriendListItem *item4 = new FriendListItem();
+// item4->setData(FriendListItem::Name, "Name 4");
+// item4->setData(FriendListItem::Updated, "2 days ago");
+// item4->setData(FriendListItem::StatusText, "Hello Maemo Situare!");
+// item4->setData(FriendListItem::Location, "Kiviharjunlenkki 1E, 91910 Oulu");
+// item4->setData(FriendListItem::Image, ":/resources/dummy_Avatar.png");
+// FriendListItem *item5 = new FriendListItem();
+// item5->setData(FriendListItem::Name, "Name 5");
+// item5->setData(FriendListItem::Updated, "2 days ago");
+// item5->setData(FriendListItem::StatusText, "Hello Maemo Situare!");
+// item5->setData(FriendListItem::Location, "Kiviharjunlenkki 1E, 91910 Oulu");
+// item5->setData(FriendListItem::Image, ":/resources/dummy_Avatar.png");
+// FriendListItem *item6 = new FriendListItem();
+// item6->setData(FriendListItem::Name, "Name 6");
+// item6->setData(FriendListItem::Updated, "2 days ago");
+// item6->setData(FriendListItem::StatusText, "Hello Maemo Situare!");
+// item6->setData(FriendListItem::Location, "Kiviharjunlenkki 1E, 91910 Oulu");
+// item6->setData(FriendListItem::Image, ":/resources/dummy_Avatar.png");
+// friendListView->addItem(item1);
+// friendListView->addItem(item2);
+// friendListView->addItem(item3);
+// friendListView->addItem(item4);
+// friendListView->addItem(item5);
+// friendListView->addItem(item6);
+
+ QWidget *friendListView = new QWidget(this);
+ QVBoxLayout *friendListLayout = new QVBoxLayout(this);
+ friendListLayout->setMargin(0);
+ friendListLayout->setSpacing(0);
+ friendListView->setLayout(friendListLayout);
FriendListItem *item1 = new FriendListItem();
- item1->setData(FriendListItem::Name, "Name 1");
- item1->setData(FriendListItem::Updated, "2 days ago");
- QString test = QString("Hello Maemo Situare! Hello Maemo Situare! ");
- test.append("Hello Maemo Situare! ");
- test.append("Hello Maemo Situare! ");
- test.append("Hello Maemo Situare! ");
- test.append("Hello Maemo Situare! ");
- item1->setData(FriendListItem::StatusText, test);
- item1->setData(FriendListItem::Location, "Kiviharjunlenkki 1E, 91910 Oulu");
- item1->setData(FriendListItem::Image, ":/resources/dummy_Avatar.png");
FriendListItem *item2 = new FriendListItem();
- item2->setData(FriendListItem::Name, "Name 2");
- item2->setData(FriendListItem::Updated, "2 days ago");
- item2->setData(FriendListItem::StatusText, "Hello Maemo Situare!");
- item2->setData(FriendListItem::Location, "Kiviharjunlenkki 1E, 91910 Oulu");
- item2->setData(FriendListItem::Image, ":/resources/dummy_Avatar.png");
FriendListItem *item3 = new FriendListItem();
- item3->setData(FriendListItem::Name, "Name 3");
- item3->setData(FriendListItem::Updated, "2 days ago");
- item3->setData(FriendListItem::StatusText, "Hello Maemo Situare!");
- item3->setData(FriendListItem::Location, "Kiviharjunlenkki 1E, 91910 Oulu");
- item3->setData(FriendListItem::Image, ":/resources/dummy_Avatar.png");
FriendListItem *item4 = new FriendListItem();
- item4->setData(FriendListItem::Name, "Name 4");
- item4->setData(FriendListItem::Updated, "2 days ago");
- item4->setData(FriendListItem::StatusText, "Hello Maemo Situare!");
- item4->setData(FriendListItem::Location, "Kiviharjunlenkki 1E, 91910 Oulu");
- item4->setData(FriendListItem::Image, ":/resources/dummy_Avatar.png");
FriendListItem *item5 = new FriendListItem();
- item5->setData(FriendListItem::Name, "Name 5");
- item5->setData(FriendListItem::Updated, "2 days ago");
- item5->setData(FriendListItem::StatusText, "Hello Maemo Situare!");
- item5->setData(FriendListItem::Location, "Kiviharjunlenkki 1E, 91910 Oulu");
- item5->setData(FriendListItem::Image, ":/resources/dummy_Avatar.png");
FriendListItem *item6 = new FriendListItem();
- item6->setData(FriendListItem::Name, "Name 6");
- item6->setData(FriendListItem::Updated, "2 days ago");
- item6->setData(FriendListItem::StatusText, "Hello Maemo Situare!");
- item6->setData(FriendListItem::Location, "Kiviharjunlenkki 1E, 91910 Oulu");
- item6->setData(FriendListItem::Image, ":/resources/dummy_Avatar.png");
- friendListView->addItem(item1);
- friendListView->addItem(item2);
- friendListView->addItem(item3);
- friendListView->addItem(item4);
- friendListView->addItem(item5);
- friendListView->addItem(item6);
+
+ friendListLayout->addWidget(item1);
+ friendListLayout->addWidget(item2);
+ friendListLayout->addWidget(item3);
+ friendListLayout->addWidget(item4);
+ friendListLayout->addWidget(item5);
+ friendListLayout->addWidget(item6);
+
+ QScrollArea *friendListScroll = new QScrollArea();
+ friendListScroll->setWidget(friendListView);
//DEBUG
+
m_arrowbutton = new Pixmap(QPixmap(":/resources/arrow_right.png"));
m_personalInfo = new InfoTab;
machine->start();
m_vbox = new QHBoxLayout(this);
- //m_vbox->addWidget(view);
+// m_vbox->addWidget(view);
//DEBUG
- m_vbox->addWidget(friendListView);
+ //m_vbox->addWidget(friendListView);
+ m_vbox->addWidget(friendListScroll);
//DEBUG
m_vbox->setMargin(0);