#endif
SituareEngine::SituareEngine(QMainWindow *parent)
- : QObject(parent)
+ : QObject(parent),
+ m_autoCenteringEnabled(false),
+ m_gpsEnabled(false)
{
qDebug() << __PRETTY_FUNCTION__;
m_ui = new MainWindow;
qDebug() << __PRETTY_FUNCTION__;
delete m_ui;
+
+ QSettings settings(DIRECTORY_NAME, FILE_NAME);
+ qDebug() << __PRETTY_FUNCTION__ << m_gpsEnabled;
+ qDebug() << __PRETTY_FUNCTION__ << m_autoCenteringEnabled;
+ settings.setValue(GPS_ENABLED, m_gpsEnabled);
+ settings.setValue(AUTO_CENTERING_ENABLED, m_autoCenteringEnabled);
}
void SituareEngine::loginProcessCancelled()
{
qDebug() << __PRETTY_FUNCTION__;
+ m_gpsEnabled = enabled;
+
if (enabled) {
m_gps->lastPosition();
m_gps->start();
{
qDebug() << __PRETTY_FUNCTION__;
+ m_autoCenteringEnabled = enabled;
+
if (enabled) {
m_ui->setAutoCenteringButton(true);
m_ui->autoCenteringEnabled(true);
* DATA MEMBERS
******************************************************************************/
private:
+ bool m_autoCenteringEnabled; ///< Auto centering enabled
+ bool m_gpsEnabled; ///< GPS enabled
FacebookAuthentication *m_facebookAuthenticator; ///< Instance for facebook authenticator
GPSPositionInterface *m_gps; ///< Instance of the gps position
MainWindow *m_ui; ///< Instance of the MainWindow UI
qDebug() << "Session Key" << result[SESSION_KEY].toString();
m_loginCredentials.setSessionKey(result[SESSION_KEY].toString());
- qDebug() << "userID" << result[USER_ID].toString();
- m_loginCredentials.setUserID(result[USER_ID].toString());
+// // commeted out until qjson parser can handle 64-bit integers
+// qDebug() << "userID" << result[USER_ID].toString();
+// m_loginCredentials.setUserID(result[USER_ID].toString().toAscii());
+
+ // dirty fix, get user id from session_key
+ QStringList list = result[SESSION_KEY].toString().split("-");
+ m_loginCredentials.setUserID(list.at(1));
+ qDebug() << m_loginCredentials.userID();
qDebug() << "Expires" << result[EXPIRES].toString();
m_loginCredentials.setExpires(result[EXPIRES].toString());
if(m_buttonMode != QIcon::Disabled) {
QAbstractButton::mousePressEvent(event);
- m_buttonMode = QIcon::Selected;
- update();
+ setMode(QIcon::Selected);
}
}
if(m_buttonMode != QIcon::Disabled) {
QAbstractButton::mouseReleaseEvent(event);
- m_buttonMode = QIcon::Normal;
- update();
+ setMode(QIcon::Normal);
}
}
Q_UNUSED(event);
QPainter painter(this);
-
- // Temporary border
- painter.setPen(Qt::white);
- painter.drawRect(this->rect().x(), this->rect().y(),
- this->rect().width() - 1, this->rect().height() - 1);
-
icon().paint(&painter, this->rect(), NULL, m_buttonMode);
}
void ImageButton::setMode(QIcon::Mode mode)
{
- qDebug() << __PRETTY_FUNCTION__;
+ qDebug() << __PRETTY_FUNCTION__ << "Button icon mode:" << mode;
m_buttonMode = mode;
update();
#include <QPaintEvent>
/**
-* @brief A simple class for icon button
-*
-* @author Pekka Nissinen - pekka.nissinen (at) ixonos.com
-*/
+ * @brief A simple class for icon button
+ *
+ * @author Pekka Nissinen - pekka.nissinen (at) ixonos.com
+ */
class ImageButton : public QPushButton
{
Q_OBJECT
public:
/**
- * @brief Constructor
- *
- * @param parent Parent
- * @param normalIconPictureFileName Normal state Icon image file name
- * @param selectedIconPictureFileName Selected state Icon image file name (optional)
- */
+ * @brief Constructor
+ *
+ * @param parent Parent
+ * @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 = "");
******************************************************************************/
protected:
/**
- * @brief Event handler for mouse press events
- *
- * @param event Mouse event
- */
+ * @brief Event handler for mouse press events
+ *
+ * @param event Mouse event
+ */
void mousePressEvent(QMouseEvent *event);
/**
- * @brief Event handler for mouse release events
- *
- * @param event Mouse event
- */
+ * @brief Event handler for mouse release events
+ *
+ * @param event Mouse event
+ */
void mouseReleaseEvent(QMouseEvent *event);
/**
- * @brief Event handler for paint events
- *
- * Paints the button and its icon
- * @param event Paint event
- */
+ * @brief Event handler for paint events
+ *
+ * Paints the button and its icon
+ * @param event Paint event
+ */
void paintEvent(QPaintEvent *event);
/*******************************************************************************
* MEMBER FUNCTIONS AND SLOTS
******************************************************************************/
public:
+ /**
+ * @brief Sets the button icon mode
+ *
+ * @param mode Button icon mode
+ */
void setMode(QIcon::Mode mode);
/*******************************************************************************
PropModeReplace,
reinterpret_cast<unsigned char *>(&val),
1);
+#else
+ Q_UNUSED(grab);
#endif // Q_WS_MAEMO_5
}
move(m_x, m_y);
}
-
-ZoomButtonPanel::~ZoomButtonPanel()
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- delete m_zoomInBtn;
- delete m_zoomOutBtn;
- m_zoomInBtn = 0;
- m_zoomOutBtn = 0;
-}
-
-void ZoomButtonPanel ::paintEvent(QPaintEvent *event)
-{
- qDebug() << __PRETTY_FUNCTION__;
-
- Q_UNUSED(event);
-
- QPainter painter(this);
-
- // Temporary border
- painter.setPen(Qt::red);
- painter.drawRect(this->rect().x(), this->rect().y(),
- this->rect().width() - 1, this->rect().height() - 1);
-}
*/
ZoomButtonPanel(QWidget *parent = 0, int x = 0, int y = 0);
- /**
- * @brief Destructor
- */
- ~ZoomButtonPanel();
-
-/*******************************************************************************
- * BASE CLASS INHERITED AND REIMPLEMENTED MEMBER FUNCTIONS
- ******************************************************************************/
-protected:
- void paintEvent(QPaintEvent *event);
-
/*******************************************************************************
* DATA MEMBERS
******************************************************************************/