<context>
<name>GPSPositionPrivate</name>
<message>
- <location filename="../../src/gps/gpspositionprivate.cpp" line="56"/>
- <location filename="../../src/gps/gpspositionprivateliblocation.cpp" line="59"/>
<source>Unable to use GPS</source>
- <translation>GPS ei käytössä</translation>
+ <translation type="obsolete">GPS ei käytössä</translation>
</message>
</context>
<context>
<context>
<name>MainWindow</name>
<message>
- <location filename="../../src/ui/mainwindow.cpp" line="88"/>
+ <location filename="../../src/ui/mainwindow.cpp" line="87"/>
+ <source>Automatic location update</source>
+ <translation>Automaattinen paikan päivitys</translation>
+ </message>
+ <message>
+ <location filename="../../src/ui/mainwindow.cpp" line="94"/>
<source>Situare</source>
<translation>Situare</translation>
</message>
<message>
- <location filename="../../src/ui/mainwindow.cpp" line="375"/>
- <location filename="../../src/ui/mainwindow.cpp" line="634"/>
+ <location filename="../../src/ui/mainwindow.cpp" line="398"/>
+ <location filename="../../src/ui/mainwindow.cpp" line="657"/>
<source>Login</source>
<translation>Kirjaudu</translation>
</message>
<message>
- <location filename="../../src/ui/mainwindow.cpp" line="380"/>
+ <location filename="../../src/ui/mainwindow.cpp" line="403"/>
<source>Settings</source>
<translation>Asetukset</translation>
</message>
<message>
- <location filename="../../src/ui/mainwindow.cpp" line="385"/>
+ <location filename="../../src/ui/mainwindow.cpp" line="408"/>
<source>GPS</source>
<translation>GPS</translation>
</message>
<message>
- <location filename="../../src/ui/mainwindow.cpp" line="392"/>
+ <location filename="../../src/ui/mainwindow.cpp" line="415"/>
<source>Auto centering</source>
<translation>Automaattinen keskitys</translation>
</message>
<message>
- <location filename="../../src/ui/mainwindow.cpp" line="398"/>
+ <location filename="../../src/ui/mainwindow.cpp" line="421"/>
<source>Main</source>
<translation>Päävalikko</translation>
</message>
<message>
- <location filename="../../src/ui/mainwindow.cpp" line="403"/>
+ <location filename="../../src/ui/mainwindow.cpp" line="426"/>
<source>Menu</source>
<translation>Valikko</translation>
</message>
<message>
- <location filename="../../src/ui/mainwindow.cpp" line="506"/>
+ <location filename="../../src/ui/mainwindow.cpp" line="529"/>
<source>GPS timeout</source>
<translation>GPS pyyntö aikakatkaistiin</translation>
</message>
<message>
- <location filename="../../src/ui/mainwindow.cpp" line="628"/>
+ <location filename="../../src/ui/mainwindow.cpp" line="651"/>
<source>Logout</source>
<translation>Kirjaudu ulos</translation>
</message>
<context>
<name>QObject</name>
<message>
- <location filename="../../src/common.h" line="52"/>
<source>Session expired. Please login again</source>
- <translation>Istunto vanhentunut. Kirjaudu uudelleen</translation>
+ <translation type="obsolete">Istunto vanhentunut. Kirjaudu uudelleen</translation>
</message>
<message>
- <location filename="../../src/common.h" line="53"/>
<source>Invalid E-mail address or password</source>
- <translation>Virheellinen sähköpostiosoite tai salasana</translation>
+ <translation type="obsolete">Virheellinen sähköpostiosoite tai salasana</translation>
</message>
<message>
- <location filename="../../src/common.h" line="54"/>
<source>Update failed, please try again</source>
- <translation>Päivitys epäonnistui. Yritä uudelleen</translation>
+ <translation type="obsolete">Päivitys epäonnistui. Yritä uudelleen</translation>
</message>
<message>
- <location filename="../../src/common.h" line="55"/>
<source>Data retrieval failed, please try again</source>
<oldsource>Data retrieval failed, plaease try again</oldsource>
- <translation>Tiedon haku epäonnistui. Yritä uudelleen</translation>
+ <translation type="obsolete">Tiedon haku epäonnistui. Yritä uudelleen</translation>
</message>
<message>
- <location filename="../../src/common.h" line="56"/>
<source>Address retrieval failed, please try again</source>
- <translation>Osoitteen haku epäonnistui. Yritä uudelleen</translation>
+ <translation type="obsolete">Osoitteen haku epäonnistui. Yritä uudelleen</translation>
</message>
<message>
- <location filename="../../src/common.h" line="57"/>
<source>Image download failed</source>
- <translation>Kuvan haku epäonnistui</translation>
+ <translation type="obsolete">Kuvan haku epäonnistui</translation>
</message>
</context>
<context>
<name>SettingsDialog</name>
<message>
- <location filename="../../src/ui/settingsdialog.cpp" line="44"/>
+ <location filename="../../src/ui/settingsdialog.cpp" line="41"/>
<source>Settings</source>
<translation>Asetukset</translation>
</message>
<message>
- <location filename="../../src/ui/settingsdialog.cpp" line="50"/>
+ <location filename="../../src/ui/settingsdialog.cpp" line="47"/>
<source>Use automatic location update</source>
<translation>Sijainnin automaattinen päivitys</translation>
</message>
<message>
- <location filename="../../src/ui/settingsdialog.cpp" line="57"/>
- <location filename="../../src/ui/settingsdialog.cpp" line="89"/>
+ <location filename="../../src/ui/settingsdialog.cpp" line="54"/>
+ <location filename="../../src/ui/settingsdialog.cpp" line="86"/>
<source>Update interval</source>
<translation>Päivitysväli</translation>
</message>
<message>
- <location filename="../../src/ui/settingsdialog.cpp" line="138"/>
+ <location filename="../../src/ui/settingsdialog.cpp" line="131"/>
<source>%1 min</source>
<translation>%1 min</translation>
</message>
<context>
<name>SituareEngine</name>
<message>
- <location filename="../../src/engine/engine.cpp" line="136"/>
+ <location filename="../../src/engine/engine.cpp" line="140"/>
<source>Auto centering disabled</source>
<translation>Automaattinen keskitys pois päältä</translation>
</message>
<message>
+ <location filename="../../src/engine/engine.cpp" line="185"/>
+ <source>Do you want to enable automatic location update with %1 min update interval?</source>
+ <translation>Asetetaanko automaattinen paikan päivitys %1 minuutin välein päälle?</translation>
+ </message>
+ <message>
+ <location filename="../../src/engine/engine.cpp" line="190"/>
+ <source>Automatic location update enabled</source>
+ <translation>Automaattinen paikan päivitys päällä</translation>
+ </message>
+ <message>
+ <location filename="../../src/engine/engine.cpp" line="211"/>
+ <source>Connection refused by the server</source>
+ <translation>Palvelin ei vastaa pyyntöihin</translation>
+ </message>
+ <message>
+ <location filename="../../src/engine/engine.cpp" line="214"/>
+ <source>Connection closed by the server</source>
+ <translation>Palvelin sulki yhteyden</translation>
+ </message>
+ <message>
+ <location filename="../../src/engine/engine.cpp" line="217"/>
+ <source>Remote server not found</source>
+ <translation>Palvelinta ei löydy</translation>
+ </message>
+ <message>
<location filename="../../src/engine/engine.cpp" line="220"/>
- <location filename="../../src/engine/engine.cpp" line="228"/>
+ <source>Connection timed out</source>
+ <translation>Yhteys aikakatkaistiin</translation>
+ </message>
+ <message>
+ <location filename="../../src/engine/engine.cpp" line="223"/>
+ <source>Session expired. Please login again</source>
+ <translation>Istunto vanhentunut. Kirjaudu uudelleen</translation>
+ </message>
+ <message>
+ <location filename="../../src/engine/engine.cpp" line="226"/>
+ <source>Invalid E-mail address or password</source>
+ <translation>Virheellinen sähköpostiosoite tai salasana</translation>
+ </message>
+ <message>
+ <location filename="../../src/engine/engine.cpp" line="229"/>
+ <source>Update failed, please try again</source>
+ <translation>Päivitys epäonnistui. Yritä uudelleen</translation>
+ </message>
+ <message>
+ <location filename="../../src/engine/engine.cpp" line="232"/>
+ <source>Data retrieval failed, please try again</source>
+ <translation>Tiedon haku epäonnistui. Yritä uudelleen</translation>
+ </message>
+ <message>
+ <location filename="../../src/engine/engine.cpp" line="235"/>
+ <source>Address retrieval failed, please try again</source>
+ <translation>Osoitteen haku epäonnistui. Yritä uudelleen</translation>
+ </message>
+ <message>
+ <location filename="../../src/engine/engine.cpp" line="238"/>
+ <source>Image download failed</source>
+ <translation>Kuvan haku epäonnistui</translation>
+ </message>
+ <message>
+ <location filename="../../src/engine/engine.cpp" line="242"/>
+ <source>GPS initialization failed</source>
+ <translation>GPS alustus epäonnistui</translation>
+ </message>
+ <message>
+ <location filename="../../src/engine/engine.cpp" line="279"/>
+ <location filename="../../src/engine/engine.cpp" line="287"/>
<source>GPS enabled</source>
<translation>GPS päällä</translation>
</message>
<message>
- <location filename="../../src/engine/engine.cpp" line="221"/>
- <location filename="../../src/engine/engine.cpp" line="231"/>
+ <location filename="../../src/engine/engine.cpp" line="280"/>
+ <location filename="../../src/engine/engine.cpp" line="290"/>
<source>Auto centering enabled</source>
<translation>Automaattinen keskitys päällä</translation>
</message>
<context>
<name>UpdateLocationDialog</name>
<message>
- <location filename="../../src/ui/updatelocation/updatelocationdialog.cpp" line="31"/>
+ <location filename="../../src/ui/updatelocation/updatelocationdialog.cpp" line="34"/>
<source>Update Location</source>
<translation>Päivitä sijainti</translation>
</message>
<message>
- <location filename="../../src/ui/updatelocation/updatelocationdialog.cpp" line="43"/>
+ <location filename="../../src/ui/updatelocation/updatelocationdialog.cpp" line="71"/>
<source>Publish on Facebook</source>
<translation>Julkaise Facebookissa</translation>
</message>
<message>
- <location filename="../../src/ui/updatelocation/updatelocationdialog.cpp" line="49"/>
+ <location filename="../../src/ui/updatelocation/updatelocationdialog.cpp" line="77"/>
<source>Send</source>
<translation>Lähetä</translation>
</message>
<message>
- <location filename="../../src/ui/updatelocation/updatelocationdialog.cpp" line="52"/>
+ <location filename="../../src/ui/updatelocation/updatelocationdialog.cpp" line="82"/>
<source>Location:</source>
<translation>Sijainti:</translation>
</message>
<message>
- <location filename="../../src/ui/updatelocation/updatelocationdialog.cpp" line="53"/>
+ <location filename="../../src/ui/updatelocation/updatelocationdialog.cpp" line="42"/>
<source>Message:</source>
<translation>Viesti:</translation>
</message>
<context>
<name>UserInfo</name>
<message>
- <location filename="../../src/ui/userinfo.cpp" line="342"/>
+ <location filename="../../src/ui/userinfo.cpp" line="340"/>
<source>Location update failed
Your message is saved to textbox until sending will succeed</source>
const QString SITUARE_LOGIN_FAILURE = "http://www.facebook.com/connect/login_failure.html";
const QString FACEBOOK_LOGIN_ENDING = "&fbconnect=true&return_session=true&";
-// Error messages
-const QString SESSION_EXPIRED = QObject::tr("Session expired. Please login again");
-const QString LOGIN_FAILED = QObject::tr("Invalid E-mail address or password");
-const QString UPDATE_FAILED = QObject::tr("Update failed, please try again");
-const QString DATA_RETRIEVAL_FAILED = QObject::tr("Data retrieval failed, please try again");
-const QString ADDRESS_RETRIEVAL_FAILED = QObject::tr("Address retrieval failed, please try again");
-const QString DOWNLOAD_FAILED = QObject::tr("Image download failed");
+// Situare errors
+namespace SituareError {
+ enum errors {
+ SESSION_EXPIRED = 10,
+ LOGIN_FAILED,
+ UPDATE_FAILED,
+ DATA_RETRIEVAL_FAILED,
+ ADDRESS_RETRIEVAL_FAILED,
+ DOWNLOAD_FAILED,
+ GPS_INITIALIZATION_FAILED
+ };
+}
#endif // COMMON_H
*/
#include <QMessageBox>
+#include <QNetworkReply>
#include "common.h"
#include "facebookservice/facebookauthentication.h"
}
}
-void SituareEngine::error(const QString &error)
+void SituareEngine::error(const int error)
{
qDebug() << __PRETTY_FUNCTION__;
- m_ui->buildInformationBox(error, true);
+ switch(error)
+ {
+ case QNetworkReply::ConnectionRefusedError:
+ m_ui->buildInformationBox(tr("Connection refused by the server"), true);
+ break;
+ case QNetworkReply::RemoteHostClosedError:
+ m_ui->buildInformationBox(tr("Connection closed by the server"), true);
+ break;
+ case QNetworkReply::HostNotFoundError:
+ m_ui->buildInformationBox(tr("Remote server not found"), true);
+ break;
+ case QNetworkReply::TimeoutError:
+ m_ui->buildInformationBox(tr("Connection timed out"), true);
+ break;
+ case SituareError::SESSION_EXPIRED:
+ m_ui->buildInformationBox(tr("Session expired. Please login again"), true);
+ break;
+ case SituareError::LOGIN_FAILED:
+ m_ui->buildInformationBox(tr("Invalid E-mail address or password"), true);
+ break;
+ case SituareError::UPDATE_FAILED:
+ m_ui->buildInformationBox(tr("Update failed, please try again"), true);
+ break;
+ case SituareError::DATA_RETRIEVAL_FAILED:
+ m_ui->buildInformationBox(tr("Data retrieval failed, please try again"), true);
+ break;
+ case SituareError::ADDRESS_RETRIEVAL_FAILED:
+ m_ui->buildInformationBox(tr("Address retrieval failed, please try again"), true);
+ break;
+ case SituareError::DOWNLOAD_FAILED:
+ m_ui->buildInformationBox(tr("Image download failed"), true);
+ break;
+ case SituareError::GPS_INITIALIZATION_FAILED:
+ enableGPS(false);
+ m_ui->buildInformationBox(tr("GPS initialization failed"), true);
+ break;
+ default:
+ qCritical() << "QNetworkReply::NetworkError :" << error;
+ break;
+ }
- if(error.compare(SESSION_EXPIRED) == 0) {
+ if(error == SituareError::SESSION_EXPIRED) {
m_facebookAuthenticator->clearAccountInformation(true); // keep username = true
m_ui->loggedIn(false);
m_ui->loginFailed();
{
qDebug() << __PRETTY_FUNCTION__;
- connect(m_facebookAuthenticator, SIGNAL(error(QString)),
- this, SLOT(error(QString)));
+ connect(m_facebookAuthenticator, SIGNAL(error(int)),
+ this, SLOT(error(int)));
connect(m_facebookAuthenticator, SIGNAL(credentialsReady(FacebookCredentials)),
m_situareService, SLOT(credentialsReady(FacebookCredentials)));
connect(m_gps, SIGNAL(timeout()),
m_ui, SLOT(gpsTimeout()));
- connect(m_gps, SIGNAL(error(QString)),
- this, SLOT(error(QString)));
+ connect(m_gps, SIGNAL(error(int)),
+ this, SLOT(error(int)));
connect(m_gps, SIGNAL(position(QPointF,qreal)),
this, SLOT(saveGPSPosition(QPointF)));
{
qDebug() << __PRETTY_FUNCTION__;
+ connect(m_ui, SIGNAL(error(int)),
+ this, SLOT(error(int)));
+
connect(m_ui, SIGNAL(fetchUsernameFromSettings()),
this, SLOT(fetchUsernameFromSettings()));
connect(m_ui, SIGNAL(refreshUserData()),
this, SLOT(refreshUserData()));
- connect (m_ui, SIGNAL(notificateUpdateFailing(QString)),
- this, SLOT(error(QString)));
-
connect(m_ui, SIGNAL(findUser(QPointF)),
m_mapEngine, SLOT(setViewLocation(QPointF)));
{
qDebug() << __PRETTY_FUNCTION__;
- connect(m_mapEngine, SIGNAL(error(QString)),
- this, SLOT(error(QString)));
+ connect(m_mapEngine, SIGNAL(error(int)),
+ this, SLOT(error(int)));
connect(m_mapEngine, SIGNAL(locationChanged(QPoint)),
m_ui, SIGNAL(centerToSceneCoordinates(QPoint)));
{
qDebug() << __PRETTY_FUNCTION__;
- connect(m_situareService, SIGNAL(error(QString)),
- this, SLOT(error(QString)));
+ connect(m_situareService, SIGNAL(error(int)),
+ this, SLOT(error(int)));
connect(m_situareService, SIGNAL(reverseGeoReady(QString)),
m_ui, SIGNAL(reverseGeoReady(QString)));
connect(m_situareService, SIGNAL(updateWasSuccessful()),
m_ui, SIGNAL(updateWasSuccessful()));
- connect(m_situareService, SIGNAL(error(QString)),
- m_ui, SIGNAL(messageSendingFailed(QString)));
+ connect(m_situareService, SIGNAL(error(int)),
+ m_ui, SIGNAL(messageSendingFailed(int)));
}
void SituareEngine::updateWasSuccessful()
* MEMBER FUNCTIONS AND SLOTS
******************************************************************************/
public slots:
+// /**
+// * @brief Slot to intercept error signal from ImageFetcher and SituareService
+// *
+// * @param error Error message
+// */
+// void error(const QString &error);
/**
* @brief Slot to intercept error signal from ImageFetcher and SituareService
*
* @param error Error message
*/
- void error(const QString &error);
+ void error(const int error);
/**
* @brief Slot to intercept signal when username is fetched from settings
qDebug() << callbackUrl;
clearAccountInformation(true);
if(m_freshLogin) {
- emit error(LOGIN_FAILED);
+ emit error(SituareError::LOGIN_FAILED);
emit loginFailure();
}
else {
m_freshLogin = true;
- emit error(SESSION_EXPIRED);
+ emit error(SituareError::SESSION_EXPIRED);
}
}
else if(callbackUrl.indexOf(LOGIN_PAGE) == 0) {
/**
* @brief Signals error
*
- * @param error error message
+ * @param error error code
*/
- void error(const QString &error);
+ void error(const int error);
/**
* @brief This signal is emitted if updateCredentials method finds credentials from URL.
/**
* @brief Signal for error.
*
- * @param message error code
+ * @param error error code
*/
- void error(int code);
+ void error(const int error);
/**
* @brief Signal for position information.
#include <QDebug>
#include <QTimer>
+#include "common.h"
#include "gpscommon.h"
#include "gpsposition.h"
#include "gpspositionprivate.h"
if (!m_gpsSource) {
m_initialized = false;
- emit m_parent->error(123);
+ emit m_parent->error(SituareError::GPS_INITIALIZATION_FAILED);
return;
}
}
#include <QDebug>
#include <QTimer>
+#include "common.h"
#include "gpscommon.h"
#include "gpsposition.h"
#include "gpspositionprivateliblocation.h"
if (mode == GPSPosition::Default) {
m_liblocationWrapper = new LiblocationWrapper(this);
- if (!m_liblocationWrapper) {
+ if (!m_liblocationWrapper) {
m_initialized = false;
- emit m_parent->error(123); ///Change to correct error code
+ emit m_parent->error(SituareError::GPS_INITIALIZATION_FAILED);
return;
}
}
Q_UNUSED(errorMessage);
- emit m_parent->error(123);
+ emit m_parent->error(SituareError::GPS_INITIALIZATION_FAILED);
}
void GPSPositionPrivate::setUpdateInterval(int interval)
#include <QDebug>
+#include "common.h"
#include "gpsposition.h"
#include "gpspositionprivatestub.h"
{
qDebug() << __PRETTY_FUNCTION__;
- emit m_parent->error(123);
+ emit m_parent->error(SituareError::GPS_INITIALIZATION_FAILED);
}
void GPSPositionPrivate::stop()
m_mapFetcher, SLOT(enqueueFetchMapImage(int, int, int)));
connect(m_mapFetcher, SIGNAL(mapImageReceived(int, int, int, QPixmap)),
this, SLOT(mapImageReceived(int, int, int, QPixmap)));
- connect(m_mapFetcher, SIGNAL(error(QString)),
- this, SIGNAL(error(QString)));
+ connect(m_mapFetcher, SIGNAL(error(int)),
+ this, SIGNAL(error(int)));
m_ownLocation = new OwnLocationItem();
m_ownLocation->hide(); // hide until first location info is received
/**
* @brief Signals error
*
- * @param error error message
+ * @param error error code
*/
- void error(const QString &error);
+ void error(const int error);
/**
* @brief Signal for image fetching.
emit mapImageReceived(zoomLevel, x, y, QPixmap::fromImage(image));
}
else {
- emit error(DOWNLOAD_FAILED);
+ emit error(SituareError::DOWNLOAD_FAILED);
}
m_currentDownloads.removeAll(reply);
* @brief Signal which is emitted when there is error
* in network reply.
*
- * @param message error message
+ * @param error error code
*/
- void error(const QString &message);
+ void error(const int error);
/*******************************************************************************
* DATA MEMBERS
emit imageReceived(url, image);
}
else {
- emit error(DOWNLOAD_FAILED);
+ emit error(SituareError::DOWNLOAD_FAILED);
}
m_currentDownloads.removeAll(reply);
* @brief Signal which is emitted when there is error
* in network reply.
*
- * @param message error message
+ * @param error error code
*/
- void error(const QString &message);
+ void error(const int error);
/*******************************************************************************
* DATA MEMBERS
m_imageFetcher, SLOT(fetchImage(QUrl)));
connect(m_imageFetcher, SIGNAL(imageReceived(QUrl,QPixmap)),
this, SLOT(imageReceived(QUrl, QPixmap)));
- connect(m_imageFetcher, SIGNAL(error(QString)),
- this, SIGNAL(error(QString)));
+ connect(m_imageFetcher, SIGNAL(error(int)),
+ this, SIGNAL(error(int)));
}
SituareService::~SituareService()
qDebug() << "BytesAvailable: " << reply->bytesAvailable();
if (reply->error()) {
- emit error(reply->errorString());
+ emit error(reply->error());
} else {
qint64 max = reply->size();
QByteArray replyArray = reply->read(max);
if(replyArray == ERROR_LAT.toAscii()) {
qDebug() << "Error: " << ERROR_LAT;
- emit error(UPDATE_FAILED);
+ emit error(SituareError::UPDATE_FAILED);
} else if(replyArray == ERROR_LON.toAscii()) {
qDebug() << "Error: " << ERROR_LON;
- emit error(UPDATE_FAILED);
+ emit error(SituareError::UPDATE_FAILED);
} else if(replyArray.contains(ERROR_SESSION.toAscii())) {
qDebug() << "Error: " << ERROR_SESSION;
- emit error(SESSION_EXPIRED);
+ emit error(SituareError::SESSION_EXPIRED);
} else if(replyArray.startsWith(OPENING_BRACE_MARK.toAscii())) {
qDebug() << "JSON string";
parseUserData(replyArray);
emit updateWasSuccessful();
} else {
// session credentials are invalid
- emit error(SESSION_EXPIRED);
+ emit error(SituareError::SESSION_EXPIRED);
}
} else {
// Street address ready
/**
* @brief Signals error
*
- * @param error error message
+ * @param error error code
*/
- void error(const QString &error);
+ void error(const int error);
/**
* @brief Signal for image fetching
connect(this, SIGNAL(updateWasSuccessful()),
m_userPanel, SIGNAL(updateWasSuccessful()));
- connect(this, SIGNAL(messageSendingFailed(QString)),
- m_userPanel, SIGNAL(messageSendingFailed(QString)));
+ connect(this, SIGNAL(messageSendingFailed(int)),
+ m_userPanel, SIGNAL(messageSendingFailed(int)));
- connect(m_userPanel, SIGNAL(notificateUpdateFailing(QString)),
- this, SIGNAL(notificateUpdateFailing(QString)));
+ connect(m_userPanel, SIGNAL(notificateUpdateFailing(QString, bool)),
+ this, SLOT(buildInformationBox(QString, bool)));
}
void MainWindow::buildWebView()
qDebug() << __PRETTY_FUNCTION__;
if(reply->error()) {
- qDebug() << reply->error() << reply->errorString();
+ emit error(reply->error());
toggleProgressIndicator(false);
}
}
******************************************************************************/
public:
/**
- * @brief Builds information box with message.
- *
- * @param message Information message
- * @param modal Modal = true, non-modal false
- */
- void buildInformationBox(const QString &message, bool modal=false);
-
- /**
* @brief Clears cookie jar
*
*/
public slots:
/**
+ * @brief Builds information box with message.
+ *
+ * @param message Information message
+ * @param modal Modal = true, non-modal false
+ */
+ void buildInformationBox(const QString &message, bool modal=false);
+
+ /**
* @brief Slot to intercept signal when login has failed (loginFailure signal)
*
*/
void enableAutomaticLocationUpdate(bool enabled, int updateIntervalMsecs);
/**
+ * @brief Signals error
+ *
+ * @param error Error code
+ */
+ void error(const int error);
+
+ /**
* @brief Signal for requesting username from settings
*
*/
* @brief Signal that informs that user's message/location failed to update on Situare server
* This signal is originally sended from SituareService with name error
* Signal is renamed on MainWindow
+ *
+ * @param error error code
*/
- void messageSendingFailed(const QString &error);
+ void messageSendingFailed(const int error);
/**
* @brief Forwarding signal from MapEngine to MapView
void minZoomLevelReached();
/**
- * @brief Signal that used to inform user that his message/location update tp Situare server
- * was failed.
- * This signal is originally sended from UserInfo
- */
- void notificateUpdateFailing(const QString &message);
-
- /**
* @brief Forwarding signal from MapEngine to MapScale
*/
void newMapResolution(qreal scale);
UserInfo::UserInfo(QWidget *parent)
: QWidget(parent),
m_expanded(false),
+ m_messageUpdateVerified(false),
m_updateLocation(0)
{
qDebug() << __PRETTY_FUNCTION__;
return labelMetrics.elidedText(textParam, Qt::ElideRight, textMaxWidth);
}
-void UserInfo::verifyMessageUpdateFailure(const QString &errorMessage)
+void UserInfo::verifyMessageUpdateFailure(const int error)
{
qDebug() << __PRETTY_FUNCTION__;
- Q_UNUSED(errorMessage);
+ Q_UNUSED(error);
if (!m_messageUpdateVerified) {
if (m_messageText != m_backupMessage && !m_backupMessage.isEmpty())
emit notificateUpdateFailing(tr("Location update failed\n\nYour message is saved to "
- "textbox until sending will succeed"));
+ "textbox until sending will succeed"), true);
}
m_messageUpdateVerified = true;
* @brief Emits signal to inform user about failed message/location update.
* Contains logic to send signal only after failed message/location update.
*
- * @param errorMessage from Situare server. Message is not used in this function
+ * @param error from Situare server. Error is not used in this function
*/
- void verifyMessageUpdateFailure(const QString &errorMessage);
+ void verifyMessageUpdateFailure(const int error);
private:
void findUser(const QPointF &coordinates);
/**
- * @brief Signal that informs that user's message/location failed to update on Situare server
- * This signal is originally sended from SituareService with name error
- * Signal is renamed on MainWindow
- */
- void messageSendingFailed(const QString &error);
-
- /**
* @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);
+ void notificateUpdateFailing(const QString &message, bool modal);
/**
* @brief Signal for refreshing user data.
connect(this, SIGNAL(updateWasSuccessful()),
m_userInfo, SLOT(clearUpdateLocationDialogData()));
- connect(this, SIGNAL(messageSendingFailed(QString)),
- m_userInfo, SIGNAL(messageSendingFailed(QString)));
+ connect (this, SIGNAL(messageSendingFailed(int)),
+ m_userInfo, SLOT(verifyMessageUpdateFailure(int)));
- connect (this, SIGNAL(messageSendingFailed(QString)),
- m_userInfo, SLOT(verifyMessageUpdateFailure(QString)));
-
- connect (m_userInfo, SIGNAL(notificateUpdateFailing(QString)),
- this, SIGNAL(notificateUpdateFailing(QString)));
+ connect (m_userInfo, SIGNAL(notificateUpdateFailing(QString, bool)),
+ this, SIGNAL(notificateUpdateFailing(QString, bool)));
}
void UserInfoPanel::userDataReceived(User *user)
* @brief Signal that informs that user's message/location failed to update on Situare server
* This signal is originally sended from SituareService with name error
* Signal is renamed on MainWindow
+ *
+ * @param error Error code
*/
- void messageSendingFailed(const QString &error);
+ void messageSendingFailed(const int error);
/**
* @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);
+ void notificateUpdateFailing(const QString &message, bool modal);
/**
* @brief Signal for refreshing user data.