screenshot: Apply rotation and add boilerplate 56/29956/1
authorMunkyu Im <munkyu.im@samsung.com>
Mon, 3 Nov 2014 06:08:16 +0000 (15:08 +0900)
committerMunkyu Im <munkyu.im@samsung.com>
Thu, 6 Nov 2014 05:43:08 +0000 (14:43 +0900)
screenshot supports rotation angle now.

Change-Id: Id0d85ee621d8b4870697babbb576e77790c7a51e
Signed-off-by: Munkyu Im <munkyu.im@samsung.com>
tizen/src/ui/menu/Makefile.objs
tizen/src/ui/menu/screenshot.cpp
tizen/src/ui/menu/screenshot.h
tizen/src/ui/menu/screenshotview.cpp
tizen/src/ui/menu/screenshotview.h

index 137a92f927956be00699ea104685cb1ab100c078..7e5454e15dcea0ea63208de070a6638b9972af4d 100644 (file)
@@ -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
index dbefa431ffce925e3326ab0aa1abde2032d3cb04..062d1d1670fd74bbbb8a00a5c1ffcdf337b2371c 100644 (file)
@@ -1,3 +1,32 @@
+/*
+ * Qt Screenshot
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Munkyu Im <munkyu.im@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * 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 <QtWidgets>
 #include <qtoolbutton.h>
 #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);
index 1fd8288ced1f4411f1e0fd169516889b299bf45b..e7f1e2240c23e07afd47a970962bae41161582b4 100644 (file)
@@ -1,3 +1,32 @@
+/*
+ * Qt Screenshot
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Munkyu Im <munkyu.im@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * 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;
index a0605c03032aa3cd2b6dcde1a4aa021c500cf94f..907d857870439b25dc9219f57e0a784f26e782a8 100644 (file)
@@ -1,3 +1,32 @@
+/*
+ * Qt Screenshot
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * Munkyu Im <munkyu.im@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * 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"
 
index 2872ddcaea18f36ce0902d5d975370dcf5c7795a..a500dfbe0d98309c90ca4b8dabe341952b42ec0b 100644 (file)
@@ -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 <munkyu.im@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * 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 <QtWidgets>