From e17862b5b8b33380648f6f5117065b57bd470228 Mon Sep 17 00:00:00 2001 From: Pekka Nissinen Date: Sun, 29 Aug 2010 22:35:02 +0300 Subject: [PATCH] Changed the names of panel opening slots and signals into "more" appropriate ones --- src/ui/friendlistpanel.cpp | 2 +- src/ui/mainwindow.cpp | 8 ++++---- src/ui/panelbase.h | 2 +- src/ui/tabbedpanel.cpp | 28 ++++++++++++++-------------- src/ui/tabbedpanel.h | 12 +++++++----- 5 files changed, 27 insertions(+), 25 deletions(-) diff --git a/src/ui/friendlistpanel.cpp b/src/ui/friendlistpanel.cpp index 4b62e3f..9c1b6c9 100644 --- a/src/ui/friendlistpanel.cpp +++ b/src/ui/friendlistpanel.cpp @@ -297,7 +297,7 @@ void FriendListPanel::showFriendsInList(const QList &userIDs) clearTextFiltering(); - emit showPanelRequested(this); + emit openPanelRequested(this); } void FriendListPanel::topmostWindowChanged(bool mainWindowIsTopmost) diff --git a/src/ui/mainwindow.cpp b/src/ui/mainwindow.cpp index 576c238..0d4c574 100644 --- a/src/ui/mainwindow.cpp +++ b/src/ui/mainwindow.cpp @@ -331,11 +331,11 @@ void MainWindow::buildPanels() connect(m_mapView, SIGNAL(viewResized(QSize)), m_tabbedPanel, SLOT(resizePanel(QSize))); - connect(m_friendsListPanel, SIGNAL(showPanelRequested(QWidget*)), - m_tabbedPanel, SLOT(showPanel(QWidget*))); + connect(m_friendsListPanel, SIGNAL(openPanelRequested(QWidget*)), + m_tabbedPanel, SLOT(openPanel(QWidget*))); - connect(m_routingPanel, SIGNAL(showPanelRequested(QWidget*)), - m_tabbedPanel, SLOT(showPanel(QWidget*))); + connect(m_routingPanel, SIGNAL(openPanelRequested(QWidget*)), + m_tabbedPanel, SLOT(openPanel(QWidget*))); connect(m_tabbedPanel, SIGNAL(panelClosed()), m_friendsListPanel, SLOT(anyPanelClosed())); diff --git a/src/ui/panelbase.h b/src/ui/panelbase.h index deeaa08..c226f57 100644 --- a/src/ui/panelbase.h +++ b/src/ui/panelbase.h @@ -65,7 +65,7 @@ signals: * * @param widget Pointer to the widget that emitted the signal */ - void showPanelRequested(QWidget *widget); + void openPanelRequested(QWidget *widget); /******************************************************************************* * DATA MEMBERS diff --git a/src/ui/tabbedpanel.cpp b/src/ui/tabbedpanel.cpp index 11afa8d..2c69d38 100644 --- a/src/ui/tabbedpanel.cpp +++ b/src/ui/tabbedpanel.cpp @@ -38,7 +38,7 @@ const int PANEL_CONTEXT_BUTTON_BAR_LEFT_X = 1; TabbedPanel::TabbedPanel(QWidget *parent) : QWidget(parent), - m_isOpen(false) + m_open(false) { qDebug() << __PRETTY_FUNCTION__; @@ -121,7 +121,7 @@ void TabbedPanel::closePanel() { qDebug() << __PRETTY_FUNCTION__; - if (m_isOpen) + if (m_open) emit toggleState(); } @@ -135,6 +135,13 @@ int TabbedPanel::insertTab(int index, QWidget *widget, const QIcon& icon) return index; } +void TabbedPanel::openPanel(QWidget *widget) +{ + qDebug() << __PRETTY_FUNCTION__; + + m_panelTabBar->selectTab(m_panelContentStack->indexOf(widget)); +} + void TabbedPanel::removeTab(int index) { qDebug() << __PRETTY_FUNCTION__; @@ -160,7 +167,7 @@ void TabbedPanel::resizePanel(const QSize &size) resize(PANEL_BAR_TABBED_WIDTH + PANEL_WIDTH, size.height() - PANEL_TOP_PADDING - PANEL_BOTTOM_PADDING); - if (!m_isOpen) + if (!m_open) move(size.width() - PANEL_TAB_WIDTH - PANEL_BAR_WIDTH, PANEL_TOP_PADDING); else move(size.width() - PANEL_TAB_WIDTH - PANEL_BAR_WIDTH - PANEL_WIDTH, PANEL_TOP_PADDING); @@ -187,7 +194,7 @@ void TabbedPanel::setCurrentIndex(int index) if ((index < m_panelContentStack->count()) && (index >= 0)) { m_panelContentStack->setCurrentIndex(index); - if (!m_isOpen) + if (!m_open) emit toggleState(); m_panelContextButtonBar->setContextButtons( @@ -197,23 +204,16 @@ void TabbedPanel::setCurrentIndex(int index) } } -void TabbedPanel::showPanel(QWidget *widget) -{ - qDebug() << __PRETTY_FUNCTION__; - - m_panelTabBar->selectTab(m_panelContentStack->indexOf(widget)); -} - void TabbedPanel::stateChanged() { qDebug() << __PRETTY_FUNCTION__; - if (!m_isOpen) { - m_isOpen = true; + if (!m_open) { + m_open = true; m_panelContextButtonBar->setVisible(true); emit panelOpened(); } else { - m_isOpen = false; + m_open = false; m_panelContextButtonBar->setVisible(false); emit panelClosed(); } diff --git a/src/ui/tabbedpanel.h b/src/ui/tabbedpanel.h index 58dbb17..aaeb990 100644 --- a/src/ui/tabbedpanel.h +++ b/src/ui/tabbedpanel.h @@ -102,11 +102,13 @@ public slots: void closePanel(); /** - * @brief Slot that shows the tab (and opens it if closed) with the desired widget + * @brief Slot that opens the panel + * + * If widget pointer is provided the corresponding tab is also set active * * @param widget Widget */ - void showPanel(QWidget *widget); + void openPanel(QWidget *widget = 0); /** * @brief Slot to redraw the panel after window resize event @@ -129,7 +131,7 @@ private slots: void setCurrentIndex(int index); /** - * @brief Internal slot used to track statemachine state + * @brief Internal slot used to set the panel state */ void stateChanged(); @@ -161,7 +163,7 @@ signals: void panelOpened(); /** - * @brief Signal that is sent to state machine when panel state must be changed + * @brief Signal that is sent when the panel state must be changed * * @sa openPanel * @sa closePanel @@ -172,7 +174,7 @@ signals: * DATA MEMBERS ******************************************************************************/ private: - bool m_isOpen; ///< Boolean used to track the current state of the statemachine + bool m_open; ///< Current state of the panel QPropertyAnimation *m_panelAnimation; ///< Animation for panel state changes -- 1.7.9.5