#include "user/friendmodel.h"
#include "user/profile.h"
#include "qmlui/userimageprovider.h"
+#include "updatelocation.h"
const QString SETTINGS_GPS_ENABLED = "GPS_ENABLED"; ///< GPS setting
const QString SETTINGS_AUTO_CENTERING_ENABLED = "AUTO_CENTERING_ENABLED";///< Auto centering setting
FriendModel friendModel;
RouteModel routeModel;
Profile profile;
+ UpdateLocation updateLocation;
QDeclarativeView* ui;
d->ui->rootContext()->setContextProperty("routingModel", &d->routeModel);
d->ui->rootContext()->setContextProperty("friendModel", &d->friendProxyModel);
d->ui->rootContext()->setContextProperty("userProfile", &d->profile);
+ d->ui->rootContext()->setContextProperty("locationUpdate", &d->updateLocation);
d->ui->rootContext()->setContextProperty("engine", this);
d->ui->setSource(QUrl("qrc:/Main.qml"));
m_contactManager->requestContactGuids();
m_facebookAuthenticator->login();
+
+ connect(&d->updateLocation, SIGNAL(locationUpdate(QString,bool)),
+ this, SLOT(requestUpdateLocation(QString,bool)));
}
SituareEngine::~SituareEngine()
connect(m_ui, SIGNAL(requestReverseGeo()),
this, SLOT(requestAddress()));
- connect(m_ui, SIGNAL(locationUpdate(QString,bool)),
- this, SLOT(requestUpdateLocation(QString,bool)));
-
connect(m_ui, SIGNAL(enableAutomaticLocationUpdate(bool, int)),
this, SLOT(enableAutomaticLocationUpdate(bool, int)));
connect(m_situareService, SIGNAL(updateWasSuccessful()),
this, SLOT(updateWasSuccessful()));
- connect(m_situareService, SIGNAL(updateWasSuccessful()),
- m_ui, SIGNAL(updateWasSuccessful()));
+ Q_D(SituareEngine);
+ connect(m_situareService, SIGNAL(updateWasSuccessful()), &d->updateLocation, SLOT(clear()));
}
void SituareEngine::startAutomaticUpdate()
TextEdit {
id: text
- anchors { leftMargin: 5; left: image.right; right: parent.right; top: parent.top }
+ anchors { leftMargin: 5; left: image.right; right: sendButton.left; top: parent.top }
focus: true
selectByMouse: true
font.pixelSize: image.height * 0.7
id: textHeightBehavior
NumberAnimation { duration: 150 }
}
+ onActiveFocusChanged: {
+ if (activeFocus)
+ parent.state = "edit"
+ }
+ }
+
+ Button {
+ id: sendButton
+ text: "Send"
+ anchors { right: parent.right; rightMargin: 5; top: text.top }
+ height: 25
+ width: 0
+ visible: false
+ onButtonClicked: {
+ locationUpdate.setMessage(text.text)
+ locationUpdate.send()
+ parent.state = ""
+ }
+ }
+
+ Button {
+ id: cancelButton
+ text: "Cancel"
+ anchors { left: sendButton.left; right: sendButton.right; top: sendButton.bottom; topMargin: 5 }
+ height: 25
+ visible: false
+ onButtonClicked: {
+ parent.state = ""
+ }
+ }
+
+ onStateChanged: {
+ console.log("onStateChanged, state: " + state)
}
Component.onCompleted: {
explicit: true
height: textSingleLineHeight
}
+ },
+ State {
+ name: "edit"
+ PropertyChanges {
+ target: text
+ text: locationUpdate.message
+ }
+ PropertyChanges {
+ target: sendButton
+ width: 60
+ }
}
+
]
transitions: [
PropertyAction { target: text; property: "wrapMode"; value: Text.NoWrap }
PropertyAction { target: text; property: "elide"; value: Text.ElideRight }
}
+ },
+ Transition {
+ from: ""
+ to: "edit"
+ SequentialAnimation {
+ PropertyAction { target: sendButton; property: "visible"; value: true }
+ PropertyAction { target: cancelButton; property: "visible"; value: true }
+ NumberAnimation { target: sendButton; properties: "width"; duration: 1500 }
+ }
+ },
+ Transition {
+ from: "edit"
+ to: ""
+ SequentialAnimation {
+ NumberAnimation { target: sendButton; properties: "width"; duration: 1500 }
+ PropertyAction { target: sendButton; property: "visible"; value: false }
+ PropertyAction { target: cancelButton; property: "visible"; value: false }
+ PropertyAction { target: text; property: "visible"; value: text }
+ }
}
]
}
#ifdef Q_WS_MAEMO_5
setAttribute(Qt::WA_Maemo5StackedWindow);
#endif
-
- m_updateLocationController = new UpdateLocation(this);
-
- connect(this, SIGNAL(updateWasSuccessful()), m_updateLocationController, SLOT(clear()));
- connect(m_updateLocationController, SIGNAL(locationUpdate(QString,bool)),
- this, SIGNAL(locationUpdate(QString,bool)));
}
MainWindow::~MainWindow()
void locationItemClicked(const GeoCoordinate &swBound, const GeoCoordinate &neBound);
/**
- * @brief Send location update
- *
- * @param status Status message
- * @param publish Publish on Facebook?
- */
- void locationUpdate(const QString &status, bool publish);
-
- /**
* @brief Signals when Login/Logout action is pressed
*
*/
void viewZoomFinished();
/**
- * @brief Signals when updateLocation request finished successfully
- */
- void updateWasSuccessful();
-
- /**
* @brief Signal for use location ready.
*
* @param user User object