From: Munkyu Im Date: Mon, 3 Nov 2014 06:08:16 +0000 (+0900) Subject: screenshot: Apply rotation and add boilerplate X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F56%2F29956%2F1;p=sdk%2Femulator%2Fqemu.git screenshot: Apply rotation and add boilerplate screenshot supports rotation angle now. Change-Id: Id0d85ee621d8b4870697babbb576e77790c7a51e Signed-off-by: Munkyu Im --- diff --git a/tizen/src/ui/menu/Makefile.objs b/tizen/src/ui/menu/Makefile.objs index 137a92f927..7e5454e15d 100644 --- a/tizen/src/ui/menu/Makefile.objs +++ b/tizen/src/ui/menu/Makefile.objs @@ -2,7 +2,7 @@ obj-$(CONFIG_QT) += aboutdialog.o moc_aboutdialog.o obj-$(CONFIG_QT) += screenshot.o moc_screenshot.o obj-$(CONFIG_QT) += detailedinfodialog.o moc_detailedinfodialog.o obj-$(CONFIG_QT) += contextmenu.o moc_contextmenu.o -obj-$(CONFIG_QT) += screenshotview.o moc_screenshotview.o +obj-$(CONFIG_QT) += screenshotview.o $(obj)/moc_aboutdialog.o: $(obj)/moc_aboutdialog.cpp $(obj)/moc_aboutdialog.cpp: $(obj)/aboutdialog.h @@ -16,6 +16,3 @@ $(obj)/moc_contextmenu.cpp: $(obj)/contextmenu.h $(obj)/moc_screenshot.o: $(obj)/moc_screenshot.cpp $(obj)/moc_screenshot.cpp: $(obj)/screenshot.h moc $< -o $@ -$(obj)/moc_screenshotview.o: $(obj)/moc_screenshotview.cpp -$(obj)/moc_screenshotview.cpp: $(obj)/screenshotview.h - moc $< -o $@ \ No newline at end of file diff --git a/tizen/src/ui/menu/screenshot.cpp b/tizen/src/ui/menu/screenshot.cpp index dbefa431ff..062d1d1670 100644 --- a/tizen/src/ui/menu/screenshot.cpp +++ b/tizen/src/ui/menu/screenshot.cpp @@ -1,3 +1,32 @@ +/* + * Qt Screenshot + * + * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Munkyu Im + * Sangho Park + * + * 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 #include #include "screenshot.h" @@ -64,9 +93,12 @@ void Screenshot::refresh(const QPixmap &pixmap) { ratioStr = "100%"; slider->setValue(3); scene->clear(); + + QMatrix rm; + rm.rotate(getRotateAngle()); + screenshotPixmap = screenshotPixmap.transformed(rm); scene->addPixmap(screenshotPixmap); slider->setToolTip(ratioStr); - } void Screenshot::setStatusBar(qreal posX, qreal posY) { @@ -104,6 +136,12 @@ bool Screenshot::save() { } } +int Screenshot::getRotateAngle() { + int rotateAngle = ((MainWindow *)(this->parent()->parent()))->getUIState()->mainFormAngle; + qDebug("rotaedAngle: %d", rotateAngle); + return rotateAngle; +} + void Screenshot::makeWidgets() { toolbar = new QToolBar(this); @@ -141,6 +179,10 @@ void Screenshot::setImage() { scene = new QGraphicsScene(this); qDebug() << screenshotPixmap; + + QMatrix rm; + rm.rotate(getRotateAngle()); + screenshotPixmap = screenshotPixmap.transformed(rm); scene->addPixmap(screenshotPixmap); view = new ScreenshotView(scene, this); diff --git a/tizen/src/ui/menu/screenshot.h b/tizen/src/ui/menu/screenshot.h index 1fd8288ced..e7f1e2240c 100644 --- a/tizen/src/ui/menu/screenshot.h +++ b/tizen/src/ui/menu/screenshot.h @@ -1,3 +1,32 @@ +/* + * Qt Screenshot + * + * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Munkyu Im + * Sangho Park + * + * 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 + * + */ + #ifndef SCREENSHOT_H #define SCREENSHOT_H @@ -30,6 +59,7 @@ private: void setImage(); void setRatio(int level); void updateStatusBar(); + int getRotateAngle(); QString posX; diff --git a/tizen/src/ui/menu/screenshotview.cpp b/tizen/src/ui/menu/screenshotview.cpp index a0605c0303..907d857870 100644 --- a/tizen/src/ui/menu/screenshotview.cpp +++ b/tizen/src/ui/menu/screenshotview.cpp @@ -1,3 +1,32 @@ +/* + * Qt Screenshot + * + * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Munkyu Im + * Sangho Park + * + * 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 "screenshotview.h" #include "screenshot.h" diff --git a/tizen/src/ui/menu/screenshotview.h b/tizen/src/ui/menu/screenshotview.h index 2872ddcaea..a500dfbe0d 100644 --- a/tizen/src/ui/menu/screenshotview.h +++ b/tizen/src/ui/menu/screenshotview.h @@ -1,5 +1,34 @@ -#ifndef SCREENSHOTIMAGE_H -#define SCREENSHOTIMAGE_H +/* + * Qt Screenshot + * + * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Munkyu Im + * Sangho Park + * + * 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 + * + */ + +#ifndef SCREENSHOTVIEW_H +#define SCREENSHOTVIEW_H #include