#include "mce.h"
#include "network/networkaccessmanager.h"
#include "situareservice/situareservice.h"
-#include "qmlui/declarativeview.h"
#include "ui/mainwindow.h"
#include "qmlui/geomap.h"
#include "qmlui/rotation.h"
#include "qmlui/loginlogic.h"
#include <qdeclarative.h>
+#include <QDeclarativeView>
#include <QDeclarativeContext>
#include <QApplication>
#include <QDesktopWidget>
#include "qmlui/userimageprovider.h"
#include "updatelocation.h"
+#ifdef Q_WS_MAEMO_5
+#include <QX11Info>
+#include <X11/Xatom.h>
+#include <X11/Xlib.h>
+#endif
+
const QString SETTINGS_GPS_ENABLED = "GPS_ENABLED"; ///< GPS setting
const QString SETTINGS_AUTO_CENTERING_ENABLED = "AUTO_CENTERING_ENABLED";///< Auto centering setting
const int DEFAULT_ZOOM_LEVEL_WHEN_GPS_IS_AVAILABLE = 12; ///< Default zoom level when GPS available
Profile profile;
UpdateLocation updateLocation;
- DeclarativeView* ui;
+ QDeclarativeView* ui;
int progressIndicatorCount;
q->m_ui->toggleProgressIndicator(value);
#endif
}
+
+ void grabZoomKeys(bool grab)
+ {
+#ifdef QML_UI
+#ifdef Q_WS_MAEMO_5
+ // Can't grab keys unless we have a window id
+ if (!ui->winId())
+ return;
+
+ unsigned long val = (grab) ? 1 : 0;
+ Atom atom = XInternAtom(QX11Info::display(), "_HILDON_ZOOM_KEY_ATOM", False);
+ if (!atom)
+ return;
+
+ XChangeProperty (QX11Info::display(),
+ ui->winId(),
+ atom,
+ XA_INTEGER,
+ 32,
+ PropModeReplace,
+ reinterpret_cast<unsigned char *>(&val),
+ 1);
+#endif
+#endif
+ Q_UNUSED(grab);
+ }
};
SituareEngine::SituareEngine()
Q_D(SituareEngine);
- d->ui = new DeclarativeView(QApplication::desktop());
+ d->ui = new QDeclarativeView(QApplication::desktop());
+ d->grabZoomKeys(true);
#ifdef Q_WS_MAEMO_5
// d->ui->setAttribute(Qt::WA_Maemo5AutoOrientation, true);
#endif
geoMap->setFriendModels(&d->friendModel, &d->friendProxyModel);
geoMap->setRouteModel(&d->routeModel);
- connect(d->ui, SIGNAL(zoomIn()), geoMap, SLOT(zoomIn()));
- connect(d->ui, SIGNAL(zoomOut()), geoMap, SLOT(zoomOut()));
-
-
connect(d->ui->engine()->networkAccessManager(),
SIGNAL(sslErrors(QNetworkReply*, QList<QSslError>)),
m_facebookAuthenticator, SLOT(sslErrors(QNetworkReply*, QList<QSslError>)));
{
qDebug() << __PRETTY_FUNCTION__;
+ Q_D(SituareEngine);
+ d->grabZoomKeys(false);
+
delete m_ui;
QSettings settings(SETTINGS_ORGANIZATION_NAME, SETTINGS_APPLICATION_NAME);
*/
void routeFromTo(double fromLatitude, double fromLongitude, double toLatitude, double toLongitude);
+ /**
+ * @brief Shows contact dialog.
+ *
+ * Calls MainWindow showContactDialog with contact guid defined by contact's Facebook ID.
+ * @param facebookId contact's facebookId
+ */
+ void showContactDialog(const QString &facebookId);
+
private:
/**
* @brief Read settings and determine whether to use GPS and autocentering.
void setPowerSaving(bool enabled);
/**
- * @brief Shows contact dialog.
- *
- * Calls MainWindow showContactDialog with contact guid defined by contact's Facebook ID.
- * @param facebookId contact's facebookId
- */
- void showContactDialog(const QString &facebookId);
-
- /**
* @brief Automatic update interval timer timeout.
*
* Requests update location if user has moved.
Row {
Image {
id: routeButton
- source: "qrc:/res/images/route_to_friend.png"
+ source: routeButtonArea.pressed ? "qrc:/res/images/route_to_friend_s.png" : "qrc:/res/images/route_to_friend.png"
MouseArea {
- id: mouseArea
+ id: routeButtonArea
anchors.fill: parent
onClicked: {
engine.routeFromTo(map.gpsLocationLatitude, map.gpsLocationLongitude, latitude, longitude);
}
Image {
id: contactButton
- source: "qrc:/res/images/contact.png"
+ source: contactButtonArea.pressed ? "qrc:/res/images/contact_s.png" : "qrc:/res/images/contact.png"
+ MouseArea {
+ id: contactButtonArea
+ anchors.fill: parent
+ onClicked: {
+ engine.showContactDialog(userId);
+ }
+ }
}
}
}
}
}
+ Keys.onPressed: {
+ if (event.key == Qt.Key_F7)
+ map.zoomIn()
+ else if (event.key == Qt.Key_F8)
+ map.zoomOut()
+ }
+
Image {
id: sight
x: parent.width/2 - width/2
+++ /dev/null
-#include "declarativeview.h"
-#include <QDebug>
-#include <QKeyEvent>
-#ifdef Q_WS_MAEMO_5
-#include <QtMaemo5/QMaemo5InformationBox>
-#include <QtGui/QX11Info>
-#include <X11/Xatom.h>
-#include <X11/Xlib.h>
-#endif // Q_WS_MAEMO_5
-
-DeclarativeView::DeclarativeView(QWidget *parent) :
- QDeclarativeView(parent)
-{
- grabZoomKeys(true);
-}
-
-DeclarativeView::~DeclarativeView()
-{
- grabZoomKeys(false);
-}
-
-void DeclarativeView::keyPressEvent(QKeyEvent* event)
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- switch (event->key()) {
- case Qt::Key_F7:
- event->accept();
- emit zoomIn();
- break;
-
- case Qt::Key_F8:
- event->accept();
- emit zoomOut();
- break;
- }
- QDeclarativeView::keyPressEvent(event);
-}
-
-void DeclarativeView::grabZoomKeys(bool grab)
-{
- qDebug() << __PRETTY_FUNCTION__;
-
-#ifdef Q_WS_MAEMO_5
- // Can't grab keys unless we have a window id
- if (!winId())
- return;
-
- unsigned long val = (grab) ? 1 : 0;
- Atom atom = XInternAtom(QX11Info::display(), "_HILDON_ZOOM_KEY_ATOM", False);
- if (!atom)
- return;
-
- XChangeProperty (QX11Info::display(),
- winId(),
- atom,
- XA_INTEGER,
- 32,
- PropModeReplace,
- reinterpret_cast<unsigned char *>(&val),
- 1);
-#else
- Q_UNUSED(grab);
-#endif // Q_WS_MAEMO_5
-}
+++ /dev/null
-#ifndef DECLARATIVEVIEW_H
-#define DECLARATIVEVIEW_H
-
-#include <QDeclarativeView>
-
-class DeclarativeView : public QDeclarativeView
-{
- Q_OBJECT
-
-public:
- explicit DeclarativeView(QWidget *parent = 0);
- virtual ~DeclarativeView();
-
- virtual void keyPressEvent(QKeyEvent *event);
-
-signals:
- void zoomIn();
- void zoomOut();
-
-private:
- void grabZoomKeys(bool grab);
-};
-
-#endif // DECLARATIVEVIEW_H
engine/updatelocation.cpp \
user/friendmodel.cpp \
user/profile.cpp \
- qmlui/userimageprovider.cpp \
- qmlui/declarativeview.cpp
+ qmlui/userimageprovider.cpp
HEADERS += application.h \
common.h \
engine/updatelocation.h \
user/friendmodel.h \
user/profile.h \
- qmlui/userimageprovider.h \
- qmlui/declarativeview.h
+ qmlui/userimageprovider.h
OTHER_FILES += qmlui/Main.qml \
qmlui/Dialog.qml \