UserInfo::UserInfo(QWidget *parent)
: QWidget(parent),
- m_expanded(false),
- m_updateLocation(0)
+ m_expanded(false)
{
qDebug() << __PRETTY_FUNCTION__;
m_backgroundMiddleImage.load(":/res/images/list_item_middle.png");
m_backgroundBottomImage.load(":/res/images/list_item_bottom.png");
- restoreUnsendMessage();
+// restoreUnsendMessage();
}
UserInfo::~UserInfo()
{
qDebug() << __PRETTY_FUNCTION__;
-
- QSettings settings(SETTINGS_ORGANIZATION_NAME, SETTINGS_APPLICATION_NAME);
-
- if (!m_backupMessage.isEmpty()) {
- settings.setValue(USER_UNSEND_MESSAGE, m_backupMessage.toAscii());
- settings.setValue(USER_UNSEND_MESSAGE_PUBLISH, m_backupFacebookPublishPolicity);
- } else {
- settings.remove(USER_UNSEND_MESSAGE);
- settings.remove(USER_UNSEND_MESSAGE_PUBLISH);
- }
-}
-
-void UserInfo::backupUpdateLocationDialogData(const QString &status, bool publish)
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- m_backupMessage = status;
- m_backupFacebookPublishPolicity = publish;
-}
-
-void UserInfo::clearUpdateLocationDialogData()
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- m_backupMessage.clear();
- m_backupFacebookPublishPolicity = false;
}
void UserInfo::collapse()
emit findUser(m_coordinates);
}
-void UserInfo::messageUpdate()
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- delete m_updateLocation;
- m_updateLocation = new UpdateLocationDialog(m_backupMessage, m_backupFacebookPublishPolicity,
- this);
-
- 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, SLOT(backupUpdateLocationDialogData(QString, bool)));
-
- connect(m_updateLocation, SIGNAL(finished(int)),
- this, SLOT(updateLocationDialogFinished(int)));
-
- m_updateLocation->show();
-
- emit requestReverseGeo();
-}
-
void UserInfo::mousePressEvent(QMouseEvent *event)
{
qDebug() << __PRETTY_FUNCTION__ << " " << event->pos();
painter.drawPixmap(bottomRect, m_backgroundBottomImage);
}
-void UserInfo::restoreUnsendMessage()
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- QSettings settings(SETTINGS_ORGANIZATION_NAME, SETTINGS_APPLICATION_NAME);
- m_backupMessage = settings.value(USER_UNSEND_MESSAGE).toString();
- m_backupFacebookPublishPolicity = settings.value(USER_UNSEND_MESSAGE_PUBLISH, false).toBool();
-}
-
void UserInfo::setAddress(const QString &address)
{
qDebug() << __PRETTY_FUNCTION__;
m_nameLabel->setText(TextModifier::shortenText(m_nameLabel->fontMetrics(), m_userName,
LABEL_MAX_WIDTH));
}
-
-void UserInfo::updateLocationDialogFinished(int reason)
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- Q_UNUSED(reason);
-
- if (m_updateLocation) {
- disconnect(this, SIGNAL(reverseGeoReady(QString)),
- m_updateLocation, SLOT(setAddress(QString)));
-
- disconnect(m_updateLocation, SIGNAL(statusUpdate(QString,bool)),
- this, SIGNAL(statusUpdate(QString,bool)));
-
- disconnect(m_updateLocation, SIGNAL(statusUpdate(QString,bool)),
- this, SLOT(backupUpdateLocationDialogData(QString,bool)));
-
- disconnect(m_updateLocation, SIGNAL(finished(int)),
- this, SLOT(updateLocationDialogFinished(int)));
-
- m_updateLocation->deleteLater();
- m_updateLocation = 0;
- }
-}