#include <QtGui>
#include <QtWebKit>
-#ifdef Q_WS_MAEMO_5
-#include <QtMaemo5/QMaemo5InformationBox>
-#endif // Q_WS_MAEMO_5
-
#include "common.h"
#include "facebookservice/facebookauthentication.h"
#include "friendlistpanel.h"
#include "mainwindow.h"
-// These MUST BE HERE, compiling fails under scratchbox if moved
+// These MUST BE HERE, compiling for Maemo fails if moved
+#ifdef Q_WS_MAEMO_5
+#include <QtMaemo5/QMaemo5InformationBox>
#include <QtGui/QX11Info>
-#include <X11/Xlib.h>
#include <X11/Xatom.h>
+#include <X11/Xlib.h>
+#endif // Q_WS_MAEMO_5
// values for setting screen size in desktop matching N900 screen size
const int N900_APP_WIDTH = 800;
m_drawOwnLocationCrosshair(false),
m_loggedIn(false),
m_refresh(false),
+ m_ownLocationCrosshair(0),
m_email(),
m_password(),
+ m_fullScreenButton(0),
m_webView(0),
m_cookieJar(0)
{
// set stacking order of widgets
m_zoomButtonPanel->stackUnder(m_userPanel);
- m_osmLicense->stackUnder(m_zoomButtonPanel);
+ if(m_fullScreenButton) {
+ m_fullScreenButton->stackUnder(m_zoomButtonPanel);
+ m_osmLicense->stackUnder(m_fullScreenButton);
+ } else
+ m_osmLicense->stackUnder(m_zoomButtonPanel);
m_ownLocationCrosshair->stackUnder(m_osmLicense);
m_mapView->stackUnder(m_ownLocationCrosshair);
delete m_webView;
}
+void MainWindow::automaticLocationUpdateEnabled(bool enabled)
+{
+ m_settingsDialog->setAutomaticLocationUpdateSettings(enabled);
+}
+
+void MainWindow::buildFullScreenButton()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+#ifdef Q_WS_MAEMO_5
+ m_fullScreenButton = new QToolButton(this);
+ m_fullScreenButton->setIcon(QIcon::fromTheme(QLatin1String("general_fullsize")));
+ m_fullScreenButton->setFixedSize(m_fullScreenButton->sizeHint());
+ connect(m_fullScreenButton, SIGNAL(clicked()),
+ this, SLOT(toggleFullScreen()));
+#endif // Q_WS_MAEMO_5
+
+}
+
void MainWindow::buildFriendListPanel()
{
qDebug() << __PRETTY_FUNCTION__;
m_mapView = new MapView(this);
buildZoomButtonPanel();
-
- m_ownLocationCrosshair = 0;
buildOsmLicense();
buildManualLocationCrosshair();
+ buildFullScreenButton();
connect(m_mapView, SIGNAL(viewScrolled(QPoint)),
this, SIGNAL(mapViewScrolled(QPoint)));
connect(m_mapView, SIGNAL(viewResized(QSize)),
this, SIGNAL(mapViewResized(QSize)));
+ connect(m_mapView, SIGNAL(viewResized(QSize)),
+ this, SLOT(drawFullScreenButton(QSize)));
+
connect(m_mapView, SIGNAL(viewResizedNewSize(int, int)),
this, SLOT(setViewPortSize(int, int)));
m_viewMenu->setObjectName(tr("Menu"));
}
+void MainWindow::drawFullScreenButton(const QSize &size)
+{
+ qDebug() << __PRETTY_FUNCTION__ << size.width() << "x" << size.height();
+
+ if(m_fullScreenButton) {
+ m_fullScreenButton->move(size.width() - m_fullScreenButton->size().width()
+ - PANEL_PEEK_AMOUNT,
+ size.height() - m_fullScreenButton->size().height());
+ }
+}
+
void MainWindow::drawOsmLicense(const QSize &size)
{
qDebug() << __PRETTY_FUNCTION__ << size.width() << "x" << size.height();
m_osmLicense->move(size.width() - m_osmLicense->fontMetrics().width(OSM_LICENSE)
- PANEL_PEEK_AMOUNT,
size.height() - m_osmLicense->fontMetrics().height());
-
}
void MainWindow::drawOwnLocationCrosshair(int width, int height)
}
}
-void MainWindow::gpsError(const QString &message)
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- showMaemoInformationBox(message);
-}
-
void MainWindow::gpsTimeout()
{
qDebug() << __PRETTY_FUNCTION__;
toggleProgressIndicator(false);
- showMaemoInformationBox(tr("Invalid E-mail address or password"), true);
-
QStringList urlParts;
urlParts.append(FACEBOOK_LOGINBASE);
urlParts.append(SITUARE_PUBLIC_FACEBOOKAPI_KEY);
m_viewPortHeight = height;
}
+bool MainWindow::showEnableAutomaticUpdateLocationDialog()
+{
+ QMessageBox msgBox(QMessageBox::Warning, tr("Automatic location update"),
+ tr("Are you sure you want to enable automatic location update?"),
+ QMessageBox::Ok | QMessageBox::Cancel, 0);
+ msgBox.button(QMessageBox::Ok)->setText(tr("Ok"));
+ int ret = msgBox.exec();
+
+ if (ret == QMessageBox::Ok)
+ return true;
+ else
+ return false;
+}
+
void MainWindow::showMaemoInformationBox(const QString &message, bool modal)
{
qDebug() << __PRETTY_FUNCTION__;
#endif
}
+void MainWindow::toggleFullScreen()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ if(windowState() == Qt::WindowNoState)
+ showFullScreen();
+ else
+ showNormal();
+}
+
void MainWindow::startLoginProcess(const QUrl &url)
{
qDebug() << __PRETTY_FUNCTION__;
}
else {
loginDialog.userInput(m_email, m_password);
+ emit saveUsername(m_email);
m_webView->load(url);
toggleProgressIndicator(true);
m_refresh = true;