From 36f5e82e67e2658f1ae40113ad2362324c4ff485 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sami=20R=C3=A4m=C3=B6?= Date: Fri, 3 Sep 2010 11:14:24 +0300 Subject: [PATCH] Removed disabled button states, don't open panel without buttons - Removed disabled states from item related context buttons - ListItemContextButtonBar is not opened if it does not contain buttons --- src/ui/friendlistpanel.cpp | 13 ------------- src/ui/friendlistpanel.h | 7 ------- src/ui/listitemcontextbuttonbar.cpp | 9 ++++++--- src/ui/locationsearchpanel.cpp | 15 +-------------- src/ui/locationsearchpanel.h | 7 ------- 5 files changed, 7 insertions(+), 44 deletions(-) diff --git a/src/ui/friendlistpanel.cpp b/src/ui/friendlistpanel.cpp index 5e461e5..3827746 100644 --- a/src/ui/friendlistpanel.cpp +++ b/src/ui/friendlistpanel.cpp @@ -83,9 +83,6 @@ FriendListPanel::FriendListPanel(QWidget *parent) this, SIGNAL(findFriend(GeoCoordinate))); connect(m_friendListView, SIGNAL(listItemSelectionChanged()), - this, SLOT(setRouteButtonDisabled())); - - connect(m_friendListView, SIGNAL(listItemSelectionChanged()), this, SLOT(onListItemSelectionChanged())); // --- FOOTER, TEXT BASED FILTERING --- @@ -124,7 +121,6 @@ FriendListPanel::FriendListPanel(QWidget *parent) 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())); @@ -150,7 +146,6 @@ void FriendListPanel::anyPanelClosed() clearFiltering(); m_friendListView->clearItemSelection(); - setRouteButtonDisabled(); } void FriendListPanel::anyPanelOpened() @@ -239,7 +234,6 @@ void FriendListPanel::hideEvent(QHideEvent *event) clearFiltering(); m_friendListView->clearItemSelection(); - setRouteButtonDisabled(); } void FriendListPanel::routeToSelectedFriend() @@ -273,13 +267,6 @@ void FriendListPanel::updateKeyboardGrabbing() } } -void FriendListPanel::setRouteButtonDisabled() -{ - qDebug() << __PRETTY_FUNCTION__; - - m_routeButton->setDisabled(m_friendListView->selectedItems().isEmpty()); -} - void FriendListPanel::showEvent(QShowEvent *event) { qDebug() << __PRETTY_FUNCTION__; diff --git a/src/ui/friendlistpanel.h b/src/ui/friendlistpanel.h index a781517..6a2723e 100644 --- a/src/ui/friendlistpanel.h +++ b/src/ui/friendlistpanel.h @@ -169,13 +169,6 @@ private slots: 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 diff --git a/src/ui/listitemcontextbuttonbar.cpp b/src/ui/listitemcontextbuttonbar.cpp index 3d5791e..d7b6551 100644 --- a/src/ui/listitemcontextbuttonbar.cpp +++ b/src/ui/listitemcontextbuttonbar.cpp @@ -20,6 +20,7 @@ */ #include +#include #include #include #include @@ -178,7 +179,9 @@ void ListItemContextButtonBar::showContextButtonBar() { qDebug() << __PRETTY_FUNCTION__; - m_state = StateOpening; - m_animation->setDirection(QAbstractAnimation::Forward); - m_animation->start(); + if (m_contextButtons->layout()->count() > 0) { + m_state = StateOpening; + m_animation->setDirection(QAbstractAnimation::Forward); + m_animation->start(); + } } diff --git a/src/ui/locationsearchpanel.cpp b/src/ui/locationsearchpanel.cpp index b765744..c0d53a8 100644 --- a/src/ui/locationsearchpanel.cpp +++ b/src/ui/locationsearchpanel.cpp @@ -60,9 +60,6 @@ LocationSearchPanel::LocationSearchPanel(QWidget *parent) SIGNAL(locationItemClicked(const GeoCoordinate&, const GeoCoordinate&))); connect(m_locationListView, SIGNAL(listItemSelectionChanged()), - this, SLOT(setRouteButtonDisabled())); - - connect(m_locationListView, SIGNAL(listItemSelectionChanged()), this, SLOT(onListItemSelectionChanged())); QVBoxLayout *resultsListViewLayout = new QVBoxLayout; @@ -83,8 +80,7 @@ LocationSearchPanel::LocationSearchPanel(QWidget *parent) 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())); @@ -102,8 +98,6 @@ void LocationSearchPanel::clearListsSelections() qDebug() << __PRETTY_FUNCTION__; m_locationListView->clearItemSelection(); - - setRouteButtonDisabled(); } void LocationSearchPanel::hideEvent(QHideEvent *event) @@ -159,10 +153,3 @@ void LocationSearchPanel::setHeaderText(int count) m_resultsLabel->setText(tr("Search results: %1").arg(count)); } - -void LocationSearchPanel::setRouteButtonDisabled() -{ - qDebug() << __PRETTY_FUNCTION__; - - m_routeButton->setDisabled(m_locationListView->selectedItems().isEmpty()); -} diff --git a/src/ui/locationsearchpanel.h b/src/ui/locationsearchpanel.h index fd87bf2..98b978d 100644 --- a/src/ui/locationsearchpanel.h +++ b/src/ui/locationsearchpanel.h @@ -97,13 +97,6 @@ private slots: */ void routeToSelectedLocation(); - /** - * @brief Sets route button disabled. - * - * Disabled if there isn't any list item selected. - */ - void setRouteButtonDisabled(); - /******************************************************************************* * SIGNALS ******************************************************************************/ -- 1.7.9.5