ui/sidepanel.h
QT += network \
webkit
-
-#DEFINES += QT_NO_DEBUG_OUTPUT
+DEFINES += QT_NO_DEBUG_OUTPUT
maemo5 | simulator {
SOURCES += gps/gpspositionprivate.cpp
message([QtMobility])
message(Make sure you have QtMobility development headers installed)
message(install headers with: apt-get install libqtm-dev)
-}
-else {
+} else {
SOURCES += gps/gpspositionprivatestub.cpp
HEADERS += gps/gpspositionprivatestub.h
message(QJson built in)
message(install headers with: sudo apt-get install libqjson-dev)
}
-
# -----------------------------------------------------------------
# Debian packetizing additions
# -----------------------------------------------------------------
USA.
*/
+#include <QSize>
#include <QDebug>
#include <QPixmap>
#include <QPainter>
-#include <QAbstractButton>
#include "imagebutton.h"
ImageButton::ImageButton(QWidget *parent, QString normalIconPictureFileName,
- QString selectedIconPictureFileName)
+ QString selectedIconPictureFileName)
: QPushButton(parent),
m_buttonMode(QIcon::Normal)
{
qDebug() << __PRETTY_FUNCTION__;
+ // If there is a file name provided for icon image, use it as the icon for the button
if (normalIconPictureFileName != "") {
QPixmap iconPixmap(normalIconPictureFileName);
- m_buttonSize = iconPixmap.size(); // Get the button size from the normal state icon picture
+ QSize buttonSize = iconPixmap.size(); // Get the button size from the normal state icon picture
QIcon icon(iconPixmap);
// If there is a picture for selected state, use it instead of a simple highlight change
if(selectedIconPictureFileName != "")
- icon.addFile(selectedIconPictureFileName, m_buttonSize, QIcon::Selected);
+ icon.addFile(selectedIconPictureFileName, buttonSize, QIcon::Selected);
setIcon(icon);
- setIconSize(m_buttonSize);
- setFixedSize(m_buttonSize);
+ setIconSize(buttonSize);
+ setFixedSize(buttonSize);
}
}
void ImageButton::setButtonIcon(const QPixmap &image)
{
- m_buttonSize = image.size(); // Get the button size from the normal state icon picture
+ QSize buttonSize = image.size(); // Get the button size from the normal state icon picture
QIcon icon(image);
setIcon(icon);
- setIconSize(m_buttonSize);
- setFixedSize(m_buttonSize);
+ setIconSize(buttonSize);
+ setFixedSize(buttonSize);
}
void ImageButton::mousePressEvent(QMouseEvent *event)
qDebug() << __PRETTY_FUNCTION__;
if(m_buttonMode != QIcon::Disabled) {
- QAbstractButton::mousePressEvent(event);
+ QPushButton::mousePressEvent(event);
setMode(QIcon::Selected);
}
}
qDebug() << __PRETTY_FUNCTION__;
if(m_buttonMode != QIcon::Disabled) {
- QAbstractButton::mouseReleaseEvent(event);
+ QPushButton::mouseReleaseEvent(event);
setMode(QIcon::Normal);
}
}
#define IMAGEBUTTON_H
#include <QIcon>
-#include <QSize>
#include <QString>
+#include <QWidget>
#include <QPushButton>
#include <QMouseEvent>
#include <QPaintEvent>
* @brief Constructor
*
* @param parent Parent
- * @param normalIconPictureFileName Normal state Icon image file name
- * @param selectedIconPictureFileName Selected state Icon image file name (optional)
+ * @param normalIconPictureFileName Normal state icon image file name
+ * @param selectedIconPictureFileName Selected state icon image file name (optional)
*/
ImageButton(QWidget *parent = 0, QString normalIconPictureFileName = "",
QString selectedIconPictureFileName = "");
/*******************************************************************************
* DATA MEMBERS
******************************************************************************/
-private:
+protected:
QIcon::Mode m_buttonMode; ///< Button mode (Normal, Selected etc...)
- QSize m_buttonSize; ///< Button size
};
#endif // IMAGEBUTTON_H
m_zoomButtonPanel = new ZoomButtonPanel(this, ZOOM_BUTTON_PANEL_POSITION_X,
ZOOM_BUTTON_PANEL_POSITION_Y);
- connect(m_zoomButtonPanel->m_zoomInButton, SIGNAL(clicked()),
+ connect(m_zoomButtonPanel->zoomInButton(), SIGNAL(clicked()),
this, SIGNAL(zoomIn()));
- connect(m_zoomButtonPanel->m_zoomOutButton, SIGNAL(clicked()),
+ connect(m_zoomButtonPanel->zoomOutButton(), SIGNAL(clicked()),
this, SIGNAL(zoomOut()));
connect(this, SIGNAL(zoomLevelChanged(int)),
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)
+ m_zoomInButton(0),
+ m_zoomOutButton(0)
{
qDebug() << __PRETTY_FUNCTION__;
m_panelLayout.addWidget(m_zoomInButton, 0, 0);
m_panelLayout.addWidget(m_zoomOutButton, 1, 0);
- move(m_x, m_y);
+ move(x, y);
+}
+
+const ImageButton* ZoomButtonPanel::zoomInButton()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ return m_zoomInButton;
+}
+
+const ImageButton* ZoomButtonPanel::zoomOutButton()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+
+ return m_zoomOutButton;
}
void ZoomButtonPanel::disableZoomInButton()
#define ZOOMBUTTONPANEL_H
#include <QWidget>
-#include <QPaintEvent>
#include <QGridLayout>
#include <QGraphicsItem>
/*******************************************************************************
* MEMBER FUNCTIONS AND SLOTS
******************************************************************************/
+public:
+ /**
+ * @brief Getter for the zoom in button
+ *
+ * @return Pointer to the zoomInButton
+ */
+ const ImageButton* zoomInButton();
+
+ /**
+ * @brief Getter for the zoom out button
+ *
+ * @return Pointer to the zoomOutButton
+ */
+ const ImageButton* zoomOutButton();
+
public slots:
/**
- * @brief Disables the Zoom In button
+ * @brief Disables the zoom in button
*/
void disableZoomInButton();
/**
- * @brief Disables the Zoom Out button
+ * @brief Disables the zoom out button
*/
void disableZoomOutButton();
/**
- * @brief Reset Zoom button states to normal
+ * @brief Reset zoom button states to normal
*/
void resetButtons();
/*******************************************************************************
* DATA MEMBERS
******************************************************************************/
-public:
- ImageButton *m_zoomInButton; ///< Button for zoom in
- ImageButton *m_zoomOutButton; ///< Button for zoom out
-
private:
- QGridLayout m_panelLayout; ///< Panel layout
- int m_x; ///< Panel x coordinate
- int m_y; ///< Panel y coordinate
+ QGridLayout m_panelLayout; ///< Panel layout
+ ImageButton *m_zoomInButton; ///< Button for zoom in
+ ImageButton *m_zoomOutButton; ///< Button for zoom out
};
#endif // ZOOMBUTTONPANEL_H