connect(this, SIGNAL(reverseGeoReady(QString)),
m_updateLocation, SLOT(setAddress(QString)));
- connect(m_updateLocation, SIGNAL(statusUpdate(QString,bool)),
- this, SIGNAL(statusUpdate(QString,bool)));
+ connect(m_updateLocation, SIGNAL(statusUpdate(QString, bool)),
+ this, SIGNAL(statusUpdate(QString, bool)));
- connect(m_updateLocation, SIGNAL(statusUpdate(QString,bool)),
- this, SLOT(backupUpdateLocationDialogData(QString,bool)));
+ connect(m_updateLocation, SIGNAL(statusUpdate(QString, bool)),
+ this, SLOT(backupUpdateLocationDialogData(QString, bool)));
connect(m_updateLocation, SIGNAL(finished(int)),
this, SLOT(updateLocationDialogFinished(int)));
{
qDebug() << __PRETTY_FUNCTION__ << " " << event->pos();
-
- const int MOUSE_PRESS_AREA_WIDTH = 20;
const int MOUSE_PRESS_AREA_HEIGHT = 20;
+ const int MOUSE_PRESS_AREA_WIDTH = 20;
- if ((abs(m_mousePosition.y() - event->pos().y()) <= MOUSE_PRESS_AREA_WIDTH) &&
- (abs(m_mousePosition.x() - event->pos().x()) <= MOUSE_PRESS_AREA_HEIGHT)) {
+ if ((abs(m_mousePosition.y() - event->pos().y()) <= MOUSE_PRESS_AREA_WIDTH)
+ && (abs(m_mousePosition.x() - event->pos().x()) <= MOUSE_PRESS_AREA_HEIGHT)) {
if (m_expanded) {
setText(false);
m_expanded = false;
}
}
-void UserInfo::paintEvent(QPaintEvent *aPaintEvent)
+void UserInfo::paintEvent(QPaintEvent *event)
{
- qDebug() << __PRETTY_FUNCTION__ << " " << aPaintEvent->rect();
+ qDebug() << __PRETTY_FUNCTION__ << " " << event->rect();
QPainter painter(this);
}
m_messageText = list.join(" ");
- m_statusTextLabel->setText(m_messageText);
setText(false);
}
{
qDebug() << __PRETTY_FUNCTION__;
- if (expanded) {
+ if (expanded)
m_statusTextLabel->setText(m_messageText);
- }
- else {
- m_nameLabel->setText(shortenText(m_nameLabel, m_userName, LABEL_MAX_WIDTH));
- m_statusTextLabel->setText(shortenText(m_statusTextLabel, m_messageText,
- LABEL_MAX_WIDTH));
- }
+ else
+ m_statusTextLabel->setText(shortenText(m_statusTextLabel, m_messageText, LABEL_MAX_WIDTH));
}
void UserInfo::setTime(const QString &time)
qDebug() << __PRETTY_FUNCTION__;
m_userName = name;
- setText(false);
+ m_nameLabel->setText(shortenText(m_nameLabel, m_userName, LABEL_MAX_WIDTH));
}
QString UserInfo::shortenText(const QLabel *label, const QString &text, int textMaxWidth)
qDebug() << __PRETTY_FUNCTION__;
QFontMetrics labelMetrics = label->fontMetrics();
- QString textParam = text;
- int index = textParam.indexOf('\n');
+ QString copiedText = text;
+ int index = copiedText.indexOf('\n');
- if (index > 0) {
- textParam.truncate(index);
- textParam.append("...");
- }
+ if (index >= 0) {
+ copiedText.truncate(index);
+ copiedText.append("...");
+ }
- return labelMetrics.elidedText(textParam, Qt::ElideRight, textMaxWidth);
+ return labelMetrics.elidedText(copiedText, Qt::ElideRight, textMaxWidth);
}
QString UserInfo::splitWord(const QString &word) const
QString temp;
for (int i = 0; i < word.length(); i++) {
- if (fontMetrics().width(temp.append(word.at(i))) > LABEL_MAX_WIDTH)
- {
- temp.append(" ");
- result.append(temp);
- temp.clear();
+ if (fontMetrics().width(temp.append(word.at(i))) > LABEL_MAX_WIDTH) {
+ result.append(temp.left(temp.length() - 1));
+ result.append(" ");
+ temp.remove(0, temp.length() - 1);
}
}