#include "indicatorbutton.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_indicatorButton(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();
+// buildFriendListPanel();
buildUserInfoPanel();
createMenus();
setWindowTitle(tr("Situare"));
// set stacking order of widgets
- m_zoomButtonPanel->stackUnder(m_userPanel);
+// m_zoomButtonPanel->stackUnder(m_userInfoPanel);
+ 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(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)));
{
qDebug() << __PRETTY_FUNCTION__;
- m_userPanel = new UserInfoPanel(this);
-
- m_userPanelSidebar = new PanelSideBar(this, LEFT);
-
- m_userPanelSidebar->stackUnder(m_friendsListPanel);
- m_userPanel->stackUnder(m_userPanelSidebar);
+ 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()));
+ m_userInfoPanel, SIGNAL(clearUpdateLocationDialogData()));
- 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(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)));
+
+ m_tabbedPanel = new TabbedPanel(this);
+ m_tabbedPanel->addTab(m_userInfoPanel, QIcon(":/res/images/user_info.png"));
+
+ // This is just testing
+ m_tabbedPanel->addTab(new QPushButton("Friend List"), QIcon(":/res/images/friend_list.png"));
+
+ // Another test
+ m_tabbedPanel->addTab(new QPushButton("Routing"), QIcon(":/res/images/routing.png"));
+
+ connect(m_mapView, SIGNAL(viewResized(QSize)),
+ m_tabbedPanel, SLOT(resizePanel(QSize)));
}
void MainWindow::buildWebView()
{
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()
#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
*/
const QString username();
public slots:
-
/**
* @brief Build direction indicator button and connect slots
*/
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
};
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
};
#include "panelcommon.h"
UserInfoPanel::UserInfoPanel(QWidget *parent)
- : SidePanel(parent)
+ : QWidget(parent)
{
qDebug() << __PRETTY_FUNCTION__;
- setType(SidePanel::UserPanel);
-
m_userInfo = new UserInfo(this);
QWidget *userInfoView = new QWidget(this);
userInfoScroll->viewport()->setAutoFillBackground(false);
userInfoScroll->widget()->setAutoFillBackground(false);
- m_panelVBox->addWidget(userInfoScroll);
- m_panelVBox->setContentsMargins(USERPANEL_MARGIN_LEFT, 0, USERPANEL_MARGIN_RIGHT, 0);
-
connect(m_userInfo, SIGNAL(findUser(GeoCoordinate)),
this, SIGNAL(findUser(GeoCoordinate)));
#include <QtGui>
#include "../user/user.h"
-#include "sidepanel.h"
class UserInfo;
* @author Kaj Wallin - kaj.wallin (at) ixonos.com
* @class UserInfoPanel
*/
-class UserInfoPanel : public SidePanel
+class UserInfoPanel : public QWidget
{
Q_OBJECT