map/maptile.cpp \
map/mapfetcher.cpp \
ui/pixmap.cpp \
- ui/infotab.cpp
+ ui/infotab.cpp \
+ ui/updatelocation/updatelocationdialog.cpp \
+ ui/updatelocation/texteditautoresizer.cpp
HEADERS += ui/mainwindow.h \
ui/mapviewscreen.h \
ui/listviewscreen.h \
map/mapfetcher.h \
common.h \
ui/pixmap.h \
- ui/infotab.h
+ ui/infotab.h \
+ ui/updatelocation/updatelocationdialog.h \
+ ui/updatelocation/texteditautoresizer.h
QT += network \
webkit
#include <QGraphicsProxyWidget>
#include <QStateMachine>
#include "listviewscreen.h"
-#include "pixmap.h"
-#include "infotab.h"
#include <QDebug>
ListViewScreen::ListViewScreen(QWidget *parent)
m_personalInfo->setTime("1 hour ago");
m_personalInfo->setAddress("Kiviharjunlenkki 1E, 91910 Oulu");
+ m_locationDialog = new updatelocationdialog(this);
m_widgetProxy = new QGraphicsProxyWidget();
m_widgetProxy->setWidget(m_personalInfo);
m_vbox = new QVBoxLayout(this);
m_vbox->addWidget(view);
m_vbox->setMargin(0);
+
+ connect(m_personalInfo,SIGNAL(launchMessageUpdate()),this,SLOT(updateMessage()));
}
ListViewScreen::~ListViewScreen()
if (m_vbox)
delete m_vbox;
}
+
+void ListViewScreen::updateMessage()
+{
+ qDebug() << __PRETTY_FUNCTION__;
+ m_locationDialog->exec();
+}
#include <QtGui>
#include "infotab.h"
#include "pixmap.h"
+#include "updatelocation/updatelocationdialog.h"
/**
* @brief List View class. Used for displaying List of friends
*/
class ListViewScreen : public QWidget
{
+Q_OBJECT
public:
/**
* @brief Constructor
*
*/
~ListViewScreen();
+public slots:
+ void updateMessage();
private:
QVBoxLayout *m_vbox; ///< Holds the graphics view
InfoTab *m_personalInfo; ///< Personal info tab
QPropertyAnimation *m_anim2; ///< Animation for arrowbutton from hidden to visible
QPropertyAnimation *m_anim3; ///< Animation for infotab from visible to hidden
QPropertyAnimation *m_anim4; ///< Animation for arrowbutton from visible to hidden
+ updatelocationdialog *m_locationDialog; ///< Message dialog
};
#endif // LISTVIEWTAB_H
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Katri Kaikkonen - katri.kaikkonen@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+#include <QtGui>
+#include "texteditautoresizer.h"
+
+TextEditAutoResizer::TextEditAutoResizer(QWidget *parent)
+ : QObject(parent)
+ , m_edit(qobject_cast<QFrame *>(parent))
+ , m_plainTextEdit(qobject_cast<QPlainTextEdit *>(parent))
+ , m_textEdit(qobject_cast<QTextEdit *>(parent))
+ {
+ //parent must either inherit QPlainTextEdit or QTextEdit!
+ Q_ASSERT(m_plainTextEdit || m_textEdit);
+
+ connect(parent, SIGNAL(textChanged()), this, SLOT(textEditChanged()));
+ connect(parent, SIGNAL(cursorPositionChanged()), this, SLOT(textEditChanged()));
+ }
+
+void TextEditAutoResizer::textEditChanged()
+{
+ QTextDocument *document = m_textEdit ? m_textEdit->document() : m_plainTextEdit->document();
+ QRect cursor = m_textEdit ? m_textEdit->cursorRect() : m_plainTextEdit->cursorRect();
+
+ QSize size = document->size().toSize();
+ if (m_plainTextEdit)
+ size.setHeight((size.height() + 1) * m_edit->fontMetrics().lineSpacing());
+
+ const QRect frameRect = m_edit->frameRect();
+ const QRect contentsRect = m_edit->contentsRect();
+
+ m_edit->setMinimumHeight(qMax(70, size.height() + (frameRect.height()
+ - contentsRect.height() - 1)));
+
+ // make sure the cursor is visible in case we have a QAbstractScrollArea parent
+ QPoint position = m_edit->pos();
+ QWidget *parentWidget = m_edit->parentWidget();
+ while (parentWidget) {
+ #ifdef Q_WS_MAEMO_5
+ if (parentWidget->parentWidget()) {
+ if (QAbstractScrollArea *area = qobject_cast<QAbstractScrollArea *>(
+ parentWidget->parentWidget()->parentWidget())) {
+ if (QAbstractKineticScroller * scroller=
+ area->property("kineticScroller").value<QAbstractKineticScroller *>()) {
+ scroller->ensureVisible(position + cursor.center(), 10 + cursor.width(),
+ 2 * cursor.height());
+ }
+ break;
+ }
+ }
+ #endif
+ position = parentWidget->mapToParent(position);
+ parentWidget = parentWidget->parentWidget();
+ }
+}
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Katri Kaikkonen - katri.kaikkonen@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+#ifndef TEXTEDITAUTORESIZER_H
+#define TEXTEDITAUTORESIZER_H
+
+#include <QtGui>
+#ifdef Q_WS_MAEMO_5
+#include <QAbstractKineticScroller>
+#endif // Q_WS_MAEMO_5
+
+/**
+* @brief TextEditAutoResizer class
+*
+* @class TextEditAutoResizer class is used to automatically resize the QTextEdit once the contents
+* become too large.
+*/
+class TextEditAutoResizer : public QObject
+{
+Q_OBJECT
+
+public:
+ /**
+ * @brief Default constructor
+ *
+ * @fn TextEditAutoResizer
+ * @param parent
+ */
+ TextEditAutoResizer(QWidget *parent = 0);
+
+private slots:
+ /**
+ * @brief Private slot which indicate when textEdit has been changed
+ *
+ * @fn textEditChanged
+ */
+ void textEditChanged();
+
+private:
+ QFrame *m_edit; ///< Pointer to Frame
+ QPlainTextEdit *m_plainTextEdit; ///< Pointer to PlainTextEdit
+ QTextEdit *m_textEdit; ///< Pointer to TextEdit
+};
+
+#endif // TEXTEDITAUTORESIZER_H
+
+
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Katri Kaikkonen - katri.kaikkonen@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+#include <QtGui>
+#include <QDebug>
+#include "updatelocationdialog.h"
+
+updatelocationdialog::updatelocationdialog(QWidget *parent)
+ : QDialog(parent)
+{
+ setWindowTitle(tr("Update Location"));
+
+ QScrollArea *scrollArea = new QScrollArea(this);
+ QGridLayout *gridLayout = new QGridLayout(this);
+ QGroupBox *groupBox = new QGroupBox(scrollArea);
+
+ QTextEdit *m_textEdit = new QTextEdit;
+ QLineEdit *m_lineEdit = new QLineEdit;
+ QCheckBox *m_checkBox = new QCheckBox("Publish in Fabebook");
+
+ QPushButton *m_okButton = new QPushButton("Send");
+ QDialogButtonBox *m_buttonBox = new QDialogButtonBox(Qt::Vertical);
+ m_buttonBox->addButton(m_okButton, QDialogButtonBox::ActionRole);
+
+ QFormLayout *form = new QFormLayout();
+ form->addRow(new QLabel("Location:"), m_lineEdit);
+ form->addRow(new QLabel("Message:"), m_textEdit);
+ form->addWidget(m_checkBox);
+
+ new TextEditAutoResizer(m_textEdit);
+
+ groupBox->setLayout(form);
+ scrollArea->setWidget(groupBox);
+ scrollArea->setWidgetResizable(true);
+ gridLayout->addWidget(scrollArea, 0, 0, 2, 1);
+ gridLayout->addWidget(m_buttonBox, 0, 1, 1, 1);
+ setLayout(gridLayout);
+
+ scrollArea->show();
+}
--- /dev/null
+/*
+ Situare - A location system for Facebook
+ Copyright (C) 2010 Ixonos Plc. Authors:
+
+ Katri Kaikkonen - katri.kaikkonen@ixonos.com
+
+ Situare is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License
+ version 2 as published by the Free Software Foundation.
+
+ Situare is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with Situare; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+ USA.
+*/
+
+#ifndef UPDATELOCATIONDIALOG_H
+#define UPDATELOCATIONDIALOG_H
+
+#include <QDialog>
+#include <QtGui>
+#ifdef Q_WS_MAEMO_5
+#include <QAbstractKineticScroller>
+#endif // Q_WS_MAEMO_5
+#include "texteditautoresizer.h"
+
+class QCheckBox;
+class QDialogButtonBox;
+class QGroupBox;
+class QLabel;
+class QLineEdit;
+class QTextEdit;
+class QPushButton;
+class QScrollArea;
+
+/**
+* @brief Update Location UI
+*
+* @class UI for update location functionality.
+*/
+class updatelocationdialog : public QDialog
+{
+ Q_OBJECT
+
+public:
+ /**
+ * @brief Default constructor
+ *
+ * @fn updatelocationdialog
+ * @param parent
+ */
+ updatelocationdialog(QWidget *parent = 0);
+
+private slots:
+
+private:
+ QDialogButtonBox *m_buttonBox; ///< Pointer to DialogButtonBox
+ QCheckBox *m_checkBox; ///< Pointer to CheckBox
+ QLineEdit *m_lineEdit; ///< Pointer to LineEdit
+ QPushButton *m_okButton; ///< Pointer to PushButton
+ QTextEdit *m_textEdit; ///< Pointer to TextEdit
+};
+
+#endif // UPDATELOCATIONDIALOG_H