Added a new method for getting current icon mode (ImageButton).
authorPekka Nissinen <pekka.nissinen@ixonos.com>
Tue, 18 May 2010 08:47:06 +0000 (11:47 +0300)
committerPekka Nissinen <pekka.nissinen@ixonos.com>
Tue, 18 May 2010 08:47:06 +0000 (11:47 +0300)
Reviewed by: Jussi Laitinen

src/ui/imagebutton.cpp
src/ui/imagebutton.h
src/ui/zoombuttonpanel.cpp
tests/ui/zoombuttonpanel/testzoombuttonpanel [deleted file]
tests/ui/zoombuttonpanel/testzoombuttonpanel.cpp

index 0c3bf40..28e8358 100644 (file)
@@ -78,8 +78,15 @@ void ImageButton::paintEvent(QPaintEvent *event)
 
 void ImageButton::setMode(QIcon::Mode mode)
 {
-    qDebug() << __PRETTY_FUNCTION__ << "Button icon mode:" << mode;
+    qDebug() << __PRETTY_FUNCTION__;
 
     m_buttonMode = mode;
     update();
 }
+
+QIcon::Mode ImageButton::mode()
+{
+    qDebug() << __PRETTY_FUNCTION__;
+
+    return m_buttonMode;
+}
index be7852e..df47c61 100644 (file)
@@ -86,6 +86,13 @@ public:
      */
     void setMode(QIcon::Mode mode);
 
+    /**
+     * @brief Returns the current button icon mode
+     *
+     * @return Button icon mode
+     */
+    QIcon::Mode mode();
+
 /*******************************************************************************
  * DATA MEMBERS
  ******************************************************************************/
index c21ceb1..94d04c0 100644 (file)
@@ -27,6 +27,8 @@
 
 ZoomButtonPanel::ZoomButtonPanel(QWidget *parent, int x, int y)
     : QWidget(parent),
+      m_zoomInButton(0),
+      m_zoomOutButton(0),
       m_panelLayout(this),
       m_x(x),
       m_y(y)
diff --git a/tests/ui/zoombuttonpanel/testzoombuttonpanel b/tests/ui/zoombuttonpanel/testzoombuttonpanel
deleted file mode 100755 (executable)
index 171774a..0000000
Binary files a/tests/ui/zoombuttonpanel/testzoombuttonpanel and /dev/null differ
index c72ac66..58cbdfd 100644 (file)
@@ -52,14 +52,14 @@ private slots:
 void TestZoomButtonPanel::init()
 {
     // Create a new instance of ZoomButtonPanel
-    ZoomButtonPanel zoomButtonPanel(NULL, 10, 10);
+    ZoomButtonPanel zoomButtonPanel(0, 10, 10);
 
     // Check that panel is positioned to the right place
     QCOMPARE(zoomButtonPanel.pos(), QPoint(10, 10));
 
     // Check that both of the buttons images are loaded successfully
-    QVERIFY(zoomButtonPanel.m_zoomInButton != NULL);
-    QVERIFY(zoomButtonPanel.m_zoomOutButton != NULL);
+    QVERIFY(zoomButtonPanel.m_zoomInButton != 0);
+    QVERIFY(zoomButtonPanel.m_zoomOutButton != 0);
 
     // Check that both of the button icons are at normal mode
     QVERIFY(zoomButtonPanel.m_zoomInButton->mode() == QIcon::Normal);
@@ -69,7 +69,7 @@ void TestZoomButtonPanel::init()
 void TestZoomButtonPanel::disableZoomIn()
 {
     // Create a new instance of ZoomButtonPanel
-    ZoomButtonPanel zoomButtonPanel(NULL, NULL, NULL);
+    ZoomButtonPanel zoomButtonPanel(0, 0, 0);
 
     // Disable the button
     zoomButtonPanel.disableZoomInButton();
@@ -81,7 +81,7 @@ void TestZoomButtonPanel::disableZoomIn()
 void TestZoomButtonPanel::disableZoomOut()
 {
     // Create a new instance of ZoomButtonPanel
-    ZoomButtonPanel zoomButtonPanel(NULL, NULL, NULL);
+    ZoomButtonPanel zoomButtonPanel(0, 0, 0);
 
     // Disable the button
     zoomButtonPanel.disableZoomOutButton();
@@ -93,7 +93,7 @@ void TestZoomButtonPanel::disableZoomOut()
 void TestZoomButtonPanel::reset()
 {
     // Create a new instance of ZoomButtonPanel
-    ZoomButtonPanel zoomButtonPanel(NULL, NULL, NULL);
+    ZoomButtonPanel zoomButtonPanel(0, 0, 0);
 
     // Set both buttons to disabled mode
     zoomButtonPanel.m_zoomInButton->setMode(QIcon::Disabled);