From 89260d896a96073e7b26f55e37ac8bd75277aa74 Mon Sep 17 00:00:00 2001 From: "Anselmo Lacerda S. de Melo" Date: Sat, 29 May 2010 00:23:15 -0300 Subject: hyperui: New structure. Preparing for PR 1.2 With the release of PR 1.2, Qt 4.6.2 is now the default Qt in Maemo 5, what simplifies the packaging and the deployment of applications. This commit introduces a new structure for the HyperUI demo. The following commits are going to update the build process and add a script to make easier the task of generating the source tarball which is uploaded to maemo buildbot. Signed-off-by: Anselmo Lacerda S. de Melo --- hyperui/clockwidget.cpp | 267 -------------- hyperui/clockwidget.h | 88 ----- hyperui/contactlist.cpp | 428 ----------------------- hyperui/contactlist.h | 67 ---- hyperui/contactresource.cpp | 123 ------- hyperui/contactresource.h | 61 ---- hyperui/data/hyperui.desktop | 8 + hyperui/data/hyperui.png | Bin 0 -> 9379 bytes hyperui/data/hyperui.svg | 177 ++++++++++ hyperui/draggablepreview.cpp | 210 ----------- hyperui/draggablepreview.h | 91 ----- hyperui/global.cpp | 55 --- hyperui/global.h | 48 --- hyperui/hyperui.desktop | 8 - hyperui/hyperui.png | Bin 9379 -> 0 bytes hyperui/hyperui.svg | 177 ---------- hyperui/main.cpp | 81 ----- hyperui/mainwindow.cpp | 175 ---------- hyperui/mainwindow.h | 78 ----- hyperui/menuview.cpp | 201 ----------- hyperui/menuview.h | 81 ----- hyperui/pagemenu.cpp | 82 ----- hyperui/pagemenu.h | 60 ---- hyperui/pageview.cpp | 246 ------------- hyperui/pageview.h | 84 ----- hyperui/phoneview.cpp | 727 --------------------------------------- hyperui/phoneview.h | 89 ----- hyperui/src/clockwidget.cpp | 267 ++++++++++++++ hyperui/src/clockwidget.h | 88 +++++ hyperui/src/contactlist.cpp | 428 +++++++++++++++++++++++ hyperui/src/contactlist.h | 67 ++++ hyperui/src/contactresource.cpp | 123 +++++++ hyperui/src/contactresource.h | 61 ++++ hyperui/src/draggablepreview.cpp | 210 +++++++++++ hyperui/src/draggablepreview.h | 91 +++++ hyperui/src/global.cpp | 55 +++ hyperui/src/global.h | 48 +++ hyperui/src/main.cpp | 81 +++++ hyperui/src/mainwindow.cpp | 175 ++++++++++ hyperui/src/mainwindow.h | 78 +++++ hyperui/src/menuview.cpp | 201 +++++++++++ hyperui/src/menuview.h | 81 +++++ hyperui/src/pagemenu.cpp | 82 +++++ hyperui/src/pagemenu.h | 60 ++++ hyperui/src/pageview.cpp | 246 +++++++++++++ hyperui/src/pageview.h | 84 +++++ hyperui/src/phoneview.cpp | 727 +++++++++++++++++++++++++++++++++++++++ hyperui/src/phoneview.h | 89 +++++ hyperui/src/view.cpp | 73 ++++ hyperui/src/view.h | 75 ++++ hyperui/view.cpp | 73 ---- hyperui/view.h | 75 ---- 52 files changed, 3675 insertions(+), 3675 deletions(-) delete mode 100644 hyperui/clockwidget.cpp delete mode 100644 hyperui/clockwidget.h delete mode 100644 hyperui/contactlist.cpp delete mode 100644 hyperui/contactlist.h delete mode 100644 hyperui/contactresource.cpp delete mode 100644 hyperui/contactresource.h create mode 100644 hyperui/data/hyperui.desktop create mode 100644 hyperui/data/hyperui.png create mode 100644 hyperui/data/hyperui.svg delete mode 100644 hyperui/draggablepreview.cpp delete mode 100644 hyperui/draggablepreview.h delete mode 100644 hyperui/global.cpp delete mode 100644 hyperui/global.h delete mode 100644 hyperui/hyperui.desktop delete mode 100644 hyperui/hyperui.png delete mode 100644 hyperui/hyperui.svg delete mode 100644 hyperui/main.cpp delete mode 100644 hyperui/mainwindow.cpp delete mode 100644 hyperui/mainwindow.h delete mode 100644 hyperui/menuview.cpp delete mode 100644 hyperui/menuview.h delete mode 100644 hyperui/pagemenu.cpp delete mode 100644 hyperui/pagemenu.h delete mode 100644 hyperui/pageview.cpp delete mode 100644 hyperui/pageview.h delete mode 100644 hyperui/phoneview.cpp delete mode 100644 hyperui/phoneview.h create mode 100644 hyperui/src/clockwidget.cpp create mode 100644 hyperui/src/clockwidget.h create mode 100644 hyperui/src/contactlist.cpp create mode 100644 hyperui/src/contactlist.h create mode 100644 hyperui/src/contactresource.cpp create mode 100644 hyperui/src/contactresource.h create mode 100644 hyperui/src/draggablepreview.cpp create mode 100644 hyperui/src/draggablepreview.h create mode 100644 hyperui/src/global.cpp create mode 100644 hyperui/src/global.h create mode 100644 hyperui/src/main.cpp create mode 100644 hyperui/src/mainwindow.cpp create mode 100644 hyperui/src/mainwindow.h create mode 100644 hyperui/src/menuview.cpp create mode 100644 hyperui/src/menuview.h create mode 100644 hyperui/src/pagemenu.cpp create mode 100644 hyperui/src/pagemenu.h create mode 100644 hyperui/src/pageview.cpp create mode 100644 hyperui/src/pageview.h create mode 100644 hyperui/src/phoneview.cpp create mode 100644 hyperui/src/phoneview.h create mode 100644 hyperui/src/view.cpp create mode 100644 hyperui/src/view.h delete mode 100644 hyperui/view.cpp delete mode 100644 hyperui/view.h diff --git a/hyperui/clockwidget.cpp b/hyperui/clockwidget.cpp deleted file mode 100644 index b6388b5..0000000 --- a/hyperui/clockwidget.cpp +++ /dev/null @@ -1,267 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: openBossa - INdT (renato.chencarek@openbossa.org) -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** the openBossa stream from INdT (renato.chencarek@openbossa.org). -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include - -#include "global.h" -#include "dataresource.h" -#include "clockwidget.h" - - -class ClockEvent -{ -public: - ClockEvent(const QDateTime &begin, const QDateTime &end, - const QColor &color, const QString &text) - : begin(begin), end(end), color(color), text(text) { } - - QDateTime begin; - QDateTime end; - QColor color; - QString text; -}; - - -ClockWidget::ClockWidget(QGraphicsItem *parent) - : QGraphicsWidget(parent), - m_background(Resource::pixmap("idle_clock_structure.png")), - m_divLine(Resource::pixmap("idle_line.png")), - m_middleKnob(Resource::pixmap("idle_clock_pointers_middle.png")), - m_hourPointer(Resource::pixmap("idle_clock_pointer_hour.png")), - m_minutePointer(Resource::pixmap("idle_clock_pointer_minutes.png")) -{ - QFont defaultFont(Resource::stringValue("default/font-family")); - m_fontColor = QColor(Resource::stringValue("clock-widget/font-color")); - - m_dayFont = defaultFont; - m_dayFont.setBold(true); - m_dayFont.setPixelSize(Resource::intValue("clock-widget/day-font-size")); - - m_labelFont = defaultFont; - m_labelFont.setPixelSize(Resource::intValue("clock-widget/label-font-size")); - - m_weekDayFont = defaultFont; - m_weekDayFont.setPixelSize(Resource::intValue("clock-widget/wday-font-size")); - - m_labelHeight = Resource::intValue("clock-widget/label-height"); - m_labelPos = Resource::value("clock-widget/label-init-pos").toPoint(); - m_knobPoint = Resource::value("clock-widget/knob-pos").toPoint(); - m_middlePoint = Resource::value("clock-widget/middle-pos").toPoint(); - m_dayRect = Resource::value("clock-widget/day-label-rect").toRect(); - m_weekDayRect = Resource::value("clock-widget/wday-label-rect").toRect(); - m_eventsPixmapRect = Resource::value("clock-widget/events-pixmap-rect").toRect(); - m_eventsInnerOffset = Resource::intValue("clock-widget/events-inner-offset"); - m_eventsInnerDiameter = Resource::intValue("clock-widget/events-inner-diameter"); - - setMinimumSize(m_background.size()); - setMaximumSize(m_background.size()); - - connect(&m_timer, SIGNAL(timeout()), SLOT(updateTime())); - m_timer.start(Resource::intValue("clock-widget/update-timeout")); - - m_eventsPixmap = QPixmap(m_eventsPixmapRect.size()); -} - -ClockWidget::~ClockWidget() -{ - qDeleteAll(m_events); -} - -void ClockWidget::addEvent(const QDateTime &begin, const QDateTime &end, - const QColor &color, const QString &text) -{ - m_events.append(new ClockEvent(begin, end, color, text)); - updateEvents(); - update(); -} - -void ClockWidget::updateTime() -{ - update(); -} - -void ClockWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, - QWidget *widget) -{ - Q_UNUSED(option); - Q_UNUSED(widget); - - // store and adjust render hints - const QPainter::RenderHints hints = painter->renderHints(); - painter->setRenderHints(hints | QPainter::SmoothPixmapTransform); - - // draw clock base pixmap - painter->drawPixmap(0, 0, m_background); - - // draw day information - const QDateTime &dateTime = QDateTime::currentDateTime(); - painter->setPen(m_fontColor); - painter->setFont(m_dayFont); - painter->drawText(m_dayRect, Qt::AlignHCenter | Qt::AlignVCenter, - dateTime.toString("dd")); - painter->setFont(m_weekDayFont); - painter->drawText(m_weekDayRect, Qt::AlignHCenter | Qt::AlignVCenter, - dateTime.toString("ddd").toUpper()); - - painter->drawPixmap(m_eventsPixmapRect.x(), m_eventsPixmapRect.y(), - m_eventsPixmap); - - // calculate min/hour pointer angles - const QTime &time = dateTime.time(); - const int hourAngle = 180 + qRound(30.0 * (time.hour() + time.minute() / 60.0)); - const int minuteAngle = 180 + qRound(6.0 * (time.minute() + time.second() / 60.0)); - - // paint minute pointer - painter->save(); - painter->translate(m_middlePoint); - painter->rotate(minuteAngle); - painter->drawPixmap(-m_minutePointer.width() / 2, 0, m_minutePointer); - painter->restore(); - - // paint hour pointer - painter->save(); - painter->translate(m_middlePoint); - painter->rotate(hourAngle); - painter->drawPixmap(-m_hourPointer.width() / 2, 0, m_hourPointer); - painter->restore(); - - // paint middle knob - painter->drawPixmap(m_knobPoint, m_middleKnob); - - int i = 0; - int bx = m_labelPos.x(); - int by = m_labelPos.y(); - int bw = m_divLine.width(); - - QString lastText; - QFont font = m_labelFont; - painter->drawPixmap(bx, by, m_divLine); - - // paint events descriptions - foreach (ClockEvent *event, m_events) { - // show different events - if (event->text == lastText) - continue; - - lastText = event->text; - - painter->setPen(event->color); - painter->setBrush(event->color); - painter->drawRoundedRect(bx + 4, by + 0.3 * m_labelHeight, - 0.1 * bw, 0.5 * m_labelHeight, 2, 2); - - font.setBold(true); - painter->setFont(font); - drawTextWithShadow(painter, bx + 0.13 * bw, by + 0.75 * m_labelHeight, - event->begin.toString("hh:mm"), Qt::white); - - font.setBold(false); - painter->setFont(font); - drawTextWithShadow(painter, bx + 0.3 * bw, by + 0.75 * m_labelHeight, - event->text, m_fontColor); - - painter->drawPixmap(bx, by + m_labelHeight, m_divLine); - - by += m_labelHeight; - - // show just two events - if (++i > 1) break; - } - - // restore render hints - painter->setRenderHints(hints); -} - - -void ClockWidget::updateEvents() -{ - // clear the cache - m_eventsPixmap.fill(Qt::transparent); - - QPainter painter(&m_eventsPixmap); - painter.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform); - - painter.setOpacity(0.9); - painter.setPen(Qt::NoPen); - - const int inner = m_eventsInnerOffset; - const int diameter = m_eventsInnerDiameter; - - foreach (ClockEvent *event, m_events) { - painter.setCompositionMode(QPainter::CompositionMode_SourceOver); - - // calculate start angle - const QTime &ta = event->begin.time(); - int ia = qRound(30.0 * (ta.hour() + ta.minute() / 60.0)); - - // calculate end angle - const QTime &tb = event->end.time(); - int ib = qRound(30.0 * (tb.hour() + tb.minute() / 60.0)) - ia; - - // drawPie parameters must be specified in 1/16th of a degree - // and it's counter-clockwise. so we must adjust to the right values. - ia = ia * -16 + 90 * 16; - ib = ib * -16; - - // draw the event pie - painter.setBrush(event->color); - painter.drawPie(0, 0, diameter, diameter, ia, ib); - - // draw some gradients to simulate light effects - QRadialGradient gradient(diameter / 2, diameter / 2, diameter / 2 - 35); - gradient.setColorAt(0.9, QColor::fromRgbF(1, 1, 1, 0.5)); - gradient.setColorAt(1, QColor::fromRgbF(0, 0, 0, 0.0)); - painter.setBrush(gradient); - painter.drawPie(0, 0, diameter, diameter, ia, ib); - - QRadialGradient gradient2(diameter / 2, diameter / 2, diameter / 2); - gradient2.setColorAt(0.98, QColor::fromRgbF(0, 0, 0, 0.0)); - gradient2.setColorAt(1, QColor::fromRgbF(0, 0, 0, 0.5)); - painter.setBrush(gradient2); - painter.drawPie(0, 0, diameter, diameter, ia, ib); - - QRadialGradient gradient3(diameter / 2, diameter / 2, diameter / 2); - gradient3.setColorAt(0, QColor::fromRgbF(1, 1, 1, 0.4)); - gradient3.setColorAt(1, QColor::fromRgbF(1, 1, 1, 0.0)); - - gradient3.setFocalPoint(100, 100); - painter.setBrush(gradient3); - painter.drawPie(0, 0, diameter, diameter, ia, ib); - } - - // clear the middle of the pies - painter.setBrush(Qt::transparent); - painter.setCompositionMode(QPainter::CompositionMode_Clear); - painter.drawPie(inner, inner, diameter - inner * 2, - diameter - inner * 2, 0, 360 * 16); -} diff --git a/hyperui/clockwidget.h b/hyperui/clockwidget.h deleted file mode 100644 index 62a1890..0000000 --- a/hyperui/clockwidget.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: openBossa - INdT (renato.chencarek@openbossa.org) -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** the openBossa stream from INdT (renato.chencarek@openbossa.org). -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef CLOCKWIDGET_H -#define CLOCKWIDGET_H - -#include -#include -#include -#include - -class ClockEvent; - - -class ClockWidget : public QGraphicsWidget -{ - Q_OBJECT - -public: - ClockWidget(QGraphicsItem *parent = 0); - ~ClockWidget(); - - void addEvent(const QDateTime &begin, const QDateTime &end, - const QColor &color, const QString &text); - - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, - QWidget *widget = 0); - -private slots: - void updateTime(); - void updateEvents(); - -private: - QFont m_dayFont; - QFont m_labelFont; - QFont m_weekDayFont; - QColor m_fontColor; - QPixmap m_background; - QPixmap m_divLine; - - QTimer m_timer; - QPoint m_knobPoint; - QPoint m_middlePoint; - QPoint m_labelPos; - QRectF m_dayRect; - QRectF m_weekDayRect; - QRect m_eventsPixmapRect; - int m_labelHeight; - int m_eventsInnerOffset; - int m_eventsInnerDiameter; - - QPixmap m_middleKnob; - QPixmap m_hourPointer; - QPixmap m_minutePointer; - - QPixmap m_eventsPixmap; - QList m_events; -}; - -#endif diff --git a/hyperui/contactlist.cpp b/hyperui/contactlist.cpp deleted file mode 100644 index 89a6a3e..0000000 --- a/hyperui/contactlist.cpp +++ /dev/null @@ -1,428 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: openBossa - INdT (renato.chencarek@openbossa.org) -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** the openBossa stream from INdT (renato.chencarek@openbossa.org). -** $QT_END_LICENSE$ -** -****************************************************************************/ - - -#include -#include -#include - -#include "dataresource.h" -#include "contactlist.h" -#include "contactresource.h" - -#include "label.h" -#include "scrollarea.h" -#include "pixmapwidget.h" - - -class LetterScroll : public PixmapWidget -{ - Q_OBJECT - -public: - LetterScroll(ContactList *list); - - void mousePressEvent(QGraphicsSceneMouseEvent *e); - void mouseMoveEvent(QGraphicsSceneMouseEvent *e); - void mouseReleaseEvent(QGraphicsSceneMouseEvent *e); - -signals: - void letterPressed(char c); - -private: - void gotoPosition(int offset); - - char lastChar; - ContactList *list; - QGraphicsPixmapItem *marker; - QGraphicsSimpleTextItem *markerLabel; -}; - - -LetterScroll::LetterScroll(ContactList *list) - : PixmapWidget(Resource::pixmap("list_abc.png")), - lastChar(0), - list(list) -{ - marker = new QGraphicsPixmapItem(Resource::pixmap("list_abcmarker.png"), this); - marker->setX(-marker->boundingRect().width()); - marker->hide(); - - markerLabel = new QGraphicsSimpleTextItem(marker); - markerLabel->setBrush(Qt::white); - markerLabel->setText(QString()); - markerLabel->setX(0.08 * marker->boundingRect().width()); - markerLabel->setY(0.07 * marker->boundingRect().height()); - - QFont font(Resource::stringValue("default/font-family")); - font.setPixelSize(Resource::intValue("contact-list/marker-font-size")); - markerLabel->setFont(font); - - setMinimumSize(preferredSize()); - setMaximumSize(preferredSize()); -} - -void LetterScroll::mousePressEvent(QGraphicsSceneMouseEvent *e) -{ - gotoPosition(e->pos().y()); - marker->show(); -} - -void LetterScroll::mouseMoveEvent(QGraphicsSceneMouseEvent *e) -{ - gotoPosition(e->pos().y()); -} - -void LetterScroll::mouseReleaseEvent(QGraphicsSceneMouseEvent *) -{ - marker->hide(); - lastChar = 0; -} - -void LetterScroll::gotoPosition(int y) -{ - static const char *letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ#"; - - // assume monospaced letters - int len = strlen(letters); - int index = y / (size().height() / len); - int center = marker->boundingRect().height() / 2; - - int value = qBound(-center, y - center, size().height() - center); - marker->setY(value); - - if (index >= 0 && index < len) { - const char c = letters[index]; - markerLabel->setText(QString(c)); - marker->setOpacity(list->containsLetter(c) ? 1.0 : 0.3); - - if (lastChar != c) { - lastChar = c; - emit letterPressed(c); - } - } -} - - -class ContactLabel : public QGraphicsWidget -{ - Q_OBJECT - -public: - ContactLabel(const QString &text, QGraphicsItem *parent = 0); - - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, - QWidget *widget = 0); - -private: - QString text; - QPixmap divisor; - QColor color; -}; - -ContactLabel::ContactLabel(const QString &text, QGraphicsItem *parent) - : QGraphicsWidget(parent), - text(text), - divisor(Resource::pixmap("list_divisor.png")), - color(Resource::stringValue("contact-list/label-font-color")) -{ - QFont font(Resource::stringValue("default/font-family")); - font.setPixelSize(Resource::intValue("contact-list/label-font-size")); - setFont(font); - - setMinimumHeight(Resource::intValue("contact-list/label-height")); -} - -void ContactLabel::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, - QWidget *widget) -{ - Q_UNUSED(option); - Q_UNUSED(widget); - - painter->setPen(color); - painter->setFont(font()); - painter->drawText(size().width() * 0.03, - size().height() * 0.80, text); - - painter->drawPixmap(0, size().height() - divisor.height(), divisor); -} - - - -class ContactPhoto : public QGraphicsWidget -{ - Q_OBJECT - -public: - ContactPhoto(int index, ContactList *list); - - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, - QWidget *widget = 0); - -protected: - void mousePressEvent(QGraphicsSceneMouseEvent *e); - void mouseReleaseEvent(QGraphicsSceneMouseEvent *e); - -private: - int m_index; - Label *m_label; - ContactList *m_list; - PixmapWidget *m_photo; - QColor m_color; -}; - -ContactPhoto::ContactPhoto(int index, ContactList *list) - : QGraphicsWidget(list), - m_index(index), - m_list(list), - m_color(Resource::stringValue("contact-list/thumb-bg-color")) -{ - m_label = new Label(); - - const QString &photoPath = ContactResource::photo(index); - m_photo = new PixmapWidget(Resource::pixmap(photoPath)); - - QFont font(Resource::stringValue("default/font-family")); - font.setBold(true); - font.setPixelSize(Resource::intValue("contact-list/thumb-font-size")); - - m_label->setFont(font); - m_label->setText(ContactResource::name(index)); - - QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical); - layout->setSpacing(1); - layout->setContentsMargins(3, 3, 3, 3); - layout->addItem(m_photo); - layout->addItem(m_label); - - setLayout(layout); - - setMinimumHeight(Resource::intValue("contact-list/thumb-height")); -} - -void ContactPhoto::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, - QWidget *widget) -{ - Q_UNUSED(option); - Q_UNUSED(widget); - - painter->fillRect(boundingRect(), m_color); -} - -void ContactPhoto::mousePressEvent(QGraphicsSceneMouseEvent *) -{ - -} - -void ContactPhoto::mouseReleaseEvent(QGraphicsSceneMouseEvent *) -{ - emit m_list->contactClicked(m_index); -} - - - -class ContactListItem : public QGraphicsWidget -{ -public: - ContactListItem(int index, ContactList *parent); - - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, - QWidget *widget = 0); - -protected: - void mousePressEvent(QGraphicsSceneMouseEvent *e); - void mouseReleaseEvent(QGraphicsSceneMouseEvent *e); - -private: - int m_index; - QFont m_font; - QString m_text; - QString m_phone; - ContactList *m_list; - QPixmap m_icon; - QPixmap m_divisor; - int m_nameFontSize; - int m_phoneFontSize; -}; - - -ContactListItem::ContactListItem(int index, ContactList *list) - : QGraphicsWidget(list), - m_index(index), - m_list(list), - m_divisor(Resource::pixmap("list_divisor.png")), - m_nameFontSize(Resource::intValue("contact-list/list-item-name-font-size")), - m_phoneFontSize(Resource::intValue("contact-list/list-item-phone-font-size")) -{ - m_font = QFont(Resource::stringValue("default/font-family")); - setMinimumHeight(Resource::intValue("contact-list/list-item-height")); - - m_text = ContactResource::name(index); - m_phone = ContactResource::phone(index); - - // use random icons - switch(qrand() % 3) { - case 0 : - m_icon = Resource::pixmap("list_icon_chat.png"); - break; - case 1: - m_icon = Resource::pixmap("list_icon_world.png"); - break; - default: - m_icon = QPixmap(); - break; - } -} - -void ContactListItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, - QWidget *widget) -{ - Q_UNUSED(option); - Q_UNUSED(widget); - - const int w = boundingRect().width(); - const int h = boundingRect().height(); - - painter->setPen(Qt::white); - - m_font.setBold(true); - m_font.setPixelSize(m_nameFontSize); - painter->setFont(m_font); - painter->drawText(w * 0.12, h * 0.40, m_text); - - m_font.setBold(false); - m_font.setPixelSize(m_phoneFontSize); - painter->setFont(m_font); - painter->drawText(w * 0.12, h * 0.75, m_phone); - - if (!m_icon.isNull()) - painter->drawPixmap(0, h * 0.15, m_icon); - - painter->drawPixmap(0, boundingRect().height() - m_divisor.height(), m_divisor); -} - -void ContactListItem::mousePressEvent(QGraphicsSceneMouseEvent *) -{ - -} - -void ContactListItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *) -{ - emit m_list->contactClicked(m_index); -} - - - - -ContactList::ContactList(QGraphicsItem *parent) - : QGraphicsWidget(parent) -{ - setFlag(QGraphicsItem::ItemHasNoContents); - - QGraphicsWidget *contents = new QGraphicsWidget(this); - - PixmapWidget *scroll = new LetterScroll(this); - connect(scroll, SIGNAL(letterPressed(char)), SLOT(letterPressed(char))); - - QGraphicsLinearLayout *contentsLayout = new QGraphicsLinearLayout(Qt::Vertical); - contentsLayout->setSpacing(0); - contentsLayout->setContentsMargins(7, 0, 7, 0); - - QGraphicsLinearLayout * topLayout = new QGraphicsLinearLayout(Qt::Horizontal); - topLayout->setSpacing(3); - topLayout->setContentsMargins(0, 0, 0, 0); - topLayout->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - - const int totalContacts = ContactResource::count(); - - // just get 3 contacts with photo - for (int i = 0, k = 0; k < 3 && i < totalContacts; i++) { - const QString &photo = ContactResource::photo(i); - - if (!photo.isEmpty()) { - k++; - topLayout->addItem(new ContactPhoto(i, this)); - } - } - - contentsLayout->addItem(topLayout); - - char lastChar = 0; - for (int i = 0; i < totalContacts; i++) { - const QString &name = ContactResource::name(i); - - if (name.isEmpty()) - continue; - - const char c = name.at(0).toLatin1(); - - if (lastChar != c) { - lastChar = c; - ContactLabel *label = new ContactLabel(QString(c)); - contentsLayout->addItem(label); - m_labels[c] = label; - } - - contentsLayout->addItem(new ContactListItem(i, this)); - } - - contents->setLayout(contentsLayout); - - m_scrollArea = new ScrollArea(); - m_scrollArea->setWidget(contents); - - scroll->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding); - m_scrollArea->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - - QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Horizontal); - layout->setSpacing(0); - layout->setContentsMargins(0, 0, 0, 0); - - layout->addItem(m_scrollArea); - layout->addItem(scroll); - setLayout(layout); -} - -bool ContactList::containsLetter(char c) const -{ - return m_labels.contains(c); -} - -void ContactList::letterPressed(char c) -{ - if (m_labels.contains(c)) { - m_scrollArea->stopKinetic(); - // XXX: check first letter - m_scrollArea->setOffset(c == 'A' ? 0 : m_labels[c]->y()); - } -} - -#include "contactlist.moc" diff --git a/hyperui/contactlist.h b/hyperui/contactlist.h deleted file mode 100644 index 096cc30..0000000 --- a/hyperui/contactlist.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: openBossa - INdT (renato.chencarek@openbossa.org) -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** the openBossa stream from INdT (renato.chencarek@openbossa.org). -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef CONTACTLIST_H -#define CONTACTLIST_H - -#include - -#include "view.h" - -class ScrollArea; -class ContactPhoto; -class ContactListItem; - - -class ContactList : public QGraphicsWidget -{ - Q_OBJECT - -public: - ContactList(QGraphicsItem *parent = 0); - - bool containsLetter(char c) const; - -signals: - void contactClicked(int index); - -protected slots: - void letterPressed(char c); - -private: - ScrollArea *m_scrollArea; - QHash m_labels; - - friend class ContactPhoto; - friend class ContactListItem; -}; - -#endif diff --git a/hyperui/contactresource.cpp b/hyperui/contactresource.cpp deleted file mode 100644 index 348627d..0000000 --- a/hyperui/contactresource.cpp +++ /dev/null @@ -1,123 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: openBossa - INdT (renato.chencarek@openbossa.org) -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** the openBossa stream from INdT (renato.chencarek@openbossa.org). -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include - -#include "contactresource.h" - - -ContactResource::ContactResource() -{ - QFile fp(":/contactlist.txt"); - fp.open(QIODevice::ReadOnly); - - QTextStream buffer(&fp); - - QHash values; - - while (!buffer.atEnd()) { - const QString &line = buffer.readLine().trimmed(); - - if (line.isEmpty()) - continue; - - const QStringList &parts = line.split(':'); - - values[0] = parts[0]; - values[1] = parts[1]; - - if (parts[2].isEmpty()) { - values[2] = QString(); - values[3] = QString(); - } else { - values[2] = QString("list_photo_%1").arg(parts[2]); - values[3] = QString("call_photo_%1").arg(parts[2]); - } - - m_values.append(values); - } - - fp.close(); -} - -ContactResource::~ContactResource() -{ - -} - -QString ContactResource::data(int index, int role) const -{ - if (index < 0 || index >= m_values.count()) - return QString(); - else - return m_values[index].value(role, QString()); -} - -ContactResource *ContactResource::instance() -{ - static ContactResource result; - return &result; -} - -int ContactResource::count() -{ - return instance()->m_values.count(); -} - -QString ContactResource::name(int index) -{ - return instance()->data(index, 0); -} - -QString ContactResource::phone(int index) -{ - return instance()->data(index, 1); -} - -QString ContactResource::photo(int index, PhotoSize type) -{ - return instance()->data(index, (type == SmallPhoto) ? 2 : 3); -} - -int ContactResource::indexFromPhone(const QString &phone) -{ - ContactResource *d = instance(); - - int total = count(); - for (int i = 0; i < total; i++) { - if (phone == d->data(i, 1)) - return i; - } - - return -1; -} diff --git a/hyperui/contactresource.h b/hyperui/contactresource.h deleted file mode 100644 index 10add4f..0000000 --- a/hyperui/contactresource.h +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: openBossa - INdT (renato.chencarek@openbossa.org) -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** the openBossa stream from INdT (renato.chencarek@openbossa.org). -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef CONTACTRESOURCE_H -#define CONTACTRESOURCE_H - -#include -#include - -class ContactResource -{ -public: - enum PhotoSize { SmallPhoto, LargePhoto }; - - static int count(); - - static QString name(int index); - static QString phone(int index); - static QString photo(int index, PhotoSize type = SmallPhoto); - - static int indexFromPhone(const QString &phone); - -private: - ContactResource(); - ~ContactResource(); - static ContactResource *instance(); - - QString data(int index, int role) const; - - QList > m_values; -}; - -#endif diff --git a/hyperui/data/hyperui.desktop b/hyperui/data/hyperui.desktop new file mode 100644 index 0000000..adff5bc --- /dev/null +++ b/hyperui/data/hyperui.desktop @@ -0,0 +1,8 @@ +[Desktop Entry] +Type=Application +Name=HyperUI +Categories=Applications +Exec=/usr/bin/hyperui +Icon=hyperui +X-Icon-path=/usr/share/pixmaps/ +X-Osso-Type=application/x-executable diff --git a/hyperui/data/hyperui.png b/hyperui/data/hyperui.png new file mode 100644 index 0000000..09f0a28 Binary files /dev/null and b/hyperui/data/hyperui.png differ diff --git a/hyperui/data/hyperui.svg b/hyperui/data/hyperui.svg new file mode 100644 index 0000000..b5b4706 --- /dev/null +++ b/hyperui/data/hyperui.svg @@ -0,0 +1,177 @@ + + + +]> + + + + + + diff --git a/hyperui/draggablepreview.cpp b/hyperui/draggablepreview.cpp deleted file mode 100644 index 4ffe814..0000000 --- a/hyperui/draggablepreview.cpp +++ /dev/null @@ -1,210 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: openBossa - INdT (renato.chencarek@openbossa.org) -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** the openBossa stream from INdT (renato.chencarek@openbossa.org). -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include -#include - -#include "dataresource.h" -#include "draggablepreview.h" - - -#define SCALED_POS(sw, sh, scale) \ - QPointF(qRound(sw * 0.5 - (sw * 0.5 + m_leftMargin) * scale), \ - qRound(sh - (sh + m_topMargin) * 0.5 * scale)) - - -DraggablePreview::DraggablePreview(QGraphicsWidget *item, const QSize &screenSize, - QGraphicsItem *parent) - : QGraphicsWidget(parent), - m_item(item), - m_screenSize(screenSize), - m_border(Resource::intValue("draggable-preview/border")), - m_topMargin(Resource::intValue("draggable-preview/margin-top")), - m_leftMargin(Resource::intValue("draggable-preview/margin-left")), - m_maximizeRange(Resource::doubleValue("draggable-preview/maximize-range")), - m_minimumOffset(Resource::intValue("draggable-preview/minimum-offset")) -{ - setFlag(QGraphicsItem::ItemHasNoContents); - - setupInterface(); -} - -void DraggablePreview::setupInterface() -{ - // add background item - QPixmap backgroundPixmap = Resource::pixmap("screen_unlock.png"); - m_background = new QGraphicsPixmapItem(backgroundPixmap, this); - m_background->setPos(0, 0); - m_background->setFlag(QGraphicsItem::ItemStacksBehindParent); - m_background->setShapeMode(QGraphicsPixmapItem::BoundingRectShape); - - // add embedded widget - m_item->setParentItem(this); - m_item->setFlag(QGraphicsItem::ItemStacksBehindParent); - m_item->setPos(m_leftMargin + m_border, m_topMargin + m_border); - m_item->resize(m_screenSize); - - // resize to the background size - resize(backgroundPixmap.size()); - - const int sw = m_screenSize.width(); - const int sh = m_screenSize.height(); - - qreal minimumScale = Resource::doubleValue("draggable-preview/minimum-scale"); - qreal draggableScale = Resource::doubleValue("draggable-preview/first-zoom-scale"); - - m_draggablePos = SCALED_POS(sw, sh, draggableScale); - QPointF minimumPos(SCALED_POS(sw, sh, minimumScale)); - QPointF maximumPos(-m_leftMargin - m_border, -m_topMargin - m_border); - - m_maximumOffset = minimumPos.y(); - - QStateMachine *machine = new QStateMachine(this); - - m_minimizedState = new QState(); - m_minimizedState->assignProperty(this, "pos", minimumPos); - m_minimizedState->assignProperty(this, "scale", minimumScale); - - m_draggableState = new QState(); - m_draggableState->assignProperty(this, "pos", m_draggablePos); - m_draggableState->assignProperty(this, "scale", draggableScale); - - m_maximizedState = new QState(); - m_maximizedState->assignProperty(this, "pos", maximumPos); - m_maximizedState->assignProperty(this, "scale", 1.0); - - int restoreTime = Resource::intValue("draggable-preview/restore-time"); - int maximizeTime = Resource::intValue("draggable-preview/maximize-time"); - int firstZoomTime = Resource::intValue("draggable-preview/first-zoom-time"); - - QSignalTransition *transition; - - // create minimized > draggable state transition - transition = m_minimizedState->addTransition(this, SIGNAL(draggableStarted()), - m_draggableState); - transition->addAnimation(createAnimation(firstZoomTime)); - - // create draggable > minimized state transition - transition = m_draggableState->addTransition(this, SIGNAL(minimizeStarted()), - m_minimizedState); - transition->addAnimation(createAnimation(restoreTime)); - - // create draggable > maximized state transition - transition = m_draggableState->addTransition(this, SIGNAL(maximizeStarted()), - m_maximizedState); - transition->addAnimation(createAnimation(maximizeTime, - SLOT(onMaximizeFinished()))); - - // this is used just to update the final value when still animating - transition = m_draggableState->addTransition(this, SIGNAL(draggableUpdate()), - m_draggableState); - transition->addAnimation(createAnimation(0)); - - // add states - machine->addState(m_minimizedState); - machine->addState(m_draggableState); - machine->addState(m_maximizedState); - - setPos(minimumPos); - setScale(minimumScale); - - machine->setInitialState(m_minimizedState); - machine->start(); -} - -QAbstractAnimation *DraggablePreview::createAnimation(int time, const char *slot) -{ - QParallelAnimationGroup *result = new QParallelAnimationGroup(); - - QPropertyAnimation *posAnimation = new QPropertyAnimation(this, "pos"); - posAnimation->setEasingCurve(QEasingCurve::InSine); - posAnimation->setDuration(time); - - QPropertyAnimation *scaleAnimation = new QPropertyAnimation(this, "scale"); - scaleAnimation->setEasingCurve(QEasingCurve::InSine); - scaleAnimation->setDuration(time); - - result->addAnimation(posAnimation); - result->addAnimation(scaleAnimation); - - if (slot) - connect(result, SIGNAL(finished()), slot); - - return result; -} - -void DraggablePreview::onMaximizeFinished() -{ - // hide background - m_background->hide(); - - // move menu to front to not block events - m_item->setFlag(QGraphicsItem::ItemStacksBehindParent, false); - - emit maximizeFinished(); - - // detach from parent to avoid inherit transformations - m_item->setParentItem(0); - m_item->setPos(0, 0); -} - -void DraggablePreview::mousePressEvent(QGraphicsSceneMouseEvent *e) -{ - m_lastPos = e->scenePos(); - m_draggableState->assignProperty(this, "pos", m_draggablePos); - emit draggableStarted(); -} - -void DraggablePreview::mouseMoveEvent(QGraphicsSceneMouseEvent *e) -{ - const int offset = qRound(pos().y() + e->scenePos().y() - m_lastPos.y()); - m_lastPos = e->scenePos(); - - const int fy = qBound(m_minimumOffset, offset, m_maximumOffset); - - if (fy < m_draggablePos.y()) { - m_draggableState->assignProperty(this, "pos", - QPointF(m_draggablePos.x(), fy)); - emit draggableUpdate(); - } -} - -void DraggablePreview::mouseReleaseEvent(QGraphicsSceneMouseEvent *) -{ - if (pos().y() < m_minimumOffset + m_maximizeRange) - emit maximizeStarted(); - else - emit minimizeStarted(); -} diff --git a/hyperui/draggablepreview.h b/hyperui/draggablepreview.h deleted file mode 100644 index 656f556..0000000 --- a/hyperui/draggablepreview.h +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: openBossa - INdT (renato.chencarek@openbossa.org) -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** the openBossa stream from INdT (renato.chencarek@openbossa.org). -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef DRAGGABLEPREVIEW_H -#define DRAGGABLEPREVIEW_H - -#include - -QT_BEGIN_NAMESPACE -class QState; -class QAbstractAnimation; -QT_END_NAMESPACE - - -class DraggablePreview : public QGraphicsWidget -{ - Q_OBJECT - -public: - DraggablePreview(QGraphicsWidget *item, const QSize &screenSize, - QGraphicsItem *parent = 0); - -signals: - void draggableUpdate(); - void draggableStarted(); - void minimizeStarted(); - void maximizeStarted(); - void maximizeFinished(); - -protected: - void mousePressEvent(QGraphicsSceneMouseEvent *e); - void mouseMoveEvent(QGraphicsSceneMouseEvent *e); - void mouseReleaseEvent(QGraphicsSceneMouseEvent *e); - -private slots: - void onMaximizeFinished(); - -private: - void setupInterface(); - QAbstractAnimation *createAnimation(int time, const char *slot = 0); - - QGraphicsWidget *m_item; - QSize m_screenSize; - - int m_border; - int m_topMargin; - int m_leftMargin; - int m_maximizeRange; - - QPointF m_lastPos; - QPointF m_draggablePos; - int m_minimumOffset; - int m_maximumOffset; - - QGraphicsPixmapItem *m_background; - - QState *m_minimizedState; - QState *m_draggableState; - QState *m_maximizedState; -}; - - -#endif diff --git a/hyperui/global.cpp b/hyperui/global.cpp deleted file mode 100644 index 784cb6b..0000000 --- a/hyperui/global.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: openBossa - INdT (renato.chencarek@openbossa.org) -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** the openBossa stream from INdT (renato.chencarek@openbossa.org). -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -#include "global.h" - - -void drawTextWithShadow(QPainter *painter, int x, int y, - const QString &text, const QColor &color) -{ - painter->setPen(QColor(30, 30, 30)); - painter->drawText(x + 2, y + 2, text); - - painter->setPen(color); - painter->drawText(x, y, text); -} - -QPropertyAnimation *propertyAnimation(QObject *obj, const char *property, int time, - QEasingCurve::Type type) -{ - QPropertyAnimation *result = new QPropertyAnimation(obj, property); - result->setDuration(time); - result->setEasingCurve(type); - return result; -} diff --git a/hyperui/global.h b/hyperui/global.h deleted file mode 100644 index 7fb0237..0000000 --- a/hyperui/global.h +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: openBossa - INdT (renato.chencarek@openbossa.org) -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** the openBossa stream from INdT (renato.chencarek@openbossa.org). -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef GLOBAL_H -#define GLOBAL_H - -#include -#include -#include - -class QPainter; -class QPropertyAnimation; - -void drawTextWithShadow(QPainter *painter, int x, int y, - const QString &text, const QColor &color); - -QPropertyAnimation *propertyAnimation(QObject *obj, const char *property, int time, - QEasingCurve::Type type = QEasingCurve::Linear); - -#endif diff --git a/hyperui/hyperui.desktop b/hyperui/hyperui.desktop deleted file mode 100644 index adff5bc..0000000 --- a/hyperui/hyperui.desktop +++ /dev/null @@ -1,8 +0,0 @@ -[Desktop Entry] -Type=Application -Name=HyperUI -Categories=Applications -Exec=/usr/bin/hyperui -Icon=hyperui -X-Icon-path=/usr/share/pixmaps/ -X-Osso-Type=application/x-executable diff --git a/hyperui/hyperui.png b/hyperui/hyperui.png deleted file mode 100644 index 09f0a28..0000000 Binary files a/hyperui/hyperui.png and /dev/null differ diff --git a/hyperui/hyperui.svg b/hyperui/hyperui.svg deleted file mode 100644 index b5b4706..0000000 --- a/hyperui/hyperui.svg +++ /dev/null @@ -1,177 +0,0 @@ - - - -]> - - - - - - diff --git a/hyperui/main.cpp b/hyperui/main.cpp deleted file mode 100644 index ee4324e..0000000 --- a/hyperui/main.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: openBossa - INdT (renato.chencarek@openbossa.org) -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** the openBossa stream from INdT (renato.chencarek@openbossa.org). -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include - -#include "system.h" -#include "dataresource.h" -#include "mainwindow.h" - - -int main(int argc, char **argv) -{ -#ifdef USE_RASTER_GRAPHICS_SYSTEM - QApplication::setGraphicsSystem("raster"); -#endif - - Resource::setIniFile(":/hyperui.ini"); - Resource::setPixmapPrefix(":/images/"); - - QApplication app(argc, argv); - - const int width = Resource::intValue("window/width"); - const int height = Resource::intValue("window/height"); - - QGraphicsScene scene; - QGraphicsView view(&scene); - - view.setWindowTitle(QObject::tr("Hyper UI")); - view.setFrameShape(QFrame::NoFrame); - view.setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - view.setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - view.setViewportUpdateMode(QGraphicsView::BoundingRectViewportUpdate); - - view.resize(width, height); - scene.setSceneRect(0, 0, width, height); - - MainWindow mainWindow; - scene.addItem(&mainWindow); - mainWindow.setGeometry(0, 0, width, height); - - System::setViewMode(&view, System::PortraitMode); - -#if defined(Q_OS_SYMBIAN) || defined(Q_WS_MAEMO_5) - view.showFullScreen(); -#else - view.setFixedSize(width, height); - view.show(); -#endif - - return app.exec(); -} diff --git a/hyperui/mainwindow.cpp b/hyperui/mainwindow.cpp deleted file mode 100644 index 5006917..0000000 --- a/hyperui/mainwindow.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: openBossa - INdT (renato.chencarek@openbossa.org) -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** the openBossa stream from INdT (renato.chencarek@openbossa.org). -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include - -#include "dataresource.h" -#include "mainwindow.h" -#include "pageview.h" -#include "menuview.h" -#include "clockwidget.h" -#include "draggablepreview.h" - - -MainWindow::MainWindow(QGraphicsItem *parent) - : QGraphicsWidget(parent), - m_background(Resource::pixmap("background.png")) -{ - m_clockWidget = new ClockWidget(this); - m_clockWidget->setPos(0, 0); - - // cache the clock into a pixmap to improve drag performance - m_clockWidget->setCacheMode(QGraphicsItem::ItemCoordinateCache); - - const int width = Resource::intValue("window/width"); - const int height = Resource::intValue("window/height"); - - m_overlay = new QGraphicsRectItem(this); - m_overlay->setBrush(QColor(0, 0, 0, 100)); - m_overlay->setRect(0, 0, width, height); - m_overlay->hide(); - - m_mainView = new PageView(); - m_mainView->add(new MenuView()); - m_preview = new DraggablePreview(m_mainView, QSize(width, height), this); - connect(m_preview, SIGNAL(draggableStarted()), SLOT(onDragModeIn())); - connect(m_preview, SIGNAL(minimizeStarted()), SLOT(onDragModeOut())); - connect(m_preview, SIGNAL(maximizeFinished()), SLOT(onMaximizeFinished())); - - QGraphicsSimpleTextItem *phoneLabel = - new QGraphicsSimpleTextItem(tr("T-Mobile"), this); - - m_hourLabel = new QGraphicsSimpleTextItem(this); - - QFont labelFont(Resource::stringValue("default/font-family")); - labelFont.setBold(true); - labelFont.setPixelSize(Resource::intValue("topbar/font-size")); - phoneLabel->setFont(labelFont); - phoneLabel->setBrush(QColor(Resource::stringValue("default/font-color"))); - - m_hourLabel->setFont(labelFont); - m_hourLabel->setBrush(QColor(Resource::stringValue("default/font-color"))); - - QGraphicsPixmapItem *iconBattery = - new QGraphicsPixmapItem(Resource::pixmap("topbar_battery.png"), this); - - QGraphicsPixmapItem *icon3G = - new QGraphicsPixmapItem(Resource::pixmap("topbar_3g.png"), this); - - QGraphicsPixmapItem *iconNetwork = - new QGraphicsPixmapItem(Resource::pixmap("topbar_network.png"), this); - - m_hourLabel->setPos(Resource::value("topbar/hour-label-pos").toPoint()); - phoneLabel->setPos(Resource::value("topbar/label-pos").toPoint()); - iconNetwork->setPos(Resource::value("topbar/icon-network-pos").toPoint()); - icon3G->setPos(Resource::value("topbar/icon-3g-pos").toPoint()); - iconBattery->setPos(Resource::value("topbar/icon-battery-pos").toPoint()); - - updateTime(); - createDummyDailyEvents(); - - // update time each 30 seconds - startTimer(30000); -} - -void MainWindow::timerEvent(QTimerEvent *event) -{ - Q_UNUSED(event); - updateTime(); -} - -void MainWindow::updateTime() -{ - m_hourLabel->setText(QDateTime::currentDateTime().toString("hh:mm")); -} - -void MainWindow::onDragModeIn() -{ - m_overlay->show(); -} - -void MainWindow::onDragModeOut() -{ - m_overlay->hide(); -} - -void MainWindow::onMaximizeFinished() -{ - m_overlay->hide(); - m_clockWidget->hide(); -} - -void MainWindow::createDummyDailyEvents() -{ - QColor color1("#80A2BF"); - QColor color2("#FF5E74"); - QColor color3("#A05284"); - - const QDate &cd = QDate::currentDate(); - - m_clockWidget->addEvent(QDateTime(cd, QTime(15, 20, 0)), - QDateTime(cd, QTime(16, 30, 0)), color1, - tr("Development Meeting")); - m_clockWidget->addEvent(QDateTime(cd, QTime(16, 34, 0)), - QDateTime(cd, QTime(17, 15, 0)), color1, - tr("Development Meeting")); - m_clockWidget->addEvent(QDateTime(cd, QTime(17, 19, 0)), - QDateTime(cd, QTime(18, 17, 0)), color1, - tr("Development Meeting")); - m_clockWidget->addEvent(QDateTime(cd, QTime(18, 25, 0)), - QDateTime(cd, QTime(18, 53, 0)), color1, - tr("Development Meeting")); - - m_clockWidget->addEvent(QDateTime(cd, QTime(18, 40, 0)), - QDateTime(cd, QTime(19, 20, 0)), color3, - tr("Project Presentation")); - m_clockWidget->addEvent(QDateTime(cd, QTime(19, 24, 0)), - QDateTime(cd, QTime(20, 20, 0)), color3, - tr("Project Presentation")); - - m_clockWidget->addEvent(QDateTime(cd, QTime(19, 55, 0)), - QDateTime(cd, QTime(20, 45, 0)), color2, - tr("Dinner with Managers")); - m_clockWidget->addEvent(QDateTime(cd, QTime(21, 25, 0)), - QDateTime(cd, QTime(22, 20, 0)), color2, - tr("Dinner with Managers")); -} - -void MainWindow::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, - QWidget *widget) -{ - Q_UNUSED(option); - Q_UNUSED(widget); - - painter->drawPixmap(0, 0, m_background); -} diff --git a/hyperui/mainwindow.h b/hyperui/mainwindow.h deleted file mode 100644 index f945e44..0000000 --- a/hyperui/mainwindow.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: openBossa - INdT (renato.chencarek@openbossa.org) -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** the openBossa stream from INdT (renato.chencarek@openbossa.org). -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef MAINWINDOW_H -#define MAINWINDOW_H - -#include - -class PageView; -class ClockWidget; -class DraggablePreview; - -QT_BEGIN_NAMESPACE -class QPainter; -class QGraphicsRectItem; -class QStyleOptionGraphicsItem; -QT_END_NAMESPACE - - -class MainWindow : public QGraphicsWidget -{ - Q_OBJECT - -public: - MainWindow(QGraphicsItem *parent = 0); - - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, - QWidget *widget = 0); - -protected: - void timerEvent(QTimerEvent *event); - -private slots: - void onDragModeIn(); - void onDragModeOut(); - void onMaximizeFinished(); - -private: - void updateTime(); - void createDummyDailyEvents(); - - QPixmap m_background; - PageView *m_mainView; - ClockWidget *m_clockWidget; - DraggablePreview *m_preview; - QGraphicsRectItem *m_overlay; - QGraphicsSimpleTextItem *m_hourLabel; -}; - -#endif diff --git a/hyperui/menuview.cpp b/hyperui/menuview.cpp deleted file mode 100644 index 4eda89d..0000000 --- a/hyperui/menuview.cpp +++ /dev/null @@ -1,201 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: openBossa - INdT (renato.chencarek@openbossa.org) -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** the openBossa stream from INdT (renato.chencarek@openbossa.org). -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include - -#include "dataresource.h" -#include "global.h" -#include "button.h" -#include "menuview.h" -#include "phoneview.h" - - -#define FPOS(i, j) QPointF(m_leftMargin + m_vSpacing * i, \ - m_topMargin + m_hSpacing * j) - -#define FNPOS(i, j) QPointF(m_vSpacing * -(i + 3), \ - m_topMargin + m_hSpacing * (j + 2)) - - -MenuView::MenuView(QGraphicsItem *parent) - : View(parent) -{ - setTitle(tr("MENU")); - setFlag(QGraphicsItem::ItemHasNoContents); - setFlag(QGraphicsItem::ItemClipsChildrenToShape); - - // read settings - m_topMargin = Resource::intValue("menu-view/margin-top"); - m_leftMargin = Resource::intValue("menu-view/margin-left"); - m_vSpacing = Resource::intValue("menu-view/spacing-vertical"); - m_hSpacing = Resource::intValue("menu-view/spacing-horizontal"); - m_mainIconIPos = Resource::value("menu-view/main-icon-pos").toPoint(); - m_mainIconFPos = Resource::value("menu-view/main-icon-out-pos").toPoint(); - - // initialize interface - m_btnTwitter = addIcon(Resource::pixmap("menu_bt_twitter.png"), FPOS(0, 0)); - - m_btnEmail = addIcon(Resource::pixmap("menu_bt_email.png"), FPOS(0, 2)); - m_btnSettings = addIcon(Resource::pixmap("menu_bt_settings.png"), FPOS(1, 1)); - m_btnMusic = addIcon(Resource::pixmap("menu_bt_music.png"), FPOS(2, 0)); - - m_btnNavigation = addIcon(Resource::pixmap("menu_bt_navigation.png"), FPOS(0, 4)); - m_btnChat = addIcon(Resource::pixmap("menu_bt_chat.png"), FPOS(1, 3)); - m_btnGames = addIcon(Resource::pixmap("menu_bt_games.png"), FPOS(2, 2)); - m_btnWeb = addIcon(Resource::pixmap("menu_bt_web.png"), FPOS(3, 1)); - - m_btnFolder = addIcon(Resource::pixmap("menu_bt_folder.png"), FPOS(1, 5)); - m_btnCalendar = addIcon(Resource::pixmap("menu_bt_calendar.png"), FPOS(2, 4)); - m_btnCamera = addIcon(Resource::pixmap("menu_bt_camera.png"), FPOS(3, 3)); - - m_btnPhone = addIcon(Resource::pixmap("menu_bt_phone.png"), - m_mainIconIPos, SLOT(onPhoneClicked())); - - createStateMachine(); - - // keep always alive to reduce transition time - m_phoneView = new PhoneView(); - m_phoneView->setParent(this); -} - -Button *MenuView::addIcon(const QPixmap &pixmap, const QPointF &pos, - const char *slot) -{ - Button *button = new Button(pixmap, this); - button->setPos(pos); - - if (slot) - connect(button, SIGNAL(clicked()), slot); - - return button; -} - -void MenuView::onPhoneClicked() -{ - pageView()->add(m_phoneView, true); -} - -void MenuView::createStateMachine() -{ - QStateMachine *machine = new QStateMachine(this); - - QState *state1 = new QState(); - state1->assignProperty(m_btnTwitter, "pos", FNPOS(2, 3)); - state1->assignProperty(m_btnEmail, "pos", FNPOS(2, 5)); - state1->assignProperty(m_btnSettings, "pos", FNPOS(1, 4)); - state1->assignProperty(m_btnMusic, "pos", FNPOS(0, 3)); - state1->assignProperty(m_btnNavigation, "pos", FNPOS(2, 7)); - state1->assignProperty(m_btnChat, "pos", FNPOS(1, 6)); - state1->assignProperty(m_btnGames, "pos", FNPOS(0, 5)); - state1->assignProperty(m_btnWeb, "pos", FNPOS(-1, 4)); - state1->assignProperty(m_btnFolder, "pos", FNPOS(1, 8)); - state1->assignProperty(m_btnCalendar, "pos", FNPOS(0, 7)); - state1->assignProperty(m_btnCamera, "pos", FNPOS(-1, 6)); - state1->assignProperty(m_btnPhone, "pos", m_mainIconFPos); - - QState *state2 = new QState(); - state2->assignProperty(m_btnTwitter, "pos", FPOS(0, 0)); - state2->assignProperty(m_btnEmail, "pos", FPOS(0, 2)); - state2->assignProperty(m_btnSettings, "pos", FPOS(1, 1)); - state2->assignProperty(m_btnMusic, "pos", FPOS(2, 0)); - state2->assignProperty(m_btnNavigation, "pos", FPOS(0, 4)); - state2->assignProperty(m_btnChat, "pos", FPOS(1, 3)); - state2->assignProperty(m_btnGames, "pos", FPOS(2, 2)); - state2->assignProperty(m_btnWeb, "pos", FPOS(3, 1)); - state2->assignProperty(m_btnFolder, "pos", FPOS(1, 5)); - state2->assignProperty(m_btnCalendar, "pos", FPOS(2, 4)); - state2->assignProperty(m_btnCamera, "pos", FPOS(3, 3)); - state2->assignProperty(m_btnPhone, "pos", m_mainIconIPos); - - QSignalTransition *transition1 = - state1->addTransition(this, SIGNAL(transitionInStarted()), state2); - transition1->addAnimation(createInOutAnimation(false)); - - QSignalTransition *transition2 = - state2->addTransition(this, SIGNAL(transitionOutStarted()), state1); - transition2->addAnimation(createInOutAnimation(true)); - - machine->addState(state1); - machine->addState(state2); - - machine->setInitialState(state2); - machine->start(); -} - -QAbstractAnimation *MenuView::createInOutAnimation(bool out) -{ - QParallelAnimationGroup *result = new QParallelAnimationGroup(); - - const int t = 200; - const int d = 50; - - if (!out) { - const QEasingCurve::Type ec = QEasingCurve::OutQuart; - - result->addAnimation(propertyAnimation(m_btnWeb, "pos", t, ec)); - result->addAnimation(propertyAnimation(m_btnMusic, "pos", t + d, ec)); - result->addAnimation(propertyAnimation(m_btnCamera, "pos", t + 2 * d, ec)); - result->addAnimation(propertyAnimation(m_btnGames, "pos", t + 3 * d, ec)); - result->addAnimation(propertyAnimation(m_btnSettings, "pos", t + 4 * d, ec)); - result->addAnimation(propertyAnimation(m_btnTwitter, "pos", t + 5 * d, ec)); - result->addAnimation(propertyAnimation(m_btnCalendar, "pos", t + 6 * d, ec)); - result->addAnimation(propertyAnimation(m_btnChat, "pos", t + 7 * d, ec)); - result->addAnimation(propertyAnimation(m_btnEmail, "pos", t + 8 * d, ec)); - result->addAnimation(propertyAnimation(m_btnFolder, "pos", t + 9 * d, ec)); - result->addAnimation(propertyAnimation(m_btnNavigation, "pos", t + 10 * d, ec)); - result->addAnimation(propertyAnimation(m_btnPhone, "pos", t + 11 * d, ec)); - - connect(result, SIGNAL(finished()), SIGNAL(transitionInFinished())); - } else { - const QEasingCurve::Type ec = QEasingCurve::InQuart; - - result->addAnimation(propertyAnimation(m_btnPhone, "pos", t, ec)); - result->addAnimation(propertyAnimation(m_btnFolder, "pos", t + d, ec)); - result->addAnimation(propertyAnimation(m_btnNavigation, "pos", t + 2 * d, ec)); - result->addAnimation(propertyAnimation(m_btnCalendar, "pos", t + 3 * d, ec)); - result->addAnimation(propertyAnimation(m_btnChat, "pos", t + 4 * d, ec)); - result->addAnimation(propertyAnimation(m_btnEmail, "pos", t + 5 * d, ec)); - result->addAnimation(propertyAnimation(m_btnCamera, "pos", t + 6 * d, ec)); - result->addAnimation(propertyAnimation(m_btnGames, "pos", t + 7 * d, ec)); - result->addAnimation(propertyAnimation(m_btnSettings, "pos", t + 8 * d, ec)); - result->addAnimation(propertyAnimation(m_btnTwitter, "pos", t + 9 * d, ec)); - result->addAnimation(propertyAnimation(m_btnWeb, "pos", t + 10 * d, ec)); - result->addAnimation(propertyAnimation(m_btnMusic, "pos", t + 11 * d, ec)); - - connect(result, SIGNAL(finished()), SIGNAL(transitionOutFinished())); - } - - return result; -} diff --git a/hyperui/menuview.h b/hyperui/menuview.h deleted file mode 100644 index d557816..0000000 --- a/hyperui/menuview.h +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: openBossa - INdT (renato.chencarek@openbossa.org) -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** the openBossa stream from INdT (renato.chencarek@openbossa.org). -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef MENUVIEW_H -#define MENUVIEW_H - -#include "view.h" - -class PhoneView; -class QAbstractAnimation; - - -class MenuView : public View -{ - Q_OBJECT - -public: - MenuView(QGraphicsItem *parent = 0); - -protected slots: - void onPhoneClicked(); - -protected: - int m_vSpacing; - int m_hSpacing; - int m_topMargin; - int m_leftMargin; - QPointF m_mainIconIPos; - QPointF m_mainIconFPos; - - Button *m_btnTwitter; - Button *m_btnEmail; - Button *m_btnSettings; - Button *m_btnMusic; - Button *m_btnNavigation; - Button *m_btnChat; - Button *m_btnGames; - Button *m_btnWeb; - Button *m_btnFolder; - Button *m_btnCalendar; - Button *m_btnCamera; - Button *m_btnPhone; - - PhoneView *m_phoneView; - - void createStateMachine(); - QAbstractAnimation *createInOutAnimation(bool out); - - Button *addIcon(const QPixmap &pixmap, const QPointF &pos, - const char *slot = 0); -}; - -#endif diff --git a/hyperui/pagemenu.cpp b/hyperui/pagemenu.cpp deleted file mode 100644 index 9053ca7..0000000 --- a/hyperui/pagemenu.cpp +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: openBossa - INdT (renato.chencarek@openbossa.org) -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** the openBossa stream from INdT (renato.chencarek@openbossa.org). -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -#include "dataresource.h" -#include "pagemenu.h" - - -PageMenu::PageMenu(QGraphicsItem *parent) - : QGraphicsWidget(parent), - m_background(Resource::pixmap("top_bar_active.png")) -{ - QFont textFont = QFont(Resource::stringValue("default/font-family")); - textFont.setPixelSize(Resource::intValue("page-menu/font-size")); - setFont(textFont); - - m_textRect = Resource::value("page-menu/label-rect").toRect(); - m_fontColor = QColor(Resource::stringValue("default/font-color")); - - setMinimumSize(m_background.size()); - setMaximumSize(m_background.size()); -} - -QString PageMenu::text() const -{ - return m_text; -} - -void PageMenu::setText(const QString &text) -{ - if (m_text != text) { - m_text = text; - update(); - } -} - -void PageMenu::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, - QWidget *widget) -{ - Q_UNUSED(option); - Q_UNUSED(widget); - - painter->drawPixmap(0, 0, m_background); - - QFontMetrics metrics(font()); - const QString &elidedText = metrics.elidedText(m_text, Qt::ElideRight, - m_textRect.width()); - - painter->setFont(font()); - painter->setPen(m_fontColor); - painter->drawText(m_textRect, Qt::TextSingleLine | Qt::AlignCenter, elidedText); -} diff --git a/hyperui/pagemenu.h b/hyperui/pagemenu.h deleted file mode 100644 index efc9bf7..0000000 --- a/hyperui/pagemenu.h +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: openBossa - INdT (renato.chencarek@openbossa.org) -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** the openBossa stream from INdT (renato.chencarek@openbossa.org). -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef PAGEMENU_H -#define PAGEMENU_H - -#include -#include -#include - - -class PageMenu : public QGraphicsWidget -{ - Q_OBJECT - -public: - PageMenu(QGraphicsItem *parent = 0); - - QString text() const; - void setText(const QString &text); - - void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, - QWidget *widget = 0); - -private: - QString m_text; - QRect m_textRect; - QColor m_fontColor; - QPixmap m_background; -}; - -#endif diff --git a/hyperui/pageview.cpp b/hyperui/pageview.cpp deleted file mode 100644 index 3f3812d..0000000 --- a/hyperui/pageview.cpp +++ /dev/null @@ -1,246 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: openBossa - INdT (renato.chencarek@openbossa.org) -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** the openBossa stream from INdT (renato.chencarek@openbossa.org). -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include - -#include "dataresource.h" -#include "view.h" -#include "button.h" -#include "pagemenu.h" -#include "pageview.h" - - -class PageSlot : public QGraphicsWidget -{ - Q_OBJECT - -public: - PageSlot(QGraphicsItem *parent = 0); - - View *contents() const; - void setContents(View *contents); - -protected: - void resizeEvent(QGraphicsSceneResizeEvent *event); - -private: - View *m_contents; -}; - - -PageSlot::PageSlot(QGraphicsItem *parent) - : QGraphicsWidget(parent), - m_contents(0) -{ - setFlags(QGraphicsItem::ItemHasNoContents); -} - -View *PageSlot::contents() const -{ - return m_contents; -} - -void PageSlot::setContents(View *contents) -{ - if (m_contents && m_contents->parentItem() == this) - m_contents->setParentItem(0); - - m_contents = contents; - - if (contents) { - contents->setParentItem(this); - contents->setGeometry(0, 0, size().width(), size().height()); - } -} - -void PageSlot::resizeEvent(QGraphicsSceneResizeEvent *event) -{ - QGraphicsWidget::resizeEvent(event); - - if (m_contents) - m_contents->resize(event->newSize()); -} - - -PageView::PageView(QGraphicsItem *parent) - : QGraphicsWidget(parent), - m_isBack(false), - m_isAnimating(false) -{ - m_topOffset = Resource::intValue("page-view/margin-top"); - - setFlag(QGraphicsItem::ItemHasNoContents); - - QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical); - layout->setContentsMargins(20 * 0.75, 40, 20 * 0.75, 0); - - QGraphicsLinearLayout *topLayout = new QGraphicsLinearLayout(Qt::Horizontal); - topLayout->setContentsMargins(0, 0, 0, 0); - - setLayout(layout); - layout->addItem(topLayout); - layout->addStretch(1); - - m_menu = new PageMenu(); - - m_backButton = new Button(Resource::pixmap("top_bt_back.png"), - QPixmap(), - Resource::pixmap("top_bt_back_disabled.png")); - - m_optionsButton = new Button(Resource::pixmap("top_bt_options.png"), - QPixmap(), - Resource::pixmap("top_bt_options_disabled.png")); - - connect(m_backButton, SIGNAL(clicked()), SLOT(backClicked())); - connect(m_optionsButton, SIGNAL(clicked()), SLOT(optionsClicked())); - - topLayout->addItem(m_optionsButton); - topLayout->addStretch(1); - topLayout->addItem(m_menu); - topLayout->addStretch(1); - topLayout->addItem(m_backButton); - - m_optionsButton->setEnabled(false); - - m_oldSlot = new PageSlot(this); - m_newSlot = new PageSlot(this); - m_oldSlot->setPos(0, m_topOffset); - m_newSlot->setPos(0, m_topOffset); -} - -bool PageView::add(View *view, bool keepAlive) -{ - if (!view || isAnimating()) - return false; - - view->setPageView(this); - m_keepAlive[view] = keepAlive; - - if (m_views.isEmpty()) { - m_views.push(view); - m_menu->setText(view->title()); - m_oldSlot->setContents(view); - } else - animateTransition(m_views.top(), view, false); - - return true; -} - -bool PageView::back() -{ - if (m_views.count() < 2 || isAnimating()) - return false; - - View *oldView = m_views.pop(); - View *newView = m_views.top(); - - animateTransition(oldView, newView, true); - return true; -} - -bool PageView::isAnimating() const -{ - return m_isAnimating; -} - -void PageView::backClicked() -{ - if (isAnimating()) - return; - - if (m_views.count() < 2) - QApplication::quit(); - else - back(); -} - -void PageView::optionsClicked() -{ - qWarning("options clicked"); -} - -void PageView::transitionFinished() -{ - View *newView = m_newSlot->contents(); - View *oldView = m_oldSlot->contents(); - - disconnect(newView, SIGNAL(transitionInFinished()), - this, SLOT(transitionFinished())); - disconnect(oldView, SIGNAL(transitionOutFinished()), - newView, SLOT(doTransitionOut())); - - if (m_isBack) { - m_oldSlot->setContents(0); - bool keepAlive = m_keepAlive[oldView]; - m_keepAlive.remove(oldView); - if (!keepAlive) - delete oldView; - } else { - oldView->hide(); - m_views.push(newView); - } - - m_isAnimating = false; - m_menu->setText(newView->title()); -} - -void PageView::animateTransition(View *oldView, View *newView, bool isBack) -{ - m_isAnimating = true; - - m_isBack = isBack; - m_oldSlot->setContents(oldView); - m_newSlot->setContents(newView); - - newView->show(); - - connect(newView, SIGNAL(transitionInFinished()), - this, SLOT(transitionFinished())); - connect(oldView, SIGNAL(transitionOutFinished()), - newView, SLOT(doTransitionIn())); - - oldView->doTransitionOut(); -} - -void PageView::resizeEvent(QGraphicsSceneResizeEvent *event) -{ - QGraphicsWidget::resizeEvent(event); - - QSizeF newSize = event->newSize(); - newSize.setHeight(newSize.height() - m_topOffset); - - m_oldSlot->resize(newSize); - m_newSlot->resize(newSize); -} - -#include "pageview.moc" diff --git a/hyperui/pageview.h b/hyperui/pageview.h deleted file mode 100644 index 130e9eb..0000000 --- a/hyperui/pageview.h +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: openBossa - INdT (renato.chencarek@openbossa.org) -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** the openBossa stream from INdT (renato.chencarek@openbossa.org). -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef PAGEVIEW_H -#define PAGEVIEW_H - -#include -#include -#include - -class View; -class Button; -class PageMenu; -class PageSlot; - - -class PageView : public QGraphicsWidget -{ - Q_OBJECT - -public: - PageView(QGraphicsItem *parent = 0); - - bool add(View *view, bool keepAlive = false); - bool back(); - - bool isAnimating() const; - -protected: - void animateTransition(View *oldView, View *newView, bool isBack); - - void resizeEvent(QGraphicsSceneResizeEvent *event); - void mousePressEvent(QGraphicsSceneMouseEvent *) { } - -private slots: - void backClicked(); - void optionsClicked(); - void transitionFinished(); - -private: - bool m_isBack; - int m_topOffset; - bool m_isAnimating; - - QStack m_views; - QHash m_keepAlive; - - PageMenu *m_menu; - Button *m_backButton; - Button *m_optionsButton; - - PageSlot *m_oldSlot; - PageSlot *m_newSlot; -}; - -#endif diff --git a/hyperui/phoneview.cpp b/hyperui/phoneview.cpp deleted file mode 100644 index ee20cfc..0000000 --- a/hyperui/phoneview.cpp +++ /dev/null @@ -1,727 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: openBossa - INdT (renato.chencarek@openbossa.org) -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** the openBossa stream from INdT (renato.chencarek@openbossa.org). -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "dataresource.h" -#include "label.h" -#include "global.h" -#include "button.h" -#include "phoneview.h" -#include "contactlist.h" -#include "contactresource.h" - - -static QFont resourceButtonFont() -{ - QFont font(Resource::stringValue("default/font-family")); - font.setBold(true); - font.setPixelSize(Resource::intValue("button/font-size")); - return font; -} - - -class Overlay : public QObject, - public QGraphicsRectItem -{ - Q_OBJECT - Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity) - Q_PROPERTY(bool visible READ isVisible WRITE setVisible) - -public: - Overlay(QGraphicsItem *parent = 0) - : QGraphicsRectItem(parent) {} - -protected: - void mousePressEvent(QGraphicsSceneMouseEvent *) { } -}; - - -class DialerWidget : public QGraphicsWidget -{ - Q_OBJECT - -public: - DialerWidget(QGraphicsItem *parent = 0); - -signals: - void buttonClicked(const QString &value); - -protected: - void addButton(const QString &label, int row, int col, - const QString &imagePrefix); - -private slots: - void onButtonClicked(); - -private: - QGraphicsGridLayout *m_layout; -}; - - -DialerWidget::DialerWidget(QGraphicsItem *parent) - : QGraphicsWidget(parent) -{ - QGraphicsPixmapItem *background = - new QGraphicsPixmapItem(Resource::pixmap("dialer/background.png"), this); - background->setPos(0, 0); - background->setShapeMode(QGraphicsPixmapItem::BoundingRectShape); - - const int margin = Resource::intValue("dialer-widget/margin"); - const int spacing = Resource::intValue("dialer-widget/spacing"); - - m_layout = new QGraphicsGridLayout(); - m_layout->setSpacing(spacing); - m_layout->setContentsMargins(margin, margin, margin, margin); - - addButton("1", 0, 0, "dialer/top_left_key"); - addButton("2", 0, 1, "dialer/middle_key"); - addButton("3", 0, 2, "dialer/top_right_key"); - addButton("4", 1, 0, "dialer/middle_key"); - addButton("5", 1, 1, "dialer/middle_key"); - addButton("6", 1, 2, "dialer/middle_key"); - addButton("7", 2, 0, "dialer/middle_key"); - addButton("8", 2, 1, "dialer/middle_key"); - addButton("9", 2, 2, "dialer/middle_key"); - addButton("*", 3, 0, "dialer/bottom_left_key"); - addButton("0", 3, 1, "dialer/middle_key"); - addButton("#", 3, 2, "dialer/bottom_right_key"); - - setLayout(m_layout); -} - -void DialerWidget::addButton(const QString &label, int row, int col, - const QString &imagePrefix) -{ - const QString &normalPath = QString("%1.png").arg(imagePrefix); - const QString &pressedPath = QString("%1_pressed.png").arg(imagePrefix); - - Button *button = new Button(Resource::pixmap(normalPath), - Resource::pixmap(pressedPath)); - button->setText(label); - button->setFont(resourceButtonFont()); - - connect(button, SIGNAL(clicked()), SLOT(onButtonClicked())); - - m_layout->addItem(button, row, col); -} - -void DialerWidget::onButtonClicked() -{ - Button *button = dynamic_cast