qDebug() << __PRETTY_FUNCTION__;
m_ui->loggedIn(false);
-
- // signal to clear locationUpdateDialog's data
- connect(this, SIGNAL(clearUpdateLocationDialogData()),
- m_ui, SIGNAL(clearUpdateLocationDialogData()));
- emit clearUpdateLocationDialogData();
-
+ m_ui->clearUpdateLocationDialogData();
m_situareService->updateSession(""); // empty session string means logged out
-
m_automaticUpdateFirstStart = true;
}
this, SLOT(updateWasSuccessful()));
connect(m_situareService, SIGNAL(updateWasSuccessful()),
- m_ui, SIGNAL(clearUpdateLocationDialogData()));
+ m_ui, SLOT(clearUpdateLocationDialogData()));
}
void SituareEngine::startAutomaticUpdate()
void automaticLocationUpdateEnabled(bool enabled);
/**
- * @brief Signal to clear locationUpdateDialog's data
- *
- */
- void clearUpdateLocationDialogData();
-
- /**
* @brief Signal when direction and distance from current map center point to current GPS
* location is changed
*
#include "settingsdialog.h"
#include "situareservice/situarecommon.h"
#include "tabbedpanel.h"
+#include "updatelocation/updatelocationdialog.h"
#include "userinfopanel.h"
#include "zoombuttonpanel.h"
m_crosshair(0),
m_fullScreenButton(0),
m_indicatorButtonPanel(0),
- m_mapScale(0)
+ m_mapScale(0),
+ m_updateLocation(0)
{
qDebug() << __PRETTY_FUNCTION__;
qDeleteAll(m_error_queue.begin(), m_error_queue.end());
m_error_queue.clear();
+
+ 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 MainWindow::automaticUpdateDialogFinished(int result)
m_automaticUpdateLocationDialog->deleteLater();
}
+void MainWindow::backupUpdateLocationDialogData(const QString &status, bool publish)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_backupMessage = status;
+ m_backupFacebookPublishPolicity = publish;
+}
+
void MainWindow::buildCrosshair()
{
qDebug() << __PRETTY_FUNCTION__;
connect(this, SIGNAL(userLocationReady(User*)),
m_userInfoPanel, SLOT(userDataReceived(User*)));
- connect(this, SIGNAL(reverseGeoReady(QString)),
- m_userInfoPanel, SIGNAL(reverseGeoReady(QString)));
-
- connect(this, SIGNAL(clearUpdateLocationDialogData()),
- m_userInfoPanel, SIGNAL(clearUpdateLocationDialogData()));
-
connect(m_userInfoPanel, SIGNAL(findUser(GeoCoordinate)),
this, SIGNAL(centerToCoordinates(GeoCoordinate)));
- connect(m_userInfoPanel, SIGNAL(requestReverseGeo()),
- this, SIGNAL(requestReverseGeo()));
-
- connect(m_userInfoPanel, SIGNAL(statusUpdate(QString,bool)),
- this, SIGNAL(statusUpdate(QString,bool)));
-
connect(m_userInfoPanel, SIGNAL(refreshUserData()),
this, SIGNAL(refreshUserData()));
- connect(m_userInfoPanel, SIGNAL(notificateUpdateFailing(QString, bool)),
- this, SLOT(buildInformationBox(QString, bool)));
+ connect(m_userInfoPanel, SIGNAL(updateLocationMessageButtonClicked()),
+ this, SLOT(showUpdateLocationDialog()));
}
void MainWindow::buildZoomButtonPanel()
this, SIGNAL(draggingModeTriggered()));
}
+void MainWindow::clearUpdateLocationDialogData()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_backupMessage.clear();
+ m_backupFacebookPublishPolicity = false;
+}
+
void MainWindow::createMenus()
{
qDebug() << __PRETTY_FUNCTION__;
}
}
+void MainWindow::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 MainWindow::setCrosshairVisibility(bool visibility)
{
qDebug() << __PRETTY_FUNCTION__;
}
}
+void MainWindow::showUpdateLocationDialog()
+{
+ 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 MainWindow::sslErrors(QNetworkReply *reply, const QList<QSslError> &errors)
{
qWarning() << __PRETTY_FUNCTION__;
m_tabbedPanel->setTabsEnabled(m_situareTabsIndexes, loggedIn);
}
+
+void MainWindow::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;
+ }
+}
class SettingsDialog;
class SituareService;
class TabbedPanel;
+class UpdateLocationDialog;
class User;
class UserInfoPanel;
class ZoomButtonPanel;
public slots:
/**
+ * @brief Saves status message and Facebook publish setting
+ *
+ * @param status message that user sends. Message is stored to m_backupMessage data member
+ * @param publish setting that determines whether the user status message is published on
+ * Facebook. This value is stored to m_backupFacebookPublishPolicity data member.
+ */
+ void backupUpdateLocationDialogData(const QString &status, bool publish);
+
+ /**
* @brief Builds information box with message.
*
* @param message Information message
void buildInformationBox(const QString &message, bool modal=false);
/**
+ * @brief Clears backups of message and publish on Facebook setting
+ */
+ void clearUpdateLocationDialogData();
+
+ /**
* @brief Hides and deletes login dialog
*/
void destroyLoginDialog();
void queueDialog(QDialog *dialog);
/**
+ * @brief reads Unsend message from settings at startup
+ */
+ void restoreUnsendMessage();
+
+ /**
* @brief Shows queued error information box
*
*/
void settingsDialogAccepted();
/**
+ * @brief Show update location dialog
+ */
+ void showUpdateLocationDialog();
+
+ /**
* @brief Ignore SSL error from the reply
*/
void sslErrors(QNetworkReply *reply, const QList<QSslError> &errors);
*/
void toggleFullScreen();
+ /**
+ * @brief Slot function to get indication when dialog is finished
+ */
+ void updateLocationDialogFinished(int reason);
+
/*******************************************************************************
* SIGNALS
******************************************************************************/
void statusUpdate(const QString &status, const bool &publish);
/**
- * @brief Signals when updateLocationDialog's data must be cleared
- *
- */
- void clearUpdateLocationDialogData();
-
- /**
* @brief Dragging mode triggered.
*/
void draggingModeTriggered();
* DATA MEMBERS
******************************************************************************/
private:
+ bool m_backupFacebookPublishPolicity; ///< Backup of publish on Facebook checkbox value
bool m_errorShown; ///< Indicates if error dialog/note is shown
bool m_loggedIn; ///< Indicates login state
bool m_refresh; ///< Indicates when webpage is refreshed
QMessageBox *m_automaticUpdateLocationDialog; ///< Automatic update location dialog
+ QString m_backupMessage; ///< Backup of users message
+
FriendListPanel *m_friendsListPanel; ///< Instance of friends list panel
FullScreenButton *m_fullScreenButton; ///< Instance of the fullscreen toggle button
IndicatorButtonPanel *m_indicatorButtonPanel; ///< Instance of direction indicator button
MapView *m_mapView; ///< Instance of the map view
RoutingPanel *m_routingPanel; ///< Instance of routing panel
TabbedPanel *m_tabbedPanel; ///< Widget for tabbed panels
+ UpdateLocationDialog *m_updateLocation; ///< Update location dialog
UserInfoPanel *m_userInfoPanel; ///< Instance of the user information panel
ZoomButtonPanel *m_zoomButtonPanel; ///< Instance of zoom button panel
};
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;
- }
-}
#include <QWidget>
#include "coordinates/geocoordinate.h"
-#include "updatelocation/updatelocationdialog.h"
+
+class QLabel;
class ImageButton;
public slots:
/**
- * @brief Saves status message and Facebook publish setting
- *
- * @param status message that user sends. Message is stored to m_backupMessage data member
- * @param publish setting that determines whether the user status message is published on
- * Facebook. This value is stored to m_backupFacebookPublishPolicity data member.
- */
- void backupUpdateLocationDialogData(const QString &status, bool publish);
-
- /**
- * @brief Clears backups of message and publish on Facebook setting
- */
- void clearUpdateLocationDialogData();
-
- /**
* @brief Sets the message text
*
* @param text Reference to user message
private:
/**
- * @brief reads Unsend message from settings at startup
- */
- void restoreUnsendMessage();
-
- /**
* @brief Set shortened or full-length text to labels.
*
* @param expanded true if full-length text is set, false otherwise
*/
void findButtonClicked();
- /**
- * @brief Slot function to forward messageUpdate launch signal
- */
- void messageUpdate();
-
- /**
- * @brief Slot function to get indication when dialog is finished
- */
- void updateLocationDialogFinished(int reason);
-
/******************************************************************************
* SIGNALS
******************************************************************************/
*/
void findUser(const GeoCoordinate &coordinates);
- /**
- * @brief Signal that used to inform user that his message/location update tp Situare server
- * was failed.
- * This signal is originally sended from UserInfo
- * @param message message for notification
- * @param modal true if modal notification otherwice false
- */
- void notificateUpdateFailing(const QString &message, bool modal);
-
- /**
- * @brief Signal for requesting reverseGeo from SituareEngine
- */
- void requestReverseGeo();
-
- /**
- * @brief Signals, when address data is ready
- *
- * @param address Street address
- */
- void reverseGeoReady(const QString &address);
-
- /**
- * @brief Signal for requestLocationUpdate from SituareEngine via MainWindow class
- *
- * @param status Status message
- * @param publish Publish on Facebook
- */
- void statusUpdate(const QString &status, const bool &publish);
-
/******************************************************************************
* DATA MEMBERS
******************************************************************************/
private:
- bool m_backupFacebookPublishPolicity; ///< Backup of publish on Facebook checkbox value
bool m_expanded; ///< Item expanded state
QLabel *m_locationLabel; ///< Location label
QPoint m_mousePosition; ///< Current mouse press position
- QString m_backupMessage; ///< Backup of users message
QString m_messageText; ///< User's message
QString m_userName; ///< User's name
GeoCoordinate m_coordinates; ///< User current coordinates
ImageButton *m_avatar; ///< User find button
- UpdateLocationDialog *m_updateLocation; ///< Update location dialog
};
#endif // USERINFO_H
connect(m_userInfo, SIGNAL(findUser(GeoCoordinate)),
this, SIGNAL(findUser(GeoCoordinate)));
- connect(m_userInfo,SIGNAL(requestReverseGeo()),
- this, SIGNAL(requestReverseGeo()));
-
- connect(m_userInfo, SIGNAL(statusUpdate(QString, bool)),
- this, SIGNAL(statusUpdate(QString, bool)));
-
- connect(m_userInfo, SIGNAL(notificateUpdateFailing(QString, bool)),
- this, SIGNAL(notificateUpdateFailing(QString, bool)));
-
- connect(this, SIGNAL(reverseGeoReady(QString)),
- m_userInfo, SIGNAL(reverseGeoReady(QString)));
-
- connect(this, SIGNAL(clearUpdateLocationDialogData()),
- m_userInfo, SLOT(clearUpdateLocationDialogData()));
-
connect(this, SIGNAL(collapse()),
m_userInfo, SLOT(collapse()));
this, SIGNAL(refreshUserData()));
connect(updateStatusMessageButton, SIGNAL(clicked()),
- m_userInfo, SLOT(messageUpdate()));
+ this, SIGNAL(updateLocationMessageButtonClicked()));
}
void findUser(const GeoCoordinate &coordinates);
/**
- * @brief Signal that used to inform user that his message/location update tp Situare server
- * was failed.
- * This signal is originally sended from UserInfo
- *
- * @param message message for notification
- * @param modal true if modal notification otherwice false
- */
- void notificateUpdateFailing(const QString &message, bool modal);
-
- /**
* @brief Signal for refreshing user data.
*/
void refreshUserData();
/**
- * @brief Signal for requesting reverseGeo from SituareEngine
- */
- void requestReverseGeo();
-
- /**
- * @brief Signals, when address data is ready
- *
- * @param address Street address
- */
- void reverseGeoReady(const QString &address);
-
- /**
- * @brief Signal Signal for requestLocationUpdate from SituareEngine via MainWindow class
- *
- * @param status Status message
- * @param publish Publish on Facebook
- */
- void statusUpdate(const QString &status, const bool &publish);
-
- /**
- * @brief Signals when updateLocationDialog's data must be cleared
- */
- void clearUpdateLocationDialogData();
+ * @brief Notify that update location message button was clicked
+ */
+ void updateLocationMessageButtonClicked();
/*******************************************************************************
* DATA MEMBERS