Added images for search location button and implemented a temporary slot for repositi...
authorPekka Nissinen <pekka.nissinen@ixonos.com>
Thu, 19 Aug 2010 11:08:06 +0000 (14:08 +0300)
committerPekka Nissinen <pekka.nissinen@ixonos.com>
Thu, 19 Aug 2010 11:08:06 +0000 (14:08 +0300)
images.qrc
res/images/search.png [new file with mode: 0644]
res/images/search_s.png [new file with mode: 0644]
res/images/show_position.png [deleted file]
res/images/show_position_s.png [deleted file]
src/ui/tabbedpanel.cpp
src/ui/tabbedpanel.h

index 807345e..94b955f 100644 (file)
         <file>res/images/rocket_icon_gray.png</file>
         <file>res/images/routing.png</file>
         <file>res/images/ruler.png</file>
+        <file>res/images/search.png</file>
+        <file>res/images/search_s.png</file>
         <file>res/images/send_position.png</file>
         <file>res/images/send_position_s.png</file>
-        <file>res/images/show_position.png</file>
-        <file>res/images/show_position_s.png</file>
         <file>res/images/sight.png</file>
         <file>res/images/tab_active.png</file>
         <file>res/images/tab_inactive.png</file>
diff --git a/res/images/search.png b/res/images/search.png
new file mode 100644 (file)
index 0000000..e6f330f
Binary files /dev/null and b/res/images/search.png differ
diff --git a/res/images/search_s.png b/res/images/search_s.png
new file mode 100644 (file)
index 0000000..e571dff
Binary files /dev/null and b/res/images/search_s.png differ
diff --git a/res/images/show_position.png b/res/images/show_position.png
deleted file mode 100755 (executable)
index fcc4dcf..0000000
Binary files a/res/images/show_position.png and /dev/null differ
diff --git a/res/images/show_position_s.png b/res/images/show_position_s.png
deleted file mode 100755 (executable)
index 96a99f8..0000000
Binary files a/res/images/show_position_s.png and /dev/null differ
index 9bdd962..1292de3 100644 (file)
 #include <QStateMachine>
 
 #include "panelbar.h"
+#include "panelbase.h"
 #include "panelcontentstack.h"
 #include "panelcontextbuttonbar.h"
 #include "paneltabbar.h"
 
 #include "tabbedpanel.h"
 
+const int PANEL_CONTEXT_BUTTON_BAR_LEFT_X = 0;
+
 TabbedPanel::TabbedPanel(QWidget *parent)
     : QWidget(parent),
       m_isOpen(false)
@@ -41,14 +44,14 @@ TabbedPanel::TabbedPanel(QWidget *parent)
 
     const int PANEL_LEFT_X = 0;
     const int PANEL_TOP_Y = 0;
-    const int TAB_BAR_TOP_SPACING = 8;
+    const int PANEL_TAB_BAR_TOP_SPACING = 8;
 
     resize(PANEL_BAR_TABBED_WIDTH + PANEL_WIDTH, PANEL_HEIGHT);
     move(PANEL_CLOSED_X, PANEL_TOP_PADDING);
 
     // --- TABS ---
     m_panelTabBar = new PanelTabBar(this);
-    m_panelTabBar->move(PANEL_LEFT_X, TAB_BAR_TOP_SPACING);
+    m_panelTabBar->move(PANEL_LEFT_X, PANEL_TAB_BAR_TOP_SPACING);
 
     connect(m_panelTabBar, SIGNAL(currentChanged(int)),
             this, SLOT(setCurrentIndex(int)));
@@ -65,7 +68,18 @@ TabbedPanel::TabbedPanel(QWidget *parent)
 
     // --- CONTEXT BUTTON BAR ---
     m_panelContextButtonBar = new PanelContextButtonBar(this);
-    m_panelContextButtonBar->move(1, 300);
+    m_panelContextButtonBar->setVisible(false);
+    m_panelContextButtonBar->move(PANEL_CONTEXT_BUTTON_BAR_LEFT_X,
+                                  PANEL_HEIGHT - m_panelContextButtonBar->height());
+
+    connect(m_panelContextButtonBar, SIGNAL(positionChangeRequested()),
+            this, SLOT(repositionContextButtonBar()));
+
+    connect(this, SIGNAL(panelOpened()),
+            this, SLOT(showContextButtonBar()));
+
+    connect(this, SIGNAL(panelClosed()),
+            this, SLOT(hideContextButtonBar()));
 
     // --- PANEL CONTENT ---
     m_panelContentStack = new PanelContentStack(this);
@@ -137,6 +151,14 @@ void TabbedPanel::removeTab(int index)
     }
 }
 
+void TabbedPanel::repositionContextButtonBar()
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    m_panelContextButtonBar->move(PANEL_CONTEXT_BUTTON_BAR_LEFT_X,
+                                  height() - m_panelContextButtonBar->height());
+}
+
 void TabbedPanel::resizePanel(const QSize &size)
 {
     qDebug() << __PRETTY_FUNCTION__;
@@ -151,6 +173,9 @@ void TabbedPanel::resizePanel(const QSize &size)
 
     m_panelBar->resizeBar(size);
 
+    m_panelContextButtonBar->move(PANEL_CONTEXT_BUTTON_BAR_LEFT_X,
+                                  size.height() - m_panelContextButtonBar->height());
+
     m_panelContentStack->resizeContentStack(size);
 
     QPoint closedPosition(size.width() - PANEL_TAB_WIDTH - PANEL_BAR_WIDTH, PANEL_TOP_PADDING);
@@ -161,13 +186,6 @@ void TabbedPanel::resizePanel(const QSize &size)
     m_panelStateOpened->assignProperty(this, "pos", openedPosition);
 }
 
-void TabbedPanel::showPanel(QWidget *widget)
-{
-    qDebug() << __PRETTY_FUNCTION__;
-
-    m_panelTabBar->selectTab(m_panelContentStack->indexOf(widget));
-}
-
 void TabbedPanel::setCurrentIndex(int index)
 {
     qDebug() << __PRETTY_FUNCTION__;
@@ -178,19 +196,31 @@ void TabbedPanel::setCurrentIndex(int index)
         if (!m_isOpen)
             emit toggleState();
 
+        m_panelContextButtonBar->setContextButtons(
+                static_cast<PanelBase *>(m_panelContentStack->widget(index))->contextButtons());
+
         emit currentChanged(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;
+        m_panelContextButtonBar->setVisible(true);
         emit panelOpened();
     } else {
         m_isOpen = false;
+        m_panelContextButtonBar->setVisible(false);
         emit panelClosed();
     }
 }
index 52c3cfb..58dbb17 100644 (file)
@@ -117,6 +117,11 @@ public slots:
 
 private slots:
     /**
+     * @brief Repositions context button bar
+     */
+    void repositionContextButtonBar();
+
+    /**
      * @brief Sets the panel at current index active
      *
      * @param index Index of the panel