menu: modified screenshot class name 49/36149/2
authorGiWoong Kim <giwoong.kim@samsung.com>
Tue, 3 Mar 2015 02:49:00 +0000 (11:49 +0900)
committerGiWoong Kim <giwoong.kim@samsung.com>
Tue, 3 Mar 2015 06:05:37 +0000 (15:05 +0900)
Screenshot -> ScreenShotDialog

Change-Id: I516cfffbf5973a4c5abe140498e66332a587b63f
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/ui/menu/Makefile.objs
tizen/src/ui/menu/contextmenu.cpp
tizen/src/ui/menu/contextmenu.h
tizen/src/ui/menu/screenshotdialog.cpp [moved from tizen/src/ui/menu/screenshot.cpp with 87% similarity]
tizen/src/ui/menu/screenshotdialog.h [moved from tizen/src/ui/menu/screenshot.h with 89% similarity]
tizen/src/ui/menu/screenshotview.cpp
tizen/src/ui/menu/screenshotview.h

index 087c040..bb9a371 100644 (file)
@@ -1,5 +1,5 @@
 obj-$(CONFIG_QT) += aboutdialog.o moc_aboutdialog.o
-obj-$(CONFIG_QT) += screenshot.o moc_screenshot.o
+obj-$(CONFIG_QT) += screenshotdialog.o moc_screenshotdialog.o
 obj-$(CONFIG_QT) += detailedinfodialog.o moc_detailedinfodialog.o
 obj-$(CONFIG_QT) += contextmenu.o moc_contextmenu.o
 obj-$(CONFIG_QT) += menuitem.o
@@ -16,6 +16,6 @@ $(obj)/moc_detailedinfodialog.cpp: $(obj)/detailedinfodialog.h
 $(obj)/moc_contextmenu.o: $(obj)/moc_contextmenu.cpp
 $(obj)/moc_contextmenu.cpp: $(obj)/contextmenu.h
        moc $< -o $@
-$(obj)/moc_screenshot.o: $(obj)/moc_screenshot.cpp
-$(obj)/moc_screenshot.cpp: $(obj)/screenshot.h
+$(obj)/moc_screenshotdialog.o: $(obj)/moc_screenshotdialog.cpp
+$(obj)/moc_screenshotdialog.cpp: $(obj)/screenshotdialog.h
        moc $< -o $@
index ec22e1f..7426ebc 100644 (file)
@@ -733,7 +733,7 @@ void ContextMenu::slotShowScreenshot(const QPixmap &screenshot)
     qDebug("show screenshot");
 
     if (screenshotDialog == NULL) {
-        screenshotDialog = new Screenshot(parent, screenshot);
+        screenshotDialog = new ScreenShotDialog(parent, screenshot);
     }
 
     screenshotDialog->slotRefresh(screenshot);
index bc68969..7d48f21 100644 (file)
@@ -35,7 +35,7 @@
 
 #include "detailedinfodialog.h"
 #include "aboutdialog.h"
-#include "screenshot.h"
+#include "screenshotdialog.h"
 #include "menu/menuitem.h"
 
 class MainWindow;
@@ -60,7 +60,7 @@ public:
     QSignalMapper *getScaleMapper();
     QSignalMapper *getControllerMapper();
 
-    Screenshot *screenshotDialog;
+    ScreenShotDialog *screenshotDialog;
 
 signals:
 
similarity index 87%
rename from tizen/src/ui/menu/screenshot.cpp
rename to tizen/src/ui/menu/screenshotdialog.cpp
index 9ca468e..0fb1c81 100644 (file)
@@ -5,6 +5,7 @@
  *
  * Contact:
  * Munkyu Im <munkyu.im@samsung.com>
+ * GiWoong Kim <giwoong.kim@samsung.com>
  * Sangho Park <sangho1206.park@samsung.com>
  *
  * This program is free software; you can redistribute it and/or
 
 #include <qtoolbutton.h>
 
-#include "screenshot.h"
+#include "screenshotdialog.h"
 #include "screenshotview.h"
 #include "mainwindow.h"
 
-Screenshot::Screenshot(QWidget *parent, const QPixmap &pixmap) :
+ScreenShotDialog::ScreenShotDialog(QWidget *parent, const QPixmap &pixmap) :
     QDialog(parent), screenshotPixmap(pixmap)
 {
     this->win = (MainWindow *)parent;
@@ -60,22 +61,77 @@ Screenshot::Screenshot(QWidget *parent, const QPixmap &pixmap) :
     resize(win->uiInfo->getMainSize());
 }
 
-void Screenshot::slotCopy()
+void ScreenShotDialog::createItems()
 {
-    qDebug("copy to clipboard");
+    statusBar = new QStatusBar(this);
+    toolbar = new QToolBar(this);
 
-    QClipboard* clipboard = QApplication::clipboard();
-    QPixmap pixmap(screenshotPixmap);
-    clipboard->clear();
-    clipboard->setPixmap(pixmap);
+    slider = new QSlider(Qt::Horizontal, this);
+    slider->setTickPosition(QSlider::TicksAbove);
+    slider->setRange(0, 5);
+    slider->setValue(3);
+    sliderLevel = 3;
+    slider->setFixedWidth(100);
+    slider->setToolTip("100%");
+    connect(slider, SIGNAL(valueChanged(int)), this, SLOT(slotScaleChanged(int)));
+
+    gridlayout = new QGridLayout(this);
+    gridlayout->setContentsMargins(0, 0, 0, 0);
+
+    saveAct = new QAction(tr("&Save"), this);
+    saveAct->setShortcuts(QKeySequence::Save);
+    saveAct->setIcon(QIcon(":/icons/save_screenshot_dialog.png"));
+    saveAct->setToolTip("Save to file");
+    connect(saveAct, SIGNAL(triggered()), this, SLOT(slotSave()));
+
+    copyAct = new QAction(tr("&Copy"), this);
+    copyAct->setShortcuts(QKeySequence::Copy);
+    copyAct->setIcon(QIcon(":/icons/copy_screenshot_dialog.png"));
+    copyAct->setToolTip("Copy to clipboard");
+    connect(copyAct, SIGNAL(triggered()), this, SLOT(slotCopy()));
+
+    refreshAct = new QAction(tr("&Refresh"), this);
+    refreshAct->setShortcuts(QKeySequence::Refresh);
+    refreshAct->setIcon(QIcon(":/icons/refresh_screenshot_dialog.png"));
+    refreshAct->setToolTip("Refresh Image");
+    connect(refreshAct, SIGNAL(triggered()),
+        win->getPopupMenu(), SLOT(slotRequestScreenshot()));
 }
 
-QString Screenshot::getRatio()
+void ScreenShotDialog::setImage()
+{
+    scene = new QGraphicsScene(this);
+
+    qDebug() << screenshotPixmap;
+
+    QMatrix rm;
+    rm.rotate(getRotateAngle());
+    screenshotPixmap = screenshotPixmap.transformed(rm);
+    scene->addPixmap(screenshotPixmap);
+
+    view = new ScreenShotView(scene, this);
+    ratioStr = "100%";
+    view->setScene(scene);
+    view->setMouseTracking(true);
+
+    QScrollArea *area = new QScrollArea(this);
+    area->setFixedSize(screenshotPixmap.width(), screenshotPixmap.height());
+    view->setCornerWidget(area);
+    view->verticalScrollBar()->setValue(1);
+    view->horizontalScrollBar()->setValue(1);
+}
+
+int ScreenShotDialog::getRotateAngle()
+{
+    return win->uiInfo->getMainFormDisplayType()->getAngle();
+}
+
+QString ScreenShotDialog::getRatio()
 {
     return ratioStr;
 }
 
-void Screenshot::setRatio(int level)
+void ScreenShotDialog::setRatio(int level)
 {
     switch (level) {
     case 0:
@@ -100,62 +156,12 @@ void Screenshot::setRatio(int level)
     ratioStr = QString::number(ratio * 100).append("%");
 }
 
-void Screenshot::slotScaleChanged(int level)
-{
-    qDebug("scale changed: %d", level);
-
-    sliderLevel = level;
-    QPixmap pixmap(screenshotPixmap);
-    setRatio(level);
-    scene->clear();
-    scene->addPixmap(pixmap.scaled(pixmap.size() * ratio,
-        Qt::KeepAspectRatio, Qt::FastTransformation));
-    slider->setToolTip(ratioStr);
-
-    updateStatusBar();
-}
-
-int Screenshot::getSliderLevel()
+int ScreenShotDialog::getSliderLevel()
 {
     return sliderLevel;
 }
 
-void Screenshot::slotRefresh(const QPixmap &pixmap)
-{
-    qDebug("refresh");
-
-    this->frameBuf = pixmap;
-
-    ratioStr = "100%";
-    sliderLevel = 3;
-    slider->setValue(3);
-    scene->clear();
-
-    // TODO: once
-    QMatrix rm;
-    rm.rotate(getRotateAngle());
-    screenshotPixmap = screenshotPixmap.transformed(rm);
-    scene->addPixmap(screenshotPixmap);
-    slider->setToolTip(ratioStr);
-}
-
-void Screenshot::setStatusBar(qreal xx, qreal yy)
-{
-    posX = QString::number(xx);
-    posY = QString::number(yy);
-
-    updateStatusBar();
-}
-
-void Screenshot::updateStatusBar()
-{
-    statusBar->showMessage("x: " + posX + ", y:" + posY +
-        " (" + QString::number(screenshotPixmap.width()) +
-        "x" + QString::number(screenshotPixmap.height()) +
-        ", " + qPrintable(getRatio()) + ")");
-}
-
-bool Screenshot::slotSave()
+bool ScreenShotDialog::slotSave()
 {
     qDebug("save");
 
@@ -170,81 +176,76 @@ bool Screenshot::slotSave()
     if (filename.isEmpty()) {
         qDebug("can not have file");
         return false;
-    } else {
-        QPixmap pixmap(screenshotPixmap);
-        qDebug() << filename;
-        pixmap.save(filename);
     }
 
+    QPixmap pixmap(screenshotPixmap);
+    qDebug() << filename;
+    pixmap.save(filename);
+
     return true;
 }
 
-int Screenshot::getRotateAngle()
+void ScreenShotDialog::slotCopy()
 {
-    return win->uiInfo->getMainFormDisplayType()->getAngle();
+    qDebug("copy to clipboard");
+
+    QClipboard* clipboard = QApplication::clipboard();
+    QPixmap pixmap(screenshotPixmap);
+    clipboard->clear();
+    clipboard->setPixmap(pixmap);
 }
 
-void Screenshot::createItems()
+void ScreenShotDialog::slotRefresh(const QPixmap &pixmap)
 {
-    statusBar = new QStatusBar(this);
-    toolbar = new QToolBar(this);
+    qDebug("refresh");
 
-    slider = new QSlider(Qt::Horizontal, this);
-    slider->setTickPosition(QSlider::TicksAbove);
-    slider->setRange(0, 5);
-    slider->setValue(3);
+    frameBuf = pixmap;
+
+    ratioStr = "100%";
     sliderLevel = 3;
-    slider->setFixedWidth(100);
-    slider->setToolTip("100%");
-    connect(slider, SIGNAL(valueChanged(int)), this, SLOT(slotScaleChanged(int)));
+    slider->setValue(3);
+    scene->clear();
 
-    gridlayout = new QGridLayout(this);
-    gridlayout->setContentsMargins(0, 0, 0, 0);
+    // TODO: once
+    QMatrix rm;
+    rm.rotate(getRotateAngle());
+    screenshotPixmap = screenshotPixmap.transformed(rm);
+    scene->addPixmap(screenshotPixmap);
+    slider->setToolTip(ratioStr);
+}
 
-    saveAct = new QAction(tr("&Save"), this);
-    saveAct->setShortcuts(QKeySequence::Save);
-    saveAct->setIcon(QIcon(":/icons/save_screenshot_dialog.png"));
-    saveAct->setToolTip("Save to file");
-    connect(saveAct, SIGNAL(triggered()), this, SLOT(slotSave()));
+void ScreenShotDialog::slotScaleChanged(int level)
+{
+    qDebug("scale changed: %d", level);
 
-    copyAct = new QAction(tr("&Copy"), this);
-    copyAct->setShortcuts(QKeySequence::Copy);
-    copyAct->setIcon(QIcon(":/icons/copy_screenshot_dialog.png"));
-    copyAct->setToolTip("Copy to clipboard");
-    connect(copyAct, SIGNAL(triggered()), this, SLOT(slotCopy()));
+    sliderLevel = level;
+    QPixmap pixmap(screenshotPixmap);
+    setRatio(level);
+    scene->clear();
+    scene->addPixmap(pixmap.scaled(pixmap.size() * ratio,
+        Qt::KeepAspectRatio, Qt::FastTransformation));
+    slider->setToolTip(ratioStr);
 
-    refreshAct = new QAction(tr("&Refresh"), this);
-    refreshAct->setShortcuts(QKeySequence::Refresh);
-    refreshAct->setIcon(QIcon(":/icons/refresh_screenshot_dialog.png"));
-    refreshAct->setToolTip("Refresh Image");
-    connect(refreshAct, SIGNAL(triggered()),
-        win->getPopupMenu(), SLOT(slotRequestScreenshot()));
+    updateStatusBar();
 }
 
-void Screenshot::setImage()
+void ScreenShotDialog::setStatusBar(qreal xx, qreal yy)
 {
-    scene = new QGraphicsScene(this);
-
-    qDebug() << screenshotPixmap;
-
-    QMatrix rm;
-    rm.rotate(getRotateAngle());
-    screenshotPixmap = screenshotPixmap.transformed(rm);
-    scene->addPixmap(screenshotPixmap);
+    posX = QString::number(xx);
+    posY = QString::number(yy);
 
-    view = new ScreenshotView(scene, this);
-    ratioStr = "100%";
-    view->setScene(scene);
-    view->setMouseTracking(true);
+    updateStatusBar();
+}
 
-    QScrollArea *area = new QScrollArea(this);
-    area->setFixedSize(screenshotPixmap.width(), screenshotPixmap.height());
-    view->setCornerWidget(area);
-    view->verticalScrollBar()->setValue(1);
-    view->horizontalScrollBar()->setValue(1);
+void ScreenShotDialog::updateStatusBar()
+{
+    statusBar->showMessage("x: " + posX + ", y:" + posY +
+        " (" + QString::number(screenshotPixmap.width()) +
+        "x" + QString::number(screenshotPixmap.height()) +
+        ", " + qPrintable(getRatio()) + ")");
 }
 
-void Screenshot::showEvent(QShowEvent *event)
+void ScreenShotDialog::showEvent(QShowEvent *event)
 {
     Q_UNUSED(event)
 
@@ -253,7 +254,7 @@ void Screenshot::showEvent(QShowEvent *event)
         win->geometry().center().y() - (geometry().size().height() / 2));
 }
 
-Screenshot::~Screenshot()
+ScreenShotDialog::~ScreenShotDialog()
 {
     qDebug("destroy screenshot dialog");
 
similarity index 89%
rename from tizen/src/ui/menu/screenshot.h
rename to tizen/src/ui/menu/screenshotdialog.h
index bd1c0ff..87bd157 100644 (file)
@@ -5,6 +5,7 @@
  *
  * Contact:
  * Munkyu Im <munkyu.im@samsung.com>
+ * GiWoong Kim <giwoong.kim@samsung.com>
  * Sangho Park <sangho1206.park@samsung.com>
  *
  * This program is free software; you can redistribute it and/or
 
 class MainWindow;
 
-class Screenshot : public QDialog
+class ScreenShotDialog : public QDialog
 {
     Q_OBJECT
 
 public:
-    explicit Screenshot(QWidget *parent, const QPixmap &screenshot);
-    ~Screenshot();
+    explicit ScreenShotDialog(QWidget *parent, const QPixmap &screenshot);
+    ~ScreenShotDialog();
 
-    void setStatusBar(qreal xx, qreal yy);
-    int getSliderLevel();
     int getRotateAngle();
     QString getRatio();
+    int getSliderLevel();
+    void setStatusBar(qreal xx, qreal yy);
 
     QPixmap frameBuf;
 
 public slots:
+    bool slotSave();
+    void slotCopy();
     void slotRefresh(const QPixmap &);
 
 protected:
     void showEvent(QShowEvent *event);
-    QGraphicsScene* scene;
+
+    QGraphicsScene *scene;
 
 private:
     void createItems();
@@ -66,7 +70,7 @@ private:
     QString posX;
     QString posY;
     QGridLayout *gridlayout;
-    QGraphicsViewview;
+    QGraphicsView *view;
     int sliderLevel;
     QLabel *label;
     QSlider *slider;
@@ -85,8 +89,6 @@ private:
     QAction *refreshAct;
 
 private slots:
-    bool slotSave();
-    void slotCopy();
     void slotScaleChanged(int level);
 };
 
index 8c70088..9877444 100644 (file)
 #include <QtCore/qmath.h>
 
 #include "screenshotview.h"
-#include "screenshot.h"
+#include "screenshotdialog.h"
 
-ScreenshotView::ScreenshotView(QGraphicsScene *scene, QWidget *parent) :
+ScreenShotView::ScreenShotView(QGraphicsScene *scene, QWidget *parent) :
     QGraphicsView(scene, parent)
 {
     setBackgroundRole(QPalette::Dark);
 }
 
-void ScreenshotView::mouseMoveEvent(QMouseEvent *event)
+void ScreenShotView::mouseMoveEvent(QMouseEvent *event)
 {
     int max_x;
     int max_y;
-    Screenshot *screenshot = (Screenshot *)(this->parent());
+    ScreenShotDialog *screenshot = (ScreenShotDialog *)(this->parent());
     QPointF fixedPos = this->mapToScene(event->pos());
     int sliderLevel = screenshot->getSliderLevel();
 
@@ -103,7 +103,7 @@ void ScreenshotView::mouseMoveEvent(QMouseEvent *event)
     }
 }
 
-ScreenshotView::~ScreenshotView()
+ScreenShotView::~ScreenShotView()
 {
     /* do nothing */
 }
index 94e43ba..a112e66 100644 (file)
 
 #include <QtWidgets>
 
-class ScreenshotView: public QGraphicsView
+class ScreenShotView: public QGraphicsView
 {
 public:
-    ScreenshotView(QGraphicsScene *scene, QWidget *parent);
-    ~ScreenshotView();
+    ScreenShotView(QGraphicsScene *scene, QWidget *parent);
+    ~ScreenShotView();
 
 protected:
     void mouseMoveEvent(QMouseEvent *event);