<RCC>
<qresource prefix="/">
<file>res/images/aeroplane_icon_gray.png</file>
- <file>res/images/arrow_left.png</file>
- <file>res/images/arrow_right.png</file>
<file>res/images/car_icon_gray.png</file>
<file>res/images/clock.png</file>
<file>res/images/compass.png</file>
<file>res/images/envelope.png</file>
<file>res/images/friend_group.png</file>
+ <file>res/images/friend_list.png</file>
<file>res/images/gps_position.png</file>
<file>res/images/gps_position_s.png</file>
<file>res/images/large_profile_pic_border_left.png</file>
<file>res/images/refresh.png</file>
<file>res/images/refresh_s.png</file>
<file>res/images/rocket_icon_gray.png</file>
+ <file>res/images/routing.png</file>
<file>res/images/send_position.png</file>
<file>res/images/send_position_s.png</file>
<file>res/images/show_position.png</file>
<file>res/images/show_position_s.png</file>
- <file>res/images/side_bar_middle_left.png</file>
- <file>res/images/side_bar_middle_right.png</file>
- <file>res/images/side_bar_tile_left.png</file>
- <file>res/images/side_bar_tile_right.png</file>
<file>res/images/sight.png</file>
- <file>res/images/sliding_bar_button.png</file>
<file>res/images/sliding_bar_tile.png</file>
- <file>res/images/user_info_item_bottom.png</file>
- <file>res/images/user_info_item_middle.png</file>
- <file>res/images/user_info_item_top.png</file>
+ <file>res/images/tab_active.png</file>
+ <file>res/images/tab_inactive.png</file>
+ <file>res/images/tab_inactive_2.png</file>
+ <file>res/images/user_info.png</file>
<file>res/images/walk_icon_gray.png</file>
<file>res/images/zoom_in.png</file>
<file>res/images/zoom_out.png</file>
TRANSLATIONS += ../res/languages/situare_fi.ts
SOURCES += main.cpp \
application.cpp \
+ coordinates/geocoordinate.cpp \
+ coordinates/scenecoordinate.cpp \
engine/engine.cpp \
+ engine/mce.cpp \
facebookservice/facebookauthentication.cpp \
facebookservice/facebookcredentials.cpp \
gps/gpsposition.cpp \
map/gpslocationitem.cpp \
map/mapengine.cpp \
map/mapfetcher.cpp \
+ map/maprouteitem.cpp \
map/mapscene.cpp \
map/mapscroller.cpp \
map/maptile.cpp \
network/networkcookiejar.cpp \
network/networkhandler.cpp \
network/networkreply.cpp \
+ routing/geocodingservice.cpp \
+ routing/location.cpp \
+ routing/route.cpp \
+ routing/routesegment.cpp \
+ routing/routingservice.cpp \
situareservice/imagefetcher.cpp \
situareservice/situareservice.cpp \
ui/updatelocation/texteditautoresizer.cpp \
ui/avatarimage.cpp \
ui/friendlistitem.cpp \
ui/friendlistpanel.cpp \
+ ui/fullscreenbutton.cpp \
ui/imagebutton.cpp \
+ ui/indicatorbutton.cpp \
+ ui/indicatorbuttonpanel.cpp \
ui/logindialog.cpp \
ui/mainwindow.cpp \
ui/mapscale.cpp \
- ui/panelsidebar.cpp \
- ui/panelsliderbar.cpp \
ui/settingsdialog.cpp \
- ui/sidepanel.cpp \
- ui/sidepanelbase.cpp \
ui/userinfo.cpp \
ui/userinfopanel.cpp \
ui/zoombutton.cpp \
ui/zoombuttonpanel.cpp \
- user/user.cpp \
- ui/fullscreenbutton.cpp \
- engine/mce.cpp \
- ui/indicatorbutton.cpp \
- routing/routingservice.cpp \
- routing/routesegment.cpp \
- routing/route.cpp \
- routing/location.cpp \
- map/maprouteitem.cpp \
- coordinates/scenecoordinate.cpp \
- coordinates/geocoordinate.cpp \
ui/listview.cpp \
ui/listitem.cpp \
ui/listitemdelegate.cpp \
ui/friendlistitemdelegate.cpp \
ui/searchdialog.cpp \
- ui/indicatorbuttonpanel.cpp\
- routing/geocodingservice.cpp
+ ui/paneltab.cpp \
+ ui/tabbedpanel.cpp \
+ ui/panelbar.cpp \
+ ui/panelcontent.cpp \
+ ui/panelbase.cpp \
+ user/user.cpp
HEADERS += application.h \
common.h \
engine/engine.h \
+ error.h \
facebookservice/facebookauthentication.h \
facebookservice/facebookcommon.h \
facebookservice/facebookcredentials.h \
ui/mainwindow.h \
ui/mapscale.h \
ui/panelcommon.h \
- ui/panelsidebar.h \
- ui/panelsliderbar.h \
ui/settingsdialog.h \
ui/userinfo.h \
ui/userinfopanel.h \
- ui/sidepanel.h \
- ui/sidepanelbase.h \
ui/zoombutton.h \
ui/zoombuttonpanel.h \
user/user.h \
ui/fullscreenbutton.h \
engine/mce.h \
ui/indicatorbutton.h \
+ ui/indicatorbuttonpanel.h \
+ routing/geocodingservice.h \
routing/routingservice.h \
routing/routingcommon.h \
routing/routesegment.h \
ui/friendlistitemdelegate.h \
ui/listcommon.h \
ui/searchdialog.h \
- ui/indicatorbuttonpanel.h\
- error.h \
- routing/geocodingservice.h
+ ui/paneltab.h \
+ ui/tabbedpanel.h \
+ ui/panelbar.h \
+ ui/panelcontent.h \
+ ui/panelbase.h
QT += network \
webkit
Kaj Wallin - kaj.wallin@ixonos.com
Henri Lampela - henri.lampela@ixonos.com
+ Pekka Nissinen - pekka.nissinen@ixonos.com
Situare is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
#include "friendlistitem.h"
#include "friendlistitemdelegate.h"
#include "panelcommon.h"
-#include "sidepanel.h"
#include "friendlistpanel.h"
FriendListPanel::FriendListPanel(QWidget *parent)
- : SidePanel(parent)
+ : QWidget(parent)
{
qDebug() << __PRETTY_FUNCTION__;
- setType(SidePanel::FriendPanel);
- QHBoxLayout *filterLayout = new QHBoxLayout;
+ QVBoxLayout *friendListPanelLayout = new QVBoxLayout();
+ friendListPanelLayout->setMargin(0);
+ friendListPanelLayout->setSpacing(0);
+ friendListPanelLayout->setContentsMargins(PANEL_MARGIN_LEFT, 0, PANEL_MARGIN_RIGHT, 0);
+ setLayout(friendListPanelLayout);
+
+ QHBoxLayout *filterLayout = new QHBoxLayout();
filterLayout->setContentsMargins(FRIENDPANEL_FILTER_MARGIN_LEFT, 0,
FRIENDPANEL_FILTER_MARGIN_RIGHT, 0);
+
m_friendListHeaderWidget = new QWidget();
m_friendListHeaderWidget->setLayout(filterLayout);
m_friendListHeaderWidget->setAutoFillBackground(true);
+
QPalette labelPalette = m_friendListHeaderWidget->palette();
labelPalette.setColor(QPalette::Background, Qt::black);
+
m_friendListHeaderWidget->setPalette(labelPalette);
m_friendListHeaderWidget->hide();
m_friendListLabel = new QLabel(this);
m_clearFilterButton = new QPushButton(tr("Show all"));
+
filterLayout->addWidget(m_friendListLabel);
filterLayout->addWidget(m_clearFilterButton);
- m_panelVBox->addWidget(m_friendListHeaderWidget);
-
- QHBoxLayout *friendListLayout = new QHBoxLayout;
- friendListLayout->setContentsMargins(FRIENDPANEL_MARGIN_LEFT, FRIENDPANEL_MARGIN_TOP,
- FRIENDPANEL_MARGIN_RIGHT, FRIENDPANEL_MARGIN_BOTTOM);
m_friendListView = new ListView(this);
+
m_friendListView->setAutoFillBackground(false);
m_friendListView->viewport()->setAutoFillBackground(false);
m_friendListItemDelegate = new FriendListItemDelegate();
m_friendListView->setItemDelegate(m_friendListItemDelegate);
- friendListLayout->addWidget(m_friendListView);
- m_panelVBox->addLayout(friendListLayout);
+ friendListPanelLayout->addWidget(m_friendListHeaderWidget);
+ friendListPanelLayout->addWidget(m_friendListView);
connect(m_friendListView, SIGNAL(listItemClicked(GeoCoordinate)),
this, SIGNAL(findFriend(GeoCoordinate)));
connect(m_clearFilterButton, SIGNAL(clicked()),
this, SLOT(clearFriendListFilter()));
- connect(this, SIGNAL(panelOpened()),
- this, SLOT(clearFriendListFilter()));
+
+// connect(this, SIGNAL(panelOpened()),
+// this, SLOT(clearFriendListFilter()));
}
void FriendListPanel::friendImageReady(User *user)
item = new FriendListItem();
item->setUserData(user);
m_friendListView->addListItem(user->userId(), item);
- }
- else {
+ } else {
item = static_cast<FriendListItem *>(m_friendListView->takeListItemFromView(
user->userId()));
m_friendListLabel->setText(tr("Selected: %1").arg(userIDs.count()));
- openPanel();
+// openPanel();
m_friendListHeaderWidget->show();
m_friendListView->filter(userIDs);
}
- /*
+/*
Situare - A location system for Facebook
Copyright (C) 2010 Ixonos Plc. Authors:
Kaj Wallin - kaj.wallin@ixonos.com
Henri Lampela - henri.lampela@ixonos.com
+ Pekka Nissinen - pekka.nissinen@ixonos.com
Situare is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
along with Situare; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA.
- */
+*/
#ifndef FRIENDLISTPANEL_H
#define FRIENDLISTPANEL_H
#include <QtGui>
-#include "sidepanel.h"
-
class QLabel;
class QWidget;
class User;
/**
-* @brief Class for sliding friends list panel
-*
-* @author Kaj Wallin - kaj.wallin (at) ixonos.com
-* @class FriendListPanel friendlistpanel.h "ui/friendlistpanel.h"
-*/
-class FriendListPanel : public SidePanel
+ * @brief Class for sliding friends list panel
+ *
+ * @author Kaj Wallin - kaj.wallin (at) ixonos.com
+ * @author Henri Lampela - henri.lampela (at) ixonos.com
+ * @author Pekka Nissinen - pekka.nissinen (at) ixonos.com
+ *
+ * @class FriendListPanel friendlistpanel.h "ui/friendlistpanel.h"
+ */
+class FriendListPanel : public QWidget
{
Q_OBJECT
public:
/**
- * @brief Default constructor
- *
- * @param parent
- */
+ * @brief Default constructor
+ *
+ * @param parent
+ */
FriendListPanel(QWidget *parent = 0);
/*******************************************************************************
******************************************************************************/
public slots:
/**
- * @brief Slot to update friend item's image
- *
- * @param user Friend
- */
+ * @brief Slot to update friend item's image
+ *
+ * @param user Friend
+ */
void friendImageReady(User *user);
/**
- * @brief Slot to refresh friends list
- *
- * @param friendList
- */
+ * @brief Slot to refresh friends list
+ *
+ * @param friendList
+ */
void friendInfoReceived(QList<User *> &friendList);
private slots:
/**
- * @brief Slot to clear friend list filter.
- */
+ * @brief Slot to clear friend list filter.
+ */
void clearFriendListFilter();
/**
- * @brief Slot to show friends in list.
- *
- * Shows only friends that are on userIDs list.
- * @param userIDs list of user ID's
- */
+ * @brief Slot to show friends in list.
+ *
+ * Shows only friends that are on userIDs list.
+ * @param userIDs list of user ID's
+ */
void showFriendsInList(const QList<QString> &userIDs);
/*******************************************************************************
******************************************************************************/
signals:
/**
- * @brief Signal for friend finding.
- *
- * @param coordinates Target coordinate
- */
+ * @brief Signal for friend finding.
+ *
+ * @param coordinates Target coordinate
+ */
void findFriend(const GeoCoordinate &coordinates);
/*******************************************************************************
******************************************************************************/
private:
QWidget *m_friendListHeaderWidget; ///< Friend list header widget
+
QLabel *m_friendListLabel; ///< Friend list label
+
QPushButton *m_clearFilterButton; ///< Button to clear list filtering
- ListView *m_friendListView; ///< Friend list view
+
+ ListView *m_friendListView; ///< Friend list view
FriendListItemDelegate *m_friendListItemDelegate; ///< Friend list item delegate
};
/*
- Situare - A location system for Facebook
- Copyright (C) 2010 Ixonos Plc. Authors:
-
- Katri Kaikkonen - katri.kaikkonen@ixonos.com
- Kaj Wallin - kaj.wallin@ixonos.com
- Sami Rämö - sami.ramo@ixonos.com
-
- Situare is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- version 2 as published by the Free Software Foundation.
-
- Situare is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Situare; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- USA.
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Kaj Wallin - kaj.wallin@ixonos.com
+ Katri Kaikkonen - katri.kaikkonen@ixonos.com
+ Sami Rämö - sami.ramo@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
*/
#include <QDebug>
#include <QMouseEvent>
#include <QTimer>
#include <QToolButton>
-#include <QWidget>
/**
* @brief Indicator button class
*
* @brief Name label's maximum width
*/
-const int NAME_LABEL_MAX_WIDTH = ITEM_WIDTH - 3*MARGIN - IMAGE_WIDTH;
+const int NAME_LABEL_MAX_WIDTH = ITEM_WIDTH - 3 * MARGIN - IMAGE_WIDTH;
/**
* @var LABEL_MAX_WIDTH
*
* @brief All label's maximum width
*/
-const int LABEL_MAX_WIDTH = ITEM_WIDTH - 3 * MARGIN - IMAGE_WIDTH - MARGIN - ICON_WIDTH - MARGIN*2;
+const int LABEL_MAX_WIDTH = ITEM_WIDTH - 3 * MARGIN - IMAGE_WIDTH - MARGIN - ICON_WIDTH - MARGIN * 2;
const int NAME_DISPLAY_INDEX = Qt::DisplayRole;
const int AVATAR_IMAGE_INDEX = Qt::DecorationRole;
Henri Lampela - henri.lampela@ixonos.com
Kaj Wallin - kaj.wallin@ixonos.com
- Jussi Laitinen jussi.laitinen@ixonos.com
+ Jussi Laitinen - jussi.laitinen@ixonos.com
Sami Rämö - sami.ramo@ixonos.com
Ville Tiensuu - ville.tiensuu@ixonos.com
Katri Kaikkonen - katri.kaikkonen@ixonos.com
#include "fullscreenbutton.h"
#include "logindialog.h"
#include "mapscale.h"
+#include "panelcommon.h"
+#include "tabbedpanel.h"
#include "searchdialog.h"
#include "settingsdialog.h"
#include "userinfopanel.h"
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent),
- m_errorShown(false),
- m_loggedIn(false),
- m_refresh(false),
- m_progressIndicatorCount(0),
- m_ownLocationCrosshair(0),
- m_email(),
- m_password(),
- m_webView(0),
- m_fullScreenButton(0),
- m_indicatorButtonPanel(0),
- m_mapScale(0),
- m_cookieJar(0)
+ m_errorShown(false),
+ m_loggedIn(false),
+ m_refresh(false),
+ m_progressIndicatorCount(0),
+ m_ownLocationCrosshair(0),
+ m_email(),
+ m_password(),
+ m_webView(0),
+ m_fullScreenButton(0),
+ m_indicatorButton(0),
+ m_mapScale(0),
+ m_cookieJar(0)
{
qDebug() << __PRETTY_FUNCTION__;
setCentralWidget(new QWidget());
centralWidget()->setLayout(layout);
- buildFriendListPanel();
- buildUserInfoPanel();
+ buildPanels();
createMenus();
setWindowTitle(tr("Situare"));
// set stacking order of widgets
- m_zoomButtonPanel->stackUnder(m_userPanel);
+ m_zoomButtonPanel->stackUnder(m_tabbedPanel);
if(m_fullScreenButton) {
m_fullScreenButton->stackUnder(m_zoomButtonPanel);
m_osmLicense->stackUnder(m_fullScreenButton);
m_friendsListPanel = new FriendListPanel(this);
- m_friendsListPanelSidebar = new PanelSideBar(this, RIGHT);
-
- m_friendsListPanel->stackUnder(m_friendsListPanelSidebar);
-
connect(this, SIGNAL(friendsLocationsReady(QList<User*>&)),
m_friendsListPanel, SLOT(friendInfoReceived(QList<User*>&)));
connect(this, SIGNAL(locationItemClicked(QList<QString>)),
m_friendsListPanel, SLOT(showFriendsInList(QList<QString>)));
- connect(m_mapView, SIGNAL(viewResized(QSize)),
- m_friendsListPanel, SLOT(resizePanel(QSize)));
-
- connect(m_mapView, SIGNAL(viewResized(QSize)),
- m_friendsListPanelSidebar, SLOT(resizeSideBar(QSize)));
-
connect(m_friendsListPanel, SIGNAL(findFriend(GeoCoordinate)),
this, SIGNAL(findFriend(GeoCoordinate)));
this, SLOT(drawOsmLicense(QSize)));
}
-void MainWindow::buildUserInfoPanel()
+void MainWindow::buildPanels()
{
qDebug() << __PRETTY_FUNCTION__;
- m_userPanel = new UserInfoPanel(this);
+ buildUserInfoPanel();
+ buildFriendListPanel();
- m_userPanelSidebar = new PanelSideBar(this, LEFT);
+ m_tabbedPanel = new TabbedPanel(this);
+ m_tabbedPanel->addTab(m_userInfoPanel, QIcon(":/res/images/user_info.png"));
+ m_tabbedPanel->addTab(m_friendsListPanel, QIcon(":/res/images/friend_list.png"));
- m_userPanelSidebar->stackUnder(m_friendsListPanel);
- m_userPanel->stackUnder(m_userPanelSidebar);
+ connect(m_tabbedPanel, SIGNAL(panelOpened()),
+ m_friendsListPanel, SLOT(clearFriendListFilter()));
+
+ connect(m_mapView, SIGNAL(viewResized(QSize)),
+ m_tabbedPanel, SLOT(resizePanel(QSize)));
+}
+
+void MainWindow::buildUserInfoPanel()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_userInfoPanel = new UserInfoPanel(this);
connect(this, SIGNAL(userLocationReady(User*)),
- m_userPanel, SLOT(userDataReceived(User*)));
+ m_userInfoPanel, SLOT(userDataReceived(User*)));
connect(this, SIGNAL(reverseGeoReady(QString)),
- m_userPanel, SIGNAL(reverseGeoReady(QString)));
+ m_userInfoPanel, SIGNAL(reverseGeoReady(QString)));
connect(this, SIGNAL(clearUpdateLocationDialogData()),
- m_userPanel, SIGNAL(clearUpdateLocationDialogData()));
-
- connect(m_mapView, SIGNAL(viewResized(QSize)),
- m_userPanel, SLOT(resizePanel(QSize)));
+ m_userInfoPanel, SIGNAL(clearUpdateLocationDialogData()));
- connect(m_mapView, SIGNAL(viewResized(QSize)),
- m_userPanelSidebar, SLOT(resizeSideBar(QSize)));
-
- connect(m_userPanel, SIGNAL(findUser(GeoCoordinate)),
+ connect(m_userInfoPanel, SIGNAL(findUser(GeoCoordinate)),
this, SIGNAL(findUser(GeoCoordinate)));
- connect(m_userPanel, SIGNAL(requestReverseGeo()),
+ connect(m_userInfoPanel, SIGNAL(requestReverseGeo()),
this, SIGNAL(requestReverseGeo()));
- connect(m_userPanel, SIGNAL(statusUpdate(QString,bool)),
+ connect(m_userInfoPanel, SIGNAL(statusUpdate(QString,bool)),
this, SIGNAL(statusUpdate(QString,bool)));
- connect(m_userPanel, SIGNAL(refreshUserData()),
+ connect(m_userInfoPanel, SIGNAL(refreshUserData()),
this, SIGNAL(refreshUserData()));
- connect(m_userPanel, SIGNAL(notificateUpdateFailing(QString, bool)),
+ connect(m_userInfoPanel, SIGNAL(notificateUpdateFailing(QString, bool)),
this, SLOT(buildInformationBox(QString, bool)));
}
{
qDebug() << __PRETTY_FUNCTION__ << size.width() << "x" << size.height();
- if(m_fullScreenButton) {
- if(m_loggedIn) {
- m_fullScreenButton->move(size.width() - m_fullScreenButton->size().width()
- - PANEL_PEEK_AMOUNT,
- size.height() - m_fullScreenButton->size().height());
- } else {
- m_fullScreenButton->move(size.width() - m_fullScreenButton->size().width(),
- size.height() - m_fullScreenButton->size().height());
- }
- }
+ if(m_fullScreenButton)
+ m_fullScreenButton->move(size.width() - m_fullScreenButton->size().width(),
+ size.height() - m_fullScreenButton->size().height());
}
void MainWindow::drawMapScale(const QSize &size)
const int LEFT_SCALE_MARGIN = 10;
const int BOTTOM_SCALE_MARGIN = 2;
- qDebug() << __PRETTY_FUNCTION__ << size.width() << "x" << size.height();
+// qDebug() << __PRETTY_FUNCTION__ << size.width() << "x" << size.height();
- m_mapScale->move(PANEL_PEEK_AMOUNT + LEFT_SCALE_MARGIN,
+ m_mapScale->move(LEFT_SCALE_MARGIN,
size.height() - m_mapScale->size().height() - BOTTOM_SCALE_MARGIN);
}
qDebug() << __PRETTY_FUNCTION__ << size.width() << "x" << size.height();
m_osmLicense->move(size.width() - m_osmLicense->fontMetrics().width(OSM_LICENSE)
- - PANEL_PEEK_AMOUNT,
+ - PANEL_BAR_WIDTH,
size.height() - m_osmLicense->fontMetrics().height());
}
drawFullScreenButton(m_viewPortSize);
- if(m_loggedIn) {
- if(!m_friendsListPanel->isVisible()) {
- m_friendsListPanel->show();
- m_friendsListPanelSidebar->show();
- }
+// if(m_loggedIn) {
+// if(!m_friendsListPanel->isVisible()) {
+// m_friendsListPanel->show();
+// m_friendsListPanelSidebar->show();
+// }
- if(!m_userPanel->isVisible()) {
- m_userPanel->show();
- m_userPanelSidebar->show();
- }
- }
+// if(!m_userPanel->isVisible()) {
+// m_userPanel->show();
+// m_userPanelSidebar->show();
+// }
+// }
}
void MainWindow::startLocationSearch()
{
qDebug() << __PRETTY_FUNCTION__;
- if(!m_loggedIn) {
- m_friendsListPanel->closePanel();
- m_friendsListPanel->hide();
- m_friendsListPanelSidebar->hide();
- m_userPanel->closePanel();
- m_userPanel->hide();
- m_userPanelSidebar->hide();
- }
+// if(!m_loggedIn) {
+// m_friendsListPanel->closePanel();
+// m_friendsListPanel->hide();
+// m_friendsListPanelSidebar->hide();
+
+// m_userPanel->closePanel();
+// m_userPanel->hide();
+// m_userPanelSidebar->hide();
+// }
}
const QString MainWindow::username()
Henri Lampela - henri.lampela@ixonos.com
Kaj Wallin - kaj.wallin@ixonos.com
+ Jussi Laitinen - jussi.laitinen@ixonos.com
Sami Rämö - sami.ramo@ixonos.com
Katri Kaikkonen - katri.kaikkonen@ixonos.com
#include <QUrl>
#include "network/networkcookiejar.h"
-#include "panelsidebar.h"
class QGraphicsScene;
class QLabel;
class MapScale;
class MapScene;
class MapView;
+class TabbedPanel;
class SettingsDialog;
class SceneCoordinate;
class SituareService;
class UserInfoPanel;
class ZoomButtonPanel;
-
/**
* @brief Main Window Class
*/
void buildOsmLicense();
/**
+ * @brief Build application panels
+ */
+ void buildPanels();
+
+ /**
* @brief Build user info panel and connect slots
*/
void buildUserInfoPanel();
MapScale *m_mapScale; ///< Instance of the map scale
MapView *m_mapView; ///< Instance of the map view
NetworkCookieJar *m_cookieJar; ///< Placeholder for QNetworkCookies
- PanelSideBar *m_userPanelSidebar; ///< User panel side bar
- PanelSideBar *m_friendsListPanelSidebar;///< Friends panel side bar
- UserInfoPanel *m_userPanel; ///< Instance of the user information panel
+ TabbedPanel *m_tabbedPanel; ///< Widget for tabbed panels
+ UserInfoPanel *m_userInfoPanel; ///< Instance of the user information panel
ZoomButtonPanel *m_zoomButtonPanel; ///< Instance of zoom button panel
};
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Kaj Wallin - kaj.wallin@ixonos.com
+ Pekka Nissinen - pekka.nissinen@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+#include <QDebug>
+#include <QPainter>
+#include <QRegion>
+
+#include "panelbar.h"
+
+#include "panelcommon.h"
+
+PanelBar::PanelBar(QWidget *parent) //, Side side)
+ : QWidget(parent)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_barTile.load(":/res/images/sliding_bar_tile.png");
+ m_menuDropShadowTile.load(":/res/images/menu_bar_drop_shadow.png");
+
+ m_barRect.setRect(0, 0, PANEL_BAR_WIDTH, PANEL_HEIGHT);
+
+// m_sliderRegion = QRegion(m_buttonRect).united(QRegion(m_topRect).united(QRegion(m_bottomRect)));
+// setMask(m_sliderRegion);
+
+ this->resize(PANEL_BAR_WIDTH, PANEL_HEIGHT);
+}
+
+void PanelBar::paintEvent(QPaintEvent *)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ QPainter painter(this);
+
+ painter.drawTiledPixmap(m_barRect, m_barTile);
+ painter.drawTiledPixmap(0, 0, PANEL_BAR_WIDTH, m_menuDropShadowTile.height(),
+ m_menuDropShadowTile);
+}
+
+void PanelBar::resizeBar(const QSize &size)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_barRect.setRect(0, 0, PANEL_BAR_WIDTH, size.height());
+
+// m_sliderRegion = QRegion(m_buttonRect).united(QRegion(m_topRect).united(QRegion(m_bottomRect)));
+// setMask(m_sliderRegion);
+
+ this->resize(PANEL_BAR_WIDTH, size.height() - PANEL_TOP_PADDING - PANEL_BOTTOM_PADDING);
+}
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Kaj Wallin - kaj.wallin@ixonos.com
+ Pekka Nissinen - pekka.nissinen@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+#ifndef PANELBAR_H
+#define PANELBAR_H
+
+#include <QWidget>
+
+/**
+ * @brief Generic class for panel bars
+ *
+ * @author Kaj Wallin - kaj.wallin (at) ixonos.com
+ * @author Pekka Nissinen - pekka.nissinen@ixonos.com
+ *
+ * @class PanelBar panelbar.h "ui/panelbar.h"
+ */
+class PanelBar : public QWidget
+{
+ Q_OBJECT
+
+public:
+ /**
+ * @brief Constructor
+ *
+ * @param parent Parent
+ */
+ PanelBar(QWidget *parent = 0);
+
+/*******************************************************************************
+ * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
+ ******************************************************************************/
+protected:
+ /**
+ * @brief Draws the bar
+ *
+ * @param * QPaintEvent unused
+ */
+ void paintEvent(QPaintEvent *);
+
+/*******************************************************************************
+ * MEMBER FUNCTIONS AND SLOTS
+ ******************************************************************************/
+public slots:
+ /**
+ * @brief Slot to redraw the bar after window resize event
+ *
+ * @param size Size of the new window
+ */
+ void resizeBar(const QSize &size);
+
+/*******************************************************************************
+ * DATA MEMBERS
+ ******************************************************************************/
+private:
+ QPixmap m_menuDropShadowTile; ///< Pixmap for menu drop shadow
+ QPixmap m_barTile; ///< Pixmap for panel bar
+
+ QRect m_barRect; ///< Rect for the panel bar
+
+// QRegion m_sliderRegion; ///< Region of the slider bar
+};
+#endif // PANELBAR_H
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Pekka Nissinen - pekka.nissinen@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+#include <QDebug>
+#include <QPainter>
+#include <QPalette>
+#include <QRect>
+
+#include "panelbase.h"
+
+PanelBase::PanelBase(QWidget *parent)
+ : QWidget(parent)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_menuDropShadowTile.load(":res/images/menu_bar_drop_shadow.png");
+
+ QPalette pal = palette();
+ pal.setColor(QPalette::Background, QColor(0, 0, 0, 128));
+ setPalette(pal);
+ setAutoFillBackground(true);
+}
+
+void PanelBase::paintEvent(QPaintEvent *)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ QPainter painter(this);
+
+ QRect shadowRect = QRect(0, 0, this->rect().width(), m_menuDropShadowTile.height());
+ painter.drawTiledPixmap(shadowRect, m_menuDropShadowTile);
+}
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Pekka Nissinen - pekka.nissinen@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+#ifndef PANELBASE_H
+#define PANELBASE_H
+
+#include <QPaintEvent>
+#include <QPixmap>
+#include <QWidget>
+
+/**
+ * @brief Base class for panel inner content
+ *
+ * @author Pekka Nissinen - pekka.nissinen@ixonos.com
+ *
+ * @class PanelBase panelbase.h "ui/panelbase.h"
+ */
+class PanelBase : public QWidget
+{
+ Q_OBJECT
+
+public:
+ /**
+ * @brief Constructor
+ *
+ * @param parent Parent
+ */
+ PanelBase(QWidget *parent = 0);
+
+/*******************************************************************************
+ * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
+ ******************************************************************************/
+protected:
+ /**
+ * @brief Draws the panel content base
+ *
+ * @param * QPaintEvent unused
+ */
+ void paintEvent(QPaintEvent *);
+
+/*******************************************************************************
+ * DATA MEMBERS
+ *******************************************************************************/
+private:
+ QPixmap m_menuDropShadowTile; ///< Pixmap for menu drop shadow
+};
+
+#endif // PANELBASE_H
- /*
+/*
Situare - A location system for Facebook
Copyright (C) 2010 Ixonos Plc. Authors:
along with Situare; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
USA.
- */
+*/
#ifndef PANELCOMMON_H
#define PANELCOMMON_H
const int FORCE_RELEASE_TIME = 10000; ///< How long mouse can be grabbed
// Common panel settings
-enum Side {LEFT, RIGHT}; ///< Enumerator for panel sideness
-
const int MAEMO5_SCROLLBAR_WIDTH = 8; ///< Width of the Maemo scrollbar
-const int PANEL_PEEK_AMOUNT = 27; ///< Amount of pixels shown when panel is closed
const int PANEL_TOP_PADDING = 0; ///< Amount of padding in top of panels
const int PANEL_BOTTOM_PADDING = 0; ///< Amount of padding in bottom of panels
-const int SIDEBAR_WIDTH = 23; ///< Width of the sidebar
-const int SIDEBAR_HEIGHT = DEFAULT_SCREEN_HEIGHT - PANEL_TOP_PADDING
- - PANEL_BOTTOM_PADDING; ///< Height of the sidebar
-
-const int SLIDER_BAR_WIDTH = 5; ///< Width of the slider bar
-const int SLIDER_BUTTON_OFFSET = 19; ///< Slider bar button extrusion width
-const int SLIDER_WIDTH = 43; ///< Width of the whole slider
-const int SLIDER_HEIGHT = DEFAULT_SCREEN_HEIGHT - PANEL_TOP_PADDING
- - PANEL_BOTTOM_PADDING; ///< Height of the slider
+const int PANEL_BAR_WIDTH = 5; ///< Width of the slider bar
+const int PANEL_TAB_WIDTH = 74; ///< Panel tab (maximum) width
+const int PANEL_BAR_TABBED_WIDTH = PANEL_BAR_WIDTH + PANEL_TAB_WIDTH; ///< Width of the tabbed bar
+const int PANEL_WIDTH = 384; ///< Width of the panel
+const int PANEL_HEIGHT = DEFAULT_SCREEN_HEIGHT - PANEL_TOP_PADDING
+ - PANEL_BOTTOM_PADDING; ///< Height of the panel
-// Friend list panel settings
-const int FRIENDPANEL_WIDTH = 426; ///< Width of the friends list panel
-const int FRIENDPANEL_HEIGHT = DEFAULT_SCREEN_HEIGHT - PANEL_TOP_PADDING
- - PANEL_BOTTOM_PADDING; ///< Height of the friends list panel
-
-/**
- * @brief Friend list panel inner margin (left)
- *
- * @var FRIENDPANEL_MARGIN_LEFT
- */
-const int FRIENDPANEL_MARGIN_LEFT = SLIDER_BUTTON_OFFSET
- + MAEMO5_SCROLLBAR_WIDTH;
-const int FRIENDPANEL_MARGIN_RIGHT = SIDEBAR_WIDTH; ///< Friend list panel inner margin (right)
-const int FRIENDPANEL_MARGIN_TOP = 0; ///< Friend list panel inner margin (top)
-const int FRIENDPANEL_MARGIN_BOTTOM = 0; ///< Friend list panel inner margin (bottom)
+const int PANEL_MARGIN_LEFT = MAEMO5_SCROLLBAR_WIDTH; ///< Panel inner margin (left)
+const int PANEL_MARGIN_RIGHT = 0; ///< Panel inner margin (right)
+const int PANEL_MARGIN_TOP = 0; ///< Panel inner margin (top)
+const int PANEL_MARGIN_BOTTOM = 0; ///< Panel inner margin (bottom)
/**
* @brief Friend list filter bar margin (left)
*
* @var FRIENDPANEL_FILTER_MARGIN_LEFT
*/
-const int FRIENDPANEL_FILTER_MARGIN_LEFT = FRIENDPANEL_MARGIN_LEFT + 4;
+const int FRIENDPANEL_FILTER_MARGIN_LEFT = PANEL_MARGIN_LEFT + 4;
/**
* @brief Friend list filter bar margin (right)
*
* @var FRIENDPANEL_FILTER_MARGIN_RIGHT
*/
-const int FRIENDPANEL_FILTER_MARGIN_RIGHT = FRIENDPANEL_MARGIN_RIGHT
- + MAEMO5_SCROLLBAR_WIDTH + 4;
+const int FRIENDPANEL_FILTER_MARGIN_RIGHT = PANEL_MARGIN_RIGHT + MAEMO5_SCROLLBAR_WIDTH + 4;
-const int SHOW_ALL_BUTTON_RIGHT_MARGIN = SIDEBAR_WIDTH * 2 - 7; ///< Show all button right margin
+const int SHOW_ALL_BUTTON_RIGHT_MARGIN = 39; ///< Show all button right margin
-/**
- * @brief Horizontal position of a closed friend list panel
- *
- * @var FRIENDPANEL_CLOSED_X
- */
-const int FRIENDPANEL_CLOSED_X = DEFAULT_SCREEN_WIDTH - SLIDER_BUTTON_OFFSET
- - PANEL_PEEK_AMOUNT;
+const int PANEL_CLOSED_X = DEFAULT_SCREEN_WIDTH - PANEL_TAB_WIDTH
+ - PANEL_BAR_WIDTH; ///< Horizontal position of a closed panel
-/**
- * @brief Horizontal position of a open friend list panel
- *
- * @var FRIENDPANEL_OPENED_X
- */
-const int FRIENDPANEL_OPENED_X = DEFAULT_SCREEN_WIDTH - SLIDER_BUTTON_OFFSET - SLIDER_BAR_WIDTH
- - FRIENDPANEL_WIDTH;
-
-// User info panel settings
-const int USERPANEL_WIDTH = 298; ///< Width of the user panel
-const int USERPANEL_HEIGHT = DEFAULT_SCREEN_HEIGHT - PANEL_TOP_PADDING
- - PANEL_BOTTOM_PADDING; ///< Height of the user panel
-
-const int USERPANEL_MARGIN_LEFT = SIDEBAR_WIDTH
- + MAEMO5_SCROLLBAR_WIDTH; ///< User info panel inner margin (left)
-const int USERPANEL_MARGIN_RIGHT = SLIDER_BUTTON_OFFSET; ///< User info panel inner margin (right)
-const int USERPANEL_MARGIN_TOP = 0; ///< User info panel inner margin (top)
-const int USERPANEL_MARGIN_BOTTOM = 0; ///< User info panel inner margin (bottom)
-
-/**
- * @brief Horizontal position of a closed user info panel
- *
- * @var USERPANEL_CLOSED_X
- */
-const int USERPANEL_CLOSED_X = - USERPANEL_WIDTH + PANEL_PEEK_AMOUNT
- - SLIDER_BAR_WIDTH;
-const int USERPANEL_OPENED_X = 0; ///< Horizontal position of a open user info panel
+const int PANEL_OPENED_X = DEFAULT_SCREEN_WIDTH - PANEL_TAB_WIDTH - PANEL_BAR_WIDTH
+ - PANEL_WIDTH; ///< Horizontal position of a open panel
// Zoom button panel settings
-const int ZOOM_BUTTON_PANEL_POSITION_X = 10 +
- PANEL_PEEK_AMOUNT; ///< Horizontal position of zoom panel
-const int ZOOM_BUTTON_PANEL_POSITION_Y = 10; ///< Vertical position of zoom panel
-const int ZOOM_BUTTON_PANEL_BUTTON_SPACING = 4; ///< Size of a zoom button spacing
+const int ZOOM_BUTTON_PANEL_POSITION_X = 10; ///< Horizontal position of zoom panel
+const int ZOOM_BUTTON_PANEL_POSITION_Y = 10; ///< Vertical position of zoom panel
+const int ZOOM_BUTTON_PANEL_BUTTON_SPACING = 4; ///< Size of a zoom button spacing
const QString ZOOMPANEL_POSITION = "Zoom_Panel_Position";
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Kaj Wallin - kaj.wallin@ixonos.com
+ Pekka Nissinen - pekka.nissinen@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+#include <QAbstractState>
+#include <QDebug>
+#include <QVBoxLayout>
+
+#include "panelcontent.h"
+
+#include "panelcommon.h"
+#include "panelbase.h"
+
+PanelContent::PanelContent(QWidget *parent)
+ : QWidget(parent)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ this->resize(PANEL_WIDTH, PANEL_HEIGHT);
+
+ m_panelVBox = new QVBoxLayout(this);
+ m_panelVBox->setMargin(0);
+ m_panelVBox->setSpacing(0);
+
+ m_panelBase = new PanelBase(this);
+ m_panelBase->setLayout(m_panelVBox);
+ m_panelBase->resize(this->size());
+}
+
+void PanelContent::setContentWidget(QWidget *widget)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_panelVBox->addWidget(widget);
+}
+
+void PanelContent::resizePanelContent(const QSize &size)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ this->resize(PANEL_WIDTH, size.height() - PANEL_TOP_PADDING - PANEL_BOTTOM_PADDING);
+
+ m_panelBase->resize(this->size());
+}
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Kaj Wallin - kaj.wallin@ixonos.com
+ Pekka Nissinen - pekka.nissinen@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+#ifndef PANELCONTENT_H
+#define PANELCONTENT_H
+
+#include <QWidget>
+
+class QVBoxLayout;
+
+class PanelBase;
+
+/**
+ * @brief Base class for panel content area
+ *
+ * @author Kaj Wallin - kaj.wallin (at) ixonos.com
+ * @author Pekka Nissinen - pekka.nissinen@ixonos.com
+ *
+ * @class PanelContent panelcontent.h "ui/panelcontent.h"
+ */
+class PanelContent : public QWidget
+{
+ Q_OBJECT
+
+public:
+ /**
+ * @brief Constructor
+ *
+ * @param parent
+ */
+ PanelContent(QWidget *parent = 0);
+
+/*******************************************************************************
+ * MEMBER FUNCTIONS AND SLOTS
+ ******************************************************************************/
+public:
+ /**
+ * @brief Sets the panel content widget
+ *
+ * @param widget Widget
+ */
+ void setContentWidget(QWidget *widget);
+
+public slots:
+ /**
+ * @brief Slot to redraw the panel content area after window resize event
+ *
+ * @param size Size of the new window
+ */
+ void resizePanelContent(const QSize &size);
+
+/*******************************************************************************
+ * DATA MEMBERS
+ *******************************************************************************/
+private:
+ QVBoxLayout *m_panelVBox; ///< Vertical layout inside the panel
+
+ PanelBase *m_panelBase; ///< Widget for panel base
+};
+
+#endif // PANELCONTENT_H
+++ /dev/null
-/*
- Situare - A location system for Facebook
- Copyright (C) 2010 Ixonos Plc. Authors:
-
- Kaj Wallin - kaj.wallin@ixonos.com
- Pekka Nissinen - pekka.nissinen@ixonos.com
-
- Situare is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- version 2 as published by the Free Software Foundation.
-
- Situare is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Situare; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- USA.
-*/
-
-#include <QDebug>
-#include <QPainter>
-
-#include "panelsidebar.h"
-
-PanelSideBar::PanelSideBar(QWidget *parent, Side side)
- : QWidget(parent)
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- if (side == LEFT) {
- setObjectName("SidePanelLeft");
- m_panelTile.load(":res/images/side_bar_tile_left.png");
- m_panelMiddleTile.load(":res/images/side_bar_middle_left.png");
- move(0, PANEL_TOP_PADDING);
- } else if (side == RIGHT) {
- setObjectName("SidePanelRight");
- m_panelTile.load(":res/images/side_bar_tile_right.png");
- m_panelMiddleTile.load(":res/images/side_bar_middle_right.png");
- move(DEFAULT_SCREEN_WIDTH - SIDEBAR_WIDTH, PANEL_TOP_PADDING);
- } else {
- qFatal("Illegal PanelSideBar 2nd argument");
- }
-
- m_menuDropShadowTile.load(":res/images/menu_bar_drop_shadow.png");
-
- middleRect.setRect(0, (SIDEBAR_HEIGHT / 2) - (m_panelMiddleTile.height() / 2),
- SIDEBAR_WIDTH, m_panelMiddleTile.height());
- topRect.setRect(0, 0, SIDEBAR_WIDTH, middleRect.top());
- bottomRect.setRect(0, middleRect.bottom() + 1, SIDEBAR_WIDTH,
- SIDEBAR_HEIGHT - topRect.height() - middleRect.height());
-
- resize(SIDEBAR_WIDTH, SIDEBAR_HEIGHT);
- setAttribute(Qt::WA_TransparentForMouseEvents, true);
-}
-
-void PanelSideBar::paintEvent(QPaintEvent *)
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- QPainter painter(this);
-
- painter.drawTiledPixmap(topRect, m_panelTile);
- painter.drawPixmap(middleRect, m_panelMiddleTile);
- painter.drawTiledPixmap(bottomRect, m_panelTile);
- painter.drawTiledPixmap(0, 0, SIDEBAR_WIDTH, m_menuDropShadowTile.height(), m_menuDropShadowTile);
-}
-
-void PanelSideBar::resizeSideBar(const QSize &size)
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- if (objectName() == "SidePanelRight")
- move(size.width() - SIDEBAR_WIDTH, PANEL_TOP_PADDING);
-
- middleRect.setRect(0, (size.height() / 2) - (m_panelMiddleTile.height() / 2),
- SIDEBAR_WIDTH, m_panelMiddleTile.height());
- topRect.setRect(0, 0, SIDEBAR_WIDTH, middleRect.top());
- bottomRect.setRect(0, middleRect.bottom() + 1,
- SIDEBAR_WIDTH, size.height() - topRect.height() - middleRect.height());
-
- resize(SIDEBAR_WIDTH, size.height() - PANEL_TOP_PADDING - PANEL_BOTTOM_PADDING);
-}
+++ /dev/null
-/*
- Situare - A location system for Facebook
- Copyright (C) 2010 Ixonos Plc. Authors:
-
- Kaj Wallin - kaj.wallin@ixonos.com
- Pekka Nissinen - pekka.nissinen@ixonos.com
-
- Situare is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- version 2 as published by the Free Software Foundation.
-
- Situare is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Situare; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- USA.
-*/
-
-#ifndef PANELSIDEBAR_H
-#define PANELSIDEBAR_H
-
-#include <QPaintEvent>
-#include <QPixmap>
-#include <QRect>
-#include <QSize>
-#include <QWidget>
-
-#include "panelcommon.h"
-
-/**
- * @brief Generic class for drawing sidebar anchors at the side of the screen
- *
- * @author Kaj Wallin - kaj.wallin (at) ixonos.com
- * @author Pekka Nissinen - pekka.nissinen@ixonos.com
- *
- * @class PanelSideBar panelsidebar.h "ui/panelsidebar.h"
- */
-class PanelSideBar : public QWidget
-{
- Q_OBJECT
-
-public:
- /**
- * @brief Constructor
- *
- * @param parent Parent
- * @param side Qstring for the sidebar location. Accepts "left" and "right"
- */
- PanelSideBar(QWidget *parent = 0, Side side = LEFT);
-
-/*******************************************************************************
- * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
- ******************************************************************************/
-protected:
- /**
- * @brief Draws stylesheet used in this class.
- *
- * @param * QPaintEvent unused
- */
- void paintEvent(QPaintEvent *);
-
-/*******************************************************************************
- * MEMBER FUNCTIONS AND SLOTS
- ******************************************************************************/
-public slots:
- /**
- * @brief Slot to redraw the side bar after window resize event
- *
- * @param size Size of the new window
- */
- void resizeSideBar(const QSize &size);
-
-/*******************************************************************************
- * DATA MEMBERS
- ******************************************************************************/
-private:
- QPixmap m_menuDropShadowTile; ///< Pixmap for menu drop shadow
- QPixmap m_panelMiddleTile; ///< Pixmap for side bar middle tile
- QPixmap m_panelTile; ///< Pixmap for side bar tile
- QRect topRect; ///< Rect for side bar top
- QRect middleRect; ///< Rect for side bar middle
- QRect bottomRect; ///< Rect for side bar bottom
-};
-
-#endif // PANELSIDEBAR_H
+++ /dev/null
-/*
- Situare - A location system for Facebook
- Copyright (C) 2010 Ixonos Plc. Authors:
-
- Kaj Wallin - kaj.wallin@ixonos.com
- Pekka Nissinen - pekka.nissinen@ixonos.com
-
- Situare is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- version 2 as published by the Free Software Foundation.
-
- Situare is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Situare; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- USA.
-*/
-
-#include <QDebug>
-#include <QPainter>
-#include <QRegion>
-
-#include "panelsliderbar.h"
-
-PanelSliderBar::PanelSliderBar(QWidget *parent, Side side)
- : QWidget(parent)
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- m_sliderButtonArrows[LEFT].load(":res/images/arrow_left.png");
- m_sliderButtonArrows[RIGHT].load(":res/images/arrow_right.png");
-
- if (side == LEFT) {
- m_sliderSide = side;
- m_sliderDirection = RIGHT;
- } else if (side == RIGHT) {
- m_sliderSide = side;
- m_sliderDirection = LEFT;
- } else {
- qFatal("Illegal PanelSliderBar 2nd argument");
- }
-
- m_sliderTile.load(":res/images/sliding_bar_tile.png");
- m_sliderButton.load(":res/images/sliding_bar_button.png");
- m_menuDropShadowTile.load(":res/images/menu_bar_drop_shadow.png");
-
- m_buttonRect.setRect(0, (SLIDER_HEIGHT / 2) - (m_sliderButton.height() / 2),
- SLIDER_WIDTH, m_sliderButton.height());
- m_topRect.setRect(SLIDER_BUTTON_OFFSET, 0, SLIDER_BAR_WIDTH, m_buttonRect.top());
- m_bottomRect.setRect(SLIDER_BUTTON_OFFSET, m_buttonRect.bottom() + 1,
- SLIDER_BAR_WIDTH, SLIDER_HEIGHT - m_topRect.height() - m_buttonRect.height());
-
- m_sliderRegion = QRegion(m_buttonRect).united(QRegion(m_topRect).united(QRegion(m_bottomRect)));
- setMask(m_sliderRegion);
-
- resize(SLIDER_WIDTH, SLIDER_HEIGHT);
-}
-
-void PanelSliderBar::paintEvent(QPaintEvent *)
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- QPainter painter(this);
-
- painter.drawTiledPixmap(m_topRect, m_sliderTile);
- painter.drawTiledPixmap(m_bottomRect, m_sliderTile);
- painter.drawTiledPixmap(SLIDER_BUTTON_OFFSET, 0, SLIDER_BAR_WIDTH, m_menuDropShadowTile.height(),
- m_menuDropShadowTile);
- painter.drawPixmap(m_buttonRect, m_sliderButton);
- painter.drawPixmap((this->width() / 2) - (m_sliderButtonArrows[m_sliderDirection].width() / 2),
- (this->height() / 2) - (m_sliderButtonArrows[m_sliderDirection].height() / 2),
- m_sliderButtonArrows[m_sliderDirection]);
-}
-
-void PanelSliderBar::mouseReleaseEvent(QMouseEvent *)
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- emit clicked();
-}
-
-void PanelSliderBar::changeDirection(SliderBarState state)
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- if (state == PanelSliderBar::Open) {
- if (m_sliderSide == LEFT)
- m_sliderDirection = LEFT;
- else
- m_sliderDirection = RIGHT;
- } else {
- if (m_sliderSide == LEFT)
- m_sliderDirection = RIGHT;
- else
- m_sliderDirection = LEFT;
- }
-}
-
-void PanelSliderBar::resizeSliderBar(const QSize &size)
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- m_buttonRect.setRect(0, (size.height() / 2) - (m_sliderButton.height() / 2),
- SLIDER_WIDTH, m_sliderButton.height());
- m_topRect.setRect(SLIDER_BUTTON_OFFSET, 0, SLIDER_BAR_WIDTH, m_buttonRect.top());
- m_bottomRect.setRect(SLIDER_BUTTON_OFFSET, m_buttonRect.bottom() + 1,
- SLIDER_BAR_WIDTH, size.height() - m_topRect.height() - m_buttonRect.height());
-
- m_sliderRegion = QRegion(m_buttonRect).united(QRegion(m_topRect).united(QRegion(m_bottomRect)));
- setMask(m_sliderRegion);
-
- resize(SLIDER_WIDTH, size.height() - PANEL_TOP_PADDING - PANEL_BOTTOM_PADDING);
-}
+++ /dev/null
-/*
- Situare - A location system for Facebook
- Copyright (C) 2010 Ixonos Plc. Authors:
-
- Kaj Wallin - kaj.wallin@ixonos.com
- Pekka Nissinen - pekka.nissinen@ixonos.com
-
- Situare is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- version 2 as published by the Free Software Foundation.
-
- Situare is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Situare; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- USA.
-*/
-
-#ifndef PANELSLIDERBAR_H
-#define PANELSLIDERBAR_H
-
-#include <QMouseEvent>
-#include <QPaintEvent>
-#include <QPixmap>
-#include <QRect>
-#include <QWidget>
-
-#include "panelcommon.h"
-
-/**
- * @brief Generic class for panel slider bars
- *
- * @author Kaj Wallin - kaj.wallin (at) ixonos.com
- * @author Pekka Nissinen - pekka.nissinen@ixonos.com
- *
- * @class PanelSliderBar panelsliderbar.h "ui/panelsliderbar.h"
- */
-class PanelSliderBar : public QWidget
-{
- Q_OBJECT
-
-public:
- /**
- * @brief Constructor
- *
- * @param parent Parent
- * @param side Qstring for the sliderbar location. Accepts "LEFT" and "RIGHT"
- */
- PanelSliderBar(QWidget *parent, Side side);
-
- /**
- * @brief Enumerator for the slider bar state
- * Defines values: Open, Closed
- *
- * @sa changeDirection
- */
- enum SliderBarState {Open, Closed};
-
-/*******************************************************************************
- * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
- ******************************************************************************/
-protected:
- /**
- * @brief Draws the slider
- *
- * @param * QPaintEvent unused
- */
- void paintEvent(QPaintEvent *);
-
- /**
- * @brief Mouse release event used to expand/collapse the panel
- *
- * @param * Event
- *
- * @sa clicked
- */
- void mouseReleaseEvent(QMouseEvent *);
-
-/*******************************************************************************
- * MEMBER FUNCTIONS AND SLOTS
- ******************************************************************************/
-public slots:
- /**
- * @brief Slot to change sliderbar direction
- *
- * @param state Current state of the panel
- */
- void changeDirection(SliderBarState state);
-
- /**
- * @brief Slot to redraw the slider bar after window resize event
- *
- * @param size Size of the new window
- */
- void resizeSliderBar(const QSize &size);
-
-/*******************************************************************************
- * SIGNALS
- ******************************************************************************/
-signals:
- /**
- * @brief Signal that is emitted the slider bar is clicked
- *
- * @sa mouseReleaseEvent
- */
- void clicked();
-
-/*******************************************************************************
- * DATA MEMBERS
- ******************************************************************************/
-private:
- int m_sliderDirection; ///< Direction of the slider bar
-
- QPixmap m_menuDropShadowTile; ///< Pixmap for menu drop shadow
- QPixmap m_sliderButton; ///< Pixmap for panel sliding bar button
- QPixmap m_sliderButtonArrows[2]; ///< Pixmap array for panel sliding bar button arrows
- QPixmap m_sliderTile; ///< Pixmap for panel sliding bar
- QRect m_bottomRect; ///< Rect for slider bar bottom
- QRect m_buttonRect; ///< Rect for slider bar button
- QRect m_topRect; ///< Rect for slider bar top
- QRegion m_sliderRegion; ///< Region of the slider bar
-
- Side m_sliderSide; ///< Slider side
-};
-#endif // PANELSLIDERBAR_H
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Pekka Nissinen - pekka.nissinen@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+#include <QDebug>
+#include <QMouseEvent>
+#include <QPainter>
+#include <QRect>
+
+#include "paneltab.h"
+
+const int TAB_WIDTH = 66;
+const int TAB_WIDTH_ACTIVE = 74;
+const int TAB_HEIGHT = 66;
+
+PanelTab::PanelTab(QWidget *parent)
+ : QToolButton(parent),
+ m_tabActive(false),
+ m_tabSelected(false)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_tabPixmaps[0].load(":/res/images/tab_inactive.png");
+ m_tabPixmaps[1].load(":/res/images/tab_inactive2.png");
+ m_tabPixmaps[2].load(":/res/images/tab_active.png");
+
+// m_tabRect.setRect(TAB_WIDTH_ACTIVE - TAB_WIDTH, 0, TAB_WIDTH, TAB_HEIGHT);
+
+ setCheckable(true);
+
+ setFixedSize(TAB_WIDTH_ACTIVE, TAB_HEIGHT);
+}
+
+void PanelTab::mouseMoveEvent(QMouseEvent *event)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ if(m_tabSelected) {
+ if(!rect().contains(event->pos()))
+ setDown(false);
+ else
+ setDown(true);
+ }
+}
+
+void PanelTab::mousePressEvent(QMouseEvent *event)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ if(event->button() == Qt::LeftButton) {
+ setDown(true);
+ m_tabSelected = true;
+ }
+}
+
+void PanelTab::mouseReleaseEvent(QMouseEvent *event)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ if(this->rect().contains(event->pos())) {
+ click();
+
+ if(isChecked()) {
+ setChecked(false);
+// m_tabRect.setRect(TAB_WIDTH_ACTIVE - TAB_WIDTH, 0, TAB_WIDTH, TAB_HEIGHT);
+ } else {
+ setChecked(true);
+// m_tabRect.setRect(0, 0, TAB_WIDTH_ACTIVE, TAB_HEIGHT);
+ }
+ }
+
+ setDown(false);
+ m_tabSelected = false;
+}
+
+void PanelTab::paintEvent(QPaintEvent *)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ QPainter painter(this);
+
+ if(isChecked()) {
+ m_tabRect.setRect(0, 0, TAB_WIDTH_ACTIVE, TAB_HEIGHT);
+ painter.drawPixmap(m_tabRect, m_tabPixmaps[2]);
+ } else {
+ m_tabRect.setRect(TAB_WIDTH_ACTIVE - TAB_WIDTH, 0, TAB_WIDTH, TAB_HEIGHT);
+ painter.drawPixmap(m_tabRect, m_tabPixmaps[0]);
+ }
+
+ if(isDown())
+ icon().paint(&painter, m_tabRect, Qt::AlignCenter, QIcon::Selected);
+ else if(isChecked())
+ icon().paint(&painter, m_tabRect, Qt::AlignCenter, QIcon::Normal);
+ else
+ icon().paint(&painter, m_tabRect, Qt::AlignCenter, QIcon::Disabled);
+}
+
+void PanelTab::setActive(bool state)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ if(state)
+ setChecked(true);
+ else
+ setChecked(false);
+}
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Pekka Nissinen - pekka.nissinen@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+#ifndef PANELTAB_H
+#define PANELTAB_H
+
+#include <QToolButton>
+
+class QMouseEvent;
+
+class PanelTab : public QToolButton
+{
+ Q_OBJECT
+
+public:
+ /**
+ * @brief Constructor
+ *
+ * @param parent
+ */
+ PanelTab(QWidget *parent = 0);
+
+/*******************************************************************************
+ * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
+ ******************************************************************************/
+protected:
+ /**
+ * @brief Move event for the distance indicator button
+ *
+ * @param event Mouse event
+ */
+ void mouseMoveEvent(QMouseEvent *event);
+
+ /**
+ * @brief Event handler for mouse press events
+ *
+ * @param event Mouse event
+ */
+ void mousePressEvent(QMouseEvent *event);
+
+ /**
+ * @brief Event handler for mouse release events
+ *
+ * @param event Mouse event
+ */
+ void mouseReleaseEvent(QMouseEvent *event);
+
+ /**
+ * @brief Draws the tab button
+ *
+ * @param * QPaintEvent unused
+ */
+ void paintEvent(QPaintEvent *);
+
+/*******************************************************************************
+ * MEMBER FUNCTIONS AND SLOTS
+ ******************************************************************************/
+public:
+ void setActive(bool state);
+
+/*******************************************************************************
+ * DATA MEMBERS
+ ******************************************************************************/
+private:
+ bool m_tabActive;
+ bool m_tabSelected;
+
+ QPixmap m_tabPixmaps[3];
+
+ QRect m_tabRect;
+};
+
+#endif // PANELTAB_H
+++ /dev/null
-/*
- Situare - A location system for Facebook
- Copyright (C) 2010 Ixonos Plc. Authors:
-
- Kaj Wallin - kaj.wallin@ixonos.com
- Pekka Nissinen - pekka.nissinen@ixonos.com
-
- Situare is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- version 2 as published by the Free Software Foundation.
-
- Situare is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Situare; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- USA.
-*/
-
-#include <QAbstractState>
-
-#include "sidepanel.h"
-
-#include "panelcommon.h"
-#include "panelsidebar.h"
-#include "panelsliderbar.h"
-#include "sidepanelbase.h"
-
-SidePanel::SidePanel(QWidget *parent) :
- QWidget(parent),
- m_isOpen(false),
- currentType(SidePanel::None)
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- m_panelVBox = new QVBoxLayout(this);
- m_panelVBox->setMargin(0);
- m_panelVBox->setSpacing(0);
-
- m_panelBase = new SidePanelBase(this);
- m_panelBase->setLayout(m_panelVBox);
-
- m_panelStateMachine = new QStateMachine(this);
- m_panelStateClosed = new QState(m_panelStateMachine);
- m_panelStateOpened = new QState(m_panelStateMachine);
-
- m_panelStateMachine->setInitialState(m_panelStateClosed);
-
- m_panelTransitionOpen = m_panelStateClosed->addTransition(this, SIGNAL(toggleState()),
- m_panelStateOpened);
- m_panelTransitionOpen->addAnimation(new QPropertyAnimation(this, "pos", this));
-
- m_panelTransitionClose = m_panelStateOpened->addTransition(this, SIGNAL(toggleState()),
- m_panelStateClosed);
- m_panelTransitionClose->addAnimation(new QPropertyAnimation(this, "pos", this));
-
- connect(m_panelStateClosed, SIGNAL(entered()),
- this, SLOT(stateChangedToClosed()));
- connect(m_panelStateOpened, SIGNAL(entered()),
- this, SLOT(stateChangedToOpen()));
-
- hide();
-}
-
-void SidePanel::openPanel()
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- if(!m_isOpen)
- emit toggleState();
-}
-
-void SidePanel::closePanel()
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- if(m_isOpen)
- emit toggleState();
-}
-
-void SidePanel::resizePanel(const QSize &size)
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- if(currentType == SidePanel::UserPanel) {
- this->resize(USERPANEL_WIDTH + SLIDER_BAR_WIDTH + SLIDER_BUTTON_OFFSET,
- size.height() - PANEL_TOP_PADDING - PANEL_BOTTOM_PADDING);
-
- m_panelBase->resize(USERPANEL_WIDTH,
- size.height() - PANEL_TOP_PADDING - PANEL_BOTTOM_PADDING);
-
- m_panelSlidingBar->resizeSliderBar(size);
- } else if(currentType == SidePanel::FriendPanel) {
- this->resize(SLIDER_WIDTH + FRIENDPANEL_WIDTH,
- size.height() - PANEL_TOP_PADDING - PANEL_BOTTOM_PADDING);
-
- if(!m_isOpen)
- this->move(size.width() - SLIDER_BUTTON_OFFSET - PANEL_PEEK_AMOUNT, PANEL_TOP_PADDING);
- else
- this->move(size.width() - SLIDER_BUTTON_OFFSET - SLIDER_BAR_WIDTH - FRIENDPANEL_WIDTH,
- PANEL_TOP_PADDING);
-
- m_panelBase->resize(FRIENDPANEL_WIDTH,
- size.height() - PANEL_TOP_PADDING - PANEL_BOTTOM_PADDING);
-
- m_panelSlidingBar->resizeSliderBar(size);
-
- m_panelStateClosed->assignProperty(this, "pos",
- QPoint(size.width() - SLIDER_BUTTON_OFFSET - PANEL_PEEK_AMOUNT, PANEL_TOP_PADDING));
- m_panelStateOpened->assignProperty(this, "pos",
- QPoint(size.width() - SLIDER_BUTTON_OFFSET - SLIDER_BAR_WIDTH - FRIENDPANEL_WIDTH,
- PANEL_TOP_PADDING));
- } else {
- qFatal("Illegal panel type in SidePanel::screenResized");
- }
-}
-
-void SidePanel::setType(SidePanel::PanelType type)
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- if(currentType == SidePanel::None) {
- if(type == SidePanel::UserPanel) {
- currentType = type;
- setObjectName("UserPanel");
-
- this->resize(USERPANEL_WIDTH + SLIDER_BAR_WIDTH + SLIDER_BUTTON_OFFSET,
- USERPANEL_HEIGHT);
- this->move(USERPANEL_CLOSED_X, PANEL_TOP_PADDING);
-
- m_panelBase->resize(USERPANEL_WIDTH, SLIDER_HEIGHT);
-
- m_panelSlidingBar = new PanelSliderBar(this, LEFT);
- m_panelSlidingBar->move(USERPANEL_WIDTH - SLIDER_BUTTON_OFFSET, 0);
-
- connect(m_panelSlidingBar, SIGNAL(clicked()),
- this, SIGNAL(toggleState()));
-
- m_panelStateClosed->assignProperty(this, "pos",
- QPoint(USERPANEL_CLOSED_X, PANEL_TOP_PADDING));
- m_panelStateOpened->assignProperty(this, "pos",
- QPoint(USERPANEL_OPENED_X, PANEL_TOP_PADDING));
- } else if (type == SidePanel::FriendPanel) {
- currentType = type;
- setObjectName("FriendPanel");
-
- this->resize(SLIDER_BUTTON_OFFSET + SLIDER_BAR_WIDTH + FRIENDPANEL_WIDTH,
- FRIENDPANEL_HEIGHT);
- this->move(FRIENDPANEL_CLOSED_X, PANEL_TOP_PADDING);
-
- m_panelBase->resize(FRIENDPANEL_WIDTH, FRIENDPANEL_HEIGHT);
- m_panelBase->move(SLIDER_BUTTON_OFFSET + SLIDER_BAR_WIDTH, 0);
-
- m_panelSlidingBar = new PanelSliderBar(this, RIGHT);
-
- connect(m_panelSlidingBar, SIGNAL(clicked()),
- this, SIGNAL(toggleState()));
-
- m_panelStateClosed->assignProperty(this, "pos",
- QPoint(FRIENDPANEL_CLOSED_X, PANEL_TOP_PADDING));
- m_panelStateOpened->assignProperty(this, "pos",
- QPoint(FRIENDPANEL_OPENED_X, PANEL_TOP_PADDING));
- } else {
- qWarning() << "In" << __PRETTY_FUNCTION__ << ":" << type;
- qFatal("Illegal type set for SidePanel::setType");
- }
- m_panelStateMachine->start();
- show();
- } else {
- qWarning() << "Illegally tried to set type multiple times at SidePanel::setType";
- }
-}
-
-void SidePanel::stateChangedToClosed()
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- m_isOpen = false;
- emit panelClosed();
-
- m_panelSlidingBar->changeDirection(PanelSliderBar::Closed);
-}
-
-void SidePanel::stateChangedToOpen()
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- m_isOpen = true;
- emit panelOpened();
-
- m_panelSlidingBar->changeDirection(PanelSliderBar::Open);
-}
+++ /dev/null
-/*
- Situare - A location system for Facebook
- Copyright (C) 2010 Ixonos Plc. Authors:
-
- Kaj Wallin - kaj.wallin@ixonos.com
- Pekka Nissinen - pekka.nissinen@ixonos.com
-
- Situare is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- version 2 as published by the Free Software Foundation.
-
- Situare is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Situare; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- USA.
-*/
-
-#ifndef SIDEPANEL_H
-#define SIDEPANEL_H
-
-#include <QWidget>
-#include <QtGui>
-
-class PanelSliderBar;
-class SidePanelBase;
-
-/**
- * @brief Base class for sliding side panels
- *
- * @author Kaj Wallin - kaj.wallin (at) ixonos.com
- * @author Pekka Nissinen - pekka.nissinen@ixonos.com
- *
- * @class SidePanel sidepanel.h "ui/sidepanel.h"
- */
-class SidePanel : public QWidget
-{
- Q_OBJECT
-
-public:
- /**
- * @brief Constructor
- *
- * @param parent
- */
- SidePanel(QWidget *parent = 0);
-
- /**
- * @brief Enumerator for the panel type
- * Defines values: UserPanel, FriendPanel, None
- *
- * @sa setType
- */
- enum PanelType {UserPanel, FriendPanel, None};
-
-/******************************************************************************
- * MEMBER FUNCTIONS AND SLOTS
- ******************************************************************************/
-public:
- /**
- * @brief Type setter for the panel. Also sets panel visible
- *
- * Use to set panel type as UserPanel or FriendPanel. Panel type determines
- * which side the panel will be rendered. UserPanel will always be rendered
- * on the left side of the screen and FriendPanel on the right side. Type
- * cannot be set twice.
- *
- * @param type Type of the panel, either UserPanel or FriendPanel
- * @sa PanelType
- */
- void setType(SidePanel::PanelType type);
-
-public slots:
- /**
- * @brief Public slot that will open the panel unless already open
- */
- void openPanel();
-
- /**
- * @brief Public slot that will close the panel unless already closed
- */
- void closePanel();
-
- /**
- * @brief Slot to redraw the panel after window resize event
- *
- * @param size Size of the new window
- */
- void resizePanel(const QSize &size);
-
-private slots:
- /**
- * @brief Internal slot used to track statemachine state
- */
- void stateChangedToClosed();
-
- /**
- * @brief Internal slot used to track statemachine state
- */
- void stateChangedToOpen();
-
-/******************************************************************************
- * SIGNALS
- ******************************************************************************/
-signals:
- /**
- * @brief Signal that is sent to state machine when state must be changed
- *
- * @sa openPanel
- * @sa closePanel
- */
- void toggleState();
-
- /**
- * @brief Signal that is sent when panel is closed
- *
- * @sa openPanel
- * @sa closePanel
- */
- void panelClosed();
-
- /**
- * @brief Signal that is sent when panel is opened
- *
- * @sa openPanel
- * @sa closePanel
- */
- void panelOpened();
-
-/*******************************************************************************
- * DATA MEMBERS
- *******************************************************************************/
-protected:
- QVBoxLayout *m_panelVBox; ///< Vertical layout inside the panel
-
-private:
- bool m_isOpen; ///< Boolean used to track the current state of the statemachine
-
- QSignalTransition *m_panelTransitionClose; ///< Transition signal for closing the panel
- QSignalTransition *m_panelTransitionOpen; ///< Transition signal for opening the panel
- QState *m_panelStateClosed; ///< State of the closed panel
- QState *m_panelStateOpened; ///< State of the opened panel
- QStateMachine *m_panelStateMachine; ///< State machine for sliding the panel
-
- SidePanelBase *m_panelBase; ///< Widget for panel base
- PanelType currentType; ///< Holder for the type of this panel
- PanelSliderBar *m_panelSlidingBar; ///< Widget for panel sliding bar item
-};
-
-#endif // SIDEPANEL_H
+++ /dev/null
-/*
- Situare - A location system for Facebook
- Copyright (C) 2010 Ixonos Plc. Authors:
-
- Pekka Nissinen - pekka.nissinen@ixonos.com
-
- Situare is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- version 2 as published by the Free Software Foundation.
-
- Situare is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Situare; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- USA.
-*/
-
-#include <QDebug>
-#include <QPainter>
-#include <QPalette>
-#include <QRect>
-
-#include "sidepanelbase.h"
-
-SidePanelBase::SidePanelBase(QWidget *parent) :
- QWidget(parent)
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- m_menuDropShadowTile.load(":res/images/menu_bar_drop_shadow.png");
-
- QPalette pal = palette();
- pal.setColor(QPalette::Background, QColor(0, 0, 0, 128));
- setPalette(pal);
- setAutoFillBackground(true);
-}
-
-void SidePanelBase::paintEvent(QPaintEvent *)
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- QPainter painter(this);
-
- QRect shadowRect = QRect(0, 0, this->rect().width(), m_menuDropShadowTile.height());
- painter.drawTiledPixmap(shadowRect, m_menuDropShadowTile);
-}
+++ /dev/null
-/*
- Situare - A location system for Facebook
- Copyright (C) 2010 Ixonos Plc. Authors:
-
- Pekka Nissinen - pekka.nissinen@ixonos.com
-
- Situare is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License
- version 2 as published by the Free Software Foundation.
-
- Situare is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with Situare; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
- USA.
-*/
-
-#ifndef SIDEPANELBASE_H
-#define SIDEPANELBASE_H
-
-#include <QPaintEvent>
-#include <QPixmap>
-#include <QWidget>
-
-/**
- * @brief Base class for panel inner content
- *
- * @author Pekka Nissinen - pekka.nissinen@ixonos.com
- *
- * @class SidePanelBase sidepanelbase.h "ui/sidepanelbase.h"
- */
-class SidePanelBase : public QWidget
-{
- Q_OBJECT
-
-public:
- /**
- * @brief Constructor
- *
- * @param parent Parent
- */
- SidePanelBase(QWidget *parent);
-
-/*******************************************************************************
- * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
- ******************************************************************************/
-protected:
- /**
- * @brief Draws the panel content base
- *
- * @param * QPaintEvent unused
- */
- void paintEvent(QPaintEvent *);
-
-/*******************************************************************************
- * DATA MEMBERS
- *******************************************************************************/
-private:
- QPixmap m_menuDropShadowTile; ///< Pixmap for menu drop shadow
-};
-
-#endif // SIDEPANELBASE_H
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Kaj Wallin - kaj.wallin@ixonos.com
+ Pekka Nissinen - pekka.nissinen@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+#include <QButtonGroup>
+#include <QDebug>
+#include <QPainter>
+#include <QRegion>
+
+#include "panelbar.h"
+#include "panelcontent.h"
+#include "paneltab.h"
+#include "userinfo.h"
+
+#include "tabbedpanel.h"
+
+TabbedPanel::TabbedPanel(QWidget *parent)
+ : QWidget(parent),
+ m_isOpen(false),
+ m_activeTab(-1)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ this->resize(PANEL_BAR_TABBED_WIDTH + PANEL_WIDTH, PANEL_HEIGHT);
+ this->move(PANEL_CLOSED_X, PANEL_TOP_PADDING);
+
+ // --- TABS ---
+ m_panelWidgetStack = new QStackedWidget(this);
+
+ m_tabButtonGroup = new QButtonGroup(this);
+
+ connect(m_tabButtonGroup, SIGNAL(buttonPressed(int)),
+ this, SLOT(setActiveTab(int)));
+
+ // --- BAR ---
+ m_panelBar = new PanelBar(this);
+ m_panelBar->move(PANEL_TAB_WIDTH, 0);
+
+ // --- PANEL CONTENT ---
+ m_panelContent = new PanelContent(this);
+ m_panelContent->setContentWidget(m_panelWidgetStack);
+ m_panelContent->move(PANEL_TAB_WIDTH + PANEL_BAR_WIDTH, 0);
+
+ // --- STATE MACHINE ---
+ m_panelStateMachine = new QStateMachine(this);
+ m_panelStateClosed = new QState(m_panelStateMachine);
+ m_panelStateOpened = new QState(m_panelStateMachine);
+
+ m_panelStateMachine->setInitialState(m_panelStateClosed);
+
+ m_panelTransitionOpen = m_panelStateClosed->addTransition(this, SIGNAL(toggleState()),
+ m_panelStateOpened);
+ m_panelTransitionOpen->addAnimation(new QPropertyAnimation(this, "pos", this));
+
+ m_panelTransitionClose = m_panelStateOpened->addTransition(this, SIGNAL(toggleState()),
+ m_panelStateClosed);
+ m_panelTransitionClose->addAnimation(new QPropertyAnimation(this, "pos", this));
+
+ connect(m_panelStateClosed, SIGNAL(entered()),
+ this, SLOT(stateChangedToClosed()));
+ connect(m_panelStateOpened, SIGNAL(entered()),
+ this, SLOT(stateChangedToOpen()));
+
+ m_panelStateClosed->assignProperty(this, "pos",
+ QPoint(PANEL_CLOSED_X, PANEL_TOP_PADDING));
+ m_panelStateOpened->assignProperty(this, "pos",
+ QPoint(PANEL_OPENED_X, PANEL_TOP_PADDING));
+
+ m_panelStateMachine->start();
+}
+
+int TabbedPanel::addTab(QWidget *widget, const QIcon& icon)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ return insertTab(-1, widget, icon);
+}
+
+int TabbedPanel::insertTab(int index, QWidget *widget, const QIcon& icon)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ if(!widget)
+ return -1;
+
+ int verticalStartPoint = 8;
+
+ index = m_panelWidgetStack->insertWidget(index, widget);
+ m_tabButtonGroup->addButton(new PanelTab(this), index);
+ m_tabButtonGroup->button(index)->setIcon(icon);
+
+ // [BEGIN]: Purkkaa (to be removed ASAP!!!)
+ if(index > 0)
+ verticalStartPoint += 65 * index;
+
+ m_tabButtonGroup->button(index)->move(0, verticalStartPoint);
+ // [END]: Purkkaa
+
+ return index;
+}
+
+void TabbedPanel::removeTab(int index)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ if(QWidget *widget = m_panelWidgetStack->widget(index)) {
+ m_panelWidgetStack->removeWidget(widget);
+
+ QAbstractButton *tab = m_tabButtonGroup->button(index);
+ m_tabButtonGroup->removeButton(tab);
+ delete tab;
+ }
+}
+
+void TabbedPanel::closePanel()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ if(m_isOpen)
+ emit toggleState();
+}
+
+void TabbedPanel::openPanel()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ if(!m_isOpen)
+ emit toggleState();
+}
+
+void TabbedPanel::setActiveTab(int index)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ if(m_activeTab == -1) {
+ m_activeTab = index;
+ m_panelWidgetStack->setCurrentIndex(index);
+ emit toggleState();
+ } else if(m_activeTab == index) {
+ m_activeTab = -1;
+ emit toggleState();
+ } else {
+ m_activeTab = index;
+ m_panelWidgetStack->setCurrentIndex(index);
+ }
+}
+
+void TabbedPanel::resizePanel(const QSize &size)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ this->resize(PANEL_BAR_TABBED_WIDTH + PANEL_WIDTH,
+ size.height() - PANEL_TOP_PADDING - PANEL_BOTTOM_PADDING);
+
+ if(!m_isOpen)
+ this->move(size.width() - PANEL_TAB_WIDTH - PANEL_BAR_WIDTH, PANEL_TOP_PADDING);
+ else
+ this->move(size.width() - PANEL_TAB_WIDTH - PANEL_BAR_WIDTH - PANEL_WIDTH,
+ PANEL_TOP_PADDING);
+
+ m_panelBar->resizeBar(size);
+
+ m_panelContent->resizePanelContent(size);
+
+ m_panelStateClosed->assignProperty(this, "pos",
+ QPoint(size.width() - PANEL_TAB_WIDTH - PANEL_BAR_WIDTH, PANEL_TOP_PADDING));
+ m_panelStateOpened->assignProperty(this, "pos",
+ QPoint(size.width() - PANEL_TAB_WIDTH - PANEL_BAR_WIDTH - PANEL_WIDTH,
+ PANEL_TOP_PADDING));
+}
+
+void TabbedPanel::stateChangedToClosed()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_isOpen = false;
+ emit panelClosed();
+}
+
+void TabbedPanel::stateChangedToOpen()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_isOpen = true;
+ emit panelOpened();
+}
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Kaj Wallin - kaj.wallin@ixonos.com
+ Pekka Nissinen - pekka.nissinen@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+
+#ifndef TABBEDPANEL_H
+#define TABBEDPANEL_H
+
+#include <QWidget>
+
+#include "panelcommon.h"
+
+class QButtonGroup;
+class QMouseEvent;
+class QPaintEvent;
+class QPixmap;
+class QRect;
+class QSignalTransition;
+class QStackedWidget;
+class QState;
+class QStateMachine;
+
+class PanelBar;
+class PanelContent;
+
+/**
+ * @brief Class for tabbed panels
+ *
+ * @author Kaj Wallin - kaj.wallin (at) ixonos.com
+ * @author Pekka Nissinen - pekka.nissinen@ixonos.com
+ *
+ * @class TabbedPanel tabbedpanel.h "ui/tabbedpanel.h"
+ */
+class TabbedPanel : public QWidget
+{
+ Q_OBJECT
+
+public:
+ /**
+ * @brief Constructor
+ *
+ * @param parent Parent
+ */
+ TabbedPanel(QWidget *parent = 0);
+
+/*******************************************************************************
+ * MEMBER FUNCTIONS AND SLOTS
+ ******************************************************************************/
+public:
+ /**
+ * @brief Adds a tab to the panel
+ *
+ * Adds a tab with the given widget and icon into the tabbed panel and returns the index of the
+ * inserted tab.
+ *
+ * @param widget Widget to be added into the tab
+ * @param icon Icon of the tab
+ */
+ int addTab(QWidget *widget, const QIcon& icon);
+
+ /**
+ * @brief Inserts a tab to the panel
+ *
+ * Inserts a tab with the given widget and icon into the tabbed panel at the specified index,
+ * and returns the index of the inserted tab.
+ *
+ * If index is out of range, the tab is simply appended. Otherwise it is inserted at the
+ * specified position.
+ *
+ * @param index Index of the tab
+ * @param widget Widget to be inserted into the tab
+ * @param icon Icon of the tab
+ */
+ int insertTab(int index, QWidget *widget, const QIcon& icon);
+
+ /**
+ * @brief Removes a tab from the panel
+ *
+ * Removes a tab and its widget from the panel at index position. The widget itself is not
+ * deleted.
+ *
+ * TODO: Fix tab drawing order
+ *
+ * @param index Index of the tab
+ */
+ void removeTab(int index);
+
+public slots:
+ /**
+ * @brief Public slot that will close the panel unless already closed
+ */
+ void closePanel();
+
+ /**
+ * @brief Public slot that will open the panel unless already open
+ */
+ void openPanel();
+
+ /**
+ * @brief Sets the tab at given index active
+ *
+ * @param index Index of the tab
+ */
+ void setActiveTab(int index);
+
+ /**
+ * @brief Slot to redraw the panel after window resize event
+ *
+ * @param size Size of the new window
+ */
+ void resizePanel(const QSize &size);
+
+private slots:
+ /**
+ * @brief Internal slot used to track statemachine state
+ */
+ void stateChangedToClosed();
+
+ /**
+ * @brief Internal slot used to track statemachine state
+ */
+ void stateChangedToOpen();
+
+/*******************************************************************************
+ * SIGNALS
+ ******************************************************************************/
+signals:
+ /**
+ * @brief Signal that is sent when panel is closed
+ *
+ * @sa openPanel
+ * @sa closePanel
+ */
+ void panelClosed();
+
+ /**
+ * @brief Signal that is sent when panel is opened
+ *
+ * @sa openPanel
+ * @sa closePanel
+ */
+ void panelOpened();
+
+ /**
+ * @brief Signal that is sent to state machine when state must be changed
+ *
+ * @sa openPanel
+ * @sa closePanel
+ */
+ void toggleState();
+
+/*******************************************************************************
+ * DATA MEMBERS
+ ******************************************************************************/
+private:
+ bool m_isOpen; ///< Boolean used to track the current state of the statemachine
+
+ int m_activeTab; ///< Index of a active tab
+
+ QButtonGroup *m_tabButtonGroup; ///< Button groub for tab buttons
+
+ QSignalTransition *m_panelTransitionClose; ///< Transition signal for closing the panel
+ QSignalTransition *m_panelTransitionOpen; ///< Transition signal for opening the panel
+
+ QStackedWidget *m_panelWidgetStack; ///< Stack for panel widgets
+
+ QState *m_panelStateClosed; ///< State of the closed panel
+ QState *m_panelStateOpened; ///< State of the opened panel
+
+ QStateMachine *m_panelStateMachine; ///< State machine for sliding the panel
+
+ PanelBar *m_panelBar; ///< Widget for panel bar
+ PanelContent *m_panelContent; ///< Widget for panel content
+};
+
+#endif // TABBEDPANEL_H
USA.
*/
+#include "userinfo.h"
+
+#include "../user/user.h"
#include "common.h"
#include "imagebutton.h"
-#include "../user/user.h"
-#include "userinfo.h"
-const int BACKGROUND_WIDTH = 240; ///< Width for item
-const int BACKGROUND_TOP_HEIGHT = 16; ///< Height for item top
+const int BACKGROUND_WIDTH = 368; ///< Width for item
+const int BACKGROUND_TOP_HEIGHT = 20; ///< Height for item top
const int BACKGROUND_BOTTOM_HEIGHT = 15; ///< Height for item bottom
const int ICON_HEIGHT = 24; ///< Icon height
const int ICON_WIDTH = 24; ///< Icon width
const int MARGIN = 5; ///< Icon margin
-const int LINE_LENGTH = 17; ///< Line length
+const int LINE_LENGTH = 27; ///< Line length
const int MOUSE_PRESS_AREA_WIDTH = 20; ///< Area width for item height toggling
const int MOUSE_PRESS_AREA_HEIGHT = 20; ///< Area height for item height toggling
namePalette.setColor(QPalette::Foreground, Qt::white);
m_nameLabel->setPalette(namePalette);
- m_backgroundTopImage.load(":/res/images/user_info_item_top.png");
- m_backgroundMiddleImage.load(":/res/images/user_info_item_middle.png");
- m_backgroundBottomImage.load(":/res/images/user_info_item_bottom.png");
+ m_backgroundTopImage.load(":/res/images/list_item_top.png");
+ m_backgroundMiddleImage.load(":/res/images/list_item_middle.png");
+ m_backgroundBottomImage.load(":/res/images/list_item_bottom.png");
restoreUnsendMessage();
}
QRect topRect = QRect(0, MARGIN, BACKGROUND_WIDTH, BACKGROUND_TOP_HEIGHT);
QRect middleRect = QRect(0, topRect.bottom(), BACKGROUND_WIDTH,
- height() - BACKGROUND_TOP_HEIGHT - BACKGROUND_BOTTOM_HEIGHT);
+ this->height() - BACKGROUND_TOP_HEIGHT - BACKGROUND_BOTTOM_HEIGHT);
QRect bottomRect = QRect(topRect.left(), middleRect.bottom(), BACKGROUND_WIDTH,
BACKGROUND_BOTTOM_HEIGHT);
textParam.truncate(index);
textParam.append("...");
}
- if (textWidth > 150)
+ if (textWidth > 250)
textParam.insert(LINE_LENGTH, QString("\n"));
return labelMetrics.elidedText(textParam, Qt::ElideRight, textMaxWidth);
m_updateLocation->deleteLater();
m_updateLocation = 0;
}
-
}
class ImageButton;
/**
-* @brief UserInfo shows user's data in expandable item.
-*
-* @class UserInfo userinfo.h "ui/userinfo.h"
-*/
+ * @brief UserInfo shows user's data in expandable item.
+ *
+ * @class UserInfo userinfo.h "ui/userinfo.h"
+ */
class UserInfo : public QWidget
{
Q_OBJECT
+
public:
/**
- * @brief Constructor
- *
- * @param parent Parent
- */
+ * @brief Constructor
+ *
+ * @param parent Parent
+ */
UserInfo(QWidget *parent=0);
/**
- * @brief Desctructor
- * saves unsend user message to settings
- *
- */
+ * @brief Desctructor
+ * saves unsend user message to settings
+ *
+ */
~UserInfo();
/*******************************************************************************
*******************************************************************************/
protected:
/**
- * @brief Set current mouse position to mouse event position.
- *
- * @param event QMouseEvent mouse press event
- */
+ * @brief Set current mouse position to mouse event position.
+ *
+ * @param event QMouseEvent mouse press event
+ */
void mousePressEvent(QMouseEvent *event);
/**
- * @brief Call toggleHeight if mouse position is unchanged.
- *
- * Check if current mouse position is same as mouse release position.
- * @param event QMouseEvent mouse release event
- */
+ * @brief Call toggleHeight if mouse position is unchanged.
+ *
+ * Check if current mouse position is same as mouse release position.
+ * @param event QMouseEvent mouse release event
+ */
void mouseReleaseEvent(QMouseEvent *event);
/**
- * @brief This function is called when the widget is drawn
- *
- * @param aPaintEvent Pointer to paint event
- */
+ * @brief This function is called when the widget is drawn
+ *
+ * @param aPaintEvent Pointer to paint event
+ */
void paintEvent(QPaintEvent *aPaintEvent);
/******************************************************************************
******************************************************************************/
public:
/**
- * @brief Sets the users current address
- *
- * @param address Reference to users current address
- */
+ * @brief Sets the users current address
+ *
+ * @param address Reference to users current address
+ */
void setAddress(const QString &address);
/**
- * @brief Sets the users current coordinates
- *
- * @param coordinates Reference to users current coordinates
- */
+ * @brief Sets the users current coordinates
+ *
+ * @param coordinates Reference to users current coordinates
+ */
void setCoordinates(const GeoCoordinate &coordinates);
/**
- * @brief Sets the user picture
- *
- * @param image Reference to user picture
- */
+ * @brief Sets the user picture
+ *
+ * @param image Reference to user picture
+ */
void setProfileImage(const QPixmap &image);
/**
- * @brief Sets the time of updated message
- *
- * @param time Reference to time when message was sent.
- */
+ * @brief Sets the time of updated message
+ *
+ * @param time Reference to time when message was sent.
+ */
void setTime(const QString &time);
- /**
- * @brief Sets the user name
- *
- * @param name Reference to user name
- */
+ /**
+ * @brief Sets the user name
+ *
+ * @param name Reference to user name
+ */
void setUserName(const QString &name);
public slots:
/**
- * @brief Clears backups of message and publish on Facebook setting
- */
+ * @brief Clears backups of message and publish on Facebook setting
+ */
void clearUpdateLocationDialogData();
/**
- * @brief Saves status message and Facebook publish setting
- *
- * @param status message that user sends. Message is stored to m_backupMessage data member
- * @param publish setting that determines whether the user status message is published on
- * Facebook. This value is stored to m_backupFacebookPublishPolicity data member.
- */
+ * @brief Saves status message and Facebook publish setting
+ *
+ * @param status message that user sends. Message is stored to m_backupMessage data member
+ * @param publish setting that determines whether the user status message is published on
+ * Facebook. This value is stored to m_backupFacebookPublishPolicity data member.
+ */
void backupUpdateLocationDialogData(const QString &status, bool publish);
/**
- * @brief Sets the message text
- *
- * @param text Reference to user message
- */
+ * @brief Sets the message text
+ *
+ * @param text Reference to user message
+ */
void setMessageText(const QString &text);
private:
/**
- * @brief reads Unsend message from settings at startup
- *
- */
+ * @brief reads Unsend message from settings at startup
+ */
void restoreUnsendMessage();
/**
- * @brief Set shortened or full-length text to labels.
- *
- * @param expanded true if full-length text is set, false otherwise
- */
+ * @brief Set shortened or full-length text to labels.
+ *
+ * @param expanded true if full-length text is set, false otherwise
+ */
void setText(bool expanded);
/**
- * @brief Set shortened texts from User data.
- *
- * Text length is defined by MAXIMUM_CHARS.
- */
+ * @brief Set shortened texts from User data.
+ *
+ * Text length is defined by MAXIMUM_CHARS.
+ */
QString shortenText(const QLabel *label, const QString &text, int textMaxWidth);
private slots:
/**
- * @brief Slot for find button click
- */
+ * @brief Slot for find button click
+ */
void findButtonClicked();
/**
- * @brief Slot function to forward messageUpdate launch signal
- *
- */
+ * @brief Slot function to forward messageUpdate launch signal
+ */
void messageUpdate();
/**
- * @brief Slot function to get indication when dialog is finished
- *
- */
+ * @brief Slot function to get indication when dialog is finished
+ */
void updateLocationDialogFinished(int reason);
/******************************************************************************
******************************************************************************/
signals:
/**
- * @brief Signal for finding user.
- *
- * @param coordinates user geo coordinates
- */
+ * @brief Signal for finding user.
+ *
+ * @param coordinates user geo coordinates
+ */
void findUser(const GeoCoordinate &coordinates);
/**
- * @brief Signal that used to inform user that his message/location update tp Situare server
- * was failed.
- * This signal is originally sended from UserInfo
- * @param message message for notification
- * @param modal true if modal notification otherwice false
- */
+ * @brief Signal that used to inform user that his message/location update tp Situare server
+ * was failed.
+ * This signal is originally sended from UserInfo
+ * @param message message for notification
+ * @param modal true if modal notification otherwice false
+ */
void notificateUpdateFailing(const QString &message, bool modal);
/**
- * @brief Signal for refreshing user data.
- *
- */
+ * @brief Signal for refreshing user data.
+ */
void refreshUserData();
/**
- * @brief Signal for requesting reverseGeo from SituareEngine
- *
- */
+ * @brief Signal for requesting reverseGeo from SituareEngine
+ */
void requestReverseGeo();
/**
- * @brief Signals, when address data is ready
- *
- * @param address Street address
- */
+ * @brief Signals, when address data is ready
+ *
+ * @param address Street address
+ */
void reverseGeoReady(const QString &address);
/**
- * @brief Signal for requestLocationUpdate from SituareEngine via MainWindow class
- *
- * @param status Status message
- * @param publish Publish on Facebook
- */
+ * @brief Signal for requestLocationUpdate from SituareEngine via MainWindow class
+ *
+ * @param status Status message
+ * @param publish Publish on Facebook
+ */
void statusUpdate(const QString &status, const bool &publish);
/******************************************************************************
* DATA MEMBERS
******************************************************************************/
private:
- bool m_backupFacebookPublishPolicity; ///< Backup of publish on Facebook checkbox value
- bool m_expanded; ///< Item expanded state
- QLabel *m_locationLabel; ///< Location label
- QLabel *m_nameLabel; ///< Name label
- QLabel *m_statusTextLabel; ///< Status text label
- QLabel *m_updatedLabel; ///< Updated label
- QPixmap m_backgroundBottomImage; ///< Bottom background image
- QPixmap m_backgroundMiddleImage; ///< Middle background image
- QPixmap m_backgroundTopImage; ///< Top background image
- QPoint m_mousePosition; ///< Current mouse press position
- GeoCoordinate m_coordinates; ///< User current coordinates
- QString m_address; ///< Address from where the new message was sent
- QString m_backupMessage; ///< Backup of users message
- QString m_expandedMessageText; ///< Expanded message text
- QString m_messageText; ///< User's message
- QString m_time; ///< Time when the new message was sent
- QString m_userName; ///< User's name
- ImageButton *m_findButton; ///< User find button
+ bool m_backupFacebookPublishPolicity; ///< Backup of publish on Facebook checkbox value
+ bool m_expanded; ///< Item expanded state
+
+ QLabel *m_locationLabel; ///< Location label
+ QLabel *m_nameLabel; ///< Name label
+ QLabel *m_statusTextLabel; ///< Status text label
+ QLabel *m_updatedLabel; ///< Updated label
+
+ QPixmap m_backgroundBottomImage; ///< Bottom background image
+ QPixmap m_backgroundMiddleImage; ///< Middle background image
+ QPixmap m_backgroundTopImage; ///< Top background image
+
+ QPoint m_mousePosition; ///< Current mouse press position
+
+ QString m_address; ///< Address from where the new message was sent
+ QString m_backupMessage; ///< Backup of users message
+ QString m_expandedMessageText; ///< Expanded message text
+ QString m_messageText; ///< User's message
+ QString m_time; ///< Time when the new message was sent
+ QString m_userName; ///< User's name
+
+ GeoCoordinate m_coordinates; ///< User current coordinates
+ ImageButton *m_findButton; ///< User find button
UpdateLocationDialog *m_updateLocation; ///< Update location dialog
};
Copyright (C) 2010 Ixonos Plc. Authors:
Kaj Wallin - kaj.wallin@ixonos.com
+ Katri Kaikkonen - katri.kaikkonen@ixonos.com
+ Pekka Nissinen - pekka.nissinen@ixonos.com
Situare is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
#include "panelcommon.h"
UserInfoPanel::UserInfoPanel(QWidget *parent)
- : SidePanel(parent)
+ : QWidget(parent)
{
qDebug() << __PRETTY_FUNCTION__;
- setType(SidePanel::UserPanel);
+ QVBoxLayout *userInfoPanelLayout = new QVBoxLayout;
+ userInfoPanelLayout->setMargin(0);
+ userInfoPanelLayout->setSpacing(0);
+ userInfoPanelLayout->setContentsMargins(PANEL_MARGIN_LEFT, 0, PANEL_MARGIN_RIGHT, 0);
+ setLayout(userInfoPanelLayout);
m_userInfo = new UserInfo(this);
QWidget *userInfoView = new QWidget(this);
- QVBoxLayout *userViewLayout = new QVBoxLayout(userInfoView);
- userViewLayout->setMargin(0);
- userViewLayout->setSpacing(0);
- userViewLayout->setStretch(0, 0);
- userViewLayout->setSizeConstraint(QLayout::SetFixedSize);
- userViewLayout->addWidget(m_userInfo);
-
- QScrollArea *userInfoScroll = new QScrollArea(this);
+ QVBoxLayout *userInfoViewLayout = new QVBoxLayout(userInfoView);
+ userInfoViewLayout->setMargin(0);
+ userInfoViewLayout->setSpacing(0);
+ userInfoViewLayout->setStretch(0, 0);
+ userInfoViewLayout->setSizeConstraint(QLayout::SetFixedSize);
+ userInfoViewLayout->addWidget(m_userInfo);
+
+ QScrollArea *userInfoScroll = new QScrollArea();
userInfoScroll->setWidgetResizable(true);
userInfoScroll->setWidget(userInfoView);
userInfoScroll->setAlignment(Qt::AlignVCenter);
userInfoScroll->viewport()->setAutoFillBackground(false);
userInfoScroll->widget()->setAutoFillBackground(false);
- m_panelVBox->addWidget(userInfoScroll);
- m_panelVBox->setContentsMargins(USERPANEL_MARGIN_LEFT, 0, USERPANEL_MARGIN_RIGHT, 0);
+ userInfoPanelLayout->addWidget(userInfoScroll);
connect(m_userInfo, SIGNAL(findUser(GeoCoordinate)),
this, SIGNAL(findUser(GeoCoordinate)));
Kaj Wallin - kaj.wallin@ixonos.com
Katri Kaikkonen - katri.kaikkonen@ixonos.com
+ Pekka Nissinen - pekka.nissinen@ixonos.com
Situare is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
#include <QtGui>
#include "../user/user.h"
-#include "sidepanel.h"
class UserInfo;
/**
-* @brief Class for sliding user information panel
-*
-* @author Kaj Wallin - kaj.wallin (at) ixonos.com
-* @class UserInfoPanel
-*/
-class UserInfoPanel : public SidePanel
+ * @brief Class for sliding user information panel
+ *
+ * @author Kaj Wallin - kaj.wallin (at) ixonos.com
+ * @author Katri Kaikkonen - katri.kaikkonen (at) ixonos.com
+ * @author Pekka Nissinen - pekka.nissinen (at) ixonos.com
+ *
+ * @class UserInfoPanel
+ */
+class UserInfoPanel : public QWidget
{
Q_OBJECT
public:
/**
- * @brief Default constructor
- *
- * @param parent
- */
+ * @brief Default constructor
+ *
+ * @param parent
+ */
UserInfoPanel(QWidget *parent = 0);
/*******************************************************************************
******************************************************************************/
public slots:
/**
- * @brief Slot to capture returning user data from situareService
- *
- * @param user
- */
+ * @brief Slot to capture returning user data from situareService
+ *
+ * @param user
+ */
void userDataReceived(User *user);
/*******************************************************************************
******************************************************************************/
signals:
/**
- * @brief Signal for finding user.
- *
- * @param coordinates user geo coordinates
- */
+ * @brief Signal for finding user.
+ *
+ * @param coordinates user geo coordinates
+ */
void findUser(const GeoCoordinate &coordinates);
/**
- * @brief Signal that used to inform user that his message/location update tp Situare server
- * was failed.
- * This signal is originally sended from UserInfo
- * @param message message for notification
- * @param modal true if modal notification otherwice false
- */
+ * @brief Signal that used to inform user that his message/location update tp Situare server
+ * was failed.
+ * This signal is originally sended from UserInfo
+ *
+ * @param message message for notification
+ * @param modal true if modal notification otherwice false
+ */
void notificateUpdateFailing(const QString &message, bool modal);
/**
- * @brief Signal for refreshing user data.
- *
- */
+ * @brief Signal for refreshing user data.
+ */
void refreshUserData();
/**
- * @brief Signal for requesting reverseGeo from SituareEngine
- *
- */
+ * @brief Signal for requesting reverseGeo from SituareEngine
+ */
void requestReverseGeo();
/**
- * @brief Signals, when address data is ready
- *
- * @param address Street address
- */
+ * @brief Signals, when address data is ready
+ *
+ * @param address Street address
+ */
void reverseGeoReady(const QString &address);
/**
- * @brief Signal Signal for requestLocationUpdate from SituareEngine via MainWindow class
- *
- * @param status Status message
- * @param publish Publish on Facebook
- */
+ * @brief Signal Signal for requestLocationUpdate from SituareEngine via MainWindow class
+ *
+ * @param status Status message
+ * @param publish Publish on Facebook
+ */
void statusUpdate(const QString &status, const bool &publish);
/**
- * @brief Signals when updateLocationDialog's data must be cleared
- *
- */
+ * @brief Signals when updateLocationDialog's data must be cleared
+ */
void clearUpdateLocationDialogData();
+
/*******************************************************************************
* DATA MEMBERS
******************************************************************************/
if (event->buttons() & Qt::LeftButton) {
QPoint newLocation = mapToParent(event->pos()) - m_dragPosition;
- if (newLocation.x() < SIDEBAR_WIDTH)
- newLocation.rx() = SIDEBAR_WIDTH;
- else if (newLocation.x() > m_screenSize.width() - width() - SIDEBAR_WIDTH)
- newLocation.rx() = m_screenSize.width() - width() - SIDEBAR_WIDTH;
+ if (newLocation.x() < 0)
+ newLocation.rx() = 0;
+ else if (newLocation.x() > m_screenSize.width() - width() - PANEL_BAR_WIDTH)
+ newLocation.rx() = m_screenSize.width() - width() - PANEL_BAR_WIDTH;
if (newLocation.y() < 0)
newLocation.ry() = 0;
m_screenSize = newSize;
QPoint resizedPosition = pos();
-
- if(resizedPosition.x() > (newSize.width() - rect().width()))
+
+ if(resizedPosition.x() < 0)
+ resizedPosition.rx() = 0;
+ else if(resizedPosition.x() > (newSize.width() - rect().width()))
resizedPosition.rx() = newSize.width() - rect().width();
- else if (resizedPosition.x() < SIDEBAR_WIDTH)
- resizedPosition.rx() = SIDEBAR_WIDTH;
-
- if(resizedPosition.y() > (newSize.height() - rect().height()))
- resizedPosition.ry() = newSize.height() - rect().height();
- else if (resizedPosition.y() < 0)
+
+ if(resizedPosition.y() < 0)
resizedPosition.ry() = 0;
+ else if(resizedPosition.y() > (newSize.height() - rect().height()))
+ resizedPosition.ry() = newSize.height() - rect().height();
+
if((pos().y() + rect().center().y()) > (oldHeight/2))
resizedPosition.ry() = newSize.height() - (oldHeight - pos().y());