m_errorShown(false),
m_loggedIn(false),
m_refresh(false),
+ m_mapCenterHorizontalShifting(0),
m_progressIndicatorCount(0),
- m_ownLocationCrosshair(0),
+ m_crosshair(0),
m_email(), ///< @todo WTF?!?!?!?
m_password(),
m_webView(0),
if (m_fullScreenButton) {
m_tabbedPanel->stackUnder(m_fullScreenButton);
}
- m_ownLocationCrosshair->stackUnder(m_tabbedPanel);
- m_zoomButtonPanel->stackUnder(m_ownLocationCrosshair);
+ m_crosshair->stackUnder(m_tabbedPanel);
+ m_zoomButtonPanel->stackUnder(m_crosshair);
m_indicatorButtonPanel->stackUnder(m_zoomButtonPanel);
m_osmLicense->stackUnder(m_indicatorButtonPanel);
m_mapScale->stackUnder(m_osmLicense);
m_automaticUpdateLocationDialog->deleteLater();
}
-void MainWindow::buildFullScreenButton()
+void MainWindow::buildCrosshair()
{
qDebug() << __PRETTY_FUNCTION__;
-#ifdef Q_WS_MAEMO_5
- m_fullScreenButton = new FullScreenButton(this);
+ m_crosshair = new QLabel(this);
+ QPixmap crosshairImage(":/res/images/sight.png");
+ m_crosshair->setPixmap(crosshairImage);
+ m_crosshair->setFixedSize(crosshairImage.size());
+ m_crosshair->hide();
+ m_crosshair->setAttribute(Qt::WA_TransparentForMouseEvents, true);
- if (m_fullScreenButton) {
- connect(m_fullScreenButton, SIGNAL(clicked()),
- this, SLOT(toggleFullScreen()));
+ connect(m_mapView, SIGNAL(viewResized(QSize)),
+ this, SLOT(moveCrosshair()));
- connect(qApp, SIGNAL(showFullScreenButton()),
- m_fullScreenButton, SLOT(invoke()));
- }
-#endif // Q_WS_MAEMO_5
+ connect(m_mapView, SIGNAL(horizontalShiftingChanged(int)),
+ this, SLOT(mapCenterHorizontalShiftingChanged(int)));
}
void MainWindow::buildFriendListPanel()
this, SIGNAL(routeTo(const GeoCoordinate&)));
}
+void MainWindow::buildFullScreenButton()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+#ifdef Q_WS_MAEMO_5
+ m_fullScreenButton = new FullScreenButton(this);
+
+ if (m_fullScreenButton) {
+ connect(m_fullScreenButton, SIGNAL(clicked()),
+ this, SLOT(toggleFullScreen()));
+
+ connect(qApp, SIGNAL(showFullScreenButton()),
+ m_fullScreenButton, SLOT(invoke()));
+ }
+#endif // Q_WS_MAEMO_5
+}
+
void MainWindow::buildIndicatorButtonPanel()
{
qDebug() << __PRETTY_FUNCTION__;
queueDialog(msgBox);
}
-void MainWindow::buildManualLocationCrosshair()
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- m_ownLocationCrosshair = new QLabel(this);
- QPixmap crosshairImage(":/res/images/sight.png");
- m_ownLocationCrosshair->setPixmap(crosshairImage);
- m_ownLocationCrosshair->setFixedSize(crosshairImage.size());
- m_ownLocationCrosshair->hide();
- m_ownLocationCrosshair->setAttribute(Qt::WA_TransparentForMouseEvents, true);
-
- connect(m_mapView, SIGNAL(viewResized(QSize)),
- this, SLOT(drawOwnLocationCrosshair(QSize)));
-}
-
void MainWindow::buildMap()
{
qDebug() << __PRETTY_FUNCTION__;
buildZoomButtonPanel();
buildOsmLicense();
- buildManualLocationCrosshair();
+ buildCrosshair();
buildFullScreenButton();
buildIndicatorButtonPanel();
buildMapScale();
size.height() - m_osmLicense->fontMetrics().height());
}
-void MainWindow::drawOwnLocationCrosshair(const QSize &size)
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- if (m_ownLocationCrosshair != 0) {
- m_ownLocationCrosshair->move(size.width()/2 - m_ownLocationCrosshair->pixmap()->width()/2,
- size.height()/2 - m_ownLocationCrosshair->pixmap()->height()/2);
- }
-}
-
void MainWindow::errorDialogFinished(int status)
{
qDebug() << __PRETTY_FUNCTION__;
}
-void MainWindow::openSettingsDialog()
+void MainWindow::mapCenterHorizontalShiftingChanged(int shifting)
{
- qDebug() << __PRETTY_FUNCTION__;
+ m_mapCenterHorizontalShifting = shifting;
+ moveCrosshair();
+}
- SettingsDialog *settingsDialog = new SettingsDialog(this);
- settingsDialog->enableSituareSettings((m_loggedIn && m_gpsToggleAct->isChecked()));
- connect(settingsDialog, SIGNAL(accepted()), this, SLOT(settingsDialogAccepted()));
+void MainWindow::moveCrosshair()
+{
+ qDebug() << __PRETTY_FUNCTION__;
- settingsDialog->show();
+ if (m_crosshair) {
+ int mapHeight = m_mapView->size().height();
+ int mapWidth = m_mapView->size().width();
+ m_crosshair->move(mapWidth / 2 - m_crosshair->pixmap()->width() / 2
+ - m_mapCenterHorizontalShifting,
+ mapHeight / 2 - m_crosshair->pixmap()->height() / 2);
+ }
}
-void MainWindow::readAutomaticLocationUpdateSettings()
+void MainWindow::openSettingsDialog()
{
qDebug() << __PRETTY_FUNCTION__;
- QSettings settings(DIRECTORY_NAME, FILE_NAME);
- bool automaticUpdateEnabled = settings.value(SETTINGS_AUTOMATIC_UPDATE_ENABLED, false).toBool();
- QTime automaticUpdateInterval = settings.value(SETTINGS_AUTOMATIC_UPDATE_INTERVAL, QTime())
- .toTime();
+ SettingsDialog *settingsDialog = new SettingsDialog(this);
+ settingsDialog->enableSituareSettings((m_loggedIn && m_gpsToggleAct->isChecked()));
+ connect(settingsDialog, SIGNAL(accepted()), this, SLOT(settingsDialogAccepted()));
- if (automaticUpdateEnabled && automaticUpdateInterval.isValid()) {
- QTime time;
- emit enableAutomaticLocationUpdate(true, time.msecsTo(automaticUpdateInterval));
- } else {
- emit enableAutomaticLocationUpdate(false);
- }
+ settingsDialog->show();
}
void MainWindow::queueDialog(QDialog *dialog)
showInformationBox();
}
+void MainWindow::readAutomaticLocationUpdateSettings()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ QSettings settings(DIRECTORY_NAME, FILE_NAME);
+ bool automaticUpdateEnabled = settings.value(SETTINGS_AUTOMATIC_UPDATE_ENABLED, false).toBool();
+ QTime automaticUpdateInterval = settings.value(SETTINGS_AUTOMATIC_UPDATE_INTERVAL, QTime())
+ .toTime();
+
+ if (automaticUpdateEnabled && automaticUpdateInterval.isValid()) {
+ QTime time;
+ emit enableAutomaticLocationUpdate(true, time.msecsTo(automaticUpdateInterval));
+ } else {
+ emit enableAutomaticLocationUpdate(false);
+ }
+}
+
void MainWindow::saveCookies()
{
qDebug() << __PRETTY_FUNCTION__;
settings.setValue(COOKIES, list);
}
+void MainWindow::setCrosshairVisibility(bool visibility)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ if (visibility) {
+ m_crosshair->show();
+ moveCrosshair();
+ } else {
+ m_crosshair->hide();
+ }
+}
+
void MainWindow::setGPSButtonEnabled(bool enabled)
{
qDebug() << __PRETTY_FUNCTION__;
m_mapView->setScene(scene);
}
-void MainWindow::setOwnLocationCrosshairVisibility(bool visibility)
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- if (visibility) {
- m_ownLocationCrosshair->show();
- drawOwnLocationCrosshair(m_viewPortSize);
- } else {
- m_ownLocationCrosshair->hide();
- }
-}
-
void MainWindow::settingsDialogAccepted()
{
qDebug() << __PRETTY_FUNCTION__;
m_automaticUpdateLocationDialog->show();
}
-void MainWindow::toggleFullScreen()
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- if(windowState() == Qt::WindowNoState)
- showFullScreen();
- else
- showNormal();
-}
-
void MainWindow::showErrorInformationBox()
{
qDebug() << __PRETTY_FUNCTION__;
queueDialog(loginDialog);
}
+void MainWindow::toggleFullScreen()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ if(windowState() == Qt::WindowNoState)
+ showFullScreen();
+ else
+ showNormal();
+}
+
void MainWindow::toggleProgressIndicator(bool value)
{
qDebug() << __PRETTY_FUNCTION__;
*
* @param visible
*/
- void setOwnLocationCrosshairVisibility(bool visible);
+ void setCrosshairVisibility(bool visible);
/**
* @brief Sets username to member variable for login dialog
private:
/**
- * @brief Build fullscreen toggle button and connect slots
+ * @brief Build manual location setting cross hair and connect slots
*/
- void buildFullScreenButton();
+ void buildCrosshair();
/**
* @brief Build friend list panel and connect slots
void buildFriendListPanel();
/**
- * @brief Build manual location setting cross hair and connect slots
+ * @brief Build fullscreen toggle button and connect slots
*/
- void buildManualLocationCrosshair();
+ void buildFullScreenButton();
/**
* @brief Build map and connect slots
void drawOsmLicense(const QSize &size);
/**
- * @brief Slot for drawing the own location crosshair
- *
- * @param size Size of the screen
- */
- void drawOwnLocationCrosshair(const QSize &size);
-
- /**
* @brief Slot to intercept signal when error dialog/information note is processed
*
* @param status Status of the dialog
void loadDone(bool done);
/**
+ * @brief Called when map center point horizontal shifting is changed
+ *
+ * @param shifting New shifting value
+ */
+ void mapCenterHorizontalShiftingChanged(int shifting);
+
+ /**
+ * @brief Move the crosshair
+ */
+ void moveCrosshair();
+
+ /**
* @brief Slot to save cookies to settings
*/
void saveCookies();
bool m_loggedIn; ///< Indicates login state
bool m_refresh; ///< Indicates when webpage is refreshed
+ int m_mapCenterHorizontalShifting; ///< Amount of map center point horizontal shifting
int m_progressIndicatorCount; ///< Indicates the number of progress indicator calls
QAction *m_gpsToggleAct; ///< Action to trigger gps toggle
QAction *m_loginAct; ///< Action to Login/Logout
QAction *m_toSettingsAct; ///< Action to trigger switch to settings dialog
+ QLabel *m_crosshair; ///< Label for center point crosshair
QLabel *m_osmLicense; ///< Label for Open Street Map license
- QLabel *m_ownLocationCrosshair; ///< Label that show ownLocationCrosshair
QList<QDialog *> m_error_queue; ///< QList type error dialog queue
QList<QDialog *> m_queue; ///< QList type dialog queue