<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_left.png</file>
- <file>res/images/side_bar_right.png</file>
- <file>res/images/sliding_bar_left.png</file>
- <file>res/images/sliding_bar_right.png</file>
<file>res/images/led_red.png</file>
<file>res/images/led_red_s.png</file>
<file>res/images/list_item_bottom.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/sliding_bar_left_test.png</file>
- <file>res/images/userpanel_mask.png</file>
- <file>res/images/sliding_bar_right_test.png</file>
<file>res/images/gps_pos_accurate.png</file>
<file>res/images/gps_pos_coarse.png</file>
<file>res/images/friend_group.png</file>
<file>res/images/large_profile_pic_border_left.png</file>
<file>res/images/large_profile_pic_border_middle.png</file>
<file>res/images/large_profile_pic_border_right.png</file>
+ <file>res/images/menu_bar_drop_shadow.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/sliding_bar_button.png</file>
+ <file>res/images/sliding_bar_tile.png</file>
</qresource>
</RCC>
const QString USER_UNSEND_MESSAGE = "UNSEND_MESSAGE_CONTENT";
const QString USER_UNSEND_MESSAGE_PUBLISH = "UNSEND_MESSAGE_PUBLISH_POLICITY";
-const QColor COLOR_GRAY = QColor(152, 152, 152); ///< Gray color
-const QFont NOKIA_FONT_NORMAL = QFont("Nokia Sans", 18, QFont::Normal); ///< Normal font
-const QFont NOKIA_FONT_SMALL = QFont("Nokia Sans", 13, QFont::Normal); ///< Small font
+// Misc values
+const int DEFAULT_SCREEN_WIDTH = 800; ///< Default N900 screen width
+const int DEFAULT_SCREEN_HEIGHT = 480; ///< Default N900 screen height
+
+const QColor COLOR_GRAY = QColor(152, 152, 152); ///< Gray color
+const QFont NOKIA_FONT_NORMAL = QFont("Nokia Sans", 18, QFont::Normal); ///< Normal font
+const QFont NOKIA_FONT_SMALL = QFont("Nokia Sans", 13, QFont::Normal); ///< Small font
// Facobook login page pieces
const QString FACEBOOK_LOGINBASE = "http://www.facebook.com/login.php?";
if(m_ui->loginState()) {
logout();
m_situareService->clearUserData();
- }
- else {
+ } else {
m_facebookAuthenticator->start();
}
}
bool found = false;
- if (url.isValid()){
+ if (url.isValid()) {
qDebug() << "url is valid";
QString callbackUrl = url.toString();
}
}
}
- }
- else if ( callbackUrl.indexOf(LOGIN_FAILURE_REPLY) == 0){
+ } else if ( callbackUrl.indexOf(LOGIN_FAILURE_REPLY) == 0) {
qDebug() << "login failure";
qDebug() << callbackUrl;
clearAccountInformation(true);
if(m_freshLogin) {
emit error(SituareError::LOGIN_FAILED);
emit loginFailure();
- }
- else {
+ } else {
m_freshLogin = true;
emit error(SituareError::SESSION_EXPIRED);
}
- }
- else if(callbackUrl.indexOf(LOGIN_PAGE) == 0) {
+ } else if(callbackUrl.indexOf(LOGIN_PAGE) == 0) {
qDebug() << "correct loginPage";
- }
- else {
+ } else {
qDebug() << "totally wrong webPage";
// we should not get a wrong page at this point
emit loginFailure();
}
- }
- else {
+ } else {
qDebug() << " Loading of page failed invalid URL" << endl;
// we should not get a wrong page at this point
emit loginFailure();
******************************************************************************/
public:
/**
- * @brief Return item sceneBoundingRect transformed to given zoom level
- *
- * Because of using ItemIgnoresTransformations, and not scaling the item, the default
- * sceneBoundingRect does always return the lowest map tile level scene bounding rect which
- * is scaled to current zoom level.
- *
- * Left side of the returned rect is always inside the world coordinates, so collision
- * detection based on this rect does work also when items are spanned outside the
- * world coordinates.
- *
- * @param zoomLevel Zoom level for which the sceneBoundingRect should be transformed
- * @return sceneBoundingRect transformed to given zoom level
- */
+ * @brief Return item sceneBoundingRect transformed to given zoom level
+ *
+ * Because of using ItemIgnoresTransformations, and not scaling the item, the default
+ * sceneBoundingRect does always return the lowest map tile level scene bounding rect which
+ * is scaled to current zoom level.
+ *
+ * Left side of the returned rect is always inside the world coordinates, so collision
+ * detection based on this rect does work also when items are spanned outside the
+ * world coordinates.
+ *
+ * @param zoomLevel Zoom level for which the sceneBoundingRect should be transformed
+ * @return sceneBoundingRect transformed to given zoom level
+ */
QRect sceneTransformedBoundingRect(int zoomLevel) const;
};
const qreal MIN_LONGITUDE = -180.0; ///< Minimum longitude value
const qreal MAX_LONGITUDE = 180.0; ///< Maximum longitude value
-const int DEFAULT_SCREEN_WIDTH = 973; ///< Default screen width
-const int DEFAULT_SCREEN_HEIGHT = 614; ///< Default screen height
const int DEFAULT_ZOOM_LEVEL = 14; ///< Default zoom level
const qreal DEFAULT_LONGITUDE = 0.0000; ///< Default longitude value
const qreal DEFAULT_LATITUDE = 0.0000; ///< Default latitude value
if (!m_ownLocation->isVisible())
m_ownLocation->show();
- }
- else {
+ } else {
m_ownLocation->hide();
}
../languages.qrc
TRANSLATIONS += ../res/languages/situare_fi.ts
SOURCES += main.cpp \
- ui/mainwindow.cpp \
- situareservice/situareservice.cpp \
- situareservice/imagefetcher.cpp \
- facebookservice/facebookcredentials.cpp \
+ engine/engine.cpp \
facebookservice/facebookauthentication.cpp \
+ facebookservice/facebookcredentials.cpp \
+ gps/gpsposition.cpp \
+ map/baselocationitem.cpp \
+ map/friendgroupitem.cpp \
+ map/frienditemshandler.cpp \
+ map/friendlocationitem.cpp \
+ map/gpslocationitem.cpp \
map/mapengine.cpp \
- map/mapview.cpp \
+ map/mapfetcher.cpp \
map/mapscene.cpp \
map/maptile.cpp \
- map/mapfetcher.cpp \
+ map/maptilerequest.cpp \
+ map/mapview.cpp \
map/ownlocationitem.cpp \
- map/baselocationitem.cpp \
- map/friendlocationitem.cpp \
- ui/updatelocation/updatelocationdialog.cpp \
+ network/networkaccessmanager.cpp \
+ network/networkcookiejar.cpp \
+ network/networkhandler.cpp \
+ network/networkreply.cpp \
+ situareservice/imagefetcher.cpp \
+ situareservice/situareservice.cpp \
ui/updatelocation/texteditautoresizer.cpp \
- ui/friendlistview.cpp \
- ui/friendlistitem.cpp \
- user/user.cpp \
+ ui/updatelocation/updatelocationdialog.cpp \
ui/avatarimage.cpp \
- engine/engine.cpp \
- ui/settingsdialog.cpp \
- ui/logindialog.cpp \
- map/maptilerequest.cpp \
- ui/imagebutton.cpp \
+ ui/friendlistitem.cpp \
ui/friendlistpanel.cpp \
- ui/userinfopanel.cpp \
+ ui/friendlistview.cpp \
+ ui/imagebutton.cpp \
+ ui/logindialog.cpp \
+ ui/mainwindow.cpp \
+ ui/mapscale.cpp \
ui/panelsidebar.cpp \
ui/panelsliderbar.cpp \
- map/friendgroupitem.cpp \
- map/frienditemshandler.cpp \
- gps/gpsposition.cpp \
- map/gpslocationitem.cpp \
- ui/zoombuttonpanel.cpp \
- ui/userinfo.cpp \
+ ui/settingsdialog.cpp \
ui/sidepanel.cpp \
+ ui/sidepanelbase.cpp \
+ ui/userinfo.cpp \
+ ui/userinfopanel.cpp \
ui/zoombutton.cpp \
- network/networkaccessmanager.cpp \
- network/networkhandler.cpp \
- network/networkcookiejar.cpp \
- network/networkreply.cpp \
- ui/mapscale.cpp
-HEADERS += ui/mainwindow.h \
+ ui/zoombuttonpanel.cpp \
+ user/user.cpp
+HEADERS += common.h \
+ engine/engine.h \
+ facebookservice/facebookauthentication.h \
+ facebookservice/facebookcommon.h \
+ facebookservice/facebookcredentials.h \
+ gps/gpscommon.h \
+ gps/gpsposition.h \
+ map/baselocationitem.h \
+ map/friendgroupitem.h \
+ map/frienditemshandler.h \
+ map/friendlocationitem.h \
+ map/gpslocationitem.h \
+ map/mapcommon.h \
map/mapengine.h \
- map/mapview.h \
+ map/mapfetcher.h \
map/mapscene.h \
map/maptile.h \
- map/mapfetcher.h \
- map/mapcommon.h \
+ map/maptilerequest.h \
+ map/mapview.h \
map/ownlocationitem.h \
- map/baselocationitem.h \
- map/friendlocationitem.h \
- ui/updatelocation/updatelocationdialog.h \
- ui/updatelocation/texteditautoresizer.h \
- situareservice/situareservice.h \
- situareservice/situarecommon.h \
+ network/networkaccessmanager.h \
+ network/networkcookiejar.h \
+ network/networkhandler.h \
+ network/networkreply.h \
situareservice/imagefetcher.h \
- facebookservice/facebookcredentials.h \
- facebookservice/facebookauthentication.h \
- facebookservice/facebookcommon.h \
- ui/friendlistview.h \
- ui/friendlistitem.h \
- user/user.h \
+ situareservice/situarecommon.h \
+ situareservice/situareservice.h \
+ ui/updatelocation/texteditautoresizer.h \
+ ui/updatelocation/updatelocationdialog.h \
ui/avatarimage.h \
- engine/engine.h \
- ui/settingsdialog.h \
- ui/logindialog.h \
- map/maptilerequest.h \
- ui/imagebutton.h \
+ ui/friendlistitem.h \
ui/friendlistpanel.h \
- ui/userinfopanel.h \
+ ui/friendlistview.h \
+ ui/imagebutton.h \
+ ui/logindialog.h \
+ ui/mainwindow.h \
+ ui/mapscale.h \
ui/panelcommon.h \
ui/panelsidebar.h \
ui/panelsliderbar.h \
- map/friendgroupitem.h \
- map/frienditemshandler.h \
- gps/gpsposition.h \
- map/gpslocationitem.h \
- gps/gpscommon.h \
- ui/zoombuttonpanel.h \
- common.h \
+ ui/settingsdialog.h \
ui/userinfo.h \
+ ui/userinfopanel.h \
ui/sidepanel.h \
+ ui/sidepanelbase.h \
ui/zoombutton.h \
- network/networkaccessmanager.h \
- network/networkhandler.h \
- network/networkcookiejar.h \
- network/networkreply.h \
- ui/mapscale.h
+ ui/zoombuttonpanel.h \
+ user/user.h
QT += network \
webkit
DEFINES += QT_NO_DEBUG_OUTPUT
#include "imagebutton.h"
#include "../common.h"
-const int BACKGROUND_TOP_HEIGHT = 20;
const int BACKGROUND_BOTTOM_HEIGHT = 15;
+const int BACKGROUND_TOP_HEIGHT = 20;
+const int BACKGROUND_WIDTH = 368;
const int ICON_HEIGHT = 24; ///< Icon height
const int ICON_WIDTH = 24; ///< Icon width
const int IMAGE_HEIGHT = 64; ///< Friend image height
const int IMAGE_WIDTH = 64; ///< Friend image width
-const int ITEM_MAX_WIDTH = 368; ///< Maximum width for item
const int ITEM_MIN_HEIGHT = 141; ///< Minimum height for item
-const int ITEM_MIN_WIDTH = 368; ///< Minimum width for item
const int MARGIN = 5; ///< Icon margin
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
+
/**
* @var NAME_LABEL_MAX_WIDTH
*
* @brief Name label's maximum width
*/
-const int NAME_LABEL_MAX_WIDTH = ITEM_MIN_WIDTH - 3*MARGIN - IMAGE_WIDTH;
+const int NAME_LABEL_MAX_WIDTH = BACKGROUND_WIDTH - 3*MARGIN - IMAGE_WIDTH;
+
/**
* @var LABEL_MAX_WIDTH
*
* @brief All label's maximum width
*/
-const int LABEL_MAX_WIDTH = ITEM_MIN_WIDTH - 3*MARGIN - IMAGE_WIDTH - MARGIN - ICON_WIDTH;
+const int LABEL_MAX_WIDTH = BACKGROUND_WIDTH - 3 * MARGIN - IMAGE_WIDTH - MARGIN - ICON_WIDTH;
const int WALK_DISTANCE = 5; ///< Walk distance limit for distance icon
const int CAR_DISTANCE = 500; ///< Car distance limit for distance icon
layout->addLayout(topLayout, 0);
layout->addLayout(bottomLayout, 1);
- setMinimumSize(ITEM_MIN_WIDTH, ITEM_MIN_HEIGHT);
- setMaximumWidth(ITEM_MIN_WIDTH);
+ setMinimumSize(BACKGROUND_WIDTH, ITEM_MIN_HEIGHT);
+ setMaximumWidth(BACKGROUND_WIDTH);
setFont(NOKIA_FONT_SMALL);
m_nameLabel->setFont(NOKIA_FONT_NORMAL);
QPainter painter(this);
- QRect topRect = QRect(0, 0, ITEM_MIN_WIDTH, BACKGROUND_TOP_HEIGHT);
- QRect middleRect = QRect(0, topRect.bottom(), ITEM_MIN_WIDTH,
+ QRect topRect = QRect(0, 0, BACKGROUND_WIDTH, BACKGROUND_TOP_HEIGHT);
+ QRect middleRect = QRect(0, topRect.bottom(), BACKGROUND_WIDTH,
height() - BACKGROUND_TOP_HEIGHT - BACKGROUND_BOTTOM_HEIGHT);
- QRect bottomRect = QRect(topRect.left(), middleRect.bottom(), ITEM_MIN_WIDTH,
+ QRect bottomRect = QRect(topRect.left(), middleRect.bottom(), BACKGROUND_WIDTH,
BACKGROUND_BOTTOM_HEIGHT);
painter.drawPixmap(topRect, m_backgroundTopImage);
setType(SidePanel::FriendPanel);
QHBoxLayout *filterLayout = new QHBoxLayout;
- filterLayout->setContentsMargins(SLIDINGBAR_WIDTH+1, 0, SHOW_ALL_BUTTON_RIGHT_MARGIN, 0);
+ filterLayout->setContentsMargins(FRIENDPANEL_FILTER_MARGIN_LEFT, 0,
+ FRIENDPANEL_FILTER_MARGIN_RIGHT, 0);
m_friendListHeaderWidget = new QWidget();
m_friendListHeaderWidget->setLayout(filterLayout);
m_friendListHeaderWidget->setAutoFillBackground(true);
m_panelVBox->addWidget(m_friendListHeaderWidget);
QHBoxLayout *friendListLayout = new QHBoxLayout;
- friendListLayout->setContentsMargins(SLIDINGBAR_WIDTH+1, 0, SIDEBAR_WIDTH, 0);
+ friendListLayout->setContentsMargins(FRIENDPANEL_MARGIN_LEFT, FRIENDPANEL_MARGIN_TOP,
+ FRIENDPANEL_MARGIN_RIGHT, FRIENDPANEL_MARGIN_BOTTOM);
m_friendListView = new FriendListView(this);
QScrollArea *friendListScroll = new QScrollArea(this);
friendListScroll->setWidgetResizable(false);
#define FRIENDLISTPANEL_H
#include <QtGui>
+
#include "sidepanel.h"
class FriendListView;
QWidget *m_friendListHeaderWidget; ///< Friend list header widget
QLabel *m_friendListLabel; ///< Friend list label
QPushButton *m_clearFilterButton; ///< Button to clear list filtering
- FriendListView *m_friendListView; ///< Friend list view
+ FriendListView *m_friendListView; ///< Friend list view
};
#endif // FRIENDLISTPANEL_H
#include <QtWebKit>
#include <QtAlgorithms>
-#include "common.h"
#include "facebookservice/facebookauthentication.h"
+#include "map/mapcommon.h"
+#include "map/mapview.h"
+#include "common.h"
#include "friendlistpanel.h"
#include "logindialog.h"
-#include "map/mapview.h"
+#include "mapscale.h"
#include "settingsdialog.h"
#include "userinfopanel.h"
#include "zoombuttonpanel.h"
-#include "mapscale.h"
#include "mainwindow.h"
#include <X11/Xlib.h>
#endif // Q_WS_MAEMO_5
-// values for setting screen size in desktop matching N900 screen size
-const int N900_APP_WIDTH = 800;
-const int N900_APP_HEIGHT = 449;
-
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent),
m_drawOwnLocationCrosshair(false),
QHBoxLayout *layout = new QHBoxLayout;
layout->addWidget(m_mapView);
layout->setMargin(0);
+ layout->setSpacing(0);
+
setCentralWidget(new QWidget());
centralWidget()->setLayout(layout);
grabZoomKeys(true);
- // set screen size in desktop matching N900 screen size
- resize(N900_APP_WIDTH, N900_APP_HEIGHT);
+ // Set default screen size
+ resize(DEFAULT_SCREEN_WIDTH, DEFAULT_SCREEN_HEIGHT);
#ifdef Q_WS_MAEMO_5
setAttribute(Qt::WA_Maemo5StackedWindow);
#endif
connect(m_fullScreenButton, SIGNAL(clicked()),
this, SLOT(toggleFullScreen()));
#endif // Q_WS_MAEMO_5
-
}
void MainWindow::buildFriendListPanel()
qDebug() << __PRETTY_FUNCTION__;
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(m_friendsListPanel, SIGNAL(findFriend(QPointF)),
- this, SIGNAL(findFriend(QPointF)));
-
- connect(m_mapView, SIGNAL(viewResized(QSize)),
- m_friendsListPanel, SLOT(screenResized(QSize)));
-
connect(this, SIGNAL(locationItemClicked(QList<QString>)),
m_friendsListPanel, SLOT(showFriendsInList(QList<QString>)));
connect(m_mapView, SIGNAL(viewResized(QSize)),
- m_friendsListPanelSidebar, SLOT(reDrawSidebar(QSize)));
+ m_friendsListPanel, SLOT(resizePanel(QSize)));
+
+ connect(m_mapView, SIGNAL(viewResized(QSize)),
+ m_friendsListPanelSidebar, SLOT(resizeSideBar(QSize)));
+
+ connect(m_friendsListPanel, SIGNAL(findFriend(QPointF)),
+ this, SIGNAL(findFriend(QPointF)));
}
void MainWindow::buildInformationBox(const QString &message, bool modal)
qDebug() << __PRETTY_FUNCTION__;
m_userPanel = new UserInfoPanel(this);
+
m_userPanelSidebar = new PanelSideBar(this, LEFT);
m_userPanelSidebar->stackUnder(m_friendsListPanel);
m_userPanel->stackUnder(m_userPanelSidebar);
- connect(m_userPanel, SIGNAL(findUser(QPointF)),
- this, SIGNAL(findUser(QPointF)));
-
connect(this, SIGNAL(userLocationReady(User*)),
m_userPanel, SLOT(userDataReceived(User*)));
- connect(m_userPanel, SIGNAL(requestReverseGeo()),
- this, SIGNAL(requestReverseGeo()));
-
connect(this, SIGNAL(reverseGeoReady(QString)),
m_userPanel, SIGNAL(reverseGeoReady(QString)));
- connect(m_userPanel, SIGNAL(statusUpdate(QString,bool)),
- this, SIGNAL(statusUpdate(QString,bool)));
-
- connect(m_userPanel, SIGNAL(refreshUserData()),
- this, SIGNAL(refreshUserData()));
-
- connect(m_mapView, SIGNAL(viewResized(QSize)),
- m_userPanel, SLOT(screenResized(QSize)));
-
connect(this, SIGNAL(clearUpdateLocationDialogData()),
m_userPanel, SIGNAL(clearUpdateLocationDialogData()));
connect(this, SIGNAL(messageSendingFailed(int)),
m_userPanel, SIGNAL(messageSendingFailed(int)));
+ connect(m_mapView, SIGNAL(viewResized(QSize)),
+ m_userPanel, SLOT(resizePanel(QSize)));
+
+ connect(m_mapView, SIGNAL(viewResized(QSize)),
+ m_userPanelSidebar, SLOT(resizeSideBar(QSize)));
+
+ connect(m_userPanel, SIGNAL(findUser(QPointF)),
+ this, SIGNAL(findUser(QPointF)));
+
+ connect(m_userPanel, SIGNAL(requestReverseGeo()),
+ this, SIGNAL(requestReverseGeo()));
+
+ connect(m_userPanel, SIGNAL(statusUpdate(QString,bool)),
+ this, SIGNAL(statusUpdate(QString,bool)));
+
+ connect(m_userPanel, SIGNAL(refreshUserData()),
+ this, SIGNAL(refreshUserData()));
+
connect(m_userPanel, SIGNAL(notificateUpdateFailing(QString, bool)),
this, SLOT(buildInformationBox(QString, bool)));
}
*/
void readAutomaticLocationUpdateSettings();
-
/**
* @brief Enable / disable auto centering button.
*
#ifndef PANELCOMMON_H
#define PANELCOMMON_H
-#include <QtCore>
-#include "map/mapcommon.h"
-
-enum Side {LEFT, RIGHT}; ///< Enumerator for panel sideness
+#include <QString>
+#include "../common.h"
+// Dragging settings
const int DRAG_INIT_TIME = 1000; ///< How long buttons must be pressed to start drag mode
const int FORCE_RELEASE_TIME = 10000; ///< How long mouse can be grabbed
-const int SIDEBAR_WIDTH = 23; ///< Width of the sidebar
-const int SIDEBAR_HEIGHT = 424; ///< Height of the sidebar
+// 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 SLIDINGBAR_WIDTH = 24; ///< Width of the slidingbar
-const int SLIDINGBAR_HEIGHT = 424; ///< Height of the slidingbar
+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 SHOW_ALL_BUTTON_RIGHT_MARGIN = SIDEBAR_WIDTH*2-7; ///< Show all button right margin
+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_PEEK_AMOUNT = 25; ///< Amount of pixels shown when panel is closed
+// 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
-const int FRIENDPANEL_WIDTH = 430; ///< Width of the friends list panel
-const int FRIENDPANEL_HEIGHT = DEFAULT_SCREEN_HEIGHT; ///< Height of the friends list panel
+const int FRIENDPANEL_MARGIN_LEFT = SLIDER_BUTTON_OFFSET
+ + MAEMO5_SCROLLBAR_WIDTH; ///< Friend list panel inner margin (left)
+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 USERPANEL_WIDTH = 300; ///< Width of the user panel
-const int USERPANEL_HEIGHT = DEFAULT_SCREEN_HEIGHT; ///< Height of the user panetl
+const int FRIENDPANEL_FILTER_MARGIN_LEFT = FRIENDPANEL_MARGIN_LEFT + 4; ///< Friend list filter bar margin (left)
+const int FRIENDPANEL_FILTER_MARGIN_RIGHT = FRIENDPANEL_MARGIN_RIGHT
+ + MAEMO5_SCROLLBAR_WIDTH + 4; ///< Friend list filter bar margin (right)
-const int MARGIN_CORRECTION = 1; ///< Amount of correction to make panels touch the window borders
-const int MARGIN_CORRECTION2 = 2; ///< Amount of correction to make panels touch the window borders
+const int SHOW_ALL_BUTTON_RIGHT_MARGIN = SIDEBAR_WIDTH * 2 - 7; ///< Show all button right margin
-const int PANEL_TOP_Y = 0; ///< Y coordinate for top of both panels
-const int TOP_CORNER_X = 0; ///< X coordinate for top left corner
+const int FRIENDPANEL_CLOSED_X = DEFAULT_SCREEN_WIDTH - SLIDER_BUTTON_OFFSET
+ - PANEL_PEEK_AMOUNT; ///< Horizontal position of a closed friend list panel
+const int FRIENDPANEL_OPENED_X = DEFAULT_SCREEN_WIDTH - SLIDER_BUTTON_OFFSET - SLIDER_BAR_WIDTH
+ - FRIENDPANEL_WIDTH; ///< Horizontal position of a open friend list panel
-const int FRIENDPANEL_CLOSED_X =
- DEFAULT_SCREEN_WIDTH - PANEL_PEEK_AMOUNT
- - SLIDINGBAR_WIDTH; ///< X location of the friend list panel when closed
-const int FRIENDPANEL_OPENED_X =
- DEFAULT_SCREEN_WIDTH - FRIENDPANEL_WIDTH
- - SLIDINGBAR_WIDTH; ///< X location of the friend list panel when opened
+// 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_CLOSED_X =
- 2 - USERPANEL_WIDTH + PANEL_PEEK_AMOUNT; ///< X location of the user panel when closed
-const int USERPANEL_OPENED_X = 0; ///< X location of the user panel when opened
+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)
+const int USERPANEL_CLOSED_X = - USERPANEL_WIDTH + PANEL_PEEK_AMOUNT
+ - SLIDER_BAR_WIDTH; ///< Horizontal position of a closed user info panel
+const int USERPANEL_OPENED_X = 0; ///< Horizontal position of a open user info panel
-const int ZOOM_BUTTON_PANEL_POSITION_X = 10
- + PANEL_PEEK_AMOUNT; ///< Horizontal position of zoom 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
- /*
+/*
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
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 <QtGui>
#include "panelsidebar.h"
-#include "panelcommon.h"
PanelSideBar::PanelSideBar(QWidget *parent, Side side)
: QWidget(parent)
{
+ qDebug() << __PRETTY_FUNCTION__;
+
if (side == LEFT) {
setObjectName("SidePanelLeft");
- setStyleSheet(QString(
- "#SidePanelLeft{background-image: url(:/res/images/side_bar_left.png)}"));
- move(QPoint(USERPANEL_OPENED_X, PANEL_TOP_Y));
- }
- else if (side == RIGHT){
+ 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");
- setStyleSheet(QString(
- "#SidePanelRight{background-image: url(:/res/images/side_bar_right.png)}"));
- move(QPoint(DEFAULT_SCREEN_WIDTH - SIDEBAR_WIDTH + MARGIN_CORRECTION2, PANEL_TOP_Y));
- }
- else {
+ 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);
}
{
qDebug() << __PRETTY_FUNCTION__;
- QStyleOption option;
- option.init(this);
+ QPainter painter(this);
- QStylePainter painter(this);
- style()->drawPrimitive(QStyle::PE_Widget, &option, &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::reDrawSidebar(const QSize &size)
+void PanelSideBar::resizeSideBar(const QSize &size)
{
qDebug() << __PRETTY_FUNCTION__;
- if (objectName() == "SidePanelRight") {
- move(size.width() - SIDEBAR_WIDTH + MARGIN_CORRECTION2, PANEL_TOP_Y);
- }
+
+ 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);
}
- /*
+/*
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
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
-* @class PanelSideBar panelsidebar.h "ui/panelsidebar.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"
- */
+ * @brief Constructor
+ *
+ * @param parent Parent
+ * @param side Qstring for the sidebar location. Accepts "left" and "right"
+ */
PanelSideBar(QWidget *parent = 0, Side side = LEFT);
/*******************************************************************************
******************************************************************************/
protected:
/**
- * @brief Draws stylesheet used in this class.
- *
- * @param * QPaintEvent unused
- */
+ * @brief Draws stylesheet used in this class.
+ *
+ * @param * QPaintEvent unused
+ */
void paintEvent(QPaintEvent *);
/*******************************************************************************
******************************************************************************/
public slots:
/**
- * @brief Slot to redraw the sidebar after window resize event
- *
- * @param size Size of the screen
- */
- void reDrawSidebar(const QSize &size);
+ * @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
- /*
+/*
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
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 <QtGui>
#include "panelsliderbar.h"
-#include "panelcommon.h"
PanelSliderBar::PanelSliderBar(QWidget *parent, Side side)
: QWidget(parent)
{
- if(side == LEFT) {
- setObjectName("UserPanelSlidingBar");
- setStyleSheet(QString(
- "#UserPanelSlidingBar{background-image: url(:/res/images/sliding_bar_left_test.png)}"));
- setMask(QPixmap(":/res/images/sliding_bar_left_test.png").mask());
- }
- else if(side == RIGHT) {
- setObjectName("FriendPanelSlidingBar");
- setStyleSheet(QString(
- "#FriendPanelSlidingBar{background-image: url(:/res/images/sliding_bar_right_test.png)}"));
- setMask(QPixmap(":/res/images/sliding_bar_right_test.png").mask());
- }
- else {
+ qDebug() << __PRETTY_FUNCTION__;
+
+ if (side == LEFT)
+ m_sliderButtonArrow.load(":res/images/arrow_right.png");
+ else if (side == RIGHT)
+ m_sliderButtonArrow.load(":res/images/arrow_left.png");
+ else
qFatal("Illegal PanelSliderBar 2nd argument");
- }
- resize(SLIDINGBAR_WIDTH*2, SLIDINGBAR_HEIGHT);
+
+ 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__;
- QStyleOption option;
- option.init(this);
+ QPainter painter(this);
- QStylePainter painter(this);
- style()->drawPrimitive(QStyle::PE_Widget, &option, &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_sliderButtonArrow.width() / 2),
+ (this->height() / 2) - (m_sliderButtonArrow.height() / 2),
+ m_sliderButtonArrow);
}
void PanelSliderBar::mouseReleaseEvent(QMouseEvent *)
{
qDebug() << __PRETTY_FUNCTION__;
+
emit clicked();
}
+
+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);
+}
- /*
+/*
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
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 from drawing sliding bar attached to panels
-*
-* @author Kaj Wallin - kaj.wallin (at) ixonos.com
-* @class PanelSliderBar panelsliderbar.h "ui/panelsliderbar.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"
- */
+ * @brief Constructor
+ *
+ * @param parent Parent
+ * @param side Qstring for the sliderbar location. Accepts "LEFT" and "RIGHT"
+ */
PanelSliderBar(QWidget *parent, Side side);
/*******************************************************************************
-* BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
-******************************************************************************/
+ * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
+ ******************************************************************************/
protected:
/**
- * @brief Draws stylesheet used in this class.
- *
- * @param * QPaintEvent unused
- */
+ * @brief Draws the slider
+ *
+ * @param * QPaintEvent unused
+ */
void paintEvent(QPaintEvent *);
/**
- * @brief Mouse release event used to expand/collapse the panel
- *
- * @param * Event
- *
- * @sa clicked
- */
+ * @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 redraw the slider bar after window resize event
+ *
+ * @param size Size of the new window
+ */
+ void resizeSliderBar(const QSize &size);
- /*******************************************************************************
- * SIGNALS
- ******************************************************************************/
+/*******************************************************************************
+ * SIGNALS
+ ******************************************************************************/
signals:
/**
- * @brief Signal that is emitted the slider bar is clicked
- *
- * @sa mouseReleaseEvent
- */
+ * @brief Signal that is emitted the slider bar is clicked
+ *
+ * @sa mouseReleaseEvent
+ */
void clicked();
+
+/*******************************************************************************
+ * DATA MEMBERS
+ ******************************************************************************/
+private:
+ QPixmap m_menuDropShadowTile; ///< Pixmap for menu drop shadow
+ QPixmap m_sliderButton; ///< Pixmap for panel sliding bar button
+ QPixmap m_sliderButtonArrow; ///< Pixmap for panel sliding bar button arrow
+ 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
};
#endif // PANELSLIDERBAR_H
- /*
+/*
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
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 "panelsliderbar.h"
+
+#include "panelcommon.h"
#include "panelsidebar.h"
-#include <QAbstractState>
+#include "panelsliderbar.h"
+#include "sidepanelbase.h"
SidePanel::SidePanel(QWidget *parent) :
QWidget(parent),
- m_isOpen(false)
+ m_isOpen(false),
+ currentType(SidePanel::None)
{
qDebug() << __PRETTY_FUNCTION__;
- currentType = SidePanel::None;
m_panelVBox = new QVBoxLayout(this);
m_panelVBox->setMargin(0);
m_panelVBox->setSpacing(0);
- m_panelBase = new QWidget(this);
+ m_panelBase = new SidePanelBase(this);
m_panelBase->setLayout(m_panelVBox);
- QPalette pal = palette();
- pal.setColor(QPalette::Background, QColor(0, 0, 0, 128));
- m_panelBase->setPalette(pal);
- m_panelBase->setAutoFillBackground(true);
-
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 = 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 = 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();
}
qDebug() << __PRETTY_FUNCTION__;
if(!m_isOpen)
- {
emit toggleState();
- }
}
void SidePanel::closePanel()
qDebug() << __PRETTY_FUNCTION__;
if(m_isOpen)
- {
emit toggleState();
- }
}
-void SidePanel::screenResized(const QSize &size)
+void SidePanel::resizePanel(const QSize &size)
{
qDebug() << __PRETTY_FUNCTION__;
- if(currentType == SidePanel::UserPanel)
- {
- m_panelBase->resize(USERPANEL_WIDTH, SLIDINGBAR_HEIGHT + MARGIN_CORRECTION);
- resize(USERPANEL_WIDTH + SLIDINGBAR_WIDTH,SLIDINGBAR_HEIGHT + MARGIN_CORRECTION);
- }
- else if(currentType == SidePanel::FriendPanel)
- {
- resize(FRIENDPANEL_WIDTH + SLIDINGBAR_WIDTH, size.height() + MARGIN_CORRECTION);
- m_panelBase->resize(FRIENDPANEL_WIDTH, size.height() + MARGIN_CORRECTION);
- m_panelStateClosed->assignProperty(this, "pos", QPoint(
- size.width() - PANEL_PEEK_AMOUNT - SLIDINGBAR_WIDTH + MARGIN_CORRECTION, PANEL_TOP_Y));
- m_panelStateOpened->assignProperty(this, "pos", QPoint(
- size.width() - FRIENDPANEL_WIDTH - SLIDINGBAR_WIDTH + MARGIN_CORRECTION, PANEL_TOP_Y));
- move(size.width() - PANEL_PEEK_AMOUNT - SLIDINGBAR_WIDTH + MARGIN_CORRECTION, PANEL_TOP_Y);
- }
- else
- {
+ 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");
}
}
if(currentType == SidePanel::None) {
if(type == SidePanel::UserPanel) {
currentType = type;
- m_panelBase->move(TOP_CORNER_X,PANEL_TOP_Y);
- m_panelBase->resize(USERPANEL_WIDTH, SLIDINGBAR_HEIGHT + MARGIN_CORRECTION);
+ setObjectName("UserPanel");
+
+ this->resize(USERPANEL_WIDTH + SLIDER_BAR_WIDTH + SLIDER_BUTTON_OFFSET,
+ USERPANEL_HEIGHT);
+ this->move(USERPANEL_CLOSED_X, PANEL_TOP_PADDING);
- PanelSliderBar *m_panelSlidingBar = new PanelSliderBar(this, LEFT);
- m_panelSlidingBar->move(USERPANEL_WIDTH - SLIDINGBAR_WIDTH, PANEL_TOP_Y);
+ 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()));
- // set mask to allow clicking zoom button at their default position
- setMask(QPixmap(":/res/images/userpanel_mask.png").mask());
-
- m_panelStateClosed->assignProperty(this, "pos", QPoint(
- USERPANEL_CLOSED_X, PANEL_TOP_Y));
- m_panelStateOpened->assignProperty(this, "pos", QPoint(
- USERPANEL_OPENED_X, PANEL_TOP_Y));
- setObjectName("UserPanel");
- }
- else if (type == SidePanel::FriendPanel) {
+ 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;
- m_panelBase->move(TOP_CORNER_X + SLIDINGBAR_WIDTH,PANEL_TOP_Y);
+ 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);
- m_panelSlidingBar->move(TOP_CORNER_X, PANEL_TOP_Y);
connect(m_panelSlidingBar, SIGNAL(clicked()),
this, SIGNAL(toggleState()));
- m_panelStateClosed->assignProperty(this, "pos", QPoint(
- FRIENDPANEL_CLOSED_X, PANEL_TOP_Y));
- m_panelStateOpened->assignProperty(this, "pos", QPoint(
- FRIENDPANEL_OPENED_X, PANEL_TOP_Y));
- setObjectName("FriendPanel");
- }
- else {
+ 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 {
+ } else {
qWarning() << "Illegally tried to set type multiple times at SidePanel::setType";
}
}
- /*
+/*
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
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>
-#include "panelcommon.h"
class PanelSliderBar;
+class SidePanelBase;
/**
-* @brief Base class for sliding side panels
-*
-* @author Kaj Wallin - kaj.wallin (at) ixonos.com
-* @class SidePanel sidepanel.h "ui/sidepanel.h"
-*/
+ * @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
- */
+ * @brief Constructor
+ *
+ * @param parent
+ */
SidePanel(QWidget *parent = 0);
/**
- * @brief Enumerator for the panel type
- * Defines values: UserPanel, FriendPanel, None
- *
- * @sa setType
- */
+ * @brief Enumerator for the panel type
+ * Defines values: UserPanel, FriendPanel, None
+ *
+ * @sa setType
+ */
enum PanelType {UserPanel, FriendPanel, None};
+
/******************************************************************************
* MEMBER FUNCTIONS AND SLOTS
******************************************************************************/
public slots:
/**
- * @brief Public slot that will open the panel unless already open
- */
+ * @brief Public slot that will open the panel unless already open
+ */
void openPanel();
/**
- * @brief Public slot that will close the panel unless already closed
- */
+ * @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 screen
- */
- void screenResized(const QSize &size);
+ * @brief Slot to redraw the panel after window resize event
+ *
+ * @param size Size of the new window
+ */
+ void resizePanel(const QSize &size);
/**
- * @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
- */
+ * @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);
-
private slots:
/**
- * @brief Internal slot used to track statemachine state
- */
+ * @brief Internal slot used to track statemachine state
+ */
void stateChangedToClosed();
+
/**
- * @brief Internal slot used to track statemachine state
- */
+ * @brief Internal slot used to track statemachine state
+ */
void stateChangedToOpen();
/******************************************************************************
******************************************************************************/
signals:
/**
- * @brief Signal that is sent to state machine when state must be changed
- *
- * @sa openPanel
- * @sa closePanel
- */
+ * @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
- */
+ * @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
- */
+ * @brief Signal that is sent when panel is opened
+ *
+ * @sa openPanel
+ * @sa closePanel
+ */
void panelOpened();
/*******************************************************************************
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
- QWidget *m_panelBase; ///< Widget for panel base
-
- PanelType currentType; ///< Holder for the type of this panel
- PanelSliderBar *m_panelSlidingBar; ///< Widget for sidebar tab item
+
+ 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
*/
#include "userinfopanel.h"
+
#include "userinfo.h"
+#include "panelcommon.h"
UserInfoPanel::UserInfoPanel(QWidget *parent)
: SidePanel(parent)
userInfoScroll->widget()->setAutoFillBackground(false);
m_panelVBox->addWidget(userInfoScroll);
- m_panelVBox->setContentsMargins(SLIDINGBAR_WIDTH+1, 0, SIDEBAR_WIDTH, 0);
+ m_panelVBox->setContentsMargins(USERPANEL_MARGIN_LEFT, 0, USERPANEL_MARGIN_RIGHT, 0);
connect(m_userInfo, SIGNAL(findUser(QPointF)),
this, SIGNAL(findUser(QPointF)));
USA.
*/
-
#ifndef USERPANEL_H
#define USERPANEL_H
#include <QtGui>
+
#include "../user/user.h"
#include "sidepanel.h"
#ifndef ZOOMBUTTONPANEL_H
#define ZOOMBUTTONPANEL_H
-#include <QWidget>
-#include <QGridLayout>
#include <QGraphicsItem>
+#include <QGridLayout>
+#include <QTimer>
+#include <QWidget>
#include "zoombutton.h"
SOURCES += \
testsidepanel.cpp \
../../../src/ui/sidepanel.cpp \
+ ../../../src/ui/sidepanelbase.cpp \
../../../src/ui/panelsliderbar.cpp
-
HEADERS += \
../../../src/ui/sidepanel.h \
+ ../../../src/ui/sidepanelbase.h \
../../../src/ui/panelsliderbar.h \
../../../src/ui/panelcommon.h \
../../../src/map/mapcommon.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.
- */
-
-
+*/
#include <QtTest/QtTest>
#include <QtCore>