const int ICON_WIDTH = 24; ///< Icon width
const int IMAGE_HEIGHT = 60; ///< Friend image height
const int IMAGE_WIDTH = 60; ///< Friend image width
-const int ITEM_MIN_WIDTH = 250; ///< Minimum width for item
+const int ITEM_MIN_WIDTH = 245; ///< Minimum width for item
const int MARGIN = 5; ///< Icon margin
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
*
* @var NAME_LABEL_MAX_WIDTH
*/
-const int NAME_LABEL_MAX_WIDTH = LABEL_MAX_WIDTH + 30;
+const int NAME_LABEL_MAX_WIDTH = LABEL_MAX_WIDTH + 70;
UserInfo::UserInfo(QWidget *parent)
- : QWidget(parent)
- , m_expanded(false)
-{
+ : QWidget(parent),
+ m_expanded(false)
+{
QVBoxLayout *verticalLayout = new QVBoxLayout(this);
- verticalLayout->setContentsMargins(MARGIN, 0, MARGIN*2, MARGIN*2);
+ verticalLayout->setContentsMargins(MARGIN * 2, 0, MARGIN * 2, MARGIN * 2);
+// verticalLayout->setSizeConstraint(QLayout::SetFixedSize);
verticalLayout->setSpacing(0);
- setLayout(verticalLayout);
+ this->setLayout(verticalLayout);
+
+ QVBoxLayout *topLayout = new QVBoxLayout(this);
+ topLayout->setMargin(0);
+ topLayout->setSpacing(0);
- QFormLayout *infoLayout = new QFormLayout();
+ QFormLayout *infoLayout = new QFormLayout(this);
infoLayout->setMargin(0);
infoLayout->setSpacing(0);
- QHBoxLayout *buttonLayout = new QHBoxLayout();
+ QHBoxLayout *buttonLayout = new QHBoxLayout(this);
buttonLayout->setMargin(0);
buttonLayout->setSpacing(0);
- QLabel *clockLabel = new QLabel();
- clockLabel->setPixmap(QPixmap(":/res/images/clock.png"));
- clockLabel->setContentsMargins(0, 0, MARGIN, 0);
- clockLabel->setFixedSize(ICON_WIDTH + MARGIN, ICON_HEIGHT);
- QLabel *envelopeLabel = new QLabel();
+ QLabel *envelopeLabel = new QLabel(this);
envelopeLabel->setPixmap(QPixmap(":/res/images/envelope.png"));
envelopeLabel->setContentsMargins(0, 0, MARGIN, 0);
envelopeLabel->setFixedSize(ICON_WIDTH + MARGIN, ICON_HEIGHT);
- QLabel *compassLabel = new QLabel();
+ QLabel *compassLabel = new QLabel(this);
compassLabel->setPixmap(QPixmap(":/res/images/compass.png"));
compassLabel->setContentsMargins(0, 0, MARGIN, 0);
compassLabel->setFixedSize(ICON_WIDTH + MARGIN, ICON_HEIGHT);
+ QLabel *clockLabel = new QLabel(this);
+ clockLabel->setPixmap(QPixmap(":/res/images/clock.png"));
+ clockLabel->setContentsMargins(0, 0, MARGIN, 0);
+ clockLabel->setFixedSize(ICON_WIDTH + MARGIN, ICON_HEIGHT);
- m_imageLabel = new QLabel();
+ m_imageLabel = new QLabel(this);
m_imageLabel->setFixedSize(IMAGE_WIDTH, IMAGE_HEIGHT);
- m_imageLabel->setAlignment(Qt::AlignHCenter);
- m_nameLabel = new QLabel();
- m_nameLabel->setFixedHeight(IMAGE_HEIGHT);
- m_nameLabel->setAlignment(Qt::AlignHCenter);
+ m_nameLabel = new QLabel(this);
- m_updatedLabel = new QLabel();
- m_updatedLabel->setWordWrap(true);
- m_statusTextLabel = new QLabel();
+ m_statusTextLabel = new QLabel(this);
m_statusTextLabel->setWordWrap(true);
- m_locationLabel = new QLabel();
+ m_locationLabel = new QLabel(this);
m_locationLabel->setWordWrap(true);
+ m_updatedLabel = new QLabel(this);
+ m_updatedLabel->setWordWrap(true);
ImageButton *updateFriendsButton = new ImageButton(this, ":/res/images/refresh.png",
":/res/images/refresh_s.png");
buttonLayout->addWidget(updateFriendsButton);
buttonLayout->addWidget(updateStatusMessageButton);
- infoLayout->addRow(compassLabel, m_locationLabel);
infoLayout->addRow(envelopeLabel, m_statusTextLabel);
+ infoLayout->addRow(compassLabel, m_locationLabel);
infoLayout->addRow(clockLabel, m_updatedLabel);
- verticalLayout->addWidget(m_imageLabel, 0, Qt::AlignHCenter);
-
- verticalLayout->addWidget(m_nameLabel, 1);
- verticalLayout->addLayout(infoLayout);
- verticalLayout->addLayout(buttonLayout, 2);
+// verticalLayout->addWidget(m_imageLabel, 0, Qt::AlignHCenter);
+// verticalLayout->addWidget(m_nameLabel, 0, Qt::AlignHCenter);
+ topLayout->addWidget(m_imageLabel, 0, Qt::AlignHCenter);
+ topLayout->addWidget(m_nameLabel, 0, Qt::AlignHCenter);
+ verticalLayout->addLayout(topLayout);
+ verticalLayout->addLayout(infoLayout, 1);
+ verticalLayout->addLayout(buttonLayout);
connect(updateStatusMessageButton,SIGNAL(clicked()),
this,SLOT(messageUpdate()));
connect(updateFriendsButton,SIGNAL(clicked()),
this, SIGNAL(refreshUserData()));
+ setFixedWidth(235);
+
this->setFont(NOKIA_FONT_SMALL);
m_nameLabel->setFont(NOKIA_FONT_NORMAL);
QPalette itemPalette = palette();
m_backgroundMiddleImage.load(":/res/images/list_item_middle.png");
m_backgroundBottomImage.load(":/res/images/list_item_bottom.png");
- this->setMinimumWidth(ITEM_MIN_WIDTH);
+ qWarning() << "Widget width:" << size().width();
+ qWarning() << "VLay width:" << verticalLayout->sizeHint().width();
}
void UserInfo::setUserName(const QString &name)
painter.drawPixmap(topRect, m_backgroundTopImage);
painter.drawPixmap(middleRect, m_backgroundMiddleImage);
painter.drawPixmap(bottomRect, m_backgroundBottomImage);
+
+// painter.setPen(Qt::white);
+// painter.drawRect(rect().x(), rect().y(), rect().width() - 1, rect().height() - 1);
}
void UserInfo::mousePressEvent(QMouseEvent *event)
m_userPanelVBox = new QVBoxLayout(this);
m_userPanelVBox->setMargin(0);
- m_userPanelVBox->setContentsMargins(SLIDINGBAR_WIDTH+1, 0, SIDEBAR_WIDTH, 0);
+ m_userPanelVBox->setContentsMargins(SLIDINGBAR_WIDTH + 3, 0, SIDEBAR_WIDTH + 3, 0);
m_userPanelVBox->setSpacing(0);
- m_userInfo = new UserInfo(this);
- m_userPanelVBox->addWidget(m_userInfo, 0, Qt::AlignCenter);
-
m_panelBase = new QWidget(this);
m_panelBase->setLayout(m_userPanelVBox);
- m_panelBase->move(TOP_CORNER_X,PANEL_TOP_Y);
+ m_panelBase->move(TOP_CORNER_X, PANEL_TOP_Y);
m_panelBase->resize(USERPANEL_WIDTH, USERPANEL_HEIGHT);
QPalette pal = palette();
m_panelBase->setPalette(pal);
m_panelBase->setAutoFillBackground(true);
+ m_userView = new QWidget(this);
+ m_userView->setLayout(m_userPanelVBox);
+
+ m_userInfo = new UserInfo(this);
+ QScrollArea *userInfoScroll = new QScrollArea(this);
+ userInfoScroll->setWidget(m_userInfo);
+ userInfoScroll->setWidgetResizable(true);
+ userInfoScroll->viewport()->setAutoFillBackground(false);
+ userInfoScroll->widget()->setAutoFillBackground(false);
+ userInfoScroll->setFixedWidth(245);
+
+ m_userPanelVBox->addWidget(userInfoScroll);
+
PanelSliderBar *m_userPanelSlidingBar = new PanelSliderBar(this, LEFT);
m_userPanelSlidingBar->move(USERPANEL_WIDTH - SLIDINGBAR_WIDTH, PANEL_TOP_Y);
void UserInfoPanel::userDataReceived(User *user)
{
- qDebug() << __PRETTY_FUNCTION__ << " " << user->name();
+ qDebug() << __PRETTY_FUNCTION__;
- m_userInfo->setUserName(user->name());
m_userInfo->setAvatar(user->profileImage());
+ m_userInfo->setUserName(user->name());
m_userInfo->setMessageText(user->note());
m_userInfo->setAddress(user->address());
m_userInfo->setTime(user->timestamp());