Kaj Wallin - kaj.wallin@ixonos.com
Jussi Laitinen jussi.laitinen@ixonos.com
Sami Rämö - sami.ramo@ixonos.com
+ Ville Tiensuu - ville.tiensuu@ixonos.com
Situare is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
#include "friendlistpanel.h"
#include "logindialog.h"
#include "map/mapview.h"
-#include "panelsidebar.h"
#include "settingsdialog.h"
#include "userinfopanel.h"
#include "zoombuttonpanel.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent),
m_drawOwnLocationCrosshair(false),
+ m_loggedIn(false),
m_refresh(false),
m_email(),
m_password(),
qDebug() << __PRETTY_FUNCTION__;
m_friendsListPanel = new FriendListPanel(this);
- PanelSideBar *friendsListPanelSidebar = new PanelSideBar(this, RIGHT);
+ m_friendsListPanelSidebar = new PanelSideBar(this, RIGHT);
- m_friendsListPanel->stackUnder(friendsListPanelSidebar);
+ m_friendsListPanel->stackUnder(m_friendsListPanelSidebar);
connect(this, SIGNAL(friendsLocationsReady(QList<User*>&)),
m_friendsListPanel, SLOT(friendInfoReceived(QList<User*>&)));
m_friendsListPanel, SLOT(showFriendsInList(QList<QString>)));
connect(m_mapView, SIGNAL(viewResizedNewSize(int, int)),
- friendsListPanelSidebar, SLOT(reDrawSidebar(int, int)));
+ m_friendsListPanelSidebar, SLOT(reDrawSidebar(int, int)));
}
void MainWindow::buildManualLocationCrosshair()
void MainWindow::buildOsmLicense()
{
- qWarning() << __PRETTY_FUNCTION__;
+ qDebug() << __PRETTY_FUNCTION__;
m_osmLicense = new QLabel(this);
m_osmLicense->setAttribute(Qt::WA_TranslucentBackground, true);
qDebug() << __PRETTY_FUNCTION__;
m_userPanel = new UserInfoPanel(this);
- PanelSideBar *userPanelSidebar = new PanelSideBar(this, LEFT);
+ m_userPanelSidebar = new PanelSideBar(this, LEFT);
+
+ m_userPanelSidebar->stackUnder(m_friendsListPanel);
+ m_userPanel->stackUnder(m_userPanelSidebar);
- userPanelSidebar->stackUnder(m_friendsListPanel);
- m_userPanel->stackUnder(userPanelSidebar);
+ connect(m_userPanel, SIGNAL(findUser(QPointF)),
+ this, SIGNAL(findUser(QPointF)));
connect(this, SIGNAL(userLocationReady(User*)),
m_userPanel, SLOT(userDataReceived(User*)));
{
qDebug() << __PRETTY_FUNCTION__;
- m_zoomButtonPanel = new ZoomButtonPanel(this, ZOOM_BUTTON_PANEL_POSITION_X,
- ZOOM_BUTTON_PANEL_POSITION_Y);
+ m_zoomButtonPanel = new ZoomButtonPanel(this);
- connect(m_zoomButtonPanel->m_zoomInButton, SIGNAL(clicked()),
+ connect(m_zoomButtonPanel->zoomInButton(), SIGNAL(clicked()),
this, SIGNAL(zoomIn()));
- connect(m_zoomButtonPanel->m_zoomOutButton, SIGNAL(clicked()),
+ connect(m_zoomButtonPanel->zoomOutButton(), SIGNAL(clicked()),
this, SIGNAL(zoomOut()));
connect(this, SIGNAL(zoomLevelChanged(int)),
connect(this, SIGNAL(minZoomLevelReached()),
m_zoomButtonPanel, SLOT(disableZoomOutButton()));
+
+ connect(m_mapView, SIGNAL(viewResized(QSize)),
+ m_zoomButtonPanel, SLOT(screenResized(QSize)));
}
void MainWindow::createMenus()
{
qDebug() << __PRETTY_FUNCTION__;
+ // login/logout
+ m_loginAct = new QAction(tr("Login"), this);
+ connect(m_loginAct, SIGNAL(triggered()),
+ this, SIGNAL(loginActionPressed()));
+
// settings
m_toSettingsAct = new QAction(tr("Settings"), this);
- m_toSettingsAct->setObjectName(tr("Settings"));
connect(m_toSettingsAct, SIGNAL(triggered()),
this, SLOT(openSettingsDialog()));
// build the actual menu
m_viewMenu = menuBar()->addMenu(tr("Main"));
+ m_viewMenu->addAction(m_loginAct);
m_viewMenu->addAction(m_toSettingsAct);
m_viewMenu->addAction(m_gpsToggleAct);
m_viewMenu->addAction(m_autoCenteringAct);
{
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());
+ m_osmLicense->move(size.width() - m_osmLicense->fontMetrics().width(OSM_LICENSE)
+ - PANEL_PEEK_AMOUNT,
+ size.height() - m_osmLicense->fontMetrics().height());
}
}
}
+void MainWindow::loggedIn(bool logged)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_loggedIn = logged;
+
+ if(logged) {
+ m_loginAct->setText(tr("Logout"));
+ }
+ else {
+ m_loginAct->setText(tr("Login"));
+ }
+ showPanels(m_loggedIn);
+}
+
void MainWindow::loginDialogDone(const QString &email, const QString &password)
{
qDebug() << __PRETTY_FUNCTION__;
qDebug() << __PRETTY_FUNCTION__;
SettingsDialog *dialog = new SettingsDialog(this);
+ if(!m_loggedIn) {
+ dialog->disableSituareSettings();
+ }
dialog->show();
}
m_mapView->setScene(scene);
}
-void MainWindow::setUsername(const QString &username)
-{
- qDebug() << __PRETTY_FUNCTION__;
- m_email = username;
-}
-
void MainWindow::setOwnLocationCrosshairVisibility(bool visibility)
{
qDebug() << __PRETTY_FUNCTION__;
}
}
+void MainWindow::setUsername(const QString &username)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+ m_email = username;
+}
+
void MainWindow::setViewPortSize(int width, int height)
{
qDebug() << __PRETTY_FUNCTION__;
#endif
}
+void MainWindow::showPanels(bool show)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+ if(show) {
+ m_friendsListPanel->show();
+ m_friendsListPanelSidebar->show();
+ m_userPanel->show();
+ m_userPanelSidebar->show();
+ }
+ else {
+ m_friendsListPanel->closePanel();
+ m_friendsListPanel->hide();
+ m_friendsListPanelSidebar->hide();
+ m_userPanel->closePanel();
+ m_userPanel->hide();
+ m_userPanelSidebar->hide();
+ }
+}
+
void MainWindow::startLoginProcess(const QUrl &url)
{
qDebug() << __PRETTY_FUNCTION__;