/* * Qt UI * * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved. * * Contact: * GiWoong Kim * SeokYeon Hwang * Sangho Park * Stanislav Vorobiov * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * * Contributors: * - S-Core Co., Ltd * */ #include "displayswwidget.h" #include "input/multitouchtracker.h" extern "C" { #include "emul_state.h" }; DisplaySWWidget::DisplaySWWidget(QWidget *parent, DisplayType *displayForm, QSize resolution, qreal scaleFactor) : QLabel(parent), DisplayBase(displayForm, resolution, scaleFactor, this) { /* fill the screen with black(with full alpha) surface */ QPixmap initImage( displayForm->getRect().width() * scaleFactor, displayForm->getRect().height() * scaleFactor); initImage.fill(QColor(0, 0, 0, 255)); setPixmap(initImage); /* to be enable to drop events */ setAcceptDrops(true); } void DisplaySWWidget::drawMtPoints(QPainter &painter) { MultiTouchTracker *mtTracker = getTouchScreenHelper()->getMtTracker(); QList pointList = mtTracker->getTouchPointList(); TouchPoint *point = NULL; for (int i = 0; i < pointList.count(); i++) { point = pointList.at(i); if (point != NULL) { painter.drawImage( point->getHostPos().x() - mtTracker->getPointRadius(), point->getHostPos().y() - mtTracker->getPointRadius(), mtTracker->getPointImage()); } } } /* override */ void DisplaySWWidget::paintEvent(QPaintEvent *event) { QLabel::paintEvent(event); handlePaint(); if (isTsEnabled == true) { /* draw multi-touch points */ QPainter painter(this); drawMtPoints(painter); } } /* override */ void DisplaySWWidget::dragEnterEvent(QDragEnterEvent *event) { handleDragEnterEvent(event); } /* override */ void DisplaySWWidget::dropEvent(QDropEvent *event) { handleDropEvent(event); } /* override */ void DisplaySWWidget::resizeEvent(QResizeEvent *event) { QLabel::resizeEvent(event); handleResize(); repaint(); } /* override */ void DisplaySWWidget::mousePressEvent(QMouseEvent *event) { handleMousePress(event); if (isMovingMode() == true) { /* do nothing */ return; } } /* override */ void DisplaySWWidget::mouseReleaseEvent(QMouseEvent *event) { handleMouseRelease(event); if (isMovingMode() == true) { /* do nothing */ return; } } /* override */ void DisplaySWWidget::mouseMoveEvent(QMouseEvent *event) { handleMouseMove(event); if (isMovingMode() == true) { /* do nothing */ return; } } /* override */ void DisplaySWWidget::enterEvent(QEvent *event) { handleMouseEnter(event); if (isMovingMode() == true) { /* do nothing */ return; } } /* override */ void DisplaySWWidget::leaveEvent(QEvent *event) { handleMouseLeave(event); if (isMovingMode() == true) { /* do nothing */ return; } } DisplaySWWidget::~DisplaySWWidget() { /* do nothing */ }