├── .gitignore
├── AUTHORS
├── CMakeLists.txt
├── COPYING
├── ChangeLog
├── README
├── doxyfile
├── resources
├── eastereggs.txt
├── icons
│ ├── eog.png
│ ├── eog_os2.ico
│ ├── eog_win.ico
│ └── oxygen
│ │ ├── application-exit.png
│ │ ├── configure-shortcuts.png
│ │ ├── configure-toolbars.png
│ │ ├── configure.png
│ │ ├── dialog-cancel.png
│ │ ├── dialog-ok-apply.png
│ │ ├── dialog-ok.png
│ │ ├── document-open-folder.png
│ │ ├── document-open-recent.png
│ │ ├── document-open.png
│ │ ├── document-print.png
│ │ ├── document-properties.png
│ │ ├── document-save.png
│ │ ├── edit-clear.png
│ │ ├── edit-delete.png
│ │ ├── edit-rename.png
│ │ ├── folder-open.png
│ │ ├── go-down.png
│ │ ├── go-first.png
│ │ ├── go-jump.png
│ │ ├── go-last.png
│ │ ├── go-next.png
│ │ ├── go-previous.png
│ │ ├── go-up.png
│ │ ├── help-about.png
│ │ ├── image-x-generic.png
│ │ ├── index.theme
│ │ ├── list-add.png
│ │ ├── list-remove.png
│ │ ├── object-flip-horizontal.png
│ │ ├── object-flip-vertical.png
│ │ ├── object-rotate-left.png
│ │ ├── object-rotate-right.png
│ │ ├── preferences-other.png
│ │ ├── show-menu.png
│ │ ├── tools-wizard.png
│ │ ├── video-x-generic.png
│ │ ├── zoom-fit-best.png
│ │ ├── zoom-in.png
│ │ ├── zoom-original.png
│ │ └── zoom-out.png
├── license.txt
├── oxygen.qrc
├── qiviewer.desktop
├── qiviewer.png
├── qiviewer.qrc
├── qiviewer_os2.rc
├── qiviewer_win.rc
└── translators.txt
└── src
├── 3rdparty
└── webp
│ ├── dec
│ ├── bits.c
│ ├── bits.h
│ ├── dsp.c
│ ├── frame.c
│ ├── quant.c
│ ├── tree.c
│ ├── vp8.c
│ ├── vp8i.h
│ ├── webp.c
│ ├── yuv.c
│ └── yuv.h
│ └── webp
│ ├── decode.h
│ ├── decode_vp8.h
│ ├── encode.h
│ └── types.h
├── CMakeLists.txt
├── aboutdialog.cpp
├── aboutdialog.h
├── actiondata.cpp
├── actiondata.h
├── actionsmanager.cpp
├── actionsmanager.h
├── configdialog.cpp
├── configdialog.h
├── defines.h.cmake
├── edittoolbar.cpp
├── edittoolbar.h
├── eggsdialog.cpp
├── eggsdialog.h
├── fileproperties.cpp
├── fileproperties.h
├── fileutils.cpp
├── fileutils.h
├── forms
├── aboutdialog.ui
├── configdialog.ui
├── edittoolbar.ui
├── eggsdialog.ui
├── fileproperties.ui
├── generaloptionspage.ui
├── gotodialog.ui
├── locationpage.ui
├── shortcuteditor.ui
└── toolbarpage.ui
├── generaloptionspage.cpp
├── generaloptionspage.h
├── gotodialog.cpp
├── gotodialog.h
├── imagewidget.cpp
├── imagewidget.h
├── locationpage.cpp
├── locationpage.h
├── main.cpp
├── mainwindow.cpp
├── mainwindow.h
├── mainwindow2.cpp
├── mainwindow2.h
├── mname.h
├── qkeysequencewidget.cpp
├── qkeysequencewidget.h
├── qkeysequencewidget_p.h
├── settings.cpp
├── settings.h
├── shortcuteditor.cpp
├── shortcuteditor.h
├── toolbarpage.cpp
├── toolbarpage.h
├── translations
├── cs.ts
├── el.ts
├── es_AR.ts
├── es_ES.ts
├── pt.ts
└── ru_RU.ts
├── utils.cpp
├── utils.h
├── webpdecoder.cpp
├── webpdecoder.h
├── webpdecoder.h~
├── zoomutils.cpp
└── zoomutils.h
/.gitignore:
--------------------------------------------------------------------------------
1 | build/
2 | Makefile
3 | qiviewer.pro.user*
4 | .directory
5 | icons/.directory
6 | translations/.directory
7 | main.cpp~
8 | qiviewer.pro~
9 | *.cpp~
10 | install/
11 | *.cmake~
12 | *.txt~
13 | CMakeLists.txt.user
14 | Makefile
15 | Makefile.*
16 | build-*
17 |
--------------------------------------------------------------------------------
/AUTHORS:
--------------------------------------------------------------------------------
1 | Core Developer:
2 | Aguilera Dario Ignacio
3 |
4 | Translators:
5 | Aguilera Dario Ignacio
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 2.8)
2 | include(FindPkgConfig)
3 | project(qiviewer)
4 | set(PROJECT_LONGNAME "QIviewer")
5 | set(PROJECT_VERSION "0.7.0")
6 | #prefixes
7 | set(BINDIR ${CMAKE_INSTALL_PREFIX}/bin)
8 | set(DATADIR ${CMAKE_INSTALL_PREFIX}/share)
9 | set(PKGDATADIR ${DATADIR}/qiviewer)
10 | set(XDG_APPS_INSTALL_DIR /usr/share/applications)
11 | message("-- PKGDATADIR: " ${PKGDATADIR})
12 |
13 | # Global CMake options
14 | set(CMAKE_INCLUDE_CURRENT_DIR ON)
15 | SET(CMAKE_AUTOMOC ON)
16 |
17 | #let's give support for c++11
18 | SET(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS} -std=c++11")
19 |
20 | #Lets find Qt
21 | FIND_PACKAGE(Qt4 REQUIRED)
22 | SET(QT_MIN_VERSION 4.8.0)
23 | INCLUDE(FindQt4)
24 | INCLUDE(${QT_USE_FILE})
25 |
26 | option(USE_DEBUGGING "Use debbuging messages" OFF)
27 | IF(USE_DEBUGGING)
28 | MESSAGE("-- Use debbuging messages")
29 | ADD_DEFINITIONS(-DUSE_DEBUGGING)
30 | ENDIF()
31 |
32 | option(USE_DEVELOPING "So, you are programming? good luck" OFF)
33 | IF(USE_DEVELOPING)
34 | MESSAGE("-- Developing")
35 | ADD_DEFINITIONS(-DUSE_DEVELOPING)
36 | ENDIF()
37 |
38 | option(WEBP_SUPPORT "Experimental support of WEBP" OFF)
39 | IF(WEBP_SUPPORT)
40 | MESSAGE("-- Webp support (experimental)")
41 | ADD_DEFINITIONS(-DWEBP_SUPPORT)
42 | ENDIF()
43 |
44 | SET(ICON_THEMES_DEFAULT_FOLDER "/usr/share/icons")
45 |
46 | #busco y agrego cstringutils
47 | #pkg_check_modules(FILEINFO REQUIRED fileinfo>=0.0.1)
48 | #link_directories(${FILEINFO_LIBRARY_DIRS})
49 | #include_directories(${FILEINFO_INCLUDE_DIRS})
50 | #set(LIBS2 ${FILEINFO_LIBRARIES})
51 |
52 | # Add subdirectories
53 | add_subdirectory(src)
54 | #add_subdirectory(src/tests)
55 |
56 | # Testing configuration
57 | #enable_testing()
58 | #set(TEST_LINK_LIBRARIES Qt5::Test)
59 |
60 |
--------------------------------------------------------------------------------
/ChangeLog:
--------------------------------------------------------------------------------
1 | Changelog of Qt-based Image Viewer
2 |
3 | --------------
4 | Version 0.7.0
5 | * Switched to CMake.
6 | * Removed webp support, temporarily
7 |
8 | Version 0.6.0
9 | * Added Russian localization.
10 | * Added Czech localization.
11 | * Added dialog to configure shortcuts.
12 | * Improved the search when editing the tool bar actions.
13 | * Improved edit toolbar dialog.
14 | * Internal code changes.
15 |
16 | Version 0.5.0
17 | * Added a clear list button in the recent files menu.
18 | * Added a print option.
19 | * Added a delete file option.
20 | * Added a move file to option.
21 | * Added a delete file option.
22 | * Added a jump to option
23 | * Added Greek translation
24 | * Added a help option to use in command line
25 | * Added option to set sorting order.
26 | * Added a dialog to config the toolbar.
27 | * Corrected some strings.
28 | * Bug fix. Now the shortcuts still working when the menu bar is hidden.
29 | * Bug fix, Now it loads the es_ES.ts trasnlation
30 |
31 | Version 0.4.0
32 | * Bug fix regarding .pro file.
33 | * Bug fix. Now it load translations on another plataforms.
34 | * Minor bug fixes regarding zoom and file properties dialog.
35 | * Fixed window title bug when tried to open a recent image that that has been moved or deleted.
36 | * Added posibility to move the viewed image with the mouse.
37 | * Added another easter egg.
38 | * Added icons (oxygen theme) for systems without icon theme, such as windows and OS/2
39 | * Added es_ES translation.
40 | * Added webp images support (experimental).
41 |
42 | Version 0.3.2
43 | * Fixed zooming bugs.
44 | * Fixed bug when opening images from command line.
45 | * Changes in about dialog.
46 | * Changes in file properties dialog.
47 | * Changes in configuration dialog.
48 | * Added a total useless egg. Find it!
49 | * Added svg images support.
50 | * Added posibility to flip and turn animated images.
51 | * Added option to set animated movies speed.
52 | * Added lost .desktop file
53 | * Removed shortcuts edit page from config dialog due to several bugs.
54 | * Removed some dialogs.
55 |
56 | Version 0.3.1
57 | * Fixed compiling bug for 4.6.3 Qt version
58 |
59 | Version 0.3.0
60 | * Bug fix. Now File Properties window shows correctly the image's weigth.
61 | * New way to set the shortcuts
62 | * Minor bug fixes
63 | * Now it can make zoom with the mouse wheel
64 | * The way it handles the image and the zoom has been rewritten
65 | * Added recent files menu entry
66 | * Added option to select the background squares size
67 | * Added a slider for zooming
68 | * Added chessBoard background for animated images
69 | * Added save option
70 | * Added recent images menu entry with option to select how many to show
71 | * Added option to show/hide menu bar
72 |
73 | Version 0.2.2
74 | * Added a .desktop file
75 | * Added option to load images from command line
76 |
77 | Version 0.2.1
78 | * Bugfixes
79 |
80 | Version 0.2.0
81 | * Use QPixmap instead QImage, reducing times
82 | * Now it's posible to set the background of images (not animated yet) and choose between two options
83 | * A little bit of code clean up
84 | * A shortcut editor in configuration dialog
85 |
86 | Version 0.1.0
87 | *A complete (at least a %80 ;-) ) rewritten config dialog, with a new way to configure toolbar actions
88 |
89 | Version 0.0.1.1
90 | * added a button to add actions in the config dialog
91 |
92 | Version 0.0.1
93 | * first test release
94 |
--------------------------------------------------------------------------------
/README:
--------------------------------------------------------------------------------
1 | QIviewer - Qt-based Image Viewer
2 |
3 | =Supported formats:
4 | - BMP
5 | - GIF
6 | - JPG
7 | - JPEG
8 | - PNG
9 | - PBM
10 | - PGM
11 | - PPM
12 | - XBM
13 | - XPM
14 |
15 | =Configure:
16 | Prefix is by default /usr/local, you can change it using -DCMAKE_INSTALL_PREFIX=prefix
17 | If you wish to hack in the project, use the option -DUSE_DEVELOPING=ON with cmake
18 |
19 | mkdir build
20 | cd build
21 | cmake .. -DCMAKE_INSTALL_PREFIX=prefix
22 |
23 | =Build:
24 | make
25 |
26 | =Installation
27 | make DESTDIR=destitationdir install
28 |
--------------------------------------------------------------------------------
/resources/eastereggs.txt:
--------------------------------------------------------------------------------
1 | Happy Time
2 | If you want to modify the preferences of the easter eggs, you have to launch qiviewer -e
.
--------------------------------------------------------------------------------
/resources/icons/eog.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/eog.png
--------------------------------------------------------------------------------
/resources/icons/eog_os2.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/eog_os2.ico
--------------------------------------------------------------------------------
/resources/icons/eog_win.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/eog_win.ico
--------------------------------------------------------------------------------
/resources/icons/oxygen/application-exit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/application-exit.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/configure-shortcuts.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/configure-shortcuts.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/configure-toolbars.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/configure-toolbars.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/configure.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/configure.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/dialog-cancel.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/dialog-cancel.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/dialog-ok-apply.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/dialog-ok-apply.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/dialog-ok.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/dialog-ok.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/document-open-folder.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/document-open-folder.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/document-open-recent.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/document-open-recent.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/document-open.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/document-open.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/document-print.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/document-print.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/document-properties.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/document-properties.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/document-save.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/document-save.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/edit-clear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/edit-clear.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/edit-delete.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/edit-delete.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/edit-rename.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/edit-rename.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/folder-open.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/folder-open.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/go-down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/go-down.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/go-first.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/go-first.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/go-jump.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/go-jump.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/go-last.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/go-last.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/go-next.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/go-next.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/go-previous.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/go-previous.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/go-up.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/go-up.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/help-about.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/help-about.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/image-x-generic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/image-x-generic.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/index.theme:
--------------------------------------------------------------------------------
1 | [Icon Theme]
2 | Name=Oxygen
3 | Comment=Oxygen Team
4 | Inherits=default
5 | Directories=16x16
6 |
7 | [16x16]
8 | Size=16
9 |
--------------------------------------------------------------------------------
/resources/icons/oxygen/list-add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/list-add.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/list-remove.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/list-remove.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/object-flip-horizontal.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/object-flip-horizontal.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/object-flip-vertical.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/object-flip-vertical.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/object-rotate-left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/object-rotate-left.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/object-rotate-right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/object-rotate-right.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/preferences-other.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/preferences-other.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/show-menu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/show-menu.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/tools-wizard.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/tools-wizard.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/video-x-generic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/video-x-generic.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/zoom-fit-best.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/zoom-fit-best.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/zoom-in.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/zoom-in.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/zoom-original.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/zoom-original.png
--------------------------------------------------------------------------------
/resources/icons/oxygen/zoom-out.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/icons/oxygen/zoom-out.png
--------------------------------------------------------------------------------
/resources/oxygen.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | icons/oxygen/index.theme
4 | icons/oxygen/dialog-ok.png
5 | icons/oxygen/image-x-generic.png
6 | icons/oxygen/edit-rename.png
7 | icons/oxygen/edit-clear.png
8 | icons/oxygen/edit-delete.png
9 | icons/oxygen/configure-toolbars.png
10 | icons/oxygen/configure-shortcuts.png
11 | icons/oxygen/dialog-ok-apply.png
12 | icons/oxygen/dialog-cancel.png
13 | icons/oxygen/document-open-folder.png
14 | icons/oxygen/preferences-other.png
15 | icons/oxygen/video-x-generic.png
16 | icons/oxygen/document-properties.png
17 | icons/oxygen/document-open-recent.png
18 | icons/oxygen/document-open.png
19 | icons/oxygen/document-save.png
20 | icons/oxygen/document-print.png
21 | icons/oxygen/application-exit.png
22 | icons/oxygen/zoom-in.png
23 | icons/oxygen/zoom-out.png
24 | icons/oxygen/zoom-original.png
25 | icons/oxygen/zoom-fit-best.png
26 | icons/oxygen/object-rotate-right.png
27 | icons/oxygen/object-rotate-left.png
28 | icons/oxygen/object-flip-vertical.png
29 | icons/oxygen/object-flip-horizontal.png
30 | icons/oxygen/help-about.png
31 | icons/oxygen/go-next.png
32 | icons/oxygen/go-first.png
33 | icons/oxygen/go-previous.png
34 | icons/oxygen/go-last.png
35 | icons/oxygen/go-jump.png
36 | icons/oxygen/folder-open.png
37 | icons/oxygen/show-menu.png
38 | icons/oxygen/configure.png
39 | icons/oxygen/tools-wizard.png
40 | icons/oxygen/go-up.png
41 | icons/oxygen/go-down.png
42 | icons/oxygen/list-add.png
43 | icons/oxygen/list-remove.png
44 |
45 |
--------------------------------------------------------------------------------
/resources/qiviewer.desktop:
--------------------------------------------------------------------------------
1 | [Desktop Entry]
2 | Name=QIviewer
3 | Name[es]=QIviewer
4 | Comment=A simple and lightweith image viewer
5 | Comment[es]=Un visor de Imágenes liviano y simple
6 | Comment[pt]=Visualizador de imagens em tecnologia Qt
7 | Exec=qiviewer
8 | StartupNotify=false
9 | Terminal=false
10 | Type=Application
11 | Icon=qiviewer
12 | Categories=Graphics;Viewer;
13 | MimeType=image/bmp;image/gif;image/jpeg;image/jpg;image/pjpeg;image/png;image/tiff;image/x-bmp;image/x-png;image/x-portable-bitmap;image/x-portable-pixmap;
14 |
--------------------------------------------------------------------------------
/resources/qiviewer.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/qiviewer.png
--------------------------------------------------------------------------------
/resources/qiviewer.qrc:
--------------------------------------------------------------------------------
1 |
2 |
3 | qiviewer.png
4 | license.txt
5 | eastereggs.txt
6 | translators.txt
7 |
8 |
9 |
--------------------------------------------------------------------------------
/resources/qiviewer_os2.rc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/qiviewer_os2.rc
--------------------------------------------------------------------------------
/resources/qiviewer_win.rc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/samkpo/qiviewer/538d3adb59c8fec7faf219c850238401c1ea3efc/resources/qiviewer_win.rc
--------------------------------------------------------------------------------
/resources/translators.txt:
--------------------------------------------------------------------------------
1 | Salvador Parra Camacho
2 | Spain-spanish
3 | Neo Kolokotronis (tetris 4)
4 | Greek
5 | Pavel Fric
6 | Czech
7 | Someone i don't know his name
8 | Russian
9 | Sérgio Marques
10 | Portuguese
11 |
--------------------------------------------------------------------------------
/src/3rdparty/webp/dec/bits.c:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Google Inc.
2 | //
3 | // This code is licensed under the same terms as WebM:
4 | // Software License Agreement: http://www.webmproject.org/license/software/
5 | // Additional IP Rights Grant: http://www.webmproject.org/license/additional/
6 | // -----------------------------------------------------------------------------
7 | //
8 | // Boolean decoder
9 | //
10 | // Author: Skal (pascal.massimino@gmail.com)
11 |
12 | #include "bits.h"
13 |
14 | #if defined(__cplusplus) || defined(c_plusplus)
15 | extern "C" {
16 | #endif
17 |
18 | //-----------------------------------------------------------------------------
19 | // VP8BitReader
20 |
21 | void VP8Init(VP8BitReader* const br, const uint8_t* buf, uint32_t size) {
22 | assert(br);
23 | assert(buf);
24 | br->range_ = 255 - 1;
25 | br->buf_ = buf;
26 | br->buf_end_ = buf + size;
27 | // Need two initial bytes.
28 | br->value_ = (VP8GetByte(br) << 8) | VP8GetByte(br);
29 | br->left_ = -8;
30 | br->eof_ = 0;
31 | }
32 |
33 | const uint8_t kVP8Log2Range[128] = {
34 | 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
35 | 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
36 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
37 | 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
38 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
39 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
40 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
41 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
42 | 0
43 | };
44 |
45 | // range = ((range + 1) << kVP8Log2Range[range]) - 1
46 | const uint8_t kVP8NewRange[128] = {
47 | 127, 127, 191, 127, 159, 191, 223, 127, 143, 159, 175, 191, 207, 223, 239,
48 | 127, 135, 143, 151, 159, 167, 175, 183, 191, 199, 207, 215, 223, 231, 239,
49 | 247, 127, 131, 135, 139, 143, 147, 151, 155, 159, 163, 167, 171, 175, 179,
50 | 183, 187, 191, 195, 199, 203, 207, 211, 215, 219, 223, 227, 231, 235, 239,
51 | 243, 247, 251, 127, 129, 131, 133, 135, 137, 139, 141, 143, 145, 147, 149,
52 | 151, 153, 155, 157, 159, 161, 163, 165, 167, 169, 171, 173, 175, 177, 179,
53 | 181, 183, 185, 187, 189, 191, 193, 195, 197, 199, 201, 203, 205, 207, 209,
54 | 211, 213, 215, 217, 219, 221, 223, 225, 227, 229, 231, 233, 235, 237, 239,
55 | 241, 243, 245, 247, 249, 251, 253, 127
56 | };
57 |
58 | //-----------------------------------------------------------------------------
59 | // Higher-level calls
60 |
61 | uint32_t VP8GetValue(VP8BitReader* const br, int bits) {
62 | uint32_t v = 0;
63 | while (bits-- > 0) {
64 | v |= VP8GetBit(br, 0x80) << bits;
65 | }
66 | return v;
67 | }
68 |
69 | int32_t VP8GetSignedValue(VP8BitReader* const br, int bits) {
70 | const int value = VP8GetValue(br, bits);
71 | return VP8Get(br) ? -value : value;
72 | }
73 |
74 | //-----------------------------------------------------------------------------
75 |
76 | #if defined(__cplusplus) || defined(c_plusplus)
77 | } // extern "C"
78 | #endif
79 |
--------------------------------------------------------------------------------
/src/3rdparty/webp/dec/bits.h:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Google Inc.
2 | //
3 | // This code is licensed under the same terms as WebM:
4 | // Software License Agreement: http://www.webmproject.org/license/software/
5 | // Additional IP Rights Grant: http://www.webmproject.org/license/additional/
6 | // -----------------------------------------------------------------------------
7 | //
8 | // Boolean decoder
9 | //
10 | // Author: Skal (pascal.massimino@gmail.com)
11 |
12 | #ifndef WEBP_DEC_BITS_H_
13 | #define WEBP_DEC_BITS_H_
14 |
15 | #include
16 | #include "webp/decode_vp8.h"
17 |
18 | #if defined(__cplusplus) || defined(c_plusplus)
19 | extern "C" {
20 | #endif
21 |
22 | //-----------------------------------------------------------------------------
23 | // Bitreader and code-tree reader
24 |
25 | typedef struct {
26 | const uint8_t* buf_; // next byte to be read
27 | const uint8_t* buf_end_; // end of read buffer
28 | int eof_; // true if input is exhausted
29 |
30 | // boolean decoder
31 | uint32_t range_; // current range minus 1. In [127, 254] interval.
32 | uint32_t value_; // current value
33 | int left_; // how many unused bits (negated)
34 | } VP8BitReader;
35 |
36 | // Initialize the bit reader and the boolean decoder.
37 | void VP8Init(VP8BitReader* const br, const uint8_t* buf, uint32_t size);
38 |
39 | // return the next value made of 'num_bits' bits
40 | uint32_t VP8GetValue(VP8BitReader* const br, int num_bits);
41 | static inline uint32_t VP8Get(VP8BitReader* const br) {
42 | return VP8GetValue(br, 1);
43 | }
44 |
45 | // return the next value with sign-extension.
46 | int32_t VP8GetSignedValue(VP8BitReader* const br, int num_bits);
47 |
48 | // Read a bit with proba 'prob'. Speed-critical function!
49 | extern const uint8_t kVP8Log2Range[128];
50 | extern const uint8_t kVP8NewRange[128];
51 | static inline uint32_t VP8GetByte(VP8BitReader* const br) {
52 | assert(br);
53 | if (br->buf_ < br->buf_end_) {
54 | assert(br->buf_);
55 | return *br->buf_++;
56 | }
57 | br->eof_ = 1;
58 | return 0x80;
59 | }
60 |
61 | static inline void VP8Shift(VP8BitReader* const br) {
62 | // range_ is in [0..127] interval here.
63 | const int shift = kVP8Log2Range[br->range_];
64 | br->range_ = kVP8NewRange[br->range_];
65 | br->value_ <<= shift;
66 | br->left_ += shift;
67 | if (br->left_ > 0) {
68 | br->value_ |= VP8GetByte(br) << br->left_;
69 | br->left_ -= 8;
70 | }
71 | }
72 |
73 | static inline uint32_t VP8GetBit(VP8BitReader* const br, int prob) {
74 | const uint32_t split = (br->range_ * prob) >> 8;
75 | const uint32_t bit = ((br->value_ >> 8) > split);
76 | if (bit) {
77 | br->range_ -= split + 1;
78 | br->value_ -= (split + 1) << 8;
79 | } else {
80 | br->range_ = split;
81 | }
82 | if (br->range_ < 0x7f) {
83 | VP8Shift(br);
84 | }
85 | return bit;
86 | }
87 |
88 | static inline int VP8GetSigned(VP8BitReader* const br, int v) {
89 | const uint32_t split = br->range_ >> 1;
90 | const uint32_t bit = ((br->value_ >> 8) > split);
91 | if (bit) {
92 | br->range_ -= split + 1;
93 | br->value_ -= (split + 1) << 8;
94 | v = -v;
95 | } else {
96 | br->range_ = split;
97 | }
98 | VP8Shift(br);
99 | return v;
100 | }
101 |
102 | #if defined(__cplusplus) || defined(c_plusplus)
103 | } // extern "C"
104 | #endif
105 |
106 | #endif // WEBP_DEC_BITS_H_
107 |
--------------------------------------------------------------------------------
/src/3rdparty/webp/dec/quant.c:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Google Inc.
2 | //
3 | // This code is licensed under the same terms as WebM:
4 | // Software License Agreement: http://www.webmproject.org/license/software/
5 | // Additional IP Rights Grant: http://www.webmproject.org/license/additional/
6 | // -----------------------------------------------------------------------------
7 | //
8 | // Quantizer initialization
9 | //
10 | // Author: Skal (pascal.massimino@gmail.com)
11 |
12 | #include "vp8i.h"
13 |
14 | #if defined(__cplusplus) || defined(c_plusplus)
15 | extern "C" {
16 | #endif
17 |
18 | static inline int clip(int v, int M) {
19 | return v < 0 ? 0 : v > M ? M : v;
20 | }
21 |
22 | // Paragraph 14.1
23 | static const uint8_t kDcTable[128] = {
24 | 4, 5, 6, 7, 8, 9, 10, 10,
25 | 11, 12, 13, 14, 15, 16, 17, 17,
26 | 18, 19, 20, 20, 21, 21, 22, 22,
27 | 23, 23, 24, 25, 25, 26, 27, 28,
28 | 29, 30, 31, 32, 33, 34, 35, 36,
29 | 37, 37, 38, 39, 40, 41, 42, 43,
30 | 44, 45, 46, 46, 47, 48, 49, 50,
31 | 51, 52, 53, 54, 55, 56, 57, 58,
32 | 59, 60, 61, 62, 63, 64, 65, 66,
33 | 67, 68, 69, 70, 71, 72, 73, 74,
34 | 75, 76, 76, 77, 78, 79, 80, 81,
35 | 82, 83, 84, 85, 86, 87, 88, 89,
36 | 91, 93, 95, 96, 98, 100, 101, 102,
37 | 104, 106, 108, 110, 112, 114, 116, 118,
38 | 122, 124, 126, 128, 130, 132, 134, 136,
39 | 138, 140, 143, 145, 148, 151, 154, 157
40 | };
41 |
42 | static const uint16_t kAcTable[128] = {
43 | 4, 5, 6, 7, 8, 9, 10, 11,
44 | 12, 13, 14, 15, 16, 17, 18, 19,
45 | 20, 21, 22, 23, 24, 25, 26, 27,
46 | 28, 29, 30, 31, 32, 33, 34, 35,
47 | 36, 37, 38, 39, 40, 41, 42, 43,
48 | 44, 45, 46, 47, 48, 49, 50, 51,
49 | 52, 53, 54, 55, 56, 57, 58, 60,
50 | 62, 64, 66, 68, 70, 72, 74, 76,
51 | 78, 80, 82, 84, 86, 88, 90, 92,
52 | 94, 96, 98, 100, 102, 104, 106, 108,
53 | 110, 112, 114, 116, 119, 122, 125, 128,
54 | 131, 134, 137, 140, 143, 146, 149, 152,
55 | 155, 158, 161, 164, 167, 170, 173, 177,
56 | 181, 185, 189, 193, 197, 201, 205, 209,
57 | 213, 217, 221, 225, 229, 234, 239, 245,
58 | 249, 254, 259, 264, 269, 274, 279, 284
59 | };
60 |
61 | //-----------------------------------------------------------------------------
62 | // Paragraph 9.6
63 |
64 | void VP8ParseQuant(VP8Decoder* const dec) {
65 | VP8BitReader* const br = &dec->br_;
66 | const int base_q0 = VP8GetValue(br, 7);
67 | const int dqy1_dc = VP8Get(br) ? VP8GetSignedValue(br, 4) : 0;
68 | const int dqy2_dc = VP8Get(br) ? VP8GetSignedValue(br, 4) : 0;
69 | const int dqy2_ac = VP8Get(br) ? VP8GetSignedValue(br, 4) : 0;
70 | const int dquv_dc = VP8Get(br) ? VP8GetSignedValue(br, 4) : 0;
71 | const int dquv_ac = VP8Get(br) ? VP8GetSignedValue(br, 4) : 0;
72 |
73 | const VP8SegmentHeader* const hdr = &dec->segment_hdr_;
74 | int i;
75 |
76 | for (i = 0; i < NUM_MB_SEGMENTS; ++i) {
77 | int q;
78 | if (hdr->use_segment_) {
79 | q = hdr->quantizer_[i];
80 | if (!hdr->absolute_delta_) {
81 | q += base_q0;
82 | }
83 | } else {
84 | if (i > 0) {
85 | dec->dqm_[i] = dec->dqm_[0];
86 | continue;
87 | } else {
88 | q = base_q0;
89 | }
90 | }
91 | {
92 | VP8QuantMatrix* const m = &dec->dqm_[i];
93 | m->y1_mat_[0] = kDcTable[clip(q + dqy1_dc, 127)];
94 | m->y1_mat_[1] = kAcTable[clip(q + 0, 127)];
95 |
96 | m->y2_mat_[0] = kDcTable[clip(q + dqy2_dc, 127)] * 2;
97 | // TODO(skal): make it another table?
98 | m->y2_mat_[1] = kAcTable[clip(q + dqy2_ac, 127)] * 155 / 100;
99 | if (m->y2_mat_[1] < 8) m->y2_mat_[1] = 8;
100 |
101 | m->uv_mat_[0] = kDcTable[clip(q + dquv_dc, 117)];
102 | m->uv_mat_[1] = kAcTable[clip(q + dquv_ac, 127)];
103 | }
104 | }
105 | }
106 |
107 | //-----------------------------------------------------------------------------
108 |
109 | #if defined(__cplusplus) || defined(c_plusplus)
110 | } // extern "C"
111 | #endif
112 |
--------------------------------------------------------------------------------
/src/3rdparty/webp/dec/yuv.c:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Google Inc.
2 | //
3 | // This code is licensed under the same terms as WebM:
4 | // Software License Agreement: http://www.webmproject.org/license/software/
5 | // Additional IP Rights Grant: http://www.webmproject.org/license/additional/
6 | // -----------------------------------------------------------------------------
7 | //
8 | // YUV->RGB conversion function
9 | //
10 | // Author: Skal (pascal.massimino@gmail.com)
11 |
12 | #include "yuv.h"
13 |
14 | #if defined(__cplusplus) || defined(c_plusplus)
15 | extern "C" {
16 | #endif
17 |
18 | enum { YUV_HALF = 1 << (YUV_FIX - 1) };
19 |
20 | int16_t VP8kVToR[256], VP8kUToB[256];
21 | int32_t VP8kVToG[256], VP8kUToG[256];
22 | uint8_t VP8kClip[YUV_RANGE_MAX - YUV_RANGE_MIN];
23 |
24 | static int done = 0;
25 |
26 | void VP8YUVInit() {
27 | int i;
28 | if (done) {
29 | return;
30 | }
31 | for (i = 0; i < 256; ++i) {
32 | VP8kVToR[i] = (89858 * (i - 128) + YUV_HALF) >> YUV_FIX;
33 | VP8kUToG[i] = -22014 * (i - 128) + YUV_HALF;
34 | VP8kVToG[i] = -45773 * (i - 128);
35 | VP8kUToB[i] = (113618 * (i - 128) + YUV_HALF) >> YUV_FIX;
36 | }
37 | for (i = YUV_RANGE_MIN; i < YUV_RANGE_MAX; ++i) {
38 | const int k = ((i - 16) * 76283 + YUV_HALF) >> YUV_FIX;
39 | VP8kClip[i - YUV_RANGE_MIN] = (k < 0) ? 0 : (k > 255) ? 255 : k;
40 | }
41 | done = 1;
42 | }
43 |
44 | #if defined(__cplusplus) || defined(c_plusplus)
45 | } // extern "C"
46 | #endif
47 |
--------------------------------------------------------------------------------
/src/3rdparty/webp/dec/yuv.h:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Google Inc.
2 | //
3 | // This code is licensed under the same terms as WebM:
4 | // Software License Agreement: http://www.webmproject.org/license/software/
5 | // Additional IP Rights Grant: http://www.webmproject.org/license/additional/
6 | // -----------------------------------------------------------------------------
7 | //
8 | // inline YUV->RGB conversion function
9 | //
10 | // Author: Skal (pascal.massimino@gmail.com)
11 |
12 | #ifndef WEBP_DEC_YUV_H_
13 | #define WEBP_DEC_YUV_H_
14 |
15 | #include "webp/decode_vp8.h"
16 |
17 | #if defined(__cplusplus) || defined(c_plusplus)
18 | extern "C" {
19 | #endif
20 |
21 | enum { YUV_FIX = 16, // fixed-point precision
22 | YUV_RANGE_MIN = -227, // min value of r/g/b output
23 | YUV_RANGE_MAX = 256 + 226 // max value of r/g/b output
24 | };
25 | extern int16_t VP8kVToR[256], VP8kUToB[256];
26 | extern int32_t VP8kVToG[256], VP8kUToG[256];
27 | extern uint8_t VP8kClip[YUV_RANGE_MAX - YUV_RANGE_MIN];
28 |
29 | inline static void VP8YuvToRgb(uint8_t y, uint8_t u, uint8_t v,
30 | uint8_t* const rgb) {
31 | const int r_off = VP8kVToR[v];
32 | const int g_off = (VP8kVToG[v] + VP8kUToG[u]) >> YUV_FIX;
33 | const int b_off = VP8kUToB[u];
34 | rgb[0] = VP8kClip[y + r_off - YUV_RANGE_MIN];
35 | rgb[1] = VP8kClip[y + g_off - YUV_RANGE_MIN];
36 | rgb[2] = VP8kClip[y + b_off - YUV_RANGE_MIN];
37 | }
38 |
39 | inline static void VP8YuvToRgba(int y, int u, int v, uint8_t* const rgba) {
40 | VP8YuvToRgb(y, u, v, rgba);
41 | rgba[3] = 0xff;
42 | }
43 |
44 | inline static void VP8YuvToBgr(uint8_t y, uint8_t u, uint8_t v,
45 | uint8_t* const bgr) {
46 | const int r_off = VP8kVToR[v];
47 | const int g_off = (VP8kVToG[v] + VP8kUToG[u]) >> YUV_FIX;
48 | const int b_off = VP8kUToB[u];
49 | bgr[0] = VP8kClip[y + b_off - YUV_RANGE_MIN];
50 | bgr[1] = VP8kClip[y + g_off - YUV_RANGE_MIN];
51 | bgr[2] = VP8kClip[y + r_off - YUV_RANGE_MIN];
52 | }
53 |
54 | inline static void VP8YuvToBgra(int y, int u, int v, uint8_t* const bgra) {
55 | VP8YuvToBgr(y, u, v, bgra);
56 | bgra[3] = 0xff;
57 | }
58 |
59 | // Must be called before everything, to initialize the tables.
60 | void VP8YUVInit();
61 |
62 | #if defined(__cplusplus) || defined(c_plusplus)
63 | } // extern "C"
64 | #endif
65 |
66 | #endif // WEBP_DEC_YUV_H_
67 |
--------------------------------------------------------------------------------
/src/3rdparty/webp/webp/decode.h:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Google Inc.
2 | //
3 | // This code is licensed under the same terms as WebM:
4 | // Software License Agreement: http://www.webmproject.org/license/software/
5 | // Additional IP Rights Grant: http://www.webmproject.org/license/additional/
6 | // -----------------------------------------------------------------------------
7 | //
8 | // Main decoding functions for WEBP images.
9 | //
10 | // Author: Skal (pascal.massimino@gmail.com)
11 |
12 | #ifndef WEBP_WEBP_DECODE_H_
13 | #define WEBP_WEBP_DECODE_H_
14 |
15 | #include "webp/types.h"
16 |
17 | #if defined(__cplusplus) || defined(c_plusplus)
18 | extern "C" {
19 | #endif
20 |
21 | // Retrieve basic header information: width, height.
22 | // This function will also validate the header and return 0 in
23 | // case of formatting error.
24 | // Pointers *width/*height can be passed NULL if deemed irrelevant.
25 | int WebPGetInfo(const uint8_t* data, uint32_t data_size,
26 | int *width, int *height);
27 |
28 | // Decodes WEBP images pointed to by *data and returns RGB samples, along
29 | // with the dimensions in *width and *height.
30 | // The returned pointer should be deleted calling free().
31 | // Returns NULL in case of error.
32 | uint8_t* WebPDecodeRGB(const uint8_t* data, uint32_t data_size,
33 | int *width, int *height);
34 |
35 | // Same as WebPDecodeRGB, but returning RGBA data.
36 | uint8_t* WebPDecodeRGBA(const uint8_t* data, uint32_t data_size,
37 | int *width, int *height);
38 |
39 | // This variant decode to BGR instead of RGB.
40 | uint8_t* WebPDecodeBGR(const uint8_t* data, uint32_t data_size,
41 | int *width, int *height);
42 | // This variant decodes to BGRA instead of RGBA.
43 | uint8_t* WebPDecodeBGRA(const uint8_t* data, uint32_t data_size,
44 | int *width, int *height);
45 |
46 | // Decode WEBP images stored in *data in Y'UV format(*). The pointer returned is
47 | // the Y samples buffer. Upon return, *u and *v will point to the U and V
48 | // chroma data. These U and V buffers need NOT be free()'d, unlike the returned
49 | // Y luma one. The dimension of the U and V planes are both (*width + 1) / 2
50 | // and (*height + 1)/ 2.
51 | // Upon return, the Y buffer has a stride returned as '*stride', while U and V
52 | // have a common stride returned as '*uv_stride'.
53 | // Return NULL in case of error.
54 | // (*) Also named Y'CbCr. See: http://en.wikipedia.org/wiki/YCbCr
55 | uint8_t* WebPDecodeYUV(const uint8_t* data, uint32_t data_size,
56 | int *width, int *height, uint8_t** u, uint8_t** v,
57 | int *stride, int* uv_stride);
58 |
59 | // These three functions are variants of the above ones, that decode the image
60 | // directly into a pre-allocated buffer 'output_buffer'. The maximum storage
61 | // available in this buffer is indicated by 'output_buffer_size'. If this
62 | // storage is not sufficient (or an error occurred), NULL is returned.
63 | // Otherwise, output_buffer is returned, for convenience.
64 | // The parameter 'output_stride' specifies the distance (in bytes)
65 | // between scanlines. Hence, output_buffer_size is expected to be at least
66 | // output_stride x picture-height.
67 | uint8_t* WebPDecodeRGBInto(const uint8_t* data, uint32_t data_size,
68 | uint8_t* output_buffer, int output_buffer_size,
69 | int output_stride);
70 | uint8_t* WebPDecodeRGBAInto(const uint8_t* data, uint32_t data_size,
71 | uint8_t* output_buffer, int output_buffer_size,
72 | int output_stride);
73 | // BGR variants
74 | uint8_t* WebPDecodeBGRInto(const uint8_t* data, uint32_t data_size,
75 | uint8_t* output_buffer, int output_buffer_size,
76 | int output_stride);
77 | uint8_t* WebPDecodeBGRAInto(const uint8_t* data, uint32_t data_size,
78 | uint8_t* output_buffer, int output_buffer_size,
79 | int output_stride);
80 |
81 | // WebPDecodeYUVInto() is a variant of WebPDecodeYUV() that operates directly
82 | // into pre-allocated luma/chroma plane buffers. This function requires the
83 | // strides to be passed: one for the luma plane and one for each of the
84 | // chroma ones. The size of each plane buffer is passed as 'luma_size',
85 | // 'u_size' and 'v_size' respectively.
86 | // Pointer to the luma plane ('*luma') is returned or NULL if an error occurred
87 | // during decoding (or because some buffers were found to be too small).
88 | uint8_t* WebPDecodeYUVInto(const uint8_t* data, uint32_t data_size,
89 | uint8_t* luma, int luma_size, int luma_stride,
90 | uint8_t* u, int u_size, int u_stride,
91 | uint8_t* v, int v_size, int v_stride);
92 |
93 | //-----------------------------------------------------------------------------
94 |
95 | #if defined(__cplusplus) || defined(c_plusplus)
96 | } // extern "C"
97 | #endif
98 |
99 | #endif /* WEBP_WEBP_DECODE_H_ */
100 |
--------------------------------------------------------------------------------
/src/3rdparty/webp/webp/decode_vp8.h:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Google Inc.
2 | //
3 | // This code is licensed under the same terms as WebM:
4 | // Software License Agreement: http://www.webmproject.org/license/software/
5 | // Additional IP Rights Grant: http://www.webmproject.org/license/additional/
6 | // -----------------------------------------------------------------------------
7 | //
8 | // Low-level API for VP8 decoder
9 | //
10 | // Author: Skal (pascal.massimino@gmail.com)
11 |
12 | #ifndef WEBP_WEBP_DECODE_VP8_H_
13 | #define WEBP_WEBP_DECODE_VP8_H_
14 |
15 | #include "decode.h"
16 |
17 | #if defined(__cplusplus) || defined(c_plusplus)
18 | extern "C" {
19 | #endif
20 |
21 | //-----------------------------------------------------------------------------
22 | // Lower-level API
23 | //
24 | // Thes functions provide fine-grained control of the decoding process.
25 | // The call flow should resemble:
26 | //
27 | // VP8Io io;
28 | // VP8InitIo(&io);
29 | // io.data = data;
30 | // io.data_size = size;
31 | // /* customize io's functions (setup()/put()/teardown()) if needed. */
32 | //
33 | // VP8Decoder* dec = VP8New();
34 | // bool ok = VP8Decode(dec);
35 | // if (!ok) printf("Error: %s\n", VP8StatusMessage(dec));
36 | // VP8Delete(dec);
37 | // return ok;
38 |
39 | // Input / Output
40 | typedef struct VP8Io VP8Io;
41 | struct VP8Io {
42 | // set by VP8GetHeaders()
43 | int width, height; // picture dimensions, in pixels
44 |
45 | // set before calling put()
46 | int mb_y; // position of the current rows (in pixels)
47 | int mb_h; // number of rows in the sample
48 | const uint8_t *y, *u, *v; // rows to copy (in yuv420 format)
49 | int y_stride; // row stride for luma
50 | int uv_stride; // row stride for chroma
51 |
52 | void* opaque; // user data
53 |
54 | // called when fresh samples are available. Currently, samples are in
55 | // YUV420 format, and can be up to width x 24 in size (depending on the
56 | // in-loop filtering level, e.g.). Should return false in case of error
57 | // or abort request.
58 | int (*put)(const VP8Io* io);
59 |
60 | // called just before starting to decode the blocks.
61 | // Should returns 0 in case of error.
62 | int (*setup)(VP8Io* io);
63 |
64 | // called just after block decoding is finished (or when an error occurred).
65 | void (*teardown)(const VP8Io* io);
66 |
67 | // this is a recommendation for the user-side yuv->rgb converter. This flag
68 | // is set when calling setup() hook and can be overwritten by it. It then
69 | // can be taken into consideration during the put() method.
70 | int fancy_upscaling;
71 |
72 | // Input buffer.
73 | uint32_t data_size;
74 | const uint8_t* data;
75 | };
76 |
77 | // Main decoding object. This is an opaque structure.
78 | typedef struct VP8Decoder VP8Decoder;
79 |
80 | // Create a new decoder object.
81 | VP8Decoder* VP8New();
82 |
83 | // Can be called to make sure 'io' is initialized properly.
84 | void VP8InitIo(VP8Io* const io);
85 |
86 | // Start decoding a new picture. Returns true if ok.
87 | int VP8GetHeaders(VP8Decoder* const dec, VP8Io* const io);
88 |
89 | // Decode a picture. Will call VP8GetHeaders() if it wasn't done already.
90 | // Returns false in case of error.
91 | int VP8Decode(VP8Decoder* const dec, VP8Io* const io);
92 |
93 | // Enumeration of the codes returned by VP8Status()
94 | typedef enum {
95 | VP8_STATUS_OK = 0,
96 | VP8_STATUS_OUT_OF_MEMORY,
97 | VP8_STATUS_INVALID_PARAM,
98 | VP8_STATUS_BITSTREAM_ERROR,
99 | VP8_STATUS_UNSUPPORTED_FEATURE,
100 | VP8_STATUS_SUSPENDED,
101 | VP8_STATUS_USER_ABORT,
102 | VP8_STATUS_NOT_ENOUGH_DATA,
103 | } VP8StatusCode;
104 |
105 | // Return current status of the decoder:
106 | VP8StatusCode VP8Status(VP8Decoder* const dec);
107 |
108 | // return readable string corresponding to the last status.
109 | const char* VP8StatusMessage(VP8Decoder* const dec);
110 |
111 | // Resets the decoder in its initial state, reclaiming memory.
112 | // Not a mandatory call between calls to VP8Decode().
113 | void VP8Clear(VP8Decoder* const dec);
114 |
115 | // Destroy the decoder object.
116 | void VP8Delete(VP8Decoder* const dec);
117 |
118 | //-----------------------------------------------------------------------------
119 |
120 | #if defined(__cplusplus) || defined(c_plusplus)
121 | } // extern "C"
122 | #endif
123 |
124 | #endif /* WEBP_WEBP_DECODE_VP8_H_ */
125 |
--------------------------------------------------------------------------------
/src/3rdparty/webp/webp/types.h:
--------------------------------------------------------------------------------
1 | // Copyright 2010 Google Inc.
2 | //
3 | // This code is licensed under the same terms as WebM:
4 | // Software License Agreement: http://www.webmproject.org/license/software/
5 | // Additional IP Rights Grant: http://www.webmproject.org/license/additional/
6 | // -----------------------------------------------------------------------------
7 | //
8 | // Common types
9 | //
10 | // Author: Skal (pascal.massimino@gmail.com)
11 |
12 | #ifndef WEBP_WEBP_TYPES_H_
13 | #define WEBP_WEBP_TYPES_H_
14 |
15 | #ifndef _MSC_VER
16 | #include
17 | #else
18 | typedef signed char int8_t;
19 | typedef unsigned char uint8_t;
20 | typedef signed short int16_t;
21 | typedef unsigned short uint16_t;
22 | typedef signed int int32_t;
23 | typedef unsigned int uint32_t;
24 | typedef unsigned long long int uint64_t;
25 | typedef long long int int64_t;
26 | #define inline __forceinline
27 | #endif /* _MSC_VER */
28 |
29 | #endif /* WEBP_WEBP_TYPES_H_ */
30 |
--------------------------------------------------------------------------------
/src/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | ADD_DEFINITIONS(${QT_DEFINITIONS})
2 | include_directories(${CMAKE_CURRENT_SOURCE_DIR})
3 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/webp)
4 | include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../)
5 |
6 | configure_file(${CMAKE_CURRENT_SOURCE_DIR}/defines.h.cmake
7 | ${CMAKE_CURRENT_BINARY_DIR}/defines.h)
8 |
9 | #app ui's
10 | file(GLOB_RECURSE app_UIS forms/*.ui)
11 | QT4_WRAP_UI(app_UIS_H ${app_UIS})
12 |
13 | #resorces
14 | QT4_ADD_RESOURCES(RESOURCE_FILES ../resources/qiviewer.qrc)
15 | SET(DESKTOP_FILE ../resources/qiviewer.desktop)
16 |
17 | #code files
18 | file(GLOB_RECURSE CODE_FILES *.cpp *.c)
19 |
20 | ################################################################################
21 | ############################## Translations stuff ##############################
22 | ################################################################################
23 | SET(LANGUAGES cs el es_AR es_ES pt ru_RU)
24 | MACRO (QT4_WRAP_TS lupdate_outputs lrelease_outputs)
25 | file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/locale)
26 | FOREACH (it ${ARGN})
27 | SET(tsfile ${CMAKE_CURRENT_SOURCE_DIR}/translations/${it}.ts)
28 | ADD_CUSTOM_COMMAND(OUTPUT ${tsfile}
29 | COMMAND ${QT_LUPDATE_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR} -ts ${tsfile}
30 | )
31 |
32 | SET(qmfile ${CMAKE_CURRENT_BINARY_DIR}/locale/${it}.qm)
33 | ADD_CUSTOM_COMMAND(OUTPUT ${qmfile}
34 | COMMAND ${QT_LRELEASE_EXECUTABLE} ${tsfile} -qm ${qmfile}
35 | )
36 |
37 | SET(${lupdate_outputs} ${${lupdate_outputs}} ${tsfile})
38 | SET(${lrelease_outputs} ${${lrelease_outputs}} ${qmfile})
39 | ENDFOREACH(it)
40 | ENDMACRO (QT4_WRAP_TS)
41 |
42 | QT4_WRAP_TS(lupdate_outputs lrelease_outputs
43 | ${LANGUAGES}
44 | )
45 | ADD_CUSTOM_TARGET(lupdate-qt4
46 | DEPENDS ${lupdate_outputs}
47 | )
48 | ADD_CUSTOM_TARGET(lrelease-qt4
49 | DEPENDS ${lrelease_outputs}
50 | )
51 |
52 | SET(qm_files)
53 | foreach(a ${LANGUAGES})
54 | set(qm_file "${CMAKE_CURRENT_BINARY_DIR}/locale/${a}.qm")
55 | set(qm_files ${qm_file} ${qm_files})
56 | message(${qm_file})
57 | endforeach(a ${LANGUAGES})
58 |
59 | ###############################################################################
60 | ################################## Libraries ##################################
61 | ###############################################################################
62 |
63 | #create executalbe
64 | add_executable(${CMAKE_PROJECT_NAME}
65 | ${CODE_FILES}
66 | ${RESOURCE_FILES}
67 | ${app_UIS_H}
68 | ${qm_files})
69 | target_link_libraries(${CMAKE_PROJECT_NAME} ${QT_LIBRARIES})
70 |
71 | #installation
72 | INSTALL(TARGETS ${CMAKE_PROJECT_NAME}
73 | RUNTIME
74 | DESTINATION bin
75 | PERMISSIONS OWNER_READ OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
76 | INSTALL(FILES ${qm_files}
77 | DESTINATION ${PKGDATADIR}/locale
78 | PERMISSIONS OWNER_READ GROUP_READ WORLD_READ)
79 |
80 | INSTALL(PROGRAMS ${DESKTOP_FILE} DESTINATION ${XDG_APPS_INSTALL_DIR} )
81 |
82 | SET(DDM_PIXMAPS_DIR "/usr/share/icons/")
83 | INSTALL (FILES ../resources/qiviewer.png DESTINATION ${DDM_PIXMAPS_DIR})
84 |
--------------------------------------------------------------------------------
/src/aboutdialog.cpp:
--------------------------------------------------------------------------------
1 | /*********************************************************************
2 | * Copyright (C) 2010 by Dario Ignacio Aguilera *
3 | * dario_21_06@hotmail.com *
4 | * *
5 | * This program is free software; you can redistribute it and/or *
6 | * modify it under the terms of the GNU General Public License *
7 | * as published by the Free Software Foundation; either version 2 *
8 | * of the License, or (at your option) any later version. *
9 | * *
10 | * This program is distributed in the hope that it will be useful, *
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 | * GNU General Public License for more details. *
14 | * *
15 | * You should have received a copy of the GNU General Public License *
16 | * along with this program; if not, write to the *
17 | * Free Software Foundation, Inc. *
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 | **********************************************************************/
20 |
21 | #include
22 | #include "aboutdialog.h"
23 | #include "defines.h"
24 | #include "utils.h"
25 |
26 | AboutDialog::AboutDialog(QWidget* parent, Qt::WFlags fl) : QDialog( parent, fl )
27 | {
28 | ui.setupUi(this);
29 | #ifdef WEBP_SUPPORT
30 | qDebug()<<"experimental webp support enabled";
31 | #endif
32 |
33 | ui.versionLabel->setText(tr("Version %1").arg(QLatin1String(PROJECT_VERSION)));
34 |
35 | QString descString;
36 | descString.append("");
37 | descString.append(tr("A simple and lightweight image viewer, written totally in Qt."));
38 | descString.append("
");
39 | descString.append("");
40 | descString.append(tr("Home page"));
41 | descString.append("
");
42 | ui.descriptionLabel->setText(descString);
43 | ui.descriptionLabel->setTextFormat(Qt::RichText);
44 |
45 | QString authorString;
46 | authorString.append("");
47 | authorString.append(tr("Use %1Github issues page%2 to report bugs, patches or ideas.").arg("", ""));
48 | authorString.append("
");
49 | authorString.append("Aguilera Dario");
50 | authorString.append("
");
51 | authorString.append(tr("Developer."));
52 | authorString.append("
");
53 | authorString.append("");
56 | authorString.append(tr("Email"));
57 | authorString.append(" - ");
58 | authorString.append("");
59 | authorString.append(tr("Personal blog"));
60 | authorString.append("
");
61 | ui.authorLabel->setText(authorString);
62 |
63 | QString thanksTo;
64 | thanksTo.append("Salvador Parra Camacho
- ");
65 | thanksTo.append(tr("Icons on systems without icon themes"));
66 | thanksTo.append("
- ");
67 | thanksTo.append(tr("OS/2 support"));
68 | thanksTo.append("
");
69 | thanksTo.append("Acidrums4
- ");
70 | thanksTo.append(tr("QIviewer icon"));
71 | thanksTo.append("
");
72 | ui.thaksToLabel->setText(thanksTo);
73 |
74 | /*!
75 | The file translators.txt must be setted as:
76 | name of the translator
77 | language
78 | */
79 | QString translators;
80 | QStringList temp = Utils::stringFromFile(":translators.txt").split("\n");
81 | for(int i=0; i < temp.count(); i++){
82 | if(i%2 == 0){
83 | translators.append("" + temp.at(i) + "
- ");
84 | }
85 | else{
86 | translators.append(temp.at(i) + "
- ");
87 | }
88 | }
89 | ui.translatorLabel->setText(translators);
90 |
91 | ui.licenseText->setText(Utils::stringFromFile(":license.txt"));
92 | ui.okButton->setIcon(QIcon::fromTheme("dialog-ok"));
93 |
94 | this->resize(QSize(470, 270));
95 | }
96 |
--------------------------------------------------------------------------------
/src/aboutdialog.h:
--------------------------------------------------------------------------------
1 | /*********************************************************************
2 | * Copyright (C) 2010 by Dario Ignacio Aguilera *
3 | * dario_21_06@hotmail.com *
4 | * *
5 | * This program is free software; you can redistribute it and/or *
6 | * modify it under the terms of the GNU General Public License *
7 | * as published by the Free Software Foundation; either version 2 *
8 | * of the License, or (at your option) any later version. *
9 | * *
10 | * This program is distributed in the hope that it will be useful, *
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 | * GNU General Public License for more details. *
14 | * *
15 | * You should have received a copy of the GNU General Public License *
16 | * along with this program; if not, write to the *
17 | * Free Software Foundation, Inc. *
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 | **********************************************************************/
20 |
21 | #ifndef ABOUTDIALOG_H
22 | #define ABOUTDIALOG_H
23 |
24 | #include
25 | #include "ui_aboutdialog.h"
26 |
27 | class AboutDialog : public QDialog
28 | {
29 | Q_OBJECT
30 |
31 | public:
32 | /*!
33 | constructor
34 | */
35 | AboutDialog(QWidget* parent = 0, Qt::WFlags fl = 0);
36 |
37 | private:
38 | Ui_AboutDialog ui;
39 |
40 | };
41 |
42 | #endif
43 |
--------------------------------------------------------------------------------
/src/actiondata.cpp:
--------------------------------------------------------------------------------
1 | #include "actiondata.h"
2 |
3 | ActionData::ActionData(QString name, QString id, QString shortcut, QString iconName, QObject *parent) :
4 | QObject(parent)
5 | {
6 | this->name = name;
7 | this->iconName = iconName;
8 | this->shortcut = shortcut;
9 | this->id = id;
10 | }
11 |
--------------------------------------------------------------------------------
/src/actiondata.h:
--------------------------------------------------------------------------------
1 | #ifndef ACTIONDATA_H
2 | #define ACTIONDATA_H
3 |
4 | #include
5 |
6 | class QString;
7 |
8 | class ActionData : public QObject
9 | {
10 | Q_OBJECT
11 | public:
12 | explicit ActionData(QString name, QString id, QString shortcut,
13 | QString iconName, QObject *parent = 0);
14 | inline QString getName() const{return name;}
15 | inline QString getId() const{return id;}
16 | inline QString getShortcut() const{return shortcut;}
17 | inline QString getIconName() const{return iconName;}
18 |
19 | inline void setName(QString name){this->name = name;}
20 | inline void setIconName(QString iconName){this->iconName = iconName;}
21 | inline void setId(QString id){this->id = id;}
22 | inline void setShortcut(QString shortcut){this->shortcut = shortcut;}
23 |
24 | private:
25 | QString name;
26 | QString id;
27 | QString shortcut;
28 | QString iconName;
29 |
30 | };
31 |
32 | #endif // ACTIONDATA_H
33 |
--------------------------------------------------------------------------------
/src/actionsmanager.h:
--------------------------------------------------------------------------------
1 | #ifndef ACTIONSMANAGER_H
2 | #define ACTIONSMANAGER_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 |
10 | class QAction;
11 | class QWidget;
12 | class QShortcut;
13 | class ActionData;
14 |
15 | class ActionsManager : public QObject
16 | {
17 | /*!
18 | \brief This class is used to manage all the action in the app.
19 |
20 | Start by creating a new object, then add an action(s), with it's respective
21 | name, id, icon name and shortcut, and the slot it has to be connected
22 | Then, if you want to add an action to some widget, just do it by:
23 | widget->addAction(actManager->getAction(id))
24 | */
25 |
26 | Q_OBJECT
27 |
28 | public:
29 | /*!
30 | constructor
31 | */
32 | ActionsManager(QObject *parent);
33 |
34 | /*!
35 | \returns a map with the action's ActionData, being the QString \param the id
36 | */
37 | QMap getActionsMap();
38 |
39 | /*!
40 | \returns a list with the actions
41 | */
42 | QList getActionsList();
43 |
44 | /*!
45 | Adds a new action to the manager
46 | \param id is the identification for the action, i.e. _open
47 | if the action already has a shortcut, then \a shortcut is ignored.
48 | \param shortcut is the action shortcut, i.e. Ctrl+O
49 | \returns a pointer to the added action
50 | */
51 | QAction* addAction(QAction *action, QString id, QWidget *parent, QKeySequence shortcut = QKeySequence());
52 |
53 | /*!
54 | Adds a new action to the manager
55 | \param id is the identification for the action, i.e. _open
56 | if the action already has a shortcut, then \a shortcut is ignored.
57 | \param shortcut is the action shortcut, i.e. Ctrl+O
58 | \returns a pointer to the added action
59 | */
60 | QAction* addAction(QAction *action,
61 | QString id,
62 | QWidget *parent,
63 | QObject *receiver,
64 | std::string slot,
65 | QKeySequence shortcut = QKeySequence());
66 |
67 | /*!
68 | Adds a new action to the manager
69 | \param id is the identification for the action, i.e. _open
70 | if the action already has a shortcut, then \a shortcut is ignored.
71 | \param shortcut is the action shortcut, i.e. Ctrl+O
72 | \returns a pointer to the added action
73 | */
74 | QAction* addAction(QAction *action,
75 | bool checkable,
76 | QString id,
77 | QWidget *parent,
78 | QObject *receiver,
79 | std::string slot,
80 | QKeySequence shortcut);
81 |
82 | /*!
83 | Adds a new action to the manager
84 | \param id is the identification for the action, i.e. _open
85 | if the action already has a shortcut, then \a shortcut is ignored.
86 | \param shortcut is the action shortcut, i.e. Ctrl+O
87 | \returns a pointer to the added action
88 | */
89 | QAction* addAction(QAction *action,
90 | bool checkable,
91 | QString id,
92 | QWidget *parent,
93 | QObject *receiver,
94 | std::string slot);
95 |
96 | /*!
97 | \a returns the action attached to \a id, otherwise \return a null action
98 | */
99 | QAction *action(QString id);
100 |
101 | /*!
102 | connects the action asigned to \a id, to the receiver \a receiver to the
103 | slot \a slot. Note: you get the slot doing SLOT(yourSlot())
104 | */
105 | void connectAction(QString id, QObject *receiver, std::string slot);
106 |
107 | /*!
108 | Enable disable the wanted action. If you added the action, then you have to use this,
109 | and it will enable/disable it's shortcut, but if you make:
110 | \code actionManaget->action(id)->setEnabled(enabled)
111 | the shortcut wont be enabled/disabled
112 | */
113 | void setEnabled(QString id, bool enabled);
114 |
115 | /*!
116 | \returns a list with all the id's stored
117 | */
118 | QStringList getIds();
119 |
120 | /*!
121 | set the \a iconName icon from the theme to the action \a id
122 | */
123 | void setActionIcon(QString id, QString iconName);
124 |
125 | /*!
126 | \returns the \a actionName name
127 | */
128 | QString removeSString(QString actionName);
129 |
130 | /*!
131 | set \a shortcut to \a id
132 | */
133 | void setShortcut(QString id, QKeySequence shortcut);
134 |
135 | /*!
136 | Makes the action \a id checkable
137 | */
138 | void setCheckable(QString id, bool checkable);
139 |
140 | /*!
141 | Makes the \a id action \a checked
142 | */
143 | void setChecked(QString id, bool checked);
144 |
145 | /*!
146 | Sets the given \a tooltip to the \a id action
147 | */
148 | void setToolTip(QString id, QString tooltip);
149 |
150 | /*!
151 | \returns a Map with the action id and it corresponding shortcut
152 | the map key is the id, and the value the shortcut
153 | this has just the actions that have shortcut
154 | \see setShortcuts(QMap list)
155 | */
156 | QMap getShortcuts();
157 |
158 | /*!
159 | Sets the shortcuts stored in list to the action correspondig to the id
160 | The format is: id=map key, shortcut=map value
161 | see getShortcuts()
162 | */
163 | void setNewShortcuts(QMap list);
164 |
165 | /*!
166 | \returns the \a id action data
167 | */
168 | ActionData *getActionData(QString id);
169 |
170 | private:
171 | /*!
172 | The name of every action created will have the next format:
173 | \a name + \t + \a shortcut, i.e. Open\tCtrl+O
174 | The string \t is used to add the shortcut string in the action
175 | name to make it look as the action shortcut, but it's not.
176 | */
177 |
178 | /*!
179 | \struct this struct contains an action, it's shortcut
180 | */
181 | struct InternalActData{
182 | QAction *action; /// ActionsList;
194 |
195 | /*!
196 | updates the action name and tooltip, corresponding to the \a id
197 | i.e. when whe modifi the action shortcut
198 | */
199 | void setNameAndToolTip(QString id);
200 |
201 | /*!
202 | removes all shortcuts from the actions stored
203 | */
204 | void clearShortcuts();
205 |
206 | /*!
207 | Shows a message (in command line) taht adverts than the given
208 | \a id ain't valid
209 | */
210 | QString invalidId(QString id);
211 | };
212 |
213 | #endif // ACTIONSMANAGER_H
214 |
--------------------------------------------------------------------------------
/src/configdialog.cpp:
--------------------------------------------------------------------------------
1 | /*********************************************************************
2 | * Copyright (C) 2010 by Dario Ignacio Aguilera *
3 | * dario_21_06@hotmail.com *
4 | * *
5 | * This program is free software; you can redistribute it and/or *
6 | * modify it under the terms of the GNU General Public License *
7 | * as published by the Free Software Foundation; either version 2 *
8 | * of the License, or (at your option) any later version. *
9 | * *
10 | * This program is distributed in the hope that it will be useful, *
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 | * GNU General Public License for more details. *
14 | * *
15 | * You should have received a copy of the GNU General Public License *
16 | * along with this program; if not, write to the *
17 | * Free Software Foundation, Inc. *
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 | **********************************************************************/
20 |
21 | #include
22 |
23 | #include "mname.h"
24 | #include "configdialog.h"
25 | #include "locationpage.h"
26 | #include "generaloptionspage.h"
27 | #include "toolbarpage.h"
28 |
29 | ConfigDialog::ConfigDialog(QWidget* parent, Qt::WFlags fl) : QDialog(parent, fl)
30 | {
31 | //configure the ui
32 | ui.setupUi(this);
33 |
34 | //add icons to the list items
35 | ui.listWidget->item(0)->setIcon(QIcon::fromTheme("image-x-generic"));
36 | ui.listWidget->item(1)->setIcon(QIcon::fromTheme("edit-rename"));
37 | ui.listWidget->item(2)->setIcon(QIcon::fromTheme("configure-toolbars"));
38 |
39 | //set names to the labels
40 | ui.generalLabel->setText(QString("
%1").arg(tr("General")));
41 | ui.locationLabel->setText(QString("%1").arg(tr("Location")));
42 | ui.toolbarLabel->setText(QString("%1").arg(tr("Toolbar")));
43 |
44 | //set icons to the apply, ok and cancel button
45 | ui.applyButton->setIcon(QIcon::fromTheme("dialog-ok-apply"));
46 | ui.acceptButton->setIcon(QIcon::fromTheme("dialog-ok"));
47 | ui.cancelButton->setIcon(QIcon::fromTheme("dialog-cancel"));
48 |
49 | //make buttons connection
50 | connect(ui.applyButton, SIGNAL(clicked()), this, SLOT(saveSettings()));
51 | connect(ui.acceptButton, SIGNAL(clicked()), this, SLOT(saveSettings()));
52 |
53 | //configure widgets
54 | lPage = new LocationPage;
55 | ui.locationLayout->addWidget(lPage);
56 | gPage = new GeneralOptionsPage;
57 | ui.generalOptionsLayout->addWidget(gPage);
58 | tbPage = new ToolbarPage;
59 | ui.toolbarLayout->addWidget(tbPage);
60 |
61 | connect(lPage, SIGNAL(settingsChanged()), this, SLOT(settingsChangedSlot()));
62 | connect(gPage, SIGNAL(settingsChanged()), this, SLOT(settingsChangedSlot()));
63 | connect(tbPage, SIGNAL(settingsChanged()), this, SLOT(settingsChangedSlot()));
64 |
65 | ui.applyButton->setEnabled(false);
66 | ui.acceptButton->setEnabled(false);
67 | }
68 |
69 | ConfigDialog::~ConfigDialog()
70 | {
71 | gPage->~GeneralOptionsPage();
72 | lPage->~LocationPage();
73 | tbPage->~ToolbarPage();
74 | }
75 |
76 | bool ConfigDialog::canSave()
77 | {
78 | return tbPage->canSave() &&
79 | gPage->canSave() &&
80 | lPage->canSave();
81 | }
82 |
83 | int ConfigDialog::closeDialog()
84 | {
85 | if (this->canSave()){
86 | return 1;
87 | }
88 | else{
89 | return 0;
90 | }
91 | }
92 |
93 | void ConfigDialog::closeEvent(QCloseEvent* event)
94 | {
95 | Q_UNUSED(event);
96 |
97 | switch (closeDialog())
98 | {
99 | case 0:
100 | break;
101 | case 1:
102 | qDebug() << __METHOD_NAME__ << ": changes not saved";
103 | break;
104 | }
105 | }
106 |
107 | void ConfigDialog::saveSettings()
108 | {
109 | qDebug() << __METHOD_NAME__ ;
110 | if(gPage->canSave()){
111 | gPage->saveSettings();
112 | }
113 | if(lPage->canSave()){
114 | lPage->saveSettings();
115 | }
116 | if(tbPage->canSave()){
117 | tbPage->saveSettings();
118 | }
119 |
120 | ui.applyButton->setEnabled(false);
121 |
122 | qDebug() << __METHOD_NAME__<< "Saving settings";
123 | emit settingsSaved();
124 | }
125 |
126 | void ConfigDialog::settingsChangedSlot()
127 | {
128 | qDebug()<< __METHOD_NAME__;
129 | ui.applyButton->setEnabled(true);
130 | ui.acceptButton->setEnabled(true);
131 | }
132 |
--------------------------------------------------------------------------------
/src/configdialog.h:
--------------------------------------------------------------------------------
1 | /*********************************************************************
2 | * Copyright (C) 2010 by Dario Ignacio Aguilera *
3 | * dario_21_06@hotmail.com *
4 | * *
5 | * This program is free software; you can redistribute it and/or *
6 | * modify it under the terms of the GNU General Public License *
7 | * as published by the Free Software Foundation; either version 2 *
8 | * of the License, or (at your option) any later version. *
9 | * *
10 | * This program is distributed in the hope that it will be useful, *
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 | * GNU General Public License for more details. *
14 | * *
15 | * You should have received a copy of the GNU General Public License *
16 | * along with this program; if not, write to the *
17 | * Free Software Foundation, Inc. *
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 | **********************************************************************/
20 |
21 | #ifndef CONFIGDIALOG2_H
22 | #define CONFIGDIALOG2_H
23 |
24 | #include
25 | #include "ui_configdialog.h"
26 |
27 | class ActionData;
28 | class LocationPage;
29 | class GeneralOptionsPage;
30 | class ToolbarPage;
31 |
32 | class ConfigDialog : public QDialog
33 | {
34 | Q_OBJECT
35 |
36 | public:
37 | ConfigDialog(QWidget* parent = 0, Qt::WFlags fl = 0 );
38 | ~ConfigDialog();
39 |
40 | signals:
41 | /**
42 | * signal sent when the dialog saves the configuration
43 | */
44 | void settingsSaved();
45 |
46 | protected:
47 | void closeEvent(QCloseEvent *event);
48 |
49 | private:
50 | Ui_ConfigDialog ui;
51 | LocationPage *lPage;
52 | GeneralOptionsPage *gPage;
53 | ToolbarPage *tbPage;
54 | int closeDialog();
55 | bool canSave();
56 |
57 | private slots:
58 | void saveSettings();
59 | void settingsChangedSlot();
60 |
61 | };
62 |
63 | #endif
64 |
--------------------------------------------------------------------------------
/src/defines.h.cmake:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright (c) 2009, Paul Gideon Dann
3 | *
4 | * Permission to use, copy, modify, and/or distribute this software for any
5 | * purpose with or without fee is hereby granted, provided that the above
6 | * copyright notice and this permission notice appear in all copies.
7 | *
8 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 | */
16 |
17 | #ifndef GLOBAL_DEFINES_H
18 | #define GLOBAL_DEFINES_H
19 |
20 | // An anonymous namespace restricts these variables to the scope of the
21 | // compilation unit.
22 | namespace {
23 | const char* PROJECT_LONGNAME = "@PROJECT_LONGNAME@";
24 | const char* PROJECT_VERSION = "@PROJECT_VERSION@";
25 | const char* ICON_THEMES_DEFAULT_FOLDER = "@ICON_THEMES_DEFAULT_FOLDER@";
26 | const char* DATADIR = "@DATADIR@";
27 | const char* PKGDATADIR = "@PKGDATADIR@";
28 | }
29 |
30 | #endif
31 | // vim: ft=cpp
32 |
--------------------------------------------------------------------------------
/src/edittoolbar.h:
--------------------------------------------------------------------------------
1 | #ifndef EDITTOOLBAR_H
2 | #define EDITTOOLBAR_H
3 |
4 | #include
5 | #include
6 | #include "actiondata.h"
7 | #include "ui_edittoolbar.h"
8 |
9 | class QListWidgetItem;
10 | class QListWidget;
11 |
12 | class EditToolBar : public QDialog
13 | {
14 | Q_OBJECT
15 |
16 | public:
17 | /*!
18 | constructor
19 | */
20 | EditToolBar(QWidget *parent = 0);
21 |
22 | /*!
23 | \returns the new list with the actions to load
24 | */
25 | QStringList getActionsList();
26 |
27 | /*!
28 | loads the \a actions in the tool bar, and \a allActions all the actions, including
29 | the given in \a actions. by setting it id (the Map key) and the ActionData (the Map value)
30 | */
31 | void setActionsList(QMap allActions, QStringList actions);
32 |
33 | /*!
34 | Loads the default actions
35 | @param defActions is a string list with the default action id's
36 | */
37 | inline void setDefaultActions(QStringList defActions){defaultActions = defActions;}
38 |
39 | signals:
40 | /*!
41 | Signal emitted when the user hits apply. It sends the new actionslist oredered.
42 | */
43 | void actionsChanged(QStringList);
44 |
45 | public slots:
46 |
47 | private:
48 | Ui_Dialog ui;
49 |
50 | /*!
51 | a map with all the action data that belong to the given id
52 | */
53 | QMap actionsMap;
54 |
55 | /*!
56 | a listwith all the actions that were loaded into the toolbar
57 | */
58 | QStringList actionsUsed;
59 |
60 | /*!
61 | Stores the app default actions
62 | */
63 | QStringList defaultActions;
64 |
65 | /*!
66 | the separator item
67 | */
68 | QListWidgetItem *separatorItem;
69 |
70 | /*!
71 | size of the icons
72 | */
73 | int iconSize;
74 |
75 | /*!
76 | it's true if the user made any search in current actions list, otherwise
77 | it's iqual to false
78 | */
79 | bool searchMade;
80 |
81 | /*!
82 | if the action has no icon asigned, then i use this to make
83 | the action gets aligned with the others, "it's a gosht icon"
84 | */
85 | QIcon emptyIcon();
86 |
87 | /*!
88 | don't know why i declared this
89 | */
90 | int getPositionToUse();
91 |
92 | /*!
93 | this is called after set the actions list to fill them
94 | */
95 | void configureActionList();
96 |
97 | /*!
98 | Add the item \a id to the given \a list in the position \a position.
99 | If \a position=-1, then it appends the item
100 | */
101 | void addItem(QString id, QListWidget *list, int position = -1);
102 |
103 | /*!
104 | Same than \see addItem(QString id, QListWidget *list, int position = -1), but here
105 | i use the actionData \a ad to add the item
106 | */
107 | void addItem(ActionData *ad, QListWidget *list, int position = -1);
108 |
109 | /*!
110 | Clears and fills the available actions list
111 | */
112 | void fillAvailableItemsWidget();
113 |
114 | /*!
115 | Clears and fills the current actions list
116 | */
117 | void fillCurrentItemsWidget();
118 |
119 | signals:
120 | void actionsListChanged();
121 |
122 | private slots:
123 | void applySlot();
124 | void okSlot();
125 | void actionsChangedSlot();
126 | void setDefaults();
127 |
128 | void addAction();
129 | void removeAction();
130 | void moveUpAction();
131 | void moveDownAction();
132 | void moveAction(int d);
133 | void updateButtons();
134 | void searchInAvailableActionsSlot(QString);
135 | void searchInCurrentActionsSlot(QString);
136 |
137 | };
138 |
139 | #endif // EDITTOOLBAR_H
140 |
--------------------------------------------------------------------------------
/src/eggsdialog.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include "eggsdialog.h"
3 | #include "settings.h"
4 |
5 | EggsDialog::EggsDialog(QWidget *parent) :
6 | QDialog(parent)
7 | {
8 | ui.setupUi(this);
9 | connect(ui.okButton, SIGNAL(clicked()), SLOT(saveSettings()));
10 | ui.okButton->setIcon(QIcon::fromTheme("dialog-ok"));
11 | ui.cancelButton->setIcon(QIcon::fromTheme("dialog-cancel"));
12 |
13 | loadSettings();
14 | if(!ui.enableEgg->isChecked()){
15 | ui.imageJokes->setEnabled(false);
16 | ui.binaryButton->setEnabled(false);
17 | ui.endTime->setEnabled(false);
18 | ui.beginTime->setEnabled(false);
19 | ui.label_4->setEnabled(false);
20 | ui.label_5->setEnabled(false);
21 | ui.label->setEnabled(false);
22 | ui.label_2->setEnabled(false);
23 | }
24 | }
25 |
26 | void EggsDialog::saveSettings()
27 | {
28 | QSettings settings("QIviewer", "qiviewer");
29 | settings.beginGroup("Eggs");
30 | settings.setValue("enableEggs", ui.enableEgg->isChecked());
31 | settings.setValue("imageJokes", ui.imageJokes->isChecked());
32 | settings.setValue("useBinary", ui.binaryButton->isChecked());
33 | settings.setValue("eggStart", setHour(ui.beginTime->time().hour(), ui.beginTime->time().minute()));
34 | settings.setValue("eggEnd", setHour(ui.endTime->time().hour(), ui.endTime->time().minute()));
35 | settings.endGroup();
36 | this->close();
37 | }
38 |
39 | void EggsDialog::loadSettings()
40 | {
41 | QSettings settings("QIviewer", "qiviewer");
42 | settings.beginGroup("Eggs");
43 | ui.enableEgg->setChecked(settings.value("enableEggs", true).toBool());
44 | ui.imageJokes->setChecked(settings.value("imageJokes", false).toBool());
45 | ui.binaryButton->setChecked(settings.value("useBinary", true).toBool());
46 |
47 | int endH, endM, begH, begM;
48 | getHour(settings.value("eggStart", setHour(0,0)).toString(), begH, begM);
49 | getHour(settings.value("eggEnd", setHour(0,30)).toString(), endH, endM);
50 | ui.endTime->setTime(QTime(endH, endM));
51 | ui.beginTime->setTime(QTime(begH, begM));
52 | settings.endGroup();
53 | }
54 |
55 | void EggsDialog::getHour(QString time, int &hour, int &min)
56 | {
57 | if(time.indexOf("@Time(") == -1){
58 | return;
59 | }
60 |
61 | time.remove("@Time(");
62 | time.remove(")");
63 |
64 | QStringList g = time.split(" ");
65 | hour = g.at(0).toInt();
66 | min = g.at(1).toInt();
67 |
68 | while(min > 59){
69 | hour++;
70 | min -= 60;
71 | }
72 |
73 | while(hour > 23){
74 | hour -= 24;
75 | }
76 |
77 | }
78 |
79 | QString EggsDialog::setHour(int hour, int min)
80 | {
81 | return QString("@Time(%1 %2)").arg(hour).arg(min);
82 | }
83 |
--------------------------------------------------------------------------------
/src/eggsdialog.h:
--------------------------------------------------------------------------------
1 | #ifndef EGGSDIALOG_H
2 | #define EGGSDIALOG_H
3 |
4 | #include
5 | #include "ui_eggsdialog.h"
6 |
7 | class EggsDialog : public QDialog
8 | {
9 | Q_OBJECT
10 | public:
11 | /*!
12 | constructor
13 | */
14 | EggsDialog(QWidget *parent = 0);
15 |
16 | private:
17 | Ui_eggsDialog ui;
18 |
19 | private slots:
20 | void saveSettings();
21 | void loadSettings();
22 |
23 | /**
24 | * @return \a hour and \a min from the given string
25 | * @param time string that contains the time
26 | * @param hour returns the hour
27 | * @param min returns the min
28 | */
29 | void getHour(QString time, int& hour, int& min);
30 |
31 | /**
32 | * @return a string containing the hour and min
33 | * @param hour pass the hour
34 | * @param min pass the minutes
35 | */
36 | QString setHour(int hour, int min);
37 |
38 | };
39 |
40 | #endif // EGGSDIALOG_H
41 |
--------------------------------------------------------------------------------
/src/fileproperties.cpp:
--------------------------------------------------------------------------------
1 | /*********************************************************************
2 | * Copyright (C) 2011 by Dario Ignacio Aguilera *
3 | * dario_21_06@hotmail.com *
4 | * *
5 | * This program is free software; you can redistribute it and/or *
6 | * modify it under the terms of the GNU General Public License *
7 | * as published by the Free Software Foundation; either version 2 *
8 | * of the License, or (at your option) any later version. *
9 | * *
10 | * This program is distributed in the hope that it will be useful, *
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 | * GNU General Public License for more details. *
14 | * *
15 | * You should have received a copy of the GNU General Public License *
16 | * along with this program; if not, write to the *
17 | * Free Software Foundation, Inc. *
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 | **********************************************************************/
20 |
21 | #include
22 | #include "fileproperties.h"
23 | #include "ui_fileproperties.h"
24 | #include "utils.h"
25 |
26 | FileProperties::FileProperties(QWidget* parent, Qt::WFlags fl)
27 | : QDialog( parent, fl )
28 | {
29 | ui.setupUi(this);
30 | ui.okButton->setIcon(QIcon::fromTheme("dialog-ok"));
31 |
32 | setWindowIcon(QIcon::fromTheme("document-properties"));
33 | }
34 |
35 | void FileProperties::setFile(const QString fileName, bool binary, int precision)
36 | {
37 | QFileInfo archivo(fileName);
38 | this->setWindowTitle(tr("%1's properties").arg(archivo.baseName()));
39 | ui.nameLabelF->setText(archivo.baseName());
40 | QString path;
41 | path.append("path
");
42 | path.replace("path", archivo.absolutePath());
43 | ui.pathLabelF->setText(path);
44 | ui.typeLabelF->setText(tr("%1 Image", "Image type").arg((archivo.completeSuffix()).toUpper()));
45 |
46 | QString size;
47 |
48 | //egg
49 | if(binary){
50 | //qDebug()<setText(tr("%1 Bytes").arg(size));
53 | ui.sizeLabelF->setToolTip(Utils::stringFromFile(":eastereggs.txt"));
54 | }
55 |
56 | else if((archivo.size() /1.024)*0.001 > 1000){
57 | size.setNum(((((archivo.size() /1.024)*0.001))/1.024) * 0.001,'f',precision);
58 | ui.sizeLabelF->setText(tr("%1 MiB (%2)").arg(size).arg(archivo.size()));
59 | }
60 |
61 | else{
62 | size.setNum((archivo.size() /1.024)*0.001, 'f', precision);
63 | ui.sizeLabelF->setText(tr("%1 KiB (%2)").arg(size).arg(archivo.size()));
64 | }
65 | }
66 |
67 | void FileProperties::setPreviewPixmap(const QPixmap prevPixmap)
68 | {
69 | ui.prevLabel->setPixmap(prevPixmap.scaled(ui.prevLabel->size(),Qt::KeepAspectRatio));
70 | }
71 |
72 | void FileProperties::setPictureSize(QSize size)
73 | {
74 | ui.heightLabelF->setText(tr("%1 Pixels").arg(size.height()));
75 | ui.widthLabelF->setText(tr("%1 Pixels").arg(size.width()));
76 | }
77 |
--------------------------------------------------------------------------------
/src/fileproperties.h:
--------------------------------------------------------------------------------
1 | /*********************************************************************
2 | * Copyright (C) 2010 by Dario Ignacio Aguilera *
3 | * dario_21_06@hotmail.com *
4 | * *
5 | * This program is free software; you can redistribute it and/or *
6 | * modify it under the terms of the GNU General Public License *
7 | * as published by the Free Software Foundation; either version 2 *
8 | * of the License, or (at your option) any later version. *
9 | * *
10 | * This program is distributed in the hope that it will be useful, *
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 | * GNU General Public License for more details. *
14 | * *
15 | * You should have received a copy of the GNU General Public License *
16 | * along with this program; if not, write to the *
17 | * Free Software Foundation, Inc. *
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 | **********************************************************************/
20 |
21 | #ifndef FILEPROPERTIES_H
22 | #define FILEPROPERTIES_H
23 |
24 | #include
25 | #include "ui_fileproperties.h"
26 |
27 | class FileProperties : public QDialog
28 | {
29 | Q_OBJECT
30 |
31 | public:
32 | /**
33 | * constructor
34 | */
35 | FileProperties(QWidget* parent = 0, Qt::WFlags fl = 0 );
36 |
37 | /**
38 | * Sets \a fileName as the file to be processed
39 | * @param useBinarySystem enable/disable the binary sistem notation to show the file size
40 | * @param sizePrecision sets the file's size precision to use
41 | */
42 | void setFile(const QString fileName, bool useBinarySystem=false, int sizePrecision=2);
43 |
44 | /**
45 | * Sets \a prevPixmap as the preview image to show in the dialog
46 | */
47 | void setPreviewPixmap(const QPixmap prevPixmap);
48 |
49 | /**
50 | * Sets \a size as the picture size (height and width) to show
51 | */
52 | void setPictureSize(QSize size);
53 |
54 | private:
55 | Ui_PropertiesDialog ui;
56 |
57 | };
58 | #endif
59 |
--------------------------------------------------------------------------------
/src/fileutils.h:
--------------------------------------------------------------------------------
1 | #ifndef FILEUTILS_H
2 | #define FILEUTILS_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | class QFileInfo;
9 |
10 | class FileUtils : public QObject
11 | {
12 | Q_OBJECT
13 |
14 | public:
15 | /**
16 | *constructor
17 | */
18 | FileUtils(QObject *parent = 0);
19 |
20 | /**
21 | * \enum Operation
22 | *
23 | * \brief Options to use for navigation between files
24 | */
25 | enum Operation{Next, ///
2 |
3 | ConfigDialog
4 |
5 |
6 |
7 | 0
8 | 0
9 | 632
10 | 357
11 |
12 |
13 |
14 |
15 | 0
16 | 0
17 |
18 |
19 |
20 |
21 | 750
22 | 358
23 |
24 |
25 |
26 | Dialog
27 |
28 |
29 | -
30 |
31 |
-
32 |
33 |
34 |
35 | 150
36 | 300
37 |
38 |
39 |
40 |
41 | 150
42 | 300
43 |
44 |
45 |
46 | Qt::ScrollBarAlwaysOff
47 |
48 |
49 | Qt::ScrollBarAlwaysOff
50 |
51 |
52 |
53 | 38
54 | 38
55 |
56 |
57 |
58 | 0
59 |
60 |
61 | 0
62 |
63 |
-
64 |
65 | General
66 |
67 |
68 | -
69 |
70 | Location
71 |
72 |
73 | -
74 |
75 | Toolbar
76 |
77 |
78 |
79 |
80 | -
81 |
82 |
83 | 0
84 |
85 |
86 |
87 |
-
88 |
89 |
90 |
91 |
92 |
93 |
94 | -
95 |
96 |
97 | Qt::Horizontal
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 | -
106 |
107 |
108 |
109 |
110 |
111 |
112 | -
113 |
114 |
115 | Qt::Horizontal
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 | -
124 |
125 |
126 |
127 |
128 |
129 |
130 | -
131 |
132 |
133 | Qt::Horizontal
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 | -
144 |
145 |
146 | Qt::Horizontal
147 |
148 |
149 |
150 | -
151 |
152 |
-
153 |
154 |
155 | Qt::Horizontal
156 |
157 |
158 |
159 | 40
160 | 20
161 |
162 |
163 |
164 |
165 | -
166 |
167 |
168 | false
169 |
170 |
171 | Ok
172 |
173 |
174 |
175 | -
176 |
177 |
178 | false
179 |
180 |
181 | Apply
182 |
183 |
184 |
185 | -
186 |
187 |
188 | Cancel
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 | listWidget
200 | currentRowChanged(int)
201 | stackedWidget
202 | setCurrentIndex(int)
203 |
204 |
205 | 93
206 | 178
207 |
208 |
209 | 573
210 | 6
211 |
212 |
213 |
214 |
215 | acceptButton
216 | clicked()
217 | ConfigDialog
218 | close()
219 |
220 |
221 | 478
222 | 337
223 |
224 |
225 | 397
226 | 331
227 |
228 |
229 |
230 |
231 | cancelButton
232 | clicked()
233 | ConfigDialog
234 | close()
235 |
236 |
237 | 589
238 | 338
239 |
240 |
241 | 347
242 | 332
243 |
244 |
245 |
246 |
247 |
248 |
--------------------------------------------------------------------------------
/src/forms/eggsdialog.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | eggsDialog
4 |
5 |
6 |
7 | 0
8 | 0
9 | 228
10 | 184
11 |
12 |
13 |
14 |
15 |
16 |
17 | -
18 |
19 |
-
20 |
21 |
22 | QFrame::NoFrame
23 |
24 |
25 | Enable eggs
26 |
27 |
28 |
29 | -
30 |
31 |
32 | Qt::RightToLeft
33 |
34 |
35 |
36 |
37 |
38 |
39 | -
40 |
41 |
42 | Enable binary notation
43 |
44 |
45 |
46 | -
47 |
48 |
49 | Qt::RightToLeft
50 |
51 |
52 |
53 |
54 |
55 |
56 | -
57 |
58 |
59 | Enable image jokes
60 |
61 |
62 |
63 | -
64 |
65 |
66 | Qt::RightToLeft
67 |
68 |
69 |
70 |
71 |
72 |
73 | -
74 |
75 |
76 | Begin
77 |
78 |
79 |
80 | -
81 |
82 |
83 | -
84 |
85 |
86 | End
87 |
88 |
89 |
90 | -
91 |
92 |
93 |
94 |
95 | -
96 |
97 |
-
98 |
99 |
100 | Qt::Horizontal
101 |
102 |
103 |
104 | 40
105 | 20
106 |
107 |
108 |
109 |
110 | -
111 |
112 |
113 | &Ok
114 |
115 |
116 |
117 | -
118 |
119 |
120 | &Cancel
121 |
122 |
123 |
124 |
125 |
126 | -
127 |
128 |
129 | Qt::Vertical
130 |
131 |
132 |
133 | 20
134 | 12
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 | cancelButton
145 | clicked()
146 | eggsDialog
147 | close()
148 |
149 |
150 | 158
151 | 149
152 |
153 |
154 | 197
155 | 155
156 |
157 |
158 |
159 |
160 | enableEgg
161 | toggled(bool)
162 | label_4
163 | setEnabled(bool)
164 |
165 |
166 | 163
167 | 10
168 |
169 |
170 | 10
171 | 38
172 |
173 |
174 |
175 |
176 | enableEgg
177 | toggled(bool)
178 | label_5
179 | setEnabled(bool)
180 |
181 |
182 | 158
183 | 19
184 |
185 |
186 | 29
187 | 64
188 |
189 |
190 |
191 |
192 | enableEgg
193 | toggled(bool)
194 | binaryButton
195 | setEnabled(bool)
196 |
197 |
198 | 161
199 | 18
200 |
201 |
202 | 157
203 | 32
204 |
205 |
206 |
207 |
208 | enableEgg
209 | toggled(bool)
210 | imageJokes
211 | setEnabled(bool)
212 |
213 |
214 | 164
215 | 13
216 |
217 |
218 | 167
219 | 65
220 |
221 |
222 |
223 |
224 | enableEgg
225 | toggled(bool)
226 | beginTime
227 | setEnabled(bool)
228 |
229 |
230 | 173
231 | 25
232 |
233 |
234 | 173
235 | 88
236 |
237 |
238 |
239 |
240 | enableEgg
241 | toggled(bool)
242 | endTime
243 | setEnabled(bool)
244 |
245 |
246 | 165
247 | 16
248 |
249 |
250 | 209
251 | 119
252 |
253 |
254 |
255 |
256 | enableEgg
257 | toggled(bool)
258 | label
259 | setEnabled(bool)
260 |
261 |
262 | 159
263 | 15
264 |
265 |
266 | 115
267 | 87
268 |
269 |
270 |
271 |
272 | enableEgg
273 | toggled(bool)
274 | label_2
275 | setEnabled(bool)
276 |
277 |
278 | 162
279 | 17
280 |
281 |
282 | 130
283 | 120
284 |
285 |
286 |
287 |
288 |
289 |
--------------------------------------------------------------------------------
/src/forms/fileproperties.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | PropertiesDialog
4 |
5 |
6 |
7 | 0
8 | 0
9 | 371
10 | 177
11 |
12 |
13 |
14 |
15 | 0
16 | 0
17 |
18 |
19 |
20 |
21 | 16777215
22 | 177
23 |
24 |
25 |
26 | %1's properties
27 |
28 |
29 | -
30 |
31 |
-
32 |
33 |
34 | <b>Location:</b>
35 |
36 |
37 |
38 | -
39 |
40 |
41 | QFrame::NoFrame
42 |
43 |
44 | TextLabel
45 |
46 |
47 | Qt::RichText
48 |
49 |
50 | true
51 |
52 |
53 | Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse
54 |
55 |
56 |
57 |
58 |
59 | -
60 |
61 |
-
62 |
63 |
64 |
65 | 90
66 | 90
67 |
68 |
69 |
70 |
71 | 50
72 | 105
73 |
74 |
75 |
76 |
77 | 50
78 | 105
79 |
80 |
81 |
82 | QFrame::StyledPanel
83 |
84 |
85 | QFrame::Sunken
86 |
87 |
88 | TextLabel
89 |
90 |
91 | false
92 |
93 |
94 | Qt::AlignCenter
95 |
96 |
97 |
98 | -
99 |
100 |
101 | QFormLayout::ExpandingFieldsGrow
102 |
103 |
104 | Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter
105 |
106 |
-
107 |
108 |
109 | <b>Type:</b>
110 |
111 |
112 |
113 | -
114 |
115 |
116 | TextLabel
117 |
118 |
119 | Qt::TextSelectableByMouse
120 |
121 |
122 |
123 | -
124 |
125 |
126 | <b>Size:</b>
127 |
128 |
129 |
130 | -
131 |
132 |
133 | TextLabel
134 |
135 |
136 | Qt::TextSelectableByMouse
137 |
138 |
139 |
140 | -
141 |
142 |
143 | <b>Height:</b>
144 |
145 |
146 |
147 | -
148 |
149 |
150 | TextLabel
151 |
152 |
153 | Qt::TextSelectableByMouse
154 |
155 |
156 |
157 | -
158 |
159 |
160 | <b>Width:</b>
161 |
162 |
163 |
164 | -
165 |
166 |
167 | TextLabel
168 |
169 |
170 | Qt::TextSelectableByMouse
171 |
172 |
173 |
174 | -
175 |
176 |
177 | <b>Name:</b>
178 |
179 |
180 |
181 | -
182 |
183 |
184 | TextLabel
185 |
186 |
187 | Qt::TextSelectableByMouse
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 | -
196 |
197 |
198 | Qt::Horizontal
199 |
200 |
201 |
202 | -
203 |
204 |
-
205 |
206 |
207 | Qt::Horizontal
208 |
209 |
210 |
211 | 40
212 | 20
213 |
214 |
215 |
216 |
217 | -
218 |
219 |
220 | &Ok
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 | okButton
232 | clicked()
233 | PropertiesDialog
234 | close()
235 |
236 |
237 | 367
238 | 142
239 |
240 |
241 | 290
242 | 142
243 |
244 |
245 |
246 |
247 |
248 |
--------------------------------------------------------------------------------
/src/forms/gotodialog.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | goToDialog
4 |
5 |
6 |
7 | 0
8 | 0
9 | 250
10 | 93
11 |
12 |
13 |
14 |
15 |
16 |
17 | -
18 |
19 |
-
20 |
21 |
22 | Name
23 |
24 |
25 |
26 | -
27 |
28 |
29 | -
30 |
31 |
32 | Position
33 |
34 |
35 |
36 | -
37 |
38 |
39 | true
40 |
41 |
42 |
43 |
44 |
45 | -
46 |
47 |
-
48 |
49 |
50 | Qt::Horizontal
51 |
52 |
53 |
54 | 40
55 | 20
56 |
57 |
58 |
59 |
60 | -
61 |
62 |
63 | &Go
64 |
65 |
66 | true
67 |
68 |
69 |
70 | -
71 |
72 |
73 | &Cancel
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 | cancelButton
85 | clicked()
86 | goToDialog
87 | close()
88 |
89 |
90 | 105
91 | 72
92 |
93 |
94 | 232
95 | 88
96 |
97 |
98 |
99 |
100 |
101 |
--------------------------------------------------------------------------------
/src/forms/locationpage.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | LocationPage
4 |
5 |
6 |
7 | 0
8 | 0
9 | 400
10 | 300
11 |
12 |
13 |
14 |
15 |
16 |
17 | -
18 |
19 |
-
20 |
21 |
22 | Use last folder
23 |
24 |
25 |
26 | -
27 |
28 |
29 | Use a different location:
30 |
31 |
32 |
33 | -
34 |
35 |
-
36 |
37 |
38 | false
39 |
40 |
41 | ...
42 |
43 |
44 | true
45 |
46 |
47 |
48 | -
49 |
50 |
51 | false
52 |
53 |
54 | true
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 | -
63 |
64 |
65 | Qt::Vertical
66 |
67 |
68 |
69 | 389
70 | 208
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
--------------------------------------------------------------------------------
/src/forms/shortcuteditor.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | ShortcutEditor
4 |
5 |
6 |
7 | 0
8 | 0
9 | 630
10 | 400
11 |
12 |
13 |
14 | Shortcuts
15 |
16 |
17 | -
18 |
19 |
-
20 |
21 |
22 | Search:
23 |
24 |
25 |
26 | -
27 |
28 |
29 | -
30 |
31 |
32 |
33 |
34 |
35 | true
36 |
37 |
38 |
39 |
40 |
41 | -
42 |
43 |
44 | 2
45 |
46 |
47 |
48 | 1
49 |
50 |
51 |
52 |
53 | 2
54 |
55 |
56 |
57 |
58 | -
59 |
60 |
-
61 |
62 |
63 | Qt::Horizontal
64 |
65 |
66 |
67 | 40
68 | 20
69 |
70 |
71 |
72 |
73 |
74 |
75 | -
76 |
77 |
-
78 |
79 |
80 | Defaults
81 |
82 |
83 |
84 | -
85 |
86 |
87 | Qt::Horizontal
88 |
89 |
90 |
91 | 40
92 | 20
93 |
94 |
95 |
96 |
97 | -
98 |
99 |
100 | false
101 |
102 |
103 | &Ok
104 |
105 |
106 |
107 | -
108 |
109 |
110 | false
111 |
112 |
113 | &Apply
114 |
115 |
116 |
117 | -
118 |
119 |
120 | &Cancel
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 | cancelButton
132 | clicked()
133 | ShortcutEditor
134 | close()
135 |
136 |
137 | 591
138 | 379
139 |
140 |
141 | 597
142 | 397
143 |
144 |
145 |
146 |
147 | clearButton
148 | clicked()
149 | searchWidget
150 | clear()
151 |
152 |
153 | 609
154 | 19
155 |
156 |
157 | 572
158 | 18
159 |
160 |
161 |
162 |
163 |
164 |
--------------------------------------------------------------------------------
/src/forms/toolbarpage.ui:
--------------------------------------------------------------------------------
1 |
2 |
3 | ToolbarPage
4 |
5 |
6 |
7 | 0
8 | 0
9 | 449
10 | 229
11 |
12 |
13 |
14 |
15 |
16 |
17 | -
18 |
19 |
20 | Lock the toolbar position
21 |
22 |
23 |
24 | -
25 |
26 |
27 | Toolbar visible
28 |
29 |
30 |
31 | -
32 |
33 |
-
34 |
35 |
36 | Position
37 |
38 |
39 |
-
40 |
41 |
42 | Top
43 |
44 |
45 |
46 | -
47 |
48 |
49 | Bottom
50 |
51 |
52 |
53 | -
54 |
55 |
56 | Right
57 |
58 |
59 |
60 | -
61 |
62 |
63 | Left
64 |
65 |
66 |
67 | -
68 |
69 |
70 | Qt::Vertical
71 |
72 |
73 |
74 | 20
75 | 40
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 | -
84 |
85 |
86 | Buttom style
87 |
88 |
89 |
-
90 |
91 |
92 | Only icons
93 |
94 |
95 |
96 | -
97 |
98 |
99 | Only text
100 |
101 |
102 |
103 | -
104 |
105 |
106 | Text beside icons
107 |
108 |
109 |
110 | -
111 |
112 |
113 | Text under icons
114 |
115 |
116 |
117 | -
118 |
119 |
120 | Follow style
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 | -
130 |
131 |
132 | Qt::Vertical
133 |
134 |
135 |
136 | 441
137 | 48
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 | toolbarVisible
148 | toggled(bool)
149 | lockToolbar
150 | setEnabled(bool)
151 |
152 |
153 | 110
154 | 34
155 |
156 |
157 | 113
158 | 10
159 |
160 |
161 |
162 |
163 |
164 |
--------------------------------------------------------------------------------
/src/generaloptionspage.h:
--------------------------------------------------------------------------------
1 | #ifndef GENERALOPTIONSPAGE_H
2 | #define GENERALOPTIONSPAGE_H
3 |
4 | #include
5 |
6 | class Settings;
7 |
8 | namespace Ui {
9 | class GeneralOptionsPage;
10 | }
11 |
12 | class GeneralOptionsPage : public QWidget
13 | {
14 | Q_OBJECT
15 |
16 | public:
17 | GeneralOptionsPage(QWidget *parent = 0);
18 | ~GeneralOptionsPage();
19 |
20 | public slots:
21 | void saveSettings();
22 | bool canSave() const{return settingsChangedBool;}
23 |
24 | signals:
25 | void settingsChanged();
26 |
27 | private:
28 | Ui::GeneralOptionsPage *ui;
29 | Settings *settings;
30 |
31 | bool settingsChangedBool;
32 |
33 | QStringList rflBack;
34 | QColor color;
35 | QPixmap iconForButton();
36 | QStringList setColorSettings();
37 | void getColorFromSettings(QStringList);
38 | int getBGSelection(int);//0->returns the settings selectins
39 | //1->returns the combobox selecteditem
40 |
41 | private slots:
42 | void paintSquaresSample(int);
43 | void bgComboBoxSlot(int);
44 | void selectColorSlot();
45 | void deleteRecentFilesList(QString);
46 | void settingsChangedSlot();
47 |
48 | };
49 |
50 | #endif // GENERALOPTIONSPAGE_H
51 |
--------------------------------------------------------------------------------
/src/gotodialog.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include "gotodialog.h"
3 |
4 | GoToDialog::GoToDialog(QWidget *parent) :
5 | QDialog(parent)
6 | {
7 | ui.setupUi(this);
8 | ui.nameLine->setEnabled(false);
9 | ui.positionLine->setEnabled(false);
10 |
11 | ui.cancelButton->setIcon(QIcon::fromTheme("dialog-cancel"));
12 | ui.goButton->setIcon(QIcon::fromTheme("dialog-ok"));
13 |
14 | connect(ui.goButton, SIGNAL(clicked()), this, SLOT(goSlot()));
15 | connect(ui.cancelButton, SIGNAL(clicked()), this, SLOT(cancelSlot()));
16 | connect(ui.positionLine, SIGNAL(valueChanged(int)), this, SLOT(spinSlot(int)));
17 | connect(ui.nameLine, SIGNAL(textChanged(QString)), this, SLOT(nameLineSlot(QString)));
18 | }
19 |
20 | void GoToDialog::setList(QStringList list)
21 | {
22 | completer = new QCompleter(list);
23 | this->list = list;
24 | completer->setCompletionMode(QCompleter::PopupCompletion);
25 | ui.nameLine->setEnabled(true);
26 | ui.nameLine->setCompleter(completer);
27 | }
28 |
29 | void GoToDialog::setRange(int min, int max, int pos)
30 | {
31 | oldPos = pos;
32 | ui.positionLine->setRange(min, max);
33 | ui.positionLine->setValue(pos + 1);
34 | ui.positionLine->setEnabled(true);
35 | ui.nameLine->setText(list.at(pos));
36 | }
37 |
38 | void GoToDialog::cancelSlot()
39 | {
40 | emit goTo("", oldPos);
41 | this->close();
42 | }
43 |
44 | void GoToDialog::goSlot()
45 | {
46 | emit goTo(ui.nameLine->text(), ui.positionLine->value() - 1);
47 | this->close();
48 | }
49 |
50 | void GoToDialog::nameLineSlot(QString d)
51 | {
52 | Q_UNUSED(d);
53 | ui.positionLine->setValue(list.lastIndexOf(ui.nameLine->text()) + 1);
54 | }
55 |
56 | void GoToDialog::spinSlot(int d)
57 | {
58 | ui.nameLine->setText(list.at(d-1));
59 | emit goTo(list.at(d-1), d-1);
60 | }
61 |
--------------------------------------------------------------------------------
/src/gotodialog.h:
--------------------------------------------------------------------------------
1 | #ifndef GOTODIALOG_H
2 | #define GOTODIALOG_H
3 |
4 | #include
5 | #include "ui_gotodialog.h"
6 |
7 | class GoToDialog : public QDialog
8 | {
9 | Q_OBJECT
10 | public:
11 | /*!
12 | * constructor
13 | */
14 | GoToDialog(QWidget *parent = 0);
15 |
16 | /*!
17 | * sets \a list as the list to use for the autocompletion
18 | */
19 | void setList(QStringList list);
20 |
21 | /*!
22 | * sets the range(\a min, \a max) to use in the spin box, and sets it to \a pos
23 | * */
24 | void setRange(int min, int max, int pos);
25 |
26 | signals:
27 | /*!
28 | * signal emited when clicking on go button, it send the \a name selected
29 | * and the \a postion
30 | */
31 | void goTo(QString name, int pos);
32 |
33 | private:
34 | Ui_goToDialog ui;
35 |
36 | //a completer for the QLineEdit object
37 | QCompleter *completer;
38 |
39 | //a list qith the files so the completer knows what to recomend
40 | QStringList list;
41 |
42 | //stores old position
43 | int oldPos;
44 |
45 | private slots:
46 | void goSlot();
47 | void cancelSlot();
48 | void spinSlot(int);
49 | void nameLineSlot(QString);
50 |
51 | };
52 |
53 | #endif // GOTODIALOG_H
54 |
--------------------------------------------------------------------------------
/src/imagewidget.h:
--------------------------------------------------------------------------------
1 | /*********************************************************************
2 | * Copyright (C) 2010 by Dario Ignacio Aguilera *
3 | * dario_21_06@hotmail.com *
4 | * *
5 | * This program is free software; you can redistribute it and/or *
6 | * modify it under the terms of the GNU General Public License *
7 | * as published by the Free Software Foundation; either version 2 *
8 | * of the License, or (at your option) any later version. *
9 | * *
10 | * This program is distributed in the hope that it will be useful, *
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 | * GNU General Public License for more details. *
14 | * *
15 | * You should have received a copy of the GNU General Public License *
16 | * along with this program; if not, write to the *
17 | * Free Software Foundation, Inc. *
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 | **********************************************************************/
20 |
21 | #ifndef IMAGEWIDGET_H
22 | #define IMAGEWIDGET_H
23 |
24 | #include
25 |
26 | class QLabel;
27 | class QString;
28 | class QHBoxLayout;
29 | class QPixmap;
30 | class QMovie;
31 | class QPaintEvent;
32 | class QSize;
33 | class QPoint;
34 |
35 | class ImageWidget : public QWidget
36 | {
37 | Q_OBJECT
38 |
39 | protected:
40 | void paintEvent(QPaintEvent *);
41 | void wheelEvent(QWheelEvent *);
42 | void mousePressEvent(QMouseEvent *);
43 | void mouseMoveEvent(QMouseEvent *);
44 | void mouseReleaseEvent(QMouseEvent *);
45 | void resizeEvent(QResizeEvent *);
46 |
47 | public:
48 | /**
49 | * \enum ImageWidget::Transform
50 | */
51 | enum Transform{
52 | toLeft, ///0){cbsSize = size;}}
102 |
103 | /**
104 | * sets \a color as the color in the solidColor background
105 | */
106 | inline void setBackgroundColor(QColor color){backColor = color;}
107 |
108 | /**
109 | * if \a restart is true, when making zoom the image reproduction will
110 | * be restarted
111 | * it's only for animated images
112 | */
113 | inline void setRestartWhenZooming(bool restart){restartWhenZooming = restart;}
114 |
115 | /**
116 | * if \a stop is true, the animated image reproduction will be stopped
117 | * after it reaches it's final frame
118 | */
119 | inline void setStopWhenFinish(bool stop){stopWhenFinish = stop;}
120 |
121 | /**
122 | * this is an egg
123 | * if \a invert is true, inverts all pixel values in the image
124 | */
125 | inline void invertColors(bool invert){invertedColors = invert;}
126 |
127 | /**
128 | * @return a copy of the image
129 | */
130 | inline QPixmap getPixmap() const{return pixmap;}
131 |
132 | /**
133 | * @return the name of the previous image that was setted
134 | */
135 | inline QString getPrevFile() const{return prevFile;}
136 |
137 | /**
138 | * @return the animated image speed
139 | */
140 | inline int getMovieSpeed() const{return movieSpeed;}
141 |
142 | /**
143 | * @return if the animated image reproduction will be stopped or not
144 | * after reach its final frame
145 | */
146 | inline bool getStopWhenFinish() const{return stopWhenFinish;}
147 |
148 | /**
149 | * @return the image's size
150 | */
151 | QSize getPictureSize() const;
152 |
153 | /**
154 | * @returns the background type
155 | */
156 | QString getBGType() const;
157 |
158 | /**
159 | * @returns true if the current image, tha one that is going to be saved, is a non-animated
160 | *image, otherwise return false
161 | */
162 | bool canSave() const;
163 |
164 |
165 | public slots:
166 | /**
167 | * this slot is used to make zoom
168 | */
169 | void makeZoom(double); //when this is iqual to 1, the zoom is %100
170 |
171 | /**
172 | * sets \a speed as the movie speed
173 | * it's in percentage, being 100 the normal and default speed
174 | */
175 | void setMovieSpeed(int speed);
176 |
177 | signals:
178 | /**
179 | * this signal is sent every time an image is setted. it's true if
180 | * the object could open the image and false if not
181 | */
182 | void couldOpen(bool);
183 |
184 | /**
185 | * signal sent every time the image size change, for example when making zoom
186 | */
187 | void picSizeChanged();
188 |
189 | /*!
190 | signal sent when the image change, for example when it makes a transformation
191 | */
192 | void pixmapChanged();
193 |
194 | /**
195 | * signal sent when making zoom with the mouse wheel
196 | * -1->zoom in, -1->zoom out
197 | */
198 | void wheelZoom(int);
199 |
200 | /**
201 | * this is to move the image with the mouse,
202 | * being the first argument the inicial position and the second the final
203 | * position
204 | */
205 | void moveWidget(QPoint, QPoint);
206 |
207 | private:
208 | /**
209 | * \enum ImageWidget::Elementipe
210 | * posibles types for images.
211 | */
212 | enum ElementType{
213 | None, ///
2 | #include "mname.h"
3 | #include "locationpage.h"
4 | #include "settings.h"
5 | #include "ui_locationpage.h"
6 |
7 | LocationPage::LocationPage(QWidget *parent) :
8 | QWidget(parent),
9 | ui(new Ui::LocationPage)
10 | {
11 | //set up ui
12 | ui->setupUi(this);
13 |
14 | //settings
15 | settings = new Settings;
16 | settings->loadSettings();
17 |
18 | //connections, use just one button, becouse when its unselected the other one is selected, and the signal is emited
19 | connect(ui->selectFolderButton, SIGNAL(pressed()), this, SLOT(openDirSlot()));
20 | connect(ui->locationOption1, SIGNAL(toggled(bool)), this, SLOT(settingsChangedSlot()));
21 |
22 | //sets last dir option tooltip
23 | ui->locationOption1->setToolTip(settings->getLastDirUsed());
24 |
25 | //sets option prefered
26 | switch (settings->getPathToUse())
27 | {
28 | case 0:
29 | ui->locationOption1->setChecked(true);
30 | break;
31 | case 1:
32 | ui->locationOption2->setChecked(true);
33 | break;
34 | }
35 |
36 | //sets the select folder button icon and tooltip, then make the connection
37 | ui->selectFolderButton->setIcon(QIcon::fromTheme("document-open-folder"));
38 | ui->selectFolderButton->setToolTip(tr("Change default location"));
39 |
40 | //sets the line edit text
41 | ui->defaultPathLineEdit->setText(settings->getDefaultPath());
42 |
43 | settingsChangedBool = false;
44 | }
45 |
46 | int LocationPage::getLastDirOption()
47 | {
48 | if (ui->locationOption1->isChecked())
49 | {
50 | return 0;
51 | }
52 | if (ui->locationOption2->isChecked())
53 | {
54 | return 1;
55 | }
56 | return 0;
57 | }
58 |
59 | void LocationPage::openDirSlot()
60 | {
61 | QString dirName = QFileDialog::getExistingDirectory(this, tr("Select folder"),
62 | settings->getDefaultPath(), QFileDialog::ShowDirsOnly
63 | | QFileDialog::DontResolveSymlinks);
64 |
65 | if (dirName.size() != 0)
66 | {
67 | settings->setDefaultPath(dirName);
68 | ui->defaultPathLineEdit->setText(dirName);
69 | settingsChangedSlot();
70 | }
71 | }
72 |
73 | LocationPage::~LocationPage()
74 | {
75 | delete ui;
76 | }
77 |
78 | void LocationPage::saveSettings()
79 | {
80 | qDebug() << __METHOD_NAME__ ;
81 | if(settingsChangedBool){
82 | settings->setDefaultPath(ui->defaultPathLineEdit->text());
83 | settings->setPathToUse(this->getLastDirOption());
84 | settings->saveSettings();
85 | settingsChangedBool = false;
86 | }
87 | }
88 |
89 | void LocationPage::settingsChangedSlot()
90 | {
91 | settingsChangedBool = true;
92 | emit settingsChanged();
93 | }
94 |
--------------------------------------------------------------------------------
/src/locationpage.h:
--------------------------------------------------------------------------------
1 | #ifndef LOCATIONPAGE_H
2 | #define LOCATIONPAGE_H
3 |
4 | #include
5 |
6 | class Settings;
7 |
8 | namespace Ui {
9 | class LocationPage;
10 | }
11 |
12 | class LocationPage : public QWidget
13 | {
14 | Q_OBJECT
15 |
16 | public:
17 | explicit LocationPage(QWidget *parent = 0);
18 | ~LocationPage();
19 |
20 | signals:
21 | void settingsChanged();
22 |
23 | public slots:
24 | void saveSettings();
25 | bool canSave() const{return settingsChangedBool;}
26 |
27 | private:
28 | Ui::LocationPage *ui;
29 | Settings *settings;
30 | int getLastDirOption();
31 | bool settingsChangedBool;
32 |
33 | private slots:
34 | void settingsChangedSlot();
35 | void openDirSlot();
36 |
37 | };
38 |
39 | #endif // LOCATIONPAGE_H
40 |
--------------------------------------------------------------------------------
/src/main.cpp:
--------------------------------------------------------------------------------
1 | /*********************************************************************
2 | * Copyright (C) 2010 by Dario Ignacio Aguilera *
3 | * dario_21_06@hotmail.com *
4 | * *
5 | * This program is free software; you can redistribute it and/or *
6 | * modify it under the terms of the GNU General Public License *
7 | * as published by the Free Software Foundation; either version 2 *
8 | * of the License, or (at your option) any later version. *
9 | * *
10 | * This program is distributed in the hope that it will be useful, *
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 | * GNU General Public License for more details. *
14 | * *
15 | * You should have received a copy of the GNU General Public License *
16 | * along with this program; if not, write to the *
17 | * Free Software Foundation, Inc. *
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 | **********************************************************************/
20 |
21 | #include
22 | #include
23 | #include
24 | #include "mname.h"
25 | #include "defines.h"
26 | #include "mainwindow.h"
27 | #include "eggsdialog.h"
28 | #include "configdialog.h"
29 |
30 | int main(int argc, char* argv[])
31 | {
32 | QApplication app(argc, argv);
33 |
34 | //all the translation stuff was taken from minitube
35 | const QString locale = QLocale::system().name();
36 |
37 | // qt translations
38 | QTranslator qtTranslator;
39 | qtTranslator.load("qt_" + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath));
40 | app.installTranslator(&qtTranslator);
41 |
42 | // app translations
43 | QString dataDir = QLatin1String(PKGDATADIR);
44 | qDebug() << __METHOD_NAME__ << "Data dir: " << __FUNCTION__ << dataDir;
45 |
46 | #ifdef USE_DEVELOPING
47 | qDebug() << __METHOD_NAME__ << "Developing";
48 | QString localeDir = qApp->applicationDirPath() + QDir::separator() + "locale";
49 | #else
50 | qDebug() << __METHOD_NAME__ << "Not developing";
51 | #if defined(Q_OS_OS2) //|| defined(Q_OS_WIN) ->this isn't checked
52 | QString localeDir = qApp->applicationDirPath() + QDir::separator() + "locale";
53 | #else
54 | QString localeDir = dataDir + QDir::separator() + "locale";
55 | #endif
56 | #endif
57 |
58 | qDebug() << __METHOD_NAME__ << "Locale dir: " << localeDir;
59 | QTranslator translator;
60 | translator.load(locale, localeDir);
61 | app.installTranslator(&translator);
62 |
63 | #ifndef Q_OS_LINUX
64 | QString BUILTIN_ICON_THEME = "oxygen";
65 | QIcon::setThemeName(BUILTIN_ICON_THEME);
66 | #endif
67 |
68 | /**
69 | *command line stuff
70 | */
71 | int next_option;
72 | int re = 0;
73 | const char* const short_options = "hevc";
74 | const struct option long_options[] =
75 | {
76 | {"help", 0, NULL, 'h'},
77 | {"eggs", 0, NULL, 'e'},
78 | {"version", 0, NULL, 'v'},
79 | {"configure",0, NULL, 'c'},
80 | {NULL, 0, NULL, 0}
81 | };
82 |
83 | next_option = getopt_long(argc, argv, short_options, long_options, NULL);
84 |
85 | if (next_option == 'h')
86 | {
87 | std::cout << QString("If you have problems with the toolbar and the actions, try deleting the file .config/QIviewer/qiviewer.conf\n"
88 | "How to use: qiviewer [OPTION/FILE]\n"
89 | "Avaible options:\n"
90 | " -h --help shows this help and finish\n"
91 | " -v --version shows qiviewer version\n"
92 | " -e --eggs shows eggs dialog\n"
93 | " -c --configuration shows the configuration dialog\n").toStdString();
94 | re = 0;
95 | }
96 |
97 | else if (next_option == 'c')
98 | {
99 | ConfigDialog con;
100 | con.setWindowTitle("QIviewer configuration");
101 | con.exec();
102 | re = 0;
103 | }
104 |
105 | else if (next_option == '?')
106 | {
107 | std::cout << QString("Try 'qiviewer --help' for more information\n").toStdString();
108 | re = 0;
109 | }
110 |
111 | else if (next_option == 'v')
112 | {
113 | std::cout << QString("QIviewer %1\n"
114 | "Copyright (C) 2011 Aguilera Dario.\n"
115 | "License GPLv2+.\n"
116 | ".\n"
117 | "This is free software: you are free to change it and redistribute.\n"
118 | "There is NO WARRANTY.\n"
119 | ).arg(QLatin1String(PROJECT_VERSION)).toStdString();
120 | re = 0;
121 | }
122 |
123 | else if (next_option == 'e')
124 | {
125 | EggsDialog ed;
126 | re = ed.exec();
127 | }
128 |
129 | else if (next_option == -1)
130 | {
131 | MainWindow imageViewer;
132 | if (QApplication::arguments().size() > 1)
133 | imageViewer.openImageFromCommandLine(QApplication::arguments());
134 | imageViewer.show();
135 | re = app.exec();
136 | }
137 |
138 | return re;
139 | }
140 |
--------------------------------------------------------------------------------
/src/mainwindow.h:
--------------------------------------------------------------------------------
1 | /*********************************************************************
2 | * Copyright (C) 2010 by Dario Ignacio Aguilera *
3 | * dario_21_06@hotmail.com *
4 | * *
5 | * This program is free software; you can redistribute it and/or *
6 | * modify it under the terms of the GNU General Public License *
7 | * as published by the Free Software Foundation; either version 2 *
8 | * of the License, or (at your option) any later version. *
9 | * *
10 | * This program is distributed in the hope that it will be useful, *
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 | * GNU General Public License for more details. *
14 | * *
15 | * You should have received a copy of the GNU General Public License *
16 | * along with this program; if not, write to the *
17 | * Free Software Foundation, Inc. *
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 | **********************************************************************/
20 |
21 | #ifndef MAINWINDOW_H
22 | #define MAINWINDOW_H
23 |
24 | #include
25 | #include
26 | #ifndef QT_NO_PRINTER
27 | #include
28 | #endif
29 |
30 | class QAction;
31 | class QMenu;
32 | class QScrollArea;
33 | class QAbstractScrollArea;
34 | class QToolBar;
35 | class QSlider;
36 | class QMovie;
37 | class QFileInfo;
38 | class QPaintEvent;
39 | class QMouseEvent;
40 | class QShortcut;
41 | class ZoomUtils;
42 | class ImageWidget;
43 | class Settings;
44 | class FileUtils;
45 | class ActionsManager;
46 |
47 | enum ImageType{
48 | Static, //this is for static images, such as jpeg's or not animated gif ones
49 | Dynamic, //animated images, such as animated gif or png
50 | Webp //needed becouse qt doesn't handle this yet
51 | };
52 |
53 | class MainWindow : public QMainWindow
54 | {
55 | Q_OBJECT
56 |
57 | public:
58 | /**
59 | * constructor
60 | */
61 | MainWindow();
62 |
63 | /**
64 | * Load app command from command line
65 | * @param d is the list of the parameters passed
66 | */
67 | void openImageFromCommandLine(const QStringList);
68 |
69 | public slots:
70 | /*!
71 | Loads the last file used
72 | */
73 | void openLastFile();
74 |
75 | protected:
76 | void resizeEvent(QResizeEvent *);
77 | void closeEvent(QCloseEvent *event);
78 |
79 | private:
80 | //variables
81 | FileUtils *fileUtils;
82 | Settings *settings;
83 | ActionsManager *actionsManager;
84 | ImageType imageType;
85 | ImageWidget *imageWidget;
86 | ZoomUtils *zoomWidget;
87 | QSlider *zoomSlider;
88 | bool showZoomSlider;
89 | bool imageSetted;
90 | bool pixmapChanged;
91 | int compressLevel;
92 | QStringList nameFilters;
93 | QStringList writableNameFilters;
94 |
95 | QScrollArea *scrollArea;
96 | QStringList actionsLoaded;
97 | QString lastDirUsed;//could i delete it and just use archivo->absoluteFilePath()? nop
98 | int pathToUse;//0=lastDir, 1=default
99 | QString defaultPath;
100 | int maxRecentFiles;
101 | QList recentFilesAct;
102 | QMap defaultShortcuts;
103 | QStringList recentFilesPath;
104 | QAction *deleteRecentFilesAct;
105 |
106 | //toolbar and menus
107 | QToolBar *mainToolBar;
108 | QMenu *fileMenu;
109 | QMenu *viewMenu;
110 | QMenu *editMenu;
111 | QMenu *goMenu;
112 | QMenu *imageMenu;
113 | QMenu *helpMenu;
114 | QMenu *recentFilesMenu;
115 | QMenu *tbMenu;
116 |
117 | #ifndef QT_NO_PRINTER
118 | QPrinter printer;
119 | #endif
120 | #ifdef __linux__
121 | //functions
122 | void checkIconTheme();
123 | #endif
124 | /*!
125 | \returns the last directory/path used
126 | */
127 | QString getLastDir() const;
128 |
129 | /*!
130 | create and configure the actions
131 | */
132 | void createActions();
133 |
134 | /*!
135 | create and configure the menus
136 | */
137 | void createMenus();
138 |
139 | /*!
140 | create the main toolbar
141 | */
142 | void createToolBar();
143 |
144 | /*!
145 | configures the allowed file formats
146 | */
147 | void setNameFilters();
148 |
149 | /*!
150 | Determinate the \see ImageType of the opened image
151 | */
152 | void determinateImageType();
153 |
154 | /*!
155 | Open the image
156 | */
157 | void openImage();
158 |
159 | /*!
160 | Update actions acording to the app status
161 | */
162 | void updateActions();
163 |
164 | /*!
165 | sets the color from the settings
166 | */
167 | void getColorFromSettings(QStringList);
168 |
169 | /*!
170 | if the image was modified shows a dialog asking if want to continue
171 | \returns true if the image wasn't modified or the user hits save
172 | \returns false if the user hits cancel/no
173 | */
174 | bool canCloseImage();
175 |
176 | /*!
177 | configures the toolbar and menubar right-click menu
178 | */
179 | void configureToolBarToolTip();
180 |
181 | /*!
182 | Creating actions for the recent files
183 | */
184 | void createRecentFilesMenu();
185 |
186 | /*!
187 | Add the loaded image into the recent files list/menu
188 | */
189 | void pushNewFile();
190 |
191 | /**
192 | * configure toolbar
193 | *
194 | * @param sl is the list of the actions to add to the toolbar
195 | * @param a is the toolbar area
196 | * @param s the toolbar buttom style
197 | * @param v toolbar visible or not
198 | * @param zl show zoom slider
199 | */
200 | void setUpToolBar(QStringList, Qt::ToolBarArea, Qt::ToolButtonStyle, bool, bool);
201 |
202 | /*!
203 | * Save the current image as \a fileName
204 | * If \a fileName is empty (fileName.isEmpty() == true), then this funcion uses current image
205 | * name and replace it.
206 | * \returns true if sucess, otherwise
207 | * \returns false if fail.
208 | */
209 | void saveImage(QString name="");
210 |
211 |
212 | private slots:
213 | /*!
214 | Open an image
215 | */
216 | void open();
217 |
218 | /*!
219 | Save the current image
220 | */
221 | void saveAs();
222 |
223 | /*!
224 | Saves the changes
225 | */
226 | void save();
227 |
228 | /*!
229 | Print the current image
230 | */
231 | void print();
232 |
233 | /*!
234 | Go to the next image in the current image folder
235 | */
236 | void next();
237 |
238 | /*!
239 | Go to the previous image in the current image folder
240 | */
241 | void previous();
242 |
243 | /*!
244 | Go to the first image in the current image folder
245 | */
246 | void goFirst();
247 |
248 | /*!
249 | Go to the last image in the current image folder
250 | */
251 | void goLast();
252 |
253 | /*!
254 | Open a folder to view the images inside it
255 | */
256 | void openDir();
257 |
258 | /*!
259 | Open the file selected in the recent files menu
260 | */
261 | void openRecentFile();
262 | void openStatic();
263 | void openDynamic();
264 | void fileProperties();
265 | void zoomIn();
266 | void zoomOut();
267 | void wheelZoom(int);
268 | void normalSize();
269 | void adjustSizeSlot();
270 | void rotateLeft();
271 | void rotateRight();
272 | void flipHorizontally();
273 | void flipVertically();
274 | void about();
275 | void couldOpen(bool);
276 | void loadSettings();
277 | void saveSettings();
278 | void showHideMenuBar();
279 | void setToolBarMovable();
280 | void setToolBarVisible(bool);
281 |
282 | /*!
283 | Deletes the recent files menu in the File menu
284 | */
285 | void deleteRecentFiles();
286 |
287 | /*!
288 | This deletes the current image
289 | */
290 | void deleteFileSlot();
291 | void moveToSlot();
292 | void goToSlot();
293 | void goToSlot(QString name, int pos);
294 |
295 | /*!
296 | Makes the given \a path the last one used, so it is passed
297 | the open file/folder and save file dialog
298 | */
299 | void setLastPathUsed(QString path);
300 | void configureToolBarSlot();
301 | void configureToolBarSlot2(QStringList);
302 | void configureShortcutsSlot();
303 | void configureNewShortcuts(QMap);
304 | void pixmapChangedSlot();
305 | void toolBarContextMenu();
306 | void closeFileSlot();
307 | void updateWindowTitle();
308 |
309 | /**
310 | *this methos is for moving the image with the mouse
311 | * @param e is the QPoint value from mousePressEvent
312 | * @param d is the QPoint value from mouseMoveEvent
313 | */
314 | void moveWidget(QPoint, QPoint);
315 |
316 | /**
317 | * configuration dialog
318 | */
319 | void configureProgram();
320 |
321 | /**
322 | *this is for when the image is rotated and the button fixed size
323 | *is checked
324 | */
325 | void imageRotated();
326 |
327 | };
328 |
329 | #endif
330 |
--------------------------------------------------------------------------------
/src/mainwindow2.cpp:
--------------------------------------------------------------------------------
1 | #include "mainwindow2.h"
2 |
3 | MainWindow2::MainWindow2(QWidget *parent) :
4 | QMainWindow(parent)
5 | {
6 | }
7 |
--------------------------------------------------------------------------------
/src/mainwindow2.h:
--------------------------------------------------------------------------------
1 | #ifndef MAINWINDOW2_H
2 | #define MAINWINDOW2_H
3 |
4 | #include
5 |
6 | class MainWindow2 : public QMainWindow
7 | {
8 | Q_OBJECT
9 | public:
10 | explicit MainWindow2(QWidget *parent = 0);
11 |
12 | signals:
13 |
14 | public slots:
15 |
16 | };
17 |
18 | #endif // MAINWINDOW2_H
19 |
--------------------------------------------------------------------------------
/src/mname.h:
--------------------------------------------------------------------------------
1 | #ifndef MNAME
2 | #define MNAME
3 | #include
4 |
5 | //Returns class::method
6 | // inline std::string methodName(const std::string& prettyFunction)
7 | // {
8 | // size_t colons = prettyFunction.find("::");
9 | // size_t begin = prettyFunction.substr(0,colons).rfind(" ") + 1;
10 | // size_t end = prettyFunction.rfind("(") - begin;
11 |
12 | // return prettyFunction.substr(begin,end) + "()";
13 | // }
14 | // #define __METHOD_NAME__ methodName(__PRETTY_FUNCTION__).c_str()
15 | inline QString methodName(const QString prettyFunction)
16 | {
17 | size_t colons = prettyFunction.indexOf("::");
18 | size_t begin = prettyFunction.mid(0,colons).indexOf(" ") + 1;
19 | size_t end = prettyFunction.lastIndexOf("(") - begin;
20 |
21 | return prettyFunction.mid(begin,end) + "()";
22 | }
23 | #define __METHOD_NAME__ methodName(__PRETTY_FUNCTION__).toLatin1().constData()
24 |
25 | #endif
--------------------------------------------------------------------------------
/src/qkeysequencewidget.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | Copyright (c) 2010, Artem Galichkin
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 |
8 | * Redistributions of source code must retain the above copyright
9 | notice, this list of conditions and the following disclaimer.
10 | * Redistributions in binary form must reproduce the above copyright
11 | notice, this list of conditions and the following disclaimer in the
12 | documentation and/or other materials provided with the distribution.
13 | * Neither the name of the nor the
14 | names of its contributors may be used to endorse or promote products
15 | derived from this software without specific prior written permission.
16 |
17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
21 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 | *******************************************************************************/
28 |
29 | #ifndef QKEYSEQUENCEWIDGET_H
30 | #define QKEYSEQUENCEWIDGET_H
31 |
32 | #include "qkeysequencewidget_p.h"
33 |
34 | #include
35 | #include
36 |
37 | class QKeySequenceWidgetPrivate;
38 |
39 | /*!
40 | \class QKeySequenceWidget
41 |
42 | \brief The QKeySequenceWidget is a widget to input a QKeySequence.
43 |
44 | This widget lets the user choose a QKeySequence, which is usually used as a
45 | shortcut key. The recording is initiated by calling captureKeySequence() or
46 | the user clicking into the widget.
47 |
48 | \code
49 | // create new QKeySequenceWidget with empty sequence
50 | QKeySequenceWidget *keyWidget = new QKeySequenceWidget;
51 |
52 | // Set sequence as "Ctrl+Alt+Space"
53 | keyWidget->setJeySequence(QKeySequence("Ctrl+Alt+Space"));
54 |
55 | // set clear button position is left
56 | setClearButtonShow(QKeySequenceWidget::ShowLeft);
57 |
58 | // set cutom clear button icon
59 | setClearButtonIcon(QIcon("/path/to/icon.png"));
60 |
61 | // connecting keySequenceChanged signal to slot
62 | connect(keyWidget, SIGNAL(keySequenceChanged(QKeySequence)), this, SLOT(slotKeySequenceChanged(QKeySequence)));
63 | \endcode
64 | */
65 | class QKeySequenceWidget : public QWidget
66 | {
67 | Q_OBJECT
68 | Q_DECLARE_PRIVATE(QKeySequenceWidget);
69 | Q_PRIVATE_SLOT(d_func(), void doneRecording())
70 |
71 | Q_PROPERTY(QKeySequence keySequence READ keySequence WRITE setKeySequence)
72 | Q_PROPERTY(QKeySequenceWidget::ClearButtonShow clearButton READ clearButtonShow WRITE setClearButtonShow)
73 | Q_PROPERTY(QString noneText READ noneText WRITE setNoneText)
74 | Q_PROPERTY(QIcon clearButtonIcon READ clearButtonIcon WRITE setClearButtonIcon)
75 |
76 | private:
77 | QKeySequenceWidgetPrivate * const d_ptr;
78 | void _connectingSlots();
79 |
80 | private Q_SLOTS:
81 | void captureKeySequence();
82 |
83 | public:
84 | explicit QKeySequenceWidget(QWidget *parent = 0);
85 | explicit QKeySequenceWidget(QKeySequence seq, QWidget *parent = 0);
86 | explicit QKeySequenceWidget(QString noneString, QWidget *parent = 0);
87 | explicit QKeySequenceWidget(QKeySequence seq, QString noneString, QWidget *parent = 0);
88 | virtual ~QKeySequenceWidget();
89 | QSize sizeHint() const;
90 | void setToolTip(const QString &tip);
91 | QKeySequence keySequence() const;
92 | QString noneText() const;
93 | QIcon clearButtonIcon() const;
94 |
95 | /*!
96 | \brief Modes of sohow ClearButton
97 | */
98 | enum ClearButton {
99 | NoShow = 0x00, /**< Hide ClearButton */
100 | ShowLeft = 0x01, /**< ClearButton isow is left */
101 | ShowRight = 0x02 /**< ClearButton isow is left */
102 | };
103 |
104 | Q_DECLARE_FLAGS(ClearButtonShow, ClearButton);
105 | Q_FLAGS(ClearButtonShow)
106 |
107 | QKeySequenceWidget::ClearButtonShow clearButtonShow() const;
108 |
109 | Q_SIGNALS:
110 | void keySequenceChanged(const QKeySequence &seq);
111 | void keyNotSupported();
112 |
113 | public Q_SLOTS:
114 | void setKeySequence(const QKeySequence &key);
115 | void clearKeySequence();
116 | void setNoneText(const QString text);
117 | void setClearButtonIcon(const QIcon& icon);
118 | void setClearButtonShow(QKeySequenceWidget::ClearButtonShow show);
119 | };
120 |
121 | #endif // QKEYSEQUENCEWIDGET_H
122 |
--------------------------------------------------------------------------------
/src/qkeysequencewidget_p.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | Copyright (c) 2010, Artem Galichkin
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are met:
7 |
8 | * Redistributions of source code must retain the above copyright
9 | notice, this list of conditions and the following disclaimer.
10 | * Redistributions in binary form must reproduce the above copyright
11 | notice, this list of conditions and the following disclaimer in the
12 | documentation and/or other materials provided with the distribution.
13 | * Neither the name of the nor the
14 | names of its contributors may be used to endorse or promote products
15 | derived from this software without specific prior written permission.
16 |
17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
18 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 | DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY
21 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 | *******************************************************************************/
28 |
29 | #ifndef QKEYSEQUENCEWIDGET_P_H
30 | #define QKEYSEQUENCEWIDGET_P_H
31 |
32 | #include
33 | #include
34 | #include
35 | #include
36 | #include
37 | #include
38 | #include
39 |
40 | #include "qkeysequencewidget.h"
41 |
42 | class QShortcutButton;
43 | class QKeySequenceWidget;
44 |
45 | class QKeySequenceWidgetPrivate // : public QObject
46 | {
47 | //Q_OBJECT
48 | Q_DECLARE_PUBLIC(QKeySequenceWidget);
49 |
50 | public:
51 | QKeySequenceWidget * q_ptr;
52 |
53 | QKeySequenceWidgetPrivate();
54 | virtual ~QKeySequenceWidgetPrivate();
55 |
56 | void init(const QKeySequence keySeq, const QString noneStr);
57 | void updateView();
58 |
59 | void startRecording();
60 | void doneRecording();
61 | inline void cancelRecording();
62 | inline void controlModifierlessTimout();
63 | inline void keyNotSupported();
64 |
65 | void updateDisplayShortcut();
66 |
67 | // members
68 | QKeySequence currentSequence;
69 | QKeySequence oldSequence;
70 | QString noneSequenceText;
71 |
72 | QTimer modifierlessTimeout;
73 |
74 | quint32 numKey;
75 | quint32 modifierKeys;
76 |
77 | void setToolTip(const QString& tip);
78 |
79 | QHBoxLayout *layout;
80 | QToolButton *clearButton;
81 | QShortcutButton *shortcutButton;
82 |
83 | int showClearButton;
84 |
85 | bool isRecording;
86 |
87 | };
88 |
89 | class QShortcutButton : public QPushButton
90 | {
91 | Q_OBJECT
92 |
93 | public:
94 | explicit QShortcutButton(QKeySequenceWidgetPrivate *p, QWidget *parent = 0)
95 | : QPushButton(parent)
96 | , d(p)
97 | {
98 | ////qDebug() << "qShortcut button Create";
99 | //qDebug() << "parent----" << parent;
100 |
101 | //qDebug() << "visible " << isVisible();
102 | setMinimumWidth(QPushButton::minimumWidth());
103 | QPushButton::setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
104 | }
105 |
106 | virtual ~QShortcutButton()
107 | {
108 | //qDebug() << "qShortcut button delete";
109 | }
110 |
111 | virtual QSize sizeHint() const;
112 |
113 | protected:
114 | // Reimplemented for internal reasons.
115 | virtual bool event(QEvent *e);
116 | virtual void keyPressEvent(QKeyEvent *keyEvent);
117 | virtual void keyReleaseEvent(QKeyEvent *keyEvent);
118 |
119 | private:
120 | QKeySequenceWidgetPrivate * const d;
121 | };
122 |
123 | #endif // QKEYSEQUENCEWIDGET_P_H
124 |
--------------------------------------------------------------------------------
/src/settings.h:
--------------------------------------------------------------------------------
1 | /*********************************************************************
2 | * Copyright (C) 2010 by Dario Ignacio Aguilera *
3 | * dario_21_06@hotmail.com *
4 | * *
5 | * This program is free software; you can redistribute it and/or *
6 | * modify it under the terms of the GNU General Public License *
7 | * as published by the Free Software Foundation; either version 2 *
8 | * of the License, or (at your option) any later version. *
9 | * *
10 | * This program is distributed in the hope that it will be useful, *
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 | * GNU General Public License for more details. *
14 | * *
15 | * You should have received a copy of the GNU General Public License *
16 | * along with this program; if not, write to the *
17 | * Free Software Foundation, Inc. *
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 | **********************************************************************/
20 |
21 | #ifndef SETTINGS_H
22 | #define SETTINGS_H
23 |
24 | #include
25 | #include
26 | #include
27 | #include
28 |
29 | class Settings : public QObject
30 | {
31 | Q_OBJECT
32 |
33 | public:
34 | /*!
35 | constructor
36 | */
37 | Settings();
38 |
39 | /*!
40 | return true if its setted to use easter eggs in the images, otherwise returns false
41 | */
42 | bool imageJokes();
43 |
44 | /*!
45 | return true if its setted to use binary sistem, otherwise returns false
46 | */
47 | bool useBinaryStyle();
48 |
49 | /*!
50 | returns true if its setted to use easter eggs , evaluating if it's timeto use them or not,
51 | */
52 | bool useEggs();
53 |
54 | /*!
55 | returns the easter eggs end \a hour and \a min
56 | */
57 | void getEggsEndHour(int& hour, int& min);
58 |
59 | /*!
60 | returns the easter eggs begining \a hour and \a min
61 | */
62 | void getEggsBeginHour(int& hour, int& min);
63 |
64 | /*!
65 | \returns a Map with the action id and it corresponding shortcut
66 | the map key is the id, and the value the shortcut
67 | this has just the actions that have shortcut
68 | \see setShortcuts(QMap list)
69 | */
70 | inline QMap getShortcuts(){return shortcuts;}
71 |
72 | /*!
73 | Sets the shortcuts stored in list to the action correspondig to the id
74 | The format is: id=map key, shortcut=map value
75 | see getShortcuts()
76 | */
77 | inline void setShortcuts(QMap list){shortcuts = list;}
78 |
79 | inline QStringList getActionsLoaded() const{return actionsLoaded;}
80 | inline QStringList getBackgroundColor() const{return backgroundColor;}
81 | inline QStringList getRecentFilesList() const{return recentFilesList;}
82 | QStringList defaultActions() const;
83 | inline QString getBGToShow() const{return backgroundToShow;}
84 | inline QString getLastDirUsed() const{return lastDirUsed;}
85 | inline QString getDefaultPath() const{return defaultPath;}
86 | #ifdef __linux__
87 | inline QString getPreferedIconTheme() const{return prefIconTheme;}
88 | #endif
89 | inline QSize getWindowSize() const{return windowSize;}
90 | inline int getSorting() const{return sorting;}
91 | inline int getPathToUse() const{return pathToUse;}
92 | inline int getSquaresSize() const{return squaresSize;}
93 | inline int getFileSizePrecision() const{return precision;}
94 | inline int getMovieSpeed() const{return movieSpeed;}
95 | inline int getZoomIncrement() const{return zoomIncrement;}
96 | inline int getMaxRecentFiles() const{return maxRecentFiles;}
97 | inline int getCompressLevel() const{return compressLevel;}
98 | inline int getTBButtomStyle() const{return tbButtomStyle;}
99 | inline int getTBArea() const{return tbArea;}
100 | inline bool getRestartWhenZooming() const{return restartWhenZooming;}
101 | inline bool getStopMovieWhenFinish() const{return stopMovieWhenFinish;}
102 | inline bool getShowZoomSlider() const{return showZoomSlider;}
103 | inline bool getShowMenuBar() const{return showMenuBar;}
104 | inline bool getTBMovable() const{return toolBarMovable;}
105 | inline bool getLoadFixedSize() const{return loadFixedSize;}
106 | inline bool getTBVisible() const{return toolBarVisible;}
107 | inline bool getCreateNewShortCuts() const{return createNewShortCuts;}
108 |
109 | inline void setActionsLoaded(const QStringList d){actionsLoaded = d;}
110 | inline void setBackgroundColor(const QStringList d){backgroundColor = d;}
111 | inline void setRecentFilesList(const QStringList d){recentFilesList = d;}
112 | inline void setBGTosShow(const QString d){backgroundToShow = d;}
113 | inline void setLastDirUsed(const QString d){lastDirUsed = d;}
114 | inline void setDefaultPath(const QString d){defaultPath = d;}
115 | #ifdef __linux__
116 | inline void setPreferedIconTheme(const QString d){prefIconTheme = d;}
117 | #endif
118 | inline void setWindowSize(const QSize d){windowSize = d;}
119 | inline void setSorting(const int sort){sorting = sort;}
120 | inline void setPathToUse(const int d){pathToUse = d;}
121 | inline void setSquaresSize(const int d){squaresSize = d;}
122 | inline void setMovieSpeed(const int d){movieSpeed = d;}
123 | inline void setFileSizePrecision(const int fSizePrecision){precision = fSizePrecision;}
124 | inline void setZoomIncrement(const int d){zoomIncrement = d;}
125 | inline void setMaxRecentFiles(const int d){maxRecentFiles = d;}
126 | inline void setCompressLevel(const int d){compressLevel = d;}
127 | inline void setTBButtomStyle(const int d){tbButtomStyle = d;}
128 | inline void setTBArea(const int d){tbArea = d;}
129 | inline void setRestartWhenZooming(const bool d){restartWhenZooming = d;}
130 | inline void setStopMovieWhenFinish(const bool d){stopMovieWhenFinish = d;}
131 | inline void setShowZoomSlider(const bool d){showZoomSlider = d;}
132 | inline void setShowMenuBar(const bool d){showMenuBar = d;}
133 | inline void setTBMovable(const bool d){toolBarMovable = d;}
134 | inline void setLoadFixedSize(const bool d){loadFixedSize = d;}
135 | inline void setTBVisible(const bool d){toolBarVisible = d;}
136 | inline void setCreateNewShortCuts(const bool d){createNewShortCuts = d;}
137 |
138 | public slots:
139 | void saveSettings();
140 | void loadSettings();
141 |
142 | private:
143 | //variables
144 | QMap shortcuts;
145 | QStringList actionsLoaded;
146 | QStringList backgroundColor;
147 | QStringList recentFilesList;
148 | QString backgroundToShow;
149 | QString lastDirUsed;
150 | QString defaultPath;
151 | QString eggEnd;
152 | QString eggBegin;
153 | #ifdef __linux__
154 | QString prefIconTheme = "oxygen";
155 | #endif
156 | QSize windowSize;
157 | int sorting;
158 | int pathToUse;
159 | int squaresSize;
160 | int zoomIncrement;
161 | int maxRecentFiles;
162 | int precision;
163 | int movieSpeed;
164 | int compressLevel;
165 | int tbButtomStyle;
166 | int tbArea;
167 | bool binary;
168 | bool restartWhenZooming;
169 | bool stopMovieWhenFinish;
170 | bool showZoomSlider;
171 | bool showMenuBar;
172 | bool toolBarMovable;
173 | bool loadFixedSize;
174 | bool toolBarVisible;
175 | bool createNewShortCuts;
176 | bool previousSettings;
177 | bool enableEggs;
178 | bool imageJoke;
179 | bool useBinary;
180 |
181 | //methods
182 | void getPreviousConfig();
183 | bool isTime();
184 |
185 | /**
186 | * @return hour and min from the given string
187 | * @param time string that contains the time
188 | * @param hour returns the hour
189 | * @param min returns the min
190 | */
191 | void getHour(QString time, int& hour, int& min);
192 |
193 | /**
194 | * @return a string containing the hour and min
195 | * @param hour pass the hour
196 | * @param min pass the minutes
197 | */
198 | QString setHour(int hour, int min);
199 | QStringList defaultColor() const;
200 |
201 | };
202 |
203 | #endif // SETTINGS_H
204 |
--------------------------------------------------------------------------------
/src/shortcuteditor.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 |
4 | #include "shortcuteditor.h"
5 | #include "actiondata.h"
6 | #include "qkeysequencewidget.h"
7 | #include "ui_shortcuteditor.h"
8 |
9 | ShortcutEditor::ShortcutEditor(QWidget *parent) :
10 | QDialog(parent),
11 | ui(new Ui::ShortcutEditor)
12 | {
13 | //setup ui
14 | ui->setupUi(this);
15 |
16 | //icon size
17 | iconSize = this->style()->pixelMetric(QStyle::PM_SmallIconSize);
18 |
19 | //tree widget headers
20 | QStringList columnNames = QStringList()<shortcutsWidget->setHeaderLabels(columnNames);
22 |
23 | //set icons to the buttons
24 | ui->applyButton->setIcon(QIcon::fromTheme("dialog-ok-apply"));
25 | ui->okButton->setIcon(QIcon::fromTheme("dialog-ok"));
26 | ui->cancelButton->setIcon(QIcon::fromTheme("dialog-cancel"));
27 | ui->clearButton->setIcon(QIcon::fromTheme("edit-clear-locationbar-rtl"));
28 | ui->setDefaultsButton->setIcon(QIcon::fromTheme("document-revert"));
29 |
30 | //configure the key seuqnce widget
31 | keySWidget = new QKeySequenceWidget;
32 | keySWidget->setEnabled(false);
33 | keySWidget->setClearButtonShow(QKeySequenceWidget::ShowRight);
34 | keySWidget->setClearButtonIcon(QIcon::fromTheme("edit-clear"));
35 | ui->csLayout->addWidget(keySWidget);
36 |
37 | //connections
38 | connect(ui->applyButton, SIGNAL(clicked()), this, SLOT(applyButtonSlot()));
39 | connect(ui->okButton, SIGNAL(clicked()), this, SLOT(okButtonSlot()));
40 | connect(ui->searchWidget, SIGNAL(textChanged(QString)), this, SLOT(searchSlot(QString)));
41 | connect(ui->shortcutsWidget, SIGNAL(itemSelectionChanged()), SLOT(changeShortcut()));
42 | connect(ui->setDefaultsButton, SIGNAL(clicked()), this, SLOT(setDefaultsShortcutsSlot()));
43 | connect(keySWidget, SIGNAL(keySequenceChanged(QKeySequence)), this, SLOT(keySequenceChanged(QKeySequence)));
44 |
45 | apply = false;
46 |
47 | //the default shortcuts haven't been setted
48 | defShortcutsMade = false;
49 |
50 | //total elements count to be added
51 | totalElements = 0;
52 | }
53 |
54 | QIcon ShortcutEditor::emptyIcon()
55 | {//copied from kedittoolbar class, in kdelibs
56 | QPixmap m_emptyIcon = QPixmap(iconSize, iconSize);
57 | m_emptyIcon.fill(Qt::transparent);
58 | return QIcon(m_emptyIcon);
59 | }
60 |
61 | void ShortcutEditor::keySequenceChanged(QKeySequence d)
62 | {
63 | //if the new key is the same than the older, no need to continue
64 | if(oldShortcut == d.toString()){
65 | return;
66 | }
67 |
68 | //check if the shortcut isn't duplciated
69 | if(this->shortcutDuplicated(d.toString())){
70 | return;
71 | }
72 |
73 | //set the new key to the item in the list
74 | ui->shortcutsWidget->currentItem()->setText(1,d.toString());
75 |
76 | //set the item in the actions changed eith it new shortcut
77 | actionsChanged[ui->shortcutsWidget->currentItem()->data(0,32).toString()] = d;
78 |
79 | //enable buttons
80 | ui->okButton->setEnabled(true);
81 | ui->applyButton->setEnabled(true);
82 |
83 | apply = true;
84 | }
85 |
86 | bool ShortcutEditor::shortcutDuplicated(QString shortcut)
87 | {
88 | foreach(ActionData *ad, actionsList){
89 | if(ad->getShortcut() == shortcut){
90 | QMessageBox::information(this, this->windowTitle(),
91 | tr("The shortcut %1 belong to %2, it won't be reasigned.").arg(shortcut, ad->getName()),
92 | QMessageBox::Ok);
93 | return true;
94 | }
95 | }
96 |
97 | return false;
98 | }
99 |
100 | void ShortcutEditor::changeShortcut()
101 | {
102 | //enable key button
103 | keySWidget->setEnabled(true);
104 |
105 | //save the current shortcut
106 | oldShortcut = ui->shortcutsWidget->currentItem()->text(1);
107 |
108 | //set the shortcut to the button
109 | keySWidget->setKeySequence(QKeySequence(oldShortcut));
110 | }
111 |
112 | ShortcutEditor::~ShortcutEditor()
113 | {
114 | delete ui;
115 | }
116 |
117 | void ShortcutEditor::addItem(ActionData *item)
118 | {
119 | //create the new item
120 | testItem = new QTreeWidgetItem(ui->shortcutsWidget);
121 |
122 | //set the name of the item, AKA the action name
123 | testItem->setText(0, item->getName());
124 |
125 | //set action data
126 | testItem->setData(0, 32, item->getId());
127 |
128 | //set action shortcut
129 | if((!item->getShortcut().isEmpty()) && (item->getShortcut() != "none")){
130 | testItem->setText(1, item->getShortcut());
131 | }
132 |
133 | //set the action/item icon
134 | if((!item->getIconName().isEmpty()) && (item->getIconName() != "none")){
135 | testItem->setIcon(0, QIcon::fromTheme(item->getIconName()));
136 | }
137 | else{
138 | testItem->setIcon(0, this->emptyIcon());
139 | }
140 |
141 | ui->shortcutsWidget->resizeColumnToContents(0);
142 | ui->shortcutsWidget->resizeColumnToContents(1);
143 | }
144 |
145 | void ShortcutEditor::setActionsList(QList actions)
146 | {
147 | actionsList = actions;
148 |
149 | //store amount of elements
150 | totalElements = actionsList.count();
151 |
152 | //add all items
153 | this->addAllItems();
154 |
155 | //if i don't do this, the buttons gets enabled
156 | ui->okButton->setEnabled(false);
157 | ui->applyButton->setEnabled(false);
158 | }
159 |
160 | void ShortcutEditor::setDefaultShortcuts(QMap defshortcuts)
161 | {
162 | defaultShortcuts = defshortcuts;
163 | defShortcutsMade = true;
164 | // QMapIterator i(defshortcuts);
165 | // while(i.hasNext()){
166 | // i.next();
167 | // qDebug()<getId())){
179 | actionsList.at(i)->setShortcut(defaultShortcuts[actionsList.at(i)->getId()]);
180 | }
181 |
182 | //make the action shortcut empty
183 | else{
184 | actionsList.at(i)->setShortcut(QString());
185 | }
186 |
187 | //set the item in the actions changed eith it new shortcut
188 | actionsChanged[actionsList.at(i)->getId()] = actionsList.at(i)->getShortcut();
189 | }
190 |
191 | //enable buttons
192 | ui->okButton->setEnabled(true);
193 | ui->applyButton->setEnabled(true);
194 |
195 | apply = true;
196 |
197 | //add the items to the widget
198 | this->addAllItems();
199 | }
200 |
201 | void ShortcutEditor::addAllItems()
202 | {
203 | ui->shortcutsWidget->clear();
204 |
205 | for(int i=0; i < totalElements; i++){
206 | //add the new item
207 | this->addItem(actionsList.at(i));
208 | }
209 | }
210 |
211 | void ShortcutEditor::searchSlot(QString d)
212 | {
213 | //clear the list
214 | ui->shortcutsWidget->clear();
215 |
216 | //if no string to search is passed, then add the all list
217 | if(d.isEmpty()){
218 | this->addAllItems();
219 | return;
220 | }
221 |
222 | QString temp;
223 | for(int i=0; igetName();
225 | if(temp.contains(d, Qt::CaseInsensitive)){
226 | //add the item
227 | this->addItem(actionsList.at(i));
228 | }
229 | }
230 | }
231 |
232 | void ShortcutEditor::okButtonSlot()
233 | {
234 | qDebug()<<"ok button slot";
235 | if(apply){
236 | this->applyButtonSlot();
237 | }
238 | this->close();
239 | }
240 |
241 | void ShortcutEditor::applyButtonSlot()
242 | {
243 | qDebug()<<"apply button slot";
244 | // QMapIterator i(actionsChanged);
245 | // while (i.hasNext()) {
246 | // i.next();
247 | // qDebug() << i.key() << ": " << i.value().toString();
248 | // }
249 | apply = false;
250 | emit newShortcuts(actionsChanged);
251 | }
252 |
--------------------------------------------------------------------------------
/src/shortcuteditor.h:
--------------------------------------------------------------------------------
1 | #ifndef SHORTCUTEDITOR_H
2 | #define SHORTCUTEDITOR_H
3 |
4 | #include
5 | #include
6 |
7 | class ActionData;
8 | class QTreeWidgetItem;
9 | class QKeySequenceWidget;
10 |
11 | namespace Ui {
12 | class ShortcutEditor;
13 | }
14 |
15 | class ShortcutEditor : public QDialog
16 | {
17 | Q_OBJECT
18 |
19 | public:
20 | /*!
21 | Contrucst a new shortcuts editor dialog
22 | */
23 | explicit ShortcutEditor(QWidget *parent = 0);
24 |
25 | /*!
26 | Load the given \a actions to modify their shortcuts
27 | */
28 | void setActionsList(QList actions);
29 |
30 | /*!
31 | Desctructor
32 | */
33 | ~ShortcutEditor();
34 |
35 | /*!
36 | set \a defShortcuts as the default shortcuts to use
37 | if need to restore them
38 | @param defShortcuts is a map whe the key is the action id
39 | that has a shortcut and the value is the shortcuts it self,
40 | passed as a string
41 | */
42 | void setDefaultShortcuts(QMap defshortcuts);
43 |
44 | signals:
45 | /*!
46 | \returns a map with the (new) \a id and the \a shortcut
47 | */
48 | void newShortcuts(QMap);
49 |
50 | private:
51 | Ui::ShortcutEditor *ui;
52 | QString oldShortcut;
53 | QKeySequenceWidget *keySWidget;
54 | QTreeWidgetItem *testItem;
55 | QMap actionsChanged;
56 | QMap defaultShortcuts;
57 | bool defShortcutsMade;//change name
58 | QList actionsList;
59 | QIcon emptyIcon();
60 | bool apply;
61 | int iconSize;
62 | int totalElements;
63 |
64 | void addItem(ActionData *item);
65 | void addAllItems();
66 | bool shortcutDuplicated(QString shortcut);
67 |
68 | private slots:
69 | void okButtonSlot();
70 | void applyButtonSlot();
71 | void setDefaultsShortcutsSlot();
72 | void searchSlot(QString);
73 | void changeShortcut();
74 | void keySequenceChanged(QKeySequence);
75 |
76 | };
77 |
78 | #endif // SHORTCUTEDITOR_H
79 |
--------------------------------------------------------------------------------
/src/toolbarpage.cpp:
--------------------------------------------------------------------------------
1 | #include "mname.h"
2 | #include "toolbarpage.h"
3 | #include "settings.h"
4 | #include "ui_toolbarpage.h"
5 |
6 | ToolbarPage::ToolbarPage(QWidget *parent) :
7 | QWidget(parent),
8 | ui(new Ui::ToolbarPage)
9 | {
10 | //set up ui
11 | ui->setupUi(this);
12 |
13 | //settings
14 | settings = new Settings;
15 | settings->loadSettings();
16 |
17 | //toolbar area
18 | switch (settings->getTBArea())
19 | {
20 | case 1:
21 | ui->leftRadioButtom->setChecked(true);
22 | break;
23 | case 2:
24 | ui->rightRadioButtom->setChecked(true);
25 | break;
26 | case 4:
27 | ui->topRadioButtom->setChecked(true);
28 | break;
29 | case 8:
30 | ui->bottomRadioButtom->setChecked(true);
31 | break;
32 | }
33 |
34 | //toolbar button style
35 | switch (settings->getTBButtomStyle())
36 | {
37 | case 0:
38 | ui->onlyIconsRadioButtom->setChecked(true);
39 | break;
40 | case 1:
41 | ui->onlyTextRadioButtom->setChecked(true);
42 | break;
43 | case 2:
44 | ui->tbiRadioButtom->setChecked(true);
45 | break;
46 | case 3:
47 | ui->tuiRadioButtom->setChecked(true);
48 | break;
49 | case 4:
50 | ui->fsRadioButtom->setChecked(true);
51 | break;
52 | }
53 |
54 | //toolbar visible
55 | ui->toolbarVisible->setChecked(settings->getTBVisible());
56 |
57 | //toolbar movable
58 | ui->lockToolbar->setChecked(!settings->getTBMovable());
59 | ui->lockToolbar->setEnabled(settings->getTBVisible());
60 |
61 | //conections
62 | connect(ui->leftRadioButtom, SIGNAL(toggled(bool)), this, SLOT(settingsChangedSlot()));
63 | connect(ui->rightRadioButtom, SIGNAL(toggled(bool)), this, SLOT(settingsChangedSlot()));
64 | connect(ui->topRadioButtom, SIGNAL(toggled(bool)), this, SLOT(settingsChangedSlot()));
65 | connect(ui->bottomRadioButtom, SIGNAL(toggled(bool)), this, SLOT(settingsChangedSlot()));
66 | connect(ui->lockToolbar, SIGNAL(toggled(bool)), this, SLOT(settingsChangedSlot()));
67 | connect(ui->toolbarVisible, SIGNAL(toggled(bool)), this, SLOT(settingsChangedSlot()));
68 | connect(ui->onlyIconsRadioButtom, SIGNAL(toggled(bool)), this, SLOT(settingsChangedSlot()));
69 | connect(ui->onlyTextRadioButtom, SIGNAL(toggled(bool)), this, SLOT(settingsChangedSlot()));
70 | connect(ui->tbiRadioButtom, SIGNAL(toggled(bool)), this, SLOT(settingsChangedSlot()));
71 | connect(ui->tuiRadioButtom, SIGNAL(toggled(bool)), this, SLOT(settingsChangedSlot()));
72 | connect(ui->fsRadioButtom, SIGNAL(toggled(bool)), this, SLOT(settingsChangedSlot()));
73 |
74 | settingsChangedBool = false;
75 | }
76 |
77 | int ToolbarPage::gettbpos()
78 | {
79 | if (ui->leftRadioButtom->isChecked())
80 | {
81 | return 1;
82 | }
83 | if (ui->rightRadioButtom->isChecked())
84 | {
85 | return 2;
86 | }
87 | if (ui->topRadioButtom->isChecked())
88 | {
89 | return 4;
90 | }
91 | if (ui->bottomRadioButtom->isChecked())
92 | {
93 | return 8;
94 | }
95 | return 4;
96 | }
97 |
98 | int ToolbarPage::getButtonStyle()
99 | {
100 | if (ui->onlyIconsRadioButtom->isChecked())
101 | {
102 | return 0;
103 | }
104 | if (ui->onlyTextRadioButtom->isChecked())
105 | {
106 | return 1;
107 | }
108 | if (ui->tbiRadioButtom->isChecked())
109 | {
110 | return 2;
111 | }
112 | if (ui->tuiRadioButtom->isChecked())
113 | {
114 | return 3;
115 | }
116 | if (ui->fsRadioButtom->isChecked())
117 | {
118 | return 4;
119 | }
120 | return 0;
121 | }
122 |
123 | void ToolbarPage::settingsChangedSlot()
124 | {
125 | //TODO change to __METHOD_NAME__
126 | qDebug() << __METHOD_NAME__ ;
127 | settingsChangedBool = true;
128 | emit settingsChanged();
129 | }
130 |
131 | void ToolbarPage::saveSettings()
132 | {
133 | //TODO change to __METHOD_NAME__
134 | qDebug() << __FUNCTION__ << "Saving from tb";
135 | if(settingsChangedBool){
136 | settings->setTBMovable(!ui->lockToolbar->isChecked());
137 | settings->setTBVisible(ui->toolbarVisible->isChecked());
138 | settings->setTBArea(this->gettbpos());
139 | settings->setTBButtomStyle(this->getButtonStyle());
140 | settings->saveSettings();
141 | settingsChangedBool = false;
142 | }
143 | }
144 |
145 | ToolbarPage::~ToolbarPage()
146 | {
147 | delete ui;
148 | }
149 |
--------------------------------------------------------------------------------
/src/toolbarpage.h:
--------------------------------------------------------------------------------
1 | #ifndef TOOLBARPAGE_H
2 | #define TOOLBARPAGE_H
3 |
4 | #include
5 | #include
6 |
7 | class Settings;
8 | class ActionData;
9 |
10 | namespace Ui {
11 | class ToolbarPage;
12 | }
13 |
14 | class ToolbarPage : public QWidget
15 | {
16 | Q_OBJECT
17 |
18 | public:
19 | explicit ToolbarPage(QWidget *parent = 0);
20 | ~ToolbarPage();
21 |
22 | public slots:
23 | void saveSettings();
24 | bool canSave() const{return settingsChangedBool;}
25 |
26 | signals:
27 | void settingsChanged();
28 |
29 | private:
30 | Ui::ToolbarPage *ui;
31 | Settings *settings;
32 | int getButtonStyle();
33 | int gettbpos();
34 | bool settingsChangedBool;
35 |
36 | private slots:
37 | void settingsChangedSlot();
38 |
39 | };
40 |
41 | #endif // TOOLBARPAGE_H
42 |
--------------------------------------------------------------------------------
/src/utils.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 | #include
5 | #include "utils.h"
6 |
7 | QPixmap Utils::chessBoard(int cbsSize)
8 | {
9 | QPixmap m = QPixmap(cbsSize*2,cbsSize*2);
10 | QPainter p(&m);
11 | p.fillRect(m.rect(), QColor(128,128,128));
12 | QColor light = QColor(192,192,192);
13 | p.fillRect(0,0,cbsSize,cbsSize,light);
14 | p.fillRect(cbsSize,cbsSize,cbsSize,cbsSize, light);
15 | p.end();
16 | return m;
17 | }
18 |
19 | QString Utils::stringFromFile(const QString &name)
20 | {
21 | QString ret_string;
22 | QFile file(name);
23 | if (file.open(QIODevice::ReadOnly))
24 | {
25 | QTextStream ts(&file);
26 | ts.setCodec("UTF-8");
27 | ret_string = ts.readAll();
28 | file.close();
29 | }
30 | return ret_string;
31 | }
32 |
--------------------------------------------------------------------------------
/src/utils.h:
--------------------------------------------------------------------------------
1 | #ifndef UTILS_H
2 | #define UTILS_H
3 |
4 | #include
5 | #include
6 |
7 | class QPixmap;
8 | class QColor;
9 |
10 | class Utils : public QObject
11 | {
12 | Q_OBJECT
13 | public:
14 | inline Utils();
15 |
16 | /*!
17 | \returns a chess board pixmap
18 | */
19 | static QPixmap chessBoard(int squareSize);
20 |
21 | /*!
22 | \returns a string containgn all the strings in the file given
23 | to the constructor
24 | */
25 | static QString stringFromFile(const QString &fileName);
26 |
27 | private:
28 |
29 | };
30 |
31 | #endif // UTILS_H
32 |
--------------------------------------------------------------------------------
/src/webpdecoder.cpp:
--------------------------------------------------------------------------------
1 | #ifdef WEBP_SUPPORT
2 | #include
3 | #include
4 | #include "webpdecoder.h"
5 | #include "3rdparty/webp/webp/decode.h"
6 |
7 | WebpDecoder::WebpDecoder(QObject *parent) : QObject(parent)
8 | {
9 | qDebug()<<"webp image";
10 | }
11 |
12 | bool WebpDecoder::setFile(const QString d)
13 | {
14 | return decodeWebpImage(d);
15 | }
16 |
17 | bool WebpDecoder::readImage(unsigned char* rgb, int width, int height, QPixmap& pixmap)
18 | {
19 | //code copied from Qt class qppmhandler
20 | int mcc = 255;
21 |
22 | if (width <= 0 || width > 32767 || height <= 0 || height > 32767 || mcc <= 0)
23 | return false; // weird P.M image
24 |
25 | int y;
26 | //int pbm_bpl;
27 | QImage::Format format = QImage::Format_RGB32;
28 | //QImage::Format format = QImage::Format_ARGB32;
29 | QImage outImage(width,height,format);
30 |
31 | //pbm_bpl = (nbits*width+7)/8; // bytes per scanline in PBM
32 |
33 | //pbm_bpl = mcc < 256 ? 3*width : 6*width;
34 | QRgb *p;
35 | QRgb *end;
36 | for (y=0; y
6 | #include
7 |
8 | class WebpDecoder : public QObject
9 | {
10 | Q_OBJECT
11 |
12 | public:
13 | /**
14 | *constructor
15 | */
16 | WebpDecoder(QObject *parent = 0);
17 |
18 | /**
19 | *pass the file \a name to decode, returns true if sucess, otherwise return false
20 | */
21 | bool setFile(const QString name);
22 |
23 | /**
24 | * @return the image passed as an QPixmap object
25 | */
26 | inline QPixmap getPixmap() const{return pixmap;}
27 |
28 | private:
29 | QPixmap pixmap;
30 | QString name;
31 |
32 | bool decodeWebpImage(const QString fileName);
33 | bool readImage(unsigned char* rgb, int width, int height, QPixmap& pixmap);
34 |
35 | };
36 |
37 | #endif // WEBPDECODER_H
38 | #endif
39 |
--------------------------------------------------------------------------------
/src/webpdecoder.h~:
--------------------------------------------------------------------------------
1 | #ifndef WEBPDECODER_H
2 | #define WEBPDECODER_H
3 |
4 | #include
5 | #include
6 |
7 | class WebpDecoder : public QObject
8 | {
9 | Q_OBJECT
10 |
11 | public:
12 | /**
13 | *constructor
14 | */
15 | WebpDecoder(QObject *parent = 0);
16 |
17 | /**
18 | *pass the file \a name to decode, returns true if sucess, otherwise return false
19 | */
20 | bool setFile(const QString name);
21 |
22 | /**
23 | * @return the image passed as an QPixmap object
24 | */
25 | inline QPixmap getPixmap() const{return pixmap;}
26 |
27 | private:
28 | QPixmap pixmap;
29 | QString name;
30 |
31 | bool decodeWebpImage(const QString fileName);
32 | bool readImage(unsigned char* rgb, int width, int height, QPixmap& pixmap);
33 |
34 | };
35 |
36 | #endif // WEBPDECODER_H
37 |
--------------------------------------------------------------------------------
/src/zoomutils.cpp:
--------------------------------------------------------------------------------
1 | /*********************************************************************
2 | * Copyright (C) 2010 by Dario Ignacio Aguilera *
3 | * dario_21_06@hotmail.com *
4 | * *
5 | * This program is free software; you can redistribute it and/or *
6 | * modify it under the terms of the GNU General Public License *
7 | * as published by the Free Software Foundation; either version 2 *
8 | * of the License, or (at your option) any later version. *
9 | * *
10 | * This program is distributed in the hope that it will be useful, *
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 | * GNU General Public License for more details. *
14 | * *
15 | * You should have received a copy of the GNU General Public License *
16 | * along with this program; if not, write to the *
17 | * Free Software Foundation, Inc. *
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19 | **********************************************************************/
20 |
21 | #include "zoomutils.h"
22 |
23 | ZoomUtils::ZoomUtils(QObject *parent) :
24 | QObject(parent)
25 | {
26 | this->setDefaults();
27 | adjustedSize = true;
28 | zoomIncrement = 25;
29 | maxZoomValue = 500;
30 | minZoomValue = 10;
31 | }
32 |
33 | bool ZoomUtils::bestZoomValue() const
34 | {
35 | if(!needToMakeZoom && (zoomValue == 100))
36 | return true;
37 |
38 | else if(needToMakeZoom && (zoomValue == zoomValueForBestFit))
39 | return true;
40 |
41 | else
42 | return false;
43 | }
44 |
45 | void ZoomUtils::setDefaults()
46 | {
47 | maxSize = QSize(-1,-1);
48 | picSize = QSize(-1,-1);
49 | zoomValue = 100;
50 | zoomRestoreValue = 100;
51 | zoomValueForBestFit = 100;
52 | needToMakeZoom = false;
53 | canMakeZoom = false;
54 | mSizeChanged = false;
55 | //fTime = true;
56 | emit sliderSignal(zoomValue);
57 | }
58 |
59 | void ZoomUtils::makeZoom(int d)
60 | {
61 | if(d < maxZoomValue && d > minZoomValue){
62 | zoomValue = d;
63 | emit sliderSignal(d);
64 | emit zoom(d * 0.01);
65 | }
66 | }
67 |
68 | void ZoomUtils::setAdjustedSize(bool d)
69 | {
70 | adjustedSize = d;
71 | if(adjustedSize){
72 | zoomRestoreValue = zoomValue;
73 | this->adjustPicSize();
74 | }
75 | else{
76 | //qDebug()<<"zom value:"<adjustPicSize();
120 | //fTime = false;
121 | return;
122 | }
123 | else{
124 | if(mSizeChanged){
125 | mSizeChanged = false;
126 | return;
127 | }
128 | else
129 | this->normalSize();
130 | }
131 | }
132 |
133 | void ZoomUtils::calculateZoom()
134 | {
135 | if(!maxSize.isValid() || !picSize.isValid()){
136 | canMakeZoom = false;
137 | return;
138 | }
139 |
140 | needToMakeZoom = false;
141 | canMakeZoom = true;
142 |
143 | double w,h,mw,mh,rw,rh,g=1;
144 | w=picSize.width();
145 | h=picSize.height();
146 | mw=maxSize.width();
147 | mh=maxSize.height();
148 | rw=mw/w;
149 | rh=mh/h;
150 |
151 | if(rw<1 && rh>1){
152 | g=rw;
153 | needToMakeZoom = true;
154 | }
155 | if(rw>1 && rh<1){
156 | g=rh;
157 | needToMakeZoom = true;
158 | }
159 | if(rw<1 && rh<1){
160 | if(rw
25 | #include
26 |
27 | class QSlider;
28 | class QSize;
29 | class QPushButton;
30 |
31 | class ZoomUtils : public QObject
32 | {
33 | Q_OBJECT
34 |
35 | public:
36 | /**
37 | * constructor
38 | */
39 | ZoomUtils(QObject *parent = 0);
40 |
41 | /**
42 | * sets \a mSize as the maximun size
43 | */
44 | void setMaxSize(const QSize mSize);
45 |
46 | /**
47 | * sets \a pSize as the picture size
48 | * */
49 | void setPicSize(const QSize pSize);
50 |
51 | /**
52 | * @return true if the available zoom is iqual to the best zoom value
53 | * otherwise returns false
54 | */
55 | bool bestZoomValue() const;
56 |
57 | /**
58 | * @return the max zoom value
59 | */
60 | inline int getMaxZoomValue() const{return maxZoomValue;}
61 |
62 | /**
63 | * @returns the minimun zoom value
64 | */
65 | inline int getMinZoomValue() const{return minZoomValue;}
66 |
67 | /**
68 | * @return the zoom incremente value
69 | */
70 | inline int getZoomIncrement() const{return zoomIncrement;}
71 |
72 | /**
73 | * @returns the zoom value
74 | */
75 | inline int getZoomValue() const{return zoomValue;}
76 |
77 | /**
78 | * sets \a d as de zoom increment
79 | */
80 | inline void setZoomIncrement(int d){zoomIncrement = d;}
81 |
82 | /**
83 | * sets \a d as the maximun zoom value
84 | */
85 | inline void setMaxZoomValue(int d){maxZoomValue = d;}
86 |
87 | /**
88 | * sets \a d as the minimum zoom increment
89 | */
90 | inline void setMinZoomValue(int d){minZoomValue = d;}
91 |
92 | /**
93 | * clear everything
94 | */
95 | inline void clearSizes(){setDefaults();}
96 |
97 | /**
98 | * makes a zoom in
99 | */
100 | inline void zoomIn(){makeZoom(zoomValue + zoomIncrement);}
101 |
102 | /**
103 | * makes a zoom out
104 | */
105 | inline void zoomOut(){makeZoom(zoomValue - zoomIncrement);}
106 |
107 |
108 | inline void normalSize(){makeZoom(100);}
109 | inline void adjustPicSize(){makeZoom(zoomValueForBestFit);}
110 |
111 | signals:
112 | /**
113 | zoom(double d) is emited to make zoom, d is the value of
114 | the zoom, the final one, not an increment. 1 = normal size
115 | 1.5 is iqual to a %150 zoom
116 | 0.5 is iqual to a %50 zoom
117 | */
118 | void zoom(double);
119 |
120 | /**
121 | same that zoom(double d), but in this case
122 | the value sended is in percentage
123 | */
124 | void sliderSignal(int);
125 |
126 | public slots:
127 | void maxSizeChanged(QSize);
128 | void setAdjustedSize(bool);
129 | inline void sliderSlot(int d){makeZoom(d);}
130 |
131 | private:
132 | QSize maxSize;
133 | QSize picSize;
134 | int zoomValue;
135 | int zoomRestoreValue;
136 | int maxZoomValue;
137 | int minZoomValue;
138 | int zoomValueForBestFit;
139 | int zoomIncrement;
140 | bool needToMakeZoom; //if the image is big
141 | bool canMakeZoom;
142 | bool adjustedSize;
143 | bool mSizeChanged;
144 | //bool fTime;
145 |
146 | void configure();
147 | void calculateZoom();
148 | void makeZoom(int);
149 | void setDefaults();
150 |
151 | signals:
152 |
153 | private slots:
154 |
155 | };
156 |
157 | #endif // ZOOMWIDGET_H
158 |
--------------------------------------------------------------------------------