diff --git a/data/kylin-photo-viewer.desktop b/data/kylin-photo-viewer.desktop
index 4fdc123..2526fa9 100644
--- a/data/kylin-photo-viewer.desktop
+++ b/data/kylin-photo-viewer.desktop
@@ -2,11 +2,14 @@
Name=Pictures
Name[zh_CN]=看图
Name[bo_CN]=རི་མོར་ལྟ་བ།
+Name[zh_HK]=看圖
Comment=Photo viewer, support to view, zoom and rotate images of various formats
Comment[zh_CN]=图片查看器,支持多种格式的图片的查看、缩放和旋转
Comment[bo_CN]=པར་རིས་ལྟ་ཆས་ཀྱི་རྣམ་གཞག་སྣ་མང་གི་པར་རིས་ལྟ་ཐུབ་པ་དང་།སྐྱེད་སྐྱུང་དང་འཁྱིལ་འཁོར་ལ་རྒྱབ་སྐྱོར་བྱེད་ཐུབ།
+Comment[zh_HK]=圖片查看器,支持多種格式的圖片的查看、縮放和旋轉
GenericName=Photo Viewer
GenericName[bo_CN]=རི་མོར་ལྟ་བ།
+GenericName[zh_HK]=看圖
Exec=/usr/bin/kylin-photo-viewer %u
Icon=kylin-photo-viewer
Type=Application
diff --git a/data/pictures/en_US/image/1.png b/data/pictures/en_US/image/1.png
new file mode 100644
index 0000000..87fc1d2
Binary files /dev/null and b/data/pictures/en_US/image/1.png differ
diff --git a/data/pictures/en_US/image/10.png b/data/pictures/en_US/image/10.png
new file mode 100644
index 0000000..564bef7
Binary files /dev/null and b/data/pictures/en_US/image/10.png differ
diff --git a/data/pictures/en_US/image/11.png b/data/pictures/en_US/image/11.png
new file mode 100644
index 0000000..e959f3b
Binary files /dev/null and b/data/pictures/en_US/image/11.png differ
diff --git a/data/pictures/en_US/image/12.png b/data/pictures/en_US/image/12.png
new file mode 100644
index 0000000..8808482
Binary files /dev/null and b/data/pictures/en_US/image/12.png differ
diff --git a/data/pictures/en_US/image/13.png b/data/pictures/en_US/image/13.png
new file mode 100644
index 0000000..1dbe9bb
Binary files /dev/null and b/data/pictures/en_US/image/13.png differ
diff --git a/data/pictures/en_US/image/14.png b/data/pictures/en_US/image/14.png
new file mode 100644
index 0000000..6ece1c6
Binary files /dev/null and b/data/pictures/en_US/image/14.png differ
diff --git a/data/pictures/en_US/image/15.png b/data/pictures/en_US/image/15.png
new file mode 100644
index 0000000..3d26d94
Binary files /dev/null and b/data/pictures/en_US/image/15.png differ
diff --git a/data/pictures/en_US/image/16.png b/data/pictures/en_US/image/16.png
new file mode 100644
index 0000000..b8774cd
Binary files /dev/null and b/data/pictures/en_US/image/16.png differ
diff --git a/data/pictures/en_US/image/17.png b/data/pictures/en_US/image/17.png
new file mode 100644
index 0000000..1cc8b11
Binary files /dev/null and b/data/pictures/en_US/image/17.png differ
diff --git a/data/pictures/en_US/image/18.png b/data/pictures/en_US/image/18.png
new file mode 100644
index 0000000..41ff4e6
Binary files /dev/null and b/data/pictures/en_US/image/18.png differ
diff --git a/data/pictures/en_US/image/19.png b/data/pictures/en_US/image/19.png
new file mode 100644
index 0000000..ee6c023
Binary files /dev/null and b/data/pictures/en_US/image/19.png differ
diff --git a/data/pictures/en_US/image/2.png b/data/pictures/en_US/image/2.png
new file mode 100644
index 0000000..d96aed8
Binary files /dev/null and b/data/pictures/en_US/image/2.png differ
diff --git a/data/pictures/en_US/image/20.png b/data/pictures/en_US/image/20.png
new file mode 100644
index 0000000..624776b
Binary files /dev/null and b/data/pictures/en_US/image/20.png differ
diff --git a/data/pictures/en_US/image/21.png b/data/pictures/en_US/image/21.png
new file mode 100644
index 0000000..35a887c
Binary files /dev/null and b/data/pictures/en_US/image/21.png differ
diff --git a/data/pictures/en_US/image/22.png b/data/pictures/en_US/image/22.png
new file mode 100644
index 0000000..9845d78
Binary files /dev/null and b/data/pictures/en_US/image/22.png differ
diff --git a/data/pictures/en_US/image/23.png b/data/pictures/en_US/image/23.png
new file mode 100644
index 0000000..92a71f4
Binary files /dev/null and b/data/pictures/en_US/image/23.png differ
diff --git a/data/pictures/en_US/image/24.png b/data/pictures/en_US/image/24.png
new file mode 100644
index 0000000..1d7d7eb
Binary files /dev/null and b/data/pictures/en_US/image/24.png differ
diff --git a/data/pictures/en_US/image/25.png b/data/pictures/en_US/image/25.png
new file mode 100644
index 0000000..ce17180
Binary files /dev/null and b/data/pictures/en_US/image/25.png differ
diff --git a/data/pictures/en_US/image/26.png b/data/pictures/en_US/image/26.png
new file mode 100644
index 0000000..45aa4ae
Binary files /dev/null and b/data/pictures/en_US/image/26.png differ
diff --git a/data/pictures/en_US/image/27.png b/data/pictures/en_US/image/27.png
new file mode 100644
index 0000000..4f367d6
Binary files /dev/null and b/data/pictures/en_US/image/27.png differ
diff --git a/data/pictures/en_US/image/28.png b/data/pictures/en_US/image/28.png
new file mode 100644
index 0000000..65e98b2
Binary files /dev/null and b/data/pictures/en_US/image/28.png differ
diff --git a/data/pictures/en_US/image/29.png b/data/pictures/en_US/image/29.png
new file mode 100644
index 0000000..feef927
Binary files /dev/null and b/data/pictures/en_US/image/29.png differ
diff --git a/data/pictures/en_US/image/3.png b/data/pictures/en_US/image/3.png
new file mode 100644
index 0000000..d96aed8
Binary files /dev/null and b/data/pictures/en_US/image/3.png differ
diff --git a/data/pictures/en_US/image/30.png b/data/pictures/en_US/image/30.png
new file mode 100644
index 0000000..1df15a3
Binary files /dev/null and b/data/pictures/en_US/image/30.png differ
diff --git a/data/pictures/en_US/image/31.png b/data/pictures/en_US/image/31.png
new file mode 100644
index 0000000..d8ff099
Binary files /dev/null and b/data/pictures/en_US/image/31.png differ
diff --git a/data/pictures/en_US/image/4.png b/data/pictures/en_US/image/4.png
new file mode 100644
index 0000000..d96aed8
Binary files /dev/null and b/data/pictures/en_US/image/4.png differ
diff --git a/data/pictures/en_US/image/5.png b/data/pictures/en_US/image/5.png
new file mode 100644
index 0000000..908cf40
Binary files /dev/null and b/data/pictures/en_US/image/5.png differ
diff --git a/data/pictures/en_US/image/6.png b/data/pictures/en_US/image/6.png
new file mode 100644
index 0000000..d96aed8
Binary files /dev/null and b/data/pictures/en_US/image/6.png differ
diff --git a/data/pictures/en_US/image/7.png b/data/pictures/en_US/image/7.png
new file mode 100644
index 0000000..87d0ae0
Binary files /dev/null and b/data/pictures/en_US/image/7.png differ
diff --git a/data/pictures/en_US/image/8.png b/data/pictures/en_US/image/8.png
new file mode 100644
index 0000000..f00b727
Binary files /dev/null and b/data/pictures/en_US/image/8.png differ
diff --git a/data/pictures/en_US/image/9.png b/data/pictures/en_US/image/9.png
new file mode 100644
index 0000000..41ff4e6
Binary files /dev/null and b/data/pictures/en_US/image/9.png differ
diff --git a/data/pictures/en_US/image/btn0.png b/data/pictures/en_US/image/btn0.png
deleted file mode 100644
index 790837a..0000000
Binary files a/data/pictures/en_US/image/btn0.png and /dev/null differ
diff --git a/data/pictures/en_US/image/cutImage.png b/data/pictures/en_US/image/cutImage.png
deleted file mode 100644
index 9e792e7..0000000
Binary files a/data/pictures/en_US/image/cutImage.png and /dev/null differ
diff --git a/data/pictures/en_US/image/enlarge1.png b/data/pictures/en_US/image/enlarge1.png
deleted file mode 100644
index 826e7da..0000000
Binary files a/data/pictures/en_US/image/enlarge1.png and /dev/null differ
diff --git a/data/pictures/en_US/image/information1.png b/data/pictures/en_US/image/information1.png
deleted file mode 100644
index 89a87c7..0000000
Binary files a/data/pictures/en_US/image/information1.png and /dev/null differ
diff --git a/data/pictures/en_US/image/main.png b/data/pictures/en_US/image/main.png
deleted file mode 100644
index 024823a..0000000
Binary files a/data/pictures/en_US/image/main.png and /dev/null differ
diff --git a/data/pictures/en_US/image/menu.png b/data/pictures/en_US/image/menu.png
deleted file mode 100644
index f57b811..0000000
Binary files a/data/pictures/en_US/image/menu.png and /dev/null differ
diff --git a/data/pictures/en_US/image/openImage.png b/data/pictures/en_US/image/openImage.png
deleted file mode 100644
index e53343f..0000000
Binary files a/data/pictures/en_US/image/openImage.png and /dev/null differ
diff --git a/data/pictures/en_US/image/rorate.png b/data/pictures/en_US/image/rorate.png
deleted file mode 100644
index a87f7bb..0000000
Binary files a/data/pictures/en_US/image/rorate.png and /dev/null differ
diff --git a/data/pictures/en_US/image/side.png b/data/pictures/en_US/image/side.png
deleted file mode 100644
index e99b251..0000000
Binary files a/data/pictures/en_US/image/side.png and /dev/null differ
diff --git a/data/pictures/en_US/index.md b/data/pictures/en_US/index.md
index 84ec583..ae2d407 100644
--- a/data/pictures/en_US/index.md
+++ b/data/pictures/en_US/index.md
@@ -1,81 +1,101 @@
-# Pictures
-## Overview
-Pictures is a simple, user-friendly image viewer that supports multiple image formats. While viewing the picture, you can also edit and process the picture simply, such as zooming in,
-zooming out, rotating, flipping, deleting, etc. In addition, you can view the details of the picture. The main interface is shown in Figure 1.
-
-![Fig 1 Eyes of Pictures-big](image/main.png)
-
-
-## Basic Function
-Icons and Function:
-
-| Icon | Function | Icon | Function |
-| :------------ | :------------ | :------------ | :------------ |
-|![](image/btn0.png)| Open image |![](image/btn1.png)| Previous
-|![](image/btn2.png)| Next|![](image/btn3.png)| Enlarge
-|![](image/btn4.png)| Shrink|![](image/btn5.png)| Show as normal size
-|![](image/btn6.png)| Fit to the window|![](image/btn7.png)|Rotate 90 degrees
-|![](image/btn8.png)| Flip horizontally|![](image/btn9.png)|Flip vertical
-|![](image/btn10.png)| View details|![](image/btn12.png)| Sidebar
-|![](image/btn11.png)| Delete to trash |![](image/btn13.png)| Crop
-
-
-
-Click the "+" button in the main interface or the "![](image/menu1.png)" button to open a picture. Click the Sidebar or "next" or "back" button to switch. As shown in Figure 2.
-
-![Fig 2 Open image-big](image/openImage.png)
-
-
-## Toolbar
-Toolbar mainly provides some operations on pictures, including: zoom out, zoom in, view the original size of the picture, adapt to the size of the window, rotate, flip horizontally, flip
-vertically, view the details of the picture, delete.
-The functions of changing the size include: reducing, enlarging, viewing the original size of the picture, and adapting to the size of the window。Take zooming in as an example, click the
-"![](image/btn3.png)" button on the toolbar to zoom in the picture. When the picture is enlarged beyond the visual range of the main interface, drag the highlight window in the middle of the
-navigator to view the whole picture. As shown in Figure 3.
-
-![Fig 3 Enlarge——Navigator-big](image/enlarge1.png)
-
-The functions of image rotation include: rotation, horizontal mirror and vertical mirror.Take rotation as an example, click the “![](image/btn7.png)” button of the toolbar to rotate picture 90°
- clockwise. As shown in Figure 4.
-
-![Fig 4 Rorate-big](image/rorate.png)
-
-Click the "![](image/btn12.png)" button in the toolbar to view the Sidebar of all supported pictures in the folder where the current picture is located on the left side of the main
-interface. Click one to switch the display of the current picture in the main interface. As shown in Figure 5.
-
-![Fig 5 Sidebar-big](image/side.png)
-
-Click the "![](image/btn10.png)" button in the toolbar to view the details of the current picture in the upper right window of the main interface. As shown in Figure 5.
-
-![Fig 6 View details-big](image/information1.png)
-
-Click the "![](image/btn13.png)" button in the toolbar to crop the current picture. As shown in Figure 5.
-
-![Fig 7 Crop-big](image/cutImage.png)
-
-Click the "![](image/btn11.png)" button in the toolbar to delete the current picture to the recycle bin.
-
-
-
-## ContextMenu
-The right-click menu of pictures mainly includes the following functions: copy, print, delete, rename, set as desktop wallpaper, and show in file. As shown in Figure 7.
-
-![Fig 7 Right click menu-big](image/menu.png)
-
-Click the copy option to copy the image to the clipboard. Click the print option to send the picture to the printer for printing. Click the delete option to delete the current picture to the
-recycle bin. Click rename to edit the current image file name. Click save as to save the current image as other format. In addition, you can set the image format supported by desktop wallpaper to desktop wallpaper. Finally, you can select display
-directly in the folder.
-
-
-
-## Appendix
-### Shortcut Key
-
-| Shortcut | Function |
-| :------------ | :------------ |
-|← | Previous
-|→ | Next
-|del | Delete
-|esc | Cancel
-|enter | Save
-
+# Pictures
+## Overview
+Pictures is an easy-to-use, user-friendly image viewer that supports opening multiple image formats. While viewing the image, you can also edit and process the image simply, and support the functions of image scaling scale selection, adaptive window display, image clipping, image mirror flipping and so on.
+
+
+
+## Opening mode
+* "**opening menu**"![](image/1.png)>"**Pictures**"![](image/2.png)
+* Selected image > double-click > Open by default > "**Pictures**"![](image/3.png)
+* Selected image > Right click > "**Opening mode**" > "**Pictures**"![](image/4.png)
+* "**taskbar**" > "**search**"![](image/5.png) > "**Pictures**"![](image/6.png) > selected"**open**"
+
+
+
+![picture-Day Mode-big](image/7.png)
+
+
+
+![picture-Night mode-big](image/8.png)
+
+
+
+## Basic operation
+Open the picture for the first time, click"**load picture**"or click "![](image/9.png)"button and select "**open**" to select and open the image file. After opening the image file, click "![](image/10.png)" in the toolbar to open the sidebar, which displays the thumbnail of the image. Selecting the "+" button in the sidebar can also open other images.
+
+
+
+After opening the image, the interface only displays the current image and the sidebar when the cursor does not stay.
+
+
+
+![picture-Cursor does not stay-big](image/11.png)
+
+
+
+When the cursor stays on the interface, the image name, toolbar and the button to switch images are displayed. The toolbar mainly provides some image view options and image editing operations. Please refer to the toolbar function description for detailed function introduction.
+
+Click "![](image/12.png)" to switch the previous image, click "![](image/13.png)" to switch the next image, or click the thumbnail in the sidebar to switch the image. Shortcut keys can also be used to switch and delete images. Shortcut keys and corresponding functions are shown in the following table:
+
+| Shortcut key | function |
+| ------------ | --------------------- |
+| ← | Previous |
+| → | Next |
+| Shift + Del | Delete to recycle bin |
+
+
+
+![picture-Cursor stay-big](image/14.png)
+
+
+
+Click "![](image/15.png)" in the toolbar to view the image details, including name, format, size, size, color space, creation time and modification time.
+
+
+
+![picture-View image information-big](image/16.png)
+
+
+
+Right click the image to pop up the menu bar, which provides the function options of image copy, print, delete, save as, rename, set as desktop wallpaper, and display in folder.
+
+Select "copy" to copy the image to the clipboard; Select "print" to send the image to the printer for printing; Select "delete" to delete the current image to the recycle bin; Select "Rename" to edit the current image file name; Select "show in folder" to open the folder location of the image. In addition, you can set the image format supported by desktop wallpaper as desktop wallpaper.
+
+
+
+![Right click menu bar-big](image/17.png)
+
+
+
+Click "![](image/18.png)" in the upper right corner of the interface to open the picture viewing menu bar, select the option of "**open**" to select and open the image file, select "**help**" to automatically jump to the user manual to view the operating instructions of the tool, select "**about**" to view the current version information, and select "**exit**" to close and exit the application.
+
+
+
+![View menu bar-big](image/19.png)
+
+
+
+## toolbar
+The toolbar mainly provides some operations for images, including reducing the view, enlarging the view, adapting to the window, rotating to the right, horizontal mirroring, clipping, viewing image information, displaying / hiding the sidebar, and deleting images.
+
+
+
+![View toolbar-big](image/20.png)
+
+
+
+Function description of Drawing toolbar
+
+| Secondary menu | function | describe |
+| ----------------- | -------------------- | -------------------------------- |
+| ![](image/21.png) | Adjust attempt ratio | Zoom in and out of the image |
+| ![](image/22.png) | Fit window | Adjust image to fit window |
+| ![](image/23.png) | Original size | Display image in full size |
+| ![](image/24.png) | Rotate right | Image rotates 90 ° clockwise |
+| ![](image/25.png) | Horizontal mirror | Flip image horizontally |
+| ![](image/26.png) | mirror vertically | Flip image vertically |
+| ![](image/31.png) | OCR | Identify the text in the picture |
+| ![](image/27.png) | Clipping | Custom clip image |
+| ![](image/28.png) | sidebar | Turn the sidebar on / off |
+| ![](image/29.png) | information | View image information |
+| ![](image/30.png) | delete | Delete image to recycle bin |
\ No newline at end of file
diff --git a/data/pictures/pictures.png b/data/pictures/pictures.png
old mode 100644
new mode 100755
index 3d88119..581f15e
Binary files a/data/pictures/pictures.png and b/data/pictures/pictures.png differ
diff --git a/data/pictures/zh_CN/image/1.png b/data/pictures/zh_CN/image/1.png
new file mode 100644
index 0000000..87fc1d2
Binary files /dev/null and b/data/pictures/zh_CN/image/1.png differ
diff --git a/data/pictures/zh_CN/image/10.png b/data/pictures/zh_CN/image/10.png
new file mode 100644
index 0000000..564bef7
Binary files /dev/null and b/data/pictures/zh_CN/image/10.png differ
diff --git a/data/pictures/zh_CN/image/11.png b/data/pictures/zh_CN/image/11.png
new file mode 100644
index 0000000..e959f3b
Binary files /dev/null and b/data/pictures/zh_CN/image/11.png differ
diff --git a/data/pictures/zh_CN/image/12.png b/data/pictures/zh_CN/image/12.png
new file mode 100644
index 0000000..8808482
Binary files /dev/null and b/data/pictures/zh_CN/image/12.png differ
diff --git a/data/pictures/zh_CN/image/13.png b/data/pictures/zh_CN/image/13.png
new file mode 100644
index 0000000..1dbe9bb
Binary files /dev/null and b/data/pictures/zh_CN/image/13.png differ
diff --git a/data/pictures/zh_CN/image/14.png b/data/pictures/zh_CN/image/14.png
new file mode 100644
index 0000000..10ac80e
Binary files /dev/null and b/data/pictures/zh_CN/image/14.png differ
diff --git a/data/pictures/zh_CN/image/15.png b/data/pictures/zh_CN/image/15.png
new file mode 100644
index 0000000..3d26d94
Binary files /dev/null and b/data/pictures/zh_CN/image/15.png differ
diff --git a/data/pictures/zh_CN/image/16.png b/data/pictures/zh_CN/image/16.png
new file mode 100644
index 0000000..f740151
Binary files /dev/null and b/data/pictures/zh_CN/image/16.png differ
diff --git a/data/pictures/zh_CN/image/17.png b/data/pictures/zh_CN/image/17.png
new file mode 100644
index 0000000..002e0e0
Binary files /dev/null and b/data/pictures/zh_CN/image/17.png differ
diff --git a/data/pictures/zh_CN/image/18.png b/data/pictures/zh_CN/image/18.png
new file mode 100644
index 0000000..41ff4e6
Binary files /dev/null and b/data/pictures/zh_CN/image/18.png differ
diff --git a/data/pictures/zh_CN/image/19.png b/data/pictures/zh_CN/image/19.png
new file mode 100644
index 0000000..32269df
Binary files /dev/null and b/data/pictures/zh_CN/image/19.png differ
diff --git a/data/pictures/zh_CN/image/2.png b/data/pictures/zh_CN/image/2.png
new file mode 100644
index 0000000..d96aed8
Binary files /dev/null and b/data/pictures/zh_CN/image/2.png differ
diff --git a/data/pictures/zh_CN/image/20.png b/data/pictures/zh_CN/image/20.png
new file mode 100644
index 0000000..624776b
Binary files /dev/null and b/data/pictures/zh_CN/image/20.png differ
diff --git a/data/pictures/zh_CN/image/21.png b/data/pictures/zh_CN/image/21.png
new file mode 100644
index 0000000..35a887c
Binary files /dev/null and b/data/pictures/zh_CN/image/21.png differ
diff --git a/data/pictures/zh_CN/image/22.png b/data/pictures/zh_CN/image/22.png
new file mode 100644
index 0000000..9845d78
Binary files /dev/null and b/data/pictures/zh_CN/image/22.png differ
diff --git a/data/pictures/zh_CN/image/23.png b/data/pictures/zh_CN/image/23.png
new file mode 100644
index 0000000..92a71f4
Binary files /dev/null and b/data/pictures/zh_CN/image/23.png differ
diff --git a/data/pictures/zh_CN/image/24.png b/data/pictures/zh_CN/image/24.png
new file mode 100644
index 0000000..1d7d7eb
Binary files /dev/null and b/data/pictures/zh_CN/image/24.png differ
diff --git a/data/pictures/zh_CN/image/25.png b/data/pictures/zh_CN/image/25.png
new file mode 100644
index 0000000..ce17180
Binary files /dev/null and b/data/pictures/zh_CN/image/25.png differ
diff --git a/data/pictures/zh_CN/image/26.png b/data/pictures/zh_CN/image/26.png
new file mode 100644
index 0000000..45aa4ae
Binary files /dev/null and b/data/pictures/zh_CN/image/26.png differ
diff --git a/data/pictures/zh_CN/image/27.png b/data/pictures/zh_CN/image/27.png
new file mode 100644
index 0000000..4f367d6
Binary files /dev/null and b/data/pictures/zh_CN/image/27.png differ
diff --git a/data/pictures/zh_CN/image/28.png b/data/pictures/zh_CN/image/28.png
new file mode 100644
index 0000000..65e98b2
Binary files /dev/null and b/data/pictures/zh_CN/image/28.png differ
diff --git a/data/pictures/zh_CN/image/29.png b/data/pictures/zh_CN/image/29.png
new file mode 100644
index 0000000..feef927
Binary files /dev/null and b/data/pictures/zh_CN/image/29.png differ
diff --git a/data/pictures/zh_CN/image/3.png b/data/pictures/zh_CN/image/3.png
new file mode 100644
index 0000000..d96aed8
Binary files /dev/null and b/data/pictures/zh_CN/image/3.png differ
diff --git a/data/pictures/zh_CN/image/30.png b/data/pictures/zh_CN/image/30.png
new file mode 100644
index 0000000..1df15a3
Binary files /dev/null and b/data/pictures/zh_CN/image/30.png differ
diff --git a/data/pictures/zh_CN/image/31.png b/data/pictures/zh_CN/image/31.png
new file mode 100755
index 0000000..d8ff099
Binary files /dev/null and b/data/pictures/zh_CN/image/31.png differ
diff --git a/data/pictures/zh_CN/image/4.png b/data/pictures/zh_CN/image/4.png
new file mode 100644
index 0000000..d96aed8
Binary files /dev/null and b/data/pictures/zh_CN/image/4.png differ
diff --git a/data/pictures/zh_CN/image/5.png b/data/pictures/zh_CN/image/5.png
new file mode 100644
index 0000000..908cf40
Binary files /dev/null and b/data/pictures/zh_CN/image/5.png differ
diff --git a/data/pictures/zh_CN/image/6.png b/data/pictures/zh_CN/image/6.png
new file mode 100644
index 0000000..d96aed8
Binary files /dev/null and b/data/pictures/zh_CN/image/6.png differ
diff --git a/data/pictures/zh_CN/image/7.png b/data/pictures/zh_CN/image/7.png
new file mode 100644
index 0000000..2bbea99
Binary files /dev/null and b/data/pictures/zh_CN/image/7.png differ
diff --git a/data/pictures/zh_CN/image/8.png b/data/pictures/zh_CN/image/8.png
new file mode 100644
index 0000000..38a9ff9
Binary files /dev/null and b/data/pictures/zh_CN/image/8.png differ
diff --git a/data/pictures/zh_CN/image/9.png b/data/pictures/zh_CN/image/9.png
new file mode 100644
index 0000000..41ff4e6
Binary files /dev/null and b/data/pictures/zh_CN/image/9.png differ
diff --git a/data/pictures/zh_CN/image/btn1.png b/data/pictures/zh_CN/image/btn1.png
deleted file mode 100644
index bb78358..0000000
Binary files a/data/pictures/zh_CN/image/btn1.png and /dev/null differ
diff --git a/data/pictures/zh_CN/image/btn10.png b/data/pictures/zh_CN/image/btn10.png
deleted file mode 100644
index 5aae3e4..0000000
Binary files a/data/pictures/zh_CN/image/btn10.png and /dev/null differ
diff --git a/data/pictures/zh_CN/image/btn11.png b/data/pictures/zh_CN/image/btn11.png
deleted file mode 100644
index 7b682f7..0000000
Binary files a/data/pictures/zh_CN/image/btn11.png and /dev/null differ
diff --git a/data/pictures/zh_CN/image/btn12.png b/data/pictures/zh_CN/image/btn12.png
deleted file mode 100644
index e45d7c2..0000000
Binary files a/data/pictures/zh_CN/image/btn12.png and /dev/null differ
diff --git a/data/pictures/zh_CN/image/btn13.png b/data/pictures/zh_CN/image/btn13.png
deleted file mode 100644
index b406640..0000000
Binary files a/data/pictures/zh_CN/image/btn13.png and /dev/null differ
diff --git a/data/pictures/zh_CN/image/btn14.png b/data/pictures/zh_CN/image/btn14.png
deleted file mode 100644
index 6fd66c2..0000000
Binary files a/data/pictures/zh_CN/image/btn14.png and /dev/null differ
diff --git a/data/pictures/zh_CN/image/btn2.png b/data/pictures/zh_CN/image/btn2.png
deleted file mode 100644
index 5c099a5..0000000
Binary files a/data/pictures/zh_CN/image/btn2.png and /dev/null differ
diff --git a/data/pictures/zh_CN/image/btn3.png b/data/pictures/zh_CN/image/btn3.png
deleted file mode 100644
index 5a4107e..0000000
Binary files a/data/pictures/zh_CN/image/btn3.png and /dev/null differ
diff --git a/data/pictures/zh_CN/image/btn4.png b/data/pictures/zh_CN/image/btn4.png
deleted file mode 100644
index 818edc5..0000000
Binary files a/data/pictures/zh_CN/image/btn4.png and /dev/null differ
diff --git a/data/pictures/zh_CN/image/btn5.png b/data/pictures/zh_CN/image/btn5.png
deleted file mode 100644
index 9c128be..0000000
Binary files a/data/pictures/zh_CN/image/btn5.png and /dev/null differ
diff --git a/data/pictures/zh_CN/image/btn6.png b/data/pictures/zh_CN/image/btn6.png
deleted file mode 100644
index 093e717..0000000
Binary files a/data/pictures/zh_CN/image/btn6.png and /dev/null differ
diff --git a/data/pictures/zh_CN/image/btn7.png b/data/pictures/zh_CN/image/btn7.png
deleted file mode 100644
index ed07877..0000000
Binary files a/data/pictures/zh_CN/image/btn7.png and /dev/null differ
diff --git a/data/pictures/zh_CN/image/btn8.png b/data/pictures/zh_CN/image/btn8.png
deleted file mode 100644
index 811ffab..0000000
Binary files a/data/pictures/zh_CN/image/btn8.png and /dev/null differ
diff --git a/data/pictures/zh_CN/image/btn9.png b/data/pictures/zh_CN/image/btn9.png
deleted file mode 100644
index fb4de3a..0000000
Binary files a/data/pictures/zh_CN/image/btn9.png and /dev/null differ
diff --git a/data/pictures/zh_CN/image/cutImage.png b/data/pictures/zh_CN/image/cutImage.png
deleted file mode 100644
index 9e792e7..0000000
Binary files a/data/pictures/zh_CN/image/cutImage.png and /dev/null differ
diff --git a/data/pictures/zh_CN/image/enlarge1.png b/data/pictures/zh_CN/image/enlarge1.png
deleted file mode 100644
index b4919b9..0000000
Binary files a/data/pictures/zh_CN/image/enlarge1.png and /dev/null differ
diff --git a/data/pictures/zh_CN/image/information1.png b/data/pictures/zh_CN/image/information1.png
deleted file mode 100644
index 3170375..0000000
Binary files a/data/pictures/zh_CN/image/information1.png and /dev/null differ
diff --git a/data/pictures/zh_CN/image/main.png b/data/pictures/zh_CN/image/main.png
deleted file mode 100644
index ce696ab..0000000
Binary files a/data/pictures/zh_CN/image/main.png and /dev/null differ
diff --git a/data/pictures/zh_CN/image/menu.png b/data/pictures/zh_CN/image/menu.png
deleted file mode 100644
index 645bd50..0000000
Binary files a/data/pictures/zh_CN/image/menu.png and /dev/null differ
diff --git a/data/pictures/zh_CN/image/menu1.png b/data/pictures/zh_CN/image/menu1.png
deleted file mode 100644
index 47e495e..0000000
Binary files a/data/pictures/zh_CN/image/menu1.png and /dev/null differ
diff --git a/data/pictures/zh_CN/image/openImage.png b/data/pictures/zh_CN/image/openImage.png
deleted file mode 100644
index e53343f..0000000
Binary files a/data/pictures/zh_CN/image/openImage.png and /dev/null differ
diff --git a/data/pictures/zh_CN/image/rorate.png b/data/pictures/zh_CN/image/rorate.png
deleted file mode 100644
index 0c1bf8d..0000000
Binary files a/data/pictures/zh_CN/image/rorate.png and /dev/null differ
diff --git a/data/pictures/zh_CN/image/side.png b/data/pictures/zh_CN/image/side.png
deleted file mode 100644
index e99b251..0000000
Binary files a/data/pictures/zh_CN/image/side.png and /dev/null differ
diff --git a/data/pictures/zh_CN/index.md b/data/pictures/zh_CN/index.md
index f4fc69e..ef626c6 100644
--- a/data/pictures/zh_CN/index.md
+++ b/data/pictures/zh_CN/index.md
@@ -1,73 +1,101 @@
-# 看图
-## 概 述
-看图是一款简单易用,界面友好,支持多种图片格式的图片查看器。在查看图片的同时,还可以对图片进行简单的编辑和处理,例如:放大、缩小、旋转、翻转、删除等。除此之外,还可以查看图片的详细信息。主界面如图1所示。
-
-![图 1 看图主界面-big](image/main.png)
-
-
-## 基本功能
-图标及其功能:
-
-|图 标 |功能说明 |图 标| 功能说明
-| :------------ | :------------ | :------------ | :------------ |
-|![](image/btn0.png)| 打开图片 |![](image/btn1.png)| 上一张
-|![](image/btn2.png)| 下一张|![](image/btn3.png)| 放大
-|![](image/btn4.png)| 缩小|![](image/btn5.png)| 正常大小显示图片
-|![](image/btn6.png)| 图像适合窗口|![](image/btn7.png)|图片旋转90度
-|![](image/btn8.png)| 水平镜像|![](image/btn9.png)|垂直镜像
-|![](image/btn10.png)| 查看图片详细信息|![](image/btn12.png)| 侧边栏
-|![](image/btn11.png)| 删除到回收站| ![](image/btn13.png)| 裁剪
-
-
-
-点击主界面“+”按钮或者“![](image/menu1.png)”按钮的“打开”选项,打开一张图片。打开侧边栏后,点击侧边栏缩略图或“下一张”“上一张”按钮进行切换。如图2所示。
-
-![图 2 打开图片-big](image/openImage.png)
-
-
-## 工具栏
-工具栏主要提供一些对图片的操作,包括:缩小、放大、查看图片原始尺寸、适应窗口尺寸、旋转、水平翻转、垂直翻转、查看图片详细信息、删除。
-改变尺寸的功能包括:缩小、放大、查看图片原始尺寸、适应窗口尺寸。以放大为例,点击工具栏的“![](image/btn3.png)”按钮,可对图片进行放大。当图片放大到超出主界面可视范围时,拖动导航器中间的高亮窗口,用户可查看图片全貌。如图3所示。
-
-![图 3 放大——导航器-big](image/enlarge1.png)
-
-对图片旋转的功能包括:旋转、水平镜像和垂直镜像。以旋转为例,每次点击工具栏的“![](image/btn7.png)”按钮,可对图片进行90°顺时针旋转。如图4所示。
-
-![图 4 旋转-big](image/rorate.png)
-
-点击工具栏的“![](image/btn12.png)”按钮,可以在主界面的左侧查看当前图片所在文件夹的所有可支持图片的缩略图。点击某一个可切换主界面当前图片的显示。如图5所示。
-
-![图 5 查看侧边栏-big](image/side.png)
-
-点击工具栏的“![](image/btn10.png)”按钮,可以在主界面的右上角窗口查看当前图片的详细信息。如图6所示。
-
-![图 6 查看详细信息-big](image/information1.png)
-
-点击工具栏的“![](image/btn13.png)”按钮,可以在进入裁剪模式。如图7所示。
-
-![图 7 裁剪-big](image/cutImage.png)
-
-点击工具栏的“![](image/btn11.png)”按钮,可以将当前图片删除至回收站。
-
-
-
-## 右键菜单
-图片右键菜单主要包含以下功能:复制、打印、删除、另存为、重命名、设置为桌面壁纸、在文件夹中显示。如图7所示。
-
-![图 7 图片右键菜单-big](image/menu.png)
-
-点击复制选项,可将图片复制到剪切板。点击打印选项,可将图片发送给打印机进行打印。点击删除选项,可将当前图片删除到回收站。点击另存为,可将当前图片转换为其他支持的格式。点击重命名,对当前图片文件名进行编辑。另外还可以将桌面壁纸支持的图片格式设置为桌面壁纸。最后,可直接在文件夹中选中显示。
-
-
-
-## 附 录
-### 快捷键
-
-| 快捷键 | 功能 |
-| :------------ | :------------ |
-|← | 上一张
-|→ | 下一张
-|del | 删除
-|esc | 取消
-|enter | 保存
-
+# 看图
+## 概述
+看图是一款简单易用,界面友好,支持打开多种图像格式的图像查看器。在查看图像的同时,还可以对图像进行简单的编辑和处理,支持图像缩放比例选择、自适应窗口显示、图像裁剪、图像镜像翻转等功能。
+
+
+
+## 打开方式
+* “**开始菜单**”![](image/1.png)>“**看图**”![](image/2.png)
+* 选中图像 > 双击 > 默认打开 > “**看图**”![](image/3.png)
+* 选中图像 > 右键单击 > “**打开方式**” > “**看图**”![](image/4.png)
+* “**任务栏**” > “**搜索**”![](image/5.png) > “**看图**”![](image/6.png) > 选择“**打开**”
+
+
+
+![看图-日间模式-big](image/7.png)
+
+
+
+![看图-夜间模式-big](image/8.png)
+
+
+
+## 基本操作
+首次打开看图,点击“**载入图片**”或者点击“![](image/9.png)”按钮后选择“**打开**”选择并打开图像文件。打开图像文件后,点击工具栏中的“![](image/10.png)”可以打开侧边栏,侧边栏展示了图像的缩略图,选择侧边栏中的“+”按钮也可以打开其他图像。
+
+
+
+打开图像后,光标无停留时界面仅显示当前图像和侧边栏。
+
+
+
+![看图-光标无停留-big](image/11.png)
+
+
+
+光标停留在界面时显示图像名、工具栏以及切换图像的按钮。工具栏主要提供一些图像视图选项和图像编辑操作,详细功能介绍请见工具栏功能说明。
+
+点击“![](image/12.png)”切换上一张图像,点击“![](image/13.png)”切换下一张图像,或者点击侧边栏中的缩略图切换图像。使用快捷键也可以进行切换、删除图像的操作。快捷键及对应功能如下表所示:
+
+| 快捷键 | 功能 |
+| ----------- | ---------- |
+| ← | 上一张 |
+| → | 下一张 |
+| Shift + Del | 删除到回收站 |
+
+
+
+![看图-光标停留-big](image/14.png)
+
+
+
+点击工具栏中的“![](image/15.png)”可以查看图像详细信息,包括名称、格式、大小、尺寸、颜色空间、创建时间及修改时间。
+
+
+
+![看图-查看图像信息-big](image/16.png)
+
+
+
+右键单击图像会弹出菜单栏,提供图像的复制、打印、删除、另存为、重命名、设置为桌面壁纸、在文件夹中显示的功能选项。
+
+选择“复制”可将图像复制到剪切板;选择“打印”可将图像发送给打印机进行打印;选择“删除”可将当前图像删除到回收站;选择“重命名”可对当前图像文件名进行编辑;选择“在文件夹中显示”可打开图像所在文件夹位置。另外还可以将桌面壁纸支持的图像格式设置为桌面壁纸。
+
+
+
+![右键菜单栏-big](image/17.png)
+
+
+
+点击界面右上角“![](image/18.png)”可以打开看图菜单栏,选择“**打开**”选项可以选择并打开图像文件,选择“**帮助**”将自动跳转至用户手册中,可查看该工具的操作说明,选择“**关于**”可查看当前版本信息,选择“**退出**”即关闭并退出应用。
+
+
+
+![看图菜单栏-big](image/19.png)
+
+
+
+## 工具栏
+工具栏主要提供一些对图像的操作,包括:缩小视图、放大视图、适应窗口、向右旋转、水平镜像、剪裁、查看图像信息、显示/隐藏侧边栏、删除图像。
+
+
+
+![看图工具栏-big](image/20.png)
+
+
+
+看图工具栏功能说明
+
+| 二级菜单 | 功能 | 描述 |
+| ------- | ----| ----|
+| ![](image/21.png) | 调整试图比例 | 放大、缩小图像 |
+| ![](image/22.png) | 适应窗口 | 调整图像适应窗口 |
+| ![](image/23.png) | 原尺寸 | 以原尺寸显示图像 |
+| ![](image/24.png) | 向右旋转 | 图像顺时针旋转90° |
+| ![](image/25.png) | 水平镜像 | 水平翻转图像 |
+| ![](image/26.png) | 垂直镜像 | 垂直翻转图像 |
+| ![](image/31.png) | OCR | 识别图片中的文字 |
+| ![](image/27.png) | 剪裁 | 自定义剪裁图像 |
+| ![](image/28.png) | 侧边栏 | 打开/关闭侧边栏 |
+| ![](image/29.png) | 信息 | 查看图像信息 |
+| ![](image/30.png) | 删除 | 删除图像至回收站 |
\ No newline at end of file
diff --git a/data/pictures/zh_CN/image/btn0.png b/data/pictures/zh_HK/image/btn0.png
similarity index 100%
rename from data/pictures/zh_CN/image/btn0.png
rename to data/pictures/zh_HK/image/btn0.png
diff --git a/data/pictures/en_US/image/btn1.png b/data/pictures/zh_HK/image/btn1.png
similarity index 100%
rename from data/pictures/en_US/image/btn1.png
rename to data/pictures/zh_HK/image/btn1.png
diff --git a/data/pictures/en_US/image/btn10.png b/data/pictures/zh_HK/image/btn10.png
similarity index 100%
rename from data/pictures/en_US/image/btn10.png
rename to data/pictures/zh_HK/image/btn10.png
diff --git a/data/pictures/en_US/image/btn11.png b/data/pictures/zh_HK/image/btn11.png
similarity index 100%
rename from data/pictures/en_US/image/btn11.png
rename to data/pictures/zh_HK/image/btn11.png
diff --git a/data/pictures/en_US/image/btn12.png b/data/pictures/zh_HK/image/btn12.png
similarity index 100%
rename from data/pictures/en_US/image/btn12.png
rename to data/pictures/zh_HK/image/btn12.png
diff --git a/data/pictures/en_US/image/btn13.png b/data/pictures/zh_HK/image/btn13.png
similarity index 100%
rename from data/pictures/en_US/image/btn13.png
rename to data/pictures/zh_HK/image/btn13.png
diff --git a/data/pictures/en_US/image/btn14.png b/data/pictures/zh_HK/image/btn14.png
similarity index 100%
rename from data/pictures/en_US/image/btn14.png
rename to data/pictures/zh_HK/image/btn14.png
diff --git a/data/pictures/en_US/image/btn2.png b/data/pictures/zh_HK/image/btn2.png
similarity index 100%
rename from data/pictures/en_US/image/btn2.png
rename to data/pictures/zh_HK/image/btn2.png
diff --git a/data/pictures/en_US/image/btn3.png b/data/pictures/zh_HK/image/btn3.png
similarity index 100%
rename from data/pictures/en_US/image/btn3.png
rename to data/pictures/zh_HK/image/btn3.png
diff --git a/data/pictures/en_US/image/btn4.png b/data/pictures/zh_HK/image/btn4.png
similarity index 100%
rename from data/pictures/en_US/image/btn4.png
rename to data/pictures/zh_HK/image/btn4.png
diff --git a/data/pictures/en_US/image/btn5.png b/data/pictures/zh_HK/image/btn5.png
similarity index 100%
rename from data/pictures/en_US/image/btn5.png
rename to data/pictures/zh_HK/image/btn5.png
diff --git a/data/pictures/en_US/image/btn6.png b/data/pictures/zh_HK/image/btn6.png
similarity index 100%
rename from data/pictures/en_US/image/btn6.png
rename to data/pictures/zh_HK/image/btn6.png
diff --git a/data/pictures/en_US/image/btn7.png b/data/pictures/zh_HK/image/btn7.png
similarity index 100%
rename from data/pictures/en_US/image/btn7.png
rename to data/pictures/zh_HK/image/btn7.png
diff --git a/data/pictures/en_US/image/btn8.png b/data/pictures/zh_HK/image/btn8.png
similarity index 100%
rename from data/pictures/en_US/image/btn8.png
rename to data/pictures/zh_HK/image/btn8.png
diff --git a/data/pictures/en_US/image/btn9.png b/data/pictures/zh_HK/image/btn9.png
similarity index 100%
rename from data/pictures/en_US/image/btn9.png
rename to data/pictures/zh_HK/image/btn9.png
diff --git a/data/pictures/zh_HK/image/cutImage.png b/data/pictures/zh_HK/image/cutImage.png
new file mode 100644
index 0000000..bb2d343
Binary files /dev/null and b/data/pictures/zh_HK/image/cutImage.png differ
diff --git a/data/pictures/zh_HK/image/enlarge1.png b/data/pictures/zh_HK/image/enlarge1.png
new file mode 100644
index 0000000..17e556c
Binary files /dev/null and b/data/pictures/zh_HK/image/enlarge1.png differ
diff --git a/data/pictures/zh_HK/image/information1.png b/data/pictures/zh_HK/image/information1.png
new file mode 100644
index 0000000..d5e678f
Binary files /dev/null and b/data/pictures/zh_HK/image/information1.png differ
diff --git a/data/pictures/zh_HK/image/main.png b/data/pictures/zh_HK/image/main.png
new file mode 100644
index 0000000..162631b
Binary files /dev/null and b/data/pictures/zh_HK/image/main.png differ
diff --git a/data/pictures/zh_HK/image/menu.png b/data/pictures/zh_HK/image/menu.png
new file mode 100644
index 0000000..eec3797
Binary files /dev/null and b/data/pictures/zh_HK/image/menu.png differ
diff --git a/data/pictures/en_US/image/menu1.png b/data/pictures/zh_HK/image/menu1.png
similarity index 100%
rename from data/pictures/en_US/image/menu1.png
rename to data/pictures/zh_HK/image/menu1.png
diff --git a/data/pictures/zh_HK/image/openImage.png b/data/pictures/zh_HK/image/openImage.png
new file mode 100644
index 0000000..052f53e
Binary files /dev/null and b/data/pictures/zh_HK/image/openImage.png differ
diff --git a/data/pictures/zh_HK/image/rorate.png b/data/pictures/zh_HK/image/rorate.png
new file mode 100644
index 0000000..d12e222
Binary files /dev/null and b/data/pictures/zh_HK/image/rorate.png differ
diff --git a/data/pictures/zh_HK/image/side.png b/data/pictures/zh_HK/image/side.png
new file mode 100644
index 0000000..a57202e
Binary files /dev/null and b/data/pictures/zh_HK/image/side.png differ
diff --git a/data/pictures/zh_HK/index.md b/data/pictures/zh_HK/index.md
new file mode 100644
index 0000000..1d3e6ad
--- /dev/null
+++ b/data/pictures/zh_HK/index.md
@@ -0,0 +1,72 @@
+# 看圖
+## 概 述
+看圖是一款簡單易用,界面友好,支持多種圖片格式的圖片查看器。在查看圖片的同時,還可以對圖片進行簡單的編輯和處理,例如:放大、縮小、旋轉、翻轉、刪除等。除此之外,還可以查看圖片的詳細信息。主界面如圖1所示。
+
+![圖 1 看圖主界面-big](image/main.png)
+
+
+## 基本功能
+圖標及其功能:
+
+|圖 標 |功能說明 |圖 標 | 功能說明
+| :------------ | :------------ | :------------ | :------------ |
+|![](image/btn0.png)| 打開圖片 |![](image/btn1.png)| 上一張
+|![](image/btn2.png)| 下一張|![](image/btn3.png)| 放大
+|![](image/btn4.png)| 縮小|![](image/btn5.png)| 正常大小顯示圖片
+|![](image/btn6.png)| 圖像適合窗口|![](image/btn7.png)|圖片旋轉90度
+|![](image/btn8.png)| 水平鏡像|![](image/btn9.png)|垂直鏡像
+|![](image/btn10.png)| 查看圖片詳細信息|![](image/btn12.png)| 側邊欄
+|![](image/btn11.png)| 刪除到回收站| ![](image/btn13.png)| 裁剪
+
+
+
+點擊主界面“+”按鈕或者“![](image/menu1.png)”按鈕的“打開”選項,打開一張圖片。打開側邊欄后,點擊側邊欄縮略圖或“下一張”“上一張”按鈕進行切換。如圖2所示。
+
+![圖 2 打開圖片-big](image/openImage.png)
+
+
+## 工具欄
+工具欄主要提供一些對圖片的操作,包括:縮小、放大、查看圖片原始尺寸、適應窗口尺寸、旋轉、水平翻轉、垂直翻轉、查看圖片詳細信息、刪除。改變尺寸的功能包括:縮小、放大、查看圖片原始尺寸、適應窗口尺寸。以放大爲例,點擊工具欄的“![](image/btn3.png)”按鈕,可對圖片進行放大。當圖片放大到超出主界面可視範圍時,拖動導航器中間的高亮窗口,用戶可查看圖片全貌。如圖3所示。
+
+![圖 3 放大——導航器-big](image/enlarge1.png)
+
+對圖片旋轉的功能包括:旋轉、水平鏡像和垂直鏡像。以旋轉為例,每次點擊工具欄的“![](image/btn7.png)”按鈕,可對圖片進行90°順時針旋轉。如圖4所示。
+
+![圖 4 旋轉-big](image/rorate.png)
+
+點擊工具欄的“![](image/btn12.png)”按鈕,可以在主界面的左側查看當前圖片所在文件夾的所有可支持圖片的縮略圖。點擊某一個可切換主界面當前圖片的显示。如圖5所示。
+
+![圖 5 查看側邊欄-big](image/side.png)
+
+點擊工具欄的“![](image/btn10.png)”按鈕,可以在主界面的右上角窗口查看當前圖片的詳細信息。如圖6所示。
+
+![圖 6 查看詳細信息-big](image/information1.png)
+
+點擊工具欄的“![](image/btn13.png)”按鈕,可以進入裁剪模式。如圖7所示。
+
+![圖 7 裁剪-big](image/cutImage.png)
+
+點擊工具欄的“![](image/btn11.png)”按鈕,可以將當前圖片刪除至回收站。
+
+
+
+## 右鍵菜單
+圖片右鍵菜單主要包含以下功能:複製、打印、刪除、另存為、重新命名、設置為桌面壁紙、在文件夾中顯示。如圖8所示。
+
+![圖 8 圖片右鍵菜單-big](image/menu.png)
+
+點擊複製選項,可將圖片複製到剪切板。點擊打印選項,可將圖片發送給打印機進行打印。點擊刪除選項,可將當前圖片刪除到回收站。點擊另存為,可將當前圖片轉換為其他支持的格式。點擊重命名,對當前圖片文件名進行編輯。另外還可以將桌面壁紙支持的圖片格式設置為桌面壁紙。最後,可直接在文件夾中選中显示。
+
+
+
+## 附錄
+### 快捷鍵
+
+| 快捷键 | 功能 |
+| :------------ | :------------ |
+|← | 上一張
+|→ | 下一張
+|del | 刪除
+|esc | 取消
+|enter | 保存
+
diff --git a/debian/changelog b/debian/changelog
index b79c94c..b7b8ca9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+kylin-photo-viewer (1.3.0.3-ok5) yangtze; urgency=medium
+
+ * BUG号:无
+ * 需求号:无
+ * 其他改动说明:同步代码,缩放优化,新增拖拽功能,新增快捷键
+ * 影响域:仅影响自身,缩放优化,新增拖拽功能,新增快捷键
+
+ -- zoujunnan Fri, 21 Oct 2022 18:43:28 +0800
+
kylin-photo-viewer (1.3.0.3-ok4) yangtze; urgency=medium
* BUG号:无
diff --git a/kylin-photo-viewer.pro b/kylin-photo-viewer.pro
index 0fbf7b2..6d54793 100644
--- a/kylin-photo-viewer.pro
+++ b/kylin-photo-viewer.pro
@@ -7,7 +7,8 @@ TRANSLATIONS += \
translations/kylin-photo-viewer_bo_CN.ts \
translations/kylin-photo-viewer_ky.ts \
translations/kylin-photo-viewer_kk.ts \
- translations/kylin-photo-viewer_ug.ts
+ translations/kylin-photo-viewer_ug.ts \
+ translations/kylin-photo-viewer_zh_HK.ts
!system($$PWD/translations/generate_translations_pm.sh): error("Failed to generate pm")
qm_files.files = translations/*.qm
diff --git a/mousebase/MouseAreaBase.js b/mousebase/MouseAreaBase.js
new file mode 100644
index 0000000..888f3e4
--- /dev/null
+++ b/mousebase/MouseAreaBase.js
@@ -0,0 +1,59 @@
+/**************************************************************************
+ ** **
+ ** Copyright (C) 2011-2021 Lukas Spies **
+ ** Contact: http://photoqt.org **
+ ** **
+ ** This file is part of PhotoQt. **
+ ** **
+ ** PhotoQt 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. **
+ ** **
+ ** PhotoQt 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 PhotoQt. If not, see . **
+ ** **
+ **************************************************************************/
+
+function checkComboForShortcut(combo, wheelDelta) {
+
+ if (wheelDelta.y > 0) {
+ whatToDoWithFoundShortcut([0,"__zoomIn"], wheelDelta)
+ } else {
+ whatToDoWithFoundShortcut([0,"__zoomOut"], wheelDelta)
+ }
+
+}
+
+function whatToDoWithFoundShortcut(sh, wheelDelta) {
+
+ var cmd = sh[1]
+
+ if(cmd === "__zoomIn") {
+ imageArea.zoomIn(wheelDelta)
+ } else if (cmd === "__zoomOut") {
+ imageArea.zoomOut(wheelDelta)
+ } else if(cmd === "__zoomReset") {
+ imageArea.zoomReset()
+ } else if(cmd === "__zoomActual") {
+ imageArea.zoomActual()
+ } else if(cmd === "__rotateL") {
+ imageArea.rotate(-variables.angle90)
+ } else if(cmd === "__rotateR") {
+ imageArea.rotate(variables.angle90)
+ } else if(cmd === "__rotate0") {
+ imageArea.rotateReset()
+ } else if(cmd === "__flipH") {
+ imageArea.mirrorH()
+ } else if(cmd === "__flipV") {
+ imageArea.mirrorV()
+ } else if(cmd === "__flipReset") {
+ imageArea.mirrorReset()
+ }
+
+}
diff --git a/mousebase/MouseAreaEvent.qml b/mousebase/MouseAreaEvent.qml
new file mode 100644
index 0000000..076ad99
--- /dev/null
+++ b/mousebase/MouseAreaEvent.qml
@@ -0,0 +1,59 @@
+/**************************************************************************
+ ** **
+ ** Copyright (C) 2011-2021 Lukas Spies **
+ ** Contact: http://photoqt.org **
+ ** **
+ ** This file is part of PhotoQt. **
+ ** **
+ ** PhotoQt 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. **
+ ** **
+ ** PhotoQt 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 PhotoQt. If not, see . **
+ ** **
+ **************************************************************************/
+
+import QtQuick 2.9
+
+import "./MouseAreaBase.js" as MouseAreaBase
+
+Item {
+ anchors.fill: parent
+ MouseArea {
+
+ anchors.fill: parent
+ acceptedButtons: Qt.LeftButton|Qt.RightButton|Qt.MiddleButton
+ hoverEnabled: true
+
+ cursorShape: Qt.ArrowCursor
+
+ property int angleDeltaX: 0
+ property int angleDeltaY: 0
+
+ onWheel: {
+ var combo = ""
+
+ angleDeltaX += wheel.angleDelta.x
+ angleDeltaY += wheel.angleDelta.y
+
+ MouseAreaBase.checkComboForShortcut(combo, Qt.point(angleDeltaX, angleDeltaY))
+
+ angleDeltaX = 0
+ angleDeltaY = 0
+ if (variables.operateWay != 9 && variables.operateWay != 10) {
+ variables.wheelChange = !variables.wheelChange
+ }
+
+
+
+ }
+ }
+
+}
diff --git a/part/ImageAnimated.qml b/part/ImageAnimated.qml
new file mode 100644
index 0000000..9aa525f
--- /dev/null
+++ b/part/ImageAnimated.qml
@@ -0,0 +1,479 @@
+/**************************************************************************
+ ** **
+ ** Copyright (C) 2011-2021 Lukas Spies **
+ ** Contact: http://photoqt.org **
+ ** **
+ ** This file is part of PhotoQt. **
+ ** **
+ ** PhotoQt 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. **
+ ** **
+ ** PhotoQt 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 PhotoQt. If not, see . **
+ ** **
+ **************************************************************************/
+
+import QtQuick 2.9
+
+Item {
+ objectName: "movieItemLower"
+ id: imageNormal
+ x: parent.width/2 - width/2
+ y: parent.height/2 - height/2
+ width: container.width
+ height: container.height
+ property real defaultScale: 1.0
+ signal sendScale(var scale)
+ property bool needWheelReact: true //是否需要滑轮响应
+ property bool newImageLoaded: false //新图片加载
+ property string imagePath: ""
+ signal sendPos(var xPos,var yPos)
+ property double imageVisibleLeftUpX: 0 //可视区域左上角的点在原图上的位置
+ property double imageVisibleLeftUpY: 0
+ property double imageLeftUpX: 0 //缩放后的图片的左上角相对于窗口的位置
+ property double imageLeftUpY: 0
+ signal needShowNavigator(var scale, var leftUpImageX, var leftUpImageY, var visibleWidth, var visibleHeight)
+ signal closeNavigator()
+ property bool imageNeedCenterZoom: true
+ property bool mouseareaEnabeled: false
+ property int mouseDragType: -1
+ property bool startAni: true
+ signal buriedPoint()
+
+ AnimatedImage {
+ id: theImage
+ objectName: "image"
+ property real curX: imageNormal.width/2 - width/2
+ property real curY: imageNormal.height/2 - height/2
+ x: curX
+ y: curY
+ focus: true
+ //原始图像不做处理
+ fillMode: Image.Pad
+ clip: true
+ cache: false
+ asynchronous: true
+ source: "qrc:/res/res/kyview_logo.png"
+ mirror: false
+ //图像在缩放或变换时是否平滑过滤。平滑过滤可以提供更好的视觉质量
+ smooth: (width * scale > variables.curWidW || height > variables.curWidH)
+ //图像在缩放或变换时是否使用mipmap过滤。与平滑相比,缩小比例时,Mipmap过滤提供了更好的视觉质量,但它可能会以性能为代价(无论是在初始化图像时还是在渲染期间)。
+ mipmap: (scale < defaultScale || (scale < 0.8 && defaultScale < 0.8)) && (width > variables.curWidW || height > variables.curWidH)
+ rotation: 0
+ property real rotateTo: 0
+ onRotateToChanged: {
+ rotation = rotateTo
+ }
+ onRotationChanged: {
+ if(!rotani.running) {
+ rotateTo = rotation
+ }
+ }
+
+ property real curScale: 1
+ scale: curScale
+
+ Behavior on x {
+ PropertyAnimation {
+ id: xani
+ duration: startAni ? variables.imageAniDuration : 0
+ easing.type: Easing.OutCubic
+ }
+ }
+
+ Behavior on y {
+ PropertyAnimation {
+ id: yani
+ duration: startAni ? variables.imageAniDuration : 0
+ easing.type: Easing.OutCubic
+ }
+ }
+ Behavior on rotation {
+ PropertyAnimation {
+ id: rotani
+ duration: startAni ? variables.imageAniDuration : 0
+ onRunningChanged: {
+ if (!rotani.running) {
+ imageBase.imageActuralLeftUpPos(theImage,theImage.curX,theImage.curY)
+ }
+ }
+ easing.type: Easing.OutCubic
+ }
+ }
+ Behavior on scale {
+ PropertyAnimation {
+ id: scaleani
+ duration: startAni ? variables.imageAniDuration : 0
+ onRunningChanged: {
+ if (!scaleani.running) {
+ imageBase.imageActuralLeftUpPos(theImage,theImage.curX,theImage.curY)
+ imageBase.makeSureNavigatorNeedShow(theImage)
+ }
+ }
+ easing.type: Easing.OutCubic
+ }
+ }
+ onXChanged: {
+ setDrogLimit()
+ }
+ onYChanged: {
+ setDrogLimit()
+ }
+
+ function sendScale() {
+ return theImage.curScale
+ }
+
+ function changeScale(scaleValue) {
+ imageBase.setImageScaleWithImageUpdate(theImage,scaleValue)
+ }
+
+ function sendScaleFirstTime() {
+ return imageBase.getImageScale(theImage)
+ }
+
+ //重设位置
+ function imagePostionReset() {
+ imageBase.resetImagePostion(theImage)
+ }
+
+ onStatusChanged: {
+ if (theImage.status == Image.Ready) {
+ theImage.source = imageNormal.imagePath
+ if (newImageLoaded) {
+ theImage.imagePostionReset()
+ }
+ }
+ }
+ function setSource(imagePath) {
+ imageNormal.imagePath = imagePath
+ theImage.source = imageNormal.imagePath
+ }
+ }
+ Connections {
+ target: variables
+ onWheelChangeChanged: {
+ buriedPoint()
+ }
+ }
+
+ PinchArea {
+
+ id: pincharea
+
+ anchors.fill: theImage
+
+ scale: theImage.scale
+ rotation: theImage.rotation
+ enabled: true
+ // the actual scale factor from a pinch event is the initial scale multiplied by Pinch.scale
+ property real initialScale
+ onPinchStarted: {
+ initialScale = theImage.curScale
+ buriedPoint()
+ }
+
+ onPinchUpdated: {
+
+ // 关闭动画
+ startAni = false
+ if (!imageNeedCenterZoom) {
+ imageBase.performZoom(theImage,theImage.mapFromItem(pincharea,pinch.center.x, pinch.center.y), undefined, false, false, true, (initialScale*pinch.scale)/theImage.curScale)
+ } else {
+ imageBase.performZoom(theImage,theImage.mapFromItem(pincharea, mainWindow.width/2, mainWindow.height/2), undefined, false, false, true,(initialScale*pinch.scale)/theImage.curScale)
+ theImage.imagePostionReset()
+ }
+ // 开启动画
+ startAni = true
+ }
+
+ MouseArea {
+ id: mousearea
+ enabled: mouseareaEnabeled
+ anchors.fill: parent
+
+ drag.target: theImage
+
+ hoverEnabled: false // 必须设置为false,否则,鼠标的坐标抓取的就不是全局的
+
+ onPressAndHold: {
+ variables.mousePos = mousearea.mapToItem(bgimage, Qt.point(mouse.x, mouse.y))
+ }
+
+ onReleased: {
+
+ theImage.curX = theImage.x
+ theImage.curY = theImage.y
+ theImage.x = Qt.binding(function() { return theImage.curX })
+ theImage.y = Qt.binding(function() { return theImage.curY })
+
+ imageBase.controlImageInWid(theImage)
+ imageBase.imageActuralLeftUpPos(theImage,theImage.curX,theImage.curY)
+ imageBase.makeSureNavigatorNeedShow(theImage)
+
+
+ }
+ onPositionChanged: {
+ setDrogLimit()
+ imageBase.imageActuralLeftUpPos(theImage,theImage.x,theImage.y)
+ imageBase.makeSureNavigatorNeedShow(theImage)
+
+ }
+
+ Connections {
+ target: variables
+ onMousePosChanged: {
+ mousearea.cursorShape = Qt.ArrowCursor
+ }
+ onVisibleItemChanged: {
+ if (variables.visibleItem !== "") {
+ mousearea.cursorShape = Qt.ArrowCursor
+ } else {
+ mousearea.cursorShape = Qt.ArrowCursor
+ }
+ }
+ }
+ }
+ }
+
+ Connections {
+ target: container
+ onZoomIn: {
+ if (isMoiveRunning()) {
+ return
+ }
+ //某些情况需要静止进行缩放
+ if (needWheelReact == false) {
+ return
+ }
+ if (wheelDelta != undefined && !imageNeedCenterZoom) {
+ imageBase.performZoom(theImage,theImage.mapFromItem(bgimage, variables.mousePos.x, variables.mousePos.y), undefined, true, false, false)
+ } else {
+ imageBase.performZoom(theImage,theImage.mapFromItem(bgimage, mainWindow.width/2, mainWindow.height/2), undefined, true, false, false)
+ theImage.imagePostionReset()
+ }
+ imageBase.imageActuralLeftUpPos(theImage,theImage.curX,theImage.curY)
+ imageBase.makeSureNavigatorNeedShow(theImage)
+ }
+
+ onZoomOut: {
+ if (isMoiveRunning()) {
+ return
+ }
+ //某些情况需要静止进行缩放
+ if (needWheelReact == false) {
+ return
+ }
+ if (wheelDelta != undefined && !imageNeedCenterZoom) {
+ imageBase.performZoom(theImage,theImage.mapFromItem(bgimage, variables.mousePos.x, variables.mousePos.y), undefined, false, false, false)
+ } else {
+ imageBase.performZoom(theImage,theImage.mapFromItem(bgimage, mainWindow.width/2, mainWindow.height/2), undefined, false, false, false)
+ theImage.imagePostionReset()
+ }
+ imageBase.imageActuralLeftUpPos(theImage,theImage.curX,theImage.curY)
+ imageBase.makeSureNavigatorNeedShow(theImage)
+ }
+ onRotate: {
+ if (isMoiveRunning()) {
+ return
+ }
+ theImage.rotateTo += deg
+ imageBase.imageActuralLeftUpPos(theImage,theImage.curX,theImage.curY)
+ }
+
+ onMirrorH: {
+ if (isMoiveRunning()) {
+ return
+ }
+ var old = theImage.mirror
+ theImage.mirror = !old
+ startAni = false
+ if (theImage.rotateTo / variables.angle90 % 2 != 0) {
+ theImage.rotateTo += variables.angle180
+ }
+ startAni = true
+ imageBase.imageActuralLeftUpPos(theImage,theImage.curX,theImage.curY)
+ }
+ onMirrorV: {
+ if (isMoiveRunning()) {
+ return
+ }
+ var old = theImage.mirror
+ theImage.mirror = !old
+ startAni = false
+ if (theImage.rotateTo / variables.angle90 % 2 == 0) {
+ theImage.rotateTo += variables.angle180
+ }
+ startAni = true
+ imageBase.imageActuralLeftUpPos(theImage,theImage.curX,theImage.curY)
+ }
+ }
+
+ function setCurScale(zoomfactor) {
+ var curScale = theImage.curScale * zoomfactor
+
+ if (curScale > 100 ) {
+ theImage.curScale = 100
+ } else if (curScale < 0.05) {
+ theImage.curScale = 0.05
+ } else {
+ theImage.curScale = curScale
+ }
+ }
+
+ function operateImage(operateWay) {
+ if (container.imageType === 0) {
+ return
+ }
+ variables.operateWay = operateWay
+ if (operateWay === 1) {
+ //放大
+ container.zoomIn(undefined)
+ } else if (operateWay === 2) {
+ //缩小
+ container.zoomOut(undefined)
+ } else if (operateWay === 3) {
+ //逆时针旋转
+ container.rotate(-variables.angle90)
+ theImage.imagePostionReset()
+ } else if (operateWay === 4) {
+ //顺时针旋转
+ container.rotate(variables.angle90)
+ theImage.imagePostionReset()
+ } else if (operateWay === 5) {
+ //水平
+ container.mirrorH()
+ theImage.imagePostionReset()
+ } else if (operateWay === 6) {
+ //垂直
+ container.mirrorV()
+ theImage.imagePostionReset()
+ }
+ //ocr和裁剪
+ if (operateWay === 9 || operateWay === 10) {
+ //禁止拖拽和缩放
+ pincharea.enabled = false
+ mousearea.enabled = false
+ needWheelReact = false
+ } else {
+ //放开拖拽和缩放
+ pincharea.enabled = true
+ needWheelReact = true
+ }
+ //切图
+ if (operateWay === 12) {
+ newImageLoaded = true
+ startAni = false
+ theImage.rotateTo = 0
+ startAni = true
+ theImage.mirror = false
+ theImage.imagePostionReset()
+ } else {
+ newImageLoaded = false
+ }
+ //显示原图大小
+ if (operateWay === 8) {
+ theImage.curScale = 1
+ theImage.imagePostionReset()
+ }
+ }
+ //判断当前的图片加载模式,防止影响其他信号的接收
+ function isMoiveRunning() {
+ if (container.imageType === 0) {
+ return true
+ } else {
+ return false
+ }
+ }
+
+ //返回所需要相对于窗口的X和Y
+ function getLeftUpPosAccordingWidX() {
+
+ return imageBase.getLeftUpPosAccordingWidX(theImage)
+
+ }
+ function getLeftUpPosAccordingWidY() {
+
+ return imageBase.getLeftUpPosAccordingWidY(theImage)
+ }
+ //返回所需要相对于窗口的在当前缩放比下的可视区域的高度和宽度
+ function getVisibleSizeAccordingWidW() {
+
+ return imageBase.getVisibleSizeAccordingWidW(theImage)
+
+ }
+ function getVisibleSizeAccordingWidH() {
+
+ return imageBase.getVisibleSizeAccordingWidH(theImage)
+ }
+ //返回相对于原图的位置
+ function getLeftUpPosAccordingImageX() {
+ return imageVisibleLeftUpX / theImage.curScale
+ }
+ function getLeftUpPosAccordingImageY() {
+ return imageVisibleLeftUpY / theImage.curScale
+ }
+
+
+ function operateNavigatorChangeImagePos(leftUpPoint) {
+ imageBase.operateNavigatorChangeImagePos(leftUpPoint,theImage)
+ }
+
+ function setDrogLimit() {
+
+ if(Math.abs(theImage.rotateTo % variables.angle360) == variables.angle90 || Math.abs(theImage.rotateTo % variables.angle360) == variables.angle270) {
+ if (theImage.width * theImage.scale >= variables.curWidH) {
+ if (theImage.height * theImage.scale >= variables.curWidW) {
+ mousearea.enabled = true
+ mousearea.drag.axis= Drag.XAndYAxis
+ mouseDragType = 2
+ } else {
+ mousearea.enabled = true
+ mousearea.drag.axis= Drag.YAxis
+ mouseDragType = 1
+ }
+ } else if (theImage.height * theImage.scale >= variables.curWidW) {
+ mousearea.enabled = true
+ mousearea.drag.axis= Drag.XAxis
+ mouseDragType = 0
+ } else {
+ mousearea.enabled = false
+ mouseDragType = -1
+ }
+ } else {
+ if (theImage.width * theImage.scale >= variables.curWidW) {
+ if (theImage.height * theImage.scale >= variables.curWidH) {
+ mousearea.enabled = true
+ mousearea.drag.axis= Drag.XAndYAxis
+ mouseDragType = 2
+ } else {
+ mousearea.enabled = true
+ mousearea.drag.axis= Drag.XAxis
+ mouseDragType = 0
+ }
+ } else if (theImage.height * theImage.scale >= variables.curWidH) {
+ mousearea.enabled = true
+ mousearea.drag.axis= Drag.YAxis
+ mouseDragType = 1
+ } else {
+ mousearea.enabled = false
+ mouseDragType = -1
+ }
+ }
+ }
+ function adjustImagePostion() {
+ setDrogLimit()
+ imageBase.controlImageInWid(theImage)
+ }
+ function updatePosAccordingToWidSizeChange() {
+ imageBase.imageActuralLeftUpPos(theImage,theImage.curX,theImage.curY)
+ imageBase.makeSureNavigatorNeedShow(theImage)
+ }
+}
diff --git a/part/ImageBaseFunction.qml b/part/ImageBaseFunction.qml
new file mode 100644
index 0000000..c1f754b
--- /dev/null
+++ b/part/ImageBaseFunction.qml
@@ -0,0 +1,496 @@
+/**************************************************************************
+ ** **
+ ** Copyright (C) 2011-2021 Lukas Spies **
+ ** Contact: http://photoqt.org **
+ ** **
+ ** This file is part of PhotoQt. **
+ ** **
+ ** PhotoQt 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. **
+ ** **
+ ** PhotoQt 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 PhotoQt. If not, see . **
+ ** **
+ **************************************************************************/
+
+import QtQuick 2.12
+
+Item {
+ //重置图片位置-居中
+ function resetImagePostion(imageObj) {
+
+ imageObj.curX = imageObj.parent.width/2 - imageObj.width/2
+ imageObj.curY = imageObj.parent.height/2 - imageObj.height/2
+ imageObj.x = Qt.binding(function() { return imageObj.curX })
+ imageObj.y = Qt.binding(function() { return imageObj.curY })
+ }
+ //首次打开; 同一张图片: 退出ocr,退出裁剪,适应窗口,原图展示,ocr;切图 更新缩放比
+ function setImageScaleWithImageUpdate(imageObj,scaleValue) {
+ imageObj.curScale = scaleValue
+ }
+ //返回图片的缩放比
+ function getImageScale(imageObj) {
+ return imageObj.curScale * variables.scalingconstant
+ }
+
+ //处理缩放等事件
+ function performZoom(theImage, pos, wheelDelta, zoom_in, zoom_actual, zoom_pinch, zoom_pinchfactor) {
+
+ if (wheelDelta !== undefined) {
+ if (wheelDelta.y > 12) {
+ wheelDelta.y = 12
+ } else if (wheelDelta.y < -12) {
+ wheelDelta.y = -12
+ }
+ }
+ // figure out zoom factor
+ var zoomfactor
+
+ // a PINCH occured
+ if(zoom_pinch) {
+ zoomfactor = zoom_pinchfactor
+ // zoom to ACTUAL SIZE
+ } else if (zoom_actual) {
+ zoomfactor = 1/theImage.curScale
+ } else {
+ // zoom IN/OUT
+ if (wheelDelta === undefined) {
+ if (zoom_in) {
+ zoomfactor = Math.max(1.01, Math.min(1.3, 1 + variables.imageZoomSpeed*0.01))
+ } else {
+ zoomfactor = 1/Math.max(1.01, Math.min(1.3, 1 + variables.imageZoomSpeed*0.01))
+ }
+ } else {
+ if (zoom_in) {
+ zoomfactor = Math.max(1.01, Math.min(1.3, 1+Math.abs(wheelDelta.y/(101-variables.imageZoomSpeed))))
+ } else {
+ zoomfactor = 1/Math.max(1.01, Math.min(1.3, 1+Math.abs(wheelDelta.y/(101-variables.imageZoomSpeed))))
+ }
+ }
+ }
+
+ var curZoomfactor = theImage.curScale * zoomfactor
+ if (curZoomfactor > 100 || curZoomfactor < 0.05) {
+ zoomfactor = 1
+ }
+ // update x/y position of image
+ var realX = (pos.x - theImage.width/2) * theImage.curScale
+ var realY = (pos.y - theImage.height/2) * theImage.curScale
+
+ // no rotation
+ if(theImage.rotateTo % variables.angle360 == 0) {
+ theImage.curX += (1-zoomfactor)*realX
+ theImage.curY += (1-zoomfactor)*realY
+
+ // rotated by 90 degrees
+ } else if(theImage.rotateTo % variables.angle360 == variables.angle90 || theImage.rotateTo % variables.angle360 == -variables.angle270) {
+
+ theImage.curX -= (1-zoomfactor)*realY
+ theImage.curY += (1-zoomfactor)*realX
+
+ // rotated by 180 degrees
+ } else if(Math.abs(theImage.rotateTo % variables.angle360) == variables.angle180) {
+
+ theImage.curX -= (1-zoomfactor)*realX
+ theImage.curY -= (1-zoomfactor)*realY
+
+ // rotated by 270 degrees
+ } else if(theImage.rotateTo%variables.angle360 == variables.angle270 || theImage.rotateTo%variables.angle360 == -variables.angle90) {
+
+ theImage.curX += (1-zoomfactor)*realY
+ theImage.curY -= (1-zoomfactor)*realX
+
+ } else {
+ console.log("ERROR: unknown rotation step:", theImage.rotateTo)
+ }
+
+ var curScale = theImage.curScale * zoomfactor
+
+ if (curScale > 100 ) {
+ theImage.curScale = 100
+ } else if (curScale < 0.05) {
+ theImage.curScale = 0.05
+ } else {
+ theImage.curScale = curScale
+ }
+ theImage.parent.sendScale(theImage.curScale * 100)
+ imageActuralLeftUpPos(theImage,theImage.curX,theImage.curY)
+ }
+
+ //返回图片左上角可视区域的点在缩放的图片的点的位置
+ function imageActuralLeftUpPos(theImage,curX,curY) {
+
+ var theImageCurX = curX
+ var theImageCurY = curY
+
+ var actualY
+ var actualX
+
+ if (theImageCurY >= 0) {
+ actualY = theImageCurY + theImage.height / 2 - (theImage.height * theImage.scale) / 2
+ } else {
+ actualY = theImage.height / 2 - Math.abs(theImageCurY) - theImage.height / 2 * theImage.scale
+ }
+ if (theImageCurX >= 0) {
+ actualX = theImageCurX + theImage.width / 2 - (theImage.width * theImage.scale) / 2
+ } else {
+ actualX = theImage.width / 2 - Math.abs(theImageCurX) - theImage.width / 2 * theImage.scale
+ }
+ if(Math.abs(theImage.rotateTo % variables.angle360) == variables.angle90 || Math.abs(theImage.rotateTo % variables.angle360) == variables.angle270) {
+ actualX = actualX + theImage.width * theImage.scale / 2 - theImage.height * theImage.scale / 2
+ actualY = actualY + theImage.height * theImage.scale / 2 - theImage.width * theImage.scale /2
+ }
+ theImage.parent.imageLeftUpX = actualX
+ theImage.parent.imageLeftUpY = actualY
+ getLeftUpPosAccordingActualImage(actualX,actualY,theImage)
+ }
+
+ function getLeftUpPosAccordingActualImage(currLeftUpX,currLeftUpY,theImage) {
+
+ var actualX = currLeftUpX
+ var actualY = currLeftUpY
+
+ if (actualX >= 0) {
+ theImage.parent.imageVisibleLeftUpX = 0
+ } else {
+ theImage.parent.imageVisibleLeftUpX = -actualX
+ }
+ if (actualY >= 0) {
+ theImage.parent.imageVisibleLeftUpY = 0
+ } else {
+ theImage.parent.imageVisibleLeftUpY = -actualY
+ }
+
+// makeSureNavigatorNeedShow(theImage)
+ }
+ function makeSureNavigatorNeedShow(theImage) {
+
+ var visibleW
+ var visibleH
+
+ if(Math.abs(theImage.rotateTo % variables.angle360) == variables.angle90 || Math.abs(theImage.rotateTo % variables.angle360) == variables.angle270) {
+ visibleH = theImage.width * theImage.curScale
+ visibleW = theImage.height * theImage.curScale
+ } else {
+ visibleW = theImage.width * theImage.curScale
+ visibleH = theImage.height * theImage.curScale
+ }
+
+ if (visibleW <= variables.curWidW && visibleH <= variables.curWidH) {
+ theImage.parent.mouseareaEnabeled = false
+ variables.navigatorState = false
+ theImage.parent.closeNavigator()
+ theImage.parent.imageNeedCenterZoom = true
+ return
+ }
+ //超出窗口大小需要显示导航栏
+ if (theImage.parent.imageLeftUpX < 0 || theImage.parent.imageLeftUpY < 0 || theImage.parent.imageLeftUpX + visibleW > variables.curWidW || theImage.parent.imageLeftUpY + visibleH > variables.curWidH) {
+ // if (!xani.running && !yani.running && !scaleani.running && !rotani.running) {
+ theImage.parent.mouseareaEnabeled = true
+ variables.navigatorState = true
+ theImage.parent.imageNeedCenterZoom = false
+ theImage.parent.needShowNavigator(theImage.curScale,theImage.parent.imageVisibleLeftUpX,theImage.parent.imageVisibleLeftUpY,getVisibleSizeAccordingWidW(theImage),getVisibleSizeAccordingWidH(theImage))
+
+ // }
+ }
+ }
+ //返回所需要相对于窗口的在当前缩放比下的可视区域的高度和宽度
+ function getVisibleSizeAccordingWidW(theImage) {
+
+ if (variables.curWidW === 0) {
+ return 1
+ }
+
+ var visibleSizeAccordingWidW;
+ if(Math.abs(theImage.rotateTo % variables.angle360) == variables.angle90 || Math.abs(theImage.rotateTo % variables.angle360) == variables.angle270) {
+ if (theImage.parent.imageLeftUpX >= 0) {
+ if (variables.curWidW - theImage.parent.imageLeftUpX - theImage.height * theImage.curScale <=0) {
+ visibleSizeAccordingWidW = variables.curWidW - theImage.parent.imageLeftUpX
+ } else {
+ visibleSizeAccordingWidW = theImage.height * theImage.curScale
+ }
+ } else {
+ if (variables.curWidW - (theImage.height * theImage.curScale + theImage.parent.imageLeftUpX) >=0) {
+ visibleSizeAccordingWidW = theImage.height * theImage.curScale + theImage.parent.imageLeftUpX
+ } else {
+ visibleSizeAccordingWidW = variables.curWidW
+ }
+ }
+ } else {
+ if (theImage.parent.imageLeftUpX >= 0) {
+ if (variables.curWidW - theImage.parent.imageLeftUpX - theImage.width * theImage.curScale <=0) {
+ visibleSizeAccordingWidW = variables.curWidW - theImage.parent.imageLeftUpX
+ } else {
+ visibleSizeAccordingWidW = theImage.width * theImage.curScale
+ }
+
+ } else {
+ if (variables.curWidW - (theImage.width * theImage.curScale + theImage.parent.imageLeftUpX) >=0) {
+ visibleSizeAccordingWidW = theImage.width * theImage.curScale + theImage.parent.imageLeftUpX
+ } else {
+ visibleSizeAccordingWidW = variables.curWidW
+ }
+ }
+ }
+ return visibleSizeAccordingWidW
+
+ }
+ function getVisibleSizeAccordingWidH(theImage) {
+
+ if (variables.curWidH === 0) {
+ return 1
+ }
+
+ var visibleSizeAccordingWidH;
+ if(Math.abs(theImage.rotateTo % variables.angle360) == variables.angle90 || Math.abs(theImage.rotateTo % variables.angle360) == variables.angle270) {
+ if (theImage.parent.imageLeftUpY >= 0) {
+ if (variables.curWidH - theImage.parent.imageLeftUpY - theImage.width * theImage.curScale <=0) {
+ visibleSizeAccordingWidH = variables.curWidH - theImage.parent.imageLeftUpY
+ } else {
+ visibleSizeAccordingWidH = theImage.width * theImage.curScale
+ }
+ } else {
+ if (variables.curWidH - (theImage.width * theImage.curScale + theImage.parent.imageLeftUpY) >=0) {
+ visibleSizeAccordingWidH = theImage.width * theImage.curScale + theImage.parent.imageLeftUpY
+ } else {
+ visibleSizeAccordingWidH = variables.curWidH
+ }
+ }
+ } else {
+ if (theImage.parent.imageLeftUpY >= 0) {
+ if (variables.curWidH - theImage.parent.imageLeftUpY - theImage.height * theImage.curScale <=0) {
+ visibleSizeAccordingWidH = variables.curWidH - theImage.parent.imageLeftUpY
+ } else {
+ visibleSizeAccordingWidH = theImage.height * theImage.curScale
+ }
+ } else {
+ if (variables.curWidH - (theImage.height * theImage.curScale + theImage.parent.imageLeftUpY) >=0) {
+ visibleSizeAccordingWidH = theImage.height * theImage.curScale + theImage.parent.imageLeftUpY
+ } else {
+ visibleSizeAccordingWidH = variables.curWidH
+ }
+ }
+ }
+ return visibleSizeAccordingWidH
+ }
+
+
+ //返回所需要相对于窗口的X和Y
+ function getLeftUpPosAccordingWidX(theImage) {
+
+ var leftUpPosAccordingWidX;
+ if (theImage.parent.imageLeftUpX > 0) {
+ leftUpPosAccordingWidX = theImage.parent.imageLeftUpX
+ } else {
+ leftUpPosAccordingWidX = 0
+ }
+ return leftUpPosAccordingWidX
+
+ }
+ function getLeftUpPosAccordingWidY(theImage) {
+
+ var leftUpPosAccordingWidY;
+ if (theImage.parent.imageLeftUpY > 0) {
+ leftUpPosAccordingWidY = theImage.parent.imageLeftUpY
+ } else {
+ leftUpPosAccordingWidY = 0
+ }
+ return leftUpPosAccordingWidY
+ }
+
+
+ function operateNavigatorChangeImagePos(leftUpPoint,theImage) {
+
+ var imageX = theImage.curX
+ var imageY = theImage.curY
+ imageX -= leftUpPoint.x
+ imageY -= leftUpPoint.y
+ theImage.curX = imageX
+ theImage.curY = imageY
+ imageActuralLeftUpPos(theImage,theImage.curX,theImage.curY)
+ makeSureNavigatorNeedShow(theImage)
+ }
+
+
+ function controlImageInWid(theImage) {
+
+ if(Math.abs(theImage.rotateTo % variables.angle360) == variables.angle90 || Math.abs(theImage.rotateTo % variables.angle360) == variables.angle270) {
+
+ if (theImage.parent.mouseDragType === 0) {
+ if (theImage.parent.imageLeftUpX > 0) {
+ theImage.curX = theImage.curX - theImage.parent.imageLeftUpX
+ } else {
+ if (variables.curWidW - theImage.height * theImage.scale + theImage.parent.imageVisibleLeftUpX > 0) {
+ theImage.curX = theImage.curX + variables.curWidW - theImage.height * theImage.scale + theImage.parent.imageVisibleLeftUpX
+ }
+ theImage.curY = theImage.parent.height/2 - theImage.height/2
+ }
+
+ } else if (theImage.parent.mouseDragType === 1) {
+ if (theImage.parent.imageLeftUpY > 0) {
+ theImage.curY = theImage.curY - theImage.parent.imageLeftUpY
+ } else {
+ if (variables.curWidH - theImage.width * theImage.scale + theImage.parent.imageVisibleLeftUpY > 0) {
+ theImage.curY = theImage.curY + variables.curWidH - theImage.width * theImage.scale + theImage.parent.imageVisibleLeftUpY
+ }
+ theImage.curX = theImage.parent.width/2 - theImage.width/2
+ }
+ } else if (theImage.parent.mouseDragType === 2) {
+
+ if (theImage.parent.imageLeftUpX < 0 && theImage.parent.imageLeftUpY < 0) {
+
+ if (variables.curWidW - theImage.height * theImage.scale + theImage.parent.imageVisibleLeftUpX > 0) {
+ if (variables.curWidH - theImage.width * theImage.scale + theImage.parent.imageVisibleLeftUpY > 0) {
+ theImage.curX = theImage.curX + variables.curWidW - theImage.height * theImage.scale + theImage.parent.imageVisibleLeftUpX
+ theImage.curY = theImage.curY + variables.curWidH - theImage.width * theImage.scale + theImage.parent.imageVisibleLeftUpY
+ } else {
+ theImage.curX = theImage.curX + variables.curWidW - theImage.height * theImage.scale + theImage.parent.imageVisibleLeftUpX
+ }
+ } else {
+ if (variables.curWidH - theImage.width * theImage.scale + theImage.parent.imageVisibleLeftUpY > 0) {
+ theImage.curY = theImage.curY + variables.curWidH - theImage.width * theImage.scale + theImage.parent.imageVisibleLeftUpY
+ }
+ }
+ } else if (theImage.parent.imageLeftUpX < 0 && theImage.parent.imageLeftUpY > 0) {
+
+ if (variables.curWidW - theImage.height * theImage.scale + theImage.parent.imageVisibleLeftUpX > 0) {
+ if (theImage.parent.imageVisibleLeftUpY < variables.curWidH) {
+ theImage.curX = theImage.curX + variables.curWidW - theImage.height * theImage.scale + theImage.parent.imageVisibleLeftUpX
+ theImage.curY = theImage.curY - theImage.parent.imageLeftUpY
+ } else {
+ theImage.curX = theImage.curX + variables.curWidW - theImage.height * theImage.scale + theImage.parent.imageVisibleLeftUpX
+ }
+ } else {
+ if (theImage.parent.imageVisibleLeftUpY < variables.curWidH) {
+ theImage.curY = theImage.curY - theImage.parent.imageLeftUpY
+ }
+ }
+
+ } else if (theImage.parent.imageLeftUpX > 0 && theImage.parent.imageLeftUpY < 0) {
+
+ if (theImage.parent.imageVisibleLeftUpX < variables.curWidW) {
+ if ( variables.curWidH - theImage.width * theImage.scale + theImage.parent.imageVisibleLeftUpY > 0) {
+ theImage.curX = theImage.curX - theImage.parent.imageLeftUpX
+ theImage.curY = theImage.curY + variables.curWidH - theImage.width * theImage.scale + theImage.parent.imageVisibleLeftUpY
+ } else {
+ theImage.curX = theImage.curX - theImage.parent.imageLeftUpX
+ }
+ } else {
+ if ( variables.curWidH - theImage.width * theImage.scale + theImage.parent.imageVisibleLeftUpY > 0) {
+ theImage.curY = theImage.curY + variables.curWidH - theImage.width * theImage.scale + theImage.parent.imageVisibleLeftUpY
+ }
+ }
+
+ } else if (theImage.parent.imageLeftUpX > 0 && theImage.parent.imageLeftUpY > 0) {
+ if (theImage.parent.imageVisibleLeftUpX < variables.curWidW) {
+ if ( theImage.parent.imageVisibleLeftUpY < variables.curWidH) {
+ theImage.curX = theImage.curX - theImage.parent.imageLeftUpX
+ theImage.curY = theImage.curY - theImage.parent.imageLeftUpY
+ } else {
+ theImage.curX = theImage.curX - theImage.parent.imageLeftUpX
+ }
+ } else {
+ if ( theImage.parent.imageVisibleLeftUpY < variables.curWidH) {
+ theImage.curY = theImage.curY - theImage.parent.imageLeftUpY
+ }
+ }
+ }
+ } else {
+ resetImagePostion(theImage)
+ }
+ } else {
+
+ if (theImage.parent.mouseDragType === 0) {
+ if (theImage.parent.imageLeftUpX > 0) {
+ theImage.curX = theImage.curX - theImage.parent.imageLeftUpX
+ } else {
+ if (variables.curWidW - theImage.width * theImage.scale + theImage.parent.imageVisibleLeftUpX > 0) {
+ theImage.curX = theImage.curX + variables.curWidW - theImage.width * theImage.scale + theImage.parent.imageVisibleLeftUpX
+ }
+ theImage.curY = theImage.parent.height/2 - theImage.height/2
+ }
+ } else if (theImage.parent.mouseDragType === 1) {
+ if (theImage.parent.imageLeftUpY > 0) {
+ theImage.curY = theImage.curY - theImage.parent.imageLeftUpY
+ } else {
+ if (variables.curWidH - theImage.height * theImage.scale + theImage.parent.imageVisibleLeftUpY > 0) {
+ theImage.curY = theImage.curY + variables.curWidH - theImage.height * theImage.scale + theImage.parent.imageVisibleLeftUpY
+ }
+ theImage.curX = theImage.parent.width/2 - theImage.width/2
+
+ }
+ } else if (theImage.parent.mouseDragType === 2) {
+
+ if (theImage.parent.imageLeftUpX < 0 && theImage.parent.imageLeftUpY < 0 && (variables.curWidW - theImage.width * theImage.scale + theImage.parent.imageVisibleLeftUpX > 0 || variables.curWidH - theImage.height * theImage.scale + theImage.parent.imageVisibleLeftUpY > 0)) {
+
+ if (variables.curWidW - theImage.width * theImage.scale + theImage.parent.imageVisibleLeftUpX > 0) {
+ if (variables.curWidH - theImage.height * theImage.scale + theImage.parent.imageVisibleLeftUpY > 0) {
+ theImage.curX = theImage.curX + variables.curWidW - theImage.width * theImage.scale + theImage.parent.imageVisibleLeftUpX
+ theImage.curY = theImage.curY + variables.curWidH - theImage.height * theImage.scale + theImage.parent.imageVisibleLeftUpY
+ } else {
+ theImage.curX = theImage.curX + variables.curWidW - theImage.width * theImage.scale + theImage.parent.imageVisibleLeftUpX
+ }
+ } else {
+ if (variables.curWidH - theImage.height * theImage.scale + theImage.parent.imageVisibleLeftUpY > 0) {
+ theImage.curY = theImage.curY + variables.curWidH - theImage.height * theImage.scale + theImage.parent.imageVisibleLeftUpY
+ }
+ }
+
+ } else if (theImage.parent.imageLeftUpX < 0 && theImage.parent.imageLeftUpY > 0) {
+
+ if (variables.curWidW - theImage.width * theImage.scale + theImage.parent.imageVisibleLeftUpX > 0) {
+ if (theImage.parent.imageVisibleLeftUpY < variables.curWidH) {
+ theImage.curX = theImage.curX + variables.curWidW - theImage.width * theImage.scale + theImage.parent.imageVisibleLeftUpX
+ theImage.curY = theImage.curY - theImage.parent.imageLeftUpY
+ } else {
+ theImage.curX = theImage.curX + variables.curWidW - theImage.width * theImage.scale + theImage.parent.imageVisibleLeftUpX
+ }
+ } else {
+ if (theImage.parent.imageVisibleLeftUpY < variables.curWidH) {
+ theImage.curY = theImage.curY - theImage.parent.imageLeftUpY
+ }
+ }
+
+ } else if (theImage.parent.imageLeftUpX > 0 && theImage.parent.imageLeftUpY < 0) {
+ if (theImage.parent.imageVisibleLeftUpX < variables.curWidW) {
+ if ( variables.curWidH - theImage.height * theImage.scale + theImage.parent.imageVisibleLeftUpY > 0) {
+ theImage.curX = theImage.curX - theImage.parent.imageLeftUpX
+ theImage.curY = theImage.curY + variables.curWidH - theImage.height * theImage.scale + theImage.parent.imageVisibleLeftUpY
+ } else {
+ theImage.curX = theImage.curX - theImage.parent.imageLeftUpX
+ }
+ } else {
+ if ( variables.curWidH - theImage.height * theImage.scale + theImage.parent.imageVisibleLeftUpY > 0) {
+ theImage.curY = theImage.curY + variables.curWidH - theImage.height * theImage.scale + theImage.parent.imageVisibleLeftUpY
+ }
+ }
+
+ } else if (theImage.parent.imageLeftUpX > 0 && theImage.parent.imageLeftUpY > 0) {
+
+ if (theImage.parent.imageVisibleLeftUpX < variables.curWidW) {
+ if ( theImage.parent.imageVisibleLeftUpY < variables.curWidH) {
+ theImage.curX = theImage.curX - theImage.parent.imageLeftUpX
+ theImage.curY = theImage.curY - theImage.parent.imageLeftUpY
+ } else {
+ theImage.curX = theImage.curX - theImage.parent.imageLeftUpX
+ }
+ } else {
+ if ( theImage.parent.imageVisibleLeftUpY < variables.curWidH) {
+ theImage.curY = theImage.curY - theImage.parent.imageLeftUpY
+ }
+ }
+ }
+ } else {
+ resetImagePostion(theImage)
+ }
+ }
+ }
+
+}
diff --git a/part/ImageNormal.qml b/part/ImageNormal.qml
new file mode 100644
index 0000000..021c191
--- /dev/null
+++ b/part/ImageNormal.qml
@@ -0,0 +1,449 @@
+/**************************************************************************
+ ** **
+ ** Copyright (C) 2011-2021 Lukas Spies **
+ ** Contact: http://photoqt.org **
+ ** **
+ ** This file is part of PhotoQt. **
+ ** **
+ ** PhotoQt 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. **
+ ** **
+ ** PhotoQt 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 PhotoQt. If not, see . **
+ ** **
+ **************************************************************************/
+
+import QtQuick 2.12
+
+Item {
+ objectName: "imageItemLower"
+ id: imageNormal
+ x: parent.width/2 - width/2
+ y: parent.height/2 - height/2
+ width: container.width
+ height: container.height
+ property real defaultScale: 1.0
+ signal sendScale(var scale)
+ property bool needWheelReact: true //是否需要滑轮响应
+ property bool newImageLoaded: false //新图片加载
+ signal sendPos(var xPos,var yPos)
+ property double imageVisibleLeftUpX: 0 //可视区域左上角的点在原图上的位置
+ property double imageVisibleLeftUpY: 0
+ property double imageLeftUpX: 0 //缩放后的图片的左上角相对于窗口的位置
+ property double imageLeftUpY: 0
+ signal needShowNavigator(var scale, var leftUpImageX, var leftUpImageY, var visibleWidth, var visibleHeight)
+ signal closeNavigator()
+ property bool imageNeedCenterZoom: true
+ property bool mouseareaEnabeled: false
+ property int mouseDragType: -1
+ property bool startAni: true
+
+ signal buriedPoint()
+
+ Image {
+ objectName: "image"
+ id: theImage
+ property real curX: imageNormal.width/2 - width/2
+ property real curY: imageNormal.height/2 - height/2
+ x: curX
+ y: curY
+ focus: true
+ //原始图像不做处理
+ fillMode: Image.Pad
+ //设置clip:true后当元素的子项超出父项范围后会自动裁剪
+ clip: true
+ cache: false
+ asynchronous: true
+ //图像是否应水平镜像,默认为false,可以做镜像来用
+ mirror: false
+ //图像在缩放或变换时是否平滑过滤。平滑过滤可以提供更好的视觉质量
+ smooth: (width * scale > variables.curWidW || height > variables.curWidH)
+ //保存图像在缩放或变换时是否使用mipmap过滤。与平滑相比,缩小比例时,mipmap过滤提供了更好的视觉质量,但它可能会以性能为代价(无论是在初始化图像时还是在渲染期间)。
+ mipmap: (scale < defaultScale || (scale < 0.8 && defaultScale < 0.8)) && (width > variables.curWidW || height > variables.curWidH)
+ source: "qrc:/res/res/kyview_logo.png"
+
+ //旋转--参数:real,角度。默认0 degree
+ rotation: 0
+ property real rotateTo: 0
+ onRotateToChanged: {
+ rotation = rotateTo
+ }
+ onRotationChanged: {
+ if(!rotani.running) {
+ rotateTo = rotation
+ }
+ }
+ property real curScale: 1
+ scale: curScale
+
+ Behavior on x {
+ PropertyAnimation {
+ id: xani
+ duration: startAni ? variables.imageAniDuration : 0
+ easing.type: Easing.OutCubic
+ }
+ }
+
+ Behavior on y {
+ PropertyAnimation {
+ id: yani
+ duration: startAni ? variables.imageAniDuration : 0
+ easing.type: Easing.OutCubic
+ }
+ }
+ Behavior on rotation {
+ PropertyAnimation {
+ id: rotani
+ duration: startAni ? variables.imageAniDuration : 0
+ onRunningChanged: {
+ if (!rotani.running) {
+ imageBase.imageActuralLeftUpPos(theImage,theImage.curX,theImage.curY)
+ }
+ }
+ easing.type: Easing.OutCubic
+ }
+ }
+ Behavior on scale {
+ PropertyAnimation {
+ id: scaleani
+ duration: startAni ? variables.imageAniDuration : 0
+ onRunningChanged: {
+ if (!scaleani.running) {
+ imageBase.imageActuralLeftUpPos(theImage,theImage.curX,theImage.curY)
+ imageBase.makeSureNavigatorNeedShow(theImage)
+ }
+ }
+ easing.type: Easing.OutCubic
+ }
+ }
+ onXChanged: {
+ setDrogLimit()
+ }
+ onYChanged: {
+ setDrogLimit()
+ }
+
+ function changeScale(scaleValue) {
+ imageBase.setImageScaleWithImageUpdate(theImage,scaleValue)
+ }
+
+ function sendScaleFirstTime() {
+ return imageBase.getImageScale(theImage)
+ }
+
+ //重设位置
+ function imagePostionReset() {
+ imageBase.resetImagePostion(theImage)
+ }
+ onStatusChanged: {
+ if (theImage.status == Image.Ready) {
+ if (newImageLoaded) {
+ theImage.imagePostionReset()
+ }
+ }
+ }
+ }
+ Connections {
+ target: variables
+ onWheelChangeChanged: {
+ buriedPoint()
+ }
+ }
+
+ PinchArea {
+
+ id: pincharea
+ anchors.fill: theImage
+ scale: theImage.scale
+ rotation: theImage.rotation
+ enabled: true
+
+ property real initialScale
+ onPinchStarted: {
+ initialScale = theImage.curScale
+ buriedPoint()
+ }
+ onPinchUpdated: {
+ // 关闭动画
+ startAni = false
+ if (!imageNeedCenterZoom) {
+ imageBase.performZoom(theImage,theImage.mapFromItem(pincharea,pinch.center.x, pinch.center.y), undefined, false, false, true, (initialScale*pinch.scale)/theImage.curScale)
+ } else {
+ imageBase.performZoom(theImage,theImage.mapFromItem(pincharea, mainWindow.width/2, mainWindow.height/2), undefined, false, false, true,(initialScale*pinch.scale)/theImage.curScale)
+ theImage.imagePostionReset()
+ }
+ // 开启动画
+ startAni = true
+ }
+
+ MouseArea {
+ id: mousearea
+ enabled: mouseareaEnabeled
+ anchors.fill: parent
+ drag.target: theImage
+ hoverEnabled: false // 必须设置为false,否则,鼠标的坐标抓取的就不是全局的
+ onPressAndHold: {
+ variables.mousePos = mousearea.mapToItem(bgimage, Qt.point(mouse.x, mouse.y))
+ }
+ onReleased: {
+
+ theImage.curX = theImage.x
+ theImage.curY = theImage.y
+ theImage.x = Qt.binding(function() { return theImage.curX })
+ theImage.y = Qt.binding(function() { return theImage.curY })
+ imageBase.controlImageInWid(theImage)
+ imageBase.imageActuralLeftUpPos(theImage,theImage.curX,theImage.curY)
+ imageBase.makeSureNavigatorNeedShow(theImage)
+ }
+ onPositionChanged: {
+ setDrogLimit()
+ imageBase.imageActuralLeftUpPos(theImage,theImage.x ,theImage.y)
+ imageBase.makeSureNavigatorNeedShow(theImage)
+ }
+
+ Connections {
+ target: variables
+ onMousePosChanged: {
+ mousearea.cursorShape = Qt.ArrowCursor
+ }
+ onVisibleItemChanged: {
+ if (variables.visibleItem !== "") {
+ mousearea.cursorShape = Qt.ArrowCursor
+ } else {
+ mousearea.cursorShape = Qt.ArrowCursor
+ }
+ }
+ }
+ }
+ }
+
+ Connections {
+ target: container
+ onZoomIn: {
+ if (isMoiveRunning()) {
+ return
+ }
+ //某些情况需要静止进行缩放
+ if (needWheelReact == false) {
+ return
+ }
+ if (wheelDelta != undefined && !imageNeedCenterZoom) {
+ imageBase.performZoom(theImage,theImage.mapFromItem(bgimage, variables.mousePos.x, variables.mousePos.y), undefined, true, false, false)
+ } else {
+ imageBase.performZoom(theImage,theImage.mapFromItem(bgimage, mainWindow.width/2, mainWindow.height/2), undefined, true, false, false)
+ theImage.imagePostionReset()
+ }
+ imageBase.imageActuralLeftUpPos(theImage,theImage.curX,theImage.curY)
+ imageBase.makeSureNavigatorNeedShow(theImage)
+ }
+
+ onZoomOut: {
+ if (isMoiveRunning()) {
+ return
+ }
+ //某些情况需要静止进行缩放
+ if (needWheelReact == false) {
+ return
+ }
+ if (wheelDelta != undefined && !imageNeedCenterZoom) {
+ imageBase.performZoom(theImage,theImage.mapFromItem(bgimage, variables.mousePos.x, variables.mousePos.y), undefined, false, false, false)
+ } else {
+ imageBase.performZoom(theImage,theImage.mapFromItem(bgimage, mainWindow.width/2, mainWindow.height/2), undefined, false, false, false)
+ theImage.imagePostionReset()
+ }
+ imageBase.imageActuralLeftUpPos(theImage,theImage.curX,theImage.curY)
+ imageBase.makeSureNavigatorNeedShow(theImage)
+ }
+ onRotate: {
+ if (isMoiveRunning()) {
+ return
+ }
+ theImage.rotateTo += deg
+ imageBase.imageActuralLeftUpPos(theImage,theImage.curX,theImage.curY)
+ }
+
+ onMirrorH: {
+ if (isMoiveRunning()) {
+ return
+ }
+ var old = theImage.mirror
+ theImage.mirror = !old
+ startAni = false
+ if (theImage.rotateTo / variables.angle90 % 2 != 0) {
+ theImage.rotateTo += variables.angle180
+ }
+ startAni = true
+ imageBase.imageActuralLeftUpPos(theImage,theImage.curX,theImage.curY)
+ }
+ onMirrorV: {
+ if (isMoiveRunning()) {
+ return
+ }
+ var old = theImage.mirror
+ theImage.mirror = !old
+ startAni = false
+ if (theImage.rotateTo / variables.angle90 % 2 == 0) {
+ theImage.rotateTo += variables.angle180
+ }
+ startAni = true
+ imageBase.imageActuralLeftUpPos(theImage,theImage.curX,theImage.curY)
+ }
+ }
+
+ function operateImage(operateWay) {
+
+ if (container.imageType === 1) {
+ return
+ }
+ variables.operateWay = operateWay
+ if (operateWay === 1) {
+ //放大
+ container.zoomIn(undefined)
+ } else if (operateWay === 2) {
+ //缩小
+ container.zoomOut(undefined)
+ } else if (operateWay === 3) {
+ //逆时针旋转
+ container.rotate(-variables.angle90)
+ theImage.imagePostionReset()
+ } else if (operateWay === 4) {
+ //顺时针旋转
+ container.rotate(variables.angle90)
+ theImage.imagePostionReset()
+ } else if (operateWay === 5) {
+ //水平
+ container.mirrorH()
+ theImage.imagePostionReset()
+ } else if (operateWay === 6) {
+ //垂直
+ container.mirrorV()
+ theImage.imagePostionReset()
+ }
+ //ocr和裁剪
+ if (operateWay === 9 || operateWay === 10) {
+ //禁止拖拽和缩放
+ pincharea.enabled = false
+ mousearea.enabled = false
+ needWheelReact = false
+ } else {
+ //放开拖拽和缩放
+ pincharea.enabled = true
+ mousearea.enabled = true
+ needWheelReact = true
+ }
+ //切图
+ if (operateWay === 12) {
+ startAni = false
+ theImage.rotateTo = 0
+ startAni = true
+ theImage.mirror = false
+ newImageLoaded = true
+ theImage.imagePostionReset()
+ } else {
+ newImageLoaded = false
+ }
+ //显示原图大小
+ if (operateWay === 8) {
+ theImage.curScale = 1
+ theImage.imagePostionReset()
+ }
+ }
+ //判断当前的图片加载模式,防止影响其他信号的接收
+ function isMoiveRunning() {
+
+ if (container.imageType === 1) {
+ return true
+ } else {
+ return false
+ }
+ }
+ //返回所需要相对于窗口的X和Y
+ function getLeftUpPosAccordingWidX() {
+
+ return imageBase.getLeftUpPosAccordingWidX(theImage)
+
+ }
+ function getLeftUpPosAccordingWidY() {
+
+ return imageBase.getLeftUpPosAccordingWidY(theImage)
+ }
+ //返回所需要相对于窗口的在当前缩放比下的可视区域的高度和宽度
+ function getVisibleSizeAccordingWidW() {
+
+ return imageBase.getVisibleSizeAccordingWidW(theImage)
+
+ }
+ function getVisibleSizeAccordingWidH() {
+
+ return imageBase.getVisibleSizeAccordingWidH(theImage)
+ }
+ //返回相对于原图的位置
+ function getLeftUpPosAccordingImageX() {
+ return imageVisibleLeftUpX / theImage.curScale
+ }
+ function getLeftUpPosAccordingImageY() {
+ return imageVisibleLeftUpY / theImage.curScale
+ }
+
+ function operateNavigatorChangeImagePos(leftUpPoint) {
+ imageBase.operateNavigatorChangeImagePos(leftUpPoint,theImage)
+ }
+
+ function setDrogLimit() {
+
+ if(Math.abs(theImage.rotateTo % variables.angle360) == variables.angle90 || Math.abs(theImage.rotateTo % variables.angle360) == variables.angle270) {
+ if (theImage.width * theImage.scale >= variables.curWidH) {
+ if (theImage.height * theImage.scale >= variables.curWidW) {
+ mousearea.enabled = true
+ mousearea.drag.axis= Drag.XAndYAxis
+ mouseDragType = 2
+ } else {
+ mousearea.enabled = true
+ mousearea.drag.axis= Drag.YAxis
+ mouseDragType = 1
+ }
+ } else if (theImage.height * theImage.scale >= variables.curWidW) {
+ mousearea.enabled = true
+ mousearea.drag.axis= Drag.XAxis
+ mouseDragType = 0
+ } else {
+ mousearea.enabled = false
+ mouseDragType = -1
+ }
+ } else {
+ if (theImage.width * theImage.scale >= variables.curWidW) {
+ if (theImage.height * theImage.scale >= variables.curWidH) {
+ mousearea.enabled = true
+ mousearea.drag.axis= Drag.XAndYAxis
+ mouseDragType = 2
+ } else {
+ mousearea.enabled = true
+ mousearea.drag.axis= Drag.XAxis
+ mouseDragType = 0
+ }
+ } else if (theImage.height * theImage.scale >= variables.curWidH) {
+ mousearea.enabled = true
+ mousearea.drag.axis= Drag.YAxis
+ mouseDragType = 1
+ } else {
+ mousearea.enabled = false
+ mouseDragType = -1
+ }
+ }
+ }
+ function adjustImagePostion() {
+ setDrogLimit()
+ imageBase.controlImageInWid(theImage)
+ }
+ function updatePosAccordingToWidSizeChange() {
+ imageBase.imageActuralLeftUpPos(theImage,theImage.curX,theImage.curY)
+ imageBase.makeSureNavigatorNeedShow(theImage)
+ }
+}
diff --git a/part/MainImageArea.qml b/part/MainImageArea.qml
new file mode 100644
index 0000000..c421f47
--- /dev/null
+++ b/part/MainImageArea.qml
@@ -0,0 +1,61 @@
+/**************************************************************************
+ ** **
+ ** Copyright (C) 2011-2021 Lukas Spies **
+ ** Contact: http://photoqt.org **
+ ** **
+ ** This file is part of PhotoQt. **
+ ** **
+ ** PhotoQt 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. **
+ ** **
+ ** PhotoQt 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 PhotoQt. If not, see . **
+ ** **
+ **************************************************************************/
+
+import QtQuick 2.9
+
+Item {
+ id: container
+ //位置和动画
+ anchors.fill: parent
+ anchors.leftMargin: 0
+ Behavior on anchors.leftMargin { NumberAnimation { duration: variables.imageAniDuration } }
+ anchors.bottomMargin: 0
+ Behavior on anchors.bottomMargin { NumberAnimation { duration: variables.imageAniDuration } }
+ anchors.topMargin: 0
+ Behavior on anchors.topMargin { NumberAnimation { duration: variables.imageAniDuration } }
+ anchors.rightMargin: 0
+
+ property int imageType: 0 //判断动静图,需要加载哪一个qml
+
+ signal zoomIn(var wheelDelta)
+ signal zoomOut(var wheelDelta)
+ signal zoomReset()
+ signal zoomActual()
+ signal rotate(var deg)
+ signal rotateReset()
+ signal mirrorH()
+ signal mirrorV()
+ signal mirrorReset()
+
+
+ Loader {
+ id: imageloader
+ objectName: "imageLoader"
+ visible: true
+ source: imageType == 0 ? "ImageNormal.qml" : "ImageAnimated.qml"
+ }
+
+ function resetImagePostion(theImage) {
+
+ }
+
+}
diff --git a/part/Variables.qml b/part/Variables.qml
new file mode 100644
index 0000000..3788eb5
--- /dev/null
+++ b/part/Variables.qml
@@ -0,0 +1,25 @@
+import QtQuick 2.12
+
+Item {
+ property string visibleItem: ""
+ property point mousePos: Qt.point(-1, -1)
+ property double curWidW: 0
+ property double curWidH: 0
+ property point mouseCurPos: Qt.point(-1, -1)
+ property bool navigatorState: false
+ //缩放比例常数
+ property int scalingconstant: 100
+ property int imageAniDuration: 300
+ property int imageZoomSpeed: 20
+ //4个角度
+ property int angle90: 90
+ property int angle180: 180
+ property int angle270: 270
+ property int angle360: 360
+ property bool wheelChange: false
+ property int operateWay: 0
+
+
+ // "jpg", "jpe", "jpeg", "pbm", "pgm", "ppm", "sr", "ras", "png", "tga", "svg", "gif", "apng", "ico", "xpm", "exr", "psd", "jfi", "jif", "j2k", "jp2", "jng", "wbmp", "xbm", "tiff", "tif", "webp", "pnm", "bmp", "dib"
+
+}
diff --git a/res.qrc b/res.qrc
index b7f3af6..4bceb04 100644
--- a/res.qrc
+++ b/res.qrc
@@ -180,8 +180,17 @@
res/damaged_img.png
res/sp1damaged/ocr_damaged.png
res/sp1damaged/1ocr_damaged.png
+ res/ocrCancel_W.png
+ res/ocrCancel_B.png
showImageComponent.qml
+ part/ImageAnimated.qml
+ part/ImageNormal.qml
+ part/MainImageArea.qml
+ part/Variables.qml
+ part/ImageBaseFunction.qml
+ mousebase/MouseAreaBase.js
+ mousebase/MouseAreaEvent.qml
diff --git a/res/ocrCancel_B.png b/res/ocrCancel_B.png
new file mode 100644
index 0000000..bbb39df
Binary files /dev/null and b/res/ocrCancel_B.png differ
diff --git a/res/ocrCancel_W.png b/res/ocrCancel_W.png
new file mode 100644
index 0000000..0853651
Binary files /dev/null and b/res/ocrCancel_W.png differ
diff --git a/showImageComponent.qml b/showImageComponent.qml
index 7179bda..9cd92fe 100644
--- a/showImageComponent.qml
+++ b/showImageComponent.qml
@@ -1,42 +1,101 @@
import QtQuick 2.12
import QtQuick.Window 2.0
+import "./part"
+import "./mousebase"
Rectangle {
- id: mainRect
objectName: "mainRect"
- color: "transparent"
- property bool startAnimation: true
- Rectangle {
- id: imageRect
- x: (mainRect.width - imageRect.width)/2
- y: (mainRect.height - imageRect.height)/2
- objectName: "imageRect"
- color: "transparent"
- Image {
- id: targatImage
- x:0
- y:0
- cache: false
- opacity: 1
- objectName: "targatImage"
- source: "qrc:/res/res/kyview_logo.png"
- Behavior on scale {
- NumberAnimation {
- id: scaleAni
- duration: mainRect.startAnimation? 300 : 0
+ id: mainWindow
+ visible: true
+ property string dropImagePath: ""
+ signal sendDropImagePath(var path)
+ property int mouseMoveDistance: 0
+ property point startPressPoint: Qt.point(-1,-1)
+ property point releasePoint: Qt.point(-1,-1)
+ property bool mouseIsDoubleClick: false
+ signal changeImage(var nextOrBack)
+ signal doubleSignal()
+ Variables { id: variables }
+ ImageBaseFunction {id: imageBase}
+ onWidthChanged: {
+ variables.curWidW = width
+ }
+ onHeightChanged: {
+ variables.curWidH = height
+ }
+
+ //鼠标事件响应区域
+ MouseAreaEvent { id: mouseshortcuts }
+ //外边框---最外层的,需要用到别的组件相对于它的位置
+ Image {
+ id: bgimage
+ anchors.fill: parent
+ MouseArea {
+ id: mousemouse
+ anchors.fill: parent
+ hoverEnabled: true
+ onReleased: {
+ //导航栏存在的话直接return
+ if (variables.navigatorState) {
+ return
+ }
+ if (mouseIsDoubleClick) {
+ mouseIsDoubleClick = false
+ return
+ }
+ releasePoint = Qt.point(mouseX, mouseY)
+ mouseMoveDistance = releasePoint.x - startPressPoint.x
+
+ if (mouseMoveDistance > 100) {
+ //切换图图片
+ changeImage(true)
}
+ if (mouseMoveDistance < -100) {
+ //切换图图片
+ changeImage(false)
+ }
+
}
- }
- Behavior on x {
- NumberAnimation {
- id: xAni1
- duration: mainRect.startAnimation? 300 : 0
+
+ onPressed: {
+ startPressPoint = Qt.point(mouseX, mouseY)
}
- }
- Behavior on y {
- NumberAnimation {
- id: yAni1
- duration: mainRect.startAnimation? 300 : 0
+ onPositionChanged: {
+ variables.mousePos = Qt.point(mouseX, mouseY)
+ }
+ onMouseXChanged: {
+ variables.mouseCurPos = Qt.point(mouseX, mouseY)
+ }
+ onMouseYChanged: {
+ variables.mouseCurPos = Qt.point(mouseX, mouseY)
+ }
+ onDoubleClicked: {
+ mouseIsDoubleClick = true
+ doubleSignal()
}
}
}
+
+ //主要的图片区域
+ MainImageArea {
+ objectName: "imageItem"
+ id: imageArea
+ x: 0
+ y: 0
+ width: mainWindow.width
+ height: mainWindow.height
+ }
+ //拖拽文件打开图片
+ DropArea{
+ anchors.fill: parent
+ onDropped: {
+ if (drop.hasUrls) {
+ if (drop.urls.length > 0) {
+ dropImagePath = drop.urls[0]
+ sendDropImagePath(drop.urls[0])
+ }
+ }
+ }
+ }
+
}
+
diff --git a/src/controller/core/base.h b/src/controller/core/base.h
index 571381e..deb69f9 100644
--- a/src/controller/core/base.h
+++ b/src/controller/core/base.h
@@ -44,6 +44,7 @@ public:
QString m_failImage; //记录当m_nowpath和m_backpath都为空时的上一次的失败路径
Mat m_nowMat; //记录当前打开
Mat m_backMat; //记录上次打开
+ Mat m_cutMat; //裁剪时使用的显示图片
QPixmap m_nowImage;
int m_maxFrame = 0; //图片最大帧数
QList m_willProcess; //存操作方式
@@ -73,7 +74,7 @@ public:
class NavigationStatus : public ImageShowStatus //导航器相关单独写,提高可读性
{
public:
- QPoint m_clickBeforePosition; //记录上次点击区域,用于提升体验
+ QPointF m_clickBeforePosition; //记录上次点击区域,用于提升体验
QPoint m_clickBeforeStartPosition; //记录上次点击区域,用于节省算力
QPixmap m_showPix; //待显示图
QImage m_navigationImage; //导航栏背景
diff --git a/src/controller/core/core.cpp b/src/controller/core/core.cpp
index 868dfd9..f7ad896 100644
--- a/src/controller/core/core.cpp
+++ b/src/controller/core/core.cpp
@@ -254,6 +254,9 @@ void Core::openImage(QString fullPath)
if (!m_openSuccess) {
//更新侧栏图标
changeOpenIcon(Variable::g_themeStyle);
+ if (m_loadedImage.contains(fullPath)) {
+ m_loadedImage.removeAt(m_loadedImage.indexOf(fullPath));
+ }
}
setHighLight(fullPath); //设置相册选中
m_nowImage = Processing::converFormat(maf.mat);
@@ -285,11 +288,21 @@ void Core::openImage(QString fullPath)
void Core::showImage(const QPixmap &pix)
{
+ //对于动图在静止无操作时,不多次进行触发
+ if (!pix.isNull()) {
+ if (m_matList != nullptr && (m_info.suffix().toLower() == "gif" || m_info.suffix().toLower() == "apng")) {
+ if (m_backImagePath == m_nowpath) {
+ if (operayteMode == OperayteMode::NormalMode || operayteMode == OperayteMode::NoOperate) {
+ return;
+ }
+ }
+ }
+ }
+ if (!pix.isNull()) {
+ m_backImagePath = m_nowpath;
+ }
m_origCutImage = pix.toImage().copy();
- if (!m_isCutting) {
- m_origCutImageBefore = pix.toImage().copy();
- }
ImageAndInfo package;
package.proportion = m_proportion;
package.imageNumber = m_albumModel->rowCount();
@@ -320,6 +333,12 @@ void Core::showImage(const QPixmap &pix)
package.leftUpPos = m_leftUpPos;
package.actualClickPos = m_actualClickPos;
package.actualPos = m_actualClickPos;
+
+ if (m_info.suffix().toLower() == "tiff" || m_info.suffix().toLower() == "tif") {
+ if (m_matList != nullptr && m_matList->length() > 1) {
+ package.imageList = m_tiffImageList;
+ }
+ }
QVariant var;
var.setValue(package);
Q_EMIT openFinish(var);
@@ -357,7 +376,7 @@ void Core::defaultImage(int proportion, int defaultProportion)
}
m_lastTimeProportion = defaultProportion;
m_tmpSize = m_nowImage.size() * m_proportion / 100;
- navigation(QPoint(-1, -1), true); //关闭导航器
+ // navigation(QPoint(-1, -1), true); //关闭导航器
showImageOrMovie();
return;
}
@@ -383,25 +402,28 @@ void Core::operateImage(int proportion, int defaultProportion)
if (judgeSizeIsZero(m_tmpSize)) {
return;
}
- //如果显示比例大于默认比例
- if (m_proportion > defaultProportion) {
- navigation(QPoint(0, 0), false); //显示导航器
- return;
- } else {
- navigation(QPoint(-1, -1), false); //关闭导航器
- }
showImageOrMovie();
}
void Core::showImageOrMovie()
{
-
+ QFileInfo fileInfo(m_nowpath);
//动画类格式循环播放
if (m_matList != nullptr) {
- if (m_matList->length() > 1) {
- playMovie(); //立即播放第一帧
- m_playMovieTimer->start(m_fps);
- return;
+ if (fileInfo.suffix().toLower() != "tiff" && fileInfo.suffix().toLower() != "tif") {
+ if (m_matList->length() > 1) {
+ playMovie(); //立即播放第一帧
+ m_playMovieTimer->start(m_fps);
+ return;
+ }
+ } else {
+ if (m_matList->length() > 1) {
+ for (int i = 0; i < m_matList->length(); i++) {
+ Mat mat = m_matList->at(i);
+ QPixmap nowIndexPix = Processing::converFormat(mat);
+ m_tiffImageList.append(nowIndexPix.toImage());
+ }
+ }
}
}
//非动画类格式
@@ -411,6 +433,7 @@ void Core::showImageOrMovie()
void Core::playMovie()
{
+
if (m_matListIndex >= m_matList->length()) {
m_matListIndex = 0;
}
@@ -444,6 +467,133 @@ void Core::navigation(const QPoint &point, bool isDragImage)
clickNavigation(m_zoomFocus, isDragImage);
}
+void Core::qmlNavigation(QPointF leftUpPosAccordingShowImage, QSizeF displaySize, double imageScale)
+{
+ m_qmlProportion = imageScale;
+ qmlCreatNavigation(displaySize);
+ qmlClickNavigation(leftUpPosAccordingShowImage, false);
+}
+
+void Core::qmlCreatNavigation(QSizeF displaySize)
+{
+ //导航栏背景
+ QSize navigationSize = Variable::NAVIGATION_SIZE;
+ m_navigationImage = Processing::resizePix(m_nowImage, navigationSize).toImage();
+
+ //记录空白区域
+ m_spaceWidth = (navigationSize.width() - m_navigationImage.width()) / 2;
+ m_spaceHeight = (navigationSize.height() - m_navigationImage.height()) / 2;
+
+ //待显示图
+ m_tmpSize = m_nowImage.size() * m_qmlProportion;
+
+ // m_hightlightSize.setWidth(
+ // displaySize.width() / m_qmlProportion
+ // * ((static_cast(m_navigationImage.width()) / static_cast(m_nowImage.width()))) *
+ // m_size.width() / m_tmpSize.width());
+ // m_hightlightSize.setHeight(
+ // displaySize.height() / m_qmlProportion
+ // * ((static_cast(m_navigationImage.height()) / static_cast(m_nowImage.height())))
+ // * m_size.height() / m_tmpSize.height());
+
+ m_hightlightSize.setWidth(m_navigationImage.width() * displaySize.width() / m_tmpSize.width());
+ m_hightlightSize.setHeight(m_navigationImage.height() * displaySize.height() / m_tmpSize.height());
+
+ if (m_hightlightSize.width() > m_navigationImage.width()) {
+ m_hightlightSize.setWidth(m_navigationImage.width());
+ }
+ if (m_hightlightSize.height() > m_navigationImage.height()) {
+ m_hightlightSize.setHeight(m_navigationImage.height());
+ }
+}
+
+void Core::qmlClickNavigation(QPointF curMousePos, bool needChangeDisplayImage)
+{
+ bool hasArg = true;
+ //无参输入则使用上次的位置
+ if (curMousePos == QPoint(-1, -1)) {
+ hasArg = false;
+ }
+ //有参则记录,无参使用上一次的点
+ if (hasArg) {
+ m_clickBeforePosition = curMousePos;
+ }
+ //两种情况:1.点击导航栏区域或拖拽导航栏高亮区域;2.除1外的其他情况
+ int naviClickStartPointX = m_clickBeforePosition.x() - m_hightlightSize.width() / 2 - m_spaceWidth;
+ int naviClickStartPointY = m_clickBeforePosition.y() - m_hightlightSize.height() / 2 - m_spaceHeight;
+ double otherStartPointX =
+ static_cast(m_clickBeforePosition.x()) / m_qmlProportion
+ * ((static_cast(m_navigationImage.width()) / static_cast(m_nowImage.width())));
+ double otherStartPointY =
+ static_cast(m_clickBeforePosition.y()) / m_qmlProportion
+ * ((static_cast(m_navigationImage.height()) / static_cast(m_nowImage.height())));
+ QPoint startPoint;
+ //计算点击区域
+ if (needChangeDisplayImage) {
+ startPoint.setX(naviClickStartPointX);
+ startPoint.setY(naviClickStartPointY);
+ } else {
+ startPoint.setX(otherStartPointX);
+ startPoint.setY(otherStartPointY);
+ }
+
+ int right = m_navigationImage.width() - m_hightlightSize.width(); //右侧边缘
+ int bottom = m_navigationImage.height() - m_hightlightSize.height(); //下侧边缘
+
+ //过滤无效区域
+ if (startPoint.x() < 0) {
+ startPoint.setX(0);
+ }
+ if (startPoint.y() < 0) {
+ startPoint.setY(0);
+ }
+ if (startPoint.x() > right) {
+ startPoint.setX(right);
+ }
+ if (startPoint.y() > bottom) {
+ startPoint.setY(bottom);
+ }
+ m_clickBeforeStartPosition = startPoint;
+ //处理导航器图片
+ QImage image = Processing::pictureDeepen(m_navigationImage, m_hightlightSize, startPoint);
+
+ //计算实际显示的图片的部分在当前缩放比下相对于图片上的位置
+ //已知:导航栏图片,高亮区域的大小,起始点位置,缩放比
+ if (needChangeDisplayImage) {
+
+ double displayDiffX =
+ static_cast(startPoint.x() - m_backHightLight.x())
+ / (static_cast(m_navigationImage.width()) / static_cast(m_nowImage.width()))
+ * m_qmlProportion;
+ double displayDiffY =
+ static_cast(startPoint.y() - m_backHightLight.y())
+ / (static_cast(m_navigationImage.height()) / static_cast(m_nowImage.height()))
+ * m_qmlProportion;
+
+ QPointF actualPos(displayDiffX, displayDiffY);
+ Q_EMIT getLeftUpPosAccordingImage(actualPos);
+ }
+ //发送到导航器设置
+ Q_EMIT sendHightlightPos(QPoint(startPoint.x() + m_spaceWidth, startPoint.y() + m_spaceHeight),
+ QPoint(startPoint.x() + m_hightlightSize.width() + m_spaceWidth,
+ startPoint.y() + m_hightlightSize.height() + m_spaceHeight));
+ //发送到导航器
+ Q_EMIT showNavigation(QPixmap::fromImage(image));
+ m_backHightLight = startPoint;
+}
+
+bool Core::qmlNaviCheckBoundary(QSizeF visibleSize, QPointF curVisiblePartLeftUpPos, double imageScale)
+{
+ if (visibleSize.width() > m_nowImage.width() * imageScale
+ || visibleSize.height() > m_nowImage.height() * imageScale) {
+ return false;
+ }
+ if (curVisiblePartLeftUpPos.x() > m_nowImage.width() * imageScale
+ || curVisiblePartLeftUpPos.y() > m_nowImage.height() * imageScale) {
+ return false;
+ }
+ return true;
+}
void Core::clickNavigation(const QPoint &point, bool isDragImage)
{
bool hasArg = true;
@@ -479,10 +629,10 @@ void Core::clickNavigation(const QPoint &point, bool isDragImage)
startPoint.setY(bottom);
}
- //有参情况下,和上次点击的有效区域一致则不处理,同时区分
- if ((startPoint == m_clickBeforeStartPosition) && hasArg && !m_isClickBtnChangeImageSize) {
- return;
- }
+ // //有参情况下,和上次点击的有效区域一致则不处理,同时区分
+ // if ((startPoint == m_clickBeforeStartPosition) && hasArg && !m_isClickBtnChangeImageSize) {
+ // return;
+ // }
m_clickBeforeStartPosition = startPoint;
//处理导航器图片
@@ -608,8 +758,8 @@ void Core::deleteImage()
//删除后队列中无图片,返回状态
if (m_albumModel->rowCount() == 1) {
- navigation(QPoint(-1, -1), true); //关闭导航器
- showImage(QPixmap()); //发送状态
+ // navigation(QPoint(-1, -1), true); //关闭导航器
+ showImage(QPixmap()); //发送状态
return;
}
}
@@ -747,6 +897,7 @@ QStandardItemModel *Core::getAlbumModel()
void Core::changeImage(const int &type)
{
+ operayteMode = OperayteMode::ChangeImage;
//如果错误不处理
if (type == ERROR_IMAGE) {
Q_EMIT updateSideNum(m_albumModel->rowCount());
@@ -790,6 +941,12 @@ void Core::changeImageFromClick(QModelIndex modelIndex)
MyStandardItem *item = dynamic_cast(m_albumModel->itemFromIndex(modelIndex));
if (item == nullptr) {
changeImage(modelIndex.row());
+ //切换图片-埋点
+ kdk::kabase::BuriedPoint buriedPointSwitchPicture;
+ if (buriedPointSwitchPicture.functionBuriedPoint(kdk::kabase::AppName::KylinPhotoViewer,
+ kdk::kabase::BuriedPoint::PT::KylinPhotoViewerSwitchPicture)) {
+ qCritical() << "Error : buried point fail SwitchPicture!";
+ }
return;
}
if (item->getPath() == m_nowpath) {
@@ -800,6 +957,12 @@ void Core::changeImageFromClick(QModelIndex modelIndex)
Q_EMIT openFromAlbum();
return;
}
+ //切换图片-埋点
+ kdk::kabase::BuriedPoint buriedPointSwitchPicture;
+ if (buriedPointSwitchPicture.functionBuriedPoint(kdk::kabase::AppName::KylinPhotoViewer,
+ kdk::kabase::BuriedPoint::PT::KylinPhotoViewerSwitchPicture)) {
+ qCritical() << "Error : buried point fail SwitchPicture!";
+ }
changeImage(modelIndex.row());
// openImage(item->getPath());
}
@@ -818,30 +981,7 @@ void Core::changeImageShowSize(ImageShowStatus::ChangeShowSizeType type, QPoint
m_imageNeedUpdate = false;
m_zoomFocus = focus;
int resizeKey;
- //只判断缩放,其他情况无需修改,不涉及使用缩放阈值
- if (type == ImageShowStatus::BIG) {
- if (m_proportion < 150) {
- resizeKey = Variable::RESIZE_KEY;
- } else if (m_proportion < 300) {
- resizeKey = Variable::RESIZE_KEY_SECOND;
- } else if (m_proportion < 500) {
- resizeKey = Variable::RESIZE_KEY_THIRD;
- } else {
- resizeKey = Variable::RESIZE_KEY_FOURTH;
- }
- } else if (type == ImageShowStatus::SMALL) {
- if (m_proportion <= 150) {
- resizeKey = Variable::RESIZE_KEY;
- } else if (m_proportion <= 300) {
- resizeKey = Variable::RESIZE_KEY_SECOND;
- } else if (m_proportion <= 500) {
- resizeKey = Variable::RESIZE_KEY_THIRD;
- } else {
- resizeKey = Variable::RESIZE_KEY_FOURTH;
- }
- }
-
-
+ resizeKey = Variable::RESIZE_KEY;
int tmpProportion = 0;
switch (type) {
@@ -1010,6 +1150,9 @@ void Core::deleteAlbumItem(const QString &path)
if (path == "") {
return;
}
+ if (m_loadedImage.contains(path)) {
+ m_loadedImage.removeAt(m_loadedImage.indexOf(path));
+ }
for (int i = 1; i < m_albumModel->rowCount(); i++) {
MyStandardItem *item = dynamic_cast(m_albumModel->item(i));
if (item->getPath() == path) {
@@ -1253,6 +1396,13 @@ void Core::cutImage()
QImage image = Processing::pictureCutDeepen(m_origCutImage, m_origCutImage.size());
showImage(QPixmap::fromImage(image));
}
+//裁剪-显示区域-全图裁剪
+void Core::cutFullViableImage()
+{
+ m_cutBeforeStartPosition = QPoint(0, 0);
+ cutRegion(QPoint(m_origCutImage.width(), m_origCutImage.height()));
+ realsePos(QPoint(0, 0));
+}
//裁剪区域
void Core::cutRegion(const QPoint &point)
{
@@ -1343,26 +1493,26 @@ void Core::releaseCutChange(int type, const QPoint &point)
void Core::exitCut()
{
showImage(QPixmap::fromImage(m_origCutImageBefore));
- m_origCutImage = m_origCutImageBefore.copy();
+ m_origCutImage = m_origCutImageBefore;
//状态重置
cutFinishReset();
}
//裁剪后保存
void Core::needSaveCutImage(int proportion)
{
- QString savePath;
QPointF startPosition =
QPointF(static_cast(m_startP.x()) / (static_cast(proportion) * Variable::PERCENTAGE),
static_cast(m_startP.y()) / (Variable::PERCENTAGE * static_cast(proportion)));
QPointF endPosition =
QPointF(static_cast(m_endP.x()) / (static_cast(proportion) * Variable::PERCENTAGE),
static_cast(m_endP.y()) / (static_cast(proportion) * Variable::PERCENTAGE));
+
int imageWidth = endPosition.x() - startPosition.x();
int imageHeight = endPosition.y() - startPosition.y();
// 确定最终裁剪区域
CutRegion cutRegion = cutRegionSelection(startPosition, QSize(imageWidth, imageHeight), m_nowImage);
cv::Mat tempMat =
- m_nowMat(cv::Rect(cutRegion.startPostion.x(), cutRegion.startPostion.y(), cutRegion.width, cutRegion.height))
+ m_cutMat(cv::Rect(cutRegion.startPostion.x(), cutRegion.startPostion.y(), cutRegion.width, cutRegion.height))
.clone();
Q_EMIT cutSaveFinish();
//状态重置
@@ -1614,7 +1764,6 @@ void Core::findAllImageFromDir(QString fullPath)
openImage(filepath);
//不论从什么位置开始都可以加载当前页图片
loadOnChange(fullPath);
-
// loadAlbum(tmpFullPath,m_allImageList);
}
//创建相册model
@@ -1721,6 +1870,29 @@ void Core::getTextFromImage()
Q_EMIT startOcr(m_nowpath);
}
+void Core::qmlCutImageDisplay(QPointF startPos, QSizeF displaySize, double imageScale)
+{
+ m_isCutting = true;
+ //边界修正
+ startPos = qmlBoundaryPos(startPos, m_nowImage.width(), m_nowImage.height());
+ displaySize = qmlBoundarySize(startPos, displaySize);
+ //裁剪图片
+ m_cutMat = m_nowMat(cv::Rect(startPos.x(), startPos.y(), displaySize.width(), displaySize.height())).clone();
+
+ //缩放到显示的大小
+ QPixmap pixmap = Processing::converFormat(m_cutMat);
+ QSizeF tmp(pixmap.size());
+ tmp.setWidth(tmp.width() * imageScale);
+ tmp.setHeight(tmp.height() * imageScale);
+ pixmap = pixmap.scaled(tmp.toSize(), Qt::KeepAspectRatio, Qt::SmoothTransformation);
+
+ //给图片添加蒙层
+ QImage image = Processing::pictureCutDeepen(pixmap.toImage(), pixmap.size());
+ //显示图片
+ showImage(QPixmap::fromImage(image));
+ m_origCutImageBefore = pixmap.toImage();
+}
+
void Core::startSignApp()
{
if (m_monitoredFiles != "") {
@@ -1761,6 +1933,35 @@ void Core::sendOcrResult(QString path, QVector result)
}
}
+QPointF Core::qmlBoundaryPos(QPointF pointf, int xMax, int yMax)
+{
+ if (pointf.x() > xMax) {
+ pointf.setX(xMax);
+ }
+ if (pointf.y() > yMax) {
+ pointf.setY(yMax);
+ }
+ if (pointf.x() < 0) {
+ pointf.setX(0);
+ }
+ if (pointf.y() < 0) {
+ pointf.setY(0);
+ }
+ return pointf;
+}
+
+QSizeF Core::qmlBoundarySize(QPointF pointf, QSizeF displaySize)
+{
+ QSizeF tmpSize = displaySize;
+ if (m_nowImage.width() - pointf.x() - tmpSize.width() < 0) {
+ tmpSize.setWidth(m_nowImage.width() - pointf.x());
+ }
+ if (m_nowImage.height() - pointf.y() - tmpSize.height() < 0) {
+ tmpSize.setHeight(m_nowImage.height() - pointf.y());
+ }
+ return tmpSize;
+}
+
bool Core::coreOperateTooOften()
{
if (m_canProcess->isActive()) {
diff --git a/src/controller/core/core.h b/src/controller/core/core.h
index 9c4fb3f..9345867 100644
--- a/src/controller/core/core.h
+++ b/src/controller/core/core.h
@@ -41,6 +41,8 @@ Q_SIGNALS:
void exitOcrModeSign();
void startOcr(QString path);
+ void getLeftUpPosAccordingImage(QPointF leftUpPos); //返回已经显示的部分相对在图片上的位置
+
public:
Core();
~Core();
@@ -77,6 +79,17 @@ public:
void startSignApp(); //调起画图
void getTextFromImage(); //获取当前打开图片中文字
+
+
+ // qml------------------------------------------
+ void qmlCutImageDisplay(QPointF startPos, QSizeF displaySize, double imageScale); //处理裁剪
+
+ void qmlNavigation(QPointF leftUpPosAccordingShowImage, QSizeF displaySize, double imageScale); //导航器
+ void qmlClickNavigation(QPointF curMousePos = QPointF(-1, -1), bool needChangeDisplayImage = false); //点击导航器
+
+ //裁剪-显示区域全图
+ void cutFullViableImage();
+
private:
void initCore(); //初始化核心
Dbus *m_dbus = nullptr; // DBus模块对象
@@ -127,7 +140,7 @@ private:
OCR m_ocr;
bool m_isCanDel = false; //判断是否可删除,默认为true
- QImage m_origCutImage; //待显示的裁剪的背景图
+ QImage m_origCutImage; //待继续处理和显示的裁剪的图,带灰色蒙层的
QImage m_origCutImageBefore; //待显示的裁剪的背景图-原图
bool m_isCutting = false; //正在裁剪
QPoint m_cutBeforeStartPosition = QPoint(-1, -1); //记录起始点
@@ -162,6 +175,19 @@ private:
void fileChangedNeedUpdated();
QString m_monitoredFiles = "";
void sendOcrResult(QString path, QVector result); // ocr识别完成后,发送出去给前端
+
+ QString m_backImagePath = "";
+
+ QPoint m_imageLeftPos = QPoint(-1, -1);
+
+
+ QPointF qmlBoundaryPos(QPointF pointf, int xMax, int yMax);
+ QSizeF qmlBoundarySize(QPointF pointf, QSizeF displaySize);
+ bool qmlNaviCheckBoundary(QSizeF visibleSize, QPointF curVisiblePartLeftUpPos, double imageScale);
+ void qmlCreatNavigation(QSizeF displaySize);
+ double m_qmlProportion = 0;
+ QPointF m_backHightLight = QPointF(-1, -1);
+ QList m_tiffImageList;
};
#endif // CORE_H
diff --git a/src/controller/core/coreinteraction.cpp b/src/controller/core/coreinteraction.cpp
index 5bd829e..d533074 100644
--- a/src/controller/core/coreinteraction.cpp
+++ b/src/controller/core/coreinteraction.cpp
@@ -88,6 +88,14 @@ void CoreInteraction::initConnect()
connect(m_core, &Core::sendHightlightPos, this, &CoreInteraction::sendHightlightPos); //回传导航栏高亮区域位置
connect(this, &CoreInteraction::coreStartSignImageApp, m_core, &Core::startSignApp); //调起画图
connect(m_core, &Core::exitOcrModeSign, this, &CoreInteraction::exitOcrModeSign); //退出ocr模式
+
+ // qml-------------------------------------
+ connect(this, &CoreInteraction::coreQmlStartCutDisplay, m_core, &Core::qmlCutImageDisplay);
+ connect(this, &CoreInteraction::coreQmlStartNaviDisplay, m_core, &Core::qmlNavigation);
+ connect(this, &CoreInteraction::coreQmlClickNavigation, m_core, &Core::qmlClickNavigation);
+ connect(m_core, &Core::getLeftUpPosAccordingImage, this, &CoreInteraction::getLeftUpPosAccordingImage);
+ //裁剪-显示区域全图
+ connect(this, &CoreInteraction::coreCutFullViableImage, m_core, &Core::cutFullViableImage);
}
bool CoreInteraction::coreOperateTooOften()
@@ -111,7 +119,7 @@ void CoreInteraction::openImage(const QString &path)
kdk::kabase::BuriedPoint buriedPointOpenPicture;
if (buriedPointOpenPicture.functionBuriedPoint(kdk::kabase::AppName::KylinPhotoViewer,
kdk::kabase::BuriedPoint::PT::KylinPhotoViewerOpenPicture)) {
- qCritical() << "buried point fail OpenPicture!";
+ qDebug() << "buried point fail OpenPicture!";
}
}
@@ -433,3 +441,25 @@ void CoreInteraction::startSignImageApp()
}
Q_EMIT coreStartSignImageApp();
}
+
+void CoreInteraction::qmlStartCutDisplay(QPointF startPos, QSizeF displaySize, double imageScale)
+{
+ Q_EMIT coreQmlStartCutDisplay(startPos, displaySize, imageScale);
+}
+
+void CoreInteraction::qmlStartNaviDisplay(QPointF leftUpPosAccordingShowImage, QSizeF displaySize, double imageScale)
+{
+
+ Q_EMIT coreQmlStartNaviDisplay(leftUpPosAccordingShowImage, displaySize, imageScale);
+}
+
+void CoreInteraction::qmlClickNaviDisplay(QPointF curMousePos, bool needChangeDisplayImage)
+{
+
+ Q_EMIT coreQmlClickNavigation(curMousePos, needChangeDisplayImage);
+}
+
+void CoreInteraction::clickCutFullViableImage()
+{
+ Q_EMIT coreCutFullViableImage();
+}
diff --git a/src/controller/core/coreinteraction.h b/src/controller/core/coreinteraction.h
index 4b4c7bb..70eb6c6 100644
--- a/src/controller/core/coreinteraction.h
+++ b/src/controller/core/coreinteraction.h
@@ -37,6 +37,13 @@ Q_SIGNALS:
void coreNeedSaveas(QString path);
void coreReloadImage(QModelIndex modelIndex); //图片加载
void coreStartSignImageApp(); //调起画图信号
+ // qml-----------------------------------------
+ void coreQmlStartCutDisplay(QPointF startPos, QSizeF displaySize, double imageScale); // qml裁剪
+ void coreQmlStartNaviDisplay(QPointF leftUpPosAccordingShowImage, QSizeF displaySize, double imageScale);
+ void coreQmlClickNavigation(QPointF curMousePos, bool needChangeDisplayImage);
+ //裁剪-显示区域全图
+ void coreCutFullViableImage();
+
public:
CoreInteraction();
@@ -78,6 +85,15 @@ protected:
virtual void reloadImage(QModelIndex modelIndex);
virtual void startSignImageApp(); //调起画图软件
+
+ // qml------------------------------------------------------
+ virtual void qmlStartCutDisplay(QPointF startPos, QSizeF displaySize, double imageScale);
+ virtual void qmlStartNaviDisplay(QPointF leftUpPosAccordingShowImage, QSizeF displaySize,
+ double imageScale); //点击裁剪按钮,需要后端处理图片并发送给前端显示
+ virtual void qmlClickNaviDisplay(QPointF curMousePos, bool needChangeDisplayImage); //导航器点击
+ //裁剪-显示区域全图
+ virtual void clickCutFullViableImage();
+
private:
void initConnect(); //初始化绑定
bool coreOperateTooOften(); //操作过于频繁
diff --git a/src/controller/interaction.h b/src/controller/interaction.h
index 94c9b9e..1e088e5 100644
--- a/src/controller/interaction.h
+++ b/src/controller/interaction.h
@@ -167,6 +167,14 @@ Q_SIGNALS:
* 参数描述:传起始位置和终点位置
*/
void exitOcrModeSign();
+ /*
+ * 接口功能:导航栏操作更改图片位置
+ * 接口场景:鼠标悬停在导航栏时,需要便装抓手,回传位置
+ * 接口类型:信号,需要绑定
+ * 参数类型:QPointF
+ * 参数描述:传图片显示的区域在图片上的位置
+ */
+ void getLeftUpPosAccordingImage(QPointF leftUpPos);
public:
/*
@@ -367,7 +375,25 @@ public:
*/
virtual void reloadImage(QModelIndex modelIndex) = 0;
- virtual void startSignImageApp() = 0; //调起画图
+ virtual void startSignImageApp() = 0; //调起画图
+
+
+ // qml-----------------------------------
+ virtual void qmlStartCutDisplay(QPointF startPos, QSizeF displaySize,
+ double imageScale) = 0; //点击裁剪按钮,需要后端处理图片并发送给前端显示
+ virtual void qmlStartNaviDisplay(QPointF leftUpPosAccordingShowImage, QSizeF displaySize,
+ double imageScale) = 0; //点击裁剪按钮,需要后端处理图片并发送给前端显示
+ virtual void qmlClickNaviDisplay(QPointF curMousePos,
+ bool needChangeDisplayImage) = 0; //点击裁剪按钮,需要后端处理图片并发送给前端显示
+ //添加裁剪点击-裁剪显示区域内全图功能
+ /*
+ * 接口功能:触发-裁剪点击-裁剪显示区域内全图
+ * 接口场景:点击裁剪区域
+ * 接口类型:函数,直接调用
+ * 参数类型:无
+ * 参数描述:无
+ */
+ virtual void clickCutFullViableImage() = 0;
private:
static Interaction *m_interaction; //单例指针
diff --git a/src/global/variable.cpp b/src/global/variable.cpp
index 0cda7bb..291b1d8 100644
--- a/src/global/variable.cpp
+++ b/src/global/variable.cpp
@@ -62,7 +62,7 @@ const QString Variable::SUPPORT_FORMATS_CLASSIFY = "(*.jpg *.jpe *.jpeg);;"
const QString Variable::SUPPORT_FORMATS_SAVEAS = "PNG(*.png);;JPE(*.jpe);;JPEG(*.jpeg);;"
"JPG(*.jpg);;"
"ICO(*.ico);;"
- "WEBP(*.webp);;BMP(*.bmp);;DIB(*.dib);;"
+ "WEBP(*.webp);;BMP(*.bmp);;"
"PSD(*.psd);;"
"JNG(*.jng);;"
"XPM(*.xpm);;TIFF(*.tiff);;TIF(*.tif);;J2K(*.j2k);;JP2(*.jp2)";
@@ -90,7 +90,7 @@ const int Variable::RESIZE_KEY = 10; //每次放大缩小的
const int Variable::RESIZE_KEY_SECOND = 25; //每次放大缩小的值-150-300
const int Variable::RESIZE_KEY_THIRD = 50; //每次放大缩小的值-300-500
const int Variable::RESIZE_KEY_FOURTH = 100; //每次放大缩小的值-500-1000
-const int Variable::RESIZE_KEY_MAX = 1000; //能够放大的最大值
+const int Variable::RESIZE_KEY_MAX = 10000; //能够放大的最大值
const int Variable::RESIZE_KEY_MIN = 5; //能够缩小的最小值
const int Variable::RESIZE_SPEED = 15; //缩放速度
const int Variable::DEFAULT_MOVIE_TIME_INTERVAL = 100; //默认动图时间间隔
@@ -103,6 +103,7 @@ QStringList Variable::g_damagedImage; //损坏图片路径
const QString Variable::DAMAGED_IMAGE_BLACK = QString(":/res/res/damaged_imgB.png");
const QString Variable::DAMAGED_IMAGE_WHITE = QString(":/res/res/damaged_img.png");
DisplayMode displayMode = DisplayMode::NormalMode;
+OperayteMode operayteMode = OperayteMode::NoOperate;
const double Variable::PERCENTAGE = 0.01; //百分比转换
QString Variable::startAppName = "";
QStringList Variable::startAppNameList = {"kylin-gallery"};
diff --git a/src/global/variable.h b/src/global/variable.h
index 3bdf268..9c8b3d6 100644
--- a/src/global/variable.h
+++ b/src/global/variable.h
@@ -34,6 +34,7 @@ struct ImageAndInfo
QPointF actualClickPos; //实际点击坐标
QPointF actualPos; //实际坐标
bool movieImage; //是否是动图
+ QList imageList; //图片的image集合--目前只需要对tiff这样做
};
struct cutBoxColor
{
@@ -51,6 +52,25 @@ enum class DisplayMode : int {
};
extern DisplayMode displayMode;
+enum class OperayteMode : int {
+ NormalMode = 0,
+ ZoomIn = 1, //放大
+ ZoomOut = 2, //缩小
+ RotateN = 3, //逆时针旋转
+ RotateS = 4, //顺时针旋转
+ FlipH = 5, //水平
+ FlipV = 6, //垂直
+ Window = 7, //适应窗口
+ LifeSize = 8, //原始尺寸
+ Ocr = 9, // ocr
+ Cut = 10, //裁剪
+ NoOperate = 11, //无操作
+ ChangeImage = 12, //切图
+ ExitCut = 13, //退出裁剪
+ ExitOcr = 14, //退出裁剪
+};
+extern OperayteMode operayteMode;
+
struct CutRegion
{
QPointF startPostion; //起点
diff --git a/src/main.cpp b/src/main.cpp
index 63fe3ec..e51b7e1 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -31,7 +31,7 @@ int main(int argc, char *argv[])
qInstallMessageHandler(::kabase::KabaseLog::logOutput);
QApplication a(argc, argv);
qApp->setWindowIcon(QIcon::fromTheme("kylin-photo-viewer", QIcon(":/res/res/kyview_logo.png")));
- QLoggingCategory::setFilterRules(QStringLiteral("qt.qml.binding.removal.info=true"));
+ // QLoggingCategory::setFilterRules(QStringLiteral("qt.qml.binding.removal.info=true"));
//翻译
QTranslator app_trans;
diff --git a/src/model/processing/processing.cpp b/src/model/processing/processing.cpp
index 960833e..b48fae6 100644
--- a/src/model/processing/processing.cpp
+++ b/src/model/processing/processing.cpp
@@ -41,7 +41,6 @@ QPixmap Processing::localAmplification(const QPixmap &orgPix, QSize showSize, QP
QPixmap localPix = orgPix.copy(locaPoint.rx(), locaPoint.ry(), locaSize.width(), locaSize.height());
return Processing::resizePix(localPix, widSize);
- ;
}
//绘制框选区域
QImage Processing::pictureRelease(const QImage &img, const QImage &originImage)
@@ -81,7 +80,7 @@ QImage Processing::pictureRelease(const QImage &img, const QImage &originImage)
colorRight.setBlue(Variable::DEFAULT_WHITE_COLOR);
image.setPixel(m_regionEndP.x(), k, colorRight.rgb());
}
- QList cutSquare = releaseSquare(m_regionStartP, m_regionEndP);
+ QList cutSquare = releaseSquare(m_regionStartP, m_regionEndP, img);
if (cutSquare.length() > 0) {
//遍历列表,改变图层颜色
for (int i = 0; i < cutSquare.length(); i++) {
@@ -614,37 +613,93 @@ void Processing::regionBoundry(const QPoint &startP, const QPoint &changeP)
}
//记录8个边角
-QList Processing::releaseSquare(const QPoint &startP, const QPoint &endP)
+QList Processing::releaseSquare(const QPoint &startP, const QPoint &endP, const QImage &img)
{
QList m_squarePoint; //每一个的方框
QPoint startPoint = startP;
QPoint endPoint = endP;
- // 4个角角
+ // 8个角
cutBoxColor colorSquare1;
- colorSquare1.startPostion = QPoint(startPoint.x() - 4, startPoint.y() - 4);
- colorSquare1.endPostion = QPoint(startPoint.x() + 4, startPoint.y() + 4);
+ QPoint leftUpStart;
+ QPoint leftUpEnd;
+ leftUpStart.setX(rectBoundaryJudg(startPoint.x() - 4, 0, true));
+ leftUpStart.setY(rectBoundaryJudg(startPoint.y() - 4, 0, true));
+ leftUpEnd.setX(leftUpStart.x() + 8);
+ leftUpEnd.setY(leftUpStart.y() + 8);
+ colorSquare1.startPostion = leftUpStart;
+ colorSquare1.endPostion = leftUpEnd;
+
cutBoxColor colorSquare2;
- colorSquare2.startPostion = QPoint(endPoint.x() - 4, endPoint.y() - 4);
- colorSquare2.endPostion = QPoint(endPoint.x() + 4, endPoint.y() + 4);
+ QPoint rightBottomStart;
+ QPoint rightBottomEnd;
+ rightBottomEnd.setX(rectBoundaryJudg(endPoint.x() + 4, img.width(), false));
+ rightBottomEnd.setY(rectBoundaryJudg(endPoint.y() + 4, img.height(), false));
+ rightBottomStart.setX(rightBottomEnd.x() - 8);
+ rightBottomStart.setY(rightBottomEnd.y() - 8);
+ colorSquare2.startPostion = rightBottomStart;
+ colorSquare2.endPostion = rightBottomEnd;
+
cutBoxColor colorSquare3;
- colorSquare3.startPostion = QPoint(startPoint.x() - 4, endPoint.y() - 4);
- colorSquare3.endPostion = QPoint(startPoint.x() + 4, endPoint.y() + 4);
+ QPoint leftBottomStart;
+ QPoint leftBottomEnd;
+ leftBottomStart.setX(rectBoundaryJudg(startPoint.x() - 4, 0, true));
+ leftBottomEnd.setY(rectBoundaryJudg(endPoint.y() + 4, img.height(), false));
+ leftBottomEnd.setX(leftBottomStart.x() + 8);
+ leftBottomStart.setY(leftBottomEnd.y() - 8);
+ colorSquare3.startPostion = leftBottomStart;
+ colorSquare3.endPostion = leftBottomEnd;
+
cutBoxColor colorSquare4;
- colorSquare4.startPostion = QPoint(endPoint.x() - 4, startPoint.y() - 4);
- colorSquare4.endPostion = QPoint(endPoint.x() + 4, startPoint.y() + 4);
+ QPoint rightUpStart;
+ QPoint rightUpEnd;
+ rightUpEnd.setX(rectBoundaryJudg(endPoint.x() + 4, img.width(), false));
+ rightUpStart.setY(rectBoundaryJudg(startPoint.y() - 4, 0, true));
+ rightUpStart.setX(rightUpEnd.x() - 8);
+ rightUpEnd.setY(rightUpStart.y() + 8);
+ colorSquare4.startPostion = rightUpStart;
+ colorSquare4.endPostion = rightUpEnd;
+
cutBoxColor colorSquare5;
- colorSquare5.startPostion = QPoint((endPoint.x() + startPoint.x()) / 2 - 4, startPoint.y() - 4);
- colorSquare5.endPostion = QPoint((endPoint.x() + startPoint.x()) / 2 + 4, startPoint.y() + 4);
+ QPoint upMiddleStart;
+ QPoint upMiddleEnd;
+
+ upMiddleStart.setY(rectBoundaryJudg(startPoint.y() - 4, 0, true));
+ upMiddleEnd.setY(upMiddleStart.y() + 8);
+ upMiddleStart.setX((endPoint.x() + startPoint.x()) / 2 - 4);
+ upMiddleEnd.setX((endPoint.x() + startPoint.x()) / 2 + 4);
+ colorSquare5.startPostion = upMiddleStart;
+ colorSquare5.endPostion = upMiddleEnd;
+
cutBoxColor colorSquare6;
- colorSquare6.startPostion = QPoint((endPoint.x() + startPoint.x()) / 2 - 4, endPoint.y() - 4);
- colorSquare6.endPostion = QPoint((endPoint.x() + startPoint.x()) / 2 + 4, endPoint.y() + 4);
+ QPoint bottomMiddleStart;
+ QPoint bottomMiddleEnd;
+ bottomMiddleEnd.setY(rectBoundaryJudg(endPoint.y() + 4, img.height(), false));
+ bottomMiddleStart.setY(bottomMiddleEnd.y() - 8);
+ bottomMiddleStart.setX((endPoint.x() + startPoint.x()) / 2 - 4);
+ bottomMiddleEnd.setX((endPoint.x() + startPoint.x()) / 2 + 4);
+ colorSquare6.startPostion = bottomMiddleStart;
+ colorSquare6.endPostion = bottomMiddleEnd;
+
cutBoxColor colorSquare7;
- colorSquare7.startPostion = QPoint(startPoint.x() - 4, (endPoint.y() + startPoint.y()) / 2 - 4);
- colorSquare7.endPostion = QPoint(startP.x() + 4, (endPoint.y() + startPoint.y()) / 2 + 4);
+ QPoint leftMiddleStart;
+ QPoint leftMiddleEnd;
+ leftMiddleStart.setX(rectBoundaryJudg(startPoint.x() - 4, 0, true));
+ leftMiddleEnd.setX(leftMiddleStart.x() + 8);
+ leftMiddleStart.setY((endPoint.y() + startPoint.y()) / 2 - 4);
+ leftMiddleEnd.setY((endPoint.y() + startPoint.y()) / 2 + 4);
+ colorSquare7.startPostion = leftMiddleStart;
+ colorSquare7.endPostion = leftMiddleEnd;
+
cutBoxColor colorSquare8;
- colorSquare8.startPostion = QPoint(endPoint.x() - 4, (endPoint.y() + startPoint.y()) / 2 - 4);
- colorSquare8.endPostion = QPoint(endPoint.x() + 4, (endPoint.y() + startPoint.y()) / 2 + 4);
+ QPoint rightMiddleStart;
+ QPoint rightMiddleEnd;
+ rightMiddleEnd.setX(rectBoundaryJudg(endPoint.x() + 4, img.width(), false));
+ rightMiddleStart.setX(rightMiddleEnd.x() - 8);
+ rightMiddleStart.setY((endPoint.y() + startPoint.y()) / 2 - 4);
+ rightMiddleEnd.setY((endPoint.y() + startPoint.y()) / 2 + 4);
+ colorSquare8.startPostion = rightMiddleStart;
+ colorSquare8.endPostion = rightMiddleEnd;
m_squarePoint.append(colorSquare1);
m_squarePoint.append(colorSquare2);
@@ -904,6 +959,21 @@ int Processing::boundaryJudg(int max, int point)
return point;
}
+int Processing::rectBoundaryJudg(int contrast, int target, bool isNeedMin)
+{
+ int tmp = contrast;
+ if (isNeedMin) {
+ if (tmp < target) {
+ tmp = 0;
+ }
+ } else {
+ if (tmp > target) {
+ tmp = target;
+ }
+ }
+ return tmp;
+}
+
int Processing::minNumIsZero(const int &num1, const int &num2)
{
int num = num1 - num2;
diff --git a/src/model/processing/processing.h b/src/model/processing/processing.h
index 4fd1c53..e6f45f0 100644
--- a/src/model/processing/processing.h
+++ b/src/model/processing/processing.h
@@ -50,14 +50,15 @@ private:
static void regionBoundry(const QPoint &startP, const QPoint &changeP); //计算框选区域
// static void regionBoundryAgian( QPoint &startP, QPoint &changeP, QPoint
// &endP);//计算框选区域-释放后在释放的情况
- static QList releaseSquare(const QPoint &startP,
- const QPoint &endP); //计算框选区域释放时的8个小方块的起始点和终点
+ static QList releaseSquare(const QPoint &startP, const QPoint &endP,
+ const QImage &img); //计算框选区域释放时的8个小方块的起始点和终点
static QList pictureCutPainter(const QImage &img, int type, int backtype, const QPoint &startP,
QPoint &endP, QPoint &changeP,
QPoint &backChangeP); //裁剪后-对图片进行改变
static QList pictureCutMove(const QImage &img, const QPoint &startCutP, const QPoint &endCutP,
int xOffset, int yOffset); //移动鼠标释放的裁剪框
static inline int boundaryJudg(int max, int point); //边界处理
+ static int rectBoundaryJudg(int contrast, int target, bool isNeedMin);
};
#endif // PROCESSING_H
diff --git a/src/src.pro b/src/src.pro
index dc886cd..f753c5b 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -3,25 +3,29 @@ include (../codec/plugins/OCR/OCR.pri)
QT += core gui
QT += svg
QT += dbus quickcontrols2
-QT += x11extras KWindowSystem printsupport network quick quickwidgets
+QT += x11extras KWindowSystem printsupport network quick quickwidgets sql
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += no_keywords
+CONFIG += link_pkgconfig
+#这个是QT内嵌的版本号关键字,只能使用a.b.c.d纯数字形式,与changelog中的版本号不完全一致
+VERSION = 1.3.0.3
+DEFINES += APP_VERSION=\\\"$$VERSION\\\"
+##定义一个字符串,可以将版本号数字之后的部分添加进去
+DEFINES += APP_VERSION_DETAIL=\\\"$$VERSION-ok5\\\"
+
+QMAKE_CXXFLAGS += -g
#INCLUDEPATH += \
#/usr/include/glib-2.0/ \
#/usr/lib/x86_64-linux-gnu/glib-2.0/include/ \
-CONFIG += link_pkgconfig
+
PKGCONFIG += gio-unix-2.0
LIBS += -lpeony \
LIBS += -lX11
#适配sdk
-PKGCONFIG += kysdk-qtwidgets
-PKGCONFIG += kysdk-waylandhelper
-PKGCONFIG += kysdk-log
-#kysdk
-PKGCONFIG += kysdk-kabase
-LIBS += -L/usr/lib/kysdk/kysdk-base -lkylog -lkyconf
+PKGCONFIG += kysdk-qtwidgets kysdk-waylandhelper kysdk-log kysdk-config kysdk-utils kysdk-kabase
+
#sdk不一样的版本路径有更改
INCLUDEPATH += /usr/include/kabase/
INCLUDEPATH += /usr/include/kysdk/applications/kabase/kylin_system/
diff --git a/src/view/cutwidget.cpp b/src/view/cutwidget.cpp
index d6f8c37..73a158b 100644
--- a/src/view/cutwidget.cpp
+++ b/src/view/cutwidget.cpp
@@ -89,6 +89,8 @@ void CutWIdget::mouseReleaseEvent(QMouseEvent *event)
Q_EMIT showBtnWid(true);
} else {
//其他-暂不处理,需要时可进行处理
+ Interaction::getInstance()->clickCutFullViableImage();
+ Q_EMIT showBtnWid(true);
}
m_startEnterPoint = QPoint(-1, -1);
m_cutEnterPos = QPoint(-1, -1);
diff --git a/src/view/information.cpp b/src/view/information.cpp
index 446f5d3..176497d 100644
--- a/src/view/information.cpp
+++ b/src/view/information.cpp
@@ -1,5 +1,6 @@
#include "information.h"
#include "sizedate.h"
+#include "kyutils.h"
Information::Information(QWidget *parent) : QWidget(parent)
{
if (m_local.system().name() == "en_US") {
@@ -51,9 +52,9 @@ Information::Information(QWidget *parent) : QWidget(parent)
// colorSpace->setText(tr("颜色空间"));
// m_colorSpace->setFont(m_ftContent);
- m_creationTime = new QLabel(this);
- m_creationTime->setAttribute(Qt::WA_TranslucentBackground);
- m_creationTime->setText(tr("Created"));
+ // m_creationTime = new QLabel(this);
+ // m_creationTime->setAttribute(Qt::WA_TranslucentBackground);
+ // m_creationTime->setText(tr("Created"));
// creationTime->setText(tr("创建时间"));
// m_creationTime->setFont(m_ftContent);
@@ -84,8 +85,8 @@ Information::Information(QWidget *parent) : QWidget(parent)
m_colorSpaceC->setAttribute(Qt::WA_TranslucentBackground);
// m_colorSpaceC->setFont(m_ftContent);
- m_creationTimeC = new QLabel(this);
- m_creationTimeC->setAttribute(Qt::WA_TranslucentBackground);
+ // m_creationTimeC = new QLabel(this);
+ // m_creationTimeC->setAttribute(Qt::WA_TranslucentBackground);
// m_creationTimeC->setFont(m_ftContent);
m_revisionTimeC = new QLabel(this);
@@ -99,17 +100,29 @@ Information::Information(QWidget *parent) : QWidget(parent)
void Information::contentText(QFileInfo info, QString sizeImage, QString spaceColor)
{
QString imageSize;
+
+ QString size = QString::number(info.size());
+ char sdkSize[1024];
+
if (float(info.size()) / 1024 >= 1024) {
- QString Size = QString("%1").arg(QString::asprintf("%.1f", float(info.size()) / 1024 / 1024));
- imageSize = Size + "MB";
+ if (kdkVolumeBaseCharacterConvert(size.toLocal8Bit().data(), KDK_MEGABYTE, sdkSize) != 0) {
+ QString Size = QString("%1").arg(QString::asprintf("%.1f", float(info.size()) / 1024 / 1024));
+ imageSize = Size + "MB";
+ } else {
+ imageSize = QString::fromUtf8(sdkSize);
+ }
} else {
- QString Size = QString("%1").arg(QString::asprintf("%.1f", float(info.size()) / 1024));
- imageSize = Size + "KB";
+ if (kdkVolumeBaseCharacterConvert(size.toLocal8Bit().data(), KDK_KILOBYTE, sdkSize) != 0) {
+ QString Size = QString("%1").arg(QString::asprintf("%.1f", float(info.size()) / 1024));
+ imageSize = Size + "KB";
+ } else {
+ imageSize = QString::fromUtf8(sdkSize);
+ }
}
if (sizeImage == "-") {
imageSize = "0.0KB";
}
- m_creationTimeC->setText(info.birthTime().toString("yyyy.MM.dd hh:mm"));
+ // m_creationTimeC->setText(info.birthTime().toString("yyyy.MM.dd hh:mm"));
m_revisionTimeC->setText(info.lastModified().toString("yyyy.MM.dd hh:mm"));
QString nameContant = AutoFeed(info.completeBaseName());
m_nameC->setText(nameContant);
@@ -147,10 +160,10 @@ void Information::layoutS(int line)
m_gdLayout->addWidget(m_pixelSizeC, 4 + line, 3, 1, 4);
m_gdLayout->addWidget(m_colorSpace, 5 + line, 0, 1, 2);
m_gdLayout->addWidget(m_colorSpaceC, 5 + line, 3, 1, 4);
- m_gdLayout->addWidget(m_creationTime, 6 + line, 0, 1, 2);
- m_gdLayout->addWidget(m_creationTimeC, 6 + line, 3, 1, 4);
- m_gdLayout->addWidget(m_revisionTime, 7 + line, 0, 1, 2);
- m_gdLayout->addWidget(m_revisionTimeC, 7 + line, 3, 1, 4);
+ // m_gdLayout->addWidget(m_creationTime, 6 + line, 0, 1, 2);
+ // m_gdLayout->addWidget(m_creationTimeC, 6 + line, 3, 1, 4);
+ m_gdLayout->addWidget(m_revisionTime, 6 + line, 0, 1, 2);
+ m_gdLayout->addWidget(m_revisionTimeC, 6 + line, 3, 1, 4);
m_gdLayout->setContentsMargins(12, 10 - line * 3, 10, 16 - line * 3);
m_inforWid->setLayout(m_gdLayout);
m_inforWid->resize(this->width(), this->height());
@@ -224,8 +237,8 @@ void Information::changeEverySize(double fontSize, double detio, QSize sizeWid)
m_pixelSizeC->setFont(font);
m_colorSpace->setFont(font);
m_colorSpaceC->setFont(font);
- m_creationTime->setFont(font);
- m_creationTimeC->setFont(font);
+ // m_creationTime->setFont(font);
+ // m_creationTimeC->setFont(font);
m_revisionTime->setFont(font);
m_revisionTimeC->setFont(font);
m_inforWid->resize(sizeWid * detio);
diff --git a/src/view/information.h b/src/view/information.h
index 23884ae..7dd41c6 100644
--- a/src/view/information.h
+++ b/src/view/information.h
@@ -26,7 +26,7 @@ private:
QLabel *m_storageSize; //存储大小
QLabel *m_pixelSize; //像素尺寸
QLabel *m_colorSpace; //颜色空间
- QLabel *m_creationTime; //创建时间
+ // QLabel *m_creationTime; //创建时间
QLabel *m_revisionTime; //修改时间
QLabel *m_nameC; //名称内容
@@ -34,7 +34,7 @@ private:
QLabel *m_storageSizeC; //存储大小内容
QLabel *m_pixelSizeC; //像素尺寸内容
QLabel *m_colorSpaceC; //颜色空间内容
- QLabel *m_creationTimeC; //创建时间内容
+ // QLabel *m_creationTimeC; //创建时间内容
QLabel *m_revisionTimeC; //修改时间内容
QWidget *m_inforWid;
diff --git a/src/view/kyview.cpp b/src/view/kyview.cpp
index 7d4889e..87a1a06 100644
--- a/src/view/kyview.cpp
+++ b/src/view/kyview.cpp
@@ -22,7 +22,12 @@ KyView::KyView(const QStringList &args)
hOrVMode = new HorizontalOrVerticalMode;
//标题栏
m_titlebar = new TitleBar(this);
+
hLayoutFlag = hOrVMode->defaultModeCapture();
+ if (hLayoutFlag != deviceMode::PCMode) {
+ m_isPcModeStarted = false;
+ }
+
this->setWindowSize();
this->setTitleBtnHide();
connect(hOrVMode, &HorizontalOrVerticalMode::RotationSig, this, &KyView::slotIntelHVModeChanged);
@@ -47,10 +52,11 @@ KyView::KyView(const QStringList &args)
m_openImage->move(int((this->width() - m_openImage->width()) / 2),
int((this->height() - m_openImage->height()) / 2));
+ m_openImage->hide();
//工具栏
m_toolbar = new ToolBar(this);
m_toolbar->move(int((this->width() - m_toolbar->width()) / 2), this->height() - m_toolbar->height() + 4 - 10);
- m_toolbar->show();
+ m_toolbar->hide();
//设置置顶
m_titlebar->setAttribute(Qt::WA_AlwaysStackOnTop);
//图片展示界面
@@ -115,7 +121,14 @@ KyView::~KyView()
void KyView::slotIntelHVModeChanged(deviceMode sig)
{
hLayoutFlag = hOrVMode->defaultModeCapture();
- this->setWindowSize();
+ if (hLayoutFlag == PADHorizontalMode) {
+ m_isResponseDbClick = false;
+ } else if (hLayoutFlag == PADVerticalMode) {
+ m_isResponseDbClick = false;
+ } else {
+ m_isResponseDbClick = true;
+ }
+
this->setTitleBtnHide();
}
@@ -150,9 +163,6 @@ void KyView::initconnect()
connect(m_showImageWidget, &ShowImageWidget::titleName, m_titlebar, &TitleBar::showImageName);
//清空相册时,展示的界面
connect(m_showImageWidget, &ShowImageWidget::clearImage, this, &KyView::clearImage);
- //滚轮放大和缩小
- connect(m_showImageWidget, &ShowImageWidget::reduceChange, m_toolbar, &ToolBar::reduceImage);
- connect(m_showImageWidget, &ShowImageWidget::enlargeChange, m_toolbar, &ToolBar::enlargeImage);
//当图片大于2张及以上,默认展示相册---先保留
// connect(m_showImageWidget,&ShowImageWidget::toShowSide,this,&KyView::defaultSidebar);
//相册尺寸改变,位置改变
@@ -203,6 +213,14 @@ void KyView::initconnect()
connect(m_showImageWidget, &ShowImageWidget::startWayToSetTitleStyle, m_titlebar, &TitleBar::setLeftUpBtnStyle);
connect(m_titlebar, &TitleBar::updateImageWidName, m_showImageWidget, &ShowImageWidget::updateImagePath);
connect(m_showImageWidget, &ShowImageWidget::sendSuffixToToolbar, m_toolbar, &ToolBar::getSuffix);
+ connect(m_showImageWidget, &ShowImageWidget::decideMainWidDisplay, this, &KyView::setWidDisplay);
+ connect(m_toolbar, &ToolBar::startZoomImage, m_showImageWidget, &ShowImageWidget::operatyImage);
+ connect(m_showImageWidget, &ShowImageWidget::toCloseNavigator, m_navigator, &Navigator::showNavigation);
+ connect(m_navigator, &Navigator::needUpdateImagePosFromMainWid, m_showImageWidget,
+ &ShowImageWidget::needUpdateImagePosFromMainWid);
+ connect(m_navigator, &Navigator::needUpdateQmlImagePos, m_showImageWidget,
+ &ShowImageWidget::noticeQmlAdjustImagePos);
+ connect(m_showImageWidget, &ShowImageWidget::doubleEventToMainWid, this, &KyView::dealMouseDouble);
}
//打开首先检测是否需要展示工具栏
void KyView::openState()
@@ -480,6 +498,13 @@ void KyView::exitOCRMode()
{
displayMode = DisplayMode::NormalMode;
}
+
+void KyView::setWidDisplay(bool isDefaultDisplay)
+{
+ m_openImage->setVisible(isDefaultDisplay);
+ m_showImageWidget->setVisible(!isDefaultDisplay);
+ m_toolbar->setVisible(!isDefaultDisplay);
+}
//处理鼠标悬浮两栏的界面展示
void KyView::hoverChange(int y)
{
@@ -691,14 +716,12 @@ void KyView::avoidChange()
//最大化和还原
void KyView::changOrigSize()
{
- if (this->isMaximized()) {
+ if (windowState() == Qt::WindowMaximized) {
this->showNormal();
- m_titlebar->g_fullscreen->setIcon(QIcon::fromTheme("window-maximize-symbolic")); //主题库的全屏图标
- m_titlebar->g_fullscreen->setToolTip(tr("full srceen"));
- } else {
+ } else if (windowState() == Qt::WindowNoState) {
this->showMaximized();
- m_titlebar->g_fullscreen->setIcon(QIcon::fromTheme("window-restore-symbolic")); //主题库的恢复图标
- m_titlebar->g_fullscreen->setToolTip(tr("recovery"));
+ } else if (windowState() == Qt::WindowFullScreen) {
+ KWindowSystem::clearState(winId(), NET::FullScreen);
}
m_titlebar->dealEditState();
}
@@ -924,6 +947,18 @@ void KyView::keyPressEvent(QKeyEvent *event)
this->fullScreen();
}
}
+ //全屏
+ if (displayMode == DisplayMode::NormalMode) {
+ if (event->key() == Qt::Key_Escape) {
+ if (this->isFullScreen()) {
+ this->showNormal();
+ if (m_titlebar != nullptr) {
+ m_titlebar->g_fullscreen->setIcon(QIcon::fromTheme("window-maximize-symbolic")); //主题库的全屏图标
+ m_titlebar->g_fullscreen->setToolTip(tr("full srceen"));
+ }
+ }
+ }
+ }
//上一张,下一张,delete按键响应
if (!m_openImage->isHidden()) {
return;
@@ -969,55 +1004,12 @@ void KyView::mouseDoubleClickEvent(QMouseEvent *event)
if (event->button() != Qt::LeftButton) {
return;
}
- //在标题栏的图片名字处双击不响应全屏或恢复
- if (m_titlebar->g_imageName->geometry().contains(this->mapFromGlobal(QCursor::pos())) && m_isLeave == true) {
- //有问题--后续需要更改
- if (m_titlebar->g_imageName->x() != 0) {
- return;
- }
- }
- if (displayMode != DisplayMode::NormalMode) {
- return;
- }
- if (!m_isResponseDbClick) {
- return;
- }
- if (!m_titlebar->geometry().contains(this->mapFromGlobal(QCursor::pos()))
- && !m_toolbar->geometry().contains(this->mapFromGlobal(QCursor::pos()))) {
- //在信息栏处双击不响应全屏
- if (!m_information->isHidden() && (m_information->geometry().contains(this->mapFromGlobal(QCursor::pos())))) {
- return;
- }
- //在导航栏处双击不响应全屏
- if (!m_navigator->isHidden() && (m_navigator->geometry().contains(this->mapFromGlobal(QCursor::pos())))) {
- return;
- }
- if (this->isFullScreen()) {
- KWindowSystem::clearState(winId(), NET::FullScreen);
-
- } else {
- KWindowSystem::setState(winId(), NET::FullScreen);
- }
-
- } else if (m_titlebar->geometry().contains(this->mapFromGlobal(QCursor::pos()))) {
- if (this->isMaximized()) {
- this->showNormal();
- m_titlebar->g_fullscreen->setIcon(QIcon::fromTheme("window-maximize-symbolic")); //主题库的全屏图标
- m_titlebar->g_fullscreen->setToolTip(tr("full srceen"));
- } else if (this->isFullScreen()) {
- return;
- } else {
- this->showMaximized();
- m_titlebar->g_fullscreen->setIcon(QIcon::fromTheme("window-restore-symbolic")); //主题库的恢复图标
- m_titlebar->g_fullscreen->setToolTip(tr("recovery"));
- }
- }
+ this->dealMouseDouble();
}
//检测鼠标在信息栏上方进入,顶栏和工具栏要展示
bool KyView::eventFilter(QObject *obj, QEvent *event)
{
if (obj == m_information) {
-
//如果信息栏show并且,鼠标在信息栏上
if (!m_information->isHidden() && m_information->geometry().contains(this->mapFromGlobal(QCursor::pos()))) {
int infor_y = m_information->mapFromGlobal(QCursor().pos()).y();
@@ -1092,16 +1084,57 @@ void KyView::dropEvent(QDropEvent *event)
m_showImageWidget->openImage(path);
}
+void KyView::dealMouseDouble()
+{
+ //在标题栏的图片名字处双击不响应全屏或恢复
+ if (m_titlebar->g_imageName->geometry().contains(this->mapFromGlobal(QCursor::pos())) && m_isLeave == true) {
+ //有问题--后续需要更改
+ if (m_titlebar->g_imageName->x() != 0) {
+ return;
+ }
+ }
+ if (displayMode != DisplayMode::NormalMode) {
+ return;
+ }
+ if (!m_isResponseDbClick) {
+ return;
+ }
+ if (!m_titlebar->geometry().contains(this->mapFromGlobal(QCursor::pos()))
+ && !m_toolbar->geometry().contains(this->mapFromGlobal(QCursor::pos()))) {
+ //在信息栏处双击不响应全屏
+ if (!m_information->isHidden() && (m_information->geometry().contains(this->mapFromGlobal(QCursor::pos())))) {
+ return;
+ }
+ //在导航栏处双击不响应全屏
+ if (!m_navigator->isHidden() && (m_navigator->geometry().contains(this->mapFromGlobal(QCursor::pos())))) {
+ return;
+ }
+ if (this->isFullScreen()) {
+ KWindowSystem::clearState(winId(), NET::FullScreen);
+
+ } else {
+ KWindowSystem::setState(winId(), NET::FullScreen);
+ }
+
+ } else if (m_titlebar->geometry().contains(this->mapFromGlobal(QCursor::pos()))) {
+ if (this->isMaximized()) {
+ this->showNormal();
+ m_titlebar->g_fullscreen->setIcon(QIcon::fromTheme("window-maximize-symbolic")); //主题库的全屏图标
+ m_titlebar->g_fullscreen->setToolTip(tr("full srceen"));
+ } else if (this->isFullScreen()) {
+ return;
+ } else {
+ this->showMaximized();
+ m_titlebar->g_fullscreen->setIcon(QIcon::fromTheme("window-restore-symbolic")); //主题库的恢复图标
+ m_titlebar->g_fullscreen->setToolTip(tr("recovery"));
+ }
+ }
+}
+
void KyView::initGrabGesture()
{
-
//手势需要关闭主题事件
this->setProperty("useStyleWindowManager", false);
- // 注册手势
- this->setAttribute(Qt::WA_AcceptTouchEvents);
- this->grabGesture(Qt::PinchGesture); //捏手势。
- this->grabGesture(Qt::TapAndHoldGesture); //长按手势
- QTapAndHoldGesture::setTimeout(1); //按下n毫秒判定为长按
}
bool KyView::event(QEvent *event)
{
@@ -1111,9 +1144,11 @@ bool KyView::event(QEvent *event)
}
//判断列表中是否只有一张图,一张图片左右按钮不显示--解决静止鼠标,按钮仍然显示的问题
if (m_openImage != nullptr && m_openImage->isHidden()) {
- if (m_showImageWidget->g_buttonState == false) {
- this->m_showImageWidget->g_next->hide();
- this->m_showImageWidget->g_back->hide();
+ if (m_showImageWidget != nullptr) {
+ if (m_showImageWidget->g_buttonState == false) {
+ this->m_showImageWidget->g_next->hide();
+ this->m_showImageWidget->g_back->hide();
+ }
}
}
//解决点击下拉菜单出现,鼠标移出窗体,点击窗体外部,两秒后两栏未隐藏的问题。
@@ -1126,10 +1161,9 @@ bool KyView::event(QEvent *event)
}
avoidChange();
//手势处理
- if (event->type() == QEvent::GestureOverride || event->type() == QEvent::Gesture) {
- return gestureEvent(event);
- }
-
+ // if (event->type() == QEvent::GestureOverride || event->type() == QEvent::Gesture) {
+ // return gestureEvent(event);
+ // }
//使用X11接管窗口移动事件后,鼠标离开事件不触发,此处作为备用方案
if (m_mousePress) {
if (event->type() == QEvent::Move) {
@@ -1138,27 +1172,6 @@ bool KyView::event(QEvent *event)
x11EventEnd();
}
}
- if (m_panTriggered) {
- if (event->type() == QEvent::MouseButtonRelease) {
- m_panTriggered = false;
- //如果本次点击出发了旋转或缩放,不处理
- if (m_touchPoint.rx() == -1) {
- return QWidget::event(event);
- }
- QMouseEvent *eve = static_cast(event);
- int distance = eve->globalPos().rx() - m_touchPoint.rx();
- //移动距离超过此值才判定为滑动
- if (distance > 100 && displayMode == DisplayMode::NormalMode) {
- m_showImageWidget->m_canSet = true;
- Interaction::getInstance()->backImage();
- } else if (distance < -100 && displayMode == DisplayMode::NormalMode) {
- m_showImageWidget->m_canSet = true;
- Interaction::getInstance()->nextImage();
- }
- }
- return QWidget::event(event);
- }
-
return QWidget::event(event);
}
@@ -1189,8 +1202,15 @@ void KyView::x11EventEnd()
xEvent.xbutton.y_root = globalPoints.y() * device;
xEvent.xbutton.display = display;
+ //在release之前,先模拟一次press操作,防止release不生效
+ XEvent xEvent2 = xEvent;
+ xEvent2.type = ButtonPress;
+ XSendEvent(display, this->effectiveWinId(), False, ButtonPressMask, &xEvent2);
+ XFlush(display);
+
XSendEvent(display, this->effectiveWinId(), False, ButtonReleaseMask, &xEvent);
XFlush(display);
+ m_mousePress = false;
}
}
@@ -1213,6 +1233,9 @@ void KyView::pinchTriggered(QPinchGesture *gesture)
{
QPinchGesture::ChangeFlags changeFlags = gesture->changeFlags(); // 获取已改变的手势属性
+ if (gesture->centerPoint() != QPointF(-1, -1)) {
+ return;
+ }
if (changeFlags & QPinchGesture::RotationAngleChanged) { // 手势覆盖角度改变
if (!m_isResize) {
const qreal lastAngle = gesture->lastRotationAngle();
@@ -1230,10 +1253,10 @@ void KyView::pinchTriggered(QPinchGesture *gesture)
QPoint zoomFocus = this->mapFromGlobal(gesture->centerPoint().toPoint());
//避免操作太频繁,移动幅度超过某值才做处理
if (tmpNum > m_minDistance) {
- Interaction::getInstance()->watchBigImage(zoomFocus);
+ // Interaction::getInstance()->watchBigImage(zoomFocus);
m_lastDistance = scaleFactor;
} else if (tmpNum < m_minDistance * -0.5) {
- Interaction::getInstance()->watchSmallImage(zoomFocus);
+ // Interaction::getInstance()->watchSmallImage(zoomFocus);
m_lastDistance = scaleFactor;
}
if (m_lastDistance != 1) {
@@ -1258,6 +1281,7 @@ void KyView::pinchTriggered(QPinchGesture *gesture)
m_isResize = false;
m_lastDistance = 1;
m_minDistance = 0.5;
+ m_needCLoseGrabGesture = false;
}
}
@@ -1353,7 +1377,7 @@ void KyView::initAboutDialog()
{
m_aboutDialog->setAppIcon(QIcon::fromTheme("kylin-photo-viewer"));
m_aboutDialog->setAppName(tr("Pictures"));
- m_aboutDialog->setAppVersion(tr("Version:") + ("1.2.0"));
+ m_aboutDialog->setAppVersion(tr("Version:") + APP_VERSION_DETAIL);
m_aboutDialog->setBodyText(tr("A system picture tool that can quickly open common formats. It provides zoom,flip "
"and other processing simplely."));
}
@@ -1369,3 +1393,27 @@ void KyView::tapAndHoldGesture(QTapAndHoldGesture *gesture)
}
m_panTriggered = true;
}
+
+void KyView::changeEvent(QEvent *event)
+{
+ if (QEvent::WindowStateChange == event->type()) {
+ Qt::WindowStates state = windowState();
+
+ if (state == Qt::WindowNoState) {
+ m_titlebar->g_fullscreen->setIcon(QIcon::fromTheme("window-maximize-symbolic")); //主题库的全屏图标
+ m_titlebar->g_fullscreen->setToolTip(tr("full srceen"));
+ if (!m_isPcModeStarted) {
+ m_isPcModeStarted = true;
+ resize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
+ QScreen *screen = QGuiApplication::primaryScreen();
+ this->move((screen->geometry().width() - this->width()) / 2,
+ (screen->geometry().height() - this->height()) / 2);
+ }
+ } else if (state == Qt::WindowMaximized) {
+ m_titlebar->g_fullscreen->setIcon(QIcon::fromTheme("window-restore-symbolic")); //主题库的恢复图标
+ m_titlebar->g_fullscreen->setToolTip(tr("recovery"));
+ }
+ }
+
+ return;
+}
diff --git a/src/view/kyview.h b/src/view/kyview.h
index 616c21c..2b49d7f 100644
--- a/src/view/kyview.h
+++ b/src/view/kyview.h
@@ -29,7 +29,6 @@
#include
#include
#include
-
#include
#include
#include "toolbar.h"
@@ -56,6 +55,10 @@ public:
~KyView();
static KyView *mutual; //指针类型静态成员变量
+
+protected:
+ void changeEvent(QEvent *event);
+
private:
int toolbarHeightValue;
int titlebarHeightValue;
@@ -78,16 +81,18 @@ private:
QTimer *m_timernavi; //离开界面或进入显隐事件的定时器
QTimer *m_timeNomove; //鼠标两秒不动
- QLocale m_local; //检测系统语言环境
- bool m_mousePress; //按下鼠标左键
- bool m_inforState = true; //信息栏状态
- bool m_albumState = true; //相册状态
- bool m_albumShow = true; //切换图片时,相册状态
+ QLocale m_local; //检测系统语言环境
+ bool m_mousePress = false; //按下鼠标左键
+ bool m_inforState = true; //信息栏状态
+ bool m_albumState = true; //相册状态
+ bool m_albumShow = true; //切换图片时,相册状态
bool m_titleState = true; //鼠标离开进入时,有关菜单下拉列表show时的问题,先默认没有离开界面
double m_tran = 0.60; //透明度
bool m_timestart = false; //记录从标题栏到中间窗体的变化
bool m_isLeave = true;
+ bool m_isPcModeStarted = true; //记录是否是从pc模式启动看图
+
QPoint m_pressPosRecord = QPoint(0, 0); //记录拖动时鼠标位置
int m_rotateLevel = 0; //手势旋转级别
qreal m_lastDistance = 1; //上次手势距离
@@ -133,6 +138,7 @@ private:
bool eventFilter(QObject *obj, QEvent *event); //事件过滤器--信息栏响应两栏show
void dragEnterEvent(QDragEnterEvent *event); //文件拖拽显示事件--判断是否响应dropevent
void dropEvent(QDropEvent *event); //文件拖拽响应
+ void dealMouseDouble(); //鼠标双击事件处理
void x11EventEnd(); //窗口移动事件
@@ -150,6 +156,8 @@ private:
KAboutDialog *m_aboutDialog = nullptr;
void initAboutDialog(); //初始化关于窗口
+ bool m_needCLoseGrabGesture = false;
+
private Q_SLOTS:
@@ -172,6 +180,7 @@ private Q_SLOTS:
void slotIntelHVModeChanged(deviceMode sig); //横竖屏切换的响应
void viewOCRMode(); //隐藏其他栏,进入OCR模式
void exitOCRMode(); //退出OCR模式
+ void setWidDisplay(bool isDefaultDisplay); //设置界面显示
Q_SIGNALS:
diff --git a/src/view/navigator.cpp b/src/view/navigator.cpp
index af2a15d..854c49e 100644
--- a/src/view/navigator.cpp
+++ b/src/view/navigator.cpp
@@ -13,7 +13,8 @@ Navigator::Navigator(QWidget *parent) : QWidget(parent)
//此处绑定信号和槽
connect(Interaction::getInstance(), &Interaction::showNavigation, this,
&Navigator::showNavigation); //启动时打开图片
- connect(this, &Navigator::posChange, Interaction::getInstance(), &Interaction::clickNavigation);
+ // connect(this, &Navigator::posChange, Interaction::getInstance(), &Interaction::clickNavigation);
+ connect(this, &Navigator::posChange, Interaction::getInstance(), &Interaction::qmlClickNaviDisplay);
connect(Interaction::getInstance(), &Interaction::sendHightlightPos, this, &Navigator::getHighLightRegion);
}
//显示导航器
@@ -35,11 +36,12 @@ void Navigator::showNavigation(QPixmap pix)
void Navigator::mouseMoveEvent(QMouseEvent *event)
{
Q_UNUSED(event);
- QPoint currpos = this->mapFromGlobal(QCursor().pos());
+ QPointF currpos = this->mapFromGlobal(QCursor().pos());
if (m_isPress) {
Q_EMIT notifyNotUpdated(true);
Q_EMIT posChange(currpos, true);
+ Q_EMIT needUpdateImagePosFromMainWid(false);
this->setCursor(Qt::ClosedHandCursor);
} else {
if ((currpos.x() >= m_startPos.x() && currpos.x() <= m_endPos.x())
@@ -56,9 +58,10 @@ void Navigator::mouseMoveEvent(QMouseEvent *event)
void Navigator::mousePressEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton) {
- QPoint currpos = this->mapFromGlobal(QCursor().pos());
+ QPointF currpos = this->mapFromGlobal(QCursor().pos());
Q_EMIT posChange(currpos, true);
Q_EMIT notifyNotUpdated(true);
+ Q_EMIT needUpdateImagePosFromMainWid(false);
}
m_isPress = true;
this->setCursor(Qt::ClosedHandCursor);
@@ -69,13 +72,15 @@ void Navigator::mouseReleaseEvent(QMouseEvent *event)
{
Q_EMIT notifyNotUpdated(false);
m_isPress = false;
- QPoint currpos = this->mapFromGlobal(QCursor().pos());
+ QPointF currpos = this->mapFromGlobal(QCursor().pos());
if ((currpos.x() >= m_startPos.x() && currpos.x() <= m_endPos.x())
&& (currpos.y() >= m_startPos.y() && currpos.y() <= m_endPos.y())) {
this->setCursor(Qt::ClosedHandCursor);
} else {
this->unsetCursor();
}
+ Q_EMIT needUpdateImagePosFromMainWid(true);
+ Q_EMIT needUpdateQmlImagePos();
//判断在区域内,鼠标不变,否则,鼠标变化
QWidget::mouseReleaseEvent(event);
}
diff --git a/src/view/navigator.h b/src/view/navigator.h
index 48457b1..6d450e1 100644
--- a/src/view/navigator.h
+++ b/src/view/navigator.h
@@ -12,6 +12,7 @@ class Navigator : public QWidget
Q_OBJECT
public:
explicit Navigator(QWidget *parent = nullptr);
+ void showNavigation(QPixmap pix);
private:
QLabel *m_bottomImage;
@@ -19,7 +20,6 @@ private:
QPoint m_startPos = QPoint(-1, -1);
QPoint m_endPos = QPoint(-1, -1);
- void showNavigation(QPixmap pix);
void mouseMoveEvent(QMouseEvent *event);
void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event);
@@ -29,9 +29,11 @@ private:
Q_SIGNALS:
void naviChange();
- void posChange(QPoint pos, bool isDragImage);
+ void posChange(QPointF curMousePos, bool needChangeDisplayImage);
void navigatorState(bool navigatorState);
void notifyNotUpdated(bool);
+ void needUpdateImagePosFromMainWid(bool);
+ void needUpdateQmlImagePos(); //鼠标释放,需要更新qml界面图片的显示位置
};
#endif // NAVIGATOR_H
diff --git a/src/view/openimage.cpp b/src/view/openimage.cpp
index 6862545..10e52b7 100644
--- a/src/view/openimage.cpp
+++ b/src/view/openimage.cpp
@@ -106,6 +106,7 @@ void OpenImage::openImagePath()
Q_EMIT openEmptyFile(true);
return;
}
+ operayteMode = OperayteMode::ChangeImage;
//写入配置
QFileInfo info(file_path);
Variable::setSettings("imagePath", info.absolutePath());
@@ -118,7 +119,6 @@ void OpenImage::initInteraction()
connect(Interaction::getInstance(), &Interaction::openFromAlbum, this, &OpenImage::openImagePath); //启动时打开图片
}
-
void OpenImage::initGsettings()
{
connect(kdk::kabase::Gsettings::getPoint(), &kdk::kabase::Gsettings::systemThemeChange, this, [=]() {
diff --git a/src/view/showimagewidget.cpp b/src/view/showimagewidget.cpp
index 174392b..406f66d 100644
--- a/src/view/showimagewidget.cpp
+++ b/src/view/showimagewidget.cpp
@@ -1,129 +1,49 @@
-#include "showimagewidget.h"
+#include "showimagewidget.h"
#include "kyview.h"
#include "sizedate.h"
+#include "global/variable.h"
ShowImageWidget::ShowImageWidget(QWidget *parent) : QWidget(parent)
{
- initInteraction();
+ this->initInteraction();
+ this->initQWidgetObject();
+ this->initQmlObject();
+ this->initMenu();
+ this->initChangeImageBtn();
- //中间展示图片部分
- m_showImage = new QLabel(this);
- m_showImage->resize(this->width(), this->height());
- m_showImage->move(int((this->width() - m_showImage->width()) / 2),
- int((this->height() - m_showImage->height()) / 2));
- m_showImage->setMouseTracking(true);
- m_showImage->installEventFilter(this);
- m_showImage->setAlignment(Qt::AlignCenter);
- m_showImage->setContextMenuPolicy(Qt::ActionsContextMenu);
- m_showImage->setContextMenuPolicy(Qt::CustomContextMenu);
-
- //设置位置和大小
- m_showImageQml = new QQuickWidget(this);
- QQmlEngine *engine = m_showImageQml->engine();
- engine->addImageProvider(QLatin1String("thumb"), new ScreenImageProvider);
-
- m_showImageQml->setSource(QUrl(QStringLiteral("qrc:/showImageComponent.qml")));
- m_showImageQml->setClearColor(Qt::transparent);
- //设置置顶
- // m_showImageQml->setAttribute(Qt::WA_AlwaysStackOnTop);
- QObject *qmlObj = m_showImageQml->rootObject();
- qmlObj->setProperty("width", this->width());
- qmlObj->setProperty("height", this->height());
- qmlObj->setProperty("x", 0);
- qmlObj->setProperty("y", 0);
- m_showImageQml->installEventFilter(this);
- m_showImageQml->setContextMenuPolicy(Qt::ActionsContextMenu);
- m_showImageQml->setContextMenuPolicy(Qt::CustomContextMenu);
- m_showImageQml->lower();
-
- //菜单栏给功能选项:复制,设置为桌面壁纸,设置为锁屏壁纸,打印,删除,在文件夹中显示
- m_copy = new QAction(tr("Copy"), this);
- m_reName = new QAction(tr("Rename"), this);
- m_setDeskPaper = new QAction(tr("Set Desktop Wallpaper"), this);
- m_setLockPaper = new QAction(tr("Set Lock Wallpaper"), this);
- m_print = new QAction(tr("Print"), this);
- m_deleteImage = new QAction(tr("Delete"), this);
- m_showInFile = new QAction(tr("Show in File"), this);
- m_saveAs = new QAction(tr("Save as"), this);
- m_signImage = new QAction(tr("Markup"), this);
- //右键菜单
- m_imageMenu = new QMenu();
- m_imageMenu->addAction(m_copy);
- // m_imageMenu->addAction(m_reName);
- // m_imageMenu->addAction(m_setDeskPaper);
- // imageMenu->addAction(setLockPaper);
- m_imageMenu->addAction(m_print);
- m_imageMenu->addAction(m_deleteImage);
- m_imageMenu->addAction(m_signImage);
- m_imageMenu->addAction(m_saveAs);
- m_imageMenu->addAction(m_showInFile);
- //上一张,下一张按钮
- g_next = new QPushButton(this);
- g_next->resize(IMAGE_BUTTON);
- g_next->setToolTip(tr("Next"));
-
- g_back = new QPushButton(this);
- g_back->resize(IMAGE_BUTTON);
- g_back->setToolTip(tr("Previous"));
-
- g_back->move(LEFT_POS, int((this->height() - g_back->height()) / 2));
- g_next->move(this->width() - LEFT_POS - g_next->width(), int((this->height() - g_next->height()) / 2));
-
- g_back->setIconSize(IMAGE_ICON);
- g_next->setIconSize(IMAGE_ICON);
-
- g_back->setFocusPolicy(Qt::NoFocus);
- g_next->setFocusPolicy(Qt::NoFocus);
- g_back->setFlat(true);
- g_next->setFlat(true);
- g_back->setStyleSheet("QPushButton{border:none;background-color:transparent;border-radius:4px;}");
- g_next->setStyleSheet("QPushButton{border:none;background-color:transparent;border-radius:4px;}");
//图片没处理完毕时,显示转圈圈图
m_loadingMovie = new QMovie(":/res/res/loadgif.gif");
m_loadingMovie->setParent(this);
- m_cutWid = new CutWIdget(this);
- m_cutWid->hide();
- //需要将这个widget移动到showimagewidget内
- m_btnWid = new QWidget(this);
- m_btnWid->hide();
- m_btnWid->setFixedSize(108, 40);
+ this->initCutWid();
+ this->initOcrWid();
+ this->ocrBtnWidStyle();
- m_cancel = new QPushButton(m_btnWid);
- m_save = new QPushButton(m_btnWid);
- m_cancel->setFixedSize(24, 24);
- m_save->setFixedSize(24, 24);
- m_cancel->move(20, 8);
- m_save->move(30 + m_cancel->width() + 8, 8);
- m_save->setToolTip(tr("Save"));
- m_cancel->setToolTip(tr("Cancel"));
- cutBtnWidStyle();
- m_btnWid->move((this->width() - m_btnWid->width()) / 2, this->height() - m_btnWid->height() - 8);
+ m_imagePageWid = new QWidget(this);
+ m_imagePageWid->setFixedSize(200, 40);
+ m_imagePageWid->move(140, 40);
+ m_imagePageWid->setStyleSheet("background:red");
- m_ocrWid = new OCRResultWidget(this);
- m_ocrWid->hide();
- m_ocrBtnWid = new QWidget(this);
- m_ocrBtnWid->hide();
- m_ocrBtnWid->setFixedSize(148, 40);
- m_ocrCancel = new QPushButton(m_ocrBtnWid);
- m_ocrCancel->setIcon(QIcon::fromTheme("ukui-start-symbolic"));
- m_ocrCancel->move(20, 8);
- m_ocrCancel->setFocusPolicy(Qt::NoFocus); //设置焦点类型
- m_ocrCancel->setProperty("isWindowButton", 0x1);
- m_ocrCancel->setProperty("useIconHighlightEffect", 0x2);
- m_ocrCancel->setFlat(true);
- m_ocrCancel->setFixedSize(24, 24);
- m_ocrCancel->setToolTip(tr("Cancel"));
- m_ocrExportToTxt = new QPushButton(m_ocrBtnWid);
- m_ocrExportToTxt->setText(tr("Export"));
- m_ocrExportToTxt->setProperty("isWindowButton", 0x1);
- m_ocrExportToTxt->setProperty("useIconHighlightEffect", 0x2);
- m_ocrExportToTxt->setFlat(true);
- m_ocrExportToTxt->setFixedSize(60, 24);
- m_ocrExportToTxt->move(64, 8);
- m_ocrExportToTxt->setEnabled(false);
- ocrBtnWidStyle();
+ m_leftPageBtn = new QPushButton(m_imagePageWid);
+ m_rightPageBtn = new QPushButton(m_imagePageWid);
+ m_pageNum = new QLabel(m_imagePageWid);
+ m_leftPageBtn->setIcon(QIcon(":/res/res/left.png"));
+ m_rightPageBtn->setIcon(QIcon(":/res/res/right.png"));
+ m_leftPageBtn->setFlat(true);
+ m_rightPageBtn->setFlat(true);
+
+ m_pageLayout = new QHBoxLayout(this);
+ m_pageLayout->addWidget(m_leftPageBtn);
+ m_pageLayout->addWidget(m_pageNum);
+ m_pageLayout->addWidget(m_rightPageBtn);
+ m_pageLayout->setContentsMargins(0, 0, 0, 0);
+ m_imagePageWid->setLayout(m_pageLayout);
+
+ m_imagePageWid->hide();
+
+ m_timer = new QTimer(this);
+ m_timer->setSingleShot(true);
//绘制阴影
QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect(this);
effect->setOffset(0, 0); //设置向哪个方向产生阴影效果(dx,dy),特别地,(0,0)代表向四周发散
@@ -132,6 +52,7 @@ ShowImageWidget::ShowImageWidget(QWidget *parent) : QWidget(parent)
m_btnWid->setGraphicsEffect(effect);
m_ocrBtnWid->setGraphicsEffect(effect);
m_widChangeHeight = makeSureHeightState();
+
this->setMouseTracking(true);
this->update();
this->initConnect();
@@ -174,6 +95,7 @@ void ShowImageWidget::initConnect()
// OCR
connect(m_ocrCancel, &QPushButton::clicked, this, &ShowImageWidget::exitGetText);
connect(m_ocrExportToTxt, &QPushButton::clicked, this, &ShowImageWidget::exportToTxt);
+ connect(m_timer, &QTimer::timeout, this, &ShowImageWidget::realBuriedPoint);
}
void ShowImageWidget::sideState(int num)
@@ -204,8 +126,154 @@ bool ShowImageWidget::imageNum(int number)
return false;
}
//根据图片是否为空决定是否显示转圈圈
-bool ShowImageWidget::imageNUll(QPixmap pixmap)
+void ShowImageWidget::imageNUll()
{
+ QObject *qmlImageRect;
+ QObject *imageLoader;
+ QObject *imageItemLower;
+ QObject *targatImage;
+ if (!getQmlObjAndJudgeNullptr(m_qmlObj, &qmlImageRect, 0, &imageLoader, &imageItemLower, &targatImage)) {
+ return;
+ }
+ //判断如果是裁剪,需要遮罩蒙层
+ if (operayteMode == OperayteMode::Cut) {
+ int way = int(operayteMode);
+ //判断传入方式进行缩放显示
+ QMetaObject::invokeMethod(imageItemLower, IMAGE_FUNC_OPERATE.toLatin1().data(), Q_ARG(QVariant, way));
+ return;
+ }
+
+ QObject::connect(imageItemLower, SIGNAL(sendScale(QVariant)), this, SLOT(setScale(QVariant)));
+ QObject::connect(imageItemLower, SIGNAL(needShowNavigator(QVariant, QVariant, QVariant, QVariant, QVariant)), this,
+ SLOT(showNavigator(QVariant, QVariant, QVariant, QVariant, QVariant)));
+ QObject::connect(imageItemLower, SIGNAL(closeNavigator()), this, SLOT(needCloseNavigator()));
+ QObject::connect(imageItemLower, SIGNAL(buriedPoint()), this, SLOT(zoomBuriedPoint()));
+
+ if ((m_paperFormat == "tiff" || m_paperFormat == "tif") && m_imagePageList.length() > 1) {
+ //更换显示界面
+ // m_imagePageWid->show();
+ // m_pageNum->setText("1");
+ //更新图片--先更新第一张-tiff格式
+ targatImage->setProperty(IMAGE_SOURCE.toLatin1().data(), "image://thumb/" + m_imagePath + QString::number(0));
+ } else {
+ //更新图片
+ targatImage->setProperty(IMAGE_SOURCE.toLatin1().data(), "image://thumb/" + m_imagePath);
+ }
+
+
+ int way = int(operayteMode);
+ //判断传入方式进行缩放显示
+ QMetaObject::invokeMethod(imageItemLower, IMAGE_FUNC_OPERATE.toLatin1().data(), Q_ARG(QVariant, way));
+ //首次打开-无状态
+ if (operayteMode == OperayteMode::NoOperate) {
+ QMetaObject::invokeMethod(targatImage, IMAGE_FUNC_CHANGESCALE.toLatin1().data(),
+ Q_ARG(QVariant, m_proportion * 0.01));
+ }
+ //同一张图片: 退出ocr,退出裁剪,适应窗口,原图展示,ocr
+ if (operayteMode == OperayteMode::NormalMode || operayteMode == OperayteMode::Window
+ || operayteMode == OperayteMode::Ocr) {
+ QMetaObject::invokeMethod(targatImage, IMAGE_FUNC_CHANGESCALE.toLatin1().data(),
+ Q_ARG(QVariant, m_proportion * 0.01));
+ QMetaObject::invokeMethod(targatImage, IMAGE_FUNC_POSRESET.toLatin1().data());
+ }
+ //切图
+ if (operayteMode == OperayteMode::ChangeImage || operayteMode == OperayteMode::LifeSize
+ || operayteMode == OperayteMode::RotateN || operayteMode == OperayteMode::RotateS
+ || operayteMode == OperayteMode::FlipH || operayteMode == OperayteMode::FlipV) {
+ if (operayteMode != OperayteMode::LifeSize) {
+ //如果切换图片,则关闭导航栏
+ this->needCloseNavigator();
+ }
+ //设置当前缩放比
+ QMetaObject::invokeMethod(targatImage, IMAGE_FUNC_CHANGESCALE.toLatin1().data(),
+ Q_ARG(QVariant, m_proportion * 0.01));
+ }
+ /* 其余方式不需要设置qml操作,qml里实现其他操作 */
+
+ //返回当前缩放比
+ QVariant var;
+ QMetaObject::invokeMethod(targatImage, IMAGE_FUNC_SENDSCALE.toLatin1().data(), Q_RETURN_ARG(QVariant, var));
+ m_proportion = var.toInt();
+ //发送给工具栏
+ setScale(var);
+ return;
+}
+
+void ShowImageWidget::showMovieImage()
+{
+ if (m_proportion == 0) {
+ return;
+ }
+ if (m_imagePath == "") {
+ return;
+ }
+ //避免出现静图也使用动图的qml加载的情况
+ if (!m_movieImage || !MOVIE_IMAGE_FORMAT.contains(m_paperFormat)) {
+ m_recordMovieBefore = true;
+ operayteMode = OperayteMode::NoOperate;
+ imageNUll();
+ return;
+ }
+
+ QObject *qmlImageRect;
+ QObject *imageLoader;
+ QObject *imageItemLower;
+ QObject *targatImage;
+ if (!getQmlObjAndJudgeNullptr(m_qmlObj, &qmlImageRect, 1, &imageLoader, &imageItemLower, &targatImage)) {
+ return;
+ }
+ QObject::connect(imageItemLower, SIGNAL(sendScale(QVariant)), this, SLOT(setScale(QVariant)));
+
+ QString path = "file://" + m_imagePath;
+
+ QMetaObject::invokeMethod(targatImage, IMAGE_FUNC_SETSOURCE.toLatin1().data(), Q_ARG(QVariant, path));
+ QObject::connect(imageItemLower, SIGNAL(needShowNavigator(QVariant, QVariant, QVariant, QVariant, QVariant)), this,
+ SLOT(showNavigator(QVariant, QVariant, QVariant, QVariant, QVariant)));
+ QObject::connect(imageItemLower, SIGNAL(closeNavigator()), this, SLOT(needCloseNavigator()));
+ QObject::connect(imageItemLower, SIGNAL(buriedPoint()), this, SLOT(zoomBuriedPoint()));
+ int way = int(operayteMode);
+ //判断传入方式进行缩放显示
+ QMetaObject::invokeMethod(imageItemLower, IMAGE_FUNC_OPERATE.toLatin1().data(), Q_ARG(QVariant, way));
+ //首次打开-无状态
+ if (operayteMode == OperayteMode::NoOperate) {
+ QMetaObject::invokeMethod(targatImage, IMAGE_FUNC_CHANGESCALE.toLatin1().data(),
+ Q_ARG(QVariant, m_proportion * 0.01));
+ }
+ //同一张图片: 退出ocr,退出裁剪,适应窗口,原图展示,ocr
+ if (operayteMode == OperayteMode::NormalMode || operayteMode == OperayteMode::Window
+ || operayteMode == OperayteMode::Ocr) {
+ QMetaObject::invokeMethod(targatImage, IMAGE_FUNC_CHANGESCALE.toLatin1().data(),
+ Q_ARG(QVariant, m_proportion * 0.01));
+ QMetaObject::invokeMethod(targatImage, IMAGE_FUNC_POSRESET.toLatin1().data());
+ }
+
+ //切图
+ if (operayteMode == OperayteMode::ChangeImage || operayteMode == OperayteMode::LifeSize
+ || operayteMode == OperayteMode::RotateN || operayteMode == OperayteMode::RotateS
+ || operayteMode == OperayteMode::FlipH || operayteMode == OperayteMode::FlipV) {
+ if (operayteMode != OperayteMode::LifeSize) {
+ //如果切换图片,则关闭导航栏
+ this->needCloseNavigator();
+ }
+ //设置当前缩放比
+ QMetaObject::invokeMethod(targatImage, IMAGE_FUNC_CHANGESCALE.toLatin1().data(),
+ Q_ARG(QVariant, m_proportion * 0.01));
+ } else {
+ qmlImageRect->setProperty(IMAGE_NEW_LOADED.toLatin1().data(), 0);
+ }
+ m_recordMovieBefore = true;
+ operayteMode = OperayteMode::NormalMode;
+ //返回当前缩放比
+ QVariant var;
+ QMetaObject::invokeMethod(targatImage, IMAGE_FUNC_SENDSCALE.toLatin1().data(), Q_RETURN_ARG(QVariant, var));
+ //发送给工具栏
+ setScale(var);
+ return;
+}
+
+bool ShowImageWidget::operatorBeforeShowImage(QPixmap pixmap)
+{
+
if (pixmap.isNull()) {
this->m_showImage->setMovie(m_loadingMovie);
m_loadingMovie->start();
@@ -216,12 +284,12 @@ bool ShowImageWidget::imageNUll(QPixmap pixmap)
if (m_loadingMovie->state() != QMovie::NotRunning) {
m_loadingMovie->stop();
}
- if (m_isCutting || m_movieImage) {
+ if (m_isCutting) {
m_showImage->setPixmap(pixmap);
m_showImage->show();
m_showImageQml->hide();
Q_EMIT perRate(QString::number(m_proportion) + "%", m_imagePath);
- return false;
+ return true;
}
if (!m_isOpenSuccess) {
@@ -229,62 +297,10 @@ bool ShowImageWidget::imageNUll(QPixmap pixmap)
m_showImage->show();
m_showImageQml->hide();
Q_EMIT perRate(QString::number(m_proportion) + "%", m_imagePath);
- return false;
+ return true;
}
-
m_showImage->hide();
m_showImageQml->show();
- QObject *qmlObj = m_showImageQml->rootObject();
- QObject *qmlImageRect = qmlObj->findChild("imageRect");
-
- QObject *targatImage = qmlImageRect->findChild("targatImage");
- //更换图片:切换图片,旋转翻转
- if (targatImage->property("source").toString() != "image://thumb/" + m_imagePath) {
- //启动动画设置,切换或者更新图片的时候不启动动画效果
- qmlObj->setProperty("startAnimation", false);
- targatImage->setProperty("source", "image://thumb/" + m_imagePath);
- } else if (m_imageNeedUpdate) {
- //路径一样的要先清空source或者设置cache为false
- qmlObj->setProperty("startAnimation", false);
- targatImage->setProperty("source", "");
- targatImage->setProperty("source", "image://thumb/" + m_imagePath);
- } else {
- qmlObj->setProperty("startAnimation", true);
- }
- qmlImageRect->setProperty("width", m_displaySizeOfPicture.width());
- qmlImageRect->setProperty("height", m_displaySizeOfPicture.height());
-
-
- if (m_leftUpPos.x() == 0 && m_leftUpPos.y() == 0) {
- int leftPosX;
- if (displayMode == DisplayMode::OCRMode) {
- leftPosX = positionCorrection(this->width() / 2, m_displaySizeOfPicture.width());
- } else {
- leftPosX = positionCorrection(this->width(), m_displaySizeOfPicture.width());
- }
- int leftPosY = positionCorrection(this->height(), m_displaySizeOfPicture.height());
- qmlImageRect->setProperty("x", leftPosX + (m_displaySizeOfPicture.width() - tempImage.width()) / 2);
- qmlImageRect->setProperty("y", leftPosY + (m_displaySizeOfPicture.height() - tempImage.height()) / 2);
- } else {
- double xPos = m_leftUpPos.x() + (m_displaySizeOfPicture.width() - tempImage.width()) / 2;
- double yPos = m_leftUpPos.y() + (m_displaySizeOfPicture.height() - tempImage.height()) / 2;
-
- if (m_displaySizeOfPicture.width() <= this->width()) {
- xPos = this->width() / 2 - (m_displaySizeOfPicture.width() / 2)
- + (m_displaySizeOfPicture.width() - tempImage.width()) / 2;
- }
- if (m_displaySizeOfPicture.height() <= this->height()) {
- yPos = this->height() / 2 - (m_displaySizeOfPicture.height() / 2)
- + (m_displaySizeOfPicture.height() - tempImage.height()) / 2;
- }
- qmlImageRect->setProperty("x", xPos);
- qmlImageRect->setProperty("y", yPos);
- }
-
- targatImage->setProperty("scale", (m_proportion)*0.01);
- targatImage->setProperty("source", "image://thumb/" + m_imagePath);
- recordCurrentProportion = m_proportion;
- Q_EMIT perRate(QString::number(m_proportion) + "%", m_imagePath);
return false;
}
//根据图片类型刷新右键菜单内容
@@ -305,7 +321,6 @@ void ShowImageWidget::imageMenu(QFileInfo info, QString imageSize, QString color
//给工具栏确定裁剪按钮的状态--必须在stateUpdate后
Q_EMIT sendImageType(false);
}
-
} else {
Q_EMIT titleName(filename, m_imagePath); //给顶栏图片的名字
Q_EMIT changeInfor(info, imageSize, colorSpace); //给信息栏需要的信息
@@ -391,7 +406,7 @@ void ShowImageWidget::copy()
kdk::kabase::BuriedPoint buriedPointCopy;
if (buriedPointCopy.functionBuriedPoint(kdk::kabase::AppName::KylinPhotoViewer,
kdk::kabase::BuriedPoint::PT::KylinPhotoViewerCoyp)) {
- qCritical() << "buried point fail Copy!";
+ qDebug() << "buried point fail Copy!";
}
}
@@ -399,6 +414,54 @@ void ShowImageWidget::updateImagePath(QString newImagePath)
{
m_imagePath = newImagePath;
}
+
+void ShowImageWidget::setScale(QVariant scale)
+{
+ m_proportion = scale.toInt();
+ recordCurrentProportion = m_proportion;
+ Q_EMIT perRate(QString::number(m_proportion) + "%", m_imagePath);
+}
+
+
+void ShowImageWidget::getDropImagePath(QVariant pathUrl)
+{
+ QString imagePath = pathUrl.toUrl().path().toLocal8Bit();
+ if (imagePath.startsWith("file://")) {
+ imagePath = imagePath.remove("file://");
+ }
+ if (imagePath == "") {
+ return;
+ }
+ QFileInfo info(imagePath);
+ if (info.exists()) {
+ //获得所有可被查看的图片格式
+ QStringList formatList;
+ QString format;
+ format = "";
+ for (const QString &str : Variable::SUPPORT_FORMATS) {
+ format = str;
+ formatList.append(format);
+ }
+ if (formatList.contains(info.suffix().toLower())) {
+ Variable::setSettings("imagePath", info.absolutePath());
+ operayteMode = OperayteMode::ChangeImage;
+ this->openImage(imagePath);
+ }
+ }
+ return;
+}
+
+void ShowImageWidget::operatyImage()
+{
+ //正式加载图片
+ if (m_movieImage && m_paperFormat != "tif" && m_paperFormat != "tiff") {
+ //动图
+ showMovieImage();
+ } else {
+ //静态图
+ imageNUll();
+ }
+}
//设置为桌面壁纸
void ShowImageWidget::setDeskPaper()
{
@@ -426,12 +489,71 @@ void ShowImageWidget::acceptPrint(QPrinter *printer)
//开始裁剪
void ShowImageWidget::startCutColor()
{
-
- m_cutWid->show();
- m_cutWid->sizeChange(m_pic.toImage().size());
- m_cutWid->move((this->width() - m_cutWid->width()) / 2, (this->height() - m_cutWid->height()) / 2);
- m_isCutting = true;
+ QObject *qmlImageRect;
+ if (!getQmlObjAndJudgeNullptr(m_qmlObj, &qmlImageRect)) {
+ return;
+ }
+ //拿当前显示的图片类型
+ int imageType = qmlImageRect->property(IMAGE_TYPE.toLatin1().data()).toInt();
+ //动图无裁剪
+ if (imageType == 1) {
+ return;
+ }
displayMode = DisplayMode::CuttingMode;
+ m_isCutting = true;
+
+ QObject *imageLoader;
+ QObject *imageItemLower;
+ QObject *targatImage;
+ if (!getQmlObjAndJudgeNullptr(m_qmlObj, &qmlImageRect, 0, &imageLoader, &imageItemLower, &targatImage)) {
+ return;
+ }
+
+ //从qml拿位置和尺寸
+ QVariant x;
+ QMetaObject::invokeMethod(imageItemLower, IMAGE_FUNC_GETLEFTUPPOSACCORDWID_X.toLatin1().data(),
+ Q_RETURN_ARG(QVariant, x));
+ QVariant y;
+ QMetaObject::invokeMethod(imageItemLower, IMAGE_FUNC_GETLEFTUPPOSACCORDWID_Y.toLatin1().data(),
+ Q_RETURN_ARG(QVariant, y));
+ QVariant w;
+ QMetaObject::invokeMethod(imageItemLower, IMAGE_FUNC_GETVISIBLESIZEACCORDWID_W.toLatin1().data(),
+ Q_RETURN_ARG(QVariant, w));
+ QVariant h;
+ QMetaObject::invokeMethod(imageItemLower, IMAGE_FUNC_GETVISIBLESIZEACCORDWID_H.toLatin1().data(),
+ Q_RETURN_ARG(QVariant, h));
+ QVariant scale;
+ QMetaObject::invokeMethod(targatImage, IMAGE_FUNC_SENDSCALE.toLatin1().data(), Q_RETURN_ARG(QVariant, scale));
+
+ QVariant xImage;
+ QMetaObject::invokeMethod(imageItemLower, IMAGE_FUNC_GETLEFTUPPOSACCORDIMAGE_X.toLatin1().data(),
+ Q_RETURN_ARG(QVariant, xImage));
+
+ QVariant yImage;
+ QMetaObject::invokeMethod(imageItemLower, IMAGE_FUNC_GETLEFTUPPOSACCORDIMAGE_Y.toLatin1().data(),
+ Q_RETURN_ARG(QVariant, yImage));
+
+ double xPos = x.toDouble();
+ double yPos = y.toDouble();
+
+ if (xPos == 0) {
+ xPos = (this->width() - w.toDouble()) / 2;
+ }
+ if (yPos == 0) {
+ yPos = (this->height() - h.toDouble()) / 2;
+ }
+ //给后端发信号,进行裁剪--发送的都是相对于在原图上的位置和大小以及缩放比也是处理好的
+ Interaction::getInstance()->qmlStartCutDisplay(
+ QPointF(xImage.toDouble(), yImage.toDouble()),
+ QSizeF(w.toDouble() / (scale.toDouble() * 0.01), h.toDouble() / (scale.toDouble() * 0.01)),
+ scale.toDouble() * 0.01);
+
+ //设置widget界面控件的位置和尺寸
+ m_showImage->resize(QSize(w.toDouble(), h.toDouble()));
+ m_showImage->move(xPos, yPos);
+ m_cutWid->show();
+ m_cutWid->resize(m_showImage->size());
+ m_cutWid->move(m_showImage->pos());
}
//退出裁剪
void ShowImageWidget::exitCutColor()
@@ -461,14 +583,13 @@ void ShowImageWidget::setGetTextResult(QVector result)
//结束OCR
void ShowImageWidget::exitGetText()
{
+ operayteMode = OperayteMode::NormalMode;
m_ocrWid->clear();
m_ocrWid->hide();
m_ocrBtnWid->hide();
- QObject *qmlObj = m_showImageQml->rootObject();
- qmlObj->setProperty("width", this->width());
- qmlObj->setProperty("height", this->height());
- qmlObj->setProperty("x", 0);
- qmlObj->setProperty("y", 0);
+
+ changeQmlSizePos(this->width(), this->height(), 0, 0);
+
m_showImage->resize(this->width(), this->height());
m_showImage->move((this->width() - m_showImage->width()) / 2, (this->height() - m_showImage->height()) / 2);
Interaction::getInstance()->changeWidgetSize(this->m_showImage->size());
@@ -477,23 +598,15 @@ void ShowImageWidget::exitGetText()
void ShowImageWidget::ocrMode()
{
-
- QObject *qmlObj = m_showImageQml->rootObject();
if (displayMode == DisplayMode::OCRMode) {
m_showImage->resize(this->width() / 2, this->height() - m_widChangeHeight);
- qmlObj->setProperty("width", this->width() / 2);
- qmlObj->setProperty("height", this->height() - m_widChangeHeight);
- qmlObj->setProperty("x", 0);
- qmlObj->setProperty("y", m_widChangeHeight);
+ changeQmlSizePos(this->width() / 2, this->height() - m_widChangeHeight, 0, m_widChangeHeight);
m_showImage->move(0, m_widChangeHeight);
m_ocrWid->resize(this->width() / 2, this->height() - m_widChangeHeight);
m_ocrWid->move(this->width() / 2, m_widChangeHeight);
m_ocrBtnWid->move((this->width() - m_ocrBtnWid->width()) / 2, this->height() - m_ocrBtnWid->height() - 8);
} else {
- qmlObj->setProperty("width", this->width());
- qmlObj->setProperty("height", this->height());
- qmlObj->setProperty("x", 0);
- qmlObj->setProperty("y", 0);
+ changeQmlSizePos(this->width(), this->height(), 0, 0);
m_showImage->resize(this->width(), this->height());
m_showImage->move((this->width() - m_showImage->width()) / 2, (this->height() - m_showImage->height()) / 2);
}
@@ -575,7 +688,7 @@ void ShowImageWidget::finishPrint(int result)
{
//失败才打印
if (1 != result) {
- qDebug() << "========" << result;
+ qDebug() << "退出打印或打印失败!" << result;
}
}
//删除
@@ -648,7 +761,7 @@ void ShowImageWidget::setMenuEnable()
m_setDeskPaper->setEnabled(m_isOpenSuccess);
m_setLockPaper->setEnabled(m_isOpenSuccess);
m_print->setEnabled(m_isOpenSuccess);
- if (m_movieImage || m_paperFormat == "svg") {
+ if (m_movieImage || m_paperFormat == "svg" || m_paperFormat == "dib") {
m_saveAs->setEnabled(false);
} else {
m_saveAs->setEnabled(m_isOpenSuccess);
@@ -686,10 +799,14 @@ void ShowImageWidget::startWithOpenImage(QString path)
{
if (path != Variable::API_TYPE) {
KyView::mutual->show();
+ Q_EMIT decideMainWidDisplay(true);
}
Q_EMIT startWayToSetTitleStyle();
if (path == "") {
+ Q_EMIT decideMainWidDisplay(true);
return;
+ } else {
+ Q_EMIT decideMainWidDisplay(false);
}
//双击和右键打开图片,将路径写入
QFileInfo info(path);
@@ -723,6 +840,7 @@ int ShowImageWidget::positionCorrection(int windowSize, int pictureSize)
//退出裁剪
void ShowImageWidget::exitCut()
{
+ operayteMode = OperayteMode::ExitCut;
m_cutWid->hide();
m_btnWid->hide();
Interaction::getInstance()->exitCut();
@@ -733,10 +851,12 @@ void ShowImageWidget::exitCut()
//保存裁剪图片并退出
void ShowImageWidget::needSave()
{
+ operayteMode = OperayteMode::ChangeImage;
m_cutWid->hide();
m_btnWid->hide();
+ m_showImage->hide();
//备份保存
- Interaction::getInstance()->needSaveCutImage(m_proportion);
+ Interaction::getInstance()->needSaveCutImage(recordCurrentProportion);
//弹出保存询问
// exitCut();
m_isCutting = false; //可进行放大缩小
@@ -768,7 +888,7 @@ void ShowImageWidget::openFinish(QVariant var)
m_isOpenSuccess = package.openSuccess;
QPixmap pixmap = package.image; //图片
m_pic = pixmap;
- tempImage = package.originImage.toImage();
+
m_displaySizeOfPicture = package.displaySizeOfPicture;
m_actualClickPos = package.actualClickPos;
//拿到返回信息
@@ -780,143 +900,123 @@ void ShowImageWidget::openFinish(QVariant var)
QString num;
int number = package.imageNumber; //在队列中的标签
m_movieImage = package.movieImage;
+ m_paperFormat = info.suffix().toLower();
if (MOVIE_IMAGE_FORMAT.contains(m_paperFormat)) {
m_movieImage = true;
}
+ m_imagePageList = package.imageList;
+ if (m_imagePageList.length() > 1 && (m_paperFormat == "tiff" || m_paperFormat == " tif")) {
+ tempImage = m_imagePageList.at(0);
+ } else {
+ tempImage = package.originImage.toImage();
+ }
+
m_imageNeedUpdate = package.imageNeedUpdate;
m_imageShowWay = package.imageShowWay;
m_zoomFocus = package.zoomFocus;
m_leftUpPos = package.leftUpPos;
-
num = QString("%1").arg(proportion) + "%";
m_path = info.absolutePath(); //图片的路径
m_imagePath = info.absoluteFilePath();
- m_paperFormat = info.suffix().toLower();
m_typeNum = number;
Q_EMIT sendSuffixToToolbar(m_paperFormat);
//根据number决定界面显示
if (imageNum(number)) {
return;
}
-
//重置ocr导出文本按钮的状态
if (m_ocrExportToTxt->isEnabled()) {
m_ocrExportToTxt->setEnabled(false);
}
//使用返回的信息进行设置界面
Q_EMIT toShowImage(); //给主界面--展示图片
- //根据图片是否为空决定是否显示转圈圈
- if (imageNUll(pixmap)) {
- return;
- }
//根据图片类型刷新右键菜单内容
imageMenu(info, imageSize, colorSpace);
-
sideState(m_typeNum);
m_isDelete = false;
- // Q_EMIT toSelectHigh(false);
+ // qml加载图片前的判断
+ if (operatorBeforeShowImage(pixmap)) {
+ return;
+ }
+ this->operatyImage();
}
//拉伸主界面时重新安排界面显示
void ShowImageWidget::reMove(int W, int H)
{
//拉伸主界面时重新安排界面显示
this->resize(W, H);
- QObject *qmlObj = m_showImageQml->rootObject();
if (displayMode == DisplayMode::OCRMode) {
- this->m_showImage->resize(this->width() / 2, this->height() - m_widChangeHeight);
- qmlObj->setProperty("width", this->width() / 2);
- qmlObj->setProperty("height", this->height() - m_widChangeHeight);
- qmlObj->setProperty("x", 0);
- qmlObj->setProperty("y", m_widChangeHeight);
- this->m_showImage->move(0, m_widChangeHeight);
- this->m_ocrWid->resize(this->width() / 2, this->height() - m_widChangeHeight);
- this->m_ocrWid->move(this->width() / 2, m_widChangeHeight);
- this->m_ocrBtnWid->move((this->width() - m_ocrBtnWid->width()) / 2, this->height() - m_ocrBtnWid->height() - 8);
+ m_showImage->resize(this->width() / 2, this->height() - m_widChangeHeight);
+ changeQmlSizePos(this->width() / 2, this->height() - m_widChangeHeight, 0, m_widChangeHeight);
+ m_showImage->move(0, m_widChangeHeight);
+ m_ocrWid->resize(this->width() / 2, this->height() - m_widChangeHeight);
+ m_ocrWid->move(this->width() / 2, m_widChangeHeight);
+ m_ocrBtnWid->move((this->width() - m_ocrBtnWid->width()) / 2, this->height() - m_ocrBtnWid->height() - 8);
} else {
- qmlObj->setProperty("width", this->width());
- qmlObj->setProperty("height", this->height());
+ m_qmlObj->setProperty(IMAGE_WIDTH.toLatin1().data(), this->width());
+ m_qmlObj->setProperty(IMAGE_HEIGHT.toLatin1().data(), this->height());
+ m_showImage->resize(this->width(), this->height());
+ m_showImage->move((this->width() - m_showImage->width()) / 2, (this->height() - m_showImage->height()) / 2);
}
g_back->move(LEFT_POS, int((this->height() - g_back->height()) / 2));
g_next->move(W - LEFT_POS - g_next->width(), int((H - g_next->height()) / 2));
+
+ if (m_firstChangeSize) {
+ return;
+ }
+ QObject *qmlImageRect;
+ QObject *imageLoader;
+ QObject *imageItemLower;
+ QObject *targatImage;
+
+ int imageType = 0;
+ if (m_movieImage && m_paperFormat != "tif" && m_paperFormat != "tiff") {
+ imageType = 1;
+ }
+ if (!getQmlObjAndJudgeNullptr(m_qmlObj, &qmlImageRect, imageType, &imageLoader, &imageItemLower, &targatImage)) {
+ return;
+ }
+ QMetaObject::invokeMethod(imageItemLower, IMAGE_FUNC_ADJUSTIMAGEPOS.toLatin1().data());
+ QMetaObject::invokeMethod(imageItemLower, IMAGE_FUNC_UPDATE_POS_ACCORD_WIDSIZE_CHANGE.toLatin1().data());
}
void ShowImageWidget::resizeEvent(QResizeEvent *event)
{
- Q_UNUSED(event);
- this->m_showImage->resize(KyView::mutual->width(), KyView::mutual->height());
- QObject *qmlObj = m_showImageQml->rootObject();
if (displayMode == DisplayMode::OCRMode) {
- this->m_showImage->resize(this->width() / 2, this->height() - m_widChangeHeight);
- qmlObj->setProperty("width", this->width() / 2);
- qmlObj->setProperty("height", this->height() - m_widChangeHeight);
- qmlObj->setProperty("x", 0);
- qmlObj->setProperty("y", m_widChangeHeight);
- this->m_showImage->move(0, m_widChangeHeight);
- this->m_ocrWid->resize(this->width() / 2, this->height() - m_widChangeHeight);
- this->m_ocrWid->move(this->width() / 2, m_widChangeHeight);
- this->m_ocrBtnWid->move((this->width() - m_ocrBtnWid->width()) / 2, this->height() - m_ocrBtnWid->height() - 8);
+ m_showImage->resize(this->width() / 2, this->height() - m_widChangeHeight);
+ changeQmlSizePos(this->width(), this->height(), 0, m_widChangeHeight);
+ m_showImage->move(0, m_widChangeHeight);
+ m_ocrWid->resize(this->width() / 2, this->height() - m_widChangeHeight);
+ m_ocrWid->move(this->width() / 2, m_widChangeHeight);
+ m_ocrBtnWid->move((this->width() - m_ocrBtnWid->width()) / 2, this->height() - m_ocrBtnWid->height() - 8);
} else {
- qmlObj->setProperty("width", this->width());
- qmlObj->setProperty("height", this->height());
- qmlObj->setProperty("x", 0);
- qmlObj->setProperty("y", 0);
+ changeQmlSizePos(this->width(), this->height(), 0, 0);
+ m_showImage->resize(this->width(), this->height());
+ m_showImage->move((this->width() - m_showImage->width()) / 2, (this->height() - m_showImage->height()) / 2);
}
- Interaction::getInstance()->changeWidgetSize(this->m_showImage->size());
+
+ //只有首次的时候才会去自适应图片大小
+ if (m_firstChangeSize) {
+ Interaction::getInstance()->changeWidgetSize(this->m_showImage->size());
+ m_firstChangeSize = false;
+ }
+ // return QWidget::resizeEvent(event);
}
//滚轮放大缩小
bool ShowImageWidget::eventFilter(QObject *obj, QEvent *event)
{
- //滚轮进行放大缩小图片
- if (obj == m_showImage) {
- if (event->type() == QEvent::Wheel) {
- QWheelEvent *wheelEvent = static_cast(event);
- if (m_isOpenSuccess) {
- if (displayMode != DisplayMode::NormalMode) {
- return QObject::eventFilter(obj, event);
- }
- QPoint zoomFocus = wheelEvent->pos();
- if (wheelEvent->angleDelta().y() > 0) {
- m_addOrreduce = true;
- Q_EMIT enlargeChange(zoomFocus);
- } else {
- m_addOrreduce = false;
- Q_EMIT reduceChange(zoomFocus);
- }
- }
- }
- }
- //滚轮进行放大缩小图片
- if (obj == m_showImageQml) {
- if (event->type() == QEvent::Wheel) {
- QWheelEvent *wheelEvent = static_cast(event);
- if (m_isOpenSuccess) {
- if (displayMode != DisplayMode::NormalMode) {
- return QObject::eventFilter(obj, event);
- }
- QPoint zoomFocus = wheelEvent->pos();
- if (wheelEvent->angleDelta().y() > 0) {
- m_addOrreduce = true;
- Q_EMIT enlargeChange(zoomFocus);
- } else {
- m_addOrreduce = false;
- Q_EMIT reduceChange(zoomFocus);
- }
- }
- }
- }
//裁剪后使qmenu隐藏
if (displayMode != DisplayMode::NormalMode) {
m_imageMenu->hide();
}
return QObject::eventFilter(obj, event);
}
+
//裁剪的工具栏按钮样式设置
void ShowImageWidget::cutBtnWidStyle()
{
-
-
m_save->setStyleSheet(
"QPushButton{border:0px;border-radius:4px;background:transparent;border-image: url(:/res/res/save.png);}"
"QPushButton::hover{border:0px;border-radius:4px;background:transparent;border-image: "
@@ -957,6 +1057,308 @@ int ShowImageWidget::makeSureHeightState()
return widHeight;
}
+void ShowImageWidget::initQmlObject()
+{
+ //设置位置和大小
+ m_showImageQml = new QQuickWidget(this);
+ QQmlEngine *engine = m_showImageQml->engine();
+ engine->addImageProvider(QLatin1String("thumb"), new ScreenImageProvider);
+ m_showImageQml->setSource(QUrl(QStringLiteral("qrc:/showImageComponent.qml")));
+
+ m_showImageQml->setClearColor(Qt::transparent);
+ m_showImageQml->installEventFilter(this);
+ m_showImageQml->setContextMenuPolicy(Qt::ActionsContextMenu);
+ m_showImageQml->setContextMenuPolicy(Qt::CustomContextMenu);
+ m_showImageQml->lower();
+
+ m_qmlObj = new QObject(this);
+ m_qmlObj = m_showImageQml->rootObject();
+ QObject::connect(m_qmlObj, SIGNAL(sendDropImagePath(QVariant)), this, SLOT(getDropImagePath(QVariant)));
+ QObject::connect(m_qmlObj, SIGNAL(changeImage(QVariant)), this, SLOT(needChangeImage(QVariant)));
+ QObject::connect(m_qmlObj, SIGNAL(doubleSignal()), this, SIGNAL(doubleEventToMainWid()));
+
+ connect(Interaction::getInstance(), &Interaction::getLeftUpPosAccordingImage, this, &ShowImageWidget::setImagePos);
+ changeQmlSizePos(this->width(), this->height(), 0, 0);
+}
+
+void ShowImageWidget::initQWidgetObject()
+{
+ //中间展示图片部分
+ m_showImage = new QLabel(this);
+ m_showImage->resize(this->width(), this->height());
+ m_showImage->move(int((this->width() - m_showImage->width()) / 2),
+ int((this->height() - m_showImage->height()) / 2));
+ m_showImage->setMouseTracking(true);
+ m_showImage->installEventFilter(this);
+ m_showImage->setAlignment(Qt::AlignCenter);
+ m_showImage->setContextMenuPolicy(Qt::ActionsContextMenu);
+ m_showImage->setContextMenuPolicy(Qt::CustomContextMenu);
+ m_showImage->hide();
+}
+
+void ShowImageWidget::initMenu()
+{
+ //菜单栏给功能选项:复制,设置为桌面壁纸,设置为锁屏壁纸,打印,删除,在文件夹中显示
+ m_copy = new QAction(tr("Copy"), this);
+ m_reName = new QAction(tr("Rename"), this);
+ m_setDeskPaper = new QAction(tr("Set Desktop Wallpaper"), this);
+ m_setLockPaper = new QAction(tr("Set Lock Wallpaper"), this);
+ m_print = new QAction(tr("Print"), this);
+ m_deleteImage = new QAction(tr("Delete"), this);
+ m_showInFile = new QAction(tr("Show in File"), this);
+ m_saveAs = new QAction(tr("Save as"), this);
+ m_signImage = new QAction(tr("Markup"), this);
+ //右键菜单
+ m_imageMenu = new QMenu();
+ m_imageMenu->addAction(m_copy);
+ // m_imageMenu->addAction(m_reName);
+ // m_imageMenu->addAction(m_setDeskPaper);
+ // imageMenu->addAction(setLockPaper);
+ m_imageMenu->addAction(m_print);
+ m_imageMenu->addAction(m_deleteImage);
+ m_imageMenu->addAction(m_signImage);
+ m_imageMenu->addAction(m_saveAs);
+ m_imageMenu->addAction(m_showInFile);
+}
+
+void ShowImageWidget::initCutWid()
+{
+ m_cutWid = new CutWIdget(this);
+ m_cutWid->hide();
+ //需要将这个widget移动到showimagewidget内
+ m_btnWid = new QWidget(this);
+ m_btnWid->hide();
+ m_btnWid->setFixedSize(108, 40);
+ m_cancel = new QPushButton(m_btnWid);
+ m_save = new QPushButton(m_btnWid);
+ m_cancel->setFixedSize(24, 24);
+ m_save->setFixedSize(24, 24);
+ m_cancel->move(20, 8);
+ m_save->move(30 + m_cancel->width() + 8, 8);
+ m_save->setToolTip(tr("Save"));
+ m_cancel->setToolTip(tr("Cancel"));
+ cutBtnWidStyle();
+ m_btnWid->move((this->width() - m_btnWid->width()) / 2, this->height() - m_btnWid->height() - 8);
+}
+
+void ShowImageWidget::initChangeImageBtn()
+{
+ //上一张,下一张按钮
+ g_next = new QPushButton(this);
+ g_next->resize(IMAGE_BUTTON);
+ g_next->setToolTip(tr("Next"));
+
+ g_back = new QPushButton(this);
+ g_back->resize(IMAGE_BUTTON);
+ g_back->setToolTip(tr("Previous"));
+
+ g_back->move(LEFT_POS, int((this->height() - g_back->height()) / 2));
+ g_next->move(this->width() - LEFT_POS - g_next->width(), int((this->height() - g_next->height()) / 2));
+
+ g_back->setIconSize(IMAGE_ICON);
+ g_next->setIconSize(IMAGE_ICON);
+
+ g_back->setFocusPolicy(Qt::NoFocus);
+ g_next->setFocusPolicy(Qt::NoFocus);
+ g_back->setFlat(true);
+ g_next->setFlat(true);
+ g_back->setStyleSheet("QPushButton{border:none;background-color:transparent;border-radius:4px;}");
+ g_next->setStyleSheet("QPushButton{border:none;background-color:transparent;border-radius:4px;}");
+}
+
+void ShowImageWidget::initOcrWid()
+{
+ m_ocrWid = new OCRResultWidget(this);
+ m_ocrWid->hide();
+ m_ocrBtnWid = new QWidget(this);
+ m_ocrBtnWid->hide();
+ m_ocrBtnWid->setFixedSize(148, 40);
+ m_ocrCancel = new QPushButton(m_ocrBtnWid);
+ // m_ocrCancel->setIcon(QIcon::fromTheme("ukui-start-symbolic"));
+ m_ocrCancel->move(20, 8);
+ m_ocrCancel->setFocusPolicy(Qt::NoFocus); //设置焦点类型
+ m_ocrCancel->setProperty("isWindowButton", 0x1);
+ m_ocrCancel->setProperty("useIconHighlightEffect", 0x2);
+ m_ocrCancel->setFlat(true);
+ m_ocrCancel->setFixedSize(24, 24);
+ m_ocrCancel->setToolTip(tr("Cancel"));
+ m_ocrCancel->setIcon(QIcon(":/res/res/ocrCancel_W.png"));
+ m_ocrExportToTxt = new QPushButton(m_ocrBtnWid);
+ m_ocrExportToTxt->setText(tr("Export"));
+ m_ocrExportToTxt->setProperty("isWindowButton", 0x1);
+ m_ocrExportToTxt->setProperty("useIconHighlightEffect", 0x2);
+ m_ocrExportToTxt->setFlat(true);
+ m_ocrExportToTxt->setFixedSize(60, 24);
+ m_ocrExportToTxt->move(64, 8);
+ m_ocrExportToTxt->setEnabled(false);
+}
+
+void ShowImageWidget::changeQmlSizePos(int w, int h, int x, int y)
+{
+ m_qmlObj->setProperty(IMAGE_WIDTH.toLatin1().data(), w);
+ m_qmlObj->setProperty(IMAGE_HEIGHT.toLatin1().data(), h);
+ m_qmlObj->setProperty(IMAGE_X.toLatin1().data(), x);
+ m_qmlObj->setProperty(IMAGE_Y.toLatin1().data(), y);
+}
+
+void ShowImageWidget::setImagePos(QPointF leftUpPos)
+{
+ QObject *qmlImageRect;
+ if (!getQmlObjAndJudgeNullptr(m_qmlObj, &qmlImageRect)) {
+ return;
+ }
+ if (qmlImageRect->property(IMAGE_TYPE.toLatin1().data()) == 0) {
+
+ QObject *imageLoader;
+ QObject *imageItemLower;
+ if (!getQmlObjAndJudgeNullptr(m_qmlObj, &qmlImageRect, 0, &imageLoader, &imageItemLower)) {
+ return;
+ }
+ QMetaObject::invokeMethod(imageItemLower, IMAGE_FUNC_NAVICHANGEIMAGEPOS.toLatin1().data(),
+ Q_ARG(QVariant, leftUpPos));
+ } else {
+ QObject *imageLoader;
+ QObject *imageItemLower;
+ if (!getQmlObjAndJudgeNullptr(m_qmlObj, &qmlImageRect, 1, &imageLoader, &imageItemLower)) {
+ return;
+ }
+ QMetaObject::invokeMethod(imageItemLower, IMAGE_FUNC_NAVICHANGEIMAGEPOS.toLatin1().data(),
+ Q_ARG(QVariant, leftUpPos));
+ }
+}
+
+bool ShowImageWidget::getQmlObjAndJudgeNullptr(QObject *objParent, QObject **objFirst, int isNormal,
+ QObject **objSecond, QObject **objThird, QObject **objFourth)
+{
+
+ if (objParent == nullptr) {
+ qDebug() << "父对象为空";
+ return false;
+ }
+
+ QObject *tmpFirst = objParent->findChild("imageItem");
+ if (tmpFirst == nullptr) {
+ qDebug() << "imageItem对象为空";
+ return false;
+ }
+ *objFirst = tmpFirst;
+
+ if (isNormal == -1) {
+ return true;
+ }
+
+ tmpFirst->setProperty(IMAGE_TYPE.toLatin1().data(), isNormal);
+
+ QObject *tmpSecond = tmpFirst->findChild("imageLoader");
+ if (tmpSecond == nullptr) {
+ qDebug() << "imageLoader对象为空";
+ return false;
+ }
+ *objSecond = tmpSecond;
+
+ QObject *tmpThird;
+ if (!isNormal) {
+ tmpThird = tmpSecond->findChild("imageItemLower");
+ } else {
+ tmpThird = tmpSecond->findChild("movieItemLower");
+ }
+ if (tmpThird == nullptr) {
+ qDebug() << "movieItemLower/imageItemLower对象为空" << isNormal;
+ return false;
+ }
+ *objThird = tmpThird;
+
+ QObject *tmpFourth = tmpThird->findChild("image");
+ if (tmpFourth == nullptr) {
+ qDebug() << "image对象为空";
+ return false;
+ }
+
+ if (objFourth != nullptr) {
+ *objFourth = tmpFourth;
+ }
+
+ return true;
+}
+
+void ShowImageWidget::realBuriedPoint()
+{
+ //缩放图片-埋点
+ kdk::kabase::BuriedPoint buriedPointZoomInandOut;
+ if (buriedPointZoomInandOut.functionBuriedPoint(kdk::kabase::AppName::KylinPhotoViewer,
+ kdk::kabase::BuriedPoint::PT::KylinPhotoViewerCurrentPointZoom)) {
+ qCritical() << "buried point fail CurrentPointZoom!";
+ }
+}
+
+void ShowImageWidget::zoomBuriedPoint()
+{
+ if (m_timer->isActive()) {
+ return;
+ }
+ m_timer->start(1000);
+}
+
+void ShowImageWidget::needCloseNavigator()
+{
+ Q_EMIT toCloseNavigator(QPixmap());
+}
+
+void ShowImageWidget::needUpdateImagePosFromMainWid(bool needUpdate)
+{
+ m_needUpdateImagePosFromMainWid = needUpdate;
+}
+
+void ShowImageWidget::needChangeImage(QVariant needChangeImage)
+{
+ if (displayMode != DisplayMode::NormalMode) {
+ return;
+ }
+ m_canSet = true;
+ if (needChangeImage.toBool()) {
+ Interaction::getInstance()->backImage();
+ } else {
+ Interaction::getInstance()->nextImage();
+ }
+}
+
+void ShowImageWidget::noticeQmlAdjustImagePos()
+{
+
+ QObject *qmlImageRect;
+ if (!getQmlObjAndJudgeNullptr(m_qmlObj, &qmlImageRect)) {
+ return;
+ }
+ if (qmlImageRect->property(IMAGE_TYPE.toLatin1().data()) == 0) {
+
+ QObject *imageLoader;
+ QObject *imageItemLower;
+ if (!getQmlObjAndJudgeNullptr(m_qmlObj, &qmlImageRect, 0, &imageLoader, &imageItemLower)) {
+ return;
+ }
+ QMetaObject::invokeMethod(imageItemLower, IMAGE_FUNC_ADJUSTIMAGEPOS.toLatin1().data());
+ } else {
+ QObject *imageLoader;
+ QObject *imageItemLower;
+ if (!getQmlObjAndJudgeNullptr(m_qmlObj, &qmlImageRect, 1, &imageLoader, &imageItemLower)) {
+ return;
+ }
+ QMetaObject::invokeMethod(imageItemLower, IMAGE_FUNC_ADJUSTIMAGEPOS.toLatin1().data());
+ }
+}
+void ShowImageWidget::showNavigator(QVariant scale, QVariant leftUpImageX, QVariant leftUpImageY, QVariant visibleWidth,
+ QVariant visibleHeight)
+{
+ if (!m_needUpdateImagePosFromMainWid) {
+ return;
+ }
+ //给后端发送缩放比和鼠标位置左上角坐标
+ Interaction::getInstance()->qmlStartNaviDisplay(QPointF(leftUpImageX.toDouble(), leftUpImageY.toDouble()),
+ QSizeF(visibleWidth.toDouble(), visibleHeight.toDouble()),
+ scale.toDouble());
+ Q_EMIT needGrabGestureOut(false);
+}
+
void ShowImageWidget::navigatorState(bool state)
{
m_navigatorState = state;
@@ -968,12 +1370,7 @@ void ShowImageWidget::navigatorMove(bool isDrageImage)
}
void ShowImageWidget::changeQmlcomponentColor(QColor color, double opacity)
{
- QObject *qmlObj = m_showImageQml->rootObject();
- qmlObj->setProperty("color", color);
- // QPalette pal(this->palette());
- // pal.setColor(QPalette::Window, QColor(color));
- // this->setPalette(pal);
- // qmlObj->setProperty("opacity", opacity);
+ m_qmlObj->setProperty(IMAGE_COLOR.toLatin1().data(), color);
}
//裁剪的工具栏窗口样式设置
void ShowImageWidget::cutBtnWidChange(QString themeTyep)
@@ -981,9 +1378,11 @@ void ShowImageWidget::cutBtnWidChange(QString themeTyep)
if ("ukui-dark" == themeTyep || "ukui-black" == themeTyep) {
m_btnWid->setStyleSheet("QWidget{background-color:rgba(0,0,0,0.72);border-radius:6px;}");
m_ocrBtnWid->setStyleSheet("QWidget{background-color:rgba(0,0,0,0.72);border-radius:6px;}");
+ m_ocrCancel->setIcon(QIcon(":/res/res/ocrCancel_B.png"));
} else {
m_btnWid->setStyleSheet("QWidget{background-color:rgba(255, 255, 255, 1);border-radius:6px;}");
m_ocrBtnWid->setStyleSheet("QWidget{background-color:rgba(255, 255, 255, 1);border-radius:6px;}");
+ m_ocrCancel->setIcon(QIcon(":/res/res/ocrCancel_W.png"));
}
}
//备用-目前不需要-以后可能会用到
diff --git a/src/view/showimagewidget.h b/src/view/showimagewidget.h
index 1179f43..41b2be9 100644
--- a/src/view/showimagewidget.h
+++ b/src/view/showimagewidget.h
@@ -22,9 +22,12 @@
#include
#include
#include
+#include
#include "imageproviderthumb.h"
#include "ocrresultwidget.h"
#include
+
+
class ShowImageWidget : public QWidget
{
Q_OBJECT
@@ -66,6 +69,19 @@ public Q_SLOTS:
void navigatorMove(bool isDrageImage);
void copy(); //复制
void updateImagePath(QString newImagePath); //更新改名后的图片路径
+
+ void setScale(QVariant scale);
+ void getDropImagePath(QVariant pathUrl);
+ void operatyImage();
+ void showNavigator(QVariant scale, QVariant leftUpImageX, QVariant leftUpImageY, QVariant visibleWidth,
+ QVariant visibleHeight);
+ void needCloseNavigator();
+ void needUpdateImagePosFromMainWid(bool needUpdate);
+ void needChangeImage(QVariant needChangeImage);
+ void noticeQmlAdjustImagePos();
+ void zoomBuriedPoint();
+
+
private:
QMessageBox *m_msg;
QMessageBox *m_queryMsg;
@@ -102,7 +118,7 @@ private:
double m_actualWidth = 0;
double m_actualHeight = 0;
bool m_addOrreduce = true;
- QPixmap m_backPic = QPixmap(); //记录前一次后端发送的图片
+
QSize m_displaySizeOfPicture; //正在显示的图片的尺寸,仅指大小不超过窗口的,默认以左上角为缩放起始点的图片
QPointF m_actualClickPos;
@@ -115,15 +131,18 @@ private:
int m_proportion = 100; //缩放比例-默认为100
bool m_navigatorState = false; //记录导航栏状态,默认为false
bool m_isDragImage = false; //是拖拽图片的动作
- bool m_movieImage = true; //是否是动图,默认不是
+ bool m_movieImage = false; //是否是动图,默认不是
void initInteraction();
void openFinish(QVariant var); //打开结束
void initConnect();
- void sideState(int num); //需要根据条件判断侧栏的显示和大小相关信息
- bool imageNum(int number); //根据num决定界面显示
- bool imageNUll(QPixmap pixmap); //根据图片是否为空,显示转圈圈
+ void sideState(int num); //需要根据条件判断侧栏的显示和大小相关信息
+ bool imageNum(int number); //根据num决定界面显示
+ void imageNUll(); //根据图片是否为空,显示转圈圈
+ void showMovieImage(); //显示动图
+ bool operatorBeforeShowImage(QPixmap pixmap);
void imageMenu(QFileInfo info, QString imageSize, QString colorSpace); //根据图片类型刷新右键菜单内容
+
//右键菜单的各功能
void setDeskPaper(); //设置为桌面壁纸
@@ -146,7 +165,7 @@ private:
void ocrMode(); //调整到ocr模式对应样式
- void resizeEvent(QResizeEvent *event);
+ void resizeEvent(QResizeEvent *event) override;
bool eventFilter(QObject *obj, QEvent *event);
QWidget *m_btnWid = nullptr;
QPushButton *m_cancel = nullptr;
@@ -165,6 +184,43 @@ private:
int makeSureHeightState();
int m_widChangeHeight;
+ bool m_firstChangeSize = true; //首次启动时变更大小,默认为true
+
+
+ QObject *m_qmlObj = nullptr;
+ // QObject *m_qmlImageRect = nullptr;
+ // QObject *m_imageLoderItem = nullptr;
+
+ // QObject *m_imageLoader = nullptr;
+ // QObject *m_imageItemLower = nullptr;
+ // QObject *m_targatImage = nullptr;
+
+ QString m_backImagePath = "";
+ void initQmlObject();
+ void initQWidgetObject();
+ void initMenu();
+ void initCutWid();
+ void initChangeImageBtn();
+ void initOcrWid();
+ void changeQmlSizePos(int w, int h, int x, int y);
+ bool m_recordMovieBefore = false; //记录上一次是否是动图
+ void setImagePos(QPointF leftUpPos);
+
+ bool m_needUpdateImagePosFromMainWid = true; //显示导航栏时,是否向后端发送位置更新导航栏显示
+
+
+ QList m_imagePageList; //图片的页数列表
+ QWidget *m_imagePageWid = nullptr; //图片显示页
+ QPushButton *m_leftPageBtn = nullptr;
+ QPushButton *m_rightPageBtn = nullptr;
+ QLabel *m_pageNum = nullptr;
+ QHBoxLayout *m_pageLayout = nullptr;
+ bool getQmlObjAndJudgeNullptr(QObject *objParent, QObject **objFirst, int isNormal = -1,
+ QObject **objSecond = nullptr, QObject **objThird = nullptr,
+ QObject **objFourth = nullptr);
+ QTimer *m_timer;
+ void realBuriedPoint();
+
Q_SIGNALS:
void perRate(QString num, QString path); //改变工具栏的缩小的百分比
void toShowImage(); //告诉主界面需要show和hide的控件
@@ -189,6 +245,11 @@ Q_SIGNALS:
void viewExitOCRMode();
void startWayToSetTitleStyle(); //从相册打开看图
void sendSuffixToToolbar(QString suffix);
+ void decideMainWidDisplay(bool isDefaultDisplay); //确定主界面显示状态
+
+ void needGrabGestureOut(bool needGrabGestureOut);
+ void toCloseNavigator(QPixmap image);
+ void doubleEventToMainWid();
};
#endif // SHOWIMAGEWIDGET_H
diff --git a/src/view/sizedate.h b/src/view/sizedate.h
index 0ce1bc3..e86ea71 100644
--- a/src/view/sizedate.h
+++ b/src/view/sizedate.h
@@ -3,6 +3,7 @@
#include
#include
#include
+#include
static const int DEFAULT_WIDTH = 1080; //主界面默认宽度
static const int DEFAULT_HEIGHT = 720; //主界面默认高度
static const int DEFAULT_HORIZONTAL_WIDTH = 1920; //主界面横屏默认宽度
@@ -72,4 +73,33 @@ static const QStringList SIGN_APP_NOT_SUPPORT = {"ras", "tga", "sr", "jng",
"jp2", "psd", "j2k", "apng"}; //画图软件不支持的格式
static const QStringList MOVIE_IMAGE_FORMAT = {"apng", "gif"}; //动图
static const QStringList OCR_SUPPORT = {"png", "jpg"}; // ocr支持的格式
-#endif // SIZEDATE_H
+
+// qml方法和属性名
+static const QString IMAGE_SOURCE = "source";
+static const QString IMAGE_X = "x";
+static const QString IMAGE_Y = "y";
+static const QString IMAGE_WIDTH = "width";
+static const QString IMAGE_HEIGHT = "height";
+static const QString IMAGE_TYPE = "imageType";
+static const QString IMAGE_NEW_LOADED = "newImageLoaded";
+static const QString IMAGE_COLOR = "color";
+
+static const QString IMAGE_FUNC_OPERATE = "operateImage";
+static const QString IMAGE_FUNC_CHANGESCALE = "changeScale";
+static const QString IMAGE_FUNC_POSRESET = "imagePostionReset";
+static const QString IMAGE_FUNC_SENDSCALE = "sendScaleFirstTime";
+static const QString IMAGE_FUNC_SETSOURCE = "setSource";
+static const QString IMAGE_FUNC_GETLEFTUPPOSACCORDWID_X = "getLeftUpPosAccordingWidX";
+static const QString IMAGE_FUNC_GETLEFTUPPOSACCORDWID_Y = "getLeftUpPosAccordingWidY";
+static const QString IMAGE_FUNC_GETVISIBLESIZEACCORDWID_W = "getVisibleSizeAccordingWidW";
+static const QString IMAGE_FUNC_GETVISIBLESIZEACCORDWID_H = "getVisibleSizeAccordingWidH";
+
+static const QString IMAGE_FUNC_GETLEFTUPPOSACCORDIMAGE_X = "getLeftUpPosAccordingImageX";
+static const QString IMAGE_FUNC_GETLEFTUPPOSACCORDIMAGE_Y = "getLeftUpPosAccordingImageY";
+
+static const QString IMAGE_FUNC_NAVICHANGEIMAGEPOS = "operateNavigatorChangeImagePos";
+
+static const QString IMAGE_FUNC_ADJUSTIMAGEPOS = "adjustImagePostion";
+
+static const QString IMAGE_FUNC_UPDATE_POS_ACCORD_WIDSIZE_CHANGE = "updatePosAccordingToWidSizeChange";
+#endif // SIZEDATE_H
diff --git a/src/view/toolbar.cpp b/src/view/toolbar.cpp
index d3f0cce..48685e5 100644
--- a/src/view/toolbar.cpp
+++ b/src/view/toolbar.cpp
@@ -244,70 +244,88 @@ void ToolBar::changePerRate(QString num, QString path)
{
this->m_percentage->setText(num);
m_imagePath = path;
-}
-//缩小
-void ToolBar::reduceImage(QPoint focus)
-{
-
- Interaction::getInstance()->watchSmallImage(focus);
-}
-//放大
-void ToolBar::enlargeImage(QPoint focus)
-{
- Interaction::getInstance()->watchBigImage(focus);
+ m_percentage->setToolTip(num);
}
void ToolBar::reduceImageSlot()
{
- reduceImage();
+ operayteMode = OperayteMode::ZoomOut;
+ Q_EMIT startZoomImage();
+ //缩放图片-埋点
+ kdk::kabase::BuriedPoint buriedPointZoomInandOut;
+ if (buriedPointZoomInandOut.functionBuriedPoint(kdk::kabase::AppName::KylinPhotoViewer,
+ kdk::kabase::BuriedPoint::PT::KylinPhotoViewerZoomInandOut)) {
+ qCritical() << "buried point fail ZoomInandOut!";
+ }
}
void ToolBar::enlargeImageSlot()
{
- enlargeImage();
+ operayteMode = OperayteMode::ZoomIn;
+ Q_EMIT startZoomImage();
+ //缩放图片-埋点
+ kdk::kabase::BuriedPoint buriedPointZoomInandOut;
+ if (buriedPointZoomInandOut.functionBuriedPoint(kdk::kabase::AppName::KylinPhotoViewer,
+ kdk::kabase::BuriedPoint::PT::KylinPhotoViewerZoomInandOut)) {
+ qCritical() << "buried point fail ZoomInandOut!";
+ }
}
//原始大小
void ToolBar::originalSize()
{
+ operayteMode = OperayteMode::LifeSize;
Interaction::getInstance()->watchOriginalImage();
}
//适应窗口
void ToolBar::adaptiveWidget()
{
+ operayteMode = OperayteMode::Window;
Interaction::getInstance()->watchAutoImage();
}
//旋转
void ToolBar::rotate()
{
if (platForm.contains(Variable::platForm)) {
+ operayteMode = OperayteMode::RotateN;
Interaction::getInstance()->rotate(false);
} else {
+ operayteMode = OperayteMode::RotateS;
Interaction::getInstance()->rotate();
}
}
//水平镜像
void ToolBar::flipH()
{
+ operayteMode = OperayteMode::FlipH;
Interaction::getInstance()->flipH();
}
//垂直镜像
void ToolBar::flipV()
{
+ operayteMode = OperayteMode::FlipV;
Interaction::getInstance()->flipV();
}
//裁剪
void ToolBar::cutImage()
{
- Interaction::getInstance()->cutImage();
+ operayteMode = OperayteMode::Cut;
+ // Interaction::getInstance()->cutImage();
Q_EMIT hideTwoBar();
Q_EMIT startCutting();
m_sidebar->setChecked(false);
m_information->setChecked(false);
+ //裁剪-埋点
+ kdk::kabase::BuriedPoint buriedPointCutting;
+ if (buriedPointCutting.functionBuriedPoint(kdk::kabase::AppName::KylinPhotoViewer,
+ kdk::kabase::BuriedPoint::PT::KylinPhotoViewerCutting)) {
+ qCritical() << "buried point fail Cutting!";
+ }
}
//获取图片中文字
void ToolBar::getText()
{
+ operayteMode = OperayteMode::Ocr;
Interaction::getInstance()->getText();
// Q_EMIT startGetText();
Q_EMIT viewOCRMode();
diff --git a/src/view/toolbar.h b/src/view/toolbar.h
index 58a97c0..c7431d7 100644
--- a/src/view/toolbar.h
+++ b/src/view/toolbar.h
@@ -23,11 +23,9 @@ public:
explicit ToolBar(QWidget *parent = nullptr);
void updateFileInfo(QFileInfo fileInfo);
void changePerRate(QString num, QString path);
- void reduceImage(QPoint focus = QPoint()); //缩小图片
- void enlargeImage(QPoint focus = QPoint()); //放大图片
- void reduceImageSlot(); //缩小图片
- void enlargeImageSlot(); //放大图片
- void delImage(); //删除
+ void reduceImageSlot(); //缩小图片
+ void enlargeImageSlot(); //放大图片
+ void delImage(); //删除
void changeStyle();
void setButtonState(bool isOpenSuccess, bool isCanOperate); //设置工具栏按钮是否可点击--图片是否打开成功
QFrame *g_tooleWid; //布局
@@ -100,8 +98,9 @@ Q_SIGNALS:
void setFontSizeSignal(int); //字体变化
void hideTwoBar(); //两栏隐藏,进入裁剪模式
void startCutting();
- void viewOCRMode(); // 通知view进入OCR模式
- void startGetText(); //通知showimagewidget做OCR模式对应的样式变换
+ void viewOCRMode(); // 通知view进入OCR模式
+ void startGetText(); //通知showimagewidget做OCR模式对应的样式变换
+ void startZoomImage(); //通知界面进行缩放图片
};
#endif // TOOLBAR_H
diff --git a/translations/kylin-photo-viewer_zh_HK.qm b/translations/kylin-photo-viewer_zh_HK.qm
new file mode 100644
index 0000000..3d4bb34
Binary files /dev/null and b/translations/kylin-photo-viewer_zh_HK.qm differ
diff --git a/translations/kylin-photo-viewer_zh_HK.ts b/translations/kylin-photo-viewer_zh_HK.ts
new file mode 100644
index 0000000..8d672e2
--- /dev/null
+++ b/translations/kylin-photo-viewer_zh_HK.ts
@@ -0,0 +1,483 @@
+
+
+
+
+ Core
+
+
+
+ 添加圖片
+
+
+
+ Information
+
+
+ 信息
+
+
+
+
+ 信息
+
+
+
+
+ 名稱
+
+
+
+
+ 類型
+
+
+
+
+ 大小
+
+
+
+
+ 尺寸
+
+
+
+
+ 顏色空間
+
+
+
+
+ 創建時間
+
+
+
+
+ 修改時間
+
+
+
+ 格式
+
+
+
+ 大小
+
+
+
+ 尺寸
+
+
+
+ 颜色空间
+
+
+
+ 创建时间
+
+
+
+ 修改时间
+
+
+
+ KyView
+
+
+ 麒麟看图
+
+
+
+
+ 圖片
+
+
+
+
+
+
+ 全屏
+
+
+
+
+
+
+
+ 恢復
+
+
+
+ OpenImage
+
+
+
+ 載入圖片
+
+
+
+
+ 打開圖片
+
+
+
+
+ 圖片類型(
+
+
+
+ Open Image
+
+
+
+ Image Files(
+
+
+
+ ShowImageWidget
+
+
+
+ 複製
+
+
+
+
+ 重新命名
+
+
+
+
+ 設置爲桌面壁紙
+
+
+
+
+ 設置爲鎖屏壁紙
+
+
+
+
+ 打印
+
+
+
+
+ 刪除
+
+
+
+
+ 在文件夾中顯示
+
+
+
+
+ 另存為
+
+
+
+
+ 下一張
+
+
+
+
+ 上一張
+
+
+
+
+ 保存
+
+
+
+
+ 取消
+
+
+
+
+
+
+
+ 警告
+
+
+
+
+ 保存 失敗,名字不能以“.”開頭。
+
+
+
+
+ 是否保存對此圖片的更改?
+
+
+
+ 保存失败。
+
+
+
+
+
+ 非法文件名
+
+
+
+ TitleBar
+
+
+ 麒麟看图
+
+
+
+
+ 圖片
+
+
+
+
+ 最小化
+
+
+
+
+ 全屏
+
+
+
+
+ 關閉
+
+
+
+
+
+
+
+
+
+ 警告
+
+
+
+
+ 此文件將被隱藏(名稱以“.”開頭的將是隱藏的文件。)
+
+
+
+
+ 非法文件名
+
+
+
+
+ 文件不存在(或已被刪除)!
+
+
+
+
+ 這個名字已被佔用,請再選一個!
+
+
+
+
+ 這是一個只讀文件,請在操作前修改權限!
+
+
+
+
+ 其他錯誤,重命名失敗!
+
+
+
+ 最大化
+
+
+
+ 还原
+
+
+
+ ToolBar
+
+
+
+ 縮小
+
+
+
+
+ 查看比例
+
+
+
+
+ 放大
+
+
+
+
+ 原圖大小
+
+
+
+
+ 適應窗口
+
+
+
+
+ 向右旋轉
+
+
+
+
+ 水平翻轉
+
+
+
+
+ 垂直翻轉
+
+
+
+
+ 裁剪
+
+
+
+ 裁剪
+
+
+
+
+ 側 欄
+
+
+
+
+ 信息
+
+
+
+ 原始尺寸
+
+
+
+ 图片适应窗口
+
+
+
+ 旋转
+
+
+
+ 水平镜像
+
+
+
+ 垂直镜像
+
+
+
+ 侧栏
+
+
+
+ 信息
+
+
+
+
+ 刪除
+
+
+
+ menuModule
+
+
+ 服务与支持团队:
+
+
+
+
+
+ 版本號:
+
+
+
+
+ 可以快速打開常見格式的系統圖片工具。它提供縮放,翻轉和其他處理。
+
+
+
+
+ 菜單
+
+
+
+ 打开..
+
+
+
+
+ 主題
+
+
+
+ 打开...
+
+
+
+
+
+
+ 服務與支持團隊:
+
+
+
+
+
+ 打開
+
+
+
+
+
+ 幫助
+
+
+
+
+
+ 關於
+
+
+
+
+
+ 退出
+
+
+
+
+
+ 圖片
+
+
+
+ 麒麟看图
+
+
+
+
+ 關閉
+
+
+
+ 麒麟看图
+
+
+