summaryrefslogtreecommitdiffstats
path: root/hyperui/dialerwidget.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'hyperui/dialerwidget.cpp')
-rw-r--r--hyperui/dialerwidget.cpp161
1 files changed, 0 insertions, 161 deletions
diff --git a/hyperui/dialerwidget.cpp b/hyperui/dialerwidget.cpp
deleted file mode 100644
index 99291c9..0000000
--- a/hyperui/dialerwidget.cpp
+++ /dev/null
@@ -1,161 +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 <QGraphicsGridLayout>
-#include <QGraphicsPixmapItem>
-
-#include "global.h"
-#include "dialerwidget.h"
-#include "button.h"
-
-#define MAX_ROWS 4
-#define MAX_COLUMNS 3
-
-
-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, SLOT(oneClicked()));
- addButton("2", 0, 1, SLOT(twoClicked()));
- addButton("3", 0, 2, SLOT(threeClicked()));
- addButton("4", 1, 0, SLOT(fourClicked()));
- addButton("5", 1, 1, SLOT(fiveClicked()));
- addButton("6", 1, 2, SLOT(sixClicked()));
- addButton("7", 2, 0, SLOT(sevenClicked()));
- addButton("8", 2, 1, SLOT(eightClicked()));
- addButton("9", 2, 2, SLOT(nineClicked()));
- addButton("*", 3, 0, SLOT(starClicked()));
- addButton("0", 3, 1, SLOT(zeroClicked()));
- addButton("#", 3, 2, SLOT(hashClicked()));
-
- setLayout(m_layout);
-}
-
-void DialerWidget::addButton(const QString &label, int row, int col, const char *slot)
-{
- QPixmap normalPixmap;
- QPixmap pressedPixmap;
-
- if (row == 0 && col == 0) {
- normalPixmap = Resource::pixmap("dialer/top_left_key.png");
- pressedPixmap = Resource::pixmap("dialer/top_left_key_pressed.png");
- } else if (row == 0 && col == MAX_COLUMNS - 1) {
- normalPixmap = Resource::pixmap("dialer/top_right_key.png");
- pressedPixmap = Resource::pixmap("dialer/top_right_key_pressed.png");
- } else if (row == MAX_ROWS - 1 && col == 0) {
- normalPixmap = Resource::pixmap("dialer/bottom_left_key.png");
- pressedPixmap = Resource::pixmap("dialer/bottom_left_key_pressed.png");
- } else if (row == MAX_ROWS - 1 && col == MAX_COLUMNS - 1) {
- normalPixmap = Resource::pixmap("dialer/bottom_right_key.png");
- pressedPixmap = Resource::pixmap("dialer/bottom_right_key_pressed.png");
- } else {
- normalPixmap = Resource::pixmap("dialer/middle_key.png");
- pressedPixmap = Resource::pixmap("dialer/middle_key_pressed.png");
- }
-
- Button *button = new Button(normalPixmap, pressedPixmap);
- button->setText(label);
- connect(button, SIGNAL(clicked()), slot);
-
- m_layout->addItem(button, row, col);
-}
-
-void DialerWidget::oneClicked()
-{
- emit buttonClicked("1");
-}
-
-void DialerWidget::twoClicked()
-{
- emit buttonClicked("2");
-}
-
-void DialerWidget::threeClicked()
-{
- emit buttonClicked("3");
-}
-
-void DialerWidget::fourClicked()
-{
- emit buttonClicked("4");
-}
-
-void DialerWidget::fiveClicked()
-{
- emit buttonClicked("5");
-}
-
-void DialerWidget::sixClicked()
-{
- emit buttonClicked("6");
-}
-
-void DialerWidget::sevenClicked()
-{
- emit buttonClicked("7");
-}
-
-void DialerWidget::eightClicked()
-{
- emit buttonClicked("8");
-}
-
-void DialerWidget::nineClicked()
-{
- emit buttonClicked("9");
-}
-
-void DialerWidget::starClicked()
-{
- emit buttonClicked("*");
-}
-
-void DialerWidget::zeroClicked()
-{
- emit buttonClicked("0");
-}
-
-void DialerWidget::hashClicked()
-{
- emit buttonClicked("#");
-}