Reviewed new files
authorSami Rämö <sami.ramo@ixonos.com>
Mon, 16 Aug 2010 08:41:17 +0000 (11:41 +0300)
committerSami Rämö <sami.ramo@ixonos.com>
Mon, 16 Aug 2010 08:41:17 +0000 (11:41 +0300)
 - Reviewed by Sami Rämö

src/ui/indicatorbuttonpanel.cpp
src/ui/panelbar.cpp
src/ui/panelbar.h
src/ui/panelbase.h
src/ui/panelcontent.cpp
src/ui/panelcontent.h
src/ui/paneltab.cpp
src/ui/paneltab.h
src/ui/tabbedpanel.cpp
src/ui/tabbedpanel.h
tests/ui/tabbedpanel/testtabbedpanel.cpp

index 55b53a5..10346f8 100644 (file)
@@ -296,8 +296,7 @@ void IndicatorButtonPanel::updateValues(qreal direction, qreal distance, bool dr
 
     m_distance = distance;
 
-    if (m_distance < MIN_TO_METERS)
-    {
+    if (m_distance < MIN_TO_METERS) {
         m_distanceText.setNum(10);
         m_distanceText.prepend("< ");
         m_distanceText.append(UNIT_METER);
index 48955c3..9a426b1 100644 (file)
@@ -28,6 +28,8 @@
 
 #include "panelcommon.h"
 
+///< @todo requires clean-up
+
 PanelBar::PanelBar(QWidget *parent) //, Side side)
     : QWidget(parent)
 {
@@ -51,6 +53,7 @@ void PanelBar::paintEvent(QPaintEvent *)
     QPainter painter(this);
 
     painter.drawTiledPixmap(m_barRect, m_barTile);
+    ///< @todo magic
     painter.drawTiledPixmap(0, 0, PANEL_BAR_WIDTH, m_menuDropShadowTile.height(),
                             m_menuDropShadowTile);
 }
@@ -59,6 +62,7 @@ void PanelBar::resizeBar(const QSize &size)
 {
     qDebug() << __PRETTY_FUNCTION__;
 
+    ///< @todo magic
     m_barRect.setRect(0, 0, PANEL_BAR_WIDTH, size.height());
 
 //    m_sliderRegion = QRegion(m_buttonRect).united(QRegion(m_topRect).united(QRegion(m_bottomRect)));
index b1a384b..8520e51 100644 (file)
 
 #include <QWidget>
 
+///< @todo Comment does not tell what this class is actually for (=draws the vertical line between panel contents and tab buttons)
 /**
  * @brief Generic class for panel bars
  *
  * @author Kaj Wallin - kaj.wallin (at) ixonos.com
  * @author Pekka Nissinen - pekka.nissinen@ixonos.com
- *
- * @class PanelBar panelbar.h "ui/panelbar.h"
  */
 class PanelBar : public QWidget
 {
@@ -49,6 +48,7 @@ public:
  * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
  ******************************************************************************/
 protected:
+    ///< @todo parameter name missing (also in .cpp)
     /**
      * @brief Draws the bar
      *
@@ -75,7 +75,5 @@ private:
     QPixmap m_barTile;              ///< Pixmap for panel bar
 
     QRect m_barRect;                ///< Rect for the panel bar
-
-//    QRegion m_sliderRegion;             ///< Region of the slider bar
 };
 #endif // PANELBAR_H
index efea05b..b75a7ab 100644 (file)
 #include <QPixmap>
 #include <QWidget>
 
+///< @todo Base class? Might be misleading comment and does not tell about what this class does
+///< @todo Why not directly inheriting QStackedWidget?
 /**
  * @brief Base class for panel inner content
  *
  * @author Pekka Nissinen - pekka.nissinen@ixonos.com
- *
- * @class PanelBase panelbase.h "ui/panelbase.h"
  */
 class PanelBase : public QWidget
 {
@@ -49,6 +49,7 @@ public:
  * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
  ******************************************************************************/
 protected:
+    ///< @todo parameter name (also in .cpp)
     /**
      * @brief Draws the panel content base
      *
index eb1753c..b8d320b 100644 (file)
@@ -24,8 +24,8 @@
 #include <QDebug>
 #include <QVBoxLayout>
 
-#include "panelcommon.h"
 #include "panelbase.h"
+#include "panelcommon.h"
 
 #include "panelcontent.h"
 
index 608d8ab..839f64a 100644 (file)
@@ -29,13 +29,12 @@ class QVBoxLayout;
 
 class PanelBase;
 
+///< @todo Base class? Might be misleading comment and does not tell about what this class does
 /**
  * @brief Base class for panel content area
  *
  * @author Kaj Wallin - kaj.wallin (at) ixonos.com
  * @author Pekka Nissinen - pekka.nissinen@ixonos.com
- *
- * @class PanelContent panelcontent.h "ui/panelcontent.h"
  */
 class PanelContent : public QWidget
 {
index 8db62d8..bb5ab31 100644 (file)
@@ -26,6 +26,7 @@
 
 #include "paneltab.h"
 
+///< @todo TAB_WIDTH not global? move into paintEvent()
 const int TAB_WIDTH = 66;
 const int TAB_WIDTH_ACTIVE = 74;
 const int TAB_HEIGHT = 66;
@@ -37,6 +38,7 @@ PanelTab::PanelTab(QWidget *parent)
 {
     qDebug() << __PRETTY_FUNCTION__;
 
+    ///< @todo magic, use enum, check also .h todo comment, fix everywhere
     m_tabPixmaps[0].load(":/res/images/tab_inactive.png");
     m_tabPixmaps[1].load(":/res/images/tab_inactive2.png");
     m_tabPixmaps[2].load(":/res/images/tab_active.png");
@@ -74,6 +76,8 @@ void PanelTab::mouseReleaseEvent(QMouseEvent *event)
 {
     qDebug() << __PRETTY_FUNCTION__;
 
+    ///< @todo mouse button is not checked, add check here or remove from mousePressEvent
+
     if(this->rect().contains(event->pos())) {
         click();
 
@@ -112,6 +116,7 @@ void PanelTab::paintEvent(QPaintEvent *)
         icon().paint(&painter, m_tabRect, Qt::AlignCenter, QIcon::Disabled);
 }
 
+///< @todo setActive() method is not used
 void PanelTab::setActive(bool state)
 {
     qDebug() << __PRETTY_FUNCTION__;
index 30aa857..fe0c7f4 100644 (file)
@@ -26,6 +26,7 @@
 
 class QMouseEvent;
 
+///< @todo Many missing comments
 class PanelTab : public QToolButton
 {
     Q_OBJECT
@@ -83,6 +84,7 @@ private:
     bool m_tabActive;
     bool m_tabSelected;
 
+    ///< @todo magic, replace with enum?
     QPixmap m_tabPixmaps[3];
 
     QRect m_tabRect;
index ec2aff2..a35d9aa 100644 (file)
 TabbedPanel::TabbedPanel(QWidget *parent)
     : QWidget(parent),
       m_isOpen(false),
-      m_activeTab(-1)
+      m_activeTab(-1) ///< @todo magic
 {
     qDebug() << __PRETTY_FUNCTION__;
 
+    ///< @todo Do not use this, REMOVE ALL OCCURENCES!
     this->resize(PANEL_BAR_TABBED_WIDTH + PANEL_WIDTH, PANEL_HEIGHT);
     this->move(PANEL_CLOSED_X, PANEL_TOP_PADDING);
 
@@ -94,6 +95,7 @@ int TabbedPanel::addTab(QWidget *widget, const QIcon& icon)
 {
     qDebug() << __PRETTY_FUNCTION__;
 
+    ///< @todo magic
     return insertTab(-1, widget, icon);
 }
 
@@ -101,16 +103,18 @@ int TabbedPanel::insertTab(int index, QWidget *widget, const QIcon& icon)
 {
     qDebug() << __PRETTY_FUNCTION__;
 
+    ///< @todo callers responsibility to call with right parameters
     if(!widget)
         return -1;
 
+    ///< @todo magic
     int verticalStartPoint = 8;
 
     index = m_panelWidgetStack->insertWidget(index, widget);
     m_tabButtonGroup->addButton(new PanelTab(this), index);
     m_tabButtonGroup->button(index)->setIcon(icon);
 
-    // [BEGIN]: Purkkaa (to be removed ASAP!!!)
+    ///< @todo [BEGIN]: Purkkaa (to be removed ASAP!!!)
     if(index > 0)
         verticalStartPoint += 65 * index;
 
@@ -133,6 +137,7 @@ void TabbedPanel::removeTab(int index)
     }
 }
 
+///< @todo sort alphabetically (other methods too)
 void TabbedPanel::closePanel()
 {
     qDebug() << __PRETTY_FUNCTION__;
@@ -156,16 +161,19 @@ void TabbedPanel::resizePanel(const QSize &size)
     this->resize(PANEL_BAR_TABBED_WIDTH + PANEL_WIDTH,
                  size.height() - PANEL_TOP_PADDING - PANEL_BOTTOM_PADDING);
 
-    if(!m_isOpen)
+    if(!m_isOpen) {
         this->move(size.width() - PANEL_TAB_WIDTH - PANEL_BAR_WIDTH, PANEL_TOP_PADDING);
-    else
+    }
+    else {
         this->move(size.width() - PANEL_TAB_WIDTH - PANEL_BAR_WIDTH - PANEL_WIDTH,
                    PANEL_TOP_PADDING);
+    }
 
     m_panelBar->resizeBar(size);
 
     m_panelContent->resizePanelContent(size);
 
+    ///< @todo alignment
     m_panelStateClosed->assignProperty(this, "pos",
                         QPoint(size.width() - PANEL_TAB_WIDTH - PANEL_BAR_WIDTH, PANEL_TOP_PADDING));
     m_panelStateOpened->assignProperty(this, "pos",
@@ -177,6 +185,8 @@ void TabbedPanel::setActiveTab(int index)
 {
     qDebug() << __PRETTY_FUNCTION__;
 
+    ///< @todo magic
+    ///< @todo short comments?
     if(m_activeTab == -1) {
         m_activeTab = index;
         m_panelWidgetStack->setCurrentIndex(index);
index 91c03a5..06ab708 100644 (file)
@@ -47,8 +47,6 @@ class PanelContent;
  *
  * @author Kaj Wallin - kaj.wallin (at) ixonos.com
  * @author Pekka Nissinen - pekka.nissinen@ixonos.com
- *
- * @class TabbedPanel tabbedpanel.h "ui/tabbedpanel.h"
  */
 class TabbedPanel : public QWidget
 {
@@ -77,6 +75,7 @@ public:
      */
     int addTab(QWidget *widget, const QIcon& icon);
 
+    ///< @todo define "out of range"
     /**
      * @brief Inserts a tab to the panel
      *
index 6dc7345..4cf8c4a 100644 (file)
@@ -1,3 +1,4 @@
+///< @todo Pekka missing from authors?
 /*
     Situare - A location system for Facebook
     Copyright (C) 2010  Ixonos Plc. Authors:
@@ -33,6 +34,8 @@ private slots:
     void testPanelToggling();
 };
 
+///< @todo Remove commented code. Add failing test case if there should be a unit test but it is not yet implemented
+
 //void TestTabbedPanel::testPanelTypes()
 //{
 //    SidePanel *testPanel = new SidePanel();
@@ -74,7 +77,10 @@ void TestTabbedPanel::testPanelToggling()
     testPanel->closePanel();
     QTest::qWait(1);
     QCOMPARE(toggleSpy.count(), 2);
+
     delete testPanel;
 }
+
 QTEST_MAIN(TestTabbedPanel)
+
 #include "testtabbedpanel.moc"