{\r
m_textEdit->setText(tr("Message:"));\r
m_textEdit->selectAll();\r
+ m_charCountLabel->setNum(MESSAGE_MAX_LENGTH);\r
\r
connect(m_textEdit, SIGNAL(selectionChanged()),\r
this, SLOT(textSelectionChanged()));\r
QPushButton *cancelButton = buttonBox->addButton(QDialogButtonBox::Cancel);\r
sendButton->setText(tr("Send"));\r
\r
- m_charCountLabel->setNum(MESSAGE_MAX_LENGTH);\r
-\r
gridLayout->addWidget(new QLabel(tr("Location:")), 0, 0, 1, 1, Qt::AlignTop | Qt::AlignLeft);\r
gridLayout->addWidget(m_locationLabel, 0, 1, 1, 3);\r
gridLayout->addWidget(scrollArea, 1, 0, 1, 4);\r
#include "../user/user.h"
#include "userinfo.h"
-const int BACKGROUND_WIDTH = 240; ///< Width for item
-const int BACKGROUND_TOP_HEIGHT = 16; ///< Height for item top
-const int BACKGROUND_BOTTOM_HEIGHT = 15; ///< Height for item bottom
-const int ICON_HEIGHT = 24; ///< Icon height
-const int ICON_WIDTH = 24; ///< Icon width
-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
+const int BACKGROUND_WIDTH = 240; ///< Width for item
+const int BACKGROUND_TOP_HEIGHT = 16; ///< Height for item top
+const int BACKGROUND_BOTTOM_HEIGHT = 15; ///< Height for item bottom
+const int ICON_HEIGHT = 24; ///< Icon height
+const int ICON_WIDTH = 24; ///< Icon width
+const int MARGIN = 5; ///< Icon margin
+const int LINE_LENGTH = 17; ///< Line length
+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 LABEL_MAX_WIDTH
qDebug() << __PRETTY_FUNCTION__;
m_messageText = text;
+ m_expandedMessageText = text;
+ int textWidth = fontMetrics().width(m_expandedMessageText);
+
+ if (textWidth > 150){
+ QStringList words = m_expandedMessageText.split(" ");
+
+ for (int i = 0; i < words.count();i++){
+ QString temp = words.at(i);
+
+ if(temp.length() >= LINE_LENGTH) {
+ temp.insert(LINE_LENGTH,QString("\n"));
+ words.replace(i,temp);
+ }
+ }
+ m_expandedMessageText = words.join(" ");
+ }
+
setText(false);
}
qDebug() << __PRETTY_FUNCTION__;
if (expanded) {
- m_nameLabel->setText(m_userName);
- m_statusTextLabel->setText(m_messageText);
+ m_statusTextLabel->setText(m_expandedMessageText);
}
else {
m_nameLabel->setText(shortenText(m_nameLabel, m_userName, LABEL_MAX_WIDTH));
qDebug() << __PRETTY_FUNCTION__;
QFontMetrics labelMetrics = label->fontMetrics();
-
QString textParam = text;
int index = textParam.indexOf('\n');
+ int textWidth = fontMetrics().width(textParam);
- if (index > 0) {
- textParam.truncate(index);
- textParam.append("...");
- }
+ if (index > 0) {
+ textParam.truncate(index);
+ textParam.append("...");
+ }
+ if (textWidth > 150)
+ textParam.insert(LINE_LENGTH, QString("\n"));
return labelMetrics.elidedText(textParam, Qt::ElideRight, textMaxWidth);
}
* @param publish Publish on Facebook
*/
void statusUpdate(const QString &status, const bool &publish);
+
/******************************************************************************
* DATA MEMBERS
******************************************************************************/
QPointF m_coordinates; ///< User current coordinates
QString m_address; ///< Address from where the new message was sent
QString m_backupMessage; ///< Backup of users message
+ QString m_expandedMessageText; ///< Expanded message text
QString m_messageText; ///< User's message
QString m_time; ///< Time when the new message was sent
QString m_userName; ///< User's name