<file>res/images/zoom_in.png</file>
<file>res/images/zoom_out.png</file>
<file>res/images/location_search.png</file>
+ <file>res/images/list_item_context_button_bar_left.png</file>
+ <file>res/images/list_item_context_button_bar_right.png</file>
+ <file>res/images/list_item_context_button_bar_tile.png</file>
<file>res/images/search_history.png</file>
<file>res/images/clear_btn_d.png</file>
<file>res/images/clear_btn_s.png</file>
ui/userinfopanel.cpp \
ui/zoombutton.cpp \
ui/zoombuttonpanel.cpp \
- user/user.cpp
+ user/user.cpp \
+ ui/listitemcontextbuttonbar.cpp
HEADERS += application.h \
common.h \
coordinates/geocoordinate.h \
ui/userinfopanel.h \
ui/zoombutton.h \
ui/zoombuttonpanel.h \
- user/user.h
+ user/user.h \
+ ui/listitemcontextbuttonbar.h
QT += network \
webkit
DEFINES += QT_NO_DEBUG_OUTPUT
this, SIGNAL(findFriend(GeoCoordinate)));
connect(m_friendListView, SIGNAL(listItemSelectionChanged()),
- this, SLOT(setRouteButtonDisabled()));
+ this, SLOT(onListItemSelectionChanged()));
// --- FOOTER, TEXT BASED FILTERING ---
QHBoxLayout *footerLayout = new QHBoxLayout();
m_routeButton = new ImageButton(":res/images/route_to_friend.png",
":res/images/route_to_friend_s.png",
":res/images/route_to_friend_d.png", this);
- m_routeButton->setDisabled(true);
connect(m_routeButton, SIGNAL(clicked()),
this, SLOT(routeToSelectedFriend()));
connect(m_clearGroupFilteringButton, SIGNAL(clicked()),
this, SLOT(clearFiltering()));
- m_contextButtonLayout->addWidget(m_routeButton);
- m_contextButtonLayout->addWidget(m_showContactButton);
- m_contextButtonLayout->addWidget(m_clearGroupFilteringButton);
+ m_itemButtonsLayout->addWidget(m_routeButton);
+ m_itemButtonsLayout->addWidget(m_showContactButton);
+ m_genericButtonsLayout->addWidget(m_clearGroupFilteringButton);
}
void FriendListPanel::anyPanelClosed()
clearFiltering();
m_friendListView->clearItemSelection();
- setRouteButtonDisabled();
}
void FriendListPanel::anyPanelOpened()
clearFiltering();
m_friendListView->clearItemSelection();
- setRouteButtonDisabled();
}
void FriendListPanel::requestSelectedFriendContactDialog()
}
}
-void FriendListPanel::setRouteButtonDisabled()
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- m_routeButton->setDisabled(m_friendListView->selectedItems().isEmpty());
-}
-
void FriendListPanel::showEvent(QShowEvent *event)
{
qDebug() << __PRETTY_FUNCTION__;
void routeToSelectedFriend();
/**
- * @brief Sets route button disabled.
- *
- * Disabled if there isn't any list item selected.
- */
- void setRouteButtonDisabled();
-
- /**
* @brief Slot to show friends in list.
*
* Shows only friends that are on userIDs list
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ 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 <QLayout>
+#include <QPainter>
+#include <QPropertyAnimation>
+#include <QStateMachine>
+
+#include "panelcommon.h"
+
+#include "listitemcontextbuttonbar.h"
+
+ListItemContextButtonBar::ListItemContextButtonBar(QWidget *parent) :
+ QWidget(parent),
+ m_waitForOpen(false),
+ m_contextButtons(0),
+ m_newContextButtons(0),
+ m_state(StateHidden)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ // --- BAR LOOK ---
+ const int BAR_HEIGHT = 78;
+ setFixedHeight(BAR_HEIGHT);
+
+ m_backgroundLeft = new QPixmap(":/res/images/list_item_context_button_bar_left.png");
+ m_backgroundMiddle = new QPixmap(":/res/images/list_item_context_button_bar_tile.png");
+ m_backgroundRight = new QPixmap(":/res/images/list_item_context_button_bar_right.png");
+
+ // --- ANIMATION ---
+ const int ANIMATION_DURATION_MS = 150;
+
+ m_animation = new QPropertyAnimation(this, "pos", this);
+ m_animation->setDuration(ANIMATION_DURATION_MS);
+
+ connect(m_animation, SIGNAL(finished()),
+ this, SLOT(onAnimationFinished()));
+}
+
+ListItemContextButtonBar::~ListItemContextButtonBar()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ if (m_backgroundLeft)
+ delete m_backgroundLeft;
+
+ if (m_backgroundMiddle)
+ delete m_backgroundMiddle;
+
+ if (m_backgroundRight)
+ delete m_backgroundRight;
+}
+
+void ListItemContextButtonBar::changeButtons()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ Q_ASSERT(m_animation->state() == QAbstractAnimation::Stopped);
+
+ if (!isVisible())
+ show();
+
+ // Hide previous buttons (if any)
+ if (m_contextButtons)
+ m_contextButtons->setParent(0);
+
+ m_contextButtons = m_newContextButtons;
+ m_newContextButtons = 0;
+ m_contextButtons->setParent(this);
+ m_contextButtons->show();
+ setFixedWidth(m_contextButtons->width());
+
+ // center this widget horizontally to middle of the panel contents area and set outside of
+ // the view
+ const int FROM_PANEL_CONTENTS_LEFT = PANEL_WIDTH / 2 - m_contextButtons->width() / 2;
+ move(PANEL_TAB_BAR_WIDTH + PANEL_BAR_WIDTH + FROM_PANEL_CONTENTS_LEFT, -size().height());
+
+ // update new target values for animations
+ m_animation->setStartValue(pos());
+ const int Y = 0;
+ m_animation->setEndValue(QPoint(pos().x(), Y));
+}
+
+void ListItemContextButtonBar::hideContextButtonBar()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_state = StateClosing;
+ m_animation->setDirection(QAbstractAnimation::Backward);
+ m_animation->start();
+}
+
+void ListItemContextButtonBar::onAnimationFinished()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ if (m_animation->direction() == QAbstractAnimation::Backward) {
+ m_state = StateHidden;
+ if (m_newContextButtons) {
+ changeButtons();
+ if (m_waitForOpen) {
+ m_waitForOpen = false;
+ showContextButtonBar();
+ }
+ }
+ } else {
+ m_state = StateVisible;
+ }
+}
+
+void ListItemContextButtonBar::onListItemSelectionChanged(bool itemIsSelected)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ if (itemIsSelected) {
+ if (m_newContextButtons)
+ m_waitForOpen = true;
+ else if (m_state != StateVisible)
+ showContextButtonBar();
+ } else {
+ if (m_newContextButtons)
+ m_waitForOpen = false;
+ else if (m_state != StateHidden)
+ hideContextButtonBar();
+ }
+}
+
+void ListItemContextButtonBar::paintEvent(QPaintEvent *event)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ Q_UNUSED(event);
+
+ QPainter painter(this);
+
+ const int TOP = 0;
+ const int LEFT = 0;
+ painter.drawPixmap(TOP, LEFT, *m_backgroundLeft);
+ painter.drawTiledPixmap(m_backgroundLeft->width(), TOP,
+ width() - m_backgroundLeft->width() - m_backgroundRight->width(),
+ height(),
+ *m_backgroundMiddle);
+ painter.drawPixmap(width() - m_backgroundRight->width(), TOP, *m_backgroundRight);
+}
+
+void ListItemContextButtonBar::setContextButtons(QWidget *contextButtons)
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ m_newContextButtons = contextButtons;
+ m_waitForOpen = false;
+
+ if (m_state != StateHidden)
+ hideContextButtonBar();
+ else
+ changeButtons();
+}
+
+void ListItemContextButtonBar::showContextButtonBar()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ if (m_contextButtons->layout()->count() > 0) {
+ m_state = StateOpening;
+ m_animation->setDirection(QAbstractAnimation::Forward);
+ m_animation->start();
+ }
+}
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ 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.
+*/
+
+#ifndef LISTITEMCONTEXTBUTTONBAR_H
+#define LISTITEMCONTEXTBUTTONBAR_H
+
+#include <QWidget>
+
+class QPropertyAnimation;
+
+/**
+ * @brief Button bar for list item relatex context buttons
+ *
+ * @author Sami Rämö - sami.ramo (at) ixonos.com
+ */
+class ListItemContextButtonBar : public QWidget
+{
+ Q_OBJECT
+public:
+ /**
+ * @brief Constructor
+ *
+ * @param parent Parent
+ */
+ explicit ListItemContextButtonBar(QWidget *parent = 0);
+
+ /**
+ * @brief Destructor
+ *
+ * Deletes images.
+ */
+ ~ListItemContextButtonBar();
+
+/*******************************************************************************
+ * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
+ ******************************************************************************/
+private:
+ /**
+ * @brief Paint the background of the item
+ *
+ * @param event Paint event
+ */
+ void paintEvent(QPaintEvent *event);
+
+/*******************************************************************************
+ * MEMBER FUNCTIONS AND SLOTS
+ ******************************************************************************/
+public:
+ /**
+ * @brief Start hiding animation
+ */
+ void hideContextButtonBar();
+
+ /**
+ * @brief Set new context buttons
+ *
+ * If bar is hidden, then changeButtons() is called. Otherwise pointer to new buttons is saved
+ * and hideContextButtonBar() is called.
+ *
+ * @param contextButtons Pointer to new context buttons
+ */
+ void setContextButtons(QWidget *contextButtons);
+
+ /**
+ * @brief Start showing animation
+ *
+ * Animation is started only if the bar contains buttons.
+ */
+ void showContextButtonBar();
+
+public slots:
+ /**
+ * @brief Shows and hides the bar when item selection is changed
+ *
+ * Calls showContextButtonBar() or hideContextButtonBar() if changing the state of the bar is
+ * required. If there is a pointer to new buttons, then request is remembered instead of
+ * changing the state immediately.
+ *
+ * @param itemIsSelected True is any item is selected
+ */
+ void onListItemSelectionChanged(bool itemIsSelected);
+
+private:
+ /**
+ * @brief Do the actual changing of the buttons
+ *
+ * Does also re-sizing and re-positioning of the bar and sets new values for animation.
+ */
+ void changeButtons();
+
+private slots:
+ /**
+ * @brief
+ *
+ * If bar was just hidden, then calls changeButtons() if there is a pointer to new buttons
+ * saved. If changing the buttons was done, then also checks if showing the bar was requested
+ * and calls showContextButtonBar() if needed.
+ */
+ void onAnimationFinished();
+
+/*******************************************************************************
+ * DATA MEMBERS
+ ******************************************************************************/
+private:
+ /**
+ * @brief States for the animation
+ *
+ * @enum AnimationState
+ */
+ enum AnimationState {
+ StateHidden,
+ StateOpening,
+ StateClosing,
+ StateVisible
+ };
+
+ bool m_waitForOpen; ///< Is showing requested while chaging buttons is not ready
+
+ QPixmap *m_backgroundLeft; ///< Background picture, left part
+ QPixmap *m_backgroundMiddle; ///< Background picture, center part
+ QPixmap *m_backgroundRight; ///< Background picture, right part
+
+ QPropertyAnimation *m_animation; ///< Sliding animation for show/hide
+
+ QWidget *m_contextButtons; ///< Widget for context buttons
+ QWidget *m_newContextButtons; ///< Temporary pointer for new context buttons
+
+ AnimationState m_state; ///< Current state of the animation
+};
+
+#endif // LISTITEMCONTEXTBUTTONBAR_H
SIGNAL(locationItemClicked(const GeoCoordinate&, const GeoCoordinate&)));
connect(m_locationListView, SIGNAL(listItemSelectionChanged()),
- this, SLOT(setRouteButtonDisabled()));
+ this, SLOT(onListItemSelectionChanged()));
QVBoxLayout *resultsListViewLayout = new QVBoxLayout;
resultsListViewLayout->setContentsMargins(PANEL_MARGIN_LEFT, PANEL_MARGIN_TOP,
panelLayout->addLayout(resultsListViewLayout);
// --- CONTEXT BUTTONS ---
- m_routeButton = new ImageButton(":res/images/compass.png", "", "", this);
- m_routeButton->setDisabled(true);
+ m_routeButton = new ImageButton(":res/images/routing.png", "", "", this);
connect(m_routeButton, SIGNAL(clicked()),
this, SLOT(routeToSelectedLocation()));
connect(m_clearLocationListButton, SIGNAL(clicked()),
this, SLOT(showSearchHistoryListView()));
- m_contextButtonLayout->addWidget(m_routeButton);
- m_contextButtonLayout->addWidget(searchLocationButton);
- m_contextButtonLayout->addWidget(m_clearLocationListButton);
+ m_itemButtonsLayout->addWidget(m_routeButton);
+ m_genericButtonsLayout->addWidget(searchLocationButton);
+ m_genericButtonsLayout->addWidget(m_clearLocationListButton);
readSettings();
showSearchHistoryListView();
m_locationListView->clearItemSelection();
m_searchHistoryListView->clearItemSelection();
-
- setRouteButtonDisabled();
}
void LocationSearchPanel::hideEvent(QHideEvent *event)
m_resultsLabel->setText(tr("Search results: %1").arg(count));
}
-void LocationSearchPanel::setRouteButtonDisabled()
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- m_routeButton->setDisabled(m_locationListView->selectedItems().isEmpty());
-}
-
void LocationSearchPanel::showLocationListView(int locationItemsCount)
{
qDebug() << __PRETTY_FUNCTION__;
*/
void routeToSelectedLocation();
- /**
- * @brief Sets route button disabled.
- *
- * Disabled if there isn't any list item selected.
- */
- void setRouteButtonDisabled();
-
/*******************************************************************************
* SIGNALS
******************************************************************************/
buildRoutingPanel();
m_tabbedPanel = new TabbedPanel(this);
-
+
//Save Situare related tab indexes so tabs can be enabled/disabled when logged in/out
m_situareTabsIndexes.append(
m_tabbedPanel->addTab(m_userInfoPanel, QIcon(":/res/images/user_info.png")));
connect(m_tabbedPanel, SIGNAL(currentChanged(int)),
m_userInfoPanel, SIGNAL(collapse()));
+
+ // signals for showing and hiding list item context buttons
+ connect(m_friendsListPanel, SIGNAL(listItemSelectionChanged(bool)),
+ m_tabbedPanel, SIGNAL(listItemSelectionChanged(bool)));
+
+ connect(m_locationSearchPanel, SIGNAL(listItemSelectionChanged(bool)),
+ m_tabbedPanel, SIGNAL(listItemSelectionChanged(bool)));
+
+ connect(m_routingPanel, SIGNAL(listItemSelectionChanged(bool)),
+ m_tabbedPanel, SIGNAL(listItemSelectionChanged(bool)));
}
void MainWindow::buildRoutingPanel()
Copyright (C) 2010 Ixonos Plc. Authors:
Pekka Nissinen - pekka.nissinen@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
*/
#include <QDebug>
+#include <QListWidget>
+#include <QResizeEvent>
#include <QVBoxLayout>
#include "panelbase.h"
{
qDebug() << __PRETTY_FUNCTION__;
+
+ // --- GENERIC BUTTONS ---
+ m_genericButtons = new QWidget;
+ m_genericButtonsLayout = new QVBoxLayout;
+
const int CONTEXT_BUTTON_MARGIN_LEFT = 2;
const int CONTEXT_BUTTON_MARGIN_TOP = 10;
const int CONTEXT_BUTTON_MARGIN_RIGHT = 0;
const int CONTEXT_BUTTON_MARGIN_BOTTOM = 0;
const int CONTEXT_BUTTON_SPACING = 0;
-
- m_contextButtons = new QWidget;
-
- m_contextButtonLayout = new QVBoxLayout;
- m_contextButtonLayout->setContentsMargins(CONTEXT_BUTTON_MARGIN_LEFT,
+ m_genericButtonsLayout->setContentsMargins(CONTEXT_BUTTON_MARGIN_LEFT,
CONTEXT_BUTTON_MARGIN_TOP,
CONTEXT_BUTTON_MARGIN_RIGHT,
CONTEXT_BUTTON_MARGIN_BOTTOM);
- m_contextButtonLayout->setSpacing(CONTEXT_BUTTON_SPACING);
+ m_genericButtonsLayout->setSpacing(CONTEXT_BUTTON_SPACING);
+
+ m_genericButtons->setLayout(m_genericButtonsLayout);
+
+ // --- ITEM RELATED BUTTONS ---
+ m_itemButtons = new QWidget(this);
+ m_itemButtonsLayout = new QHBoxLayout;
+
+ const int ITEM_CONTEXT_BUTTON_MARGIN_BOTTOM = 0;
+ const int ITEM_CONTEXT_BUTTON_MARGIN_LEFT = 2;
+ const int ITEM_CONTEXT_BUTTON_MARGIN_RIGHT = 2;
+ const int ITEM_CONTEXT_BUTTON_MARGIN_TOP = 2;
+ const int ITEM_CONTEXT_BUTTON_SPACING = 0;
+ m_itemButtonsLayout->setContentsMargins(ITEM_CONTEXT_BUTTON_MARGIN_LEFT,
+ ITEM_CONTEXT_BUTTON_MARGIN_TOP,
+ ITEM_CONTEXT_BUTTON_MARGIN_RIGHT,
+ ITEM_CONTEXT_BUTTON_MARGIN_BOTTOM);
+ m_itemButtonsLayout->setSpacing(ITEM_CONTEXT_BUTTON_SPACING);
+
+ m_itemButtons->setLayout(m_itemButtonsLayout);
+}
+
+QWidget* PanelBase::genericPanelButtons() const
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ return m_genericButtons;
+}
+
+QWidget* PanelBase::itemButtons() const
+{
+ qDebug() << __PRETTY_FUNCTION__;
- m_contextButtons->setLayout(m_contextButtonLayout);
+ return m_itemButtons;
}
-QWidget* PanelBase::contextButtons() const
+void PanelBase::onListItemSelectionChanged()
{
qDebug() << __PRETTY_FUNCTION__;
- return m_contextButtons;
+ QListWidget *listWidget = dynamic_cast<QListWidget *>(sender());
+ if (listWidget && (listWidget->selectedItems().count() > 0))
+ emit listItemSelectionChanged(true);
+ else
+ emit listItemSelectionChanged(false);
}
Copyright (C) 2010 Ixonos Plc. Authors:
Pekka Nissinen - pekka.nissinen@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
#include <QWidget>
+class QHBoxLayout;
+class QListWidgetItem;
class QVBoxLayout;
class ImageButton;
* @brief Base class for panels
*
* @author Pekka Nissinen - pekka.nissinen (at) ixonos.com
+ * @author Sami Rämö - sami.ramo (at) ixonos.com
*/
class PanelBase : public QWidget
{
******************************************************************************/
public:
/**
- * @brief Getter for the context buttons
+ * @brief Getter for the generic panel related context buttons
*
* @returns Pointer to context buttons widget
*/
- QWidget* contextButtons() const;
+ QWidget* genericPanelButtons() const;
+
+ /**
+ * @brief Getter for the list item related context buttons
+ *
+ * @returns Pointer to context buttons widget
+ */
+ QWidget* itemButtons() const;
+
+protected slots:
+ /**
+ * @brief Call when there is a change in list item selection
+ *
+ * Emits listItemSelectionChanged(bool). Parameter is true if any item is selected.
+ */
+ void onListItemSelectionChanged();
/*******************************************************************************
* SIGNALS
*/
void openPanelRequested(QWidget *widget);
+ /**
+ * @brief Emitted when there is a change in list item selection
+ *
+ * @param itemIsSelected True if any item is selected.
+ */
+ void listItemSelectionChanged(bool itemIsSelected);
+
/*******************************************************************************
* DATA MEMBERS
******************************************************************************/
protected:
- QVBoxLayout *m_contextButtonLayout; ///< Layout for context buttons
+ QVBoxLayout *m_genericButtonsLayout; ///< Layout for generic context buttons
+ QHBoxLayout *m_itemButtonsLayout; ///< Layout for item related context buttons
private:
- QWidget *m_contextButtons; ///< Widget for context buttons
+ QWidget *m_genericButtons; ///< Widget for generic context buttons
+ QWidget *m_itemButtons; ///< Widget for item related context buttons
};
#endif // PANELBASE_H
const int PANEL_BAR_WIDTH = 5; ///< Width of the slider bar
const int PANEL_TAB_BAR_WIDTH = 74; ///< Panel tab bar total width
const int PANEL_BAR_TABBED_WIDTH = PANEL_BAR_WIDTH + PANEL_TAB_BAR_WIDTH; ///< Width of the tabbed bar
-const int PANEL_WIDTH = 384; ///< Width of the panel
+const int PANEL_WIDTH = 384; ///< Width of the panel contents area
const int PANEL_HEIGHT = DEFAULT_SCREEN_HEIGHT - PANEL_TOP_PADDING
- PANEL_BOTTOM_PADDING; ///< Height of the panel
connect(m_routeWaypointListView, SIGNAL(routeWaypointItemClicked(GeoCoordinate)),
this, SIGNAL(routeWaypointItemClicked(GeoCoordinate)));
+ connect(m_routeWaypointListView, SIGNAL(listItemSelectionChanged()),
+ this, SLOT(onListItemSelectionChanged()));
+
QVBoxLayout *panelLayout = new QVBoxLayout;
panelLayout->setContentsMargins(PANEL_MARGIN_LEFT, PANEL_MARGIN_TOP,
PANEL_MARGIN_RIGHT, PANEL_MARGIN_BOTTOM);
this, SLOT(clearRouteButtonClicked()));
m_clearRouteButton->setDisabled(true);
- m_contextButtonLayout->addWidget(routeToCursorButton);
- m_contextButtonLayout->addWidget(m_clearRouteButton);
+ m_genericButtonsLayout->addWidget(routeToCursorButton);
+ m_genericButtonsLayout->addWidget(m_clearRouteButton);
}
void RoutingPanel::clearListsSelections()
#include <QStackedWidget>
#include <QStateMachine>
+#include "listitemcontextbuttonbar.h"
#include "panelbar.h"
#include "panelbase.h"
#include "panelcontentstack.h"
m_panelBar = new PanelBar(this);
m_panelBar->move(PANEL_TAB_BAR_WIDTH, PANEL_TOP_Y);
- // --- CONTEXT BUTTON BAR ---
+ // --- GENERIC PANEL CONTEXT BUTTON BAR ---
m_panelContextButtonBar = new PanelContextButtonBar(this);
m_panelContextButtonBar->move(PANEL_CONTEXT_BUTTON_BAR_LEFT_X, PANEL_HEIGHT);
connect(m_panelContextButtonBar, SIGNAL(positionChangeRequested()),
this, SLOT(repositionContextButtonBar()));
+ // --- LIST ITEM RELATED CONTEXT BUTTONS BAR ---
+ m_itemContextButtonBar = new ListItemContextButtonBar(this);
+ m_itemContextButtonBar->hide();
+
+ connect(this, SIGNAL(listItemSelectionChanged(bool)),
+ m_itemContextButtonBar, SLOT(onListItemSelectionChanged(bool)));
+
// --- PANEL CONTENT ---
m_panelContentStack = new PanelContentStack(this);
m_panelContentStack->move(PANEL_TAB_BAR_WIDTH + PANEL_BAR_WIDTH, PANEL_TOP_Y);
+ m_panelContentStack->stackUnder(m_itemContextButtonBar);
// --- PANEL ANIMATION ---
QStateMachine *panelStateMachine = new QStateMachine(this);
qDebug() << __PRETTY_FUNCTION__;
m_panelContextButtonBar->move(PANEL_CONTEXT_BUTTON_BAR_LEFT_X, height());
-
+
calculateMask();
}
openPanel();
m_panelContextButtonBar->setContextButtons(
- static_cast<PanelBase *>(m_panelContentStack->widget(index))->contextButtons());
+ static_cast<PanelBase *>(m_panelContentStack->widget(index))->genericPanelButtons());
+
+ QWidget *itemContextButtons = static_cast<PanelBase *>(m_panelContentStack->widget(index))->itemButtons();
+ m_itemContextButtonBar->setContextButtons(itemContextButtons);
emit currentChanged(index);
}
class QState;
class QStateMachine;
+class ListItemContextButtonBar;
class PanelBar;
class PanelContentStack;
class PanelContextButtonBar;
void currentChanged(int index);
/**
+ * @brief Emitted when there is a change in list item selection
+ *
+ * @param itemIsSelected True if any item is selected.
+ */
+ void listItemSelectionChanged(bool itemIsSelected);
+
+ /**
* @brief Signal that is sent when panel is closed
*
* @sa openPanel
QState *m_stateClosed; ///< State of the closed panel
QState *m_stateOpened; ///< State of the opened panel
+ ListItemContextButtonBar *m_itemContextButtonBar; ///< Widget for list item context button bar
PanelBar *m_panelBar; ///< Widget for panel bar
PanelContentStack *m_panelContentStack; ///< Stack for panel widgets
PanelContextButtonBar * m_panelContextButtonBar; ///< Widget for panel context button bar
":/res/images/send_position_s.png",
"", this);
- m_contextButtonLayout->addWidget(updateFriendsButton);
- m_contextButtonLayout->addWidget(updateStatusMessageButton);
+ m_genericButtonsLayout->addWidget(updateFriendsButton);
+ m_genericButtonsLayout->addWidget(updateStatusMessageButton);
connect(updateFriendsButton, SIGNAL(clicked()),
this, SIGNAL(refreshUserData()));
../../../src/ui/panelcontentstack.cpp \
../../../src/ui/panelcontextbuttonbar.cpp \
../../../src/ui/paneltab.cpp \
- ../../../src/ui/paneltabbar.cpp
+ ../../../src/ui/paneltabbar.cpp \
+ ../../../src/ui/listitemcontextbuttonbar.cpp
HEADERS += \
../../../src/ui/tabbedpanel.h \
../../../src/ui/panelbar.h \
../../../src/ui/panelcontextbuttonbar.h \
../../../src/ui/paneltab.h \
../../../src/ui/paneltabbar.h \
- ../../../src/ui/panelcommon.h
+ ../../../src/ui/panelcommon.h \
+ ../../../src/ui/listitemcontextbuttonbar.h
RESOURCES += ../../../images.qrc
DEFINES += QT_NO_DEBUG_OUTPUT