connect(m_friendListView, SIGNAL(listItemSelectionChanged()),
this, SLOT(setRouteButtonDisabled()));
+ connect(m_friendListView, SIGNAL(listItemSelectionChanged()),
+ this, SLOT(onListItemSelectionChanged()));
+
// --- FOOTER, TEXT BASED FILTERING ---
QHBoxLayout *footerLayout = new QHBoxLayout();
connect(m_clearGroupFilteringButton, SIGNAL(clicked()),
this, SLOT(clearFiltering()));
- m_contextButtonLayout->addWidget(m_routeButton);
- m_contextButtonLayout->addWidget(m_clearGroupFilteringButton);
+ m_itemButtonsLayout->addWidget(m_routeButton);
+ m_genericButtonsLayout->addWidget(m_clearGroupFilteringButton);
}
void FriendListPanel::anyPanelClosed()
connect(m_locationListView, SIGNAL(listItemSelectionChanged()),
this, SLOT(setRouteButtonDisabled()));
+ connect(m_locationListView, SIGNAL(listItemSelectionChanged()),
+ this, SLOT(onListItemSelectionChanged()));
+
QVBoxLayout *resultsListViewLayout = new QVBoxLayout;
resultsListViewLayout->setContentsMargins(PANEL_MARGIN_LEFT, PANEL_MARGIN_TOP,
PANEL_MARGIN_RIGHT, PANEL_MARGIN_BOTTOM);
connect(searchLocationButton, SIGNAL(clicked()),
this, SIGNAL(requestSearchLocation()));
- m_contextButtonLayout->addWidget(m_routeButton);
- m_contextButtonLayout->addWidget(searchLocationButton);
+ m_itemButtonsLayout->addWidget(m_routeButton);
+ m_genericButtonsLayout->addWidget(searchLocationButton);
}
void LocationSearchPanel::clearListsSelections()
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"
const int CONTEXT_BUTTON_MARGIN_BOTTOM = 0;
const int CONTEXT_BUTTON_SPACING = 0;
- m_contextButtons = new QWidget;
+ // --- GENERIC BUTTONS ---
+ m_genericButtons = new QWidget;
- m_contextButtonLayout = new QVBoxLayout;
- m_contextButtonLayout->setContentsMargins(CONTEXT_BUTTON_MARGIN_LEFT,
+ m_genericButtonsLayout = new QVBoxLayout;
+ 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_contextButtons->setLayout(m_contextButtonLayout);
+ m_genericButtons->setLayout(m_genericButtonsLayout);
+
+ // --- ITEM RELATED BUTTONS ---
+ m_itemButtons = new QWidget(this);
+ m_itemButtonsLayout = new QHBoxLayout;
+ /// @todo set margins
+ m_itemButtons->setLayout(m_itemButtonsLayout);
+ m_itemButtons->hide();
+}
+
+QWidget* PanelBase::genericPanelButtons() const
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ return m_genericButtons;
+}
+
+void PanelBase::onListItemSelectionChanged()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ QListWidget *listWidget = dynamic_cast<QListWidget *>(sender());
+ if (listWidget && (listWidget->selectedItems().count() > 0))
+ m_itemButtons->show();
+ else
+ m_itemButtons->hide();
}
-QWidget* PanelBase::contextButtons() const
+void PanelBase::resizeEvent(QResizeEvent *event)
{
qDebug() << __PRETTY_FUNCTION__;
- return m_contextButtons;
+ int x = event->size().width() / 2 - m_itemButtons->width() / 2;
+ const int Y = 0;
+ m_itemButtons->move(x, Y);
}
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
{
*/
PanelBase(QWidget *parent = 0);
+protected:
+ void resizeEvent(QResizeEvent *event);
+
/*******************************************************************************
* MEMBER FUNCTIONS AND SLOTS
******************************************************************************/
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;
+
+protected slots:
+ void onListItemSelectionChanged();
/*******************************************************************************
* SIGNALS
* 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
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()
openPanel();
m_panelContextButtonBar->setContextButtons(
- static_cast<PanelBase *>(m_panelContentStack->widget(index))->contextButtons());
+ static_cast<PanelBase *>(m_panelContentStack->widget(index))->genericPanelButtons());
emit currentChanged(index);
}
":/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()));