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/screenshot.cpp [deleted file]
tizen/src/ui/menu/screenshot.h [deleted file]
tizen/src/ui/menu/screenshotdialog.cpp [new file with mode: 0644]
tizen/src/ui/menu/screenshotdialog.h [new file with mode: 0644]
tizen/src/ui/menu/screenshotview.cpp
tizen/src/ui/menu/screenshotview.h

index 087c0405f49a59c00579695056a79d59dd183456..bb9a371fed0c756aab0cd28b452166cfb10b00d9 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 ec22e1f11563419b36aa61865ff9c96363d8fe17..7426ebc51e77385f936e61429d93381934878a21 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 bc6896904ee13d5a76df451e10f6a9ce3a6e171b..7d48f21c2c1a7890df618bba85007bfba5e3a01d 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:
 
diff --git a/tizen/src/ui/menu/screenshot.cpp b/tizen/src/ui/menu/screenshot.cpp
deleted file mode 100644 (file)
index 9ca468e..0000000
+++ /dev/null
@@ -1,261 +0,0 @@
-/*
- * 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 <qtoolbutton.h>
-
-#include "screenshot.h"
-#include "screenshotview.h"
-#include "mainwindow.h"
-
-Screenshot::Screenshot(QWidget *parent, const QPixmap &pixmap) :
-    QDialog(parent), screenshotPixmap(pixmap)
-{
-    this->win = (MainWindow *)parent;
-
-    setWindowTitle("Screen Shot - " + win->uiInfo->vmName +
-        " : " + QString::number(get_device_serial_number()));
-    setWindowIcon(QIcon(":/icons/screen_shot.png"));
-
-    createItems();
-
-    setImage();
-
-    toolbar->addAction(saveAct);
-    toolbar->addAction(copyAct);
-    toolbar->addAction(refreshAct);
-    toolbar->addSeparator();
-    toolbar->addWidget(slider);
-    gridlayout->addWidget(toolbar, 0, 0);
-    gridlayout->addWidget(view, 1, 0);
-    gridlayout->addWidget(statusBar, 2, 0);
-
-    setLayout(gridlayout);
-
-    resize(win->uiInfo->getMainSize());
-}
-
-void Screenshot::slotCopy()
-{
-    qDebug("copy to clipboard");
-
-    QClipboard* clipboard = QApplication::clipboard();
-    QPixmap pixmap(screenshotPixmap);
-    clipboard->clear();
-    clipboard->setPixmap(pixmap);
-}
-
-QString Screenshot::getRatio()
-{
-    return ratioStr;
-}
-
-void Screenshot::setRatio(int level)
-{
-    switch (level) {
-    case 0:
-        ratio = 0.125;
-        break;
-    case 1:
-        ratio = 0.25;
-        break;
-    case 2:
-        ratio = 0.50;
-        break;
-    case 3:
-        ratio = 1;
-        break;
-    case 4:
-        ratio = 2;
-        break;
-    case 5:
-        ratio = 4;
-        break;
-    }
-    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()
-{
-    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()
-{
-    qDebug("save");
-
-    QString vmname = win->uiInfo->vmName;
-    QDateTime currentDateTime = QDateTime::currentDateTime();
-    QString date = currentDateTime.toString("yyyy-MM-dd-HHmmss");
-    QString filePath = QDir::homePath() + QDir::separator() + vmname + "-" + date + ".png";
-    QString filterName = "Image files (*.png *.jpg *.jpeg *.bmp *.ppm *.xbm *.xpm);;"
-        "All files (*.*)";
-    QString filename = QFileDialog::getSaveFileName(this, "Save Image", filePath, filterName);
-
-    if (filename.isEmpty()) {
-        qDebug("can not have file");
-        return false;
-    } else {
-        QPixmap pixmap(screenshotPixmap);
-        qDebug() << filename;
-        pixmap.save(filename);
-    }
-
-    return true;
-}
-
-int Screenshot::getRotateAngle()
-{
-    return win->uiInfo->getMainFormDisplayType()->getAngle();
-}
-
-void Screenshot::createItems()
-{
-    statusBar = new QStatusBar(this);
-    toolbar = new QToolBar(this);
-
-    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()));
-}
-
-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);
-    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);
-}
-
-void Screenshot::showEvent(QShowEvent *event)
-{
-    Q_UNUSED(event)
-
-    // TODO:
-    move(win->geometry().center().x(),
-        win->geometry().center().y() - (geometry().size().height() / 2));
-}
-
-Screenshot::~Screenshot()
-{
-    qDebug("destroy screenshot dialog");
-
-    win->getPopupMenu()->screenshotDialog = NULL;
-}
diff --git a/tizen/src/ui/menu/screenshot.h b/tizen/src/ui/menu/screenshot.h
deleted file mode 100644 (file)
index bd1c0ff..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * 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
-
-#include <QtWidgets>
-
-class MainWindow;
-
-class Screenshot : public QDialog
-{
-    Q_OBJECT
-
-public:
-    explicit Screenshot(QWidget *parent, const QPixmap &screenshot);
-    ~Screenshot();
-
-    void setStatusBar(qreal xx, qreal yy);
-    int getSliderLevel();
-    int getRotateAngle();
-    QString getRatio();
-
-    QPixmap frameBuf;
-
-public slots:
-    void slotRefresh(const QPixmap &);
-
-protected:
-    void showEvent(QShowEvent *event);
-    QGraphicsScene* scene;
-
-private:
-    void createItems();
-    void setImage();
-    void setRatio(int level);
-    void updateStatusBar();
-
-    MainWindow *win;
-    QString posX;
-    QString posY;
-    QGridLayout *gridlayout;
-    QGraphicsView* view;
-    int sliderLevel;
-    QLabel *label;
-    QSlider *slider;
-    QPixmap screenshotPixmap;
-    QToolBar *toolbar;
-
-    QStatusBar *statusBar;
-    QMenu *fileMenu;
-    QMenu *editMenu;
-    QMenu *helpMenu;
-    QToolBar *toolBar;
-    float ratio;
-    QString ratioStr;
-    QAction *saveAct;
-    QAction *copyAct;
-    QAction *refreshAct;
-
-private slots:
-    bool slotSave();
-    void slotCopy();
-    void slotScaleChanged(int level);
-};
-
-#endif // SCREENSHOT_H
diff --git a/tizen/src/ui/menu/screenshotdialog.cpp b/tizen/src/ui/menu/screenshotdialog.cpp
new file mode 100644 (file)
index 0000000..0fb1c81
--- /dev/null
@@ -0,0 +1,262 @@
+/*
+ * Qt Screenshot
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * 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
+ * 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 <qtoolbutton.h>
+
+#include "screenshotdialog.h"
+#include "screenshotview.h"
+#include "mainwindow.h"
+
+ScreenShotDialog::ScreenShotDialog(QWidget *parent, const QPixmap &pixmap) :
+    QDialog(parent), screenshotPixmap(pixmap)
+{
+    this->win = (MainWindow *)parent;
+
+    setWindowTitle("Screen Shot - " + win->uiInfo->vmName +
+        " : " + QString::number(get_device_serial_number()));
+    setWindowIcon(QIcon(":/icons/screen_shot.png"));
+
+    createItems();
+
+    setImage();
+
+    toolbar->addAction(saveAct);
+    toolbar->addAction(copyAct);
+    toolbar->addAction(refreshAct);
+    toolbar->addSeparator();
+    toolbar->addWidget(slider);
+    gridlayout->addWidget(toolbar, 0, 0);
+    gridlayout->addWidget(view, 1, 0);
+    gridlayout->addWidget(statusBar, 2, 0);
+
+    setLayout(gridlayout);
+
+    resize(win->uiInfo->getMainSize());
+}
+
+void ScreenShotDialog::createItems()
+{
+    statusBar = new QStatusBar(this);
+    toolbar = new QToolBar(this);
+
+    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()));
+}
+
+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 ScreenShotDialog::setRatio(int level)
+{
+    switch (level) {
+    case 0:
+        ratio = 0.125;
+        break;
+    case 1:
+        ratio = 0.25;
+        break;
+    case 2:
+        ratio = 0.50;
+        break;
+    case 3:
+        ratio = 1;
+        break;
+    case 4:
+        ratio = 2;
+        break;
+    case 5:
+        ratio = 4;
+        break;
+    }
+    ratioStr = QString::number(ratio * 100).append("%");
+}
+
+int ScreenShotDialog::getSliderLevel()
+{
+    return sliderLevel;
+}
+
+bool ScreenShotDialog::slotSave()
+{
+    qDebug("save");
+
+    QString vmname = win->uiInfo->vmName;
+    QDateTime currentDateTime = QDateTime::currentDateTime();
+    QString date = currentDateTime.toString("yyyy-MM-dd-HHmmss");
+    QString filePath = QDir::homePath() + QDir::separator() + vmname + "-" + date + ".png";
+    QString filterName = "Image files (*.png *.jpg *.jpeg *.bmp *.ppm *.xbm *.xpm);;"
+        "All files (*.*)";
+    QString filename = QFileDialog::getSaveFileName(this, "Save Image", filePath, filterName);
+
+    if (filename.isEmpty()) {
+        qDebug("can not have file");
+        return false;
+    }
+
+    QPixmap pixmap(screenshotPixmap);
+    qDebug() << filename;
+    pixmap.save(filename);
+
+    return true;
+}
+
+void ScreenShotDialog::slotCopy()
+{
+    qDebug("copy to clipboard");
+
+    QClipboard* clipboard = QApplication::clipboard();
+    QPixmap pixmap(screenshotPixmap);
+    clipboard->clear();
+    clipboard->setPixmap(pixmap);
+}
+
+void ScreenShotDialog::slotRefresh(const QPixmap &pixmap)
+{
+    qDebug("refresh");
+
+    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 ScreenShotDialog::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();
+}
+
+void ScreenShotDialog::setStatusBar(qreal xx, qreal yy)
+{
+    posX = QString::number(xx);
+    posY = QString::number(yy);
+
+    updateStatusBar();
+}
+
+void ScreenShotDialog::updateStatusBar()
+{
+    statusBar->showMessage("x: " + posX + ", y:" + posY +
+        " (" + QString::number(screenshotPixmap.width()) +
+        "x" + QString::number(screenshotPixmap.height()) +
+        ", " + qPrintable(getRatio()) + ")");
+}
+
+void ScreenShotDialog::showEvent(QShowEvent *event)
+{
+    Q_UNUSED(event)
+
+    // TODO:
+    move(win->geometry().center().x(),
+        win->geometry().center().y() - (geometry().size().height() / 2));
+}
+
+ScreenShotDialog::~ScreenShotDialog()
+{
+    qDebug("destroy screenshot dialog");
+
+    win->getPopupMenu()->screenshotDialog = NULL;
+}
diff --git a/tizen/src/ui/menu/screenshotdialog.h b/tizen/src/ui/menu/screenshotdialog.h
new file mode 100644 (file)
index 0000000..87bd157
--- /dev/null
@@ -0,0 +1,95 @@
+/*
+ * Qt Screenshot
+ *
+ * Copyright (C) 2014 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * 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
+ * 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
+
+#include <QtWidgets>
+
+class MainWindow;
+
+class ScreenShotDialog : public QDialog
+{
+    Q_OBJECT
+
+public:
+    explicit ScreenShotDialog(QWidget *parent, const QPixmap &screenshot);
+    ~ScreenShotDialog();
+
+    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;
+
+private:
+    void createItems();
+    void setImage();
+    void setRatio(int level);
+    void updateStatusBar();
+
+    MainWindow *win;
+    QString posX;
+    QString posY;
+    QGridLayout *gridlayout;
+    QGraphicsView *view;
+    int sliderLevel;
+    QLabel *label;
+    QSlider *slider;
+    QPixmap screenshotPixmap;
+    QToolBar *toolbar;
+
+    QStatusBar *statusBar;
+    QMenu *fileMenu;
+    QMenu *editMenu;
+    QMenu *helpMenu;
+    QToolBar *toolBar;
+    float ratio;
+    QString ratioStr;
+    QAction *saveAct;
+    QAction *copyAct;
+    QAction *refreshAct;
+
+private slots:
+    void slotScaleChanged(int level);
+};
+
+#endif // SCREENSHOT_H
index 8c70088f5a9a9f94c3de713b18c92ea78f9ae5d1..987744462e423cb5404121f80f33538c27e5dc5b 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 94e43bae93cc07c41ea48e250c8912f4e42b79bd..a112e6662a505ba61657180edd4e6d9468fb7200 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);