Compare commits
67 Commits
upstream/1
...
ubuntu/plu
Author | SHA1 | Date | |
---|---|---|---|
1dd786fc03 | |||
923f9525af | |||
e4131b37f8 | |||
7f0df47278 | |||
1af8ae2c4c | |||
e7ffa79c43 | |||
|
7ff2b08915 | ||
|
8c952922dd | ||
|
5b11cdd2f7 | ||
|
9a88e78aaf | ||
|
d4a81e57a3 | ||
|
2036f10d59 | ||
5f9d3d590d | |||
e1127aa346 | |||
0b9fd202b8 | |||
4e4377fc22 | |||
8e8f2a16f6 | |||
f0d30a700d | |||
167a5339b9 | |||
|
f294465266 | ||
cf2194dcb6 | |||
3a3733c9d6 | |||
0d790894bb | |||
9db1929472 | |||
4222d5a1ed | |||
d27a7f87c9 | |||
534a20f1e4 | |||
723ec15593 | |||
baf6d516b9 | |||
|
5693153f40 | ||
|
cdb00bba60 | ||
|
1344b7d963 | ||
|
a96956cb42 | ||
|
292bee7075 | ||
|
786123caab | ||
|
928c6278be | ||
|
0b8d903294 | ||
|
f49a49138e | ||
|
4ec4708a17 | ||
|
b5a89e139c | ||
|
274df24479 | ||
|
7cae9815f9 | ||
|
eae01a5850 | ||
|
1e59e248db | ||
|
828954d296 | ||
|
37c59a4e2c | ||
|
6897c3765d | ||
|
a8ed52bde7 | ||
|
30bd00f458 | ||
|
68505468fb | ||
|
b9ad1df2b1 | ||
|
db5600f28a | ||
|
95f7ad9d65 | ||
|
a3dbf3aaea | ||
|
043e3115cd | ||
|
003d6f5466 | ||
|
d8b040f6a6 | ||
|
40607fae55 | ||
|
2b74a82f85 | ||
|
a649d03124 | ||
|
600cf89c86 | ||
|
511e687db0 | ||
|
3fae196eaa | ||
|
7c741c77ee | ||
|
82cdd90e57 | ||
|
59343a0633 | ||
|
bdcfbe4a8f |
11
AUTHORS
11
AUTHORS
@ -1,11 +0,0 @@
|
||||
Upstream author:
|
||||
Artem Galichkin <doomer3d@gmail.com>
|
||||
|
||||
Contributors:
|
||||
Jerome Leclanche <jerome@leclan.ch>
|
||||
Alexander Sokolov <sokoloff.a@gmail.com>
|
||||
Alf Gaida <agaida@siduction.org>
|
||||
Ilya87 <yast4ik@gmail.com>
|
||||
Jonathan Hooverman <jonathan.hooverman@gmail.com>
|
||||
Paulo Lieuthier <paulolieuthier@gmail.com>
|
||||
|
119
CHANGELOG
119
CHANGELOG
@ -1,119 +0,0 @@
|
||||
2.0
|
||||
* Port on Qt5
|
||||
|
||||
1.2
|
||||
* Added ability for autosaving type of the last created screenshot
|
||||
* Some small fixes
|
||||
|
||||
1.1.1
|
||||
* Fixed wrong 'imgur' uploading result string for bb-code with preview
|
||||
* Fixed segfault when exist configuration file contains "showTrayIcon=false"
|
||||
|
||||
1.1
|
||||
* added ability to upload to MediaCreush (http://mediacru.sh)
|
||||
* Option "Always save the window size" replaced by "autosave window size on exit ScreenGrab"
|
||||
* Reworked main window ui (the order of the buttons)
|
||||
* Reworked the configuration dialog (some UI elements moved between sections, and increment count of the sections)
|
||||
|
||||
1.0
|
||||
* Fixed dual monitor support
|
||||
* added XDG_CONFIG_HOME support, by a build option SG_XDG_CONFIG_SUPPORT
|
||||
* added ability to upload to some image hosting services (imgur.com and imgshack.us)
|
||||
* added build option for compiling without the upload feature (SG_EXT_UPLOADS build option)
|
||||
* added "Previous selection" mode (save the last selected area and restore it in the next get area screenshot)
|
||||
* added ability to edit a screenshot in an external editor
|
||||
* added option for preview screenshot in default image viewer by double click on screenshot area
|
||||
* Fixed non-minimize main window on "Exit" shortcut, when using "Minimize to tray" option
|
||||
* Fixed bug with cutting button text on main window
|
||||
* Fixed regression with not capturing a screenshot when a second instance of ScreenGrab is running
|
||||
* fixed bug with not creating the path to autosave screenshots (when it is typed in manually in configuration dialog)
|
||||
* added build option SG_GLOBALSHORTCUTS for turning on/off build with global shortcuts support
|
||||
* autoincrement filenames when saving screenshots in manual mode (in one running session)
|
||||
* added the ability to customise shortcuts to close ScreenGrab
|
||||
* added ability to run ScreenGrab minimized to tray (or taskbar, if tray is disabled) with "--minimized" command line option
|
||||
* Added ability to automatically upload the screenshot via the command line "--upload" parameter
|
||||
|
||||
0.9.1
|
||||
* fixed non-switching combo-box "Type of Screeen" when grabbing screenshot from signal by another instance
|
||||
* fixed incorect grab active window screens in GNOME (when disabled "Allow multiple copies" option and run another instance)
|
||||
|
||||
0.9
|
||||
* added global shortcuts
|
||||
* added option to enable|disable system tray
|
||||
* added switch to the already running instance of an application when you start a second instance (non-operating mode to allow multiple instances)
|
||||
* added autosave first screenshot which has been taken on application start (enabled | disabled optional)
|
||||
* redesign of the configuration dialog UI
|
||||
|
||||
0.8.1
|
||||
* [Linux] fixed incorrect selection of the default saving format in the KDE 4.4.x save file dialog
|
||||
* added de_DE translation
|
||||
|
||||
0.8
|
||||
* added command line parameters for grab modes (fullscreen, active window, selection area)
|
||||
* added BMP support
|
||||
* added pt_BR translation
|
||||
* added automatically hiding main window on grab process
|
||||
* [Linux] fixed grab active window screenshot without decorations
|
||||
* [Linux] added option "no window decoration"
|
||||
* added shortcuts for main window buttons
|
||||
|
||||
0.6.2 [Linux only]
|
||||
* fixed non-translated tray menu (closed issue #7)
|
||||
|
||||
0.6.1 [Linux only]
|
||||
* fixed incorrect detection of the system language in some Linux distributions
|
||||
|
||||
0.6
|
||||
* default value of hiding main window changed to true.
|
||||
* added input template for inserting date-time into the saved filename
|
||||
* added zoom around mouse cursor in area selection mode
|
||||
* small modifications of the configuration dialog
|
||||
* added html help info (English & Russian)
|
||||
|
||||
0.5
|
||||
* added inserting date|time in saving filename [optional]
|
||||
* added auto saving screenshots in grabbing process [option]
|
||||
* added option to change the time of displaying tray messages [1 - 10 sec]
|
||||
* added help info
|
||||
* added tool tips for the UI elements
|
||||
* small fixes config file syntax
|
||||
|
||||
v0.4
|
||||
* added grabbing selection screen area
|
||||
* added ability to copy image files into the clipboard
|
||||
* added saving the size of the main window on exit [default is turned off]
|
||||
* halve the memory size occupied by ScreenGrab at startup
|
||||
* [win32] fixed bug with storing the screengrab.ini file
|
||||
* change structure of some source code
|
||||
* change buttons tab order of the main window
|
||||
* new application icon
|
||||
* some fixes
|
||||
|
||||
v0.3.1
|
||||
* fixed bug with non-displayed main window icon
|
||||
|
||||
v0.3
|
||||
* main window is now based on ui-file (remaked UI)
|
||||
* added grabbing active window
|
||||
* added option to allow running multiple instances of ScreenGrab
|
||||
* added option to select between minimizing to tray and closing ScreenGrab (by close window button)
|
||||
|
||||
v0.2
|
||||
* added JPEG support
|
||||
* added options dialog
|
||||
* added option to select a default directory for saving the files
|
||||
* added option to select a default filename
|
||||
* added option to select a default image format
|
||||
* added saving options into an INI-file
|
||||
* added i18n support and Russian localisation
|
||||
* some fixes and changes in the code
|
||||
* Windows version is now available as installer
|
||||
|
||||
v0.1
|
||||
* first public version
|
||||
* added system tray icon and menu
|
||||
* added option to hide ScreenGrab in systray
|
||||
* added option to block running a second instance of ScreenGrab
|
||||
|
||||
v0.0.3
|
||||
- first working build
|
287
CMakeLists.txt
287
CMakeLists.txt
@ -1,287 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR)
|
||||
|
||||
# set project's name
|
||||
project(screengrab)
|
||||
|
||||
find_package(Qt5Widgets 5.2.0 REQUIRED)
|
||||
find_package(Qt5X11Extras 5.2.0 REQUIRED)
|
||||
find_package(Qt5Network 5.2.0 REQUIRED)
|
||||
find_package(KF5WindowSystem REQUIRED)
|
||||
|
||||
# for translations
|
||||
find_package(Qt5LinguistTools REQUIRED)
|
||||
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
# long live cmake + qt :)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
||||
|
||||
find_package(X11)
|
||||
if (X11_FOUND)
|
||||
set(HAVE_X11 1)
|
||||
endif(X11_FOUND)
|
||||
|
||||
# set up xcb and x11_xcb
|
||||
|
||||
find_package(
|
||||
XCB MODULE COMPONENTS
|
||||
XCB
|
||||
SHAPE
|
||||
XFIXES
|
||||
)
|
||||
|
||||
find_package(
|
||||
X11_XCB MODULE
|
||||
)
|
||||
|
||||
# add version define
|
||||
set(SCREENGRAB_VERSION "1.95")
|
||||
set(SCREENGRAB_VERSION_DEV "2.0-beta1")
|
||||
# set(DEV_BUILD True)
|
||||
|
||||
if(SCREENGRAB_VERSION_DEV)
|
||||
if(DEV_BUILD)
|
||||
# search git executable
|
||||
find_package(Git)
|
||||
if(GIT_FOUND)
|
||||
# executable git for check HEAD rev hash
|
||||
execute_process(
|
||||
COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD
|
||||
OUTPUT_VARIABLE GIT_HASH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
endif()
|
||||
|
||||
set(VERSION "${SCREENGRAB_VERSION} (${SCREENGRAB_VERSION_DEV}-git-${GIT_HASH})")
|
||||
else()
|
||||
set(VERSION "${SCREENGRAB_VERSION} (${SCREENGRAB_VERSION_DEV})")
|
||||
endif()
|
||||
elseif(NOT SCREENGRAB_VERSION_DEV)
|
||||
set(VERSION "${SCREENGRAB_VERSION}")
|
||||
endif(SCREENGRAB_VERSION_DEV)
|
||||
|
||||
add_definitions(-DVERSION="${VERSION}")
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
endif()
|
||||
|
||||
message(STATUS "Build type: " ${CMAKE_BUILD_TYPE})
|
||||
message(STATUS "Install prefix: " ${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Woverloaded-virtual -Wall -Wextra")
|
||||
|
||||
set(SG_LIBDIR "${CMAKE_INSTALL_LIBDIR}/screengrab")
|
||||
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${SG_LIBDIR}")
|
||||
message(STATUS "Library path: ${CMAKE_INSTALL_RPATH}")
|
||||
|
||||
# options
|
||||
option(SG_GLOBALSHORTCUTS "Enable global shortcuts" OFF)
|
||||
option(SG_EXT_UPLOADS "Enable upload screenshots to MediaCrush and imgur" ON)
|
||||
option(SG_EXT_EDIT "Enable ability to edit screenshots in external editor" ON)
|
||||
option(SG_DBUS_NOTIFY "Enable D-Bus notifications" ON)
|
||||
option(UPDATE_TRANSLATIONS "Update source translation translations/*.ts files" OFF)
|
||||
|
||||
# Although the names, LXQtTranslateTs and LXQtTranslateDesktop, they don't
|
||||
# bring any dependency on lxqt.
|
||||
include(LXQtTranslateTs)
|
||||
include(LXQtTranslateDesktop)
|
||||
include(Qt5TranslationLoader)
|
||||
|
||||
if(SG_GLOBALSHORTCUTS)
|
||||
add_definitions( -DSG_GLOBAL_SHORTCUTS="1")
|
||||
|
||||
if(SG_USE_SYSTEM_QXT)
|
||||
# find qxt
|
||||
find_package(Qxt REQUIRED COMPONENTS QxtCore, QxtGui)
|
||||
include_directories(${QXT_QXTCORE_INCLUDE_DIR} ${QXT_QXTGUI_INCLUDE_DIR})
|
||||
endif()
|
||||
endif(SG_GLOBALSHORTCUTS)
|
||||
|
||||
if(SG_EXT_UPLOADS)
|
||||
add_definitions( -DSG_EXT_UPLOADS="1")
|
||||
endif()
|
||||
|
||||
if(SG_EXT_EDIT)
|
||||
add_definitions( -DSG_EXT_EDIT="1")
|
||||
find_package(Qt5Xdg REQUIRED)
|
||||
endif()
|
||||
|
||||
if(SG_DBUS_NOTIFY)
|
||||
find_package(Qt5DBus 5.2 REQUIRED)
|
||||
add_definitions( -DSG_DBUS_NOTIFY="1")
|
||||
endif()
|
||||
|
||||
message(STATUS "Global shortcuts support: " ${SG_GLOBALSHORTCUTS})
|
||||
message(STATUS "Upload to MediaCrush and imgur support: " ${SG_EXT_UPLOADS})
|
||||
message(STATUS "Editing screenshots in external editor support: " ${SG_EXT_EDIT})
|
||||
message(STATUS "Enable D-Bus notifications: " ${SG_DBUS_NOTIFY})
|
||||
message(STATUS "Use system Qxt Library: " ${SG_USE_SYSTEM_QXT})
|
||||
message(STATUS "Update source translation translations/*.ts files: " ${UPDATE_TRANSLATIONS})
|
||||
|
||||
# docs
|
||||
# CMAKE_INSTALL_FULL_DOCDIR = CMAKE_INSTALL_PREFIX/CMAKE_INSTALL_DATADIR/doc/PROJECT_NAME
|
||||
message(STATUS "Documentation directory: " ${CMAKE_INSTALL_FULL_DOCDIR})
|
||||
add_definitions(-DSG_DOCDIR="${CMAKE_INSTALL_FULL_DOCDIR}")
|
||||
|
||||
# app icon path
|
||||
add_definitions(-DSG_ICONPATH="${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/pixmaps/screengrab.png")
|
||||
|
||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/src")
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/src/common/qkeysequencewidget")
|
||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/src/common/qkeysequencewidget/src")
|
||||
|
||||
if(SG_EXT_UPLOADS)
|
||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/src/modules/uploader")
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/src/modules/uploader")
|
||||
endif()
|
||||
|
||||
if (SG_EXT_EDIT)
|
||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/src/modules/extedit")
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/src/modules/extedit")
|
||||
endif()
|
||||
|
||||
set(SCREENGRAB_SRC
|
||||
src/core/main.cpp
|
||||
src/core/singleapp.cpp
|
||||
src/core/core.cpp
|
||||
src/core/config.cpp
|
||||
src/core/regionselect.cpp
|
||||
src/core/shortcutmanager.cpp
|
||||
src/core/modulemanager.cpp
|
||||
src/core/ui/configwidget.cpp
|
||||
src/core/ui/about.cpp
|
||||
src/core/ui/mainwindow.cpp
|
||||
)
|
||||
|
||||
if(SG_DBUS_NOTIFY)
|
||||
set(SCREENGRAB_SRC ${SCREENGRAB_SRC} src/core/dbusnotifier.cpp)
|
||||
endif()
|
||||
|
||||
if(X11_FOUND)
|
||||
set(SCREENGRAB_SRC ${SCREENGRAB_SRC} src/core/x11utils.cpp)
|
||||
endif()
|
||||
|
||||
set(SCREENGRAB_HDR
|
||||
src/core/singleapp.h
|
||||
)
|
||||
|
||||
set(SCREENGRAB_UI
|
||||
src/core/ui/configwidget.ui
|
||||
src/core/ui/aboutwidget.ui
|
||||
src/core/ui/mainwindow.ui
|
||||
)
|
||||
|
||||
# Qt resource file
|
||||
set(SCREENGRAB_QRC screengrab.qrc)
|
||||
qt5_add_resources(QRC_SOURCES ${SCREENGRAB_QRC})
|
||||
|
||||
message(STATUS "Generating localize ...")
|
||||
|
||||
set(SCREENGRAB_DESKTOP_FILES_IN
|
||||
screengrab.desktop.in
|
||||
)
|
||||
|
||||
lxqt_translate_ts(SCREENGRAB_QMS
|
||||
USE_QT5 TRUE
|
||||
UPDATE_TRANSLATIONS ${UPDATE_TRANSLATIONS}
|
||||
SOURCES
|
||||
${SCREENGRAB_SRC}
|
||||
${SCREENGRAB_UI}
|
||||
INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/translations"
|
||||
)
|
||||
|
||||
lxqt_translate_desktop(SCREENGRAB_DESKTOP_FILES
|
||||
SOURCES ${SCREENGRAB_DESKTOP_FILES_IN}
|
||||
)
|
||||
|
||||
qt5_translation_loader(SCREENGRAB_QM_LOADER
|
||||
"${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}/translations"
|
||||
${PROJECT_NAME}
|
||||
)
|
||||
|
||||
# generating executable
|
||||
add_executable(screengrab
|
||||
${SCREENGRAB_SRC}
|
||||
${SCREENGRAB_UI_H}
|
||||
${QRC_SOURCES}
|
||||
${SCREENGRAB_QMS}
|
||||
${SCREENGRAB_DESKTOP_FILES}
|
||||
${SCREENGRAB_QM_LOADER}
|
||||
)
|
||||
|
||||
if(SG_GLOBALSHORTCUTS)
|
||||
if(SG_USE_SYSTEM_QXT)
|
||||
target_link_libraries(screengrab ${QXT_QXTCORE_LIB_RELEASE} ${QXT_QXTGUI_LIB_RELEASE})
|
||||
else(SG_USE_SYSTEM_QXT)
|
||||
target_link_libraries(screengrab qxt)
|
||||
endif(SG_USE_SYSTEM_QXT)
|
||||
endif()
|
||||
|
||||
if(SG_EXT_UPLOADS)
|
||||
target_link_libraries(screengrab uploader)
|
||||
endif()
|
||||
|
||||
if(SG_EXT_EDIT)
|
||||
target_link_libraries(screengrab extedit)
|
||||
endif()
|
||||
|
||||
if(SG_DBUS_NOTIFY)
|
||||
target_link_libraries(screengrab Qt5::DBus)
|
||||
endif()
|
||||
|
||||
if (X11_XCB_FOUND)
|
||||
add_definitions( -DX11_XCB_FOUND="1")
|
||||
target_link_libraries(screengrab ${X11_XCB_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if (XCB_XCB_FOUND)
|
||||
add_definitions( -DXCB_XCB_FOUND="1")
|
||||
target_link_libraries(screengrab ${XCB_XCB_LIBRARY})
|
||||
endif()
|
||||
|
||||
if (XCB_SHAPE_FOUND)
|
||||
add_definitions( -DXCB_SHAPE_FOUND="1")
|
||||
target_link_libraries(screengrab ${XCB_SHAPE_LIBRARY})
|
||||
endif()
|
||||
|
||||
if (XCB_XFIXES_FOUND)
|
||||
add_definitions( -DXCB_XFOXES_FOUND="1")
|
||||
target_link_libraries(screengrab ${XCB_XFIXES_LIBRARY})
|
||||
endif()
|
||||
|
||||
target_link_libraries(screengrab qkeysequencewidget Qt5::Widgets KF5::WindowSystem ${X11_LIBRARIES})
|
||||
|
||||
# make src.tar.gz
|
||||
add_custom_target(dist @echo create source package)
|
||||
set(SCREENGRAB_DIST "screengrab-${SCREENGRAB_VERSION}")
|
||||
add_custom_command(COMMAND cp
|
||||
ARGS -R ${CMAKE_CURRENT_SOURCE_DIR} "/tmp/${SCREENGRAB_DIST}"
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
TARGET dist
|
||||
)
|
||||
|
||||
add_custom_command(COMMAND tar
|
||||
ARGS cvfz "${CMAKE_CURRENT_BINARY_DIR}/${SCREENGRAB_DIST}.tar.gz" --exclude=*~ --exclude-vcs --exclude=localize/*qm --exclude=*.kdev4 --exclude=build --exclude=create-src.sh --exclude=win32 -C "/tmp" "${SCREENGRAB_DIST}"
|
||||
WORKING_DIRECTORY "/tmp"
|
||||
TARGET dist
|
||||
)
|
||||
|
||||
add_custom_command(COMMAND rm
|
||||
ARGS -rf "/tmp/${SCREENGRAB_DIST}"
|
||||
WORKING_DIRECTORY "/tmp"
|
||||
TARGET dist
|
||||
)
|
||||
|
||||
# installing
|
||||
install(TARGETS screengrab RUNTIME DESTINATION bin)
|
||||
# install html docs
|
||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/docs/html" DESTINATION "${CMAKE_INSTALL_FULL_DOCDIR}")
|
||||
# install desktop files
|
||||
install(FILES ${SCREENGRAB_DESKTOP_FILES} DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
|
||||
# install pixmap
|
||||
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/img/screengrab.png" DESTINATION "${CMAKE_INSTALL_DATADIR}/icons/hicolor/32x32/apps")
|
280
COPYING
280
COPYING
@ -1,280 +0,0 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
62
README.md
62
README.md
@ -1,62 +0,0 @@
|
||||
ScreenGrab
|
||||
==========
|
||||
|
||||
version 2.0-dev
|
||||
|
||||
ScreenGrab - A program for fast creating screenshots, and easily publishing them on internet image hosting services. It works on Linux and Windows operating systems. ScreenGrab uses the Qt framework and thus, it is independent from any desktop environment.
|
||||
|
||||
Build requirements
|
||||
------------------
|
||||
|
||||
* Qt5 >= 5.2 (Qt 4.x support only 1.x branch)
|
||||
* CMake >= 2.8.11 (only for building ScreenGrab from sources)
|
||||
* GCC > 4.5
|
||||
* [optional] Qxt Library > 0.6 (if you want to build ScreenGrab using your system Qxt version - see the "Build options" section in this file)
|
||||
|
||||
Build
|
||||
-----
|
||||
|
||||
To build ScreenGrab from sources, use these commands:
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cmake [BUILD OPTIONS] ../
|
||||
make
|
||||
make install
|
||||
|
||||
Build options
|
||||
-------------
|
||||
|
||||
You can use some or all of these parameters to customise your build.
|
||||
|
||||
* **-DCMAKE_INSTALL_PREFIX** - Install prefix for Linux distro. Default setting: "/usr".
|
||||
* **-DSG_XDG_CONFIG_SUPPORT** - Place config files into XDGC_CONFIG_HOME directory (usually - ~/.config/${app_name) ). Default setting: ON. In previous versions the config files were stored in ~/.screengrab (Set this parameter to "OFF" to store the config files here).
|
||||
* **-DSG_EXT_UPLOADS** - Enable uploading screenshots to image hosting services. Default setting: ON.
|
||||
* **-DSG_DBUS_NOTIFY** - Enable D-Bus notifications.
|
||||
* **-DSG_GLOBALSHORTCUTS** - Enable global shortcuts for main actions to create screenshots. Default setting: ON.
|
||||
* **-DSG_USE_SYSTEM_QXT** - Use system version Qxt Library for global shortcuts. Default setting: OFF.
|
||||
* **-DSG_DOCDIR** - Name for the directory of user's documentation. Default setting: "screengrab".
|
||||
* **-DQKSW_SHARED** - Enable shared linking with qkeysequencewidget library (in src/common/qksysekwesewidget). Default setting: OFF.
|
||||
|
||||
**Build notes:**
|
||||
|
||||
* For Debian based Linux distro (Debian Squeezy, Ubuntu 12.04, etc) - if you want to build ScreenGrab using the system version of the Qxt Library, please use this command to run CMake:
|
||||
|
||||
cmake -DSG_USE_SYSTEM_QXT=ON -DQXT_QXTCORE_INCLUDE_DIR=/usr/include/qxt/QxtCore -DQXT_QXTGUI_INCLUDE_DIR=/usr/include/qxt -DCMAKE_INSTALL_PREFIX=/usr ../
|
||||
|
||||
|
||||
LICENSE
|
||||
-------
|
||||
|
||||
Screengrab is licensed under the GPL v2. See file LICENSE in docs directory for more information
|
||||
|
||||
Contacts
|
||||
--------
|
||||
|
||||
E-mail: doomer3d@gmail.com
|
||||
Jabber: doomer@jabber.linux.it
|
||||
Web homepage: http://screengrab.doomer.org/
|
||||
|
||||
|
||||
Copyright (c) 2009-2013, Artem 'DOOMer' Galichkin
|
||||
|
@ -1,155 +0,0 @@
|
||||
#############
|
||||
## basic FindQxt.cmake
|
||||
## This is an *EXTREMELY BASIC* cmake find/config file for
|
||||
## those times you have a cmake project and wish to use
|
||||
## libQxt.
|
||||
##
|
||||
## It should be noted that at the time of writing, that
|
||||
## I (mschnee) have an extremely limited understanding of the
|
||||
## way Find*.cmake files work, but I have attempted to
|
||||
## emulate what FindQt4.cmake and a few others do.
|
||||
##
|
||||
## To enable a specific component, set your QXT_USE_${modname}:
|
||||
## SET(QXT_USE_QXTCORE TRUE)
|
||||
## SET(QXT_USE_QXTGUI FALSE)
|
||||
## Currently available components:
|
||||
## QxtCore, QxtGui, QxtNetwork, QxtWeb, QxtSql
|
||||
## Auto-including directories are enabled with INCLUDE_DIRECTORIES(), but
|
||||
## can be accessed if necessary via ${QXT_INCLUDE_DIRS}
|
||||
##
|
||||
## To add the libraries to your build, TARGET_LINK_LIBRARIES(), such as...
|
||||
## TARGET_LINK_LIBRARIES(YourTargetNameHere ${QXT_LIBRARIES})
|
||||
## ...or..
|
||||
## TARGET_LINK_LIBRARIES(YourTargetNameHere ${QT_LIBRARIES} ${QXT_LIBRARIES})
|
||||
################### TODO:
|
||||
## The purpose of this cmake file is to find what components
|
||||
## exist, regardless of how libQxt was build or configured, thus
|
||||
## it should search/find all possible options. As I am not aware
|
||||
## that any module requires anything special to be used, adding all
|
||||
## modules to ${QXT_MODULES} below should be sufficient.
|
||||
## Eventually, there should be version numbers, but
|
||||
## I am still too unfamiliar with cmake to determine how to do
|
||||
## version checks and comparisons.
|
||||
## At the moment, this cmake returns a failure if you
|
||||
## try to use a component that doesn't exist. I don't know how to
|
||||
## set up warnings.
|
||||
## It would be nice having a FindQxt.cmake and a UseQxt.cmake
|
||||
## file like done for Qt - one to check for everything in advance
|
||||
|
||||
##############
|
||||
|
||||
###### setup
|
||||
SET(QXT_MODULES QxtGui QxtWeb QxtZeroConf QxtNetwork QxtSql QxtBerkeley QxtCore)
|
||||
SET(QXT_FOUND_MODULES)
|
||||
FOREACH(mod ${QXT_MODULES})
|
||||
STRING(TOUPPER ${mod} U_MOD)
|
||||
SET(QXT_${U_MOD}_INCLUDE_DIR NOTFOUND)
|
||||
SET(QXT_${U_MOD}_LIB_DEBUG NOTFOUND)
|
||||
SET(QXT_${U_MOD}_LIB_RELEASE NOTFOUND)
|
||||
SET(QXT_FOUND_${U_MOD} FALSE)
|
||||
ENDFOREACH(mod)
|
||||
SET(QXT_QXTGUI_DEPENDSON QxtCore)
|
||||
SET(QXT_QXTWEB_DEPENDSON QxtCore QxtNetwork)
|
||||
SET(QXT_QXTZEROCONF_DEPENDSON QxtCore QxtNetwork)
|
||||
SET(QXT_QXTNETWORK_DEPENDSON QxtCore)
|
||||
SET(QXT_QXTQSQL_DEPENDSON QxtCore)
|
||||
SET(QXT_QXTBERKELEY_DEPENDSON QxtCore)
|
||||
|
||||
FOREACH(mod ${QXT_MODULES})
|
||||
STRING(TOUPPER ${mod} U_MOD)
|
||||
FIND_PATH(QXT_${U_MOD}_INCLUDE_DIR ${mod}
|
||||
PATH_SUFFIXES ${mod} include/${mod} Qxt/include/${mod} include/Qxt/${mod}
|
||||
PATHS
|
||||
~/Library/Frameworks/
|
||||
/Library/Frameworks/
|
||||
/sw/
|
||||
/usr/local/
|
||||
/usr
|
||||
/opt/local/
|
||||
/opt/csw
|
||||
/opt
|
||||
"C:\\"
|
||||
"C:\\Program Files\\"
|
||||
"C:\\Program Files(x86)\\"
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
FIND_LIBRARY(QXT_${U_MOD}_LIB_RELEASE NAME ${mod}
|
||||
PATH_SUFFIXES Qxt/lib64 Qxt/lib lib64 lib
|
||||
PATHS
|
||||
/sw
|
||||
/usr/local
|
||||
/usr
|
||||
/opt/local
|
||||
/opt/csw
|
||||
/opt
|
||||
"C:\\"
|
||||
"C:\\Program Files"
|
||||
"C:\\Program Files(x86)"
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
FIND_LIBRARY(QXT_${U_MOD}_LIB_DEBUG NAME ${mod}d
|
||||
PATH_SUFFIXES Qxt/lib64 Qxt/lib lib64 lib
|
||||
PATHS
|
||||
/sw
|
||||
/usr/local
|
||||
/usr
|
||||
/opt/local
|
||||
/opt/csw
|
||||
/opt
|
||||
"C:\\"
|
||||
"C:\\Program Files"
|
||||
"C:\\Program Files(x86)"
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
IF (QXT_${U_MOD}_LIB_RELEASE)
|
||||
SET(QXT_FOUND_MODULES "${QXT_FOUND_MODULES} ${mod}")
|
||||
ENDIF (QXT_${U_MOD}_LIB_RELEASE)
|
||||
|
||||
IF (QXT_${U_MOD}_LIB_DEBUG)
|
||||
SET(QXT_FOUND_MODULES "${QXT_FOUND_MODULES} ${mod}")
|
||||
ENDIF (QXT_${U_MOD}_LIB_DEBUG)
|
||||
ENDFOREACH(mod)
|
||||
|
||||
FOREACH(mod ${QXT_MODULES})
|
||||
STRING(TOUPPER ${mod} U_MOD)
|
||||
IF(QXT_${U_MOD}_INCLUDE_DIR AND QXT_${U_MOD}_LIB_RELEASE)
|
||||
SET(QXT_FOUND_${U_MOD} TRUE)
|
||||
ENDIF(QXT_${U_MOD}_INCLUDE_DIR AND QXT_${U_MOD}_LIB_RELEASE)
|
||||
ENDFOREACH(mod)
|
||||
|
||||
|
||||
##### find and include
|
||||
# To use a Qxt Library....
|
||||
# SET(QXT_FIND_COMPONENTS QxtCore, QxtGui)
|
||||
# ...and this will do the rest
|
||||
IF( QXT_FIND_COMPONENTS )
|
||||
FOREACH( component ${QXT_FIND_COMPONENTS} )
|
||||
STRING( TOUPPER ${component} _COMPONENT )
|
||||
SET(QXT_USE_${_COMPONENT}_COMPONENT TRUE)
|
||||
ENDFOREACH( component )
|
||||
ENDIF( QXT_FIND_COMPONENTS )
|
||||
|
||||
SET(QXT_LIBRARIES "")
|
||||
SET(QXT_INCLUDE_DIRS "")
|
||||
|
||||
# like FindQt4.cmake, in order of dependence
|
||||
FOREACH( module ${QXT_MODULES} )
|
||||
STRING(TOUPPER ${module} U_MOD)
|
||||
IF(QXT_USE_${U_MOD} OR QXT_DEPENDS_${U_MOD})
|
||||
IF(QXT_FOUND_${U_MOD})
|
||||
STRING(REPLACE "QXT" "" qxt_module_def "${U_MOD}")
|
||||
ADD_DEFINITIONS(-DQXT_${qxt_module_def}_LIB)
|
||||
SET(QXT_INCLUDE_DIRS ${QXT_INCLUDE_DIRS} ${QXT_${U_MOD}_INCLUDE_DIR})
|
||||
INCLUDE_DIRECTORIES(${QXT_${U_MOD}_INCLUDE_DIR})
|
||||
SET(QXT_LIBRARIES ${QXT_LIBRARIES} ${QXT_${U_MOD}_LIB_RELEASE})
|
||||
ELSE(QXT_FOUND_${U_MOD})
|
||||
MESSAGE("Could not find Qxt Module ${module}")
|
||||
RETURN()
|
||||
ENDIF(QXT_FOUND_${U_MOD})
|
||||
FOREACH(dep ${QXT_${U_MOD}_DEPENDSON})
|
||||
STRING(TOUPPER ${dep} U_DEP)
|
||||
SET(QXT_DEPENDS_${U_DEP} TRUE)
|
||||
ENDFOREACH(dep)
|
||||
ENDIF(QXT_USE_${U_MOD} OR QXT_DEPENDS_${U_MOD})
|
||||
ENDFOREACH(module)
|
||||
MESSAGE(STATUS "Found Qxt Libraries:${QXT_FOUND_MODULES}")
|
@ -1,31 +0,0 @@
|
||||
# - Try to find libX11-xcb
|
||||
# Once done this will define
|
||||
#
|
||||
# X11_XCB_FOUND - system has libX11-xcb
|
||||
# X11_XCB_LIBRARIES - Link these to use libX11-xcb
|
||||
# X11_XCB_INCLUDE_DIR - the libX11-xcb include dir
|
||||
# X11_XCB_DEFINITIONS - compiler switches required for using libX11-xcb
|
||||
|
||||
# Copyright (c) 2011 Fredrik Höglund <fredrik@kde.org>
|
||||
# Copyright (c) 2008 Helio Chissini de Castro, <helio@kde.org>
|
||||
# Copyright (c) 2007 Matthias Kretz, <kretz@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
IF (NOT WIN32)
|
||||
# use pkg-config to get the directories and then use these values
|
||||
# in the FIND_PATH() and FIND_LIBRARY() calls
|
||||
FIND_PACKAGE(PkgConfig)
|
||||
PKG_CHECK_MODULES(PKG_X11_XCB QUIET x11-xcb)
|
||||
|
||||
SET(X11_XCB_DEFINITIONS ${PKG_X11_XCB_CFLAGS})
|
||||
|
||||
FIND_PATH(X11_XCB_INCLUDE_DIR NAMES X11/Xlib-xcb.h HINTS ${PKG_X11_XCB_INCLUDE_DIRS})
|
||||
FIND_LIBRARY(X11_XCB_LIBRARIES NAMES X11-xcb HINTS ${PKG_X11_XCB_LIBRARY_DIRS})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(X11_XCB DEFAULT_MSG X11_XCB_LIBRARIES X11_XCB_INCLUDE_DIR)
|
||||
|
||||
MARK_AS_ADVANCED(X11_XCB_INCLUDE_DIR X11_XCB_LIBRARIES)
|
||||
ENDIF (NOT WIN32)
|
@ -1,238 +0,0 @@
|
||||
# Try to find XCB on a Unix system
|
||||
#
|
||||
# This will define:
|
||||
#
|
||||
# XCB_FOUND - True if xcb is available
|
||||
# XCB_LIBRARIES - Link these to use xcb
|
||||
# XCB_INCLUDE_DIRS - Include directory for xcb
|
||||
# XCB_DEFINITIONS - Compiler flags for using xcb
|
||||
#
|
||||
# In addition the following more fine grained variables will be defined:
|
||||
#
|
||||
# XCB_XCB_FOUND XCB_XCB_INCLUDE_DIR XCB_XCB_LIBRARY
|
||||
# XCB_UTIL_FOUND XCB_UTIL_INCLUDE_DIR XCB_UTIL_LIBRARY
|
||||
# XCB_COMPOSITE_FOUND XCB_COMPOSITE_INCLUDE_DIR XCB_COMPOSITE_LIBRARY
|
||||
# XCB_DAMAGE_FOUND XCB_DAMAGE_INCLUDE_DIR XCB_DAMAGE_LIBRARY
|
||||
# XCB_XFIXES_FOUND XCB_XFIXES_INCLUDE_DIR XCB_XFIXES_LIBRARY
|
||||
# XCB_RENDER_FOUND XCB_RENDER_INCLUDE_DIR XCB_RENDER_LIBRARY
|
||||
# XCB_RANDR_FOUND XCB_RANDR_INCLUDE_DIR XCB_RANDR_LIBRARY
|
||||
# XCB_SHAPE_FOUND XCB_SHAPE_INCLUDE_DIR XCB_SHAPE_LIBRARY
|
||||
# XCB_DRI2_FOUND XCB_DRI2_INCLUDE_DIR XCB_DRI2_LIBRARY
|
||||
# XCB_GLX_FOUND XCB_GLX_INCLUDE_DIR XCB_GLX_LIBRARY
|
||||
# XCB_SHM_FOUND XCB_SHM_INCLUDE_DIR XCB_SHM_LIBRARY
|
||||
# XCB_XV_FOUND XCB_XV_INCLUDE_DIR XCB_XV_LIBRARY
|
||||
# XCB_SYNC_FOUND XCB_SYNC_INCLUDE_DIR XCB_SYNC_LIBRARY
|
||||
# XCB_XTEST_FOUND XCB_XTEST_INCLUDE_DIR XCB_XTEST_LIBRARY
|
||||
# XCB_ICCCM_FOUND XCB_ICCCM_INCLUDE_DIR XCB_ICCCM_LIBRARY
|
||||
# XCB_EWMH_FOUND XCB_EWMH_INCLUDE_DIR XCB_EWMH_LIBRARY
|
||||
# XCB_IMAGE_FOUND XCB_IMAGE_INCLUDE_DIR XCB_IMAGE_LIBRARY
|
||||
# XCB_RENDERUTIL_FOUND XCB_RENDERUTIL_INCLUDE_DIR XCB_RENDERUTIL_LIBRARY
|
||||
# XCB_KEYSYMS_FOUND XCB_KEYSYMS_INCLUDE_DIR XCB_KEYSYMS_LIBRARY
|
||||
#
|
||||
# Copyright (c) 2011 Fredrik Höglund <fredrik@kde.org>
|
||||
# Copyright (c) 2013 Martin Gräßlin <mgraesslin@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
set(knownComponents XCB
|
||||
COMPOSITE
|
||||
DAMAGE
|
||||
DRI2
|
||||
EWMH
|
||||
GLX
|
||||
ICCCM
|
||||
IMAGE
|
||||
KEYSYMS
|
||||
RANDR
|
||||
RENDER
|
||||
RENDERUTIL
|
||||
SHAPE
|
||||
SHM
|
||||
SYNC
|
||||
UTIL
|
||||
XFIXES
|
||||
XTEST
|
||||
XV)
|
||||
|
||||
unset(unknownComponents)
|
||||
|
||||
set(pkgConfigModules)
|
||||
set(requiredComponents)
|
||||
|
||||
if (XCB_FIND_COMPONENTS)
|
||||
set(comps ${XCB_FIND_COMPONENTS})
|
||||
else()
|
||||
set(comps ${knownComponents})
|
||||
endif()
|
||||
|
||||
# iterate through the list of requested components, and check that we know them all.
|
||||
# If not, fail.
|
||||
foreach(comp ${comps})
|
||||
list(FIND knownComponents ${comp} index )
|
||||
if("${index}" STREQUAL "-1")
|
||||
list(APPEND unknownComponents "${comp}")
|
||||
else()
|
||||
if("${comp}" STREQUAL "XCB")
|
||||
list(APPEND pkgConfigModules "xcb")
|
||||
elseif("${comp}" STREQUAL "COMPOSITE")
|
||||
list(APPEND pkgConfigModules "xcb-composite")
|
||||
elseif("${comp}" STREQUAL "DAMAGE")
|
||||
list(APPEND pkgConfigModules "xcb-damage")
|
||||
elseif("${comp}" STREQUAL "DRI2")
|
||||
list(APPEND pkgConfigModules "xcb-dri2")
|
||||
elseif("${comp}" STREQUAL "EWMH")
|
||||
list(APPEND pkgConfigModules "xcb-ewmh")
|
||||
elseif("${comp}" STREQUAL "GLX")
|
||||
list(APPEND pkgConfigModules "xcb-glx")
|
||||
elseif("${comp}" STREQUAL "ICCCM")
|
||||
list(APPEND pkgConfigModules "xcb-icccm")
|
||||
elseif("${comp}" STREQUAL "IMAGE")
|
||||
list(APPEND pkgConfigModules "xcb-image")
|
||||
elseif("${comp}" STREQUAL "KEYSYMS")
|
||||
list(APPEND pkgConfigModules "xcb-keysyms")
|
||||
elseif("${comp}" STREQUAL "RANDR")
|
||||
list(APPEND pkgConfigModules "xcb-randr")
|
||||
elseif("${comp}" STREQUAL "RENDER")
|
||||
list(APPEND pkgConfigModules "xcb-render")
|
||||
elseif("${comp}" STREQUAL "RENDERUTIL")
|
||||
list(APPEND pkgConfigModules "xcb-renderutil")
|
||||
elseif("${comp}" STREQUAL "SHAPE")
|
||||
list(APPEND pkgConfigModules "xcb-shape")
|
||||
elseif("${comp}" STREQUAL "SHM")
|
||||
list(APPEND pkgConfigModules "xcb-shm")
|
||||
elseif("${comp}" STREQUAL "SYNC")
|
||||
list(APPEND pkgConfigModules "xcb-sync")
|
||||
elseif("${comp}" STREQUAL "UTIL")
|
||||
list(APPEND pkgConfigModules "xcb-util")
|
||||
elseif("${comp}" STREQUAL "XFIXES")
|
||||
list(APPEND pkgConfigModules "xcb-xfixes")
|
||||
elseif("${comp}" STREQUAL "XTEST")
|
||||
list(APPEND pkgConfigModules "xcb-xtest")
|
||||
elseif("${comp}" STREQUAL "XV")
|
||||
list(APPEND pkgConfigModules "xcb-xv")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
|
||||
if(DEFINED unknownComponents)
|
||||
set(msgType STATUS)
|
||||
if(XCB_FIND_REQUIRED)
|
||||
set(msgType FATAL_ERROR)
|
||||
endif()
|
||||
if(NOT XCB_FIND_QUIETLY)
|
||||
message(${msgType} "XCB: requested unknown components ${unknownComponents}")
|
||||
endif()
|
||||
return()
|
||||
endif()
|
||||
|
||||
macro(_XCB_HANDLE_COMPONENT _comp)
|
||||
set(_header )
|
||||
set(_lib )
|
||||
if("${_comp}" STREQUAL "XCB")
|
||||
set(_header "xcb/xcb.h")
|
||||
set(_lib "xcb")
|
||||
elseif("${_comp}" STREQUAL "COMPOSITE")
|
||||
set(_header "xcb/composite.h")
|
||||
set(_lib "xcb-composite")
|
||||
elseif("${_comp}" STREQUAL "DAMAGE")
|
||||
set(_header "xcb/damage.h")
|
||||
set(_lib "xcb-damage")
|
||||
elseif("${_comp}" STREQUAL "DRI2")
|
||||
set(_header "xcb/dri2.h")
|
||||
set(_lib "xcb-dri2")
|
||||
elseif("${_comp}" STREQUAL "EWMH")
|
||||
set(_header "xcb/xcb_ewmh.h")
|
||||
set(_lib "xcb-ewmh")
|
||||
elseif("${_comp}" STREQUAL "GLX")
|
||||
set(_header "xcb/glx.h")
|
||||
set(_lib "xcb-glx")
|
||||
elseif("${_comp}" STREQUAL "ICCCM")
|
||||
set(_header "xcb/xcb_icccm.h")
|
||||
set(_lib "xcb-icccm")
|
||||
elseif("${_comp}" STREQUAL "IMAGE")
|
||||
set(_header "xcb/xcb_image.h")
|
||||
set(_lib "xcb-image")
|
||||
elseif("${_comp}" STREQUAL "KEYSYMS")
|
||||
set(_header "xcb/xcb_keysyms.h")
|
||||
set(_lib "xcb-keysyms")
|
||||
elseif("${_comp}" STREQUAL "RANDR")
|
||||
set(_header "xcb/randr.h")
|
||||
set(_lib "xcb-randr")
|
||||
elseif("${_comp}" STREQUAL "RENDER")
|
||||
set(_header "xcb/render.h")
|
||||
set(_lib "xcb-render")
|
||||
elseif("${_comp}" STREQUAL "RENDERUTIL")
|
||||
set(_header "xcb/xcb_renderutil.h")
|
||||
set(_lib "xcb-render-util")
|
||||
elseif("${_comp}" STREQUAL "SHAPE")
|
||||
set(_header "xcb/shape.h")
|
||||
set(_lib "xcb-shape")
|
||||
elseif("${_comp}" STREQUAL "SHM")
|
||||
set(_header "xcb/shm.h")
|
||||
set(_lib "xcb-shm")
|
||||
elseif("${_comp}" STREQUAL "SYNC")
|
||||
set(_header "xcb/sync.h")
|
||||
set(_lib "xcb-sync")
|
||||
elseif("${_comp}" STREQUAL "UTIL")
|
||||
set(_header "xcb/xcb_util.h")
|
||||
set(_lib "xcb-util")
|
||||
elseif("${_comp}" STREQUAL "XFIXES")
|
||||
set(_header "xcb/xfixes.h")
|
||||
set(_lib "xcb-xfixes")
|
||||
elseif("${_comp}" STREQUAL "XTEST")
|
||||
set(_header "xcb/xtest.h")
|
||||
set(_lib "xcb-xtest")
|
||||
elseif("${_comp}" STREQUAL "XV")
|
||||
set(_header "xcb/xv.h")
|
||||
set(_lib "xcb-xv")
|
||||
endif()
|
||||
|
||||
find_path(XCB_${_comp}_INCLUDE_DIR NAMES ${_header} HINTS ${PKG_XCB_INCLUDE_DIRS})
|
||||
find_library(XCB_${_comp}_LIBRARY NAMES ${_lib} HINTS ${PKG_XCB_LIBRARY_DIRS})
|
||||
|
||||
if(XCB_${_comp}_INCLUDE_DIR AND XCB_${_comp}_LIBRARY)
|
||||
list(APPEND XCB_INCLUDE_DIRS ${XCB_${_comp}_INCLUDE_DIR})
|
||||
list(APPEND XCB_LIBRARIES ${XCB_${_comp}_LIBRARY})
|
||||
if (NOT XCB_FIND_QUIETLY)
|
||||
message(STATUS "XCB[${_comp}]: Found component ${_comp}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(XCB_FIND_REQUIRED_${_comp})
|
||||
list(APPEND requiredComponents XCB_${_comp}_FOUND)
|
||||
endif()
|
||||
|
||||
find_package_handle_standard_args(XCB_${_comp} DEFAULT_MSG XCB_${_comp}_LIBRARY XCB_${_comp}_INCLUDE_DIR)
|
||||
|
||||
mark_as_advanced(XCB_${_comp}_LIBRARY XCB_${_comp}_INCLUDE_DIR)
|
||||
|
||||
# compatibility for old variable naming
|
||||
set(XCB_${_comp}_INCLUDE_DIRS ${XCB_${_comp}_INCLUDE_DIR})
|
||||
set(XCB_${_comp}_LIBRARIES ${XCB_${_comp}_LIBRARY})
|
||||
endmacro()
|
||||
|
||||
IF (NOT WIN32)
|
||||
include(FindPackageHandleStandardArgs)
|
||||
# Use pkg-config to get the directories and then use these values
|
||||
# in the FIND_PATH() and FIND_LIBRARY() calls
|
||||
find_package(PkgConfig)
|
||||
pkg_check_modules(PKG_XCB QUIET ${pkgConfigModules})
|
||||
|
||||
set(XCB_DEFINITIONS ${PKG_XCB_CFLAGS})
|
||||
|
||||
foreach(comp ${comps})
|
||||
_xcb_handle_component(${comp})
|
||||
endforeach()
|
||||
|
||||
if(XCB_INCLUDE_DIRS)
|
||||
list(REMOVE_DUPLICATES XCB_INCLUDE_DIRS)
|
||||
endif()
|
||||
|
||||
find_package_handle_standard_args(XCB DEFAULT_MSG XCB_LIBRARIES XCB_INCLUDE_DIRS ${requiredComponents})
|
||||
|
||||
# compatibility for old variable naming
|
||||
set(XCB_INCLUDE_DIR ${XCB_INCLUDE_DIRS})
|
||||
|
||||
ENDIF (NOT WIN32)
|
@ -1,107 +0,0 @@
|
||||
#=============================================================================
|
||||
# The lxqt_translate_desktop() function was copied from the the
|
||||
# LXQt LxQtTranste.cmake
|
||||
#
|
||||
# Original Author: Alexander Sokolov <sokoloff.a@gmail.com>
|
||||
#
|
||||
# funtion lxqt_translate_desktop(_RESULT
|
||||
# SOURCES <sources>
|
||||
# [TRANSLATION_DIR] translation_directory
|
||||
# )
|
||||
# Output:
|
||||
# _RESULT The generated .desktop (.desktop) files
|
||||
#
|
||||
# Input:
|
||||
#
|
||||
# SOURCES List of input desktop files (.destktop.in) to be translated
|
||||
# (merged), relative to the CMakeList.txt.
|
||||
#
|
||||
# TRANSLATION_DIR Optional path to the directory with the .ts files,
|
||||
# relative to the CMakeList.txt. Defaults to
|
||||
# "translations".
|
||||
#
|
||||
#=============================================================================
|
||||
|
||||
function(lxqt_translate_desktop _RESULT)
|
||||
# Parse arguments ***************************************
|
||||
set(oneValueArgs TRANSLATION_DIR)
|
||||
set(multiValueArgs SOURCES)
|
||||
|
||||
cmake_parse_arguments(_ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
# check for unknown arguments
|
||||
set(_UNPARSED_ARGS ${_ARGS_UNPARSED_ARGUMENTS})
|
||||
if (NOT ${_UNPARSED_ARGS} STREQUAL "")
|
||||
MESSAGE(FATAL_ERROR
|
||||
"Unknown arguments '${_UNPARSED_ARGS}'.\n"
|
||||
"See lxqt_translate_desktop() documenation for more information.\n"
|
||||
)
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED _ARGS_SOURCES)
|
||||
set(${_RESULT} "" PARENT_SCOPE)
|
||||
return()
|
||||
else()
|
||||
set(_sources ${_ARGS_SOURCES})
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED _ARGS_TRANSLATION_DIR)
|
||||
set(_translationDir "translations")
|
||||
else()
|
||||
set(_translationDir ${_ARGS_TRANSLATION_DIR})
|
||||
endif()
|
||||
|
||||
|
||||
get_filename_component (_translationDir ${_translationDir} ABSOLUTE)
|
||||
|
||||
foreach (_inFile ${_sources})
|
||||
get_filename_component(_inFile ${_inFile} ABSOLUTE)
|
||||
get_filename_component(_fileName ${_inFile} NAME_WE)
|
||||
#Extract the real extension ............
|
||||
get_filename_component(_fileExt ${_inFile} EXT)
|
||||
string(REPLACE ".in" "" _fileExt ${_fileExt})
|
||||
#.......................................
|
||||
set(_outFile "${CMAKE_CURRENT_BINARY_DIR}/${_fileName}${_fileExt}")
|
||||
|
||||
file(GLOB _translations
|
||||
${_translationDir}/${_fileName}_*${_fileExt}
|
||||
${_translationDir}/local/${_fileName}_*${_fileExt}
|
||||
)
|
||||
|
||||
set(_pattern "'\\[.*]\\s*='")
|
||||
if (_translations)
|
||||
add_custom_command(OUTPUT ${_outFile}
|
||||
COMMAND grep -v "'#TRANSLATIONS_DIR='" ${_inFile} > ${_outFile}
|
||||
COMMAND grep -h ${_pattern} ${_translations} >> ${_outFile}
|
||||
COMMENT "Generating ${_fileName}${_fileExt}"
|
||||
)
|
||||
else()
|
||||
add_custom_command(OUTPUT ${_outFile}
|
||||
COMMAND grep -v "'#TRANSLATIONS_DIR='" ${_inFile} > ${_outFile}
|
||||
COMMENT "Generating ${_fileName}${_fileExt}"
|
||||
)
|
||||
endif()
|
||||
|
||||
set(__result ${__result} ${_outFile})
|
||||
|
||||
|
||||
# TX file ***********************************************
|
||||
set(_txFile "${CMAKE_BINARY_DIR}/tx/${_fileName}${_fileExt}.tx.sh")
|
||||
string(REPLACE "${CMAKE_SOURCE_DIR}/" "" _tx_translationDir ${_translationDir})
|
||||
string(REPLACE "${CMAKE_SOURCE_DIR}/" "" _tx_inFile ${_inFile})
|
||||
string(REPLACE "." "" _fileType ${_fileExt})
|
||||
|
||||
file(WRITE ${_txFile}
|
||||
"[ -f ${_inFile} ] || exit 0\n"
|
||||
"echo '[lxde-qt.${_fileName}_${_fileType}]'\n"
|
||||
"echo 'type = DESKTOP'\n"
|
||||
"echo 'source_lang = en'\n"
|
||||
"echo 'source_file = ${_tx_inFile}'\n"
|
||||
"echo 'file_filter = ${_tx_translationDir}/${_fileName}_<lang>${_fileExt}'\n"
|
||||
"echo ''\n"
|
||||
)
|
||||
|
||||
endforeach()
|
||||
|
||||
set(${_RESULT} ${__result} PARENT_SCOPE)
|
||||
endfunction(lxqt_translate_desktop)
|
@ -1,129 +0,0 @@
|
||||
#=============================================================================
|
||||
# Copyright 2014 Luís Pereira <luis.artur.pereira@gmail.com>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of the author may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#=============================================================================
|
||||
#
|
||||
# funtion lxqt_translate_ts(qmFiles
|
||||
# [USE_QT5 [Yes | No]]
|
||||
# [UPDATE_TRANSLATIONS [Yes | No]]
|
||||
# SOURCES <sources>
|
||||
# [TEMPLATE] translation_template
|
||||
# [TRANSLATION_DIR] translation_directory
|
||||
# [INSTALL_DIR] install_directory
|
||||
# )
|
||||
# Output:
|
||||
# qmFiles The generated compiled translations (.qm) files
|
||||
#
|
||||
# Input:
|
||||
# USE_QT5 Optional flag to choose between Qt4 and Qt5. Defaults to Qt5
|
||||
#
|
||||
# UPDATE_TRANSLATIONS Optional flag. Setting it to Yes, extracts and
|
||||
# compiles the translations. Setting it No, only
|
||||
# compiles them.
|
||||
#
|
||||
# TEMPLATE Optional translations files base name. Defaults to
|
||||
# ${PROJECT_NAME}. An .ts extensions is added.
|
||||
#
|
||||
# TRANSLATION_DIR Optional path to the directory with the .ts files,
|
||||
# relative to the CMakeList.txt. Defaults to
|
||||
# "translations".
|
||||
#
|
||||
# INSTALL_DIR Optional destination of the file compiled files (qmFiles).
|
||||
# If not present no installation is performed
|
||||
|
||||
|
||||
|
||||
# CMake v2.8.3 needed to use the CMakeParseArguments module
|
||||
cmake_minimum_required(VERSION 2.8.3 FATAL_ERROR)
|
||||
|
||||
|
||||
function(lxqt_translate_ts qmFiles)
|
||||
set(oneValueArgs USE_QT5 UPDATE_TRANSLATIONS TEMPLATE TRANSLATION_DIR INSTALL_DIR)
|
||||
set(multiValueArgs SOURCES)
|
||||
cmake_parse_arguments(TR "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
|
||||
|
||||
if (NOT DEFINED TR_UPDATE_TRANSLATIONS)
|
||||
set(TR_UPDATE_TRANSLATIONS "No")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED TR_USE_QT5)
|
||||
set(TR_USE_QT5 "Yes")
|
||||
endif()
|
||||
|
||||
if(NOT DEFINED TR_TEMPLATE)
|
||||
set(TR_TEMPLATE "${PROJECT_NAME}")
|
||||
endif()
|
||||
|
||||
if (NOT DEFINED TR_TRANSLATION_DIR)
|
||||
set(TR_TRANSLATION_DIR "translations")
|
||||
endif()
|
||||
|
||||
file(GLOB tsFiles "${TR_TRANSLATION_DIR}/${TR_TEMPLATE}_*.ts")
|
||||
set(templateFile "${TR_TRANSLATION_DIR}/${TR_TEMPLATE}.ts")
|
||||
|
||||
if(TR_USE_QT5)
|
||||
# Qt5
|
||||
if (TR_UPDATE_TRANSLATIONS)
|
||||
qt5_create_translation(QMS
|
||||
${TR_SOURCES}
|
||||
${templateFile}
|
||||
OPTIONS -locations absolute
|
||||
)
|
||||
qt5_create_translation(QM
|
||||
${TR_SOURCES}
|
||||
${tsFiles}
|
||||
OPTIONS -locations absolute
|
||||
)
|
||||
else()
|
||||
qt5_add_translation(QM ${tsFiles})
|
||||
endif()
|
||||
else()
|
||||
# Qt4
|
||||
if(TR_UPDATE_TRANSLATIONS)
|
||||
qt4_create_translation(QMS
|
||||
${TR_SOURCES}
|
||||
${templateFile}
|
||||
OPTIONS -locations absolute
|
||||
)
|
||||
qt4_create_translation(QM
|
||||
${TR_SOURCES}
|
||||
${tsFiles}
|
||||
OPTIONS -locations absolute
|
||||
)
|
||||
else()
|
||||
qt4_add_translation(QM ${tsFiles})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(TR_UPDATE_TRANSLATIONS)
|
||||
add_custom_target("update_${TR_TEMPLATE}_ts" ALL DEPENDS ${QMS})
|
||||
endif()
|
||||
|
||||
if(DEFINED TR_INSTALL_DIR)
|
||||
install(FILES ${QM} DESTINATION ${TR_INSTALL_DIR})
|
||||
endif()
|
||||
|
||||
set(${qmFiles} ${QM} PARENT_SCOPE)
|
||||
endfunction()
|
@ -1,49 +0,0 @@
|
||||
#=============================================================================
|
||||
# Copyright 2014 Luís Pereira <luis.artur.pereira@gmail.com>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of the author may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#=============================================================================
|
||||
#
|
||||
# These functions enables "automatic" translation loading in Qt5 apps
|
||||
# and libs. They generate a .cpp file that takes care of everything. The
|
||||
# user doesn't have to do anything in the source code.
|
||||
#
|
||||
# qt5_translation_loader(<source_files> <translations_dir> <catalog_name>)
|
||||
#
|
||||
# Output:
|
||||
# <source_files> Appends the generated file to this variable.
|
||||
#
|
||||
# Input:
|
||||
# <translations_dir> Full path name to the translations dir.
|
||||
# <catalog_name> Translation catalog to be loaded.
|
||||
|
||||
set(__CURRENT_DIR ${CMAKE_CURRENT_LIST_DIR})
|
||||
|
||||
function(qt5_translation_loader source_files translations_dir catalog_name)
|
||||
configure_file(
|
||||
${__CURRENT_DIR}/Qt5TranslationLoader.cpp.in
|
||||
Qt5TranslationLoader.cpp @ONLY
|
||||
)
|
||||
set(${source_files} ${${source_files}} ${CMAKE_CURRENT_BINARY_DIR}/Qt5TranslationLoader.cpp PARENT_SCOPE)
|
||||
endfunction()
|
@ -1,33 +0,0 @@
|
||||
/* This file has been generated by the CMake qt_translation_loader().
|
||||
* It loads Qt application translations.
|
||||
*
|
||||
* Attention: All changes will be overwritten!!!
|
||||
*/
|
||||
|
||||
#include <QCoreApplication>
|
||||
#include <QLocale>
|
||||
#include <QTranslator>
|
||||
#include <QLibraryInfo>
|
||||
|
||||
static void loadQtTranslation()
|
||||
{
|
||||
QString locale = QLocale::system().name();
|
||||
QTranslator *qtTranslator = new QTranslator(qApp);
|
||||
|
||||
if (qtTranslator->load("qt_" + locale, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) {
|
||||
qApp->installTranslator(qtTranslator);
|
||||
} else {
|
||||
delete qtTranslator;
|
||||
}
|
||||
|
||||
QTranslator *appTranslator = new QTranslator(qApp);
|
||||
if (appTranslator->load(QString("@translations_dir@/@catalog_name@_%1.qm").arg(locale))) {
|
||||
QCoreApplication::installTranslator(appTranslator);
|
||||
} else if (locale == QLatin1String("C") ||
|
||||
locale.startsWith(QLatin1String("en"))) {
|
||||
// English is the default. It's translated anyway.
|
||||
delete appTranslator;
|
||||
}
|
||||
}
|
||||
|
||||
Q_COREAPP_STARTUP_FUNCTION(loadQtTranslation)
|
291
debian/changelog
vendored
Normal file
291
debian/changelog
vendored
Normal file
@ -0,0 +1,291 @@
|
||||
screengrab (2.9.0-0ubuntu3) plucky; urgency=medium
|
||||
|
||||
* Update Standards-Version to 4.7.1, no changes needed.
|
||||
|
||||
-- Simon Quigley <tsimonq2@ubuntu.com> Fri, 21 Feb 2025 17:00:56 -0600
|
||||
|
||||
screengrab (2.9.0-0ubuntu2) plucky; urgency=medium
|
||||
|
||||
* No-change rebuild for lxqt-build-tools C++17 -> C++20.
|
||||
|
||||
-- Simon Quigley <tsimonq2@ubuntu.com> Fri, 03 Jan 2025 04:02:58 -0600
|
||||
|
||||
screengrab (2.9.0-0ubuntu1) plucky; urgency=medium
|
||||
|
||||
* New upstream release.
|
||||
- Bump build dependencies.
|
||||
|
||||
-- Simon Quigley <tsimonq2@ubuntu.com> Fri, 15 Nov 2024 15:33:53 -0600
|
||||
|
||||
screengrab (2.8.0-0ubuntu1) oracular; urgency=medium
|
||||
|
||||
* New upstream release.
|
||||
* Update copyright file.
|
||||
* Bump Standards-Version to 4.7.0, no changes necessary.
|
||||
* Adjust dependencies.
|
||||
|
||||
-- Aaron Rainbolt <arraybolt3@ubuntu.com> Thu, 15 Aug 2024 16:50:01 -0500
|
||||
|
||||
screengrab (2.7.0-0ubuntu1) noble; urgency=medium
|
||||
|
||||
* New upstream release.
|
||||
* Bump/clean up build dependencies, and run the wrap-and-sort hammer on
|
||||
d/control.
|
||||
* Lubuntuify.
|
||||
|
||||
-- Simon Quigley <tsimonq2@ubuntu.com> Sun, 12 Nov 2023 17:32:56 -0600
|
||||
|
||||
screengrab (2.6.0-1) unstable; urgency=medium
|
||||
|
||||
* New upstream version 2.6.0
|
||||
* debian/control: Update team email to <team+lxqt@tracker.debian.org>.
|
||||
* debian/control: cleanup build-deps.
|
||||
* debian/control: build-deps on libqt5xdg-dev (>= 3.11.0~).
|
||||
* debian/control: build-deps on libkf5windowsystem-dev (>=5.36.0~).
|
||||
* debian/control: build-deps on libqt5x11extras5-dev (>=5.15.0~).
|
||||
* debian/copyright: update.
|
||||
* debian/rules: cleanup.
|
||||
* debian/upstream/metadata: drop obsolete field Name.
|
||||
* debian/upstream/metadata: update url for git repo.
|
||||
* debian/salsa-ci.yml: drop build against to experimental.
|
||||
|
||||
-- Andrew Lee (李健秋) <ajqlee@debian.org> Sun, 30 Jul 2023 22:14:08 +0200
|
||||
|
||||
screengrab (2.5.0-1) unstable; urgency=medium
|
||||
|
||||
* New upstream release.
|
||||
|
||||
-- ChangZhuo Chen (陳昌倬) <czchen@debian.org> Thu, 05 Jan 2023 12:15:05 +0800
|
||||
|
||||
screengrab (2.4.0-3) unstable; urgency=medium
|
||||
|
||||
* Update d/watch for GitHub.
|
||||
|
||||
-- ChangZhuo Chen (陳昌倬) <czchen@debian.org> Thu, 05 Jan 2023 00:21:40 +0800
|
||||
|
||||
screengrab (2.4.0-2) unstable; urgency=medium
|
||||
|
||||
* Merge to unstable.
|
||||
* Bump Standards-Version to 4.6.2:
|
||||
* Add Rules-Requires-Root: no in d/control.
|
||||
* Bump compat to 13:
|
||||
* Remove unnecessary -Wl,--as-needed in d/rules.
|
||||
* Add d/upstream/metadata.
|
||||
* Update d/copyright.
|
||||
* Fix d/lintian-overrides.
|
||||
|
||||
-- ChangZhuo Chen (陳昌倬) <czchen@debian.org> Thu, 05 Jan 2023 00:08:37 +0800
|
||||
|
||||
screengrab (2.4.0-1) experimental; urgency=medium
|
||||
|
||||
* Team Upload
|
||||
|
||||
[ Andrew Lee (李健秋) ]
|
||||
* Add debian/salsa-ci.yml file.
|
||||
* Update debian/upstream/signing-key.asc.
|
||||
* New upstream version 2.3.0
|
||||
|
||||
[ suman rajan ]
|
||||
* New upstream version 2.4.0
|
||||
* debian/copyright: Added cc-by-4.0 license
|
||||
* debian/control: bumped depends version for libqt5xdg-dev
|
||||
* salsa-ci.yml: Added release experimental
|
||||
|
||||
-- suman rajan <suman@protonmail.com> Thu, 14 Jul 2022 00:21:31 +0530
|
||||
|
||||
screengrab (2.1.0-1) unstable; urgency=medium
|
||||
|
||||
* New upstream release.
|
||||
|
||||
-- Andrew Lee (李健秋) <ajqlee@debian.org> Thu, 07 Jan 2021 17:21:24 +0800
|
||||
|
||||
screengrab (2.0.0-1) unstable; urgency=medium
|
||||
|
||||
* New upstream version 2.0.0
|
||||
* Bumped Standards-Version to 4.4.1, no changes needed
|
||||
* Switched to gbp
|
||||
* Removed patches - not needed anymore
|
||||
* Added build dependency lxqt-build-tools (Closes: #948917)
|
||||
* Removed explicit build dependencies covered by lxqt-build-tools
|
||||
* Make dh_config more verbose about used options
|
||||
|
||||
-- Alf Gaida <agaida@siduction.org> Sat, 08 Feb 2020 17:05:20 +0100
|
||||
|
||||
screengrab (1.101-1) unstable; urgency=medium
|
||||
|
||||
* Cherry-picked upstream version 1.101.
|
||||
|
||||
-- Alf Gaida <agaida@siduction.org> Mon, 25 Feb 2019 23:55:11 +0100
|
||||
|
||||
screengrab (1.100-1) unstable; urgency=medium
|
||||
|
||||
* Cherry-picked upstream version 1.100.
|
||||
* Bumped Standards to 4.3.0, no changes needed
|
||||
* Dropped d/compat, use debhelper-compat = 12, no changes needed
|
||||
* Fixed years in d/copyright
|
||||
* Removed fix-reading-config.patch, applied upstream
|
||||
* Bumped minimum version libqt5xdg-dev (>= 3.3.0~)
|
||||
* Bumped minimum version libqt5xdgiconloader-dev (>= 3.3.0~)
|
||||
* Added d/upstream/metadata
|
||||
|
||||
-- Alf Gaida <agaida@siduction.org> Sun, 27 Jan 2019 13:20:28 +0100
|
||||
|
||||
screengrab (1.99-1) unstable; urgency=medium
|
||||
|
||||
* Cherry-picked upstream version 1.99.
|
||||
* Picked fix-reading-config.patch from upstream
|
||||
Big thanks to Helge Kreutzmann <debian@helgefjell.de> and
|
||||
Bernhard Übelacker <bernhardu@mailbox.org>
|
||||
(Closes: #905967)
|
||||
* Bumped Standards to 4.2.0, no changes needed
|
||||
|
||||
-- Alf Gaida <agaida@siduction.org> Sat, 18 Aug 2018 15:26:53 +0200
|
||||
|
||||
screengrab (1.98-1) unstable; urgency=medium
|
||||
|
||||
* Cherry-picked upstream version 1.98.
|
||||
* Removed date-time patch, applied upstream
|
||||
* Refreshed the remaining patches
|
||||
* Fixed system-wide configuration (Closes: #893809)
|
||||
* Fixed default file format (Closes: LP1733461)
|
||||
|
||||
-- Alf Gaida <agaida@siduction.org> Tue, 22 May 2018 18:01:45 +0200
|
||||
|
||||
screengrab (1.97-3) unstable; urgency=medium
|
||||
|
||||
* Bumped compat to 11
|
||||
* Bumped debhelper to >= 11~
|
||||
* Removed not needed cmake minimum version
|
||||
* Bumped Standards to 4.1.4, no changes needed
|
||||
* Changed VCS fields for salsa
|
||||
* Changed Homepage, Source and watch to lxqt
|
||||
* Use a secure url for copyright-format
|
||||
* Bumped years in copyright
|
||||
* Removed trailing whitespaces from changelog
|
||||
|
||||
-- Alf Gaida <agaida@siduction.org> Sat, 28 Apr 2018 23:05:53 +0200
|
||||
|
||||
screengrab (1.97-2) unstable; urgency=medium
|
||||
|
||||
* Bumped Standards to 4.1.2, no changes needed
|
||||
* Removed branch from VCS fields
|
||||
|
||||
-- Alf Gaida <agaida@siduction.org> Fri, 15 Dec 2017 19:20:30 +0100
|
||||
|
||||
screengrab (1.97-1) unstable; urgency=medium
|
||||
|
||||
* Cherry-picked upstream version 1.97.
|
||||
* Bumped Standards to 4.1.0, no changes needed
|
||||
* Bumped year in copyrights
|
||||
* Added CMAKE_BUILD_TYPE=RelWithDebInfo
|
||||
* Added pgpsignmangle to watch file
|
||||
* Added upstream signing key to debian
|
||||
* Fixed spelling error in changelog
|
||||
* Closes: #876853
|
||||
|
||||
-- Alf Gaida <agaida@siduction.org> Tue, 26 Sep 2017 22:56:04 +0200
|
||||
|
||||
screengrab (1.96-1) unstable; urgency=medium
|
||||
|
||||
* Cherry-picked upstream version 1.96.
|
||||
* Removed disable-upload.patch, applied upstream
|
||||
* Bumped minimum version libqt5xdg-dev (>= 2.0.0)
|
||||
* Added build dependency libqt5svg5-dev
|
||||
* Added build dependency libqt5xdgiconloader-dev
|
||||
* Removed --parallel from rules, compat 10 standard
|
||||
|
||||
-- Alf Gaida <agaida@siduction.org> Tue, 18 Oct 2016 23:59:57 +0200
|
||||
|
||||
screengrab (1.96~38-g975f8ce-1) unstable; urgency=medium
|
||||
|
||||
* Cherry-picked upstream snapshot 1.96~38-g975f8ce
|
||||
* Removed not needed reproducible.patch, merged upstream
|
||||
* Added patch build-date-time.patch
|
||||
* Added patch disable-uploads.patch, core-cli-upload-option.patch,
|
||||
disable-cli-upload-option.patch (Closes: #834517)
|
||||
* Bumped compat to 10
|
||||
* Bumped dependency debhelper (>= 10)
|
||||
* Bumped Standards to 3.9.8, no changes needed
|
||||
|
||||
-- Alf Gaida <agaida@siduction.org> Mon, 19 Sep 2016 03:56:48 +0200
|
||||
|
||||
screengrab (1.95+20160128-3) unstable; urgency=medium
|
||||
|
||||
* Set LC_ALL for reproducible builds.
|
||||
|
||||
-- ChangZhuo Chen (陳昌倬) <czchen@debian.org> Mon, 08 Aug 2016 00:20:01 +0800
|
||||
|
||||
screengrab (1.95+20160128-2) unstable; urgency=medium
|
||||
|
||||
* make builds reproducible again (Closes: #815899), thanks to Eduard Sanou
|
||||
for the patch, but i fixed this already upstream
|
||||
* Bump Standard to 3.9.7
|
||||
|
||||
-- Alf Gaida <agaida@siduction.org> Thu, 25 Feb 2016 21:03:01 +0100
|
||||
|
||||
screengrab (1.95+20160128-1) unstable; urgency=medium
|
||||
|
||||
* Cherry-picking upstream version 1.95+20160128.
|
||||
* Fixed upload to Imgur
|
||||
* Drop debug package
|
||||
* use secure VCS uris
|
||||
* add hardening=+all
|
||||
* make builds reproducible (Closes: #813167)
|
||||
|
||||
-- Alf Gaida <agaida@siduction.org> Sat, 30 Jan 2016 03:19:31 +0100
|
||||
|
||||
screengrab (1.95+20151117-4) unstable; urgency=medium
|
||||
|
||||
* modify some build dependencies - and remove the limit of
|
||||
xfixes0-dev:
|
||||
Added libx11-xcb-dev,
|
||||
Added libxcb1-dev,
|
||||
Removed x11-utils
|
||||
* move from experimental to unstable
|
||||
|
||||
-- Alf Gaida <agaida@siduction.org> Sun, 20 Dec 2015 20:29:31 +0100
|
||||
|
||||
screengrab (1.95+20151117-3) experimental; urgency=medium
|
||||
|
||||
* Build dependency libxcb-xfixes0-dev leads to FTBFS when not limited
|
||||
to [linux-any]
|
||||
* Removed build dependency libqxt-dev, it's not used with Qt 5
|
||||
|
||||
-- Alf Gaida <agaida@siduction.org> Thu, 26 Nov 2015 02:58:26 +0100
|
||||
|
||||
screengrab (1.95+20151117-2) experimental; urgency=medium
|
||||
|
||||
* Added X11-Utils as build dependency
|
||||
|
||||
-- Alf Gaida <agaida@siduction.org> Fri, 20 Nov 2015 02:37:20 +0100
|
||||
|
||||
screengrab (1.95+20151117-1) experimental; urgency=medium
|
||||
|
||||
* Cherry-picking upstream version 1.95+20151117.
|
||||
* Added libxcb-xfixes0-dev as build dependency
|
||||
|
||||
-- Alf Gaida <agaida@siduction.org> Fri, 20 Nov 2015 00:23:43 +0100
|
||||
|
||||
screengrab (1.95+20150929-1) experimental; urgency=medium
|
||||
|
||||
[Alf Gaida ]
|
||||
* Cherry-picking upstream version 1.95+20150929.
|
||||
* Changed mail address of czchen
|
||||
* Added .gitignore
|
||||
* Added watch file
|
||||
* Added lintian-overrides
|
||||
* Added debug package
|
||||
* Fixed copyright
|
||||
* Deleted debian/install, use override_dh_auto_install instead
|
||||
* Cleaned source/options
|
||||
* Initial packaging (Closes: #795791)
|
||||
|
||||
[ ChangZhuo Chen (陳昌倬) ]
|
||||
* Fix changelog package name in changelog
|
||||
* Reformat control
|
||||
* Remove non upstream file
|
||||
|
||||
[ Andrew Lee (李健秋) ]
|
||||
* Adding upstream version 1.95_pr1.
|
||||
|
||||
-- Alf Gaida <agaida@siduction.org> Sun, 01 Nov 2015 23:34:44 +0100
|
33
debian/control
vendored
Normal file
33
debian/control
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
Source: screengrab
|
||||
Maintainer: Lubuntu Developers <lubuntu-devel@lists.ubuntu.com>
|
||||
Original-Maintainer: LXQt Packaging Team <team+lxqt@tracker.debian.org>
|
||||
Uploaders: Alf Gaida <agaida@siduction.org>,
|
||||
ChangZhuo Chen (陳昌倬) <czchen@debian.org>,
|
||||
Andrew Lee (李健秋) <ajqlee@debian.org>
|
||||
Section: graphics
|
||||
Priority: optional
|
||||
Build-Depends: debhelper-compat (= 13),
|
||||
libkf6windowsystem-dev (>= 6.0.0),
|
||||
libqt6xdg-dev (>= 4.1.0),
|
||||
libx11-xcb-dev,
|
||||
libxcb-xfixes0-dev [!kfreebsd-any],
|
||||
lxqt-build-tools (>= 2.1.0)
|
||||
Standards-Version: 4.7.1
|
||||
Vcs-Browser: https://salsa.debian.org/lxqt-team/screengrab
|
||||
Vcs-Git: https://salsa.debian.org/lxqt-team/screengrab.git
|
||||
Homepage: https://github.com/lxqt/screengrab
|
||||
Rules-Requires-Root: no
|
||||
|
||||
Package: screengrab
|
||||
Architecture: any
|
||||
Depends: doc-base, ${misc:Depends}, ${shlibs:Depends}
|
||||
Description: Crossplatform tool for getting screenshots
|
||||
Screengrab working in Linux and Windows. The program uses Qt and is
|
||||
independent of any desktop environment.
|
||||
Main features:
|
||||
* Get desktop screenshots
|
||||
* Get active window screenshots
|
||||
* Get secreenshots of desktop selection area
|
||||
* Copy screenshot to clipboard
|
||||
* Saving your image files in formats PNG or JPEG or BMP
|
||||
* Ability to set delay in getting screenshots (from 1 to 90 seconds)
|
377
debian/copyright
vendored
Normal file
377
debian/copyright
vendored
Normal file
@ -0,0 +1,377 @@
|
||||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: screengrab
|
||||
Source: https://github.com/lxqt/screengrab
|
||||
|
||||
Files: *
|
||||
Copyright: 2009-2015 Artem Galichkin <doomer3d@gmail.com>
|
||||
2014-2024, LXQt Project
|
||||
License: GPL-2.0+
|
||||
|
||||
Files: screengrab.metainfo.xml
|
||||
Copyright: 2010 Artem Galichkin <doomer3d@gmail.com>
|
||||
License: CC-BY-4.0
|
||||
|
||||
Files: src/common/qkeysequencewidget/*
|
||||
Copyright: 2010 Artem Galichkin <doomer3d@gmail.com>
|
||||
License: BSD-3-Clause
|
||||
|
||||
Files: debian/*
|
||||
Copyright: 2010-2013 Artem Galichkin <doomer3d@gmail.com>
|
||||
2012-2020 Alf Gaida <agaida@siduction.org>
|
||||
2015-2023 ChangZhuo Chen (陳昌倬) <czchen@debian.org>
|
||||
2022 suman rajan <suman@protonmail.com>
|
||||
2023 Andrew Lee (李健秋) <ajqlee@debian.org>
|
||||
2024 Aaron Rainbolt <arraybolt3@ubuntu.com>
|
||||
2025 Simon Quigley <tsimonq2@ubuntu.com>
|
||||
License: GPL-2.0+
|
||||
|
||||
License: GPL-2.0+
|
||||
This package is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
.
|
||||
This package is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
.
|
||||
On Debian systems, the complete text of the GNU General
|
||||
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
|
||||
|
||||
License: BSD-3-Clause
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the University nor the names of its contributors
|
||||
may be used to endorse or promote products derived from this software
|
||||
without specific prior written permission.
|
||||
.
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE HOLDERS OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
License: CC-BY-4.0
|
||||
Creative Commons Attribution 4.0 International Public License
|
||||
.
|
||||
By exercising the Licensed Rights (defined below),
|
||||
You accept and agree to be bound by the terms and conditions
|
||||
of this Creative Commons Attribution 4.0 International Public License
|
||||
("Public License").
|
||||
To the extent this Public License may be interpreted as a contract,
|
||||
You are granted the Licensed Rights
|
||||
in consideration of Your acceptance of these terms and conditions,
|
||||
and the Licensor grants You such rights
|
||||
in consideration of benefits the Licensor receives
|
||||
from making the Licensed Material available
|
||||
under these terms and conditions.
|
||||
.
|
||||
Section 1 -- Definitions.
|
||||
.
|
||||
a. Adapted Material means material
|
||||
subject to Copyright and Similar Rights
|
||||
that is derived from or based upon the Licensed Material
|
||||
and in which the Licensed Material is translated, altered,
|
||||
arranged, transformed, or otherwise modified
|
||||
in a manner requiring permission
|
||||
under the Copyright and Similar Rights held by the Licensor.
|
||||
For purposes of this Public License,
|
||||
where the Licensed Material is a musical work, performance,
|
||||
or sound recording,
|
||||
Adapted Material is always produced
|
||||
where the Licensed Material is synched
|
||||
in timed relation with a moving image.
|
||||
b. Adapter's License means the license
|
||||
You apply to Your Copyright and Similar Rights
|
||||
in Your contributions to Adapted Material
|
||||
in accordance with the terms and conditions
|
||||
of this Public License.
|
||||
c. Copyright and Similar Rights means copyright
|
||||
and/or similar rights closely related to copyright
|
||||
including, without limitation,
|
||||
performance, broadcast, sound recording,
|
||||
and Sui Generis Database Rights,
|
||||
without regard to how the rights are labeled or categorized.
|
||||
For purposes of this Public License,
|
||||
the rights specified in Section 2(b)(1)-(2)
|
||||
are not Copyright and Similar Rights.
|
||||
d. Effective Technological Measures means those measures
|
||||
that, in the absence of proper authority, may not be circumvented
|
||||
under laws fulfilling obligations
|
||||
under Article 11 of the WIPO Copyright Treaty
|
||||
adopted on December 20, 1996,
|
||||
and/or similar international agreements.
|
||||
e. Exceptions and Limitations means fair use, fair dealing,
|
||||
and/or any other exception or limitation
|
||||
to Copyright and Similar Rights
|
||||
that applies to Your use of the Licensed Material.
|
||||
f. Licensed Material means the artistic or literary work,
|
||||
database, or other material
|
||||
to which the Licensor applied this Public License.
|
||||
g. Licensed Rights means the rights granted to You
|
||||
subject to the terms and conditions of this Public License,
|
||||
which are limited to all Copyright and Similar Rights
|
||||
that apply to Your use of the Licensed Material
|
||||
and that the Licensor has authority to license.
|
||||
h. Licensor means the individual(s) or entity(ies)
|
||||
granting rights under this Public License.
|
||||
i. Share means to provide material to the public
|
||||
by any means or process that requires permission
|
||||
under the Licensed Rights,
|
||||
such as reproduction, public display, public performance,
|
||||
distribution, dissemination, communication, or importation,
|
||||
and to make material available to the public
|
||||
including in ways that members of the public may access the material
|
||||
from a place and at a time individually chosen by them.
|
||||
j. Sui Generis Database Rights means rights other than copyright
|
||||
resulting from Directive 96/9/EC of the European Parliament
|
||||
and of the Council of 11 March 1996
|
||||
on the legal protection of databases,
|
||||
as amended and/or succeeded,
|
||||
as well as other essentially equivalent rights
|
||||
anywhere in the world.
|
||||
k. You means the individual or entity
|
||||
exercising the Licensed Rights under this Public License.
|
||||
Your has a corresponding meaning.
|
||||
.
|
||||
Section 2 -- Scope.
|
||||
a. License grant.
|
||||
1. Subject to the terms and conditions of this Public License,
|
||||
the Licensor hereby grants You
|
||||
a worldwide, royalty-free, non-sublicensable, non-exclusive,
|
||||
irrevocable license
|
||||
to exercise the Licensed Rights in the Licensed Material to:
|
||||
a. reproduce and Share the Licensed Material,
|
||||
in whole or in part; and
|
||||
b. produce, reproduce, and Share Adapted Material.
|
||||
2. Exceptions and Limitations.
|
||||
For the avoidance of doubt,
|
||||
where Exceptions and Limitations apply to Your use,
|
||||
this Public License does not apply,
|
||||
and You do not need to comply with its terms and conditions.
|
||||
3. Term.
|
||||
The term of this Public License is specified in Section 6(a).
|
||||
4. Media and formats; technical modifications allowed.
|
||||
The Licensor authorizes You to exercise the Licensed Rights
|
||||
in all media and formats whether now known or hereafter created,
|
||||
and to make technical modifications necessary to do so.
|
||||
The Licensor waives and/or agrees not to assert
|
||||
any right or authority to forbid You
|
||||
from making technical modifications necessary
|
||||
to exercise the Licensed Rights,
|
||||
including technical modifications
|
||||
necessary to circumvent Effective Technological Measures.
|
||||
For purposes of this Public License,
|
||||
simply making modifications authorized by this Section 2(a)(4)
|
||||
never produces Adapted Material.
|
||||
5. Downstream recipients.
|
||||
a. Offer from the Licensor -- Licensed Material.
|
||||
Every recipient of the Licensed Material
|
||||
automatically receives an offer from the Licensor
|
||||
to exercise the Licensed Rights
|
||||
under the terms and conditions of this Public License.
|
||||
b. No downstream restrictions.
|
||||
You may not offer or impose
|
||||
any additional or different terms or conditions on,
|
||||
or apply any Effective Technological Measures to,
|
||||
the Licensed Material
|
||||
if doing so restricts exercise of the Licensed Rights
|
||||
by any recipient of the Licensed Material.
|
||||
6. No endorsement.
|
||||
Nothing in this Public License constitutes or may be construed
|
||||
as permission to assert or imply
|
||||
that You are, or that Your use of the Licensed Material is,
|
||||
connected with, or sponsored, endorsed,
|
||||
or granted official status by,
|
||||
the Licensor or others designated to receive attribution
|
||||
as provided in Section 3(a)(1)(A)(i).
|
||||
b. Other rights.
|
||||
1. Moral rights, such as the right of integrity,
|
||||
are not licensed under this Public License,
|
||||
nor are publicity, privacy,
|
||||
and/or other similar personality rights;
|
||||
however, to the extent possible,
|
||||
the Licensor waives and/or agrees not to assert
|
||||
any such rights held by the Licensor
|
||||
to the limited extent necessary to allow You
|
||||
to exercise the Licensed Rights, but not otherwise.
|
||||
2. Patent and trademark rights are not licensed
|
||||
under this Public License.
|
||||
3. To the extent possible,
|
||||
the Licensor waives any right
|
||||
to collect royalties from You
|
||||
for the exercise of the Licensed Rights,
|
||||
whether directly or through a collecting society
|
||||
under any voluntary or waivable
|
||||
statutory or compulsory licensing scheme.
|
||||
In all other cases the Licensor expressly reserves any right
|
||||
to collect such royalties.
|
||||
.
|
||||
Section 3 -- License Conditions.
|
||||
.
|
||||
Your exercise of the Licensed Rights is expressly made subject to the
|
||||
following conditions.
|
||||
a. Attribution.
|
||||
1. If You Share the Licensed Material
|
||||
(including in modified form),
|
||||
You must:
|
||||
a. retain the following
|
||||
if it is supplied by the Licensor with the Licensed Material:
|
||||
i. identification of the creator(s)
|
||||
of the Licensed Material and any others
|
||||
designated to receive attribution,
|
||||
in any reasonable manner requested by the Licensor
|
||||
(including by pseudonym if designated);
|
||||
ii. a copyright notice;
|
||||
iii. a notice that refers to this Public License;
|
||||
iv. a notice that refers to the disclaimer of warranties;
|
||||
v. a URI or hyperlink to the Licensed Material
|
||||
to the extent reasonably practicable;
|
||||
b. indicate if You modified the Licensed Material
|
||||
and retain an indication of any previous modifications; and
|
||||
c. indicate the Licensed Material is licensed
|
||||
under this Public License,
|
||||
and include the text of, or the URI or hyperlink to,
|
||||
this Public License.
|
||||
2. You may satisfy the conditions in Section 3(a)(1)
|
||||
in any reasonable manner based on the medium, means, and context
|
||||
in which You Share the Licensed Material.
|
||||
For example, it may be reasonable to satisfy the conditions
|
||||
by providing a URI or hyperlink to a resource
|
||||
that includes the required information.
|
||||
3. If requested by the Licensor, You must remove any of the
|
||||
information required by Section 3(a)(1)(A) to the extent
|
||||
reasonably practicable.
|
||||
4. If You Share Adapted Material You produce, the Adapter's
|
||||
License You apply must not prevent recipients of the Adapted
|
||||
Material from complying with this Public License.
|
||||
.
|
||||
Section 4 -- Sui Generis Database Rights.
|
||||
.
|
||||
Where the Licensed Rights include Sui Generis Database Rights
|
||||
that apply to Your use of the Licensed Material:
|
||||
a. for the avoidance of doubt,
|
||||
Section 2(a)(1) grants You the right
|
||||
to extract, reuse, reproduce, and Share
|
||||
all or a substantial portion of the contents of the database;
|
||||
b. if You include
|
||||
all or a substantial portion of the database contents
|
||||
in a database in which You have Sui Generis Database Rights,
|
||||
then the database in which You have Sui Generis Database Rights
|
||||
(but not its individual contents)
|
||||
is Adapted Material; and
|
||||
c. You must comply with the conditions in Section 3(a)
|
||||
if You Share
|
||||
all or a substantial portion of the contents of the database.
|
||||
.
|
||||
For the avoidance of doubt,
|
||||
this Section 4 supplements and does not replace
|
||||
Your obligations under this Public License
|
||||
where the Licensed Rights include other Copyright and Similar Rights.
|
||||
.
|
||||
Section 5 -- Disclaimer of Warranties and Limitation of Liability.
|
||||
.
|
||||
a. UNLESS OTHERWISE SEPARATELY UNDERTAKEN BY THE LICENSOR,
|
||||
TO THE EXTENT POSSIBLE,
|
||||
THE LICENSOR OFFERS THE LICENSED MATERIAL AS-IS AND AS-AVAILABLE,
|
||||
AND MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND
|
||||
CONCERNING THE LICENSED MATERIAL,
|
||||
WHETHER EXPRESS, IMPLIED, STATUTORY, OR OTHER.
|
||||
THIS INCLUDES, WITHOUT LIMITATION,
|
||||
WARRANTIES OF TITLE, MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT,
|
||||
ABSENCE OF LATENT OR OTHER DEFECTS, ACCURACY,
|
||||
OR THE PRESENCE OR ABSENCE OF ERRORS,
|
||||
WHETHER OR NOT KNOWN OR DISCOVERABLE.
|
||||
WHERE DISCLAIMERS OF WARRANTIES ARE NOT ALLOWED IN FULL OR IN PART,
|
||||
THIS DISCLAIMER MAY NOT APPLY TO YOU.
|
||||
b. TO THE EXTENT POSSIBLE,
|
||||
IN NO EVENT WILL THE LICENSOR BE LIABLE
|
||||
TO YOU ON ANY LEGAL THEORY
|
||||
(INCLUDING, WITHOUT LIMITATION,
|
||||
NEGLIGENCE)
|
||||
OR OTHERWISE FOR ANY DIRECT, SPECIAL, INDIRECT, INCIDENTAL,
|
||||
CONSEQUENTIAL, PUNITIVE, EXEMPLARY,
|
||||
OR OTHER LOSSES, COSTS, EXPENSES, OR DAMAGES
|
||||
ARISING OUT OF THIS PUBLIC LICENSE OR USE OF THE LICENSED MATERIAL,
|
||||
EVEN IF THE LICENSOR HAS BEEN ADVISED
|
||||
OF THE POSSIBILITY OF SUCH LOSSES, COSTS, EXPENSES, OR DAMAGES.
|
||||
WHERE A LIMITATION OF LIABILITY IS NOT ALLOWED IN FULL OR IN PART,
|
||||
THIS LIMITATION MAY NOT APPLY TO YOU.
|
||||
c. The disclaimer of warranties
|
||||
and limitation of liability provided above
|
||||
shall be interpreted in a manner that, to the extent possible,
|
||||
most closely approximates an absolute disclaimer and waiver
|
||||
of all liability.
|
||||
.
|
||||
Section 6 -- Term and Termination.
|
||||
a. This Public License applies
|
||||
for the term of the Copyright and Similar Rights licensed here.
|
||||
However, if You fail to comply with this Public License,
|
||||
then Your rights under this Public License terminate automatically.
|
||||
b. Where Your right to use the Licensed Material has terminated
|
||||
under Section 6(a), it reinstates:
|
||||
1. automatically as of the date the violation is cured,
|
||||
provided it is cured
|
||||
within 30 days of Your discovery of the violation; or
|
||||
2. upon express reinstatement by the Licensor.
|
||||
For the avoidance of doubt,
|
||||
this Section 6(b) does not affect any right
|
||||
the Licensor may have to seek remedies
|
||||
for Your violations of this Public License.
|
||||
c. For the avoidance of doubt,
|
||||
the Licensor may also offer the Licensed Material
|
||||
under separate terms or conditions
|
||||
or stop distributing the Licensed Material at any time;
|
||||
however, doing so will not terminate this Public License.
|
||||
d. Sections 1, 5, 6, 7, and 8 survive
|
||||
termination of this Public License.
|
||||
.
|
||||
Section 7 -- Other Terms and Conditions.
|
||||
a. The Licensor shall not be bound
|
||||
by any additional or different terms or conditions
|
||||
communicated by You
|
||||
unless expressly agreed.
|
||||
b. Any arrangements, understandings, or agreements
|
||||
regarding the Licensed Material not stated herein
|
||||
are separate from and independent
|
||||
of the terms and conditions of this Public License.
|
||||
.
|
||||
Section 8 -- Interpretation.
|
||||
a. For the avoidance of doubt,
|
||||
this Public License does not, and shall not be interpreted to,
|
||||
reduce, limit, restrict, or impose conditions
|
||||
on any use of the Licensed Material
|
||||
that could lawfully be made
|
||||
without permission under this Public License.
|
||||
b. To the extent possible,
|
||||
if any provision of this Public License is deemed unenforceable,
|
||||
it shall be automatically reformed
|
||||
to the minimum extent necessary to make it enforceable.
|
||||
If the provision cannot be reformed,
|
||||
it shall be severed from this Public License
|
||||
without affecting the enforceability
|
||||
of the remaining terms and conditions.
|
||||
c. No term or condition of this Public License will be waived
|
||||
and no failure to comply consented to
|
||||
unless expressly agreed to by the Licensor.
|
||||
d. Nothing in this Public License constitutes or may be interpreted
|
||||
as a limitation upon, or waiver of,
|
||||
any privileges and immunities that apply
|
||||
to the Licensor or You,
|
2
debian/docs
vendored
Normal file
2
debian/docs
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
AUTHORS
|
||||
README.md
|
6
debian/gbp.conf
vendored
Normal file
6
debian/gbp.conf
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
[DEFAULT]
|
||||
debian-branch = debian/sid
|
||||
upstream-branch = upstream/latest
|
||||
pristine-tar = True
|
||||
compression = xz
|
||||
|
5
debian/lintian-overrides
vendored
Normal file
5
debian/lintian-overrides
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
# there will be no manpage in a foreseeable future
|
||||
screengrab: no-manual-page *usr/bin/screengrab*
|
||||
|
||||
# the contained html documents are shown with the help button
|
||||
screengrab: possible-documentation-but-no-doc-base-registration
|
16
debian/rules
vendored
Executable file
16
debian/rules
vendored
Executable file
@ -0,0 +1,16 @@
|
||||
#!/usr/bin/make -f
|
||||
#export DH_VERBOSE=1
|
||||
|
||||
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
|
||||
export LC_ALL=C.UTF-8
|
||||
|
||||
%:
|
||||
dh ${@} --buildsystem=cmake
|
||||
|
||||
override_dh_auto_configure:
|
||||
dh_auto_configure -- \
|
||||
-DSG_DBUS_NOTIFY=ON \
|
||||
-DSG_EXT_EDIT=ON \
|
||||
-DSG_GLOBALSHORTCUTS=OFF \
|
||||
-DUPDATE_TRANSLATIONS=OFF \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo
|
11
debian/salsa-ci.yml
vendored
Normal file
11
debian/salsa-ci.yml
vendored
Normal file
@ -0,0 +1,11 @@
|
||||
# For more information on what jobs are run see:
|
||||
# https://salsa.debian.org/salsa-ci-team/pipeline
|
||||
#
|
||||
# To enable the jobs, go to your repository (at salsa.debian.org)
|
||||
# and click over Settings > CI/CD > Expand (in General pipelines).
|
||||
# In "Custom CI config path" write debian/salsa-ci.yml and click
|
||||
# in "Save Changes". The CI tests will run after the next commit.
|
||||
---
|
||||
include:
|
||||
- https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml
|
||||
- https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/pipeline-jobs.yml
|
7
debian/screengrab.doc-base
vendored
Normal file
7
debian/screengrab.doc-base
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
Document: screengrab
|
||||
Title: Screengrab Documentation
|
||||
Section: Viewers
|
||||
|
||||
Format: HTML
|
||||
Index: /usr/share/doc/screengrab/html/en/index.html
|
||||
Files: /usr/share/doc/screengrab/html/*/*.html
|
1
debian/screengrab.install
vendored
Normal file
1
debian/screengrab.install
vendored
Normal file
@ -0,0 +1 @@
|
||||
debian/screengrab.doc-base usr/share/doc-base/
|
4
debian/screengrab.lintian-overrides
vendored
Normal file
4
debian/screengrab.lintian-overrides
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
# This is expected
|
||||
screengrab: desktop-entry-lacks-keywords-entry [usr/share/applications/*.desktop]
|
||||
screengrab: appstream-metadata-validation-failed *
|
||||
screengrab: no-manual-page [usr/bin/*]
|
1
debian/source/format
vendored
Normal file
1
debian/source/format
vendored
Normal file
@ -0,0 +1 @@
|
||||
3.0 (quilt)
|
1
debian/source/options
vendored
Normal file
1
debian/source/options
vendored
Normal file
@ -0,0 +1 @@
|
||||
tar-ignore=.gitignore
|
5
debian/upstream/metadata
vendored
Normal file
5
debian/upstream/metadata
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
Bug-Database: https://github.com/lxqt/screengrab/issues
|
||||
Bug-Submit: https://github.com/lxqt/screengrab/issues/new
|
||||
Changelog: https://github.com/lxqt/screengrab/blob/master/CHANGELOG
|
||||
Repository: https://github.com/lxqt/screengrab.git
|
||||
Repository-Browse: https://github.com/lxqt/screengrab
|
52
debian/upstream/signing-key.asc
vendored
Normal file
52
debian/upstream/signing-key.asc
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
|
||||
mQINBF6cxrwBEADfl3ydxNfLBbWGPesXty2baQgixZ3D6aCxadI2kX+aikmT8rd0
|
||||
ttDKN18cXV52Ssxnj0qhgf4hwnu/b0be6BzqSEyGM+UQR3X2CYpxrMakfW32Q18K
|
||||
X5ec0RPR2ucBq9G0r9t6FYC8FkJ4uQUU3xxrLW3z302S0Makjgzm8BV9WrFQ7oFF
|
||||
uJQj0BHbHYC4RyaZb2AfxY4Y92BPGTjtGekWqgw6vEXCCnvAbGYVQzvxZt3nw21/
|
||||
1YmV4g7xhGFQPbOf9v3ejFUJeJIGzuJf5NAh7kvfCdUBAGYH0gnj0GpOve4ftnaG
|
||||
sAId2CQwm3oYF4Tu7yBPTOBpkaKkNaT+UdwTyeKERuCZ9ocZWX++/YF9ItRkJ5mM
|
||||
zoP1GluWn2atNWpRh/K97gyAGgr2fSmrAA4d1JrVbMujZAHoHAOKwJKqX9jPziPZ
|
||||
BFHfhcIOzG3ZhXAuumHsd7uwfPBVt20g+G+cOjBghbSSu9EOtMkAZl1g3ybvZixu
|
||||
Jtxa5exZWEmU7vtytEb8eq9Dj5XcGoTDbErE2RpJ/20HPzhyRKg9RN4iGS+0OiHS
|
||||
oRbDi5IEOizvQjp2bsBmfa3rsoDSOqF2pevp+u8I56I6bU1GFpxxNC5IGvgo2Q79
|
||||
quz0oIk5hs3eLlUdEYsLGwR6pWJaJyf36vuDsq7iLrLyvHI5irAowO4r1QARAQAB
|
||||
tCVQZWRyYW0gUG91cmFuZyA8dHN1amFuMjAwMEBnbWFpbC5jb20+iQJOBBMBCAA4
|
||||
FiEEGd/fOleb1QnbtXLYvnkwB60i334FAl6cxrwCGwMFCwkIBwIGFQoJCAsCBBYC
|
||||
AwECHgECF4AACgkQvnkwB60i335f9RAAgRpn8gUa/l10UkVAnpM2Cz0MuNMwwCOq
|
||||
IfVnuZuPBtYYiTU5Su++/aPZe3fF5B4v61F+XjNi7qeVL2t52X3jZ/iIx9Syasb+
|
||||
vDAIfQ5t6lKXvOptWxf6vteOg6CHbXwpGHbPjUkUS2vQwRikjBnR0SnkrMoXtgSX
|
||||
amPFqsitNrOhEJfeDfo0NzKESZuliWrCFt2v8c5q18G8cCZAvPLBlGuwRl58cDep
|
||||
3EIibMI/9MUSJbKoiHlK+LcHtG7BQTNis/e7Pe1PkRmExfhxe1lNajtOx8FO72Tq
|
||||
B6zY6drippM9VaIc1M+zp9BRpsFu8whOmapCqlXHRgAK8xTdQRIGInQFqLWPOxSC
|
||||
f0B6N+EvQvgkyFQ1rW+u91OJBma46uKkhrwf+mDttVRncaIAkgE6e6pqm18yIPFk
|
||||
D42rt/yHcOl+2qkcJS3gPcg5UvlCzqOwg1rKZQIk+TcPuDx3r2UghDEYZN9X6vw3
|
||||
zCBufr7ygZNf4tkbnVARFWTR4GzyCseFkWgOVZL9DccAhs8NeMy1WLkUzB75adeR
|
||||
3LONmEL7xOI8FuknKY4e6EcWhmstNIDgXfRe0hwO0VBdW3unoZC/K2ZM/ZuZyMdK
|
||||
TFjvYJrNewmymKge68wo0054bGZn8oz17i2AosJz7kW+ITsxmxhVcpfl4bav9Neq
|
||||
RpQwhnhK9bC5Ag0EXpzGvAEQANbeRHFbpgQVIqV9WVOVnTj4FIqrTPTPKKa02vJA
|
||||
7tGpgFapgvjdxnMxJfV6wuwOBUUFLR7DrXlV8EVFAYc5qTIeSQXvJsWw6gQ3+f0D
|
||||
z13oGOhZPBIzIKnV/MZI/jhIio8kSPWAuM5hR2X9Hvw3/CLo+H+hZZ6cFYoCxrQS
|
||||
tTzcKMkdQizLLa+WNbqUSxg6I/P5k/smUDY9gKW7RtI5t/PupA3WTnsVD6CYWa3Q
|
||||
c1O/1mUgqT6nQ5N9KCPpjZQRT6D6eIMmePtS85z4PPeYMJxPsKRYWPGRxKhCSdZl
|
||||
/0wsC8aRtmwYT729e0ZgTAmUnj+rQp5hboF/ZPFjIoXR9G+0HnoY0a/nqVO4lUON
|
||||
AV25GnMFGVyiHHlbH/0gboywwnzEg8BZbk+Z/61oOzBIW09sfG8fn8bsbkpL+nHf
|
||||
Mi/Vauge6wSfw7I5AfSiwrSDNHmKVsu39koWV6JGxEeFr2MffF+CuaoJCNOr/ZII
|
||||
SYR5ku3Y/lMKyUH1Oas0RWzFrdRcInqYK90A0x083zP4V445MvCwbRPzQAkm9wOP
|
||||
kILLhE5FW+9/O0/9bpx4joJUDLV4d3hFZy7GSHKiZUs1QW6BV75JQKqoi+cVt+/L
|
||||
+o1S8CMNekjqdC2mWRosM3doo51zT/FWNzQA1QcoZP2hORJDfw66y+4wPq6o8y1W
|
||||
jR35ABEBAAGJAjYEGAEIACAWIQQZ3986V5vVCdu1cti+eTAHrSLffgUCXpzGvAIb
|
||||
DAAKCRC+eTAHrSLffgbJD/4qW5YOo/BayBhaUh2L7VP7JNlECb/2xNNOFKI1NjNr
|
||||
nOmgSJLzf74Uhmt5W+iVjmJBHrDceprIPkizmPrn90kIsPIMtHIDNxzUgKZHbnza
|
||||
j1vZyAeC+JV79X1hOVpprj1TJwy65lpxXNyYnGqeIOgyFokn9fOHXv8aMQwpNuUr
|
||||
bdUJ1C75jYrvwy/NR1DczIFFYgsbkDGDtjVBjyMc5JAgvUBz37/iVPJfWP6dKVnf
|
||||
abRnUVzHgvgK7bnab00SA1TiWvjHURGjo+5rnRtv8X/AgStc2Phjq68TMIgMn0F2
|
||||
kjUVvfQotNqzo9madNshvUDmsGtAzKh4e0dS1ear7u3nRp4Z7fqSrTEtXKNbEPwZ
|
||||
wdWrWmmQLacNQBSe/FtcMzGF6xIVr4lnrL0bFjqBdQpdTC7vns3QSKk8/GFiEfpv
|
||||
kzXrDbGV7jX2OWDjNHKcmXX2+E1CsNaJgS7zOgZw5jvbvlTLJUwyYNlM1VLI2OFW
|
||||
Oa86l8pqli+B7rpTbsAE9Ut8qUaWjm87oUNSJbaKgqNnMaE+b/8VJaEeWHgQJwsD
|
||||
bJSJ/O/vzlRtDjOJ1JDlMRLs7TnOFeUh5pgwyaJoidYbJEiGlMGJbI6BjwhDTBFO
|
||||
NLJtd3SsRjc7ICtGdCvej59IvCDTjxtkhx5okF03APi1aXpHQrE18/arFD7BpoGO
|
||||
sw==
|
||||
=gSIv
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
5
debian/watch
vendored
Normal file
5
debian/watch
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
version=4
|
||||
opts="searchmode=plain, \
|
||||
pgpsigurlmangle=s/$/.asc/, \
|
||||
uversionmangle=s/(\d+\.\d+\.\d+).*/$1/" \
|
||||
https://api.github.com/repos/lxqt/@PACKAGE@/releases https:\/\/github.com\/lxqt\/@PACKAGE@\/releases\/download\/@ANY_VERSION@\/@PACKAGE@-@ANY_VERSION@.tar.xz
|
@ -1,142 +0,0 @@
|
||||
/** BASIC */
|
||||
|
||||
body {
|
||||
text-align: justify;
|
||||
font-family: Georgia, "Times New Roman", Times, serif;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
h1, h2, h3 {
|
||||
text-transform: lowercase;
|
||||
color: #000099;
|
||||
}
|
||||
|
||||
ul {
|
||||
margin-left: 0px;
|
||||
padding-left: 1em;
|
||||
list-style-position: inside;
|
||||
}
|
||||
|
||||
a {
|
||||
color: #000099;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
text-decoration: none;
|
||||
color: #990000;
|
||||
}
|
||||
|
||||
/** HEADER */
|
||||
|
||||
#header {
|
||||
width: 1000px;
|
||||
height: 60px;
|
||||
margin: 0px auto;
|
||||
}
|
||||
|
||||
#header #version {
|
||||
/* width: 1000px;
|
||||
height: 60px;
|
||||
margin: 0px auto; */
|
||||
font-weight: bolder;
|
||||
float: left;
|
||||
margin: 0px;
|
||||
padding: 35px 0px 0px 10px;
|
||||
}
|
||||
|
||||
|
||||
#header h1 {
|
||||
float: left;
|
||||
margin: 0px;
|
||||
padding: 20px 0px 0px 0px;
|
||||
}
|
||||
|
||||
#header h2 {
|
||||
float: right;
|
||||
margin: 0px;
|
||||
padding: 27px 0px 0px 0px;
|
||||
}
|
||||
|
||||
|
||||
/** MENU */
|
||||
|
||||
#menu {
|
||||
width: 1000px;
|
||||
height: 1.5em;
|
||||
margin: 0px auto;
|
||||
border: 1px solid #000099;
|
||||
}
|
||||
|
||||
#menu ul {
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
list-style: none;
|
||||
float:right;
|
||||
}
|
||||
|
||||
#menu li {
|
||||
display: inline;
|
||||
}
|
||||
|
||||
#menu a {
|
||||
display: block;
|
||||
float: left;
|
||||
padding: 3px 10px;
|
||||
border-right: 1px solid #000099;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
#menu a:hover {
|
||||
background: #000099;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
/** CONTENT */
|
||||
|
||||
#content {
|
||||
width: 1000px;
|
||||
margin: 0px auto;
|
||||
}
|
||||
|
||||
#content h2 {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
h2 a {
|
||||
font-size: 60%;
|
||||
font-weight: lighter;
|
||||
}
|
||||
|
||||
#left {
|
||||
float: left;
|
||||
width: 780px;
|
||||
}
|
||||
|
||||
#left #center{
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
#right {
|
||||
float: right;
|
||||
width: 200px;
|
||||
}
|
||||
|
||||
#right h2{
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/** FOOTER */
|
||||
|
||||
#footer {
|
||||
clear: both;
|
||||
width: 980px;
|
||||
margin: 0px auto;
|
||||
padding: 5px 10px;
|
||||
border: 1px solid #000099;
|
||||
}
|
||||
|
||||
#footer p {
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
font-size: x-small;
|
||||
}
|
@ -1,444 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<title>ScreenGrab -- Fast creation of screenshots</title>
|
||||
<link href="../default.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<a name='main'></a>
|
||||
<div id="header">
|
||||
<h1>ScreenGrab</h1> <div id="version">version 1.0</div>
|
||||
<!--<h2>By DOOMer</h2>-->
|
||||
</div>
|
||||
<div id="menu">
|
||||
<ul>
|
||||
<li><a href="#main">Description</a></li>
|
||||
<li><a href="#usage">Usage</a></li>
|
||||
<li><a href="#license">License</a></li>
|
||||
<li><a href="#versions">Version history</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="content">
|
||||
<div id="left">
|
||||
<h2>ScreenGrab - fast creation of screenshots</h2>
|
||||
<p>
|
||||
ScreenGrab is a crossplatform application designed to quickly get screenshots.
|
||||
ScreenGrab is based on the Qt Framework, which allows the program to be used in
|
||||
Microsoft Windows and GNU/Linux environments.
|
||||
</p>
|
||||
<p>
|
||||
Main features:
|
||||
</p>
|
||||
<ul>
|
||||
<li>Supports Windows & Linux</li>
|
||||
<li>Get desktop screenshots</li>
|
||||
<li>Get active window screenshots</li>
|
||||
<li>Get screenshots of selected desktop areas</li>
|
||||
<li>Copy screenshots into the clipboard</li>
|
||||
<li>Save your image files in PNG, JPEG or BMP format</li>
|
||||
<li>Ability to view and edit screenshots in an external editor</li>
|
||||
<li>Ability to upload screenshots to MediaCrush and imgur</li>
|
||||
<li>Ability to set delay before getting screenshots
|
||||
(from 1 to 90 seconds)</li>
|
||||
<li>Hide the main window (with recovery) at the time of the screenshot</li>
|
||||
<li>Ability to minimize ScreenGrab to the system tray, and
|
||||
control it via a context menu</li>
|
||||
<li>Getting screenshots using global shortcuts</li>
|
||||
<li>Auto-save screenshot when captured</li>
|
||||
<li>Ability to insert the current date and time in the filename when saving it</li>
|
||||
</ul>
|
||||
|
||||
<a name='usage'></a>
|
||||
|
||||
<h2>Usage <a href='#main'>To start page</a></h2>
|
||||
<p>
|
||||
It is very simple.
|
||||
</p>
|
||||
<p>
|
||||
On the first run ScreenGrab captures the current state of your desktop.
|
||||
The preview screen is displayed in the main window.
|
||||
|
||||
All management of the program can be carried out through the buttons in the main window or in the context menu of ScreenGrab, which can be accessed by a right-mouse-click on the ScreenGrab icon in the notification area of the desktop.
|
||||
</p>
|
||||
<p>
|
||||
Buttons in main window:
|
||||
</p>
|
||||
<ul>
|
||||
<li><b>New Screen</b> [Ctrl+N] -- Take a new screenshot</li>
|
||||
<li><b>Save Screen</b> [Ctrl+S] -- Write a captured screenshot
|
||||
on your hard disk (in PNG or JPEG format).</li>
|
||||
<li><b>Copy Screen</b> [Ctrl+C] -- Copy a screenshot to the clipboard.</li>
|
||||
<!-- <li><b>Upload</b> - upload screenshots on several image hosting services, currently ScreenGrab supports <a href='http://mediacru.sh/' target='_blank'>mediacru.sh</a>, <a href='imgur.com/' target='_blank'>http://imgur.com</a> and <a href='http://imageshack.us/' target='_blank'>imageshack.us</a>, in the future, the list will be expanded.</li> -->
|
||||
<li><b>Edit in ...</b> -- Open and edit screenshots in an image editor.
|
||||
<br />
|
||||
<br />
|
||||
<u>NOTE:</u> In the current version for Microsoft Windows only MS Paint is supported.
|
||||
<br />
|
||||
<br />
|
||||
</li>
|
||||
<li><b>Options</b> [Ctrl+O] -- Show program options window.</li>
|
||||
<li><b>Help</b> [Ctrl+H] -- Access help and information about ScreenGrab, its developer and license.</li>
|
||||
<li><b>Quit</b> [Ctrl+Q] -- Exit ScreenGrab</li>
|
||||
</ul>
|
||||
<p>
|
||||
These buttons can be accessed via right-click on the ScreenGrab icon in the systemtray menu as well.
|
||||
</p>
|
||||
<p>
|
||||
Additional controls, located in main window.
|
||||
</p>
|
||||
<ul>
|
||||
<li><b>Delay</b> -- Delay in seconds before grabbing the screen.</li>
|
||||
<li><b>Type</b> -- Type of grabbing [full screen
|
||||
or active window]. </li>
|
||||
</ul>
|
||||
<p>
|
||||
<b><u>Main settings:</u></b>
|
||||
</p>
|
||||
<ul>
|
||||
<li><b>Default directory</b> -- Default directory to save screenshots</li>
|
||||
<li><b>Default filename</b> -- Default name of the saved file</li>
|
||||
<li><b>Format</b> -- Default saving image format (you can select other formats)</li>
|
||||
<li><b>No window decoration</b> -- Grab a screenshot of the active window without window decorations (only for linux version).</li>
|
||||
</ul>
|
||||
<p>
|
||||
<b><u>Advanced settings:</u></b>
|
||||
</p>
|
||||
<ul>
|
||||
|
||||
<li><b>Insert DateTime in filename</b> -- Insert date and time in the filename to be saved
|
||||
<br />
|
||||
<br />These expressions may be used for the date part of the format string:
|
||||
<br />
|
||||
<table class="generic" align="center" cellpadding="2" cellspacing="1" border="0">
|
||||
<thead><tr valign="top" class="qt-style"><th>Parameter</th><th>Output</th></tr></thead>
|
||||
<tr valign="top" class="odd"><td>d</td><td>Day as number without a leading zero (1 to 31)</td></tr>
|
||||
|
||||
<tr valign="top" class="even"><td>dd</td><td>Day as number with a leading zero (01 to 31)</td></tr>
|
||||
<tr valign="top" class="odd"><td>ddd</td><td>Abbreviated localized day name (e.g. 'Mon' to 'Sun'). </td></tr>
|
||||
<tr valign="top" class="even"><td>dddd</td><td>Long localized day name (e.g. 'Monday' to 'Sunday').</td></tr>
|
||||
<tr valign="top" class="odd"><td>M</td><td>Month as number without a leading zero (1-12)</td></tr>
|
||||
<tr valign="top" class="even"><td>MM</td><td>Month as number with a leading zero (01-12)</td></tr>
|
||||
|
||||
<tr valign="top" class="odd"><td>MMM</td><td>Abbreviated localized month name (e.g. 'Jan' to 'Dec'). </td></tr>
|
||||
<tr valign="top" class="even"><td>MMMM</td><td>Long localized month name (e.g. 'January' to 'December'). </td></tr>
|
||||
<tr valign="top" class="odd"><td>yy</td><td>Year as two digit number (00-99)</td></tr>
|
||||
<tr valign="top" class="even"><td>yyyy</td><td>Year as four digit number</td></tr>
|
||||
</table>
|
||||
<br />
|
||||
<br />These expressions may be used for the time part of the format string:
|
||||
<br />
|
||||
<table class="generic" align="center" cellpadding="2" cellspacing="1" border="0">
|
||||
<thead><tr valign="top" class="qt-style"><th>Parameter</th><th>Output</th></tr></thead>
|
||||
<tr valign="top" class="odd"><td>h</td><td>Hour without a leading zero (0 to 23 or 1 to 12 if AM/PM display)</td></tr>
|
||||
<tr valign="top" class="even"><td>hh</td><td>Hour with a leading zero (00 to 23 or 01 to 12 if AM/PM display)</td></tr>
|
||||
<tr valign="top" class="odd"><td>H</td><td>Hour without a leading zero (0 to 23, even with AM/PM display)</td></tr>
|
||||
|
||||
<tr valign="top" class="even"><td>HH</td><td>Hour with a leading zero (00 to 23, even with AM/PM display)</td></tr>
|
||||
<tr valign="top" class="odd"><td>m</td><td>Minute without a leading zero (0 to 59)</td></tr>
|
||||
<tr valign="top" class="even"><td>mm</td><td>Minute with a leading zero (00 to 59)</td></tr>
|
||||
<tr valign="top" class="odd"><td>s</td><td>Second without a leading zero (0 to 59)</td></tr>
|
||||
<tr valign="top" class="even"><td>ss</td><td>Second with a leading zero (00 to 59)</td></tr>
|
||||
<tr valign="top" class="odd"><td>z</td><td>Milliseconds without leading zeroes (0 to 999)</td></tr>
|
||||
|
||||
<tr valign="top" class="even"><td>zzz</td><td>Milliseconds with leading zeroes (000 to 999)</td></tr>
|
||||
<tr valign="top" class="odd"><td>AP or A</td><td>Interpret as an AM/PM time. <i>AP</i> must be either "AM" or "PM".</td></tr>
|
||||
<tr valign="top" class="even"><td>ap or a</td><td>Interpret as an AM/PM time. <i>ap</i> must be either "am" or "pm".</td></tr>
|
||||
</table>
|
||||
<br />
|
||||
</li>
|
||||
<li><b>Autosave screen</b> -- Automatically save
|
||||
the screenshot in the grab process</li>
|
||||
<li><b>Save first screenshot</b> -- enabled | disabled automatically saves the first screenshot, which is captured on program start</li>
|
||||
<li><b>Filenames to clipboard on saving</b> -- Send the name of the saved file to the clipboard . You can select these parameters:</li>
|
||||
<ul>
|
||||
<li><b>No copy</b> - The name of saved file will not be transferred to the clipboard.</li>
|
||||
<li><b>Only filename</b> - Send only the file name to the clipboard.</li>
|
||||
<li><b>Full path to file</b> - Send the full path to the file to the clipboard.</li>
|
||||
</ul>
|
||||
|
||||
<li><b>Allow multiple copies</b> -- Allow run multiple copies of ScreenGrab.</li>
|
||||
<li><b>Enable external viewer</b> -- Enable or disable the preview of the screenshot in the default image viewer (by double click on screenshot area in the main window).</li>
|
||||
</ul>
|
||||
<p>
|
||||
<b><u>Display settings:</u></b>
|
||||
</p>
|
||||
<ul>
|
||||
<li><b>Save window size on exit</b> -- Save the current size of main window
|
||||
when exiting ScreenGrab (and restore it at next run)</li>
|
||||
<li><b>Zoom area around mouse in selection mode</b> -- Display the magnified area around the mouse pointer when receiving a screenshot of a selected area.</li>
|
||||
</ul>
|
||||
<p>
|
||||
<b><u>System tray settings:</u></b>
|
||||
</p>
|
||||
<ul>
|
||||
<li><b>Use tray</b> -- Use the notification area (system tray) of the operating system (desktop environment) for displaying messages and application management.</li>
|
||||
<li><b>Tray messages</b> -- Mode of displaying tray messages on grab|save events. Can be "none"
|
||||
or "if hidden" or "always"</li>
|
||||
<li><b>Time to display tray messages</b> -- Time within a specific notification is displayed </li>
|
||||
<li><b>Close in tray</b> -- Minimize the main window into the systemtray
|
||||
by click on the close window button.</li>
|
||||
|
||||
</ul>
|
||||
<p>
|
||||
<u><b>Shortcut Settings:</u></b>
|
||||
</p>
|
||||
<p>
|
||||
On the tab "Shortcuts" in the options window you can set the keyboard shortcuts, which allows you to access the application functions easily. There are two kinds of key combinations used in ScreenGrab - local and global.
|
||||
</p>
|
||||
<p>
|
||||
Local duplicate actions performed by pressing the button in the main window. They will only work when the ScreenGrab main window is active.
|
||||
</p>
|
||||
<p>
|
||||
Global shortcuts can be used the get a new screenshot when you have opened other application windows.
|
||||
</p>
|
||||
<p>
|
||||
<u><b>Command line parameters:</u></b>
|
||||
</p>
|
||||
<ul>
|
||||
<li><b>--fullscreen</b> -- Set the fullscreen mode [default].</li>
|
||||
<li><b>--active</b> -- Set the active window mode.</li>
|
||||
<li><b>--region</b> -- Set the screen region select mode.</li>
|
||||
<li><b>--minimized</b> -- Open ScreenGrab minimized in the tray (or taskbar, if tray is disabled).</li>
|
||||
<li><b>--upload</b> -- Automatically upload a screenshot to the selected image hosting service and display the direct link to the image after completion.</li>
|
||||
<li><b>--version</b> -- Display version information [Linux only].</li>
|
||||
<li><b>--help</b> -- Display command line parameters information [Linux only].</li>
|
||||
</ul>
|
||||
|
||||
<a name='license'></a>
|
||||
|
||||
<h2>License <a href='#main'>To start page</a></h2>
|
||||
<p>
|
||||
<strong>Copyright:</strong>
|
||||
</p>
|
||||
<p>
|
||||
Artem 'DOOMer' Galichkin <a href=mailto:doomer3d@gmail.com>doomer3d@gmail.com</a>
|
||||
</p>
|
||||
<p>
|
||||
<strong>License:</strong>
|
||||
</p>
|
||||
<p>
|
||||
ScreenGrab is a freeware licensed by <a href=http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
target=_blank>GNU General Public License version 2</a>
|
||||
</p>
|
||||
<p>
|
||||
<strong>Thanks to:</strong>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Translators:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li><strong>Marcio Moraes</strong> -- Brazilian Portuguese translation</strong> </li>
|
||||
<li><strong>Gennadi Motsyo</strong> -- Ukrainian translation</strong> </li>
|
||||
</ul>
|
||||
<p>
|
||||
<strong>Beta-testers:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li><strong>Alexantia</strong> </li>
|
||||
<li><strong>iNight</strong> </li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
And all those who use ScreenGrab :)
|
||||
</p>
|
||||
<a name='versions'></a>
|
||||
<h2>Version history <a href='#main'>To start page</a></h2>
|
||||
<p>
|
||||
<strong>Version 1.2:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>Added ability for autosaving type of the last created screenshot.</li>
|
||||
<li>Some small fixes.</li>
|
||||
</ul>
|
||||
<p>
|
||||
<strong>Version 1.1.1:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>Fixed wrong 'imgur' uploading result string for bb-code with preview.</li>
|
||||
<li>Fixed segfault when exist configuration file contains "showTrayIcon=false".</li>
|
||||
</ul>
|
||||
<p>
|
||||
<strong>Version 1.1:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>Added ability to upload to MediaCrush (http://mediacru.sh).</li>
|
||||
<li>Option "Always save the window size" replaced by "autosave window size on exit ScreenGrab".</li>
|
||||
<li>Reworked main window UI (the order of the buttons).</li>
|
||||
<li>Reworked the configuration dialog (some UI elements moved between sections, and increment count of the sections).</li>
|
||||
</ul>
|
||||
<p>
|
||||
<strong>Version 1.0:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>Fixed dual monitor support</li>
|
||||
<li>Added XDG_CONFIG_HOME support, by a build option SG_XDG_CONFIG_SUPPORT</li>
|
||||
<li>Added ability to upload to some image hosting services (imgur.com and imgshack.us)</li>
|
||||
<li>Added build option for compiling without the upload feature (SG_EXT_UPLOADS build option)</li>
|
||||
<li>Added "Previous selection" mode</li>
|
||||
<li>Added ability to edit a screenshot in an external editor</li>
|
||||
<li>Added option for preview screenshot in default image viewer by double click on screenshot area</li>
|
||||
<li>Fixed non-minimize main window on "Exit" shortcut, when using "Minimize to tray" option</li>
|
||||
<li>Fixed bug with cutting button text on main window</li>
|
||||
<li>Fixed regression with not capture screenshot when a second instance of ScreenGrab is running</li>
|
||||
<li>Fixed bug with not creating the path to autosave screenshots (when it is typed in manually in configuration dialog)</li>
|
||||
<li>Added build option SG_GLOBALSHORTCUTS for turning on/off build with global shortcuts support</li>
|
||||
<li>Autoincrement filenames when saving screenshots in manual mode (in one running session)</li>
|
||||
<li>Added the ability to customise shortcuts to close the application</li>
|
||||
<li>Added ability to run ScreenGrab minimized to tray (or taskbar, if tray is disabled) with "--minimized" command line option</li>
|
||||
<li>Added ability to automatically upload the screenshot via the command line "--upload" parameter</li>
|
||||
</ul>
|
||||
<p>
|
||||
<strong>Version 0.9.1:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>Fixed non-switching combo-box "Type of Screeen" when grab screenshot from signal by another instance</li>
|
||||
<li>Fixed incorect grab active window screens in GNOME (when disabled "Allow multiple copies" option and run another instance) </li>
|
||||
</ul>
|
||||
<p>
|
||||
<strong>Version 0.9:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>added global shortcuts </li>
|
||||
<li>added option for enable|disable system tray </li>
|
||||
<li>added switch to the already running instance of an application when you start a second instance (non-operating mode to allow multiple instances) </li>
|
||||
<li>added autosave first screenshot which has been taken on application start (enabled | disabled optional) </li>
|
||||
<li>redesign config dialog UI </li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
<p>
|
||||
<strong>Version 0.8.1:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>[Linux] fixed incorrect selection of the default saving format in the KDE 4.4.x save file dialog </li>
|
||||
<li>added de_DE translation</li>
|
||||
</ul>
|
||||
<p>
|
||||
<strong>Version 0.8:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>added command line parameters
|
||||
for grab modes (fullscren, active window, selection area) </li>
|
||||
<li>added BMP support </li>
|
||||
<li>added Brazilian Portuguese translation </li>
|
||||
<li>added automatically hiding main window on grab process </li>
|
||||
<li>[Linux] fixed grab active window screenshot without decorations </li>
|
||||
<li>[Linux] add option "no window decoration" </li>
|
||||
<li>added shortcuts for main window buttons </li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
<strong>Version 0.6.2 [Linux only]:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>fixed non-translated tray menu (closed issue #7) </li>
|
||||
</ul>
|
||||
<p>
|
||||
<strong>Version 0.6.1 [Linux only]:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>fixed incorrect detection of the system language in some Linux distributions </li>
|
||||
</ul>
|
||||
<p>
|
||||
<strong>Version 0.6:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>default value of hiding main window changed to true </li>
|
||||
<li>added input template for inserting date-time into the saved filename </li>
|
||||
<li>added zoom around mouse cursor in area selection mode </li>
|
||||
<li>small modifications of the configuration dialog </li>
|
||||
<li>added html help info (English & Russian) </li>
|
||||
</ul>
|
||||
|
||||
|
||||
<p>
|
||||
<strong>Version 0.5:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>added inserting date|time in saving filename [optional] </li>
|
||||
<li>added auto saving screenshots in grabbing process [option] </li>
|
||||
<li>added option to change the time of displaying tray messages [1 - 10 sec] </li>
|
||||
<li>added help info </li>
|
||||
<li>added tool tips for the UI elements </li>
|
||||
<li>small fixes config file syntax </li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<p>
|
||||
<strong>Version 0.4:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>added grabbing selection screen area </li>
|
||||
<li>added ability to copy image files into the clipboard </li>
|
||||
<li>added saving size of main window on exit [default is turned off] </li>
|
||||
<li>halve the memory size occupied by ScreenGrab at startup </li>
|
||||
<li>[win32] fixed bug with storing the screengrab.ini file </li>
|
||||
<li>change structure of some source code (work with config data) </li>
|
||||
<li>change buttons tab order of main window </li>
|
||||
<li>new application icon </li>
|
||||
<li>some fixes </li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
<strong>Version 0.3.1:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>fixed bug with non-displayed main window icon </li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
<strong>Version 0.3:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>main window is now based on ui-file (remaked UI) </li>
|
||||
<li>added grabbing active window </li>
|
||||
<li>added option to allow running multiple instances of ScreenGrab </li>
|
||||
<li>added option to select between minimizing to tray and closing
|
||||
(by close window button).</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
<strong>Version 0.2:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>added JPEG support</li>
|
||||
<li>added options dialog</li>
|
||||
<li>added option to select a default directory for saving the files </li>
|
||||
<li>added option to select a default filename </li>
|
||||
<li>added option to select a default image format </li>
|
||||
<li>added saving options into INI-file</li>
|
||||
<li>added i18n support and Russian localisation</li>
|
||||
<li>some fixes and changes in code</li>
|
||||
<li>now available as installer (Windows) and deb packages (ubuntu 9.04)</li>
|
||||
</ul>
|
||||
<p>x
|
||||
<strong>Version 0.1:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>first public version</li>
|
||||
<li>added system tray icon and menu</li>
|
||||
<li>added option to hide ScreenGrab in systray </li>
|
||||
<li>added option to block running a second instance of ScreenGrab</li>
|
||||
</ul>
|
||||
<p>
|
||||
<strong>Version 0.0.3:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>first working build with minimal features.</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div id="footer">
|
||||
<p>Copyright © 2009 - 2013, <a href="http://mapper.ru/" class="link1">DOOMer</a></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,435 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<title>ScreenGrab -- programa para captura rápida de imagens</title>
|
||||
<link href="../default.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<a name='main'></a>
|
||||
<div id="header">
|
||||
<h1>ScreenGrab</h1> <div id="version">versão 1.0</div>
|
||||
<!--<h2>By DOOMer</h2>-->
|
||||
</div>
|
||||
<div id="menu">
|
||||
<ul>
|
||||
<li><a href="#main">Descrição</a></li>
|
||||
<li><a href="#usage">Uso</a></li>
|
||||
<li><a href="#license">Licença</a></li>
|
||||
<li><a href="#versions">Histórico das versões</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="content">
|
||||
<div id="left">
|
||||
<h2>ScreenGrab - rápida criação de capturas de telas</h2>
|
||||
<p>
|
||||
Esta é uma aplicação multi-plataforma projetada para obter rapidamente capturas de telas.
|
||||
O ScreenGrab foi criado usando o Framework Qt, graças a qual o programa pode trabalhar no
|
||||
Microsoft Windows e GNU/Linux.
|
||||
</p>
|
||||
<p>
|
||||
Principais características:
|
||||
</p>
|
||||
<ul>
|
||||
<li>Funciona no Windows & Linux</li>
|
||||
<li>Obtém captura de telas do desktop</li>
|
||||
<li>Obtém captura de tela da janela ativa</li>
|
||||
<li>Obtém captura de tela de uma região do desktop</li>
|
||||
<li>Copia a captura de tela para a área de transferência</li>
|
||||
<li>Salva seus arquivos de imagens no formato PNG
|
||||
ou JPEG ou BMP</li>
|
||||
<li>Ability to view and edit screenshots in an external editor</li>
|
||||
<li>Ability to upload screenshots on several image hostings (mediacru.sh, imgur.com)</li>
|
||||
<li>Habilidade em definir atraso ao obter as capturas de telas
|
||||
(de 1 até 90 segundos)</li>
|
||||
<li>Ocultando a janela principal (com recuperação) do
|
||||
ScreenGrab no momento da captura de tela</li>
|
||||
|
||||
<li>Habilidade para minimizar o programa para a área de notificação do sistema, e
|
||||
controlá-lo via menu de contexto</li>
|
||||
<li>Obtém a captura de tela usando atalhos globais</li>
|
||||
<li>Salva automaticamente a captura de tela ao ser recebido</li>
|
||||
<li>Habilidade de inserir data e hora no nome do arquivo e salvar</li>
|
||||
</ul>
|
||||
|
||||
<a name='usage'></a>
|
||||
|
||||
<h2>Uso <a href='#main'>Para o início da página</a></h2>
|
||||
<p>
|
||||
É muito simples.
|
||||
</p>
|
||||
<p>
|
||||
Na primeira execução do programa, obtém-se o estado atual do seu desktop.
|
||||
É mostrada a tela atual na janela principal.
|
||||
|
||||
Todo o gerenciamento do programa pode ser realizado
|
||||
através dos botões ou pelo menu de contexto na área de notificação do desktop.
|
||||
</p>
|
||||
<p>
|
||||
Botões na janela principal:
|
||||
</p>
|
||||
<ul>
|
||||
<li><b>Nova tela</b> [Ctrl+N] -- obtém nova captura de tela.</li>
|
||||
<li><b>Salvar tela</b> [Ctrl+S] -- salva a captura da tela obtida no disco rígido (no formato PNG ou JPEG).</li>
|
||||
<li><b>Copiar tela</b> [Ctrl+C] -- copia tela para a área de transferência.</li>
|
||||
<li><b>Upload</b> - upload screenshots on several image hosting services, currently ScreenGrab supports <a href='http://mediacru.sh/' target='_blank'>mediacru.sh</a>, <a href='http://imgur.com/' target='_blank'>imgur.com</a> and <a href='http://imageshack.us/' target='_blank'>imageshack.us</a>, in the future, the list will be expanded.</li>
|
||||
<li><b>Edit in ...</b> - the ability to open (and edit) screenshots in an image editor.
|
||||
<br />
|
||||
<br />
|
||||
<u>NOTE:</u> In the current version for Microsoft Windows only MS Paint is supported.
|
||||
</li>
|
||||
<li><b>Opções</b> [Ctrl+O] -- mostra a janela de opções do programa.</li>
|
||||
<li><b>Ajuda</b> [Ctrl+H] -- exibe informações de ajuda e exibe informações sobre o ScreenGrab, desenvolvedor e licença.</li>
|
||||
<li><b>Sair</b> [Ctrl+Q] -- sai do programa.</li>
|
||||
</ul>
|
||||
<p>
|
||||
Estes botões também estão disponíveis no menu do programa na área de notficação do sistema.
|
||||
</p>
|
||||
<p>
|
||||
Controles adicionais, localizado na janela principal.
|
||||
</p>
|
||||
<ul>
|
||||
<li><b>Atraso</b> -- atrasa em segundos antes de capturar a tela.</li>
|
||||
<li><b>Tipo</b> -- tipo de obtenção [tela cheia
|
||||
ou janela ativa]. </li>
|
||||
</ul>
|
||||
<p>
|
||||
<b><u>Configurações principais:</u></b>
|
||||
</p>
|
||||
<ul>
|
||||
<li><b>Diretório padrão</b> -- diretório padrão para salvar as capturas de telas.</li>
|
||||
<li><b>Nome do arquivo padrão</b> -- nome do arquivo salvo por padrão.</li>
|
||||
<li><b>Formato</b> -- padrão do formato da imagem salva (você pode selecionar outro formato ao salvar).</li>
|
||||
<li><b>Nenhuma decoração da janela</b> -- captura a janela ativa sem as decoraçãos da janela (only for linux version).</li>
|
||||
</ul>
|
||||
<p>
|
||||
<b><u>Configurações avançadas:</u></b>
|
||||
</p>
|
||||
<ul>
|
||||
<li><b>Inserir Data/Hora no nome do arquivo</b> -- inseri data e hora no nome do arquivo salvo.
|
||||
<br />
|
||||
<br />Estas expressões podem ser utilizadas como parte dos caracteres do formato da data::
|
||||
<br />
|
||||
<table class="generic" align="center" cellpadding="2" cellspacing="1" border="0">
|
||||
<thead><tr valign="top" class="qt-style"><th>Saída das</th><th>expressões</th></tr></thead>
|
||||
<tr valign="top" class="odd"><td>d</td><td>o dia como número sem um zero à esquerda (1 a 31)</td></tr>
|
||||
|
||||
<tr valign="top" class="even"><td>dd</td><td>o dia como número com um zero à esquerda (01 a 31)</td></tr>
|
||||
<tr valign="top" class="odd"><td>ddd</td><td>o nome abreviado do dia localizado. (ex. 'Seg' a 'Dog')</td></tr>
|
||||
<tr valign="top" class="even"><td>dddd</td><td>o nome longo do dia localizado (ex. 'Segunda' a 'Domingo')</td></tr>
|
||||
<tr valign="top" class="odd"><td>M</td><td>o mês como número sem um zero à esquerda (1-12)</td></tr>
|
||||
<tr valign="top" class="even"><td>MM</td><td>o mês como número com um zero à esquerda (01-12)</td></tr>
|
||||
|
||||
<tr valign="top" class="odd"><td>MMM</td><td>o nome abrevido do mês localizado (ex. 'Jan' a 'Dez')</td></tr>
|
||||
<tr valign="top" class="even"><td>MMMM</td><td>o nome longo do mês localizado (ex. 'Janeiro' a 'Dezembro')</td></tr>
|
||||
<tr valign="top" class="odd"><td>yy</td><td>o ano como número de dois dígitos (00-99)</td></tr>
|
||||
<tr valign="top" class="even"><td>yyyy</td><td>o ano como número de quatro dígitos</td></tr>
|
||||
</table>
|
||||
<br />
|
||||
<br />Estas exepressões podem ser utilizadas como parte dos caracteres do formato da hora::
|
||||
<br /><br />
|
||||
<table class="generic" align="center" cellpadding="2" cellspacing="1" border="0">
|
||||
<thead><tr valign="top" class="qt-style"><th>Saída das</th><th>expressões</th></tr></thead>
|
||||
<tr valign="top" class="odd"><td>h</td><td>a hora sem um zero à esquerda (0 a 23 ou 1 a 12 se AM/PM for exibido)</td></tr>
|
||||
<tr valign="top" class="even"><td>hh</td><td>a hora com um zero à esquerda (00 a 23 ou 01 a 12 se AM/PM for exibido)</td></tr>
|
||||
<tr valign="top" class="odd"><td>H</td><td>a hora sem um zero à esquerda (0 a 23, até quando AM/PM for exibido)</td></tr>
|
||||
|
||||
<tr valign="top" class="even"><td>HH</td><td>a hora com um zero à esquerda (00 a 23, até quando AM/PM for exibido)</td></tr>
|
||||
<tr valign="top" class="odd"><td>m</td><td>o minuto sem um zero à esquerda (0 a 59)</td></tr>
|
||||
<tr valign="top" class="even"><td>mm</td><td>o minuto com um zero à esquerda (00 a 59)</td></tr>
|
||||
<tr valign="top" class="odd"><td>s</td><td>o segunddo sem um zero à esquerda (0 a 59)</td></tr>
|
||||
<tr valign="top" class="even"><td>ss</td><td>o segundo com um zero à esquerda (00 a 59)</td></tr>
|
||||
<tr valign="top" class="odd"><td>z</td><td>os milisegundos sem unz zeros à esquerda (0 a 999)</td></tr>
|
||||
|
||||
<tr valign="top" class="even"><td>zzz</td><td>os milisegundos com unz zeros à esquerda (000 a 999)</td></tr>
|
||||
<tr valign="top" class="odd"><td>AP ou A</td><td>interpreta com uma hora AM/PM. <i>AP</i> deve ser um "AM" or "PM"</td></tr>
|
||||
<tr valign="top" class="even"><td>ap ou a</td><td>interpreta com uma hora AM/PM. <i>ap</i> deve ser um "am" ou "pm"</td></tr>
|
||||
</table>
|
||||
<br />
|
||||
</li>
|
||||
<li><b>Auto-salvar tela</b> -- salva automaticamente capturas de telas no processo de captura.</li>
|
||||
<li><b>Salvar a primeira captura de tela</b> -- habilitado | desabilitado automaticamente ao salvar a primeira captura de tela, que se obtém ao executar o programa.</li>
|
||||
<li><b>Filenames to clipboard on saving</b> - send to the clipboard name of the saved file. You can select these params:</li>
|
||||
<ul>
|
||||
<li><b>No copy</b> - the name of saved file will not be transferred to the clipboard.</li>
|
||||
<li><b>Only filename</b> - send to the clipboard only the file name.</li>
|
||||
<li><b>Full path to file</b> - send to the clipboard full path to the file.</li>
|
||||
</ul>
|
||||
<li><b>Permitir múltiplas instâncias</b> -- permite executar múltiplas instâncias do ScreenGrab.</li>
|
||||
<li><b>Enable external viewer</b> -- enable or disable ability for preview screenshot in default image viewer (by double click on screenshot area in main window).</li>
|
||||
</ul>
|
||||
<p>
|
||||
<b><u>Exibir configurações:</u></b>
|
||||
</p>
|
||||
<ul>
|
||||
<li><b>Salvar o tamanho da janela ao sair</b> -- salva o tamanho da janela principal ao sair (e restaura na próxima execução).</li>
|
||||
<li><b>Zoom da área ao redor do mouse no modo de seleção</b> -- a capacidade de exibir a área ampliada em torno do ponteiro do mouse ao receber uma tela de área selecionada.</li>
|
||||
</ul>
|
||||
<p>
|
||||
<b><u>Configurações da área de notificação dos sistema:</u></b>
|
||||
</p>
|
||||
<ul>
|
||||
<li><b>Usar a área de notificação</b> -- usar a área de notificação (system tray) do sistema operacional (ambiente de trabalho) para mostrar as mensagens e gerenciar o programa.
|
||||
<li><b>Mensagens na área de notificação</b> -- modo de exibir as mensagens na área de notificação ao tirar|salvar os eventos. Pode ser "nenhum" ou "ocultar" ou "sempre".</li>
|
||||
<li><b>Tempo de exibição das mensagens na área de notificação</b> -- tempo em que as mensagens são exibidas.</li>
|
||||
<li><b>Fechar para área de notificação</b> -- minimiza a janela principal para a área de notificação ao clicar no botão fechar da janela.</li>
|
||||
</ul>
|
||||
<p>
|
||||
<u><b>configurações dos atalhos:</u></b>
|
||||
</p>
|
||||
<p>
|
||||
Na aba "Atalhos" na janela opções, você pode definir teclas de atalho para o acesso rápido das funções do programa. Existem dois tipos de combinações de teclas usadas no Screengrab - local e global.
|
||||
</p>
|
||||
<p>
|
||||
Local duplica as ações executadas ao pressionar o botão na janela principal. Eles só funcionam quando a janela principal do Screengrab está ativa.
|
||||
</p>
|
||||
<p>
|
||||
Atalhos globais podem ser usados para se obter uma nova captura de tela, ao trabalhar com outra aplicação no seu sistema operacional.
|
||||
</p>
|
||||
<p>
|
||||
<u><b>Parâmetros da linha de comando:</u></b>
|
||||
</p>
|
||||
<ul>
|
||||
<li><b>--fullscreen</b> -- define o modo tela cheia [padrão].</li>
|
||||
<li><b>--active</b> -- define o modo janela ativa.</li>
|
||||
<li><b>--region</b> -- define o modo selecionar área da tela.</li>
|
||||
<li><b>--minimized</b> -- run in minimized to the tray (or taskar, if tray is disabled).</li>
|
||||
<li><b>--upload</b> -- automatically uploading screenshot on selected image hosting. And display after it direct link to image.</li>
|
||||
<li><b>--version</b> -- exibe informações da versão {somente linux].</li>
|
||||
<li><b>--help</b> -- mostra informações dos parâmetros de linha de comando {somente linux].</li>
|
||||
</ul>
|
||||
|
||||
<a name='license'></a>
|
||||
|
||||
<h2>Licença <a href='#main'>Para o início da página</a></h2>
|
||||
<p>
|
||||
<strong>Copyright:</strong>
|
||||
</p>
|
||||
<p>
|
||||
Artem 'DOOMer' Galichkin <a href=mailto:doomer3d@gmail.com>doomer3d@gmail.com</a>
|
||||
</p>
|
||||
<p>
|
||||
<strong>Licença:</strong>
|
||||
</p>
|
||||
<p>
|
||||
ScreenGrab é um freeware licenciado sob os termos da <a href=http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
target=_blank>Licença Pública Geral GNU versão 2</a>
|
||||
</p>
|
||||
<p>
|
||||
<strong>Agradecimentos aos:</strong>:
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Tradutores:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li><strong>Márcio Moraes</strong> -- Tradução para o Português do Brasil</strong> </li>
|
||||
<li><strong>Gennadi Motsyo</strong> -- Tradução para o Ucraniano</strong> </li>
|
||||
</ul>
|
||||
<p>
|
||||
<strong>Beta-testers:</strong>
|
||||
<ul>
|
||||
<li><strong>Alexantia</strong> </li>
|
||||
<li><strong>iNight</strong> </li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
E a todos aqueles que utilizam ScreenGrab :)
|
||||
</p>
|
||||
<a name='versions'></a>
|
||||
<h2>Histórico das versões <a href='#main'>Para o início da página</a></h2>
|
||||
<p>
|
||||
<strong>Versão 1.2:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>Added ability for autosaving type of the last created screenshot.</li>
|
||||
<li>Some small fixes.</li>
|
||||
</ul>
|
||||
<p>
|
||||
<strong>Version 1.1.1:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>Fixed wrong 'imgur' uploading result string for bb-code with preview.</li>
|
||||
<li>Fixed segfault when exist configuration file contains "showTrayIcon=false".</li>
|
||||
</ul>
|
||||
<p>
|
||||
<strong>Version 1.1:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>Added ability to upload to MediaCrush (http://mediacru.sh).</li>
|
||||
<li>Option "Always save the window size" replaced by "autosave window size on exit ScreenGrab".</li>
|
||||
<li>Reworked main window UI (the order of the buttons).</li>
|
||||
<li>Reworked the configuration dialog (some UI elements moved between sections, and increment count of the sections).</li>
|
||||
</ul>
|
||||
<p>
|
||||
<strong>Versão 1.0:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>Fixed dual monitor support</li>
|
||||
<li>Added XDG_CONFIG_HOME support, by a build option SG_XDG_CONFIG_SUPPORT</li>
|
||||
<li>Added ability to upload to some image hosts (imgur.com and imgshack.us)</li>
|
||||
<li>Added build option for compile without upload feature (SG_EXT_UPLOADS bulld option)</li>
|
||||
<li>Added "Previous selection" mode</li>
|
||||
<li>Added ability to edit screenshot in external editor</li>
|
||||
<li>Added option for preview screenshot in default image viewer by double click on screenshot area</li>
|
||||
<li>Fixed non-minimize main window on "Exit" shortcut, when use "Minimize to tray" option</li>
|
||||
<li>Fixed bug with cut button text on mainwindow</li>
|
||||
<li>Fixed regression with not capture screenshot when second instance running</li>
|
||||
<li>Fixed bug with not create path to autosave screenshots (when it is typed manually in configuration dialog)</li>
|
||||
<li>Added build option SG_GLOBALSHORTCUTS for turn on/off build with global shortcuts support</li>
|
||||
<li>Autoincrement filenames when saving screenshots in manual mode (in one running session)</li>
|
||||
<li>Added the ability to customize shortcut to close the application</li>
|
||||
<li>Added ability to run in minimized to tray (or taskar, if tray is disabled) with "--minimized" comand line option</li>
|
||||
<li>Added ability to automatically upload the screenshot via the command line "--upload" param</li>
|
||||
</ul>
|
||||
<p>
|
||||
<strong>Versão 0.9.1:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>Corrigido a não-mudança da caixa de combinação "Tipo de Screeen" quando obtido a captura de tela a partir de um sinal por outra instância do programa.</li>
|
||||
<li>Corrigida a incorreta captura de tela da janela ativa no GNOME (quando desativada a opção "Permitir múltiplas cópias" e executar outra instância do programa).</li>
|
||||
</ul>
|
||||
<p>
|
||||
<strong>Versão 0.9:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>adicionados atalhos globais. </li>
|
||||
<li>adicionado a opção habilitar|desabilitar na área de notificação do sistema. </li>
|
||||
<li>adicionado alternar para a instância já em execução do programa quando você iniciar uma segunda instância (modo de operação não permitir múltiplas instâncias). </li>
|
||||
<li>adicionado salvar automaticmente a primeira captura de tela que foi obtida no início do programa (ocional habilitar | desabilitar). </li>
|
||||
<li>redesenhada a interface do diálogo de configuração. </li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
<p>
|
||||
<strong>Versão 0.8.1:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>[Linux] corrigido a incorreta seleção padrão ao salvar o formato no KDE 4.4.x no diálogo salvar arquivo. </li>
|
||||
<li>adicionada a tradução de_DE. </li>
|
||||
</ul>
|
||||
<p>
|
||||
<p>
|
||||
<strong>Versão 0.8:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>adicionado parâmetros de linha de comando
|
||||
para obtenção dos modos (tela cheia, janela ativa, área da seleção). </li>
|
||||
<li>adicionado o suporte a BMP. </li>
|
||||
<li>adicionado a tradução para o Português do Brasil. </li>
|
||||
<li>adicionado ocultando automaticamente janela principal no processo de captura. </li>
|
||||
<li>{linux] corrigido obtenção da captura da janela sem decorações. </li>
|
||||
<li>[linux] adicionado opção "sem decoração da janela". </li>
|
||||
<li>adicionado atalhos para os botões da janela principal. </li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
<strong>Versão 0.6.2 [Somente Linux]:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>corrigido o não traduzido menu da área de notificação (publicação fechada #7). </li>
|
||||
</ul>
|
||||
<p>
|
||||
<strong>Versão 0.6.1 [Somente Linux]:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>corrido a incorreta detecção do idioma do sistema em algumas distribuições Linux. </li>
|
||||
</ul>
|
||||
<p>
|
||||
<strong>Versão 0.6:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>o valor padrão de "ocultar janela principal" foi alterado para true (ativado).</li>
|
||||
<li>adicionado entrada modelo para inserir data-hora no nome do arquivo salvo.</li>
|
||||
<li>adicionado zoom ao redor do cursor do mouse no modo de seleção de área.</li>
|
||||
<li>pequena moficaição no diálogo de configuração.</li>
|
||||
<li>adicionado ajuda html em (inglês & russo).</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<p>
|
||||
<strong>Versão 0.5:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>adicionado inserir data|hora ao salvar nome do arquivo [opcional].</li>
|
||||
<li>adicionado auto salvar telas no processo de obtenção [opção].</li>
|
||||
<li>adicionado alterar tempo de exibição das mensagenas na área de notificação [1 - 10 src].</li>
|
||||
<li>adicionado informações de ajuda.</li>
|
||||
<li>adicionado dicas de ferramentas para os elementos UI.</li>
|
||||
<li>pequenas correções na sintaxe do arquivo de configuração.</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<p>
|
||||
<strong>Versão 0.4:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>adicionado obter região de uma área selecionada.</li>
|
||||
<li>adicionado copiar para a área de transferência.</li>
|
||||
<li>adicionado salvar tamanho da janela principal ao sair [padrão está desabilitado].</li>
|
||||
<li>decrementado em 2 tempos os volumes ocupados pela memória ao iniciar.</li>
|
||||
<li>[win32] falha corrigida com a localização de screengrab.ini.</li>
|
||||
<li>alterada estrutura de algumas linhas do código fonte (para trabalhar com configuração de data).</li>
|
||||
<li>alterada a ordem da aba dos botões da janela principal.</li>
|
||||
<li>novo ícone do programa.</li>
|
||||
<li>algumas correções.</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
<strong>Versão 0.3.1:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>corrigida falha com a não exibição do ícone da janela principal.</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
<strong>Versão 0.3:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>janela principal agora baseada no arquivo UI (recriado UI).</li>
|
||||
<li>adicionado captura da janela ativa.</li>
|
||||
<li>adicionado opção para permitir múltiplas instâncias do ScreenGrab.</li>
|
||||
<li>adicionado opção para selecionar entre minimiizar no área de notificação e fechar (botão fechar da janela).</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
<strong>Versão 0.2:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>adicionado suporte a JPEG.</li>
|
||||
<li>adicionado diálogo de opções.</li>
|
||||
<li>adicionado configurações ao salvar diretório, nome do arquivo e formato da imagem por padrão.</li>
|
||||
<li>adicionado opções de salvar no arquivo INI.</li>
|
||||
<li>adicionado suporte a i18n e localização Russa.</li>
|
||||
<li>algumas correções e alterações no código.</li>
|
||||
<li>disponível agora com um instalador (Windows) e pacotes deb (ubuntu 9.04).</li>
|
||||
</ul>
|
||||
<p>
|
||||
<strong>Versão 0.1:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>primeira versão pública.</li>
|
||||
<li>adicionado ícone e menu na área de notificação do sistema.</li>
|
||||
<li>adicionado ocultar na área de notificação do sistema.</li>
|
||||
<li>adicionado o bloqueio de uma segunda instância do programa.</li>
|
||||
</ul>
|
||||
<p>
|
||||
<strong>Versão 0.0.3:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>primeira construção trabalhada com recursos mínimos.</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div id="footer">
|
||||
<p>Copyright © 2009 - 2013, <a href="http://mapper.ru/" class="link1">DOOMer</a></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,487 +0,0 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
|
||||
<title>ScreenGrab -- программа для быстрого создания скриншотов</title>
|
||||
<link href="../default.css" rel="stylesheet" type="text/css" />
|
||||
</head>
|
||||
<body>
|
||||
<a name='main'></a>
|
||||
<div id="header">
|
||||
<h1>ScreenGrab</h1> <div id="version">версия 1.0</div>
|
||||
<!--<h2>By DOOMer</h2>-->
|
||||
</div>
|
||||
<div id="menu">
|
||||
<ul>
|
||||
<li><a href="#main">Описание</a></li>
|
||||
<li><a href="#usage">Использование</a></li>
|
||||
<li><a href="#license">Лицензия</a></li>
|
||||
<li><a href="#versions">История версий</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="content">
|
||||
<div id="left">
|
||||
<h2>ScreenGrab - быстрое создание скриншотов</h2>
|
||||
<p>
|
||||
Данная программа является кроссплатформенным приложением,
|
||||
предназначенным для быстрого получения снимков экрана
|
||||
(скриншотов) .
|
||||
ScreenGrab создана с использованием фреймворка Qt, за счёт
|
||||
которого
|
||||
достигается работоспособность приложения в операционных
|
||||
системах Microsoft Windows и GNU/Linux.
|
||||
</p>
|
||||
<p>
|
||||
Основные возможности программы:
|
||||
</p>
|
||||
<ul>
|
||||
<li>Работа в операционных систмах Windows и Linux</li>
|
||||
<li>Получение снимков рабочего стола</li>
|
||||
<li>Получение снимков отдельного активного окна</li>
|
||||
<li>Получение снимков выделенной области экрана</li>
|
||||
<li>Копирование скриншотов в буфер обмена</li>
|
||||
<li>Сохранение полученных изображений в файлы форматов PNG, PEG или BMP</li>
|
||||
<li>Возможность просмотра и редактирования скриншота во внешнем редакторе</li>
|
||||
<li>Ввозможность загрузки скриншотов на несколько хостингов изображений (на данный момент mediacru.sh и imgur.com)</li>
|
||||
<li>Возможность установки задержки при получении скриншотов
|
||||
(от 1 до 90 секнд)</li>
|
||||
<li>Скрытие главного окна (с последующим восстановлением)
|
||||
ScreenGrab в момент
|
||||
получения скриншота</li>
|
||||
<li>Возможность сворачивания приложения в системный трей, и
|
||||
управление через контекстное меню</li>
|
||||
<li>Получение скриншотов при помощи глобальных клавиш быстрого доступа</li>
|
||||
<li>Автоматическое сохранение скриншотов при их получении</li>
|
||||
<li>Возможность вставки текущей даты и времени в имя сохраняемого файла</li>
|
||||
</ul>
|
||||
|
||||
<a name='usage'></a>
|
||||
|
||||
<h2>Использование <a href='#main'>В начало</a></h2>
|
||||
<p>
|
||||
Все очень просто.
|
||||
</p>
|
||||
<p>
|
||||
При первом запуске программы, вы получаете снимок
|
||||
текущего состояния вшего рабочего стола. Вы можете увидеть это в
|
||||
окне программы.
|
||||
Все дальнейшее управление программой может быть осуществлено
|
||||
через кнопки
|
||||
или контекстное меню в области уведомлений рабочего стола.
|
||||
</p>
|
||||
<p>
|
||||
Назначение кнопок окна программы.
|
||||
</p>
|
||||
<ul>
|
||||
<li><b>Новый снимок</b> [Ctrl+N] -- получение нового скриншота</li>
|
||||
<li><b>Сохранить</b> [Ctrl+S] -- запись полученного снимка на жесткий
|
||||
диск,
|
||||
в виде графического файла.</li>
|
||||
<li><b>Копировать</b> [Ctrl+C] -- Копирование скриншота в буфер обмена.</li>
|
||||
<li><b>Опубликовать</b> - загрузить полученный скриншот на один из поддерживаемых хостингов изображений. На данный момент поддерживаются <a href='http://mediacru.sh/' target='_blank'>mediacru.sh</a>, <a href='http://imgur.com/' target='_blank'>imgur.com</a> и <a href='http://imageshack.us/' target='_blank'>imageshack.us</a>, в дальнейшем список будет расширен</li>
|
||||
<li><b>Открыть в ...</b> - возможность открытия (и редактирования) полученного скриншота в одном из установленных в системе приложений для работы с изображениями.
|
||||
<br />
|
||||
<u>Заимечание:</u> В версии для Microsoft Windows поддерживается только Microsoft Paint.
|
||||
</li>
|
||||
<li><b>Настройки</b> [Ctrl+O] -- настрйоки программы </li>
|
||||
<li><b>Справка</b> [Ctrl+H] -- отображение справочной информации и вывод окна с информацией о
|
||||
разработчике и лицензии</li>
|
||||
<li><b>Выход</b> [Ctrl+Q] -- выход из программы (при закрытии через
|
||||
"крестик" в верхнем правом углу,
|
||||
программа всего лишь свернётся в убласть
|
||||
уведомлений)</li>
|
||||
</ul>
|
||||
<p>
|
||||
Все это также продублировано в контекстном меню приложения.
|
||||
</p>
|
||||
<p>
|
||||
Дополнительные элементы управления приложением, расположенный в
|
||||
главном окне.
|
||||
</p>
|
||||
<ul>
|
||||
<li><b>Задержка</b> -- величина задержки (в секундах)
|
||||
перед получением нового снимка экрана.</li>
|
||||
<li><b>Тип</b> -- выбор типа скриншота (полный экран,
|
||||
снимок отдельного активного окна или выделенная область экрана). </li>
|
||||
</ul>
|
||||
<p>
|
||||
<b><u>Основные параметры:</u></b>
|
||||
</p>
|
||||
<p>
|
||||
Основные параметры разделены на две вкладки:
|
||||
</p>
|
||||
<ul>
|
||||
<li><b>Каталог по умолчанию</b> -- директория для сохранения
|
||||
файлов,
|
||||
открываемая в окне сохранения файлов.</li>
|
||||
<li><b>Имя файла по умолчанию</b> -- исходное имя файла при
|
||||
сохранении..</li>
|
||||
<li><b>Формат</b> -- формат изображения,
|
||||
который будет автоматически выбираться при сохранении.
|
||||
Возможность выбра другого формата при сохранении </li>
|
||||
<li><b>Без декораций окна</b> -- получение скриншота активного окна без рамки и строки заголовка (только для Linux-версии).</li>
|
||||
<li><b>Копировать имя сохранённого файла в буфер обмена</b> - передача в буфер обмена имени сохраняемого файла. Можно выбрать следующие варианты:</li>
|
||||
<ul>
|
||||
<li><b>Не копировать</b> - имя сохранённого файла не будет передано в буфер обмена.</li>
|
||||
<li><b>Только имя файла</b> - передать в буфер обмена только имя файла.</li>
|
||||
<li><b>Весь путь к файлу</b> - передать в буфер обмена полный путь к файлу.</li>
|
||||
</ul>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
<b><u>Основные параметры:</u></b>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<u><b>Расширенные параметры:</u></b>
|
||||
</p>
|
||||
<ul>
|
||||
<li><b>Дата и время в имени файла</b> -- возможность автоматическойй
|
||||
вставки текущей даты и времени в имя сохраняемого файла
|
||||
<br />
|
||||
<br />Эти выражения могут быть использованы для форматирования вывода даты:
|
||||
<br />
|
||||
<table class="generic" align="center" cellpadding="2" cellspacing="1" border="0">
|
||||
<thead><tr valign="top" class="qt-style"><th>Выражение</th><th>Вывод</th></tr></thead>
|
||||
<tr valign="top" class="odd"><td>d</td><td>the day as number without a leading zero (1 to 31)</td></tr>
|
||||
|
||||
<tr valign="top" class="even"><td>dd</td><td>день в виде цифр, с нулем в начале, если требуется (01-31)</td></tr>
|
||||
<tr valign="top" class="odd"><td>ddd</td><td>название для в сокращенном виде (напр. 'Пн' или 'Вс'). </td></tr>
|
||||
<tr valign="top" class="even"><td>dddd</td><td>полное название дня (напр. 'Понедельник').</td></tr>
|
||||
<tr valign="top" class="odd"><td>M</td><td>месяц в виде цифр, без нуля в начале (1-12)</td></tr>
|
||||
<tr valign="top" class="even"><td>MM</td><td>месяц в виде цифр, с нулем в начале, если требуется (01-12)</td></tr>
|
||||
|
||||
<tr valign="top" class="odd"><td>MMM</td><td>название месяца в сокращенном виде (напр. 'Янв'). </td></tr>
|
||||
<tr valign="top" class="even"><td>MMMM</td><td>полное название месяца (e.g. 'Январь'). </td></tr>
|
||||
<tr valign="top" class="odd"><td>yy</td><td>год в виде двух цифр (00-99)</td></tr>
|
||||
<tr valign="top" class="even"><td>yyyy</td><td>год в виде четырех цифр (0000-9999)</td></tr>
|
||||
</table>
|
||||
|
||||
<br />Эти выражения могут быть использованы для форматирования вывода времени:
|
||||
<br /><br />
|
||||
<table class="generic" align="center" cellpadding="2" cellspacing="1" border="0">
|
||||
<thead><tr valign="top" class="qt-style"><th>Выражение</th><th>Вывод</th></tr></thead>
|
||||
<tr valign="top" class="odd"><td>h</td><td>the hour without a leading zero (0 to 23 or 1 to 12 if AM/PM display)</td></tr>
|
||||
<tr valign="top" class="even"><td>hh</td><td>the hour with a leading zero (00 to 23 or 01 to 12 if AM/PM display)</td></tr>
|
||||
<tr valign="top" class="odd"><td>H</td><td>the hour without a leading zero (0 to 23, even with AM/PM display)</td></tr>
|
||||
|
||||
<tr valign="top" class="even"><td>HH</td><td>the hour with a leading zero (00 to 23, even with AM/PM display)</td></tr>
|
||||
<tr valign="top" class="odd"><td>m</td><td>the minute without a leading zero (0 to 59)</td></tr>
|
||||
<tr valign="top" class="even"><td>mm</td><td>the minute with a leading zero (00 to 59)</td></tr>
|
||||
<tr valign="top" class="odd"><td>s</td><td>the second without a leading zero (0 to 59)</td></tr>
|
||||
<tr valign="top" class="even"><td>ss</td><td>the second with a leading zero (00 to 59)</td></tr>
|
||||
<tr valign="top" class="odd"><td>z</td><td>the milliseconds without leading zeroes (0 to 999)</td></tr>
|
||||
|
||||
<tr valign="top" class="even"><td>zzz</td><td>the milliseconds with leading zeroes (000 to 999)</td></tr>
|
||||
<tr valign="top" class="odd"><td>AP or A</td><td>interpret as an AM/PM time. <i>AP</i> must be either "AM" or "PM".</td></tr>
|
||||
<tr valign="top" class="even"><td>ap or a</td><td>Interpret as an AM/PM time. <i>ap</i> must be either "am" or "pm".</td></tr>
|
||||
</table>
|
||||
<br />
|
||||
</li>
|
||||
<li><b>Автосохранение скриншотов</b> -- автоматическое сохранение
|
||||
скриншотов при их получении (можно совмещать с предыдущей настройкой) </li>
|
||||
<li><b>Сохранять первый скриншот</b> -- возможность автоматического сохранения скриншота, получаемого при запуске приложения </li>
|
||||
|
||||
|
||||
<li><b>Несколько копий программы</b> -- возможность
|
||||
запуска нескольких экземпляров ScreenGrab одновременно.</li>
|
||||
<li><b>Enable external viewer</b> -- включить или выключить просмотр скриншота во внешней программе просмотра графических файлов (двойным кликом по скриншоту в клавном окне).</li>
|
||||
</ul>
|
||||
<p>
|
||||
<u><b>Параметры отображения приложения:</u></b>
|
||||
</p>
|
||||
<ul>
|
||||
<li><b>Сохранять размеры окна при выходе</b> -- сохранение размеров основного окна при выходе, с восстановлением при последующем запуске.</li>
|
||||
<li><b>Масштабирование области курсора в режиме выбора</b> -- возможность отображения увеличенной области вокруг курсора мыши при получении скриншота выбранной области экрана.</li>
|
||||
</ul>
|
||||
<p>
|
||||
<u><b>Параметры использования области уведомлений (трей):</u></b>
|
||||
</p>
|
||||
<ul>
|
||||
<li><b>Использовать трей</b> -- возможность использования области уведомлений операционной системы (десктопного окружения) для отображения сообщений и управления приложением.</li>
|
||||
<li><b>Всплывающие уведомления</b> -- режим отображения
|
||||
всплывющих уведомлений. Имеет три вида - отображать всегда, отображать
|
||||
только при свёрнутом главном окне и не отображаить никогда.</li>
|
||||
<li><b>Время отображения уведомлений</b> -- время (в секундах), в
|
||||
течении которого будут отображяться всплывающие уведомления </li>
|
||||
<li><b>Сворачивать в область уедомлений</b> -- сворачивание
|
||||
прпограммы в область уведомлений (трей) при назатии на кнопку закрытия (ту
|
||||
что в правом верхнем углу окна).</li>
|
||||
|
||||
</ul>
|
||||
<p>
|
||||
<u><b>Комбинации клавиш:</u></b>
|
||||
</p>
|
||||
<p>
|
||||
На вкладке "Комбинации клавиш" в окне настроек вы можете установить сочетания клавиш для быстрого доступа к основным функциям приложения. Существует два вида комбинаций клавиш, используемых в screenGrab -- локальные и глобальные.
|
||||
</p>
|
||||
<p>
|
||||
Локальные дублируют действия выполняемые при нажатии на кнопки в главном окне приложения. Они работают только когда окно ScreenGrab является активным.
|
||||
</p>
|
||||
<p>
|
||||
Глобальные комбинации клавиш позволяют воспользоваться функцией получения нового скриншота при работе с другим приложением в вашей операционной системе.
|
||||
</p>
|
||||
<p>
|
||||
<u><b>Параметры командной строки:</u></b>
|
||||
</p>
|
||||
<ul>
|
||||
<li><b>--fullscreen</b> -- скриншот всего экрана [по умолчанию].</li>
|
||||
<li><b>--active</b> -- скриншот активного окна.</li>
|
||||
<li><b>--region</b> -- скриншот выделенной области экрана.</li>
|
||||
<li><b>--minimized</b> -- запуск с автоматическим сворачиванием в трей (или на панель задач, если тподдержка трея выключена).</li>
|
||||
<li><b>--upload</b> -- автоматическая загрузка скриншота на выбраный в настрйоках хостинг изображений. И отображение прямой ссылки на изображение после завершения загрузки.</li>
|
||||
<li><b>--version</b> -- вывод информации о версии ScreenGrab {только linux].</li>
|
||||
<li><b>--help</b> -- вывод информации о параметрах командной строки {только linux].</li>
|
||||
</ul>
|
||||
<a name='license'></a>
|
||||
|
||||
<h2>Лицензия <a href='#main'>В начало</a></h2>
|
||||
<p>
|
||||
<strong>Авторские права:</strong>
|
||||
</p>
|
||||
<p>
|
||||
Артём 'DOOMer' Галичкин <a href=mailto:doomer3d@gmail.com>doomer3d@gmail.com</a>
|
||||
</p>
|
||||
<p>
|
||||
<strong>Лицензия:</strong>
|
||||
</p>
|
||||
<p>
|
||||
Программа ScreenGrab распространяется бесплатно по условиям <a href=http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
target=_blank>GNU General Public License version 2</a>
|
||||
</p>
|
||||
<p>
|
||||
<strong>Благодарности</strong>:
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<strong>Локализации:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li><strong>Márcio Moraes</strong> -- Бразильская Португальская локализация </li>
|
||||
<li><strong>Геннадий Моцьо</strong> -- Украинская локализация </li>
|
||||
</ul>
|
||||
<p>
|
||||
<strong>Бета-тестеры</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li><strong>Alexantia</strong> </li>
|
||||
<li><strong>iNight</strong> </li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
А также всем тем, кто использует ScreenGrab :)
|
||||
</p>
|
||||
<a name='versions'></a>
|
||||
<h2>История версий <a href='#main'>В начало</a></h2>
|
||||
<p>
|
||||
<strong>версия 1.2:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>Добавлена возможность запоминания типа последнего сделанного скриншота.</li>
|
||||
<li>Несколько небольших исправлений.</li>
|
||||
</ul>
|
||||
<p>
|
||||
<strong>Версия 1.1.1:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>Исправлена неправильная строка bb-ода с превью скриншота, загружаемого на 'imgur'.</li>
|
||||
<li>справлено аварийное завершение приложения при наличии в конфигурационном файле параметра "showTrayIcon=false".</li>
|
||||
</ul>
|
||||
<p>
|
||||
<strong>Версия 1.1:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>Добавлена возможность автоматической загрузки скриншота на MediaCreush (http://mediacru.sh).</li>
|
||||
<li>Опция "Всегда сохранять размер окна" заменена на "Автодобавление размера окна при выходе из ScreenGrab".</li>
|
||||
<li>Перервботан интерфейс главного окна (изменен некоторые кнопки).</li>
|
||||
<li>Переработан диалог настроек (уменьшено число секций и некоторые настройки были перемещены между секциями).</li>
|
||||
</ul>
|
||||
<p>
|
||||
<strong>Версия 1.0:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>Исправлены баги с поддержкой двух мониторов в Linux.</li>
|
||||
<li>Добавлена поддержка XDG_CONFIG_HOME (конфигурационные файлы теперь хранятся в ~/.config/screengrab/), отключается опцией сборки SG_XDG_CONFIG_SUPPORT</li>
|
||||
<li>Добавлена возможность загрузки скриншотов на несколько хостингов (на данный момент imgur.com and imgshack.us, в дальнейшем список будет расширен)</li>
|
||||
<li>Добавлена возможность сборки без модуля загрузки скриншотов в интернет (опция сборки SG_EXT_UPLOADS)</li>
|
||||
<li>Добавлен режим "Ранее выбранная область"</li>
|
||||
<li>Добавлена возможность редактирования скриншота во внешнем редакторе</li>
|
||||
<li>Добавлена опция просмотра скриншота во внешней программе просмотра графических файлов (двойным кликом по скриншоту)</li>
|
||||
<li>Исправлена ошибка сворачивания главного окна при использовани шортката "Exit", если включена опция "Сворачивать в область уведомлений"</li>
|
||||
<li>Исправлен баг с невлезанием некоторых локализаованных надписей на кнопки в главном окне.</li>
|
||||
<li>Исправлена регрессия с неполучениемм скриншота при запуске второго экземпляра приложения.</li>
|
||||
<li>Исправлена ошибка несоздавания несуществоввашего ранее каталога для автосохранения скриншотов (при ручном вводе имени каталога в диалоге натроек)</li>
|
||||
<li>Добавлена опция сборки SG_GLOBALSHORTCUTS для возможности сборки без поддержки глобальных горячих клавиш</li>
|
||||
<li>Автодобавление номеров скриншотов при сохранении, если файл с выбранным именем уже существет в данном каталоге.</li>
|
||||
<li>Возможность изменить комбинацию клавиш для действия "выход"</li>
|
||||
<li>Возможность запуска с автоматическим сворачиванием в трей (или на панель задач, если тподдержка трея выключена) при помощи параметра командной строки "--minimized"</li>
|
||||
<li>Добавлена возможность автоматической загрузки скриншота на выбранный в настройках хотсинг изображений (парметр командной строки "--upload")</li>
|
||||
</ul>
|
||||
<p>
|
||||
<strong>Версия 0.9.1:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>Исправлено не-переключение типа скриншота (в GUI) при снятии скриншота по сигналу от другого экземпляра приложения (запущенного при выключенной опции "Несколько копий приложения").</li>
|
||||
<li>Исправлено некорректное получение скриншота активного окна в среде GNOME (при выключенной опции "Несколько копий приложения" и запуске второго экземпляра ScreenGrab)..</li>
|
||||
</ul>
|
||||
<p>
|
||||
<strong>Версия 0.9:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>Добавлены глобальные клавиши быстрого доступа. </li>
|
||||
<li>Добавлена возможность отключения трея. </li>
|
||||
<li>Дабвлено активирование узе запущенной копии ScreenGrab при попытке запуска второго экземаляра приложения (при отключенной опции "Несколько копий программы"). </li>
|
||||
<li>Добавлено автосохранение первого скриншота, получаемого при старте приложения (в виде опции)). </li>
|
||||
<li>Изменен дизайн диалога настроек. </li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
<p>
|
||||
<strong>Версия 0.8.1:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>[Linux] Исправлен некорректный выболр формата сохраняемого файла в KDE 4.4. и выше </li>
|
||||
<li>Добавлена немецкая локализация</li>
|
||||
</ul>
|
||||
<p>
|
||||
<strong>Версия 0.8:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>Добавлены параметры командной строки для установки режима получения скриншотов
|
||||
(весь экран, активное окно, область экрана). </li>
|
||||
<li>Добавлена поддержка формата BMP. </li>
|
||||
<li>Добавлена Бразильская Португальская локализация. </li>
|
||||
<li>Окно программы теперь автоматически скрывается в процессе получения скриншота. </li>
|
||||
<li>{linux] Исправлено не совсем корректно получение скриншотов активного окна. </li>
|
||||
<li>[linux] Добавлен параметр "без декораций окна". </li>
|
||||
<li>Добавлены "горячие клавиши" для кнопок главного окна. </li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
<strong>Версия 0.6.2 [Linux only]:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>Исправлена некорректная загрузка локализации для меню области уведомлений. </li>
|
||||
</ul>
|
||||
<p>
|
||||
<strong>Version 0.6.1 [Linux only]:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>Исправлено некорректное определение системной локали в некоторых Linux-дистрибутивах.. </li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
<strong>Версия 0.6:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>Параметр "скрывать главное окно" по умолчанию теперь включен. </li>
|
||||
<li>Добавлена возможность редактировать шаблон даты И времени,
|
||||
вставляемых в имя сохраняемого файла.</li>
|
||||
<li>Добавлено мастабирование экранной области вокруг курсора
|
||||
в режиме "область экрана".</li>
|
||||
<li>Немного улучшен внешний вид диалога настроек..</li>
|
||||
<li>Добавлена справочная информация в html-формате (на английском и русском языках).</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
<strong>Версия 0.5:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>Добавлена возможность автосохранения скриншотов. </li>
|
||||
<li> Добавлена возможность вставки текущей даты и времени в имя сохраняемог файла.</li>
|
||||
<li>Добавлена возможность изменения времени отображения всплывающих уведомлений (1 - 10 секунд).</li>
|
||||
<li>Добавлена возможность просмотра справочной информации по использованию программы.</li>
|
||||
<li>Добавлены всплывающие подсказки (tool tips) ко всем элементам пользовательского интерфейса .</li>
|
||||
<li>Несколько мелких исправлений в коде и конфигурационном файле.</li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<p>
|
||||
<strong>Версия 0.4:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>Добавлена вохзможность захвата выделенной области экрана. </li>
|
||||
<li> Добавлена возможность копирования скриншотов в буфер обмена.</li>
|
||||
<li>Возможность сохранения текущих размеров окна приложения
|
||||
при выходе (по умолчанию выключено).</li>
|
||||
<li>Уменьшен объём оперативной памяти, занимаемой при запуске.</li>
|
||||
<li>[Win32] Исправлен баг с размещением конфигурационного файла.</li>
|
||||
<li>Немного оптимизирован код работы с конфигурационными параметрами.</li>
|
||||
<li>Оптимизирован процесс работы с главным окном при помощи клавиатуры.</li>
|
||||
<li>Новая иконка приложения.</li>
|
||||
<li>Несколько мелких исправлений.</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
<strong>Версия 0.3.1:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>Устранён баг с неотображением иконки приложения в
|
||||
заголовке главного окна </li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
<strong>Версия 0.3:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>Полностью переработан интерфейс главного кона,
|
||||
программмный код которого отделен от основного класса приложения. </li>
|
||||
<li> Несколько других изменений в интерфейсе
|
||||
пользователя.</li>
|
||||
<li>Добавлена возможность получения скриншота
|
||||
отдельного активного окна.</li>
|
||||
<li>Добавлена опция включения возможность запуска
|
||||
нескольких копий ScreenGrab.</li>
|
||||
<li>Добавлена возможность выбора между сворачиванием в
|
||||
область уведомлений и закрытие программы (при нажатии кнопки закрытия
|
||||
окна).</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
<strong>Версия 0.2:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>Сохранение в формат JPEG.</li>
|
||||
<li>Добавлен диалог настроек.</li>
|
||||
<li>Добавлены параметры для каталога сохраняемых файлов,
|
||||
дефолтного
|
||||
имени файла и предпочитаемого формата. </li>
|
||||
<li> Сохранение настроек в INI-файл</li>
|
||||
<li>Добавлена поддержка интернационализации и
|
||||
ru-lang-package.</li>
|
||||
<li>Немного изменений и фиксов в стурктуре кода.</li>
|
||||
<li>Инстялятор для Windows-версии + пакеты для Ubuntu
|
||||
9.04.</li>
|
||||
</ul>
|
||||
<p>x
|
||||
<strong>Версия 0.1:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>Первая публичная версия.</li>
|
||||
<li>Добавлена иконка в убластиуведомлений и контекстное
|
||||
меню.</li>
|
||||
<li>Возможность скрытия окна программы в область
|
||||
уведомлений. </li>
|
||||
<li>Запуск только одного экземпляра приложения</li>
|
||||
</ul>
|
||||
<p>
|
||||
<strong>Версия 0.0.3:</strong>
|
||||
</p>
|
||||
<ul>
|
||||
<li>Первая работоспособная версия с минимальной
|
||||
функциональностью.</li>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<div id="footer">
|
||||
<p>Copyright © 2009 - 2013, <a href="http://mapper.ru/" class="link1">DOOMer</a></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
BIN
img/logo.png
BIN
img/logo.png
Binary file not shown.
Before Width: | Height: | Size: 6.7 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.9 KiB |
BIN
img/trayicon.png
BIN
img/trayicon.png
Binary file not shown.
Before Width: | Height: | Size: 764 B |
@ -1,12 +0,0 @@
|
||||
[Desktop Entry]
|
||||
Name=ScreenGrab
|
||||
Comment=Screen capture
|
||||
GenericName=Screen Capture Program
|
||||
Exec=screengrab
|
||||
Icon=screengrab
|
||||
Terminal=false
|
||||
Type=Application
|
||||
Categories=Graphics;RasterGraphics;Qt;
|
||||
X-KDE-StartupNotify=false
|
||||
|
||||
#TRANSLATIONS_DIR=translations
|
@ -1,6 +0,0 @@
|
||||
<RCC>
|
||||
<qresource prefix="/res" >
|
||||
<file>img/trayicon.png</file>
|
||||
<file>img/logo.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
@ -1,29 +0,0 @@
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||
include_directories(${Qt5Widgets_INCLUDE_DIRS})
|
||||
|
||||
add_definitions(${Qt5Widgets_DEFINITIONS})
|
||||
|
||||
OPTION (QKSW_SHARED "Use QKeysequenseWidget as shared library" OFF)
|
||||
|
||||
set (QKSW_SRC
|
||||
src/qkeysequencewidget.cpp)
|
||||
|
||||
set (QKSW_HDR
|
||||
src/qkeysequencewidget.h
|
||||
src/qkeysequencewidget_p.h)
|
||||
|
||||
set (QKSW_QRC
|
||||
qkeysequencewidget.qrc)
|
||||
|
||||
qt5_add_resources(QKSW_QRC ${QKSW_QRC})
|
||||
|
||||
if(QKSW_SHARED)
|
||||
add_definitions(-DIS_SHARED="true")
|
||||
add_library(qkeysequencewidget SHARED ${QKSW_SRC} ${QKSW_QRC})
|
||||
set_property(TARGET qkeysequencewidget PROPERTY SOVERSION 1.0.0)
|
||||
INSTALL (TARGETS qkeysequencewidget DESTINATION ${SG_LIBDIR})
|
||||
else(QKSW_SHARED)
|
||||
add_library(qkeysequencewidget STATIC ${QKSW_SRC} ${QKSW_QRC})
|
||||
endif(QKSW_SHARED)
|
||||
|
||||
target_link_libraries(qkeysequencewidget Qt5::Widgets)
|
Binary file not shown.
Before Width: | Height: | Size: 4.4 KiB |
@ -1,7 +0,0 @@
|
||||
INCLUDEPATH += $$PWD/src
|
||||
DEPENDPATH += $$PWD/src
|
||||
|
||||
SOURCES += $$PWD/src/qkeysequencewidget.cpp
|
||||
HEADERS += $$PWD/src/qkeysequencewidget.h \
|
||||
$$PWD/src/qkeysequencewidget_p.h
|
||||
RESOURCES += $$PWD/qkeysequencewidget.qrc
|
@ -1,5 +0,0 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>img/delete_32.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
@ -1,578 +0,0 @@
|
||||
/******************************************************************************
|
||||
Copyright (c) 2010, Artem Galichkin <doomer3d@gmail.com>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the <organization> nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*******************************************************************************/
|
||||
|
||||
#include <QEvent>
|
||||
#include <QKeyEvent>
|
||||
#include <QIcon>
|
||||
|
||||
#include "qkeysequencewidget_p.h"
|
||||
#include "qkeysequencewidget.h"
|
||||
|
||||
/*!
|
||||
Creates a QKeySequenceWidget object wuth \a parent and empty \a keySequence
|
||||
*/
|
||||
QKeySequenceWidget::QKeySequenceWidget(QWidget *parent) :
|
||||
QWidget(parent), d_ptr(new QKeySequenceWidgetPrivate())
|
||||
{
|
||||
Q_D(QKeySequenceWidget);
|
||||
d->q_ptr = this;
|
||||
d->init(QKeySequence(), QString());
|
||||
|
||||
_connectingSlots();
|
||||
}
|
||||
|
||||
/*!
|
||||
Creates a QKeySequenceWidget object wuth \a parent and keysequence \a keySequence
|
||||
and string for \a noneString
|
||||
*/
|
||||
QKeySequenceWidget::QKeySequenceWidget(QKeySequence seq, QString noneString, QWidget *parent) :
|
||||
QWidget(parent), d_ptr(new QKeySequenceWidgetPrivate())
|
||||
{
|
||||
Q_D(QKeySequenceWidget);
|
||||
d->q_ptr = this;
|
||||
d->init(seq, noneString);
|
||||
_connectingSlots();
|
||||
}
|
||||
|
||||
/*!
|
||||
Creates a QKeySequenceWidget object wuth \a parent and keysequence \a keySequence
|
||||
*/
|
||||
QKeySequenceWidget::QKeySequenceWidget(QKeySequence seq, QWidget *parent) :
|
||||
QWidget(parent), d_ptr(new QKeySequenceWidgetPrivate())
|
||||
{
|
||||
Q_D(QKeySequenceWidget);
|
||||
d->q_ptr = this;
|
||||
d->init(seq, QString());
|
||||
_connectingSlots();
|
||||
}
|
||||
|
||||
/*!
|
||||
Creates a QKeySequenceWidget object wuth \a parent and string for \a noneString
|
||||
*/
|
||||
QKeySequenceWidget::QKeySequenceWidget(QString noneString, QWidget *parent) :
|
||||
QWidget(parent), d_ptr(new QKeySequenceWidgetPrivate())
|
||||
{
|
||||
Q_D(QKeySequenceWidget);
|
||||
d->q_ptr = this;
|
||||
d->init(QKeySequence(), noneString);
|
||||
|
||||
_connectingSlots();
|
||||
}
|
||||
|
||||
/*!
|
||||
Destroy a QKeySequenceWidget object
|
||||
*/
|
||||
QKeySequenceWidget::~QKeySequenceWidget()
|
||||
{
|
||||
delete d_ptr;
|
||||
}
|
||||
|
||||
QSize QKeySequenceWidget::sizeHint() const
|
||||
{
|
||||
return d_ptr->shortcutButton->sizeHint();
|
||||
}
|
||||
|
||||
/*!
|
||||
Setting tooltip text to sequence button
|
||||
\param tip Text string
|
||||
*/
|
||||
void QKeySequenceWidget::setToolTip(const QString &tip)
|
||||
{
|
||||
d_ptr->setToolTip(tip);
|
||||
}
|
||||
|
||||
/*!
|
||||
Setting mode of Clear Buttorn display.
|
||||
\param show Position of clear button \a ClearButtornShow
|
||||
\sa clearButtonShow
|
||||
*/
|
||||
void QKeySequenceWidget::setClearButtonShow(QKeySequenceWidget::ClearButtonShow show)
|
||||
{
|
||||
d_ptr->showClearButton = show;
|
||||
d_ptr->updateView();
|
||||
}
|
||||
|
||||
/*!
|
||||
Return mode of clear button dosplay.
|
||||
\param show Display mode of clear button (NoShow, ShowLeft or ShorRight)
|
||||
\sa setClearButtonShow
|
||||
*/
|
||||
QKeySequenceWidget::ClearButtonShow QKeySequenceWidget::clearButtonShow() const
|
||||
{
|
||||
return static_cast<QKeySequenceWidget::ClearButtonShow>(d_ptr->showClearButton);
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
Set the key sequence.
|
||||
\param key Key sequence
|
||||
\sa clearKeySequence
|
||||
*/
|
||||
void QKeySequenceWidget::setKeySequence(const QKeySequence& key)
|
||||
{
|
||||
if (d_ptr->isRecording == false)
|
||||
{
|
||||
d_ptr->oldSequence = d_ptr->currentSequence;
|
||||
}
|
||||
|
||||
d_ptr->currentSequence = key;
|
||||
d_ptr->doneRecording();
|
||||
}
|
||||
|
||||
/*!
|
||||
Get current key sequence.
|
||||
\return Current key sequence
|
||||
\sa setKeySequence
|
||||
\sa clearKeySequence
|
||||
*/
|
||||
QKeySequence QKeySequenceWidget::keySequence() const
|
||||
{
|
||||
return d_ptr->currentSequence;
|
||||
}
|
||||
|
||||
/*!
|
||||
Clear key sequence.
|
||||
\sa setKeySequence
|
||||
*/
|
||||
void QKeySequenceWidget::clearKeySequence()
|
||||
{
|
||||
d_ptr->clearSequence();
|
||||
}
|
||||
|
||||
/*!
|
||||
* Start process capturing key sequence.
|
||||
* This slot is designed for software process capturing key sequence.
|
||||
*/
|
||||
void QKeySequenceWidget::captureKeySequence()
|
||||
{
|
||||
d_ptr->startRecording();
|
||||
}
|
||||
|
||||
/*!
|
||||
Set string for display when key sequence is undefined.
|
||||
\param text Text string
|
||||
\sa noneText
|
||||
*/
|
||||
void QKeySequenceWidget::setNoneText(const QString text)
|
||||
{
|
||||
d_ptr->noneSequenceText = text;
|
||||
d_ptr->updateDisplayShortcut();
|
||||
}
|
||||
|
||||
/*!
|
||||
Get string for display when key sequence is undefined.
|
||||
\return Text string
|
||||
\sa setNoneText
|
||||
*/
|
||||
QString QKeySequenceWidget::noneText() const
|
||||
{
|
||||
return d_ptr->noneSequenceText;
|
||||
}
|
||||
|
||||
/*!
|
||||
Set custom icon for clear buttom.
|
||||
\param icon QIcon object
|
||||
\sa clearButtonIcon
|
||||
*/
|
||||
void QKeySequenceWidget::setClearButtonIcon(const QIcon &icon)
|
||||
{
|
||||
d_ptr->clearButton->setIcon(icon);
|
||||
}
|
||||
|
||||
/*!
|
||||
Get clear buttom icon.
|
||||
\return QIcon object
|
||||
\sa setClearButtonIcon
|
||||
*/
|
||||
QIcon QKeySequenceWidget::clearButtonIcon() const
|
||||
{
|
||||
return d_ptr->clearButton->icon();
|
||||
}
|
||||
|
||||
// connection internal signals & slots
|
||||
void QKeySequenceWidget::_connectingSlots()
|
||||
{
|
||||
// connect signals to slots
|
||||
connect(d_ptr->clearButton, SIGNAL(clicked()), this,
|
||||
SLOT(clearKeySequence()));
|
||||
connect(&d_ptr->modifierlessTimeout, SIGNAL(timeout()), this, SLOT(doneRecording()));
|
||||
connect(d_func()->shortcutButton, SIGNAL(clicked()), this, SLOT(captureKeySequence()));
|
||||
|
||||
}
|
||||
|
||||
// Private class implementation
|
||||
|
||||
QKeySequenceWidgetPrivate::QKeySequenceWidgetPrivate()
|
||||
: layout(NULL), clearButton(NULL), shortcutButton(NULL)
|
||||
{
|
||||
Q_Q(QKeySequenceWidget);
|
||||
Q_UNUSED(q);
|
||||
}
|
||||
|
||||
QKeySequenceWidgetPrivate::~QKeySequenceWidgetPrivate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void QKeySequenceWidgetPrivate::init(const QKeySequence keySeq, const QString noneStr)
|
||||
{
|
||||
Q_Q(QKeySequenceWidget);
|
||||
Q_UNUSED(q);
|
||||
layout = new QHBoxLayout(q_func());
|
||||
layout->setMargin(0);
|
||||
layout->setSpacing(1);
|
||||
|
||||
clearButton = new QToolButton(q_func());
|
||||
clearButton->setText("x");
|
||||
|
||||
layout->addWidget(clearButton);
|
||||
|
||||
shortcutButton = new QShortcutButton(this, q_func());
|
||||
|
||||
if (noneStr.isNull() == true)
|
||||
{
|
||||
noneSequenceText = "...";
|
||||
}
|
||||
else
|
||||
{
|
||||
noneSequenceText = noneStr;
|
||||
}
|
||||
|
||||
q_ptr->clearKeySequence();
|
||||
currentSequence = keySeq;
|
||||
oldSequence = currentSequence;
|
||||
|
||||
shortcutButton->setFocusPolicy(Qt::StrongFocus);
|
||||
|
||||
layout->addWidget(shortcutButton);
|
||||
|
||||
showClearButton = QKeySequenceWidget::ShowRight;
|
||||
|
||||
clearButton->setIcon(QIcon(":/img/delete_32.png"));
|
||||
|
||||
// unfocused clear button afyer created (small hack)
|
||||
clearButton->setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
// update ui
|
||||
updateDisplayShortcut();
|
||||
updateView();
|
||||
}
|
||||
|
||||
// set tooltip only for seqyence button
|
||||
void QKeySequenceWidgetPrivate::setToolTip(const QString &tip)
|
||||
{
|
||||
shortcutButton->setToolTip(tip);
|
||||
clearButton->setToolTip("");
|
||||
}
|
||||
|
||||
// update the location of widgets
|
||||
void QKeySequenceWidgetPrivate::updateView()
|
||||
{
|
||||
switch(showClearButton)
|
||||
{
|
||||
case QKeySequenceWidget::ShowLeft:
|
||||
clearButton->setVisible(true);
|
||||
layout->setDirection(QBoxLayout::LeftToRight);
|
||||
break;
|
||||
case QKeySequenceWidget::ShowRight:
|
||||
clearButton->setVisible(true);
|
||||
layout->setDirection(QBoxLayout::RightToLeft);
|
||||
break;
|
||||
case QKeySequenceWidget::NoShow:
|
||||
clearButton->setVisible(false);
|
||||
break;
|
||||
default:
|
||||
layout->setDirection(QBoxLayout::LeftToRight);
|
||||
}
|
||||
}
|
||||
|
||||
void QKeySequenceWidgetPrivate::startRecording()
|
||||
{
|
||||
numKey = 0;
|
||||
modifierKeys = 0;
|
||||
oldSequence = currentSequence;
|
||||
currentSequence = QKeySequence();
|
||||
isRecording = true;
|
||||
shortcutButton->setDown(true);
|
||||
|
||||
shortcutButton->grabKeyboard();
|
||||
|
||||
if (!QWidget::keyboardGrabber())
|
||||
{
|
||||
qWarning() << "Failed to grab the keyboard! Most likely qt's nograb option is active";
|
||||
}
|
||||
|
||||
// update Shortcut display
|
||||
updateDisplayShortcut();
|
||||
}
|
||||
|
||||
void QKeySequenceWidgetPrivate::doneRecording()
|
||||
{
|
||||
modifierlessTimeout.stop();
|
||||
|
||||
if (isRecording == true)
|
||||
{
|
||||
emit q_ptr->keySequenceAccepted(currentSequence);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (oldSequence.isEmpty() != true)
|
||||
{
|
||||
emit q_ptr->keySequenceChanged(currentSequence);
|
||||
}
|
||||
}
|
||||
|
||||
isRecording = false;
|
||||
shortcutButton->releaseKeyboard();
|
||||
shortcutButton->setDown(false);
|
||||
|
||||
// if sequence is not changed
|
||||
if (currentSequence == oldSequence)
|
||||
{
|
||||
// update Shortcut display
|
||||
updateDisplayShortcut();
|
||||
|
||||
return;
|
||||
}
|
||||
// update Shortcut display
|
||||
updateDisplayShortcut();
|
||||
}
|
||||
|
||||
inline void QKeySequenceWidgetPrivate::cancelRecording()
|
||||
{
|
||||
currentSequence = oldSequence;
|
||||
doneRecording();
|
||||
}
|
||||
|
||||
inline void QKeySequenceWidgetPrivate::clearSequence()
|
||||
{
|
||||
q_ptr->setKeySequence(QKeySequence());
|
||||
emit q_ptr->keySequenceCleared();
|
||||
}
|
||||
|
||||
inline void QKeySequenceWidgetPrivate::controlModifierlessTimout()
|
||||
{
|
||||
if (numKey != 0 && !modifierKeys)
|
||||
{
|
||||
// No modifier key pressed currently. Start the timout
|
||||
modifierlessTimeout.start(600);
|
||||
}
|
||||
else
|
||||
{
|
||||
// A modifier is pressed. Stop the timeout
|
||||
modifierlessTimeout.stop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline void QKeySequenceWidgetPrivate::keyNotSupported()
|
||||
{
|
||||
Q_EMIT q_ptr->keyNotSupported();
|
||||
}
|
||||
|
||||
void QKeySequenceWidgetPrivate::updateDisplayShortcut()
|
||||
{
|
||||
// empty string if no non-modifier was pressed
|
||||
QString str = currentSequence.toString(QKeySequence::NativeText);
|
||||
str.replace('&', QLatin1String("&&")); // TODO -- check it
|
||||
|
||||
if (isRecording == true)
|
||||
{
|
||||
if (modifierKeys)
|
||||
{
|
||||
if (str.isEmpty() == false)
|
||||
str.append(",");
|
||||
|
||||
if ((modifierKeys & Qt::META) )
|
||||
str += "Meta + ";
|
||||
|
||||
if ((modifierKeys & Qt::CTRL) )
|
||||
str += "Ctrl + ";
|
||||
|
||||
if ((modifierKeys & Qt::ALT) )
|
||||
str += "Alt + ";
|
||||
|
||||
if ((modifierKeys & Qt::SHIFT) )
|
||||
str += "Shift + ";
|
||||
}
|
||||
|
||||
// make it clear that input is still going on
|
||||
str.append("...");
|
||||
}
|
||||
|
||||
// if is noting
|
||||
if (str.isEmpty() == true)
|
||||
{
|
||||
str = noneSequenceText;
|
||||
}
|
||||
|
||||
shortcutButton->setText(str);
|
||||
}
|
||||
|
||||
|
||||
// QKeySequenceButton implementation
|
||||
QSize QShortcutButton::sizeHint() const
|
||||
{
|
||||
return QPushButton::sizeHint();
|
||||
}
|
||||
|
||||
bool QShortcutButton::event(QEvent *e)
|
||||
{
|
||||
if (d->isRecording == true && e->type() == QEvent::KeyPress)
|
||||
{
|
||||
keyPressEvent(static_cast<QKeyEvent*>(e));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (d->isRecording && e->type() == QEvent::ShortcutOverride)
|
||||
{
|
||||
e->accept();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (d->isRecording == true && e->type() == QEvent::FocusOut)
|
||||
{
|
||||
d->cancelRecording();
|
||||
return true;
|
||||
}
|
||||
|
||||
return QPushButton::event(e);
|
||||
}
|
||||
|
||||
void QShortcutButton::keyPressEvent(QKeyEvent *keyEvent)
|
||||
{
|
||||
int keyQt = keyEvent->key();
|
||||
|
||||
// Qt sometimes returns garbage keycodes, I observed -1,
|
||||
// if it doesn't know a key.
|
||||
// We cannot do anything useful with those (several keys have -1,
|
||||
// indistinguishable)
|
||||
// and QKeySequence.toString() will also yield a garbage string.
|
||||
if (keyQt == -1)
|
||||
{
|
||||
// keu moy supported in Qt
|
||||
d->cancelRecording();
|
||||
d->keyNotSupported();
|
||||
|
||||
}
|
||||
|
||||
//get modifiers key
|
||||
uint newModifiers = keyEvent->modifiers() & (Qt::SHIFT | Qt::CTRL | Qt::ALT
|
||||
| Qt::META);
|
||||
|
||||
// block autostart capturing on key_return or key space press
|
||||
if (d->isRecording == false && (keyQt == Qt::Key_Return || keyQt == Qt::Key_Space))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// We get events even if recording isn't active.
|
||||
if (d->isRecording == false)
|
||||
{
|
||||
return QPushButton::keyPressEvent(keyEvent);
|
||||
}
|
||||
|
||||
keyEvent->accept();
|
||||
d->modifierKeys = newModifiers;
|
||||
|
||||
// switching key type
|
||||
switch(keyQt)
|
||||
{
|
||||
case Qt::Key_AltGr: //or else we get unicode salad
|
||||
return;
|
||||
case Qt::Key_Shift:
|
||||
case Qt::Key_Control:
|
||||
case Qt::Key_Alt:
|
||||
case Qt::Key_Meta:
|
||||
case Qt::Key_Menu: //unused (yes, but why?)
|
||||
// TODO - check it key
|
||||
d->controlModifierlessTimout();
|
||||
d->updateDisplayShortcut();
|
||||
break;
|
||||
default:
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// We now have a valid key press.
|
||||
if (keyQt)
|
||||
{
|
||||
if ((keyQt == Qt::Key_Backtab) && (d->modifierKeys & Qt::SHIFT))
|
||||
{
|
||||
keyQt = Qt::Key_Tab | d->modifierKeys;
|
||||
}
|
||||
else //if (d->isShiftAsModifierAllowed(keyQt))
|
||||
{
|
||||
keyQt |= d->modifierKeys;
|
||||
}
|
||||
|
||||
if (d->numKey == 0)
|
||||
{
|
||||
d->currentSequence = QKeySequence(keyQt);
|
||||
}
|
||||
|
||||
d->numKey++; // increment nuber of pressed keys
|
||||
|
||||
if (d->numKey >= 4)
|
||||
{
|
||||
d->doneRecording();
|
||||
return;
|
||||
}
|
||||
|
||||
d->controlModifierlessTimout();
|
||||
d->updateDisplayShortcut();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void QShortcutButton::keyReleaseEvent(QKeyEvent *keyEvent)
|
||||
{
|
||||
if (keyEvent->key() == -1)
|
||||
{
|
||||
// ignore garbage, see keyPressEvent()
|
||||
return;
|
||||
}
|
||||
|
||||
// if not recording mode
|
||||
if (d->isRecording == false)
|
||||
{
|
||||
return QPushButton::keyReleaseEvent(keyEvent);
|
||||
}
|
||||
|
||||
keyEvent->accept();
|
||||
|
||||
uint newModifiers = keyEvent->modifiers() & (Qt::SHIFT | Qt::CTRL | Qt::ALT | Qt::META);
|
||||
|
||||
// if a modifier that belongs to the shortcut was released...
|
||||
if ((newModifiers & d->modifierKeys) < d->modifierKeys)
|
||||
{
|
||||
d->modifierKeys = newModifiers;
|
||||
d->controlModifierlessTimout();
|
||||
d->updateDisplayShortcut();
|
||||
}
|
||||
}
|
@ -1,127 +0,0 @@
|
||||
/******************************************************************************
|
||||
Copyright (c) 2010, Artem Galichkin <doomer3d@gmail.com>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the <organization> nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef QKEYSEQUENCEWIDGET_H
|
||||
#define QKEYSEQUENCEWIDGET_H
|
||||
|
||||
#include "qkeysequencewidget_p.h"
|
||||
|
||||
#include <QWidget>
|
||||
#include <QIcon>
|
||||
|
||||
#if defined IS_SHARED
|
||||
#define QKSW_EXPORT Q_DECL_EXPORT
|
||||
#else
|
||||
#define QKSW_EXPORT Q_DECL_IMPORT
|
||||
#endif
|
||||
|
||||
class QKeySequenceWidgetPrivate;
|
||||
|
||||
/*!
|
||||
\class QKeySequenceWidget
|
||||
|
||||
\brief The QKeySequenceWidget is a widget to input a QKeySequence.
|
||||
|
||||
This widget lets the user choose a QKeySequence, which is usually used as a
|
||||
shortcut key. The recording is initiated by calling captureKeySequence() or
|
||||
the user clicking into the widget.
|
||||
|
||||
\code
|
||||
// create new QKeySequenceWidget with empty sequence
|
||||
QKeySequenceWidget *keyWidget = new QKeySequenceWidget;
|
||||
|
||||
// Set sequence as "Ctrl+Alt+Space"
|
||||
keyWidget->setJeySequence(QKeySequence("Ctrl+Alt+Space"));
|
||||
|
||||
// set clear button position is left
|
||||
setClearButtonShow(QKeySequenceWidget::ShowLeft);
|
||||
|
||||
// set cutom clear button icon
|
||||
setClearButtonIcon(QIcon("/path/to/icon.png"));
|
||||
|
||||
// connecting keySequenceChanged signal to slot
|
||||
connect(keyWidget, SIGNAL(keySequenceChanged(QKeySequence)), this, SLOT(slotKeySequenceChanged(QKeySequence)));
|
||||
\endcode
|
||||
*/
|
||||
class QKSW_EXPORT QKeySequenceWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_DECLARE_PRIVATE(QKeySequenceWidget);
|
||||
Q_PRIVATE_SLOT(d_func(), void doneRecording())
|
||||
|
||||
Q_PROPERTY(QKeySequence keySequence READ keySequence WRITE setKeySequence)
|
||||
Q_PROPERTY(QKeySequenceWidget::ClearButtonShow clearButton READ clearButtonShow WRITE setClearButtonShow)
|
||||
Q_PROPERTY(QString noneText READ noneText WRITE setNoneText)
|
||||
Q_PROPERTY(QIcon clearButtonIcon READ clearButtonIcon WRITE setClearButtonIcon)
|
||||
|
||||
private:
|
||||
QKeySequenceWidgetPrivate * const d_ptr;
|
||||
void _connectingSlots();
|
||||
|
||||
public:
|
||||
explicit QKeySequenceWidget(QWidget *parent = 0);
|
||||
explicit QKeySequenceWidget(QKeySequence seq, QWidget *parent = 0);
|
||||
explicit QKeySequenceWidget(QString noneString, QWidget *parent = 0);
|
||||
explicit QKeySequenceWidget(QKeySequence seq, QString noneString, QWidget *parent = 0);
|
||||
virtual ~QKeySequenceWidget();
|
||||
QSize sizeHint() const;
|
||||
void setToolTip(const QString &tip);
|
||||
QKeySequence keySequence() const;
|
||||
QString noneText() const;
|
||||
QIcon clearButtonIcon() const;
|
||||
|
||||
/*!
|
||||
\brief Modes of sohow ClearButton
|
||||
*/
|
||||
enum ClearButton {
|
||||
NoShow = 0x00, /**< Hide ClearButton */
|
||||
ShowLeft = 0x01, /**< ClearButton isow is left */
|
||||
ShowRight = 0x02 /**< ClearButton isow is left */
|
||||
};
|
||||
|
||||
Q_DECLARE_FLAGS(ClearButtonShow, ClearButton);
|
||||
Q_FLAGS(ClearButtonShow)
|
||||
|
||||
QKeySequenceWidget::ClearButtonShow clearButtonShow() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void keySequenceChanged(const QKeySequence &seq);
|
||||
void keySequenceAccepted(const QKeySequence &seq);
|
||||
void keySequenceCleared();
|
||||
void keyNotSupported();
|
||||
|
||||
public Q_SLOTS:
|
||||
void setKeySequence(const QKeySequence &key);
|
||||
void clearKeySequence();
|
||||
void setNoneText(const QString text);
|
||||
void setClearButtonIcon(const QIcon& icon);
|
||||
void setClearButtonShow(QKeySequenceWidget::ClearButtonShow show);
|
||||
void captureKeySequence();
|
||||
};
|
||||
|
||||
#endif // QKEYSEQUENCEWIDGET_H
|
@ -1,120 +0,0 @@
|
||||
/******************************************************************************
|
||||
Copyright (c) 2010, Artem Galichkin <doomer3d@gmail.com>
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the <organization> nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef QKEYSEQUENCEWIDGET_P_H
|
||||
#define QKEYSEQUENCEWIDGET_P_H
|
||||
|
||||
#include <QKeySequence>
|
||||
#include <QHBoxLayout>
|
||||
#include <QToolButton>
|
||||
#include <QPushButton>
|
||||
#include <QTimer>
|
||||
#include <QDebug>
|
||||
#include <QIcon>
|
||||
|
||||
#include "qkeysequencewidget.h"
|
||||
|
||||
class QShortcutButton;
|
||||
class QKeySequenceWidget;
|
||||
|
||||
class QKeySequenceWidgetPrivate // : public QObject
|
||||
{
|
||||
//Q_OBJECT
|
||||
Q_DECLARE_PUBLIC(QKeySequenceWidget);
|
||||
|
||||
public:
|
||||
QKeySequenceWidget * q_ptr;
|
||||
|
||||
QKeySequenceWidgetPrivate();
|
||||
virtual ~QKeySequenceWidgetPrivate();
|
||||
|
||||
void init(const QKeySequence keySeq, const QString noneStr);
|
||||
void updateView();
|
||||
|
||||
void startRecording();
|
||||
void doneRecording();
|
||||
inline void cancelRecording();
|
||||
inline void clearSequence();
|
||||
inline void controlModifierlessTimout();
|
||||
inline void keyNotSupported();
|
||||
|
||||
void updateDisplayShortcut();
|
||||
|
||||
// members
|
||||
QKeySequence currentSequence;
|
||||
QKeySequence oldSequence;
|
||||
QString noneSequenceText;
|
||||
|
||||
QTimer modifierlessTimeout;
|
||||
|
||||
quint32 numKey;
|
||||
quint32 modifierKeys;
|
||||
|
||||
void setToolTip(const QString& tip);
|
||||
|
||||
QHBoxLayout *layout;
|
||||
QToolButton *clearButton;
|
||||
QShortcutButton *shortcutButton;
|
||||
|
||||
int showClearButton;
|
||||
|
||||
bool isRecording;
|
||||
|
||||
};
|
||||
|
||||
class QShortcutButton : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit QShortcutButton(QKeySequenceWidgetPrivate *p, QWidget *parent = 0)
|
||||
: QPushButton(parent)
|
||||
, d(p)
|
||||
{
|
||||
setMinimumWidth(QPushButton::minimumWidth());
|
||||
QPushButton::setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
|
||||
}
|
||||
|
||||
virtual ~QShortcutButton()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
virtual QSize sizeHint() const;
|
||||
|
||||
protected:
|
||||
// Reimplemented for internal reasons.
|
||||
virtual bool event(QEvent *e);
|
||||
virtual void keyPressEvent(QKeyEvent *keyEvent);
|
||||
virtual void keyReleaseEvent(QKeyEvent *keyEvent);
|
||||
|
||||
private:
|
||||
QKeySequenceWidgetPrivate * const d;
|
||||
};
|
||||
|
||||
#endif // QKEYSEQUENCEWIDGET_P_H
|
@ -1,547 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "src/core/config.h"
|
||||
#include "core.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QStandardPaths>
|
||||
#include <QDir>
|
||||
#include <QFile>
|
||||
#include <QLocale>
|
||||
#include <QVector>
|
||||
#include <QDebug>
|
||||
|
||||
#define CONFIG_FILE_DIR "screengrab"
|
||||
#define CONFIG_FILE_NAME "screengrab.conf"
|
||||
|
||||
#define KEY_SAVEDIR "defDir"
|
||||
#define KEY_SAVENAME "defFilename"
|
||||
#define KEY_SAVEFORMAT "defImgFormat"
|
||||
#define KEY_DELAY_DEF "defDelay"
|
||||
#define KEY_DELAY "delay"
|
||||
#define KEY_IMG_QUALITY "imageQuality"
|
||||
#define KEY_FILENAMEDATE "insDateTimeInFilename"
|
||||
#define KEY_DATETIME_TPL "templateDateTime"
|
||||
#define KEY_FILENAME_TO_CLB "CopyFilenameToClipboard"
|
||||
#define KEY_AUTOSAVE "autoSave"
|
||||
#define KEY_AUTOSAVE_FIRST "autoSaveFirst"
|
||||
|
||||
#define KEY_SHOW_TRAY "showTrayIcon"
|
||||
#define KEY_CLOSE_INTRAY "closeInTray"
|
||||
#define KEY_TRAYMESSAGES "trayMessages"
|
||||
|
||||
#define KEY_WND_WIDTH "windowWidth"
|
||||
#define KEY_WND_HEIGHT "windowHeight"
|
||||
#define KEY_ZOOMBOX "zoomAroundMouse"
|
||||
#define KEY_TIME_NOTIFY "timeTrayMessages"
|
||||
#define KEY_ALLOW_COPIES "AllowCopies"
|
||||
#define KEY_TYPE_SCREEN "typeScreenDefault"
|
||||
#define KEY_ENABLE_EXT_VIEWER "enbaleExternalView"
|
||||
#define KEY_NODECOR "noDecorations"
|
||||
#define KEY_INCLUDE_CURSOR "includeCursor"
|
||||
|
||||
Config* Config::ptrInstance = 0;
|
||||
|
||||
// constructor
|
||||
Config::Config()
|
||||
{
|
||||
_settings = new QSettings(getConfigFile(), QSettings::IniFormat);
|
||||
|
||||
_shortcuts = new ShortcutManager(_settings);
|
||||
|
||||
// check existing config file
|
||||
if (!QFile::exists(getConfigFile()))
|
||||
{
|
||||
// creating conf file from set defaults
|
||||
QFile cf(getConfigFile());
|
||||
if (cf.open(QIODevice::WriteOnly))
|
||||
{
|
||||
cf.close();
|
||||
}
|
||||
|
||||
setDefaultSettings();
|
||||
saveSettings();
|
||||
}
|
||||
|
||||
_imageFormats << "png" << "jpg" << "bmp";
|
||||
_settings->setIniCodec("UTF-8");
|
||||
_scrNum = 0;
|
||||
}
|
||||
|
||||
Config::~Config()
|
||||
{
|
||||
delete _shortcuts;
|
||||
delete _settings;
|
||||
}
|
||||
|
||||
Config* Config::instance()
|
||||
{
|
||||
if (!ptrInstance)
|
||||
ptrInstance = new Config;
|
||||
|
||||
return ptrInstance;
|
||||
}
|
||||
|
||||
void Config::setValue(const QString &key, QVariant val)
|
||||
{
|
||||
_confData[key] = val;
|
||||
}
|
||||
|
||||
QVariant Config::value(const QString &key)
|
||||
{
|
||||
return _confData[key];
|
||||
}
|
||||
|
||||
void Config::killInstance()
|
||||
{
|
||||
if (ptrInstance)
|
||||
{
|
||||
delete ptrInstance;
|
||||
ptrInstance = 0;
|
||||
}
|
||||
}
|
||||
|
||||
QString Config::getConfigFile()
|
||||
{
|
||||
return getConfigDir() + QDir::separator() + CONFIG_FILE_NAME;
|
||||
}
|
||||
|
||||
QString Config::getConfigDir()
|
||||
{
|
||||
QString dir = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation);
|
||||
dir += QDir::separator();
|
||||
dir += CONFIG_FILE_DIR;
|
||||
|
||||
QDir qdir(dir);
|
||||
if (!qdir.exists())
|
||||
qdir.mkpath(dir);
|
||||
|
||||
return dir;
|
||||
}
|
||||
|
||||
// public methods
|
||||
|
||||
QString Config::getScrNumStr()
|
||||
{
|
||||
QString str = QString::number(_scrNum);
|
||||
|
||||
if (_scrNum < 10)
|
||||
str.prepend("0");
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
int Config::getScrNum() const
|
||||
{
|
||||
return _scrNum;
|
||||
}
|
||||
|
||||
void Config::increaseScrNum()
|
||||
{
|
||||
_scrNum++;
|
||||
}
|
||||
|
||||
void Config::resetScrNum()
|
||||
{
|
||||
_scrNum = 0;
|
||||
}
|
||||
|
||||
void Config::updateLastSaveDate()
|
||||
{
|
||||
_dateLastSaving = QDateTime::currentDateTime();
|
||||
}
|
||||
|
||||
QDateTime Config::getLastSaveDate() const
|
||||
{
|
||||
return _dateLastSaving;
|
||||
}
|
||||
|
||||
bool Config::getEnableExtView()
|
||||
{
|
||||
return value(KEY_ENABLE_EXT_VIEWER).toBool();
|
||||
}
|
||||
|
||||
void Config::setEnableExtView(bool val)
|
||||
{
|
||||
setValue(KEY_ENABLE_EXT_VIEWER, val);
|
||||
}
|
||||
|
||||
bool Config::getIncludeCursor()
|
||||
{
|
||||
return value(KEY_INCLUDE_CURSOR).toBool();
|
||||
}
|
||||
|
||||
void Config::setIncludeCursor(bool val)
|
||||
{
|
||||
setValue(KEY_INCLUDE_CURSOR, val);
|
||||
}
|
||||
|
||||
QString Config::getSaveDir()
|
||||
{
|
||||
return value(KEY_SAVEDIR).toString();
|
||||
}
|
||||
|
||||
void Config::setSaveDir(QString path)
|
||||
{
|
||||
setValue(KEY_SAVEDIR, path);
|
||||
}
|
||||
|
||||
QString Config::getSaveFileName()
|
||||
{
|
||||
return value(KEY_SAVENAME).toString();
|
||||
}
|
||||
|
||||
void Config::setSaveFileName(QString fileName)
|
||||
{
|
||||
setValue(KEY_SAVENAME, fileName);
|
||||
}
|
||||
|
||||
QString Config::getSaveFormat()
|
||||
{
|
||||
return value(KEY_SAVEFORMAT).toString();
|
||||
}
|
||||
|
||||
void Config::setSaveFormat(QString format)
|
||||
{
|
||||
setValue(KEY_SAVEFORMAT, format);
|
||||
}
|
||||
|
||||
quint8 Config::getDefDelay()
|
||||
{
|
||||
return value(KEY_DELAY_DEF).toInt();
|
||||
}
|
||||
|
||||
void Config::setDefDelay(quint8 sec)
|
||||
{
|
||||
setValue(KEY_DELAY_DEF, sec);
|
||||
}
|
||||
|
||||
quint8 Config::getDelay()
|
||||
{
|
||||
return value(KEY_DELAY).toInt();
|
||||
}
|
||||
|
||||
void Config::setDelay(quint8 sec)
|
||||
{
|
||||
setValue(KEY_DELAY, sec);
|
||||
}
|
||||
|
||||
quint8 Config::getAutoCopyFilenameOnSaving()
|
||||
{
|
||||
return value(KEY_FILENAME_TO_CLB).toInt();
|
||||
}
|
||||
|
||||
void Config::setAutoCopyFilenameOnSaving(quint8 val)
|
||||
{
|
||||
setValue(KEY_FILENAME_TO_CLB, val);
|
||||
}
|
||||
|
||||
|
||||
quint8 Config::getTrayMessages()
|
||||
{
|
||||
return value(KEY_TRAYMESSAGES).toInt();
|
||||
}
|
||||
|
||||
void Config::setTrayMessages(quint8 type)
|
||||
{
|
||||
setValue(KEY_TRAYMESSAGES, type);
|
||||
}
|
||||
|
||||
bool Config::getAllowMultipleInstance()
|
||||
{
|
||||
return value(KEY_ALLOW_COPIES).toBool();
|
||||
}
|
||||
|
||||
void Config::setAllowMultipleInstance(bool val)
|
||||
{
|
||||
setValue(KEY_ALLOW_COPIES, val);
|
||||
}
|
||||
|
||||
bool Config::getCloseInTray()
|
||||
{
|
||||
return value(KEY_CLOSE_INTRAY).toBool();
|
||||
}
|
||||
|
||||
void Config::setCloseInTray(bool val)
|
||||
{
|
||||
setValue(KEY_CLOSE_INTRAY, val);
|
||||
}
|
||||
|
||||
int Config::getTypeScreen()
|
||||
{
|
||||
return value(KEY_TYPE_SCREEN).toInt();
|
||||
}
|
||||
|
||||
void Config::setTypeScreen(quint8 type)
|
||||
{
|
||||
setValue(KEY_TYPE_SCREEN, type);
|
||||
}
|
||||
|
||||
quint8 Config::getTimeTrayMess()
|
||||
{
|
||||
return value(KEY_TIME_NOTIFY).toInt();
|
||||
}
|
||||
|
||||
void Config::setTimeTrayMess(int sec)
|
||||
{
|
||||
setValue(KEY_TIME_NOTIFY, sec);
|
||||
}
|
||||
|
||||
QSize Config::getRestoredWndSize()
|
||||
{
|
||||
QSize wndSize(value(KEY_WND_WIDTH).toInt(), value(KEY_WND_HEIGHT).toInt());
|
||||
return wndSize;
|
||||
}
|
||||
|
||||
void Config::setRestoredWndSize(int w, int h)
|
||||
{
|
||||
setValue(KEY_WND_WIDTH, w);
|
||||
setValue(KEY_WND_HEIGHT, h);
|
||||
}
|
||||
|
||||
bool Config::getDateTimeInFilename()
|
||||
{
|
||||
return value(KEY_FILENAMEDATE).toBool();
|
||||
}
|
||||
|
||||
void Config::setDateTimeInFilename(bool val)
|
||||
{
|
||||
setValue(KEY_FILENAMEDATE, val);
|
||||
}
|
||||
|
||||
bool Config::getAutoSave()
|
||||
{
|
||||
return value(KEY_AUTOSAVE).toBool();
|
||||
}
|
||||
|
||||
void Config::setAutoSave(bool val)
|
||||
{
|
||||
setValue(KEY_AUTOSAVE, val);
|
||||
}
|
||||
|
||||
quint8 Config::getImageQuality()
|
||||
{
|
||||
return value(KEY_IMG_QUALITY).toInt();
|
||||
}
|
||||
|
||||
void Config::setImageQuality(quint8 qualuty)
|
||||
{
|
||||
setValue(KEY_IMG_QUALITY, qualuty);
|
||||
}
|
||||
|
||||
bool Config::getAutoSaveFirst()
|
||||
{
|
||||
return value(KEY_AUTOSAVE_FIRST).toBool();
|
||||
}
|
||||
|
||||
void Config::setAutoSaveFirst(bool val)
|
||||
{
|
||||
setValue(KEY_AUTOSAVE_FIRST, val);
|
||||
}
|
||||
|
||||
QString Config::getDateTimeTpl()
|
||||
{
|
||||
return value(KEY_DATETIME_TPL).toString();
|
||||
}
|
||||
|
||||
void Config::setDateTimeTpl(QString tpl)
|
||||
{
|
||||
setValue(KEY_DATETIME_TPL, tpl);
|
||||
}
|
||||
|
||||
bool Config::getZoomAroundMouse()
|
||||
{
|
||||
return value(KEY_ZOOMBOX).toBool();
|
||||
}
|
||||
|
||||
void Config::setZoomAroundMouse(bool val)
|
||||
{
|
||||
setValue(KEY_ZOOMBOX, val);
|
||||
}
|
||||
|
||||
bool Config::getShowTrayIcon()
|
||||
{
|
||||
return value(KEY_SHOW_TRAY).toBool();
|
||||
}
|
||||
|
||||
void Config::setShowTrayIcon(bool val)
|
||||
{
|
||||
setValue(KEY_SHOW_TRAY, val);
|
||||
}
|
||||
|
||||
bool Config::getNoDecoration()
|
||||
{
|
||||
return value(KEY_NODECOR).toBool();
|
||||
}
|
||||
|
||||
void Config::setNoDecoration(bool val)
|
||||
{
|
||||
setValue(KEY_NODECOR, val);
|
||||
}
|
||||
|
||||
void Config::saveWndSize()
|
||||
{
|
||||
// saving size
|
||||
_settings->beginGroup("Display");
|
||||
_settings->setValue(KEY_WND_WIDTH, getRestoredWndSize().width());
|
||||
_settings->setValue(KEY_WND_HEIGHT, getRestoredWndSize().height());
|
||||
_settings->endGroup();
|
||||
}
|
||||
|
||||
// load all settings from conf file
|
||||
void Config::loadSettings()
|
||||
{
|
||||
_settings->beginGroup("Base");
|
||||
setSaveDir(_settings->value(KEY_SAVEDIR, getDirNameDefault()).toString() );
|
||||
setSaveFileName(_settings->value(KEY_SAVENAME,DEF_SAVE_NAME).toString());
|
||||
setSaveFormat(_settings->value(KEY_SAVEFORMAT, DEF_SAVE_FORMAT).toString());
|
||||
setDefDelay(_settings->value(KEY_DELAY, DEF_DELAY).toInt());
|
||||
setAutoCopyFilenameOnSaving(_settings->value(KEY_FILENAME_TO_CLB, DEF_FILENAME_TO_CLB).toInt());
|
||||
setDateTimeInFilename(_settings->value(KEY_FILENAMEDATE, DEF_DATETIME_FILENAME).toBool());
|
||||
setDateTimeTpl(_settings->value(KEY_DATETIME_TPL, DEF_DATETIME_TPL).toString());
|
||||
setAutoSave(_settings->value(KEY_AUTOSAVE, DEF_AUTO_SAVE).toBool());
|
||||
setAutoSaveFirst(_settings->value(KEY_AUTOSAVE_FIRST, DEF_AUTO_SAVE_FIRST).toBool());
|
||||
setNoDecoration(_settings->value(KEY_NODECOR, DEF_X11_NODECOR).toBool());
|
||||
setImageQuality(_settings->value(KEY_IMG_QUALITY, DEF_IMG_QUALITY).toInt());
|
||||
setIncludeCursor(_settings->value(KEY_INCLUDE_CURSOR, DEF_INCLUDE_CURSOR).toBool());
|
||||
_settings->endGroup();
|
||||
|
||||
_settings->beginGroup("Display");
|
||||
setTrayMessages(_settings->value(KEY_TRAYMESSAGES, DEF_TRAY_MESS_TYPE).toInt());
|
||||
setTimeTrayMess(_settings->value(KEY_TIME_NOTIFY, DEF_TIME_TRAY_MESS).toInt( ));
|
||||
setZoomAroundMouse(_settings->value(KEY_ZOOMBOX, DEF_ZOOM_AROUND_MOUSE).toBool());
|
||||
// TODO - make set windows size without hardcode values
|
||||
setRestoredWndSize(_settings->value(KEY_WND_WIDTH, DEF_WND_WIDTH).toInt(),
|
||||
_settings->value(KEY_WND_HEIGHT, DEF_WND_HEIGHT).toInt());
|
||||
setShowTrayIcon(_settings->value(KEY_SHOW_TRAY, DEF_SHOW_TRAY).toBool());
|
||||
_settings->endGroup();
|
||||
|
||||
_settings->beginGroup("System");
|
||||
setCloseInTray(_settings->value(KEY_CLOSE_INTRAY, DEF_CLOSE_IN_TRAY).toBool());
|
||||
setAllowMultipleInstance(_settings->value(KEY_ALLOW_COPIES, DEF_ALLOW_COPIES).toBool());
|
||||
setEnableExtView(_settings->value(KEY_ENABLE_EXT_VIEWER, DEF_ENABLE_EXT_VIEWER).toBool());
|
||||
_settings->endGroup();
|
||||
|
||||
setDelay(getDefDelay());
|
||||
|
||||
_shortcuts->loadSettings();
|
||||
}
|
||||
|
||||
void Config::saveSettings()
|
||||
{
|
||||
_settings->beginGroup("Base");
|
||||
_settings->setValue(KEY_SAVEDIR, getSaveDir());
|
||||
_settings->setValue(KEY_SAVENAME, getSaveFileName());
|
||||
_settings->setValue(KEY_SAVEFORMAT, getSaveFormat());
|
||||
_settings->setValue(KEY_DELAY, getDefDelay());
|
||||
_settings->setValue(KEY_FILENAME_TO_CLB, getAutoCopyFilenameOnSaving());
|
||||
_settings->setValue(KEY_FILENAMEDATE, getDateTimeInFilename());
|
||||
_settings->setValue(KEY_DATETIME_TPL, getDateTimeTpl());
|
||||
_settings->setValue(KEY_AUTOSAVE, getAutoSave());
|
||||
_settings->setValue(KEY_AUTOSAVE_FIRST, getAutoSaveFirst());
|
||||
_settings->setValue(KEY_IMG_QUALITY, getImageQuality());
|
||||
_settings->setValue(KEY_NODECOR, getNoDecoration());
|
||||
_settings->setValue(KEY_INCLUDE_CURSOR, getIncludeCursor());
|
||||
_settings->endGroup();
|
||||
|
||||
_settings->beginGroup("Display");
|
||||
_settings->setValue(KEY_TRAYMESSAGES, getTrayMessages());
|
||||
_settings->setValue(KEY_TIME_NOTIFY, getTimeTrayMess());
|
||||
_settings->setValue(KEY_ZOOMBOX, getZoomAroundMouse());
|
||||
_settings->setValue(KEY_SHOW_TRAY, getShowTrayIcon());
|
||||
_settings->endGroup();
|
||||
saveWndSize();
|
||||
|
||||
_settings->beginGroup("System");
|
||||
_settings->setValue(KEY_CLOSE_INTRAY, getCloseInTray());
|
||||
_settings->setValue(KEY_ALLOW_COPIES, getAllowMultipleInstance());
|
||||
_settings->setValue(KEY_ENABLE_EXT_VIEWER, getEnableExtView());
|
||||
_settings->endGroup();
|
||||
|
||||
_shortcuts->saveSettings();
|
||||
|
||||
resetScrNum();
|
||||
}
|
||||
|
||||
// set default values
|
||||
void Config::setDefaultSettings()
|
||||
{
|
||||
setSaveDir(getDirNameDefault());
|
||||
setSaveFileName(DEF_SAVE_NAME);
|
||||
setSaveFormat(DEF_SAVE_FORMAT);
|
||||
setDefDelay(DEF_DELAY);
|
||||
setImageQuality(DEF_IMG_QUALITY);
|
||||
setDateTimeInFilename(DEF_DATETIME_FILENAME);
|
||||
setDateTimeTpl(DEF_DATETIME_TPL);
|
||||
setAutoCopyFilenameOnSaving(DEF_FILENAME_TO_CLB);
|
||||
setAutoSave(DEF_AUTO_SAVE);
|
||||
setAutoSaveFirst(DEF_AUTO_SAVE_FIRST);
|
||||
setTrayMessages(DEF_TRAY_MESS_TYPE);
|
||||
setIncludeCursor(DEF_INCLUDE_CURSOR);
|
||||
setZoomAroundMouse(DEF_ZOOM_AROUND_MOUSE);
|
||||
setCloseInTray(DEF_CLOSE_IN_TRAY);
|
||||
setTimeTrayMess(DEF_TIME_TRAY_MESS);
|
||||
setAllowMultipleInstance(DEF_ALLOW_COPIES);
|
||||
// TODO - make set windows size without hardcode values
|
||||
// setRestoredWndSize(DEF_WND_WIDTH, DEF_WND_HEIGHT);
|
||||
setShowTrayIcon(DEF_SHOW_TRAY);
|
||||
setEnableExtView(DEF_ENABLE_EXT_VIEWER);
|
||||
|
||||
_shortcuts->setDefaultSettings();
|
||||
|
||||
setNoDecoration(DEF_X11_NODECOR);
|
||||
setDelay(DEF_DELAY);
|
||||
|
||||
quint8 countModules = Core::instance()->modules()->count();
|
||||
for (int i = 0; i < countModules; ++i)
|
||||
Core::instance()->modules()->getModule(i)->defaultSettings();
|
||||
}
|
||||
|
||||
// get defaukt directory path
|
||||
QString Config::getDirNameDefault()
|
||||
{
|
||||
return QDir::homePath()+QDir::separator();
|
||||
}
|
||||
|
||||
// get id of default save format
|
||||
int Config::getDefaultFormatID()
|
||||
{
|
||||
return _imageFormats.indexOf(getSaveFormat());
|
||||
}
|
||||
|
||||
QString Config::getSysLang()
|
||||
{
|
||||
QByteArray lang = qgetenv("LC_ALL");
|
||||
|
||||
if (lang.isEmpty())
|
||||
lang = qgetenv("LC_MESSAGES");
|
||||
|
||||
if (lang.isEmpty())
|
||||
lang = qgetenv("LANG");
|
||||
|
||||
if (!lang.isEmpty())
|
||||
return QLocale (lang).name();
|
||||
else
|
||||
return QLocale::system().name();
|
||||
}
|
||||
|
||||
ShortcutManager* Config::shortcuts()
|
||||
{
|
||||
return _shortcuts;
|
||||
}
|
@ -1,262 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef CONFIG_H
|
||||
#define CONFIG_H
|
||||
|
||||
#include "shortcutmanager.h"
|
||||
|
||||
#include <QSettings>
|
||||
#include <QString>
|
||||
#include <QSize>
|
||||
#include <QHash>
|
||||
#include <QVariant>
|
||||
#include <QDateTime>
|
||||
|
||||
// default values const
|
||||
const QString DEF_SAVE_NAME = "screen";
|
||||
const QString DEF_SAVE_FORMAT = "png";
|
||||
const quint8 DEF_DELAY = 0;
|
||||
const bool DEF_X11_NODECOR = false;
|
||||
const quint8 DEF_TRAY_MESS_TYPE = 1;
|
||||
const quint8 DEF_FILENAME_TO_CLB = 0;
|
||||
const quint8 DEF_IMG_QUALITY = 80;
|
||||
const bool DEF_CLOSE_IN_TRAY = false;
|
||||
const bool DEF_ALLOW_COPIES = true;
|
||||
const bool DEF_ZOOM_AROUND_MOUSE = false;
|
||||
// TODO - make set windows size without hardcode values
|
||||
const int DEF_WND_WIDTH = 480;
|
||||
const int DEF_WND_HEIGHT = 281;
|
||||
const int DEF_TIME_TRAY_MESS = 5;
|
||||
const bool DEF_DATETIME_FILENAME = false;
|
||||
const bool DEF_AUTO_SAVE = false;
|
||||
const bool DEF_AUTO_SAVE_FIRST = false;
|
||||
const QString DEF_DATETIME_TPL = "yyyy-MM-dd-hh-mm-ss";
|
||||
const bool DEF_SHOW_TRAY = true;
|
||||
const bool DEF_ENABLE_EXT_VIEWER = true;
|
||||
const bool DEF_INCLUDE_CURSOR = false;
|
||||
|
||||
// class worker with conf data
|
||||
class Config
|
||||
{
|
||||
public:
|
||||
// type of shortcut
|
||||
enum Type {
|
||||
globalShortcut = 0,
|
||||
localShortcut = 1
|
||||
};
|
||||
|
||||
Q_DECLARE_FLAGS(ShortcutType, Type)
|
||||
|
||||
// definition of shortcut
|
||||
enum Actions {
|
||||
shortcutFullScreen = 0,
|
||||
shortcutActiveWnd = 1,
|
||||
shortcutAreaSelect = 2,
|
||||
shortcutNew = 3,
|
||||
shortcutSave = 4,
|
||||
shortcutCopy = 5,
|
||||
shortcutOptions = 6,
|
||||
shortcutHelp = 7,
|
||||
shortcutClose = 8
|
||||
};
|
||||
|
||||
Q_DECLARE_FLAGS(ShortcutAction, Actions)
|
||||
|
||||
enum AutoCopyFilename {
|
||||
nameToClipboardOff = 0,
|
||||
nameToClipboardFile = 1,
|
||||
nameToClipboardPath = 2
|
||||
};
|
||||
|
||||
Q_DECLARE_FLAGS(FilenameToClipboard, AutoCopyFilename)
|
||||
|
||||
/**
|
||||
* Get current instance of configuration object
|
||||
* @return Pointer on created object
|
||||
*/
|
||||
static Config* instance();
|
||||
|
||||
/**
|
||||
* Destroy current Config object
|
||||
*/
|
||||
static void killInstance();
|
||||
~Config();
|
||||
|
||||
/**
|
||||
* @brief Gets the configuration file for screengrab. It's
|
||||
* inside the folder returned by getConfigDir().
|
||||
*/
|
||||
static QString getConfigFile();
|
||||
|
||||
/**
|
||||
* @brief Gets the directory where to save the configuration files.
|
||||
* Does not end with '/'.
|
||||
*/
|
||||
static QString getConfigDir();
|
||||
|
||||
/**
|
||||
* Load configuration data from conf file
|
||||
*/
|
||||
void loadSettings();
|
||||
|
||||
/**
|
||||
* Save configuration data to conf file
|
||||
*/
|
||||
void saveSettings();
|
||||
|
||||
/**
|
||||
* Reset configuration data from default values
|
||||
*/
|
||||
void setDefaultSettings();
|
||||
|
||||
// save dir
|
||||
QString getSaveDir();
|
||||
void setSaveDir(QString path);
|
||||
|
||||
// filename default
|
||||
QString getSaveFileName();
|
||||
void setSaveFileName(QString fileName);
|
||||
|
||||
// save format str
|
||||
QString getSaveFormat();
|
||||
void setSaveFormat(QString format);
|
||||
|
||||
// default delay
|
||||
quint8 getDefDelay();
|
||||
void setDefDelay(quint8 sec);
|
||||
|
||||
quint8 getDelay();
|
||||
void setDelay(quint8 sec);
|
||||
|
||||
quint8 getAutoCopyFilenameOnSaving();
|
||||
void setAutoCopyFilenameOnSaving(quint8 val);
|
||||
|
||||
// trayMessages
|
||||
quint8 getTrayMessages();
|
||||
void setTrayMessages(quint8 type);
|
||||
|
||||
// allow multiple copies
|
||||
bool getAllowMultipleInstance();
|
||||
void setAllowMultipleInstance(bool val);
|
||||
|
||||
// closing in tray
|
||||
bool getCloseInTray();
|
||||
void setCloseInTray(bool val);
|
||||
|
||||
// type of screen
|
||||
int getTypeScreen();
|
||||
void setTypeScreen(quint8 type);
|
||||
|
||||
// tume of tray messages
|
||||
quint8 getTimeTrayMess();
|
||||
void setTimeTrayMess(int src);
|
||||
|
||||
bool getDateTimeInFilename();
|
||||
void setDateTimeInFilename(bool val);
|
||||
|
||||
// auto save screenshot
|
||||
bool getAutoSave();
|
||||
void setAutoSave(bool val);
|
||||
|
||||
// umage qualuty
|
||||
quint8 getImageQuality();
|
||||
void setImageQuality(quint8 qualuty);
|
||||
|
||||
// aoutosave first screenshot
|
||||
bool getAutoSaveFirst();
|
||||
void setAutoSaveFirst(bool val);
|
||||
|
||||
// size wnd
|
||||
QSize getRestoredWndSize();
|
||||
void setRestoredWndSize(int w, int h);
|
||||
void saveWndSize();
|
||||
|
||||
// get default image save format
|
||||
int getDefaultFormatID();
|
||||
QString getDirNameDefault();
|
||||
|
||||
// datetime template
|
||||
QString getDateTimeTpl();
|
||||
void setDateTimeTpl(QString tpl);
|
||||
|
||||
// zoom aroundd mouse
|
||||
bool getZoomAroundMouse();
|
||||
void setZoomAroundMouse(bool val);
|
||||
|
||||
// show tray icon option
|
||||
bool getShowTrayIcon();
|
||||
void setShowTrayIcon(bool val);
|
||||
|
||||
// no decoration of window
|
||||
bool getNoDecoration();
|
||||
void setNoDecoration(bool val);
|
||||
|
||||
QString getScrNumStr();
|
||||
int getScrNum() const;
|
||||
void increaseScrNum();
|
||||
void resetScrNum();
|
||||
|
||||
void updateLastSaveDate();
|
||||
QDateTime getLastSaveDate() const;
|
||||
|
||||
bool getEnableExtView();
|
||||
void setEnableExtView(bool val);
|
||||
|
||||
bool getIncludeCursor();
|
||||
void setIncludeCursor(bool val);
|
||||
|
||||
static QString getSysLang();
|
||||
|
||||
ShortcutManager* shortcuts();
|
||||
|
||||
private:
|
||||
Config();
|
||||
Config(const Config &);
|
||||
Config& operator=(const Config& );
|
||||
|
||||
static Config *ptrInstance;
|
||||
|
||||
/**
|
||||
* Return value on configuration parameter
|
||||
*
|
||||
* @param String of name key
|
||||
* @return QVariant value of configuration parameter
|
||||
*/
|
||||
QVariant value(const QString &key);
|
||||
|
||||
/**
|
||||
* Set value on configuration parameter
|
||||
*
|
||||
* @param String of name key
|
||||
* @param String of saved value
|
||||
*/
|
||||
void setValue(const QString& key, QVariant val);
|
||||
|
||||
QSettings *_settings;
|
||||
QHash<QString, QVariant> _confData;
|
||||
|
||||
ShortcutManager *_shortcuts;
|
||||
|
||||
QVector<QString> _imageFormats;
|
||||
|
||||
int _scrNum; // screen num in session
|
||||
QDateTime _dateLastSaving;
|
||||
};
|
||||
|
||||
#endif // CONFIG_H
|
@ -1,588 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#include <QMutex>
|
||||
#include <QWaitCondition>
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QScreen>
|
||||
#include <QChar>
|
||||
#include <QBuffer>
|
||||
#include <QFile>
|
||||
#include <QDir>
|
||||
#include <QUuid>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#include <KF5/KWindowSystem/KWindowSystem>
|
||||
#include <xcb/xfixes.h>
|
||||
|
||||
#ifdef X11_XCB_FOUND
|
||||
#include "x11utils.h"
|
||||
#endif
|
||||
|
||||
#include "core/core.h"
|
||||
|
||||
#ifdef SG_DBUS_NOTIFY
|
||||
#include "dbusnotifier.h"
|
||||
#endif
|
||||
|
||||
#ifdef SG_EXT_UPLOADS
|
||||
#include "modules/uploader/moduleuploader.h"
|
||||
#endif
|
||||
|
||||
Core* Core::corePtr = 0;
|
||||
|
||||
Core::Core()
|
||||
{
|
||||
qRegisterMetaType<StateNotifyMessage>("StateNotifyMessage");
|
||||
|
||||
_conf = Config::instance();
|
||||
_conf->loadSettings();
|
||||
|
||||
_pixelMap = new QPixmap;
|
||||
_selector = 0;
|
||||
_firstScreen = true;
|
||||
|
||||
_cmdLine.setApplicationDescription("ScreenGrab " + tr("is a crossplatform application for fast creating screenshots of your desktop."));
|
||||
_cmdLine.addHelpOption();
|
||||
_cmdLine.addVersionOption();
|
||||
|
||||
QCommandLineOption optFullScreen(QStringList() << "f" << "fullscreen", tr("Take a fullscreen screenshot"));
|
||||
_cmdLine.addOption(optFullScreen);
|
||||
_screenTypeOpts.append(optFullScreen);
|
||||
|
||||
QCommandLineOption optActiveWnd(QStringList() << "a" << "active", tr("Take a screenshot of the active window"));
|
||||
_cmdLine.addOption(optActiveWnd);
|
||||
_screenTypeOpts.append(optActiveWnd);
|
||||
|
||||
QCommandLineOption optSelectedRect(QStringList() << "r" << "region", tr("Take a screenshot of a selection of the screen"));
|
||||
_cmdLine.addOption(optSelectedRect);
|
||||
_screenTypeOpts.append(optSelectedRect);
|
||||
|
||||
QCommandLineOption optRunMinimized(QStringList() << "m" << "minimized", tr("Run the application with a hidden main window"));
|
||||
_cmdLine.addOption(optRunMinimized);
|
||||
|
||||
sleep(250);
|
||||
|
||||
_wnd = NULL;
|
||||
}
|
||||
|
||||
Core::Core(const Core& ): QObject()
|
||||
{
|
||||
}
|
||||
|
||||
Core& Core::operator=(const Core &)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
Core* Core::instance()
|
||||
{
|
||||
if (!corePtr)
|
||||
corePtr = new Core;
|
||||
return corePtr;
|
||||
}
|
||||
|
||||
Core::~Core()
|
||||
{
|
||||
delete _pixelMap;
|
||||
_conf->killInstance();
|
||||
}
|
||||
|
||||
void Core::initWindow(const QString& ipcMessage)
|
||||
{
|
||||
if (!_wnd) {
|
||||
_wnd = new MainWindow;
|
||||
_wnd->setConfig(_conf);
|
||||
_wnd->updateModulesActions(_modules.generateModulesActions());
|
||||
_wnd->updateModulesenus(_modules.generateModulesMenus());
|
||||
|
||||
screenShot(true); // first screenshot
|
||||
|
||||
_wnd->resize(_conf->getRestoredWndSize());
|
||||
|
||||
if (_wnd) {
|
||||
if (runAsMinimized())
|
||||
{
|
||||
if (_wnd->isTrayed())
|
||||
_wnd->windowHideShow();
|
||||
else
|
||||
_wnd->showMinimized();
|
||||
} else
|
||||
_wnd->show();
|
||||
}
|
||||
} else {
|
||||
_wnd->showWindow(ipcMessage);
|
||||
screenShot();
|
||||
}
|
||||
}
|
||||
|
||||
void Core::sleep(int msec)
|
||||
{
|
||||
QMutex mutex;
|
||||
mutex.lock();
|
||||
QWaitCondition pause;
|
||||
pause.wait(&mutex, msec); // def 240
|
||||
mutex.unlock();
|
||||
}
|
||||
|
||||
void Core::coreQuit()
|
||||
{
|
||||
_conf->setRestoredWndSize(_wnd->width(), _wnd->height());
|
||||
_conf->saveWndSize();
|
||||
|
||||
if (_wnd) {
|
||||
_wnd->close();
|
||||
}
|
||||
|
||||
if (corePtr)
|
||||
{
|
||||
delete corePtr;
|
||||
corePtr = NULL;
|
||||
}
|
||||
|
||||
qApp->quit();
|
||||
}
|
||||
|
||||
void Core::setScreen()
|
||||
{
|
||||
_wnd->hideToShot();
|
||||
|
||||
// new code experimental
|
||||
if (_conf->getDelay() == 0)
|
||||
QTimer::singleShot(200, this, SLOT(screenShot()));
|
||||
else
|
||||
QTimer::singleShot(1000 * _conf->getDelay(), this, SLOT(screenShot()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
// get screenshot
|
||||
void Core::screenShot(bool first)
|
||||
{
|
||||
sleep(400); // delay for hide "fade effect" bug in the KWin with compositing
|
||||
_firstScreen = first;
|
||||
|
||||
// Update date last crenshot, if it is a first screen
|
||||
if (_firstScreen)
|
||||
_conf->updateLastSaveDate();
|
||||
|
||||
switch(_conf->getTypeScreen())
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
const QList<QScreen *> screens = qApp->screens();
|
||||
const QDesktopWidget *desktop = QApplication::desktop();
|
||||
const int screenNum = desktop->screenNumber(QCursor::pos());
|
||||
*_pixelMap = screens[screenNum]->grabWindow(desktop->winId());
|
||||
grabCursor(0, 0);
|
||||
|
||||
checkAutoSave(first);
|
||||
_wnd->updatePixmap(_pixelMap);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
getActiveWindow();
|
||||
checkAutoSave(first);
|
||||
_wnd->updatePixmap(_pixelMap);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
_selector = new RegionSelect(_conf);
|
||||
connect(_selector, &RegionSelect::processDone, this, &Core::regionGrabbed);
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
_selector = new RegionSelect(_conf, _lastSelectedArea);
|
||||
connect(_selector, &RegionSelect::processDone, this, &Core::regionGrabbed);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
*_pixelMap = QPixmap::grabWindow(QApplication::desktop()->winId());
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
_wnd->updatePixmap(_pixelMap);
|
||||
_wnd->restoreFromShot();
|
||||
}
|
||||
|
||||
void Core::checkAutoSave(bool first)
|
||||
{
|
||||
if (_conf->getAutoSave())
|
||||
{
|
||||
// hack
|
||||
if (first)
|
||||
{
|
||||
if (_conf->getAutoSaveFirst())
|
||||
QTimer::singleShot(600, this, SLOT(autoSave()));
|
||||
}
|
||||
else
|
||||
autoSave();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!first)
|
||||
{
|
||||
StateNotifyMessage message(tr("New screen"), tr("New screen is getted!"));
|
||||
sendNotify(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Core::getActiveWindow()
|
||||
{
|
||||
const QList<QScreen *> screens = qApp->screens();
|
||||
const QDesktopWidget *desktop = QApplication::desktop();
|
||||
const int screenNum = desktop->screenNumber(QCursor::pos());
|
||||
|
||||
WId wnd = KWindowSystem::activeWindow();
|
||||
|
||||
if (!wnd)
|
||||
{
|
||||
*_pixelMap = screens[screenNum]->grabWindow(desktop->winId());
|
||||
exit(1);
|
||||
}
|
||||
|
||||
// no decorations option is selected
|
||||
if (_conf->getNoDecoration())
|
||||
{
|
||||
*_pixelMap = screens[screenNum]->grabWindow(wnd);
|
||||
return;
|
||||
}
|
||||
|
||||
KWindowInfo info(wnd, NET::XAWMState | NET::WMFrameExtents);
|
||||
|
||||
if (info.mappingState() != NET::Visible)
|
||||
qWarning() << "Window not visible";
|
||||
|
||||
QRect geometry = info.frameGeometry();
|
||||
*_pixelMap = screens[screenNum]->grabWindow(QApplication::desktop()->winId(),
|
||||
geometry.x(),
|
||||
geometry.y(),
|
||||
geometry.width(),
|
||||
geometry.height());
|
||||
grabCursor(geometry.x(), geometry.y());
|
||||
}
|
||||
|
||||
void Core::grabCursor(int offsetX, int offsetY)
|
||||
{
|
||||
#ifdef XCB_XFOXES_FOUND
|
||||
if (_conf->getIncludeCursor())
|
||||
X11Utils::compositePointer(offsetX, offsetY, _pixelMap);
|
||||
#else
|
||||
Q_UNUSED(offsetx);
|
||||
Q_UNUSED(offsety);
|
||||
#endif
|
||||
|
||||
|
||||
}
|
||||
|
||||
void Core::sendSystemNotify(const StateNotifyMessage ¬ify)
|
||||
{
|
||||
qDebug() << "Send system notification";
|
||||
}
|
||||
|
||||
QString Core::getSaveFilePath(QString format)
|
||||
{
|
||||
QString initPath;
|
||||
|
||||
do
|
||||
{
|
||||
if (_conf->getDateTimeInFilename())
|
||||
initPath = _conf->getSaveDir() + _conf->getSaveFileName() + "-" + getDateTimeFileName() + "." + format;
|
||||
else
|
||||
{
|
||||
if (_conf->getScrNum() != 0)
|
||||
initPath = _conf->getSaveDir() + _conf->getSaveFileName() + _conf->getScrNumStr() + "." + format;
|
||||
else
|
||||
initPath = _conf->getSaveDir() + _conf->getSaveFileName() + "." + format;
|
||||
}
|
||||
} while (checkExsistFile(initPath));
|
||||
|
||||
return initPath;
|
||||
}
|
||||
|
||||
bool Core::checkExsistFile(QString path)
|
||||
{
|
||||
bool exist = QFile::exists(path);
|
||||
|
||||
if (exist)
|
||||
_conf->increaseScrNum();
|
||||
|
||||
return exist;
|
||||
}
|
||||
|
||||
QString Core::getDateTimeFileName()
|
||||
{
|
||||
QString currentDateTime = QDateTime::currentDateTime().toString(_conf->getDateTimeTpl());
|
||||
|
||||
if (currentDateTime == _conf->getLastSaveDate().toString(_conf->getDateTimeTpl()) && _conf->getScrNum() != 0)
|
||||
currentDateTime += "-" + _conf->getScrNumStr();
|
||||
else
|
||||
_conf->resetScrNum();
|
||||
|
||||
return currentDateTime;
|
||||
}
|
||||
|
||||
Config *Core::config()
|
||||
{
|
||||
return _conf;
|
||||
}
|
||||
|
||||
void Core::updatePixmap()
|
||||
{
|
||||
if (QFile::exists(_tempFilename))
|
||||
{
|
||||
_pixelMap->load(_tempFilename, "png");
|
||||
_wnd->updatePixmap(_pixelMap);
|
||||
}
|
||||
}
|
||||
|
||||
QString Core::getTempFilename(const QString& format)
|
||||
{
|
||||
_tempFilename = QUuid::createUuid().toString();
|
||||
int size = _tempFilename.size() - 2;
|
||||
_tempFilename = _tempFilename.mid(1, size).left(8);
|
||||
_tempFilename = QDir::tempPath() + QDir::separator() + "screenshot-" + _tempFilename + "." + format;
|
||||
return _tempFilename;
|
||||
}
|
||||
|
||||
void Core::killTempFile()
|
||||
{
|
||||
if (QFile::exists(_tempFilename))
|
||||
{
|
||||
QFile::remove(_tempFilename);
|
||||
_tempFilename.clear();
|
||||
}
|
||||
}
|
||||
|
||||
bool Core::writeScreen(QString& fileName, QString& format, bool tmpScreen)
|
||||
{
|
||||
// adding extension format
|
||||
if (!fileName.contains("." + format))
|
||||
fileName.append("." + format);
|
||||
|
||||
// saving temp file (for uploader module)
|
||||
if (tmpScreen)
|
||||
{
|
||||
if (!fileName.isEmpty())
|
||||
return _pixelMap->save(fileName, format.toLatin1(), _conf->getImageQuality());
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
// writing file
|
||||
bool saved = false;
|
||||
if (!fileName.isEmpty())
|
||||
{
|
||||
if (format == "jpg")
|
||||
saved = _pixelMap->save(fileName,format.toLatin1(), _conf->getImageQuality());
|
||||
else
|
||||
saved = _pixelMap->save(fileName,format.toLatin1(), -1);
|
||||
|
||||
if (saved)
|
||||
{
|
||||
StateNotifyMessage message(tr("Saved"), tr("Saved to ") + fileName);
|
||||
|
||||
message.message = message.message + copyFileNameToCliipboard(fileName);
|
||||
_conf->updateLastSaveDate();
|
||||
sendNotify(message);
|
||||
}
|
||||
else
|
||||
qWarning() << "Error saving file " << fileName;
|
||||
}
|
||||
|
||||
return saved;
|
||||
}
|
||||
|
||||
QString Core::copyFileNameToCliipboard(QString file)
|
||||
{
|
||||
QString retString = "";
|
||||
switch (_conf->getAutoCopyFilenameOnSaving())
|
||||
{
|
||||
case Config::nameToClipboardFile:
|
||||
{
|
||||
file = file.section('/', -1);
|
||||
QApplication::clipboard()->setText(file);
|
||||
retString = QChar(QChar::LineSeparator) + tr("Name of saved file is copied to the clipboard");
|
||||
break;
|
||||
}
|
||||
case Config::nameToClipboardPath:
|
||||
{
|
||||
QApplication::clipboard()->setText(file);
|
||||
retString = QChar(QChar::LineSeparator) + tr("Path to saved file is copied to the clipboard");
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return retString;
|
||||
}
|
||||
|
||||
void Core::sendNotify(const StateNotifyMessage &message)
|
||||
{
|
||||
#ifdef SG_DBUS_NOTIFY
|
||||
DBusNotifier *notifier = new DBusNotifier();
|
||||
notifier->displayNotify(message);
|
||||
#else
|
||||
_wnd->showTrayMessage(message.header, message.message);
|
||||
#endif
|
||||
}
|
||||
|
||||
void Core::copyScreen()
|
||||
{
|
||||
QApplication::clipboard()->setPixmap(*_pixelMap, QClipboard::Clipboard);
|
||||
StateNotifyMessage message(tr("Copied"), tr("Screenshot is copied to clipboard"));
|
||||
sendNotify(message);
|
||||
}
|
||||
|
||||
void Core::openInExtViewer()
|
||||
{
|
||||
if (_conf->getEnableExtView())
|
||||
{
|
||||
QString format = _conf->getSaveFormat();
|
||||
if (format.isEmpty())
|
||||
format = "png";
|
||||
|
||||
QString tempFileName = getTempFilename(format);
|
||||
writeScreen(tempFileName, format, true);
|
||||
|
||||
QString exec;
|
||||
exec = "xdg-open";
|
||||
QStringList args;
|
||||
args << tempFileName;
|
||||
|
||||
QProcess *execProcess = new QProcess(this);
|
||||
|
||||
void (QProcess:: *signal)(int, QProcess::ExitStatus) = &QProcess::finished;
|
||||
connect(execProcess, signal, this, &Core::closeExtViewer);
|
||||
execProcess->start(exec, args);
|
||||
}
|
||||
}
|
||||
|
||||
void Core::closeExtViewer(int, QProcess::ExitStatus)
|
||||
{
|
||||
sender()->deleteLater();
|
||||
killTempFile();
|
||||
}
|
||||
|
||||
ModuleManager* Core::modules()
|
||||
{
|
||||
return &_modules;
|
||||
}
|
||||
|
||||
void Core::addCmdLineOption(const QCommandLineOption& option)
|
||||
{
|
||||
_cmdLine.addOption(option);
|
||||
}
|
||||
|
||||
bool Core::checkCmdLineOption(const QCommandLineOption& option)
|
||||
{
|
||||
return _cmdLine.isSet(option);
|
||||
}
|
||||
|
||||
bool Core::checkCmdLineOptions(const QStringList &options)
|
||||
{
|
||||
for (int i = 0; i < options.count(); ++i)
|
||||
if (_cmdLine.isSet(options.at(i)))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void Core::processCmdLineOpts(const QStringList& arguments)
|
||||
{
|
||||
_cmdLine.process(arguments);
|
||||
|
||||
// Check commandline parameters and set screenshot type
|
||||
for (int i=0; i < _screenTypeOpts.count(); ++i)
|
||||
if (_cmdLine.isSet(_screenTypeOpts.at(i)))
|
||||
_conf->setTypeScreen(i);
|
||||
|
||||
#ifdef SG_EXT_UPLOADS
|
||||
/// FIXMA - In module interface need add the mthod for geting module cmdLine options
|
||||
const QString UPLOAD_CMD_PARAM = "upload";
|
||||
const QString UPLOAD_CMD_PARAM_SHORT = "u";
|
||||
QCommandLineOption u(QStringList() << UPLOAD_CMD_PARAM_SHORT << UPLOAD_CMD_PARAM);
|
||||
|
||||
if (_cmdLine.isSet(u)) {
|
||||
ModuleUploader *uploader = static_cast<ModuleUploader*>(_modules.getModule(MOD_UPLOADER));
|
||||
connect(uploader, &ModuleUploader::uploadCompleteWithQuit, qApp, &QApplication::quit);
|
||||
uploader->init();
|
||||
} else
|
||||
initWindow();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
bool Core::runAsMinimized()
|
||||
{
|
||||
return (_cmdLine.isSet("minimized") || _cmdLine.isSet("m"));
|
||||
}
|
||||
|
||||
void Core::autoSave()
|
||||
{
|
||||
QString format = _conf->getSaveFormat();
|
||||
QString fileName = getSaveFilePath(format);
|
||||
writeScreen(fileName, format);
|
||||
}
|
||||
|
||||
QString Core::getVersionPrintable()
|
||||
{
|
||||
QString str = "ScreenGrab: " + qApp->applicationVersion() + QString("\n");
|
||||
str += "Qt: " + QString(qVersion()) + QString("\n");
|
||||
return str;
|
||||
}
|
||||
|
||||
QPixmap* Core::getPixmap()
|
||||
{
|
||||
return _pixelMap;
|
||||
}
|
||||
|
||||
QByteArray Core::getScreenData()
|
||||
{
|
||||
QByteArray bytes;
|
||||
QBuffer buffer(&bytes);
|
||||
buffer.open(QIODevice::WriteOnly);
|
||||
_pixelMap->save(&buffer, _conf->getSaveFormat().toLatin1());
|
||||
return bytes;
|
||||
}
|
||||
|
||||
void Core::regionGrabbed(bool grabbed)
|
||||
{
|
||||
if (grabbed)
|
||||
{
|
||||
*_pixelMap = _selector->getSelection();
|
||||
|
||||
int x = _selector->getSelectionStartPos().x();
|
||||
int y = _selector->getSelectionStartPos().y();
|
||||
int w = _pixelMap->rect().width();
|
||||
int h = _pixelMap->rect().height();
|
||||
_lastSelectedArea.setRect(x, y, w, h);
|
||||
|
||||
checkAutoSave();
|
||||
}
|
||||
|
||||
_wnd->updatePixmap(_pixelMap);
|
||||
_selector->deleteLater();
|
||||
}
|
142
src/core/core.h
142
src/core/core.h
@ -1,142 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
#ifndef SCREENGRAB_H
|
||||
#define SCREENGRAB_H
|
||||
|
||||
#ifndef STR_PROC
|
||||
#define STR_PROC "screengrab-qt"
|
||||
#endif
|
||||
|
||||
#include "config.h"
|
||||
#include "regionselect.h"
|
||||
#include "modulemanager.h"
|
||||
|
||||
#include "ui/mainwindow.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QTimer>
|
||||
#include <QPixmap>
|
||||
#include <QClipboard>
|
||||
#include <QTime>
|
||||
#include <QByteArray>
|
||||
#include <QRect>
|
||||
#include <QProcess>
|
||||
#include <QX11Info>
|
||||
#include <QCommandLineParser>
|
||||
#include <QCommandLineOption>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
struct StateNotifyMessage {
|
||||
QString header;
|
||||
QString message;
|
||||
|
||||
StateNotifyMessage()
|
||||
{
|
||||
header = "";
|
||||
message = "";
|
||||
};
|
||||
|
||||
StateNotifyMessage(QString h, QString m)
|
||||
{
|
||||
header = h;
|
||||
message = m;
|
||||
};
|
||||
};
|
||||
|
||||
class Core : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public Q_SLOTS:
|
||||
void coreQuit();
|
||||
void setScreen();
|
||||
|
||||
void screenShot(bool first = false);
|
||||
void autoSave();
|
||||
|
||||
public:
|
||||
static Core* instance();
|
||||
~Core();
|
||||
|
||||
void initWindow(const QString& ipcMessage = QString());
|
||||
|
||||
|
||||
void sleep(int msec = 350);
|
||||
static QString getVersionPrintable();
|
||||
|
||||
QPixmap* getPixmap();
|
||||
QByteArray getScreenData();
|
||||
|
||||
void updatePixmap();
|
||||
QString getTempFilename(const QString& format);
|
||||
void killTempFile();
|
||||
bool writeScreen(QString& fileName, QString& format, bool tmpScreen = false);
|
||||
void copyScreen();
|
||||
void openInExtViewer();
|
||||
|
||||
ModuleManager* modules();
|
||||
void addCmdLineOption(const QCommandLineOption& option);
|
||||
bool checkCmdLineOption(const QCommandLineOption& option);
|
||||
bool checkCmdLineOptions(const QStringList& options);
|
||||
void processCmdLineOpts(const QStringList& arguments);
|
||||
|
||||
bool runAsMinimized();
|
||||
|
||||
QString getSaveFilePath(QString format);
|
||||
QString getDateTimeFileName();
|
||||
Config* config();
|
||||
|
||||
private:
|
||||
Core();
|
||||
Core(const Core &);
|
||||
Core& operator=(const Core &);
|
||||
|
||||
static Core *corePtr;
|
||||
|
||||
void checkAutoSave(bool first = false);
|
||||
|
||||
void getActiveWindow();
|
||||
void grabCursor(int offsetX, int offsetY);
|
||||
void sendSystemNotify(const StateNotifyMessage& notify);
|
||||
bool checkExsistFile(QString path);
|
||||
QString copyFileNameToCliipboard(QString file);
|
||||
void sendNotify(const StateNotifyMessage& message);
|
||||
|
||||
QPixmap *_pixelMap; // pixel map
|
||||
RegionSelect *_selector; // region grabber widget
|
||||
QRect _lastSelectedArea;
|
||||
|
||||
QCommandLineParser _cmdLine;
|
||||
ModuleManager _modules;
|
||||
QString _tempFilename;
|
||||
Config *_conf;
|
||||
MainWindow *_wnd;
|
||||
|
||||
bool _hided;
|
||||
bool _firstScreen;
|
||||
|
||||
QList<QCommandLineOption> _screenTypeOpts;
|
||||
|
||||
private Q_SLOTS:
|
||||
void regionGrabbed(bool grabbed);
|
||||
void closeExtViewer(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
|
||||
};
|
||||
|
||||
#endif // SCREENGRAB_H
|
@ -1,106 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#include <QDBusConnection>
|
||||
#include <QDBusConnectionInterface>
|
||||
#include <QDBusInterface>
|
||||
#include <QDir>
|
||||
#include <QTimer>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#include "dbusnotifier.h"
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#define SERVICE_FREEDESKTOP "org.freedesktop.Notifications"
|
||||
#define PATH_FREEDESKTOP "/org/freedesktop/Notifications" ,"org.freedesktop.Notifications"
|
||||
|
||||
#define CACHE_DIR "notify-cache"
|
||||
#define CACHE_PREV "preview.jpg"
|
||||
|
||||
DBusNotifier::DBusNotifier(QObject *parent) : QObject(parent)
|
||||
{
|
||||
_notifier = new QDBusInterface(SERVICE_FREEDESKTOP, PATH_FREEDESKTOP,
|
||||
QDBusConnection::sessionBus(), this);
|
||||
if (_notifier->lastError().type() != QDBusError::NoError) {
|
||||
qWarning() << "Notify: Unable to create interface.";
|
||||
return;
|
||||
}
|
||||
|
||||
qWarning() << "Notify: DBus interfece created successfully.";
|
||||
|
||||
QDir dir(Config::getConfigDir());
|
||||
if (!dir.exists(CACHE_DIR))
|
||||
dir.mkdir(CACHE_DIR);
|
||||
|
||||
_previewPath = dir.absolutePath() + QDir::toNativeSeparators(QDir::separator()) + CACHE_PREV;
|
||||
_appIconPath = QString(SG_ICONPATH);
|
||||
|
||||
_notifyDuration = Config::instance()->getTimeTrayMess() * 1000;
|
||||
|
||||
}
|
||||
|
||||
DBusNotifier::~DBusNotifier()
|
||||
{
|
||||
if (!_previewPath.isEmpty()) {
|
||||
QDir dir(QDir::home());
|
||||
dir.remove(_previewPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DBusNotifier::displayNotify(const StateNotifyMessage &message)
|
||||
{
|
||||
QList<QVariant> n = prepareNotification(message);
|
||||
|
||||
if (!n.isEmpty()) {
|
||||
QDBusReply<uint> reply = _notifier->callWithArgumentList(QDBus::Block,"Notify",n);
|
||||
}
|
||||
|
||||
deleteLater();
|
||||
}
|
||||
|
||||
QList<QVariant> DBusNotifier::prepareNotification(const StateNotifyMessage& message)
|
||||
{
|
||||
QList<QVariant> args;
|
||||
|
||||
args << "Screen Grab";
|
||||
args << QVariant(QVariant::UInt); // id
|
||||
|
||||
// app-icon(path to icon on disk)
|
||||
args << _appIconPath;
|
||||
|
||||
// summary (notification title)
|
||||
args << message.header;
|
||||
|
||||
// message text
|
||||
args << message.message;
|
||||
|
||||
// actions is none
|
||||
args << QStringList();
|
||||
|
||||
// hints
|
||||
args << QVariantMap();
|
||||
|
||||
// timeout
|
||||
args << _notifyDuration;
|
||||
|
||||
return args;
|
||||
}
|
||||
|
@ -1,46 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef DBUSNOTIFIER_H
|
||||
#define DBUSNOTIFIER_H
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "core.h"
|
||||
|
||||
class QDBusInterface;
|
||||
|
||||
class DBusNotifier : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DBusNotifier(QObject *parent = 0);
|
||||
~DBusNotifier();
|
||||
|
||||
void displayNotify(const StateNotifyMessage& message);
|
||||
|
||||
private:
|
||||
QList<QVariant> prepareNotification(const StateNotifyMessage& message);
|
||||
|
||||
QDBusInterface *_notifier;
|
||||
int _notifyDuration;
|
||||
QString _appIconPath;
|
||||
QString _previewPath;
|
||||
};
|
||||
|
||||
#endif // DBUSNOTIFIER_H
|
@ -1,43 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "singleapp.h"
|
||||
#include "core/core.h"
|
||||
#include "ui/mainwindow.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
SingleApp scr(argc, argv, VERSION);
|
||||
scr.setApplicationVersion(VERSION);
|
||||
Core *ScreenGrab = Core::instance();
|
||||
ScreenGrab->modules()->initModules();
|
||||
ScreenGrab->processCmdLineOpts(scr.arguments());
|
||||
|
||||
QObject::connect(&scr, &SingleApp::messageReceived, ScreenGrab, &Core::initWindow);
|
||||
|
||||
if (!ScreenGrab->config()->getAllowMultipleInstance() && scr.isRunning())
|
||||
{
|
||||
QString type = QString::number(ScreenGrab->config()->getTypeScreen());
|
||||
scr.sendMessage("screengrab --type=" + type);
|
||||
return 0;
|
||||
}
|
||||
|
||||
return scr.exec();
|
||||
}
|
@ -1,118 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "modulemanager.h"
|
||||
|
||||
#ifdef SG_EXT_UPLOADS
|
||||
#include "src/modules/uploader/moduleuploader.h"
|
||||
#endif
|
||||
|
||||
#ifdef SG_EXT_EDIT
|
||||
#include "src/modules/extedit/moduleextedit.h"
|
||||
#endif
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
ModuleManager::ModuleManager()
|
||||
{
|
||||
_modules = new ModuleList_t();
|
||||
}
|
||||
|
||||
void ModuleManager::initModules()
|
||||
{
|
||||
#ifdef SG_EXT_UPLOADS
|
||||
ModuleUploader *uploader = new ModuleUploader();
|
||||
_modules->insert(MOD_UPLOADER , uploader);
|
||||
#endif
|
||||
#ifdef SG_EXT_EDIT
|
||||
ModuleExtEdit *extedit = new ModuleExtEdit();
|
||||
_modules->insert(MOD_EXT_EDIT.data(), extedit);
|
||||
#endif
|
||||
}
|
||||
|
||||
AbstractModule* ModuleManager::getModule(const QByteArray& name)
|
||||
{
|
||||
if (_modules->contains(name))
|
||||
return _modules->value(name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
AbstractModule* ModuleManager::getModule(const quint8 numid)
|
||||
{
|
||||
if (numid < _modules->count())
|
||||
{
|
||||
QByteArray key = _modules->keys().at(numid);
|
||||
return _modules->value(key);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
QList<QMenu*> ModuleManager::generateModulesMenus(QStringList modules)
|
||||
{
|
||||
QList<QMenu*> list;
|
||||
if (modules.isEmpty() == true)
|
||||
{
|
||||
for (int i =0; i < _modules->keys().count(); ++i)
|
||||
{
|
||||
QMenu *menu = _modules->value(_modules->keys().at(i))->initModuleMenu();
|
||||
list.append(menu);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < modules.count(); ++i)
|
||||
{
|
||||
QByteArray currentKey = modules.at(i).toLatin1();
|
||||
QMenu *menu = _modules->value(currentKey)->initModuleMenu();
|
||||
list.append(menu);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
QList<QAction*> ModuleManager::generateModulesActions(QStringList modules)
|
||||
{
|
||||
QList<QAction*> list;
|
||||
|
||||
if (modules.isEmpty())
|
||||
{
|
||||
for (int i =0; i < _modules->keys().count(); ++i)
|
||||
{
|
||||
QAction *action = _modules->value(_modules->keys().at(i))->initModuleAction();
|
||||
list.append(action);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < modules.count(); ++i)
|
||||
{
|
||||
QByteArray currentKey = modules.at(i).toLatin1();
|
||||
QAction *action = _modules->value(currentKey)->initModuleAction();
|
||||
list.append(action);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
quint8 ModuleManager::count()
|
||||
{
|
||||
return _modules->count();
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef MODULEMANAGER_H
|
||||
#define MODULEMANAGER_H
|
||||
|
||||
#include "modules/abstractmodule.h"
|
||||
|
||||
#include <QByteArray>
|
||||
#include <QHash>
|
||||
#include <QMap>
|
||||
#include <QMenu>
|
||||
|
||||
#include <QAction>
|
||||
|
||||
const QByteArray MOD_UPLOADER = "uploader";
|
||||
const QByteArray MOD_EXT_EDIT = "extedit";
|
||||
|
||||
typedef QMap<QByteArray, AbstractModule*> ModuleList_t;
|
||||
|
||||
class ModuleManager
|
||||
{
|
||||
public:
|
||||
ModuleManager();
|
||||
void initModules();
|
||||
AbstractModule* getModule(const QByteArray& name);
|
||||
AbstractModule* getModule(const quint8 numid);
|
||||
QList<QMenu*> generateModulesMenus(QStringList modules = QStringList());
|
||||
QList<QAction*> generateModulesActions(QStringList modules = QStringList());
|
||||
quint8 count();
|
||||
|
||||
private:
|
||||
ModuleList_t *_modules;
|
||||
};
|
||||
|
||||
#endif // MODULEMANAGER_H
|
@ -1,229 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "src/core/regionselect.h"
|
||||
|
||||
#include <QDesktopWidget>
|
||||
#include <QApplication>
|
||||
#include <QScreen>
|
||||
|
||||
RegionSelect::RegionSelect(Config *mainconf, QWidget *parent)
|
||||
:QWidget(parent)
|
||||
{
|
||||
_conf = mainconf;
|
||||
sharedInit();
|
||||
|
||||
move(0, 0);
|
||||
drawBackGround();
|
||||
|
||||
_processSelection = false;
|
||||
|
||||
show();
|
||||
|
||||
grabKeyboard();
|
||||
grabMouse();
|
||||
}
|
||||
|
||||
RegionSelect::RegionSelect(Config* mainconf, const QRect& lastRect, QWidget* parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
_conf = mainconf;
|
||||
sharedInit();
|
||||
_selectRect = lastRect;
|
||||
|
||||
move(0, 0);
|
||||
drawBackGround();
|
||||
|
||||
_processSelection = false;
|
||||
|
||||
show();
|
||||
|
||||
grabKeyboard();
|
||||
grabMouse();
|
||||
}
|
||||
|
||||
RegionSelect::~RegionSelect()
|
||||
{
|
||||
_conf = NULL;
|
||||
delete _conf;
|
||||
}
|
||||
|
||||
void RegionSelect::sharedInit()
|
||||
{
|
||||
setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint);
|
||||
setWindowState(Qt::WindowFullScreen);
|
||||
setCursor(Qt::CrossCursor);
|
||||
|
||||
_sizeDesktop = QApplication::desktop()->size();
|
||||
resize(_sizeDesktop);
|
||||
|
||||
const QList<QScreen *> screens = qApp->screens();
|
||||
const QDesktopWidget *desktop = QApplication::desktop();
|
||||
const int screenNum = desktop->screenNumber(QCursor::pos());
|
||||
|
||||
if (screenNum < screens.count()) {
|
||||
_desktopPixmapBkg = screens[screenNum]->grabWindow(desktop->winId());
|
||||
}
|
||||
|
||||
_desktopPixmapClr = _desktopPixmapBkg;
|
||||
}
|
||||
|
||||
void RegionSelect::paintEvent(QPaintEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
QPainter painter(this);
|
||||
|
||||
painter.drawPixmap(QPoint(0, 0), _desktopPixmapBkg);
|
||||
|
||||
drawRectSelection(painter);
|
||||
}
|
||||
|
||||
void RegionSelect::mousePressEvent(QMouseEvent* event)
|
||||
{
|
||||
if (event->button() != Qt::LeftButton)
|
||||
return;
|
||||
|
||||
_selStartPoint = event->pos();
|
||||
_processSelection = true;
|
||||
}
|
||||
|
||||
void RegionSelect::mouseReleaseEvent(QMouseEvent* event)
|
||||
{
|
||||
_selEndPoint = event->pos();
|
||||
_processSelection = false;
|
||||
}
|
||||
|
||||
void RegionSelect::mouseDoubleClickEvent(QMouseEvent* event)
|
||||
{
|
||||
if (event->button() != Qt::LeftButton)
|
||||
return;
|
||||
|
||||
Q_EMIT processDone(true);
|
||||
}
|
||||
|
||||
void RegionSelect::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
if (_processSelection)
|
||||
{
|
||||
_selEndPoint = event->pos();
|
||||
_selectRect = QRect(_selStartPoint, _selEndPoint).normalized();
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
void RegionSelect::keyPressEvent(QKeyEvent* event)
|
||||
{
|
||||
// canceled select screen area
|
||||
if (event->key() == Qt::Key_Escape)
|
||||
Q_EMIT processDone(false);
|
||||
// canceled select screen area
|
||||
else if (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)
|
||||
Q_EMIT processDone(true);
|
||||
else
|
||||
event->ignore();
|
||||
}
|
||||
|
||||
void RegionSelect::drawBackGround()
|
||||
{
|
||||
// create painter on pixelmap of desktop
|
||||
QPainter painter(&_desktopPixmapBkg);
|
||||
|
||||
// set painter brush on 85% transparency
|
||||
painter.setBrush(QBrush(QColor(0, 0, 0, 85), Qt::SolidPattern));
|
||||
|
||||
// draw rect of desktop size in poainter
|
||||
painter.drawRect(QApplication::desktop()->rect());
|
||||
|
||||
QRect txtRect = QApplication::desktop()->screenGeometry(QApplication::desktop()->primaryScreen());
|
||||
QString txtTip = QApplication::tr("Use your mouse to draw a rectangle to screenshot or exit pressing\nany key or using the right or middle mouse buttons.");
|
||||
|
||||
txtRect.setHeight(qRound((float) (txtRect.height() / 10))); // rounded val of text rect height
|
||||
|
||||
painter.setPen(QPen(Qt::red)); // ste message rect border color
|
||||
painter.setBrush(QBrush(QColor(255, 255, 255, 180), Qt::SolidPattern));
|
||||
QRect txtBgRect = painter.boundingRect(txtRect, Qt::AlignCenter, txtTip);
|
||||
|
||||
// set height & width of bkg rect
|
||||
txtBgRect.setX(txtBgRect.x() - 6);
|
||||
txtBgRect.setY(txtBgRect.y() - 4);
|
||||
txtBgRect.setWidth(txtBgRect.width() + 12);
|
||||
txtBgRect.setHeight(txtBgRect.height() + 8);
|
||||
|
||||
painter.drawRect(txtBgRect);
|
||||
|
||||
// Draw the text
|
||||
painter.setPen(QPen(Qt::black)); // black color pen
|
||||
painter.drawText(txtBgRect, Qt::AlignCenter, txtTip);
|
||||
|
||||
// set bkg to pallette widget
|
||||
QPalette newPalette = palette();
|
||||
newPalette.setBrush(QPalette::Window, QBrush(_desktopPixmapBkg));
|
||||
setPalette(newPalette);
|
||||
}
|
||||
|
||||
void RegionSelect::drawRectSelection(QPainter &painter)
|
||||
{
|
||||
painter.drawPixmap(_selectRect, _desktopPixmapClr, _selectRect);
|
||||
painter.setPen(QPen(QBrush(QColor(0, 0, 0, 255)), 2));
|
||||
painter.drawRect(_selectRect);
|
||||
|
||||
QString txtSize = QApplication::tr("%1 x %2 pixels ").arg(_selectRect.width()).arg(_selectRect.height());
|
||||
painter.drawText(_selectRect, Qt::AlignBottom | Qt::AlignRight, txtSize);
|
||||
|
||||
if (!_selEndPoint.isNull() && _conf->getZoomAroundMouse())
|
||||
{
|
||||
const quint8 zoomSide = 200;
|
||||
|
||||
// create magnifer coords
|
||||
QPoint zoomStart = _selEndPoint;
|
||||
zoomStart -= QPoint(zoomSide/5, zoomSide/5); // 40, 40
|
||||
|
||||
QPoint zoomEnd = _selEndPoint;
|
||||
zoomEnd += QPoint(zoomSide/5, zoomSide/5);
|
||||
|
||||
// creating rect area for magnifer
|
||||
QRect zoomRect = QRect(zoomStart, zoomEnd);
|
||||
|
||||
QPixmap zoomPixmap = _desktopPixmapClr.copy(zoomRect).scaled(QSize(zoomSide, zoomSide), Qt::KeepAspectRatio);
|
||||
|
||||
QPainter zoomPainer(&zoomPixmap); // create painter from pixmap maignifer
|
||||
zoomPainer.setPen(QPen(QBrush(QColor(255, 0, 0, 180)), 2));
|
||||
zoomPainer.drawRect(zoomPixmap.rect()); // draw
|
||||
zoomPainer.drawText(zoomPixmap.rect().center() - QPoint(4, -4), "+");
|
||||
|
||||
// position for drawing preview
|
||||
QPoint zoomCenter = _selectRect.bottomRight();
|
||||
|
||||
if (zoomCenter.x() + zoomSide > _desktopPixmapClr.rect().width()
|
||||
|| zoomCenter.y() + zoomSide > _desktopPixmapClr.rect().height())
|
||||
zoomCenter -= QPoint(zoomSide, zoomSide);
|
||||
painter.drawPixmap(zoomCenter, zoomPixmap);
|
||||
}
|
||||
}
|
||||
|
||||
QPixmap RegionSelect::getSelection()
|
||||
{
|
||||
QPixmap sel;
|
||||
sel = _desktopPixmapClr.copy(_selectRect);
|
||||
return sel;
|
||||
}
|
||||
|
||||
QPoint RegionSelect::getSelectionStartPos()
|
||||
{
|
||||
return _selectRect.topLeft();
|
||||
}
|
@ -1,75 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef REGIONSELECT_H
|
||||
#define REGIONSELECT_H
|
||||
|
||||
#include "config.h"
|
||||
|
||||
//#include <QDialog>
|
||||
#include <QWidget>
|
||||
|
||||
#include <QMouseEvent>
|
||||
#include <QPainter>
|
||||
#include <QPixmap>
|
||||
#include <QSize>
|
||||
#include <QPoint>
|
||||
|
||||
// class RegionSelect : public QDialog
|
||||
class RegionSelect : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RegionSelect(Config *mainconf, QWidget *parent = 0);
|
||||
RegionSelect(Config *mainconf, const QRect& lastRect, QWidget *parent = 0);
|
||||
virtual ~RegionSelect();
|
||||
QPixmap getSelection();
|
||||
QPoint getSelectionStartPos();
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
void mouseReleaseEvent(QMouseEvent *event);
|
||||
void mouseDoubleClickEvent(QMouseEvent *event);
|
||||
void mouseMoveEvent(QMouseEvent *event);
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
|
||||
Q_SIGNALS:
|
||||
void processDone(bool grabbed);
|
||||
|
||||
private:
|
||||
QRect _selectRect;
|
||||
QSize _sizeDesktop;
|
||||
|
||||
QPoint _selStartPoint;
|
||||
QPoint _selEndPoint;
|
||||
|
||||
bool _processSelection;
|
||||
|
||||
QPixmap _desktopPixmapBkg;
|
||||
QPixmap _desktopPixmapClr;
|
||||
|
||||
void sharedInit();
|
||||
void drawBackGround();
|
||||
void drawRectSelection(QPainter &painter);
|
||||
|
||||
Config *_conf;
|
||||
|
||||
};
|
||||
|
||||
#endif // REGIONSELECT_H
|
@ -1,147 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "shortcutmanager.h"
|
||||
#include "src/core/config.h"
|
||||
|
||||
const QString DEF_SHORTCUT_NEW = "Ctrl+N";
|
||||
const QString DEF_SHORTCUT_SAVE = "Ctrl+S";
|
||||
const QString DEF_SHORTCUT_COPY = "Ctrl+C";
|
||||
const QString DEF_SHORTCUT_OPT = "Ctrl+P";
|
||||
const QString DEF_SHORTCUT_HELP = "F1";
|
||||
const QString DEF_SHORTCUT_CLOSE = "Esc";
|
||||
const QString DEF_SHORTCUT_FULL = "";
|
||||
const QString DEF_SHORTCUT_ACTW = "";
|
||||
const QString DEF_SHORTCUT_AREA = "";
|
||||
|
||||
const QString KEY_SHORTCUT_FULL = "FullScreen";
|
||||
const QString KEY_SHORTCUT_ACTW = "ActiveWindow";
|
||||
const QString KEY_SHORTCUT_AREA = "AreaSelection";
|
||||
const QString KEY_SHORTCUT_NEW = "NewScreen";
|
||||
const QString KEY_SHORTCUT_SAVE = "SaveScreen";
|
||||
const QString KEY_SHORTCUT_COPY = "CopyScreen";
|
||||
const QString KEY_SHORTCUT_OPT = "Options";
|
||||
const QString KEY_SHORTCUT_HELP = "Help";
|
||||
const QString KEY_SHORTCUT_CLOSE = "Close";
|
||||
|
||||
ShortcutManager::ShortcutManager(QSettings *settings) :
|
||||
_shortcutSettings(new QSettings)
|
||||
{
|
||||
_shortcutSettings = settings;
|
||||
|
||||
for (int i = Config::shortcutFullScreen; i <= Config::shortcutClose; ++i)
|
||||
_listShortcuts << Shortcut();
|
||||
}
|
||||
|
||||
ShortcutManager::~ShortcutManager()
|
||||
{
|
||||
_shortcutSettings = NULL;
|
||||
delete _shortcutSettings;
|
||||
}
|
||||
|
||||
void ShortcutManager::loadSettings()
|
||||
{
|
||||
_shortcutSettings->beginGroup("LocalShortcuts");
|
||||
setShortcut(_shortcutSettings->value(KEY_SHORTCUT_NEW, DEF_SHORTCUT_NEW).toString(),
|
||||
Config::shortcutNew, Config::localShortcut);
|
||||
setShortcut(_shortcutSettings->value(KEY_SHORTCUT_SAVE, DEF_SHORTCUT_SAVE).toString(),
|
||||
Config::shortcutSave, Config::localShortcut);
|
||||
setShortcut(_shortcutSettings->value(KEY_SHORTCUT_COPY, DEF_SHORTCUT_COPY).toString(),
|
||||
Config::shortcutCopy, Config::localShortcut);
|
||||
setShortcut(_shortcutSettings->value(KEY_SHORTCUT_OPT, DEF_SHORTCUT_OPT).toString(),
|
||||
Config::shortcutOptions, Config::localShortcut);
|
||||
setShortcut(_shortcutSettings->value(KEY_SHORTCUT_HELP, DEF_SHORTCUT_HELP).toString(),
|
||||
Config::shortcutHelp, Config::localShortcut);
|
||||
setShortcut(_shortcutSettings->value(KEY_SHORTCUT_CLOSE, DEF_SHORTCUT_CLOSE).toString(),
|
||||
Config::shortcutClose, Config::localShortcut);
|
||||
_shortcutSettings->endGroup();
|
||||
|
||||
_shortcutSettings->beginGroup("GlobalShortcuts");
|
||||
setShortcut(_shortcutSettings->value(KEY_SHORTCUT_FULL, DEF_SHORTCUT_FULL).toString(),
|
||||
Config::shortcutFullScreen, Config::globalShortcut);
|
||||
setShortcut(_shortcutSettings->value(KEY_SHORTCUT_ACTW, DEF_SHORTCUT_ACTW).toString(),
|
||||
Config::shortcutActiveWnd, Config::globalShortcut);
|
||||
setShortcut(_shortcutSettings->value(KEY_SHORTCUT_AREA, DEF_SHORTCUT_AREA).toString(),
|
||||
Config::shortcutAreaSelect, Config::globalShortcut);
|
||||
_shortcutSettings->endGroup();
|
||||
}
|
||||
|
||||
void ShortcutManager::saveSettings()
|
||||
{
|
||||
_shortcutSettings->beginGroup("LocalShortcuts");
|
||||
_shortcutSettings->setValue(KEY_SHORTCUT_NEW, getShortcut(Config::shortcutNew));
|
||||
_shortcutSettings->setValue(KEY_SHORTCUT_SAVE, getShortcut(Config::shortcutSave));
|
||||
_shortcutSettings->setValue(KEY_SHORTCUT_COPY, getShortcut(Config::shortcutCopy));
|
||||
_shortcutSettings->setValue(KEY_SHORTCUT_OPT, getShortcut(Config::shortcutOptions));
|
||||
_shortcutSettings->setValue(KEY_SHORTCUT_HELP, getShortcut(Config::shortcutHelp));
|
||||
_shortcutSettings->setValue(KEY_SHORTCUT_CLOSE, getShortcut(Config::shortcutClose));
|
||||
_shortcutSettings->endGroup();
|
||||
|
||||
_shortcutSettings->beginGroup("GlobalShortcuts");
|
||||
_shortcutSettings->setValue(KEY_SHORTCUT_FULL, getShortcut(Config::shortcutFullScreen));
|
||||
_shortcutSettings->setValue(KEY_SHORTCUT_ACTW, getShortcut(Config::shortcutActiveWnd));
|
||||
_shortcutSettings->setValue(KEY_SHORTCUT_AREA, getShortcut(Config::shortcutAreaSelect));
|
||||
_shortcutSettings->endGroup();
|
||||
}
|
||||
|
||||
void ShortcutManager::setDefaultSettings()
|
||||
{
|
||||
setShortcut(DEF_SHORTCUT_NEW,Config::shortcutNew, Config::localShortcut);
|
||||
setShortcut(DEF_SHORTCUT_SAVE,Config::shortcutSave, Config::localShortcut);
|
||||
setShortcut(DEF_SHORTCUT_COPY,Config::shortcutCopy, Config::localShortcut);
|
||||
setShortcut(DEF_SHORTCUT_OPT,Config::shortcutOptions, Config::localShortcut);
|
||||
setShortcut(DEF_SHORTCUT_HELP,Config::shortcutHelp, Config::localShortcut);
|
||||
setShortcut(DEF_SHORTCUT_CLOSE,Config::shortcutClose, Config::localShortcut);
|
||||
|
||||
setShortcut(DEF_SHORTCUT_FULL,Config::shortcutFullScreen, Config::globalShortcut);
|
||||
setShortcut(DEF_SHORTCUT_ACTW,Config::shortcutActiveWnd, Config::globalShortcut);
|
||||
setShortcut(DEF_SHORTCUT_AREA,Config::shortcutAreaSelect, Config::globalShortcut);
|
||||
}
|
||||
|
||||
void ShortcutManager::setShortcut(QString key, int action, int type)
|
||||
{
|
||||
_listShortcuts[action].key = key;
|
||||
_listShortcuts[action].action = action;
|
||||
_listShortcuts[action].type = type;
|
||||
}
|
||||
|
||||
QKeySequence ShortcutManager::getShortcut(int action)
|
||||
{
|
||||
return QKeySequence(_listShortcuts[action].key);;
|
||||
}
|
||||
|
||||
int ShortcutManager::getShortcutType(int action)
|
||||
{
|
||||
return _listShortcuts[action].type;
|
||||
}
|
||||
|
||||
QStringList ShortcutManager::getShortcutsList(int type)
|
||||
{
|
||||
QStringList retList;
|
||||
for (int i = Config::shortcutFullScreen; i <= Config::shortcutClose; ++i)
|
||||
{
|
||||
if (_listShortcuts[i].type == type)
|
||||
{
|
||||
if (!_listShortcuts[i].key.isNull())
|
||||
retList << _listShortcuts[i].key;
|
||||
else
|
||||
retList << QString("");
|
||||
}
|
||||
}
|
||||
return retList;
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef SHORTCUTMANAGER_H
|
||||
#define SHORTCUTMANAGER_H
|
||||
|
||||
#include <QSettings>
|
||||
#include <QVector>
|
||||
#include <QStringList>
|
||||
#include <QKeySequence>
|
||||
|
||||
struct Shortcut {
|
||||
QString key;
|
||||
int type;
|
||||
int action;
|
||||
Shortcut() {};
|
||||
Shortcut(QString k, int t, int a)
|
||||
{
|
||||
key = k;
|
||||
type = t;
|
||||
action = a;
|
||||
}
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(Shortcut)
|
||||
|
||||
typedef QVector<Shortcut> ShortcutList;
|
||||
|
||||
class ShortcutManager
|
||||
{
|
||||
public:
|
||||
ShortcutManager(QSettings *settings);
|
||||
~ShortcutManager();
|
||||
|
||||
void loadSettings();
|
||||
void saveSettings();
|
||||
void setDefaultSettings();
|
||||
|
||||
void setShortcut(QString key, int action, int type);
|
||||
QKeySequence getShortcut(int action);
|
||||
int getShortcutType(int action);
|
||||
QStringList getShortcutsList(int type);
|
||||
|
||||
private:
|
||||
ShortcutList _listShortcuts;
|
||||
QSettings *_shortcutSettings;
|
||||
};
|
||||
|
||||
#endif // SHORTCUTMANAGER_H
|
@ -1,103 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2010 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#include <QTimer>
|
||||
#include <QByteArray>
|
||||
|
||||
#include <QLocalSocket>
|
||||
#include "singleapp.h"
|
||||
|
||||
/*!
|
||||
Creates of sungle application object
|
||||
\param argc Nuber of command line arguments
|
||||
\param argv Array of command line argwuments
|
||||
\param uniqueKey String key fo unicue shared data indefier
|
||||
*/
|
||||
SingleApp::SingleApp(int& argc, char* argv[], const QString keyString) : QApplication(argc, argv), uniqueKey(keyString)
|
||||
{
|
||||
sharedMemory.setKey(uniqueKey);
|
||||
if (sharedMemory.attach())
|
||||
runned = true;
|
||||
else
|
||||
{
|
||||
runned = false;
|
||||
// create shared memory.
|
||||
if (!sharedMemory.create(1))
|
||||
{
|
||||
qDebug("Unable to create single instance.");
|
||||
return;
|
||||
}
|
||||
// create local server and listen to incomming messages from other instances.
|
||||
localServer = new QLocalServer(this);
|
||||
connect(localServer, SIGNAL(newConnection()), this, SLOT(receiveMessage()));
|
||||
localServer->listen(uniqueKey);
|
||||
}
|
||||
}
|
||||
|
||||
// public slots.
|
||||
|
||||
void SingleApp::receiveMessage()
|
||||
{
|
||||
QLocalSocket *localSocket = localServer->nextPendingConnection();
|
||||
if (!localSocket->waitForReadyRead(timeout))
|
||||
{
|
||||
qDebug("%s", qPrintable(localSocket->errorString().toLatin1()));
|
||||
return;
|
||||
}
|
||||
QByteArray byteArray = localSocket->readAll();
|
||||
QString message = QString::fromUtf8(byteArray.constData());
|
||||
emit messageReceived(message);
|
||||
localSocket->disconnectFromServer();
|
||||
}
|
||||
|
||||
// public functions.
|
||||
|
||||
/*!
|
||||
Checking instance application
|
||||
\return bool Return tue is another instance running
|
||||
*/
|
||||
bool SingleApp::isRunning()
|
||||
{
|
||||
return runned;
|
||||
}
|
||||
|
||||
/*1
|
||||
Sending message to another running instance of application
|
||||
\param message String dended message
|
||||
\tryitn bool Return status ofsending message process
|
||||
*/
|
||||
bool SingleApp::sendMessage(const QString &message)
|
||||
{
|
||||
if (!runned)
|
||||
return false;
|
||||
QLocalSocket localSocket(this);
|
||||
localSocket.connectToServer(uniqueKey, QIODevice::WriteOnly);
|
||||
if (!localSocket.waitForConnected(timeout))
|
||||
{
|
||||
qDebug("%s",qPrintable(localSocket.errorString().toLatin1()));
|
||||
return false;
|
||||
}
|
||||
localSocket.write(message.toUtf8());
|
||||
if (!localSocket.waitForBytesWritten(timeout))
|
||||
{
|
||||
qDebug("%s",qPrintable(localSocket.errorString().toLatin1()));
|
||||
return false;
|
||||
}
|
||||
localSocket.disconnectFromServer();
|
||||
return true;
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2010 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef SINGLEAPP_H
|
||||
#define SINGLEAPP_H
|
||||
|
||||
#include <QApplication>
|
||||
#include <QSharedMemory>
|
||||
#include <QLocalServer>
|
||||
|
||||
class SingleApp : public QApplication
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
SingleApp(int &argc, char *argv[], const QString keyString);
|
||||
|
||||
bool isRunning();
|
||||
bool sendMessage(const QString &message);
|
||||
|
||||
public Q_SLOTS:
|
||||
void receiveMessage();
|
||||
|
||||
Q_SIGNALS:
|
||||
void messageReceived(const QString& message);
|
||||
|
||||
private:
|
||||
bool runned;
|
||||
QString uniqueKey;
|
||||
QSharedMemory sharedMemory;
|
||||
QLocalServer *localServer;
|
||||
|
||||
static const int timeout = 1000;
|
||||
};
|
||||
|
||||
#endif // SINGLEAPP_H
|
@ -1,186 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "about.h"
|
||||
#include "ui_aboutwidget.h"
|
||||
|
||||
#include "../core.h"
|
||||
#include <QDesktopServices>
|
||||
|
||||
AboutDialog::AboutDialog(QWidget *parent):
|
||||
QDialog(parent),
|
||||
_ui(new Ui::aboutWidget)
|
||||
{
|
||||
setWindowFlags(Qt::Dialog | Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::WindowCloseButtonHint | Qt::WindowSystemMenuHint);
|
||||
|
||||
_ui->setupUi(this);
|
||||
_ui->labAppName->setText(_ui->labAppName->text() + QString(" <b>") + qApp->applicationVersion() + QString("</b>"));
|
||||
|
||||
QString versionInfo;
|
||||
versionInfo = tr("built on ");
|
||||
versionInfo.append(__DATE__);
|
||||
versionInfo.append(" ");
|
||||
versionInfo.append(__TIME__);
|
||||
|
||||
_ui->labQtVer->setText(tr("using Qt ") + qVersion());
|
||||
|
||||
_ui->labVersion->setText(versionInfo);
|
||||
|
||||
QTabBar *tabs = new QTabBar;
|
||||
|
||||
_ui->frame->layout()->addWidget(tabs);
|
||||
_ui->frame->layout()->addWidget(_ui->txtArea);
|
||||
|
||||
tabs->setFixedHeight(24);
|
||||
tabs->insertTab(0, tr("About"));
|
||||
tabs->insertTab(1, tr("Thanks"));
|
||||
tabs->insertTab(2, tr("Help us"));
|
||||
|
||||
connect(tabs, &QTabBar::currentChanged, this, &AboutDialog::changeTab);
|
||||
|
||||
_ui->txtArea->setHtml(tabAbout());
|
||||
}
|
||||
|
||||
AboutDialog::~AboutDialog()
|
||||
{
|
||||
delete _ui;
|
||||
}
|
||||
|
||||
void AboutDialog::changeTab(int tabIndex)
|
||||
{
|
||||
// trnder text info
|
||||
switch(tabIndex)
|
||||
{
|
||||
case 0:
|
||||
_ui->txtArea->setHtml(tabAbout());
|
||||
break;
|
||||
case 1:
|
||||
_ui->txtArea->setHtml(tabThanks());
|
||||
break;
|
||||
case 2:
|
||||
_ui->txtArea->setHtml(tabHelpUs());
|
||||
break;
|
||||
default:
|
||||
_ui->txtArea->setHtml(tabAbout());
|
||||
}
|
||||
}
|
||||
|
||||
void AboutDialog::changeEvent(QEvent *e)
|
||||
{
|
||||
QDialog::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
case QEvent::LanguageChange:
|
||||
_ui->retranslateUi(this);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void AboutDialog::on_butAboutQt_clicked()
|
||||
{
|
||||
qApp->aboutQt();
|
||||
}
|
||||
|
||||
void AboutDialog::on_butClose_clicked()
|
||||
{
|
||||
accept();
|
||||
}
|
||||
|
||||
QString AboutDialog::tabAbout()
|
||||
{
|
||||
QString str;
|
||||
str += "<b>ScreenGrab</b> ";
|
||||
str += tr("is a crossplatform application for fast creating screenshots of your desktop.");
|
||||
str += "<br><br>";
|
||||
str += tr("It is a light and powerful application and has been written using the Qt framework, so that you are able to use in Windows and Linux.");
|
||||
str += "<br><br>";
|
||||
|
||||
str += tr("E-Mail")+" - ";
|
||||
str += "<a href=mailto:doomer3d@gmail.com>doomer3d@gmail.com</a>";
|
||||
str += "<br>";
|
||||
str += tr("Web site")+" - ";
|
||||
str += "<a href=http://screengrab.doomer.org>http://screengrab.doomer.org/</a>";
|
||||
str += "<br><br>";
|
||||
|
||||
str += tr("Licensed under the ");
|
||||
str += " <a href=http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>GPL v2</a>";
|
||||
str += "<br><br>";
|
||||
|
||||
str += tr("Copyright © 2009-2013, Artem 'DOOMer' Galichkin");
|
||||
return str;
|
||||
}
|
||||
|
||||
QString AboutDialog::tabHelpUs()
|
||||
{
|
||||
QString str;
|
||||
str += tr("You can join us and help us if you want. This is an invitation if you like this application.");
|
||||
str += "<br><br>";
|
||||
|
||||
str += tr("What you can do?");
|
||||
|
||||
str += "<ul>";
|
||||
str += "<li>" + tr("Translate ScreenGrab to other languages") + "</li>";
|
||||
str += "<li>" + tr("Make suggestions for next releases") + "</li>";
|
||||
str += "<li>" + tr("Report bugs and issues") + "</li>";
|
||||
str += "</ul>";
|
||||
|
||||
str += tr("E-Mail");
|
||||
str += "<br>";
|
||||
str += "<a href=mailto:doomer3d@gmail.com>mailto:doomer3d@gmail.com</a>";
|
||||
str += "<br><br>";
|
||||
str += tr("Bug tracker");
|
||||
str += "<br>";
|
||||
str += "<a href=https://github.com/DOOMer/screengrab/issues>https://github.com/DOOMer/screengrab/issues/</a>";
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
QString AboutDialog::tabThanks()
|
||||
{
|
||||
QString str;
|
||||
str += "<b>" + tr("Translate:") + "</b>";
|
||||
str += "<br>";
|
||||
str += tr(" Brazilian Portuguese translation") + "<br>";
|
||||
str += tr("Marcio Moraes") + " <marciopanto@gmail.com><br>";
|
||||
str += "<br>";
|
||||
str += tr(" Ukrainian translation") + "<br>";
|
||||
str += tr("Gennadi Motsyo") + " <drool@altlinux.ru><br>";
|
||||
str += "<br>";
|
||||
str += tr(" Spanish translation") + "<br>";
|
||||
str += tr("Burjans L García D") + " <burjans@gmail.com><br>";
|
||||
str += "<br>";
|
||||
str += tr(" Italian translation") + "<br>";
|
||||
str += "speps <dreamspepser@yahoo.it><br>";
|
||||
str += "<br>";
|
||||
|
||||
str += "<b>" + tr("Testing:") + "</b>";
|
||||
str += "<br>";
|
||||
str += "Jerome Leclanche - " + tr("Dual monitor support and other in Linux") + "<br>";
|
||||
str += "Alexander Sokolov - " + tr("Dual monitor support in Linux") + "<br>";
|
||||
str += "Alexantia - " + tr("win32-build [Windows XP and 7]") + "<br>";
|
||||
str += "iNight - " + tr("old win32-build [Windows Vista]") + "<br>";
|
||||
str += "burjans - " + tr("win32-build [Windows 7]") + "<br>";
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
void AboutDialog::on_txtArea_anchorClicked(QUrl url)
|
||||
{
|
||||
QDesktopServices::openUrl(url);
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef ABOUT_H
|
||||
#define ABOUT_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QTabBar>
|
||||
#include <QUrl>
|
||||
|
||||
|
||||
namespace Ui {
|
||||
class aboutWidget;
|
||||
}
|
||||
|
||||
class AboutDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit AboutDialog(QWidget *parent = 0);
|
||||
~AboutDialog();
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
private:
|
||||
Ui::aboutWidget *_ui;
|
||||
QTabBar *_tabs;
|
||||
|
||||
private slots:
|
||||
void on_txtArea_anchorClicked(QUrl );
|
||||
void changeTab(int tabIndex);
|
||||
void on_butClose_clicked();
|
||||
void on_butAboutQt_clicked();
|
||||
|
||||
QString tabAbout();
|
||||
QString tabHelpUs();
|
||||
QString tabThanks();
|
||||
};
|
||||
|
||||
#endif // ABOUT_H
|
@ -1,167 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>aboutWidget</class>
|
||||
<widget class="QDialog" name="aboutWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>559</width>
|
||||
<height>314</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>559</width>
|
||||
<height>314</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">About ScreenGrab</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Plain</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../../screengrab.qrc">:/res/img/logo.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="labAppName">
|
||||
<property name="text">
|
||||
<string notr="true"><b>ScreenGrab</b></string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labVersion">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labQtVer">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="_2">
|
||||
<item>
|
||||
<widget class="QTextBrowser" name="txtArea">
|
||||
<property name="openExternalLinks">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="openLinks">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QPushButton" name="butAboutQt">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>112</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>About Qt</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="butClose">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>112</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Close</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../../screengrab.qrc"/>
|
||||
<include location="../../screengrab.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
@ -1,520 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#include <QKeyEvent>
|
||||
|
||||
#include "configwidget.h"
|
||||
#include "ui_configwidget.h"
|
||||
#include "../core.h"
|
||||
|
||||
#ifdef SG_GLOBAL_SHORTCUTS
|
||||
#include <QxtGui/QxtGlobalShortcut>
|
||||
#endif
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QTreeWidgetItemIterator>
|
||||
|
||||
ConfigDialog::ConfigDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
_ui(new Ui::configwidget)
|
||||
{
|
||||
_ui->setupUi(this);
|
||||
conf = Config::instance();
|
||||
|
||||
connect(_ui->butSaveOpt, &QPushButton::clicked, this, &ConfigDialog::saveSettings);
|
||||
connect(_ui->buttonBrowse, &QPushButton::clicked, this, &ConfigDialog::selectDir);
|
||||
connect(_ui->butRestoreOpt, &QPushButton::clicked, this, &ConfigDialog::restoreDefaults);
|
||||
connect(_ui->checkIncDate, &QCheckBox::toggled, this, &ConfigDialog::setVisibleDateTplEdit);
|
||||
connect(_ui->keyWidget, &QKeySequenceWidget::keySequenceAccepted, this, &ConfigDialog::acceptShortcut);
|
||||
connect(_ui->keyWidget, &QKeySequenceWidget::keyNotSupported, this, &ConfigDialog::keyNotSupported);
|
||||
connect(_ui->checkAutoSave, &QCheckBox::toggled, this, &ConfigDialog::setVisibleAutoSaveFirst);
|
||||
connect(_ui->butCancel, &QPushButton::clicked, this, &ConfigDialog::reject);
|
||||
connect(_ui->treeKeys, &QTreeWidget::expanded, _ui->treeKeys, &QTreeWidget::clearSelection);
|
||||
connect(_ui->treeKeys, &QTreeWidget::collapsed, this, &ConfigDialog::collapsTreeKeys);
|
||||
connect(_ui->checkShowTray, &QCheckBox::toggled, this, &ConfigDialog::toggleCheckShowTray);
|
||||
connect(_ui->editDateTmeTpl, &QLineEdit::textEdited, this, &ConfigDialog::editDateTmeTpl);
|
||||
|
||||
void (QSpinBox::*delayChange)(int) = &QSpinBox::valueChanged;
|
||||
connect(_ui->defDelay, delayChange, this, &ConfigDialog::changeDefDelay);
|
||||
|
||||
void (QSpinBox::*timeToTray)(int) = &QSpinBox::valueChanged;
|
||||
connect(_ui->timeTrayMess, timeToTray, this, &ConfigDialog::changeTimeTrayMess);
|
||||
|
||||
void (QComboBox::*trayMessType)(int) = &QComboBox::currentIndexChanged;
|
||||
connect(_ui->cbxTrayMsg, trayMessType, this, &ConfigDialog::changeTrayMsgType);
|
||||
|
||||
connect(_ui->treeKeys, &QTreeWidget::doubleClicked, this, &ConfigDialog::doubleclickTreeKeys);
|
||||
connect(_ui->treeKeys, &QTreeWidget::activated, this, &ConfigDialog::doubleclickTreeKeys);
|
||||
connect(_ui->treeKeys->selectionModel(), &QItemSelectionModel::currentChanged,
|
||||
this, &ConfigDialog::currentItemChanged);
|
||||
connect(_ui->keyWidget, &QKeySequenceWidget::keySequenceCleared, this, &ConfigDialog::clearShrtcut);
|
||||
connect(_ui->listWidget, &QListWidget::currentRowChanged, _ui->stackedWidget, &QStackedWidget::setCurrentIndex);
|
||||
connect(_ui->slideImgQuality, &QSlider::valueChanged, this, &ConfigDialog::changeImgQualituSlider);
|
||||
|
||||
void (QComboBox::*formatChabge)(int) = &QComboBox::currentIndexChanged;
|
||||
connect(_ui->cbxFormat, formatChabge, this, &ConfigDialog::changeFormatType);
|
||||
|
||||
loadSettings();
|
||||
changeDefDelay(conf->getDefDelay());
|
||||
setVisibleDateTplEdit(conf->getDateTimeInFilename());
|
||||
|
||||
setVisibleAutoSaveFirst(conf->getAutoSave());
|
||||
|
||||
_ui->listWidget->setCurrentRow(0);
|
||||
_ui->tabMain->setCurrentIndex(0);
|
||||
|
||||
editDateTmeTpl(conf->getDateTimeTpl());
|
||||
|
||||
_ui->treeKeys->expandAll();
|
||||
_ui->treeKeys->header()->setSectionResizeMode(QHeaderView::Stretch);
|
||||
|
||||
// adding shortcut values in treewidge
|
||||
int action = 0;
|
||||
QTreeWidgetItemIterator iter(_ui->treeKeys);
|
||||
while (*iter)
|
||||
{
|
||||
if ((*iter)->parent() != NULL)
|
||||
{
|
||||
(*iter)->setData(1, Qt::DisplayRole, conf->shortcuts()->getShortcut(action));
|
||||
|
||||
#ifndef SG_GLOBAL_SHORTCUTS
|
||||
if (conf->shortcuts()->getShortcutType(action) == Config::globalShortcut)
|
||||
(*iter)->setHidden(true);
|
||||
#endif
|
||||
++action;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef SG_GLOBAL_SHORTCUTS
|
||||
int numGlobalShortcuts = conf->shortcuts()->getShortcutsList(Config::globalShortcut).count();
|
||||
if ((*iter)->childCount() == numGlobalShortcuts)
|
||||
(*iter)->setHidden(true);
|
||||
#endif
|
||||
}
|
||||
|
||||
++iter;
|
||||
}
|
||||
|
||||
// set false visibility to edit hokey controls
|
||||
_ui->labUsedShortcut->setVisible(false);
|
||||
_ui->keyWidget->setVisible(false);
|
||||
|
||||
// Load config widgets for modules
|
||||
quint8 countModules = Core::instance()->modules()->count();
|
||||
|
||||
for (int i = 0; i < countModules; ++i)
|
||||
{
|
||||
AbstractModule* currentModule = Core::instance()->modules()->getModule(i);
|
||||
|
||||
if (currentModule->initConfigWidget() != 0)
|
||||
{
|
||||
_ui->listWidget->addItem(currentModule->moduleName());
|
||||
QWidget *currentModWidget = currentModule->initConfigWidget();
|
||||
_ui->stackedWidget->addWidget(currentModWidget);
|
||||
_moduleWidgetNames << currentModWidget->objectName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ConfigDialog::~ConfigDialog()
|
||||
{
|
||||
delete _ui;
|
||||
conf = NULL;
|
||||
delete conf;
|
||||
|
||||
}
|
||||
|
||||
void ConfigDialog::loadSettings()
|
||||
{
|
||||
// main tab
|
||||
_ui->editDir->setText(conf->getSaveDir());
|
||||
_ui->editFileName->setText(conf->getSaveFileName());
|
||||
|
||||
_ui->cbxFormat->addItem("png");
|
||||
_ui->cbxFormat->addItem("jpg");
|
||||
_ui->cbxFormat->addItem("bmp");
|
||||
_ui->cbxFormat->setCurrentIndex(conf->getDefaultFormatID());
|
||||
|
||||
_ui->defDelay->setValue(conf->getDefDelay());
|
||||
_ui->checkIncDate->setChecked(conf->getDateTimeInFilename());
|
||||
_ui->editDateTmeTpl->setText(conf->getDateTimeTpl());
|
||||
_ui->cbxCopyFileName->setCurrentIndex(conf->getAutoCopyFilenameOnSaving());
|
||||
|
||||
// display tab
|
||||
_ui->cbxTrayMsg->setCurrentIndex(conf->getTrayMessages());
|
||||
changeTrayMsgType(_ui->cbxTrayMsg->currentIndex());
|
||||
_ui->timeTrayMess->setValue(conf->getTimeTrayMess());
|
||||
_ui->checkAutoSave->setChecked(conf->getAutoSave());;
|
||||
_ui->checkAutoSaveFirst->setChecked(conf->getAutoSaveFirst());;
|
||||
_ui->checkZommMouseArea->setChecked(conf->getZoomAroundMouse());
|
||||
_ui->cbxIncludeCursor->setChecked(conf->getIncludeCursor());
|
||||
|
||||
_ui->checkInTray->setChecked(conf->getCloseInTray());
|
||||
_ui->checkAllowCopies->setChecked(conf->getAllowMultipleInstance());
|
||||
|
||||
_ui->checkNoDecorX11->setChecked(conf->getNoDecoration());
|
||||
_ui->checkShowTray->setChecked(conf->getShowTrayIcon());
|
||||
toggleCheckShowTray(conf->getShowTrayIcon());
|
||||
|
||||
_ui->slideImgQuality->setValue(conf->getImageQuality());
|
||||
_ui->cbxEnableExtView->setChecked(conf->getEnableExtView());
|
||||
}
|
||||
|
||||
|
||||
void ConfigDialog::changeEvent(QEvent *e)
|
||||
{
|
||||
QWidget::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
case QEvent::LanguageChange:
|
||||
_ui->retranslateUi(this);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigDialog::setVisibleAutoSaveFirst(bool status)
|
||||
{
|
||||
_ui->checkAutoSaveFirst->setVisible(status);
|
||||
}
|
||||
|
||||
void ConfigDialog::changeFormatType(int type)
|
||||
{
|
||||
if (type == 1)
|
||||
{
|
||||
_ui->slideImgQuality->setVisible(true);;
|
||||
_ui->labImgQuality->setVisible(true);
|
||||
_ui->labImgQualityCurrent->setVisible(true);;
|
||||
}
|
||||
else
|
||||
{
|
||||
_ui->slideImgQuality->setVisible(false);
|
||||
_ui->labImgQuality->setVisible(false);
|
||||
_ui->labImgQualityCurrent->setVisible(false);;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ConfigDialog::changeImgQualituSlider(int pos)
|
||||
{
|
||||
QString text = " " + QString::number(pos) + "%";
|
||||
_ui->labImgQualityCurrent->setText(text);
|
||||
}
|
||||
|
||||
void ConfigDialog::saveSettings()
|
||||
{
|
||||
QDir screenshotDir(_ui->editDir->text());
|
||||
if (!screenshotDir.exists())
|
||||
{
|
||||
QMessageBox msg;
|
||||
msg.setText(tr("Directory %1 does not exist. Do you want to create it?").arg(QDir::toNativeSeparators(screenshotDir.path()) + QDir::separator()));
|
||||
msg.setWindowTitle("ScreenGrab" + QString(" - ") + tr("Warning"));
|
||||
msg.setIcon(QMessageBox::Question);
|
||||
msg.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
||||
|
||||
int res = msg.exec();
|
||||
|
||||
if (res == QMessageBox::No)
|
||||
return;
|
||||
else
|
||||
{
|
||||
screenshotDir.mkpath(screenshotDir.path());
|
||||
|
||||
if (!screenshotDir.path().endsWith(QDir::separator()))
|
||||
{
|
||||
QString updatedPath = screenshotDir.path() + QDir::separator();
|
||||
updatedPath = QDir::toNativeSeparators(updatedPath);
|
||||
_ui->editDir->setText(updatedPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// set new values of general settings
|
||||
conf->setSaveDir(_ui->editDir->text());
|
||||
conf->setSaveFileName(_ui->editFileName->text());
|
||||
conf->setSaveFormat(_ui->cbxFormat->currentText());
|
||||
conf->setDefDelay(_ui->defDelay->value());
|
||||
conf->setDateTimeInFilename(_ui->checkIncDate->isChecked());
|
||||
conf->setDateTimeTpl(_ui->editDateTmeTpl->text());
|
||||
conf->setAutoCopyFilenameOnSaving(_ui->cbxCopyFileName->currentIndex());
|
||||
conf->setAutoSave(_ui->checkAutoSave->isChecked());
|
||||
conf->setAutoSaveFirst(_ui->checkAutoSaveFirst->isChecked());
|
||||
conf->setTrayMessages(_ui->cbxTrayMsg->currentIndex());
|
||||
conf->setCloseInTray(_ui->checkInTray->isChecked());
|
||||
conf->setIncludeCursor(_ui->cbxIncludeCursor->isChecked());
|
||||
conf->setZoomAroundMouse(_ui->checkZommMouseArea->isChecked());
|
||||
conf->setAllowMultipleInstance(_ui->checkAllowCopies->isChecked());
|
||||
conf->setTimeTrayMess(_ui->timeTrayMess->value());
|
||||
conf->setShowTrayIcon(_ui->checkShowTray->isChecked());
|
||||
conf->setImageQuality(_ui->slideImgQuality->value());
|
||||
conf->setEnableExtView(_ui->cbxEnableExtView->isChecked());
|
||||
conf->setNoDecoration(_ui->checkNoDecorX11->isChecked());
|
||||
|
||||
// save shortcuts in shortcutmanager
|
||||
int action = 0;
|
||||
QTreeWidgetItemIterator iter(_ui->treeKeys);
|
||||
while (*iter)
|
||||
{
|
||||
if ((*iter)->parent())
|
||||
{
|
||||
switch((*iter)->parent()->childCount())
|
||||
{
|
||||
case 3:
|
||||
conf->shortcuts()->setShortcut((*iter)->data(1, Qt::DisplayRole).toString(), action, 0);
|
||||
break;
|
||||
case 6:
|
||||
conf->shortcuts()->setShortcut((*iter)->data(1, Qt::DisplayRole).toString(), action, 1);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
++action;
|
||||
}
|
||||
++iter;
|
||||
}
|
||||
|
||||
// update values of front-end settings
|
||||
conf->saveSettings();
|
||||
conf->setDelay(conf->getDefDelay());
|
||||
|
||||
// call save method on modeule's configwidgets'
|
||||
for (int i = 0; i < _moduleWidgetNames.count(); ++i)
|
||||
{
|
||||
QString name = _moduleWidgetNames.at(i);
|
||||
QWidget* currentWidget = _ui->stackedWidget->findChild<QWidget*>(name);
|
||||
if (currentWidget)
|
||||
QMetaObject::invokeMethod(currentWidget, "saveSettings");
|
||||
}
|
||||
|
||||
accept();
|
||||
}
|
||||
|
||||
QString ConfigDialog::getFormat()
|
||||
{
|
||||
switch (_ui->cbxFormat->currentIndex())
|
||||
{
|
||||
case 0: return "png";
|
||||
case 1: return "jpg";
|
||||
default: return "png";
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigDialog::selectDir()
|
||||
{
|
||||
QString *directory = new QString;
|
||||
{
|
||||
*directory = QFileDialog::getExistingDirectory(this, trUtf8("Select directory"),
|
||||
_ui->editDir->text(), QFileDialog::ShowDirsOnly)+QDir::separator();
|
||||
if (directory->toUtf8() != QDir::separator())
|
||||
_ui->editDir->setText( *directory);
|
||||
}
|
||||
|
||||
delete directory;
|
||||
}
|
||||
|
||||
void ConfigDialog::restoreDefaults()
|
||||
{
|
||||
QMessageBox msg;
|
||||
msg.setText(tr("Do you want to reset the settings to the defaults?"));
|
||||
msg.setWindowTitle("ScreenGrab" + QString(" - ") + tr("Warning"));
|
||||
msg.setIcon(QMessageBox::Question);
|
||||
msg.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
||||
|
||||
int res = msg.exec();
|
||||
|
||||
if (res == QMessageBox::Yes)
|
||||
{
|
||||
conf->setDefaultSettings();
|
||||
conf->saveSettings();
|
||||
QDialog::accept();
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigDialog::changeDefDelay(int val)
|
||||
{
|
||||
if (val == 0)
|
||||
_ui->defDelay->setSpecialValueText(tr("None"));
|
||||
}
|
||||
|
||||
void ConfigDialog::changeTimeTrayMess(int sec)
|
||||
{
|
||||
conf->setTimeTrayMess(sec);
|
||||
}
|
||||
|
||||
void ConfigDialog::changeTrayMsgType(int type)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
_ui->labTimeTrayMess->setVisible(false);
|
||||
_ui->timeTrayMess->setVisible(false);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
_ui->labTimeTrayMess->setVisible(true);
|
||||
_ui->timeTrayMess->setVisible(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigDialog::setVisibleDateTplEdit(bool checked)
|
||||
{
|
||||
if (!checked)
|
||||
{
|
||||
_ui->editDateTmeTpl->setVisible(false);
|
||||
_ui->labMask->setVisible(false);
|
||||
_ui->labMaskExample->setVisible(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
_ui->editDateTmeTpl->setVisible(true);
|
||||
_ui->labMask->setVisible(true);
|
||||
_ui->labMaskExample->setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigDialog::editDateTmeTpl(QString str)
|
||||
{
|
||||
QString currentDateTime = QDateTime::currentDateTime().toString(str );
|
||||
_ui->labMaskExample->setText(tr("Example: ") + currentDateTime);
|
||||
}
|
||||
|
||||
void ConfigDialog::toggleCheckShowTray(bool checked)
|
||||
{
|
||||
_ui->labTrayMessages->setEnabled(checked);
|
||||
_ui->cbxTrayMsg->setEnabled(checked);
|
||||
_ui->timeTrayMess->setEnabled(checked);
|
||||
_ui->labTimeTrayMess->setEnabled(checked);
|
||||
_ui->checkInTray->setEnabled(checked);
|
||||
}
|
||||
|
||||
void ConfigDialog::currentItemChanged(const QModelIndex c, const QModelIndex p)
|
||||
{
|
||||
Q_UNUSED(p)
|
||||
if (c.parent().isValid())
|
||||
{
|
||||
_ui->labUsedShortcut->setVisible(true);
|
||||
_ui->keyWidget->setVisible(true);
|
||||
|
||||
QTreeWidgetItem *item = _ui->treeKeys->currentItem();
|
||||
_ui->keyWidget->setKeySequence(QKeySequence(item->data(1, Qt::DisplayRole).toString()));
|
||||
}
|
||||
else
|
||||
{
|
||||
_ui->labUsedShortcut->setVisible(false);
|
||||
_ui->keyWidget->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigDialog::doubleclickTreeKeys(QModelIndex index)
|
||||
{
|
||||
if (index.parent().isValid())
|
||||
{
|
||||
connect(_ui->keyWidget, SIGNAL(keySequenceChanged(QKeySequence)), this, SLOT(changeShortcut(QKeySequence)));
|
||||
_ui->keyWidget->captureKeySequence();
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigDialog::collapsTreeKeys(QModelIndex index)
|
||||
{
|
||||
if (!index.parent().isValid())
|
||||
{
|
||||
_ui->labUsedShortcut->setVisible(false);
|
||||
_ui->keyWidget->setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
void ConfigDialog::acceptShortcut(const QKeySequence& seq)
|
||||
{
|
||||
if (!checkUsedShortcuts())
|
||||
{
|
||||
#ifdef SG_GLOBAL_SHORTCUTS
|
||||
if (avalibelGlobalShortcuts(seq))
|
||||
changeShortcut(seq);
|
||||
else
|
||||
showErrorMessage(tr("This key is already used in your system! Please select another."));
|
||||
#else
|
||||
changeShortcut(seq);
|
||||
#endif
|
||||
}
|
||||
else if (checkUsedShortcuts() && seq.toString() != "")
|
||||
showErrorMessage(tr("This key is already used in ScreenGrab! Please select another."));
|
||||
}
|
||||
|
||||
void ConfigDialog::changeShortcut(const QKeySequence& seq)
|
||||
{
|
||||
disconnect(_ui->keyWidget, SIGNAL(keySequenceChanged(QKeySequence)), this, SLOT(changeShortcut(QKeySequence)));
|
||||
QTreeWidgetItem *item = _ui->treeKeys->selectedItems().first();
|
||||
item->setData(1, Qt::DisplayRole, seq.toString());
|
||||
}
|
||||
|
||||
void ConfigDialog::clearShrtcut()
|
||||
{
|
||||
QTreeWidgetItem *item = _ui->treeKeys->selectedItems().first();
|
||||
item->setData(1, Qt::DisplayRole, QString(""));
|
||||
}
|
||||
|
||||
void ConfigDialog::keyNotSupported()
|
||||
{
|
||||
showErrorMessage(tr("This key is not supported on your system!"));
|
||||
}
|
||||
|
||||
bool ConfigDialog::checkUsedShortcuts()
|
||||
{
|
||||
QTreeWidgetItem *item = _ui->treeKeys->selectedItems().first();
|
||||
QTreeWidgetItemIterator iter(_ui->treeKeys);
|
||||
while (*iter)
|
||||
{
|
||||
if ((*iter) != item && (*iter)->data(1, Qt::DisplayRole) == _ui->keyWidget->keySequence().toString())
|
||||
return true;
|
||||
++iter;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef SG_GLOBAL_SHORTCUTS
|
||||
bool ConfigDialog::avalibelGlobalShortcuts(const QKeySequence& seq)
|
||||
{
|
||||
bool ok = false;
|
||||
QxtGlobalShortcut *tmpShortcut = new QxtGlobalShortcut;
|
||||
if (tmpShortcut->setShortcut(QKeySequence(seq)) == true)
|
||||
{
|
||||
tmpShortcut->setDisabled(true);
|
||||
ok = true;
|
||||
}
|
||||
delete tmpShortcut;
|
||||
return ok;
|
||||
}
|
||||
#endif
|
||||
|
||||
void ConfigDialog::showErrorMessage(QString text)
|
||||
{
|
||||
_ui->keyWidget->clearKeySequence();
|
||||
QMessageBox msg;
|
||||
msg.setWindowTitle(tr("Error"));
|
||||
msg.setText(text);
|
||||
msg.setIcon(QMessageBox::Information);
|
||||
msg.setStandardButtons(QMessageBox::Ok);
|
||||
msg.exec();
|
||||
}
|
@ -1,79 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef CONFIGWIDGET_H
|
||||
#define CONFIGWIDGET_H
|
||||
|
||||
#include "../config.h"
|
||||
|
||||
#include <QDialog>
|
||||
#include <QTextCodec>
|
||||
#include <QDateTime>
|
||||
#include <QModelIndex>
|
||||
#include <QTreeWidgetItem>
|
||||
|
||||
namespace Ui {
|
||||
class configwidget;
|
||||
}
|
||||
class ConfigDialog : public QDialog{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ConfigDialog( QWidget *parent = 0);
|
||||
~ConfigDialog();
|
||||
Config *conf;
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
private:
|
||||
Ui::configwidget *_ui;
|
||||
void loadSettings();
|
||||
QString getFormat();
|
||||
bool checkUsedShortcuts();
|
||||
void showErrorMessage(QString text);
|
||||
|
||||
QStringList _moduleWidgetNames;
|
||||
|
||||
#ifdef SG_GLOBAL_SHORTCUTS
|
||||
bool avalibelGlobalShortcuts(const QKeySequence& seq);
|
||||
#endif
|
||||
|
||||
private slots:
|
||||
void collapsTreeKeys(QModelIndex index);
|
||||
void doubleclickTreeKeys(QModelIndex index);
|
||||
void toggleCheckShowTray(bool checked);
|
||||
void currentItemChanged(const QModelIndex c ,const QModelIndex p);
|
||||
void editDateTmeTpl(QString str);
|
||||
void setVisibleDateTplEdit(bool);
|
||||
void changeTrayMsgType(int type);
|
||||
void changeTimeTrayMess(int sec);
|
||||
void changeDefDelay(int val);
|
||||
void setVisibleAutoSaveFirst(bool status);
|
||||
void changeFormatType(int type);
|
||||
void changeImgQualituSlider(int pos);
|
||||
void saveSettings();
|
||||
void selectDir();
|
||||
void restoreDefaults();
|
||||
void acceptShortcut(const QKeySequence &seq);
|
||||
void changeShortcut(const QKeySequence &seq);
|
||||
void clearShrtcut();
|
||||
void keyNotSupported();
|
||||
|
||||
};
|
||||
|
||||
#endif // CONFIGWIDGET_H
|
@ -1,843 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>configwidget</class>
|
||||
<widget class="QWidget" name="configwidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>634</width>
|
||||
<height>294</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Options</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QListWidget" name="listWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>160</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
<height>32</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="textElideMode">
|
||||
<enum>Qt::ElideNone</enum>
|
||||
</property>
|
||||
<property name="flow">
|
||||
<enum>QListView::TopToBottom</enum>
|
||||
</property>
|
||||
<property name="isWrapping" stdset="0">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="resizeMode">
|
||||
<enum>QListView::Adjust</enum>
|
||||
</property>
|
||||
<property name="viewMode">
|
||||
<enum>QListView::ListMode</enum>
|
||||
</property>
|
||||
<property name="uniformItemSizes">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Main</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Advanced</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>System tray</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Shortcuts</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page_6">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabMain">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tabSaving">
|
||||
<attribute name="title">
|
||||
<string>Saving</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="spacing">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="labDirectory">
|
||||
<property name="text">
|
||||
<string>Default save directory:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="editDir">
|
||||
<property name="toolTip">
|
||||
<string>Path to default selection dir for saving</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="buttonBrowse">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>112</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Browse filesystem</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Browse</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_14">
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<widget class="QLabel" name="labFilename">
|
||||
<property name="text">
|
||||
<string>Default filename:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="editFileName">
|
||||
<property name="toolTip">
|
||||
<string>Default filename</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||
<item>
|
||||
<widget class="QLabel" name="labFormat">
|
||||
<property name="text">
|
||||
<string>Format</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="cbxFormat">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>112</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Default saving image format</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
||||
<property name="leftMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="labCopyFileName">
|
||||
<property name="text">
|
||||
<string>Copy file name to the clipboard when saving</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="cbxCopyFileName">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Do not copy</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Copy file name only</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Copy full file path</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>82</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tabScreenshot">
|
||||
<attribute name="title">
|
||||
<string>Screenshot</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Delay:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="defDelay">
|
||||
<property name="toolTip">
|
||||
<string>Default delay before grabbing screen</string>
|
||||
</property>
|
||||
<property name="wrapping">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> sec</string>
|
||||
</property>
|
||||
<property name="prefix">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>90</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkNoDecorX11">
|
||||
<property name="text">
|
||||
<string>No window decoration</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labImgQuality">
|
||||
<property name="text">
|
||||
<string>Image quality</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_13">
|
||||
<item>
|
||||
<widget class="QSlider" name="slideImgQuality">
|
||||
<property name="toolTip">
|
||||
<string>Image quality (1 - small file, 100 - high quality)</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="singleStep">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labImgQualityCurrent">
|
||||
<property name="text">
|
||||
<string notr="true">Current</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cbxIncludeCursor">
|
||||
<property name="text">
|
||||
<string>Include mouse pointer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkZommMouseArea">
|
||||
<property name="text">
|
||||
<string>Zoom area around mouse in selection mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>117</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_2">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||
<property name="leftMargin">
|
||||
<number>16</number>
|
||||
</property>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkIncDate">
|
||||
<property name="toolTip">
|
||||
<string>Inserting current date time into saved filename</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Insert current date and time in file name</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<widget class="QLabel" name="labMask">
|
||||
<property name="text">
|
||||
<string>Template: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="editDateTmeTpl">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>256</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labMaskExample">
|
||||
<property name="text">
|
||||
<string>Example: </string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkAutoSave">
|
||||
<property name="toolTip">
|
||||
<string>Automatically saving screenshots in grabbing process</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Autosave screenshot</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||
<property name="leftMargin">
|
||||
<number>16</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkAutoSaveFirst">
|
||||
<property name="text">
|
||||
<string>Save first screenshot</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkAllowCopies">
|
||||
<property name="toolTip">
|
||||
<string>Allow run multiplies copy of ScreenGrab</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Allow multiple instances of ScreenGrab</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="cbxEnableExtView">
|
||||
<property name="toolTip">
|
||||
<string>Open in external viewer on double click</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Enable external viewer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>66</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_4">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_13">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkShowTray">
|
||||
<property name="text">
|
||||
<string>Show ScreenGrab in the system tray</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="QLabel" name="labTrayMessages">
|
||||
<property name="text">
|
||||
<string>Tray messages:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="cbxTrayMsg">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Tray messages display mode</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Never</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Tray mode</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Always</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QLabel" name="labTimeTrayMess">
|
||||
<property name="text">
|
||||
<string>Time of display tray messages</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="timeTrayMess">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Time to display tray messages</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> sec</string>
|
||||
</property>
|
||||
<property name="minimum">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="value">
|
||||
<number>5</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkInTray">
|
||||
<property name="toolTip">
|
||||
<string>Minimize to tray on click close button</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Minimize to tray when closing</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_5">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_14">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="treeKeys">
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Action</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Shortcut</string>
|
||||
</property>
|
||||
</column>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Global shortcuts</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Fill screen</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Active window</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Area select</string>
|
||||
</property>
|
||||
</item>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Local shortcuts</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>New screen</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Save screen</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Copy screen</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Options</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Help</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Quit</string>
|
||||
</property>
|
||||
</item>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
<item>
|
||||
<widget class="QLabel" name="labUsedShortcut">
|
||||
<property name="text">
|
||||
<string>Selected shortcut:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QKeySequenceWidget" name="keyWidget" native="true">
|
||||
<property name="noneText" stdset="0">
|
||||
<string>Not defined</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="butRestoreOpt">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>112</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Restore default settings</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Defaults</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>88</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="butSaveOpt">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>112</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Save settings</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Save</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="butCancel">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>112</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Discard changes</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QKeySequenceWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>qkeysequencewidget.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>butSaveOpt</tabstop>
|
||||
<tabstop>butCancel</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -1,570 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
#include "../core.h"
|
||||
#include "../shortcutmanager.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileDialog>
|
||||
#include <QDesktopWidget>
|
||||
#include <QHash>
|
||||
#include <QHashIterator>
|
||||
#include <QRegExp>
|
||||
#include <QTimer>
|
||||
#include <QToolButton>
|
||||
#include <QMenu>
|
||||
|
||||
MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent),
|
||||
_ui(new Ui::MainWindow), _conf(NULL), _trayMenu(NULL)
|
||||
{
|
||||
_ui->setupUi(this);
|
||||
_trayed = false;
|
||||
|
||||
#ifdef SG_GLOBAL_SHORTCUTS
|
||||
// signal mapper
|
||||
_globalShortcutSignals = new QSignalMapper(this);
|
||||
|
||||
// global shortcuts
|
||||
_fullScreen = new QxtGlobalShortcut(this);
|
||||
_activeWindow = new QxtGlobalShortcut(this);
|
||||
_areaSelection = new QxtGlobalShortcut(this);
|
||||
_globalShortcuts << _fullScreen << _activeWindow << _areaSelection;
|
||||
|
||||
for (int i = 0; i < _globalShortcuts.count(); ++i )
|
||||
{
|
||||
connect(_globalShortcuts[i], SIGNAL(activated()), _globalShortcutSignals, SLOT(map()) );
|
||||
_globalShortcutSignals->setMapping(_globalShortcuts[i], i);
|
||||
}
|
||||
|
||||
connect(_globalShortcutSignals, SIGNAL(mapped(int)), this, SLOT(globalShortcutActivate(int)));
|
||||
#endif
|
||||
|
||||
_trayIcon = NULL;
|
||||
_hideWnd = NULL;
|
||||
|
||||
// create actions menu
|
||||
actNew = new QAction(QIcon::fromTheme("document-new"), tr("New"), this);
|
||||
actSave = new QAction(QIcon::fromTheme("document-save"), tr("Save"), this);
|
||||
actCopy = new QAction(QIcon::fromTheme("edit-copy"), tr("Copy"), this);
|
||||
actOptions = new QAction(QIcon::fromTheme("configure"), tr("Options"), this);
|
||||
actHelp = new QAction(QIcon::fromTheme("system-help"), tr("Help"), this);
|
||||
actAbout = new QAction(QIcon::fromTheme("system-about"), tr("About"), this);
|
||||
actQuit = new QAction(QIcon::fromTheme("application-exit"), tr("Quit"), this);
|
||||
|
||||
// connect actions to slots
|
||||
Core *c = Core::instance();
|
||||
|
||||
connect(actQuit, &QAction::triggered, c, &Core::coreQuit);
|
||||
connect(actNew, &QAction::triggered, c, &Core::setScreen);
|
||||
connect(actSave, &QAction::triggered, this, &MainWindow::saveScreen);
|
||||
connect(actCopy, &QAction::triggered, c, &Core::copyScreen);
|
||||
connect(actOptions, &QAction::triggered, this, &MainWindow::showOptions);
|
||||
connect(actAbout, &QAction::triggered, this, &MainWindow::showAbout);
|
||||
connect(actHelp, &QAction::triggered, this, &MainWindow::showHelp);
|
||||
|
||||
_ui->toolBar->addAction(actNew);
|
||||
_ui->toolBar->addAction(actSave);
|
||||
_ui->toolBar->addAction(actCopy);
|
||||
_ui->toolBar->addAction(actOptions);
|
||||
_ui->toolBar->addSeparator();
|
||||
QMenu *menuInfo = new QMenu(this);
|
||||
menuInfo->addAction(actHelp);
|
||||
menuInfo->addAction(actAbout);
|
||||
QToolButton *help = new QToolButton(this);
|
||||
help->setText(tr("Help"));
|
||||
help->setPopupMode(QToolButton::InstantPopup);
|
||||
help->setIcon(QIcon::fromTheme("system-help"));
|
||||
help->setMenu(menuInfo);
|
||||
|
||||
_ui->toolBar->addWidget(help);
|
||||
|
||||
QWidget* spacer = new QWidget();
|
||||
spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
_ui->toolBar->addWidget(spacer);
|
||||
|
||||
_ui->toolBar->addAction(actQuit);
|
||||
|
||||
void (QSpinBox::*delayChange)(int) = &QSpinBox::valueChanged;
|
||||
connect(_ui->delayBox, delayChange, this, &MainWindow::delayBoxChange);
|
||||
void (QComboBox::*typeScr)(int) = &QComboBox::currentIndexChanged;
|
||||
connect(_ui->cbxTypeScr, typeScr, this, &MainWindow::typeScreenShotChange);
|
||||
connect(_ui->checkIncludeCursor, &QCheckBox::toggled, this, &MainWindow::checkIncludeCursor);
|
||||
|
||||
QIcon icon(":/res/img/logo.png");
|
||||
setWindowIcon(icon);
|
||||
|
||||
QRect geometry = QApplication::desktop()->availableGeometry(QApplication::desktop()->screenNumber());
|
||||
move(geometry.width() / 2 - width() / 2, geometry.height() / 2 - height() / 2);
|
||||
|
||||
_ui->scrLabel->installEventFilter(this);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
{
|
||||
delete _ui;
|
||||
}
|
||||
|
||||
void MainWindow::changeEvent(QEvent *e)
|
||||
{
|
||||
QMainWindow::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
case QEvent::LanguageChange:
|
||||
_ui->retranslateUi(this);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::closeEvent(QCloseEvent *e)
|
||||
{
|
||||
if (_conf->getCloseInTray() && _conf->getShowTrayIcon())
|
||||
{
|
||||
windowHideShow();
|
||||
e->ignore();
|
||||
}
|
||||
else
|
||||
actQuit->activate(QAction::Trigger);
|
||||
}
|
||||
|
||||
// resize main window
|
||||
void MainWindow::resizeEvent(QResizeEvent *event)
|
||||
{
|
||||
Q_UNUSED(event)
|
||||
// get size dcreen pixel map
|
||||
QSize scaleSize = Core::instance()->getPixmap()->size(); // get orig size pixmap
|
||||
|
||||
scaleSize.scale(_ui->scrLabel->size(), Qt::KeepAspectRatio);
|
||||
|
||||
// if not scrlabel pixmap
|
||||
if (!_ui->scrLabel->pixmap() || scaleSize != _ui->scrLabel->pixmap()->size())
|
||||
updatePixmap(Core::instance()->getPixmap());
|
||||
}
|
||||
|
||||
bool MainWindow::eventFilter(QObject* obj, QEvent* event)
|
||||
{
|
||||
if (obj == _ui->scrLabel && event->type() == QEvent::ToolTip)
|
||||
displatScreenToolTip();
|
||||
|
||||
else if (obj == _ui->scrLabel && event->type() == QEvent::MouseButtonDblClick)
|
||||
Core::instance()->openInExtViewer();
|
||||
|
||||
return QObject::eventFilter(obj, event);
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::updatePixmap(QPixmap *pMap)
|
||||
{
|
||||
_ui->scrLabel->setPixmap(pMap->scaled(_ui->scrLabel->size(),
|
||||
Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||
}
|
||||
|
||||
void MainWindow::updateModulesActions(QList<QAction *> list)
|
||||
{
|
||||
_ui->toolBar->insertSeparator(actOptions);
|
||||
if (list.count() > 0)
|
||||
{
|
||||
for (int i = 0; i < list.count(); ++i)
|
||||
{
|
||||
QAction *action = list.at(i);
|
||||
if (action)
|
||||
_ui->toolBar->insertAction(actOptions, action);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::updateModulesenus(QList<QMenu *> list)
|
||||
{
|
||||
if (list.count() > 0)
|
||||
{
|
||||
for (int i = 0; i < list.count(); ++i)
|
||||
{
|
||||
QMenu *menu = list.at(i);
|
||||
if (menu != 0)
|
||||
{
|
||||
QToolButton* btn = new QToolButton(this);
|
||||
btn->setText(menu->title());
|
||||
btn->setPopupMode(QToolButton::InstantPopup);
|
||||
btn->setToolTip(menu->title());
|
||||
btn->setMenu(list.at(i));
|
||||
_ui->toolBar->insertWidget(actOptions, btn);
|
||||
}
|
||||
}
|
||||
_ui->toolBar->insertSeparator(actOptions);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::show()
|
||||
{
|
||||
if (!isVisible() && !_trayed)
|
||||
showNormal();
|
||||
|
||||
if (_conf->getShowTrayIcon())
|
||||
{
|
||||
_trayIcon->blockSignals(false);
|
||||
_trayIcon->setContextMenu(_trayMenu); // enable context menu
|
||||
}
|
||||
|
||||
if (_trayIcon)
|
||||
_trayIcon->setVisible(true);
|
||||
|
||||
QMainWindow::show();
|
||||
}
|
||||
|
||||
bool MainWindow::isTrayed() const
|
||||
{
|
||||
return _trayIcon != NULL;
|
||||
}
|
||||
|
||||
void MainWindow::showTrayMessage(const QString& header, const QString& message)
|
||||
{
|
||||
if (_conf->getShowTrayIcon())
|
||||
{
|
||||
switch(_conf->getTrayMessages())
|
||||
{
|
||||
case 0: break; // never shown
|
||||
case 1: // main window hidden
|
||||
{
|
||||
if (isHidden() && _trayed)
|
||||
{
|
||||
_trayIcon->showMessage(header, message,
|
||||
QSystemTrayIcon::MessageIcon(), _conf->getTimeTrayMess()*1000 ); //5000
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2: // always show
|
||||
{
|
||||
_trayIcon->showMessage(header, message,
|
||||
QSystemTrayIcon::MessageIcon(), _conf->getTimeTrayMess()*1000 );
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::setConfig(Config *config)
|
||||
{
|
||||
_conf = config;
|
||||
updateUI();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::showHelp()
|
||||
{
|
||||
QString localeHelpFile;
|
||||
|
||||
localeHelpFile = QString(SG_DOCDIR) + "%1html%1" + Config::getSysLang()+"%1index.html";
|
||||
localeHelpFile = localeHelpFile.arg(QString(QDir::separator()));
|
||||
|
||||
if (!QFile::exists(localeHelpFile))
|
||||
{
|
||||
localeHelpFile = QString(SG_DOCDIR) + "%1html%1" + Config::getSysLang().section("_", 0, 0) + "%1index.html";
|
||||
localeHelpFile = localeHelpFile.arg(QString(QDir::separator()));
|
||||
|
||||
if (!QFile::exists(localeHelpFile))
|
||||
{
|
||||
localeHelpFile = QString(SG_DOCDIR) + "%1html%1en%1index.html";
|
||||
localeHelpFile = localeHelpFile.arg(QString(QDir::separator()));
|
||||
}
|
||||
}
|
||||
|
||||
// open find localize or eng help help
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(localeHelpFile));
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::showOptions()
|
||||
{
|
||||
ConfigDialog *options = new ConfigDialog();
|
||||
#ifdef SG_GLOBAL_SHORTCUTS
|
||||
globalShortcutBlock(true);
|
||||
#endif
|
||||
|
||||
if (isMinimized())
|
||||
{
|
||||
showNormal();
|
||||
if (options->exec() == QDialog::Accepted)
|
||||
updateUI();
|
||||
hideToShot();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (options->exec() == QDialog::Accepted)
|
||||
updateUI();
|
||||
}
|
||||
|
||||
#ifdef SG_GLOBAL_SHORTCUTS
|
||||
globalShortcutBlock(false);
|
||||
#endif
|
||||
delete options;
|
||||
}
|
||||
|
||||
void MainWindow::showAbout()
|
||||
{
|
||||
AboutDialog *about = new AboutDialog(this);
|
||||
|
||||
if (isMinimized())
|
||||
{
|
||||
showNormal();
|
||||
about->exec();
|
||||
hideToShot();
|
||||
}
|
||||
else
|
||||
about->exec();
|
||||
|
||||
delete about;
|
||||
}
|
||||
|
||||
void MainWindow::displatScreenToolTip()
|
||||
{
|
||||
QSize pSize = Core::instance()->getPixmap()->size();
|
||||
quint16 w = pSize.width();
|
||||
quint16 h = pSize.height();
|
||||
QString toolTip = tr("Screenshot ") + QString::number(w) + "x" + QString::number(h);
|
||||
if (_conf->getEnableExtView())
|
||||
{
|
||||
toolTip += "\n\n";
|
||||
toolTip += tr("Double click for open screenshot in external default image viewer");
|
||||
}
|
||||
|
||||
_ui->scrLabel->setToolTip(toolTip);
|
||||
}
|
||||
|
||||
void MainWindow::createTray()
|
||||
{
|
||||
_trayed = false;
|
||||
actHideShow = new QAction(tr("Hide"), this);
|
||||
connect(actHideShow, &QAction::triggered, this, &MainWindow::windowHideShow);
|
||||
|
||||
// create tray menu
|
||||
_trayMenu = new QMenu(this);
|
||||
_trayMenu->addAction(actHideShow);
|
||||
_trayMenu->addSeparator();
|
||||
_trayMenu->addAction(actNew); // TODO - add icons (icon, action)
|
||||
_trayMenu->addAction(actSave);
|
||||
_trayMenu->addAction(actCopy);
|
||||
_trayMenu->addSeparator();
|
||||
_trayMenu->addAction(actOptions);
|
||||
_trayMenu->addSeparator();
|
||||
_trayMenu->addAction(actHelp);
|
||||
_trayMenu->addAction(actAbout);
|
||||
_trayMenu->addSeparator();
|
||||
_trayMenu->addAction(actQuit);
|
||||
|
||||
// icon menu
|
||||
QIcon icon(":/res/img/logo.png");
|
||||
|
||||
_trayIcon = new QSystemTrayIcon(this);
|
||||
|
||||
_trayIcon->setContextMenu(_trayMenu);
|
||||
_trayIcon->setIcon(icon);
|
||||
_trayIcon->show();
|
||||
connect(_trayIcon, &QSystemTrayIcon::activated, this, &MainWindow::trayClick);
|
||||
}
|
||||
|
||||
void MainWindow::killTray()
|
||||
{
|
||||
_trayed = false;
|
||||
_trayMenu->clear();
|
||||
|
||||
delete _trayIcon;
|
||||
_trayIcon = NULL;
|
||||
}
|
||||
|
||||
void MainWindow::delayBoxChange(int delay)
|
||||
{
|
||||
if (delay == 0)
|
||||
_ui->delayBox->setSpecialValueText(tr("None"));
|
||||
_conf->setDelay(delay);
|
||||
}
|
||||
|
||||
void MainWindow::typeScreenShotChange(int type)
|
||||
{
|
||||
_conf->setTypeScreen(type);
|
||||
}
|
||||
|
||||
void MainWindow::checkIncludeCursor(bool include)
|
||||
{
|
||||
_conf->setIncludeCursor(include);
|
||||
}
|
||||
|
||||
// updating UI from configdata
|
||||
void MainWindow::updateUI()
|
||||
{
|
||||
_ui->cbxTypeScr->setCurrentIndex(_conf->getTypeScreen());
|
||||
_ui->delayBox->setValue(_conf->getDelay());
|
||||
_ui->checkIncludeCursor->setChecked(_conf->getIncludeCursor());
|
||||
|
||||
updateShortcuts();
|
||||
|
||||
// create tray object
|
||||
if (_conf->getShowTrayIcon() && !_trayIcon)
|
||||
createTray();
|
||||
|
||||
// kill tray object, if tray was disabled in the configuration dialog
|
||||
if (!_conf->getShowTrayIcon() && _trayIcon)
|
||||
killTray();
|
||||
}
|
||||
|
||||
// mouse clicks on tray icom
|
||||
void MainWindow::trayClick(QSystemTrayIcon::ActivationReason reason)
|
||||
{
|
||||
switch(reason)
|
||||
{
|
||||
case QSystemTrayIcon::Trigger:
|
||||
windowHideShow();
|
||||
break;
|
||||
default: ;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::windowHideShow()
|
||||
{
|
||||
if (isHidden())
|
||||
{
|
||||
actHideShow->setText(tr("Hide"));
|
||||
_trayed = false;
|
||||
showNormal();
|
||||
activateWindow();
|
||||
}
|
||||
else
|
||||
{
|
||||
actHideShow->setText(tr("Show"));
|
||||
showMinimized();
|
||||
hide();
|
||||
_trayed = true;
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::hideToShot()
|
||||
{
|
||||
if (_conf->getShowTrayIcon())
|
||||
{
|
||||
_trayIcon->blockSignals(true);
|
||||
_trayIcon->setContextMenu(NULL); // enable context menu
|
||||
}
|
||||
|
||||
hide();
|
||||
}
|
||||
|
||||
void MainWindow::showWindow(const QString& str)
|
||||
{
|
||||
// get char of type screen (last) form received string
|
||||
QString typeNum = str[str.size() - 1];
|
||||
int type = typeNum.toInt();
|
||||
|
||||
// change type scrren in config & on main window
|
||||
_ui->cbxTypeScr->setCurrentIndex(type);
|
||||
typeScreenShotChange(type);
|
||||
}
|
||||
|
||||
void MainWindow::restoreFromShot()
|
||||
{
|
||||
if (!isVisible() && !_trayed)
|
||||
showNormal();
|
||||
|
||||
// if show tray
|
||||
if (_conf->getShowTrayIcon())
|
||||
{
|
||||
_trayIcon->blockSignals(false);
|
||||
_trayIcon->setContextMenu(_trayMenu); // enable context menu
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::saveScreen()
|
||||
{
|
||||
// create initial filepath
|
||||
QHash<QString, QString> formatsAvalible;
|
||||
|
||||
formatsAvalible["png"] = tr("PNG Files");
|
||||
formatsAvalible["jpg"] = tr("JPEG Files");
|
||||
formatsAvalible["bmp"] = tr("BMP Files");
|
||||
|
||||
QString format = "png";
|
||||
_conf->getSaveFormat();
|
||||
|
||||
Core* c = Core::instance();
|
||||
QString filePath = c->getSaveFilePath(format);
|
||||
|
||||
// create file filters
|
||||
QString fileFilters;
|
||||
|
||||
QString filterSelected;
|
||||
filterSelected = formatsAvalible[format];
|
||||
|
||||
QHash<QString, QString>::const_iterator iter = formatsAvalible.constBegin();
|
||||
while (iter != formatsAvalible.constEnd())
|
||||
{
|
||||
fileFilters.append(iter.value() + " (*." + iter.key() + ");;");
|
||||
++iter;
|
||||
}
|
||||
fileFilters.chop(2);
|
||||
|
||||
QString fileName;
|
||||
fileName = QFileDialog::getSaveFileName(this, tr("Save As..."), filePath, fileFilters, &filterSelected, QFileDialog::DontUseNativeDialog);
|
||||
|
||||
QRegExp rx("\\(\\*\\.[a-z]{3,4}\\)");
|
||||
quint8 tmp = filterSelected.size() - rx.indexIn(filterSelected);
|
||||
|
||||
filterSelected.chop(tmp + 1);
|
||||
format = formatsAvalible.key(filterSelected);
|
||||
|
||||
// if user canceled saving
|
||||
if (fileName.isEmpty())
|
||||
return;
|
||||
|
||||
c->writeScreen(fileName, format);
|
||||
}
|
||||
|
||||
void MainWindow::updateShortcuts()
|
||||
{
|
||||
actNew->setShortcut(_conf->shortcuts()->getShortcut(Config::shortcutNew));
|
||||
actSave->setShortcut(_conf->shortcuts()->getShortcut(Config::shortcutSave));
|
||||
actCopy->setShortcut(_conf->shortcuts()->getShortcut(Config::shortcutCopy));
|
||||
actOptions->setShortcut(_conf->shortcuts()->getShortcut(Config::shortcutOptions));
|
||||
actHelp->setShortcut(_conf->shortcuts()->getShortcut(Config::shortcutHelp));
|
||||
actQuit->setShortcut(_conf->shortcuts()->getShortcut(Config::shortcutClose));
|
||||
|
||||
#ifdef SG_GLOBAL_SHORTCUTS
|
||||
for (int i = 0; i < _globalShortcuts.count(); ++i)
|
||||
_globalShortcuts[i]->setShortcut(QKeySequence(_core->conf->shortcuts()->getShortcut(i)));
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef SG_GLOBAL_SHORTCUTS
|
||||
void MainWindow::globalShortcutBlock(bool state)
|
||||
{
|
||||
for (int i = 0; i < _globalShortcuts.count(); ++i)
|
||||
_globalShortcuts[i]->setDisabled(state);
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::globalShortcutActivate(int type)
|
||||
{
|
||||
_ui->cbxTypeScr->setCurrentIndex(type);
|
||||
typeScreenShotChange(type);
|
||||
|
||||
if (!_trayed)
|
||||
hide();
|
||||
QTimer::singleShot(200, _core, SLOT(screenShot()));
|
||||
}
|
||||
#endif
|
@ -1,117 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef MAINWINDOW_H
|
||||
#define MAINWINDOW_H
|
||||
|
||||
#include <QMainWindow>
|
||||
|
||||
#include "about.h"
|
||||
#include "configwidget.h"
|
||||
|
||||
#ifdef SG_GLOBAL_SHORTCUTS
|
||||
#include <QxtGui/QxtGlobalShortcut>
|
||||
#endif
|
||||
|
||||
#include <QMenu>
|
||||
#include <QSystemTrayIcon>
|
||||
#include <QDesktopServices>
|
||||
#include <QCloseEvent>
|
||||
#include <QShortcut>
|
||||
#include <QUrl>
|
||||
#include <QSignalMapper>
|
||||
|
||||
namespace Ui {
|
||||
class MainWindow;
|
||||
}
|
||||
|
||||
class MainWindow : public QMainWindow //, public screengrab
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MainWindow( QWidget *parent = 0);
|
||||
~MainWindow();
|
||||
void show();
|
||||
bool isTrayed() const;
|
||||
void showTrayMessage(const QString& header, const QString& message);
|
||||
void setConfig(Config *config);
|
||||
void updatePixmap(QPixmap *pMap);
|
||||
void updateModulesActions(QList<QAction*> list);
|
||||
void updateModulesenus(QList<QMenu*> list);
|
||||
|
||||
public Q_SLOTS:
|
||||
void showWindow(const QString& str);
|
||||
void windowHideShow();
|
||||
void hideToShot();
|
||||
void restoreFromShot();
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *e);
|
||||
void changeEvent(QEvent *e);
|
||||
void resizeEvent(QResizeEvent *event); // event resuze window
|
||||
bool eventFilter(QObject *obj, QEvent *event);
|
||||
|
||||
private:
|
||||
Ui::MainWindow *_ui;
|
||||
|
||||
QSystemTrayIcon *_trayIcon;
|
||||
QAction *actHideShow;
|
||||
QAction *actNew;
|
||||
QAction *actSave;
|
||||
QAction *actCopy;
|
||||
QAction *actOptions;
|
||||
QAction *actAbout;
|
||||
QAction *actHelp;
|
||||
QAction *actQuit;
|
||||
Config *_conf;
|
||||
QMenu *_trayMenu;
|
||||
QShortcut *_hideWnd;
|
||||
bool _trayed;
|
||||
|
||||
#ifdef SG_GLOBAL_SHORTCUTS
|
||||
QxtGlobalShortcut *_fullScreen;
|
||||
QxtGlobalShortcut *_activeWindow;
|
||||
QxtGlobalShortcut *_areaSelection;
|
||||
|
||||
QVector<QxtGlobalShortcut*> _globalShortcuts;
|
||||
QSignalMapper *_globalShortcutSignals;
|
||||
#endif
|
||||
|
||||
void displatScreenToolTip();
|
||||
void createTray();
|
||||
void killTray();
|
||||
void updateShortcuts();
|
||||
|
||||
private Q_SLOTS:
|
||||
void saveScreen();
|
||||
void showHelp();
|
||||
void showOptions();
|
||||
void showAbout();
|
||||
void delayBoxChange(int);
|
||||
void typeScreenShotChange(int type);
|
||||
void checkIncludeCursor(bool include);
|
||||
void updateUI();
|
||||
void trayClick(QSystemTrayIcon::ActivationReason reason);
|
||||
|
||||
#ifdef SG_GLOBAL_SHORTCUTS
|
||||
void globalShortcutActivate(int type);
|
||||
void globalShortcutBlock(bool state);
|
||||
#endif
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
@ -1,263 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>480</width>
|
||||
<height>343</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>480</width>
|
||||
<height>299</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>ScreenGrab</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::RightToLeft</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="scrLabel">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>450</width>
|
||||
<height>190</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="bottomBar" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>13</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="cbxTypeScr">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Type of screenshot</string>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Full screen</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Window</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Screen area</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Previous selection</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labTypeScr">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="layoutDirection">
|
||||
<enum>Qt::LeftToRight</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Type: </string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="delayBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Delay in seconds before taking screenshot</string>
|
||||
</property>
|
||||
<property name="suffix">
|
||||
<string> sec</string>
|
||||
</property>
|
||||
<property name="maximum">
|
||||
<number>90</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labDelay">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Delay</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>13</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkIncludeCursor">
|
||||
<property name="text">
|
||||
<string>Include mouse pointer</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QToolBar" name="toolBar">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>toolBar</string>
|
||||
</property>
|
||||
<property name="floatable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<attribute name="toolBarArea">
|
||||
<enum>TopToolBarArea</enum>
|
||||
</attribute>
|
||||
<attribute name="toolBarBreak">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -1,43 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2010 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "x11utils.h"
|
||||
|
||||
#include <xcb/xfixes.h>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QPainter>
|
||||
|
||||
void X11Utils::compositePointer(int offsetX, int offsetY, QPixmap *snapshot)
|
||||
{
|
||||
Xcb::ScopedCPointer<xcb_xfixes_get_cursor_image_reply_t> cursor(
|
||||
xcb_xfixes_get_cursor_image_reply(Xcb::connection(),
|
||||
xcb_xfixes_get_cursor_image_unchecked(Xcb::connection()),
|
||||
NULL));
|
||||
|
||||
if (cursor.isNull()) {
|
||||
return;
|
||||
}
|
||||
|
||||
QImage qcursorimg((uchar *) xcb_xfixes_get_cursor_image_cursor_image(cursor.data()),
|
||||
cursor->width, cursor->height,
|
||||
QImage::Format_ARGB32_Premultiplied);
|
||||
|
||||
QPainter painter(snapshot);
|
||||
painter.drawImage(QPointF(cursor->x - cursor->xhot - offsetX, cursor->y - cursor ->yhot - offsetY), qcursorimg);
|
||||
}
|
@ -1,50 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2010 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef X11UTILS_H
|
||||
#define X11UTILS_H
|
||||
|
||||
#include <QPixmap>
|
||||
#include <QScopedPointer>
|
||||
#include <QX11Info>
|
||||
|
||||
#include <X11/Xlib-xcb.h>
|
||||
#include <fixx11h.h>
|
||||
#include <xcb/xcb.h>
|
||||
|
||||
namespace X11Utils {
|
||||
void compositePointer(int offsetX, int offsetY, QPixmap *snapshot);
|
||||
}
|
||||
|
||||
|
||||
namespace Xcb {
|
||||
template <typename T>
|
||||
class ScopedCPointer : public QScopedPointer<T, QScopedPointerPodDeleter>
|
||||
{
|
||||
public:
|
||||
ScopedCPointer(T *p = 0) : QScopedPointer<T, QScopedPointerPodDeleter>(p) {}
|
||||
};
|
||||
|
||||
inline xcb_connection_t *connection()
|
||||
{
|
||||
return XGetXCBConnection(QX11Info::display());
|
||||
}
|
||||
} // namespace Xcb
|
||||
|
||||
#endif // X11UTILS_H
|
||||
|
@ -1,43 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef ABSTRACTMODULE_H
|
||||
#define ABSTRACTMODULE_H
|
||||
|
||||
#include <QList>
|
||||
#include <QWidget>
|
||||
#include <QAction>
|
||||
#include <QMenu>
|
||||
|
||||
class AbstractModule
|
||||
{
|
||||
public:
|
||||
AbstractModule() {};
|
||||
virtual ~AbstractModule() {};
|
||||
|
||||
// interface
|
||||
virtual void init() = 0;
|
||||
virtual QString moduleName() = 0;
|
||||
virtual QWidget* initConfigWidget() = 0;
|
||||
virtual void defaultSettings() = 0;
|
||||
virtual QMenu* initModuleMenu() = 0;
|
||||
virtual QAction* initModuleAction() = 0;
|
||||
};
|
||||
|
||||
|
||||
#endif // ABSTRACTMODULE_H
|
@ -1,35 +0,0 @@
|
||||
set (extedit_SRC
|
||||
moduleextedit.cpp
|
||||
extedit.cpp
|
||||
)
|
||||
|
||||
set (extedit_HDR
|
||||
extedit.h
|
||||
)
|
||||
|
||||
lxqt_translate_ts(extedit_QMS
|
||||
USE_QT5 TRUE
|
||||
UPDATE_TRANSLATIONS ${UPDATE_TRANSLATIONS}
|
||||
TEMPLATE "extedit"
|
||||
TRANSLATION_DIR "${CMAKE_SOURCE_DIR}/translations"
|
||||
SOURCES
|
||||
${extedit_SRC}
|
||||
${extedit_HDR}
|
||||
INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/translations"
|
||||
)
|
||||
|
||||
qt5_translation_loader(extedit_QM_LOADER
|
||||
"${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}/translations"
|
||||
"extedit"
|
||||
)
|
||||
|
||||
add_library(extedit
|
||||
SHARED
|
||||
${extedit_SRC}
|
||||
${extedit_QMS}
|
||||
${extedit_QM_LOADER}
|
||||
)
|
||||
set_property (TARGET extedit PROPERTY SOVERSION 1.0.0)
|
||||
install(TARGETS extedit DESTINATION ${SG_LIBDIR})
|
||||
|
||||
target_link_libraries(extedit Qt5::Widgets Qt5::X11Extras Qt5Xdg)
|
@ -1,93 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "extedit.h"
|
||||
#include "core/core.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QMimeDatabase>
|
||||
|
||||
ExtEdit::ExtEdit(QObject *parent) :
|
||||
QObject(parent), _watcherEditedFile(new QFileSystemWatcher(this))
|
||||
{
|
||||
createAppList();
|
||||
_fileIsChanged = false;
|
||||
connect(_watcherEditedFile, &QFileSystemWatcher::fileChanged, this, &ExtEdit::editedFileChanged);
|
||||
}
|
||||
|
||||
QList<XdgAction*> ExtEdit::getActions()
|
||||
{
|
||||
return _actionList;
|
||||
}
|
||||
|
||||
void ExtEdit::runExternalEditor()
|
||||
{
|
||||
XdgAction *action = static_cast<XdgAction*>(sender());
|
||||
|
||||
Core *core = Core::instance();
|
||||
QString format = core->config()->getSaveFormat();
|
||||
if (format.isEmpty())
|
||||
format = "png";
|
||||
|
||||
_editFilename = core->getTempFilename(format);
|
||||
core->writeScreen(_editFilename, format, true);
|
||||
|
||||
QProcess *execProcess = new QProcess(this);
|
||||
void (QProcess:: *signal)(int, QProcess::ExitStatus) = &QProcess::finished;
|
||||
connect(execProcess, signal, this, &ExtEdit::closedExternalEditor);
|
||||
|
||||
execProcess->start(action->desktopFile().expandExecString().first(),
|
||||
QStringList() << _editFilename);
|
||||
_watcherEditedFile->addPath(_editFilename);
|
||||
}
|
||||
|
||||
void ExtEdit::closedExternalEditor(int, QProcess::ExitStatus)
|
||||
{
|
||||
Core *core = Core::instance();
|
||||
|
||||
if (_fileIsChanged == true)
|
||||
core->updatePixmap();
|
||||
|
||||
_fileIsChanged = false;
|
||||
_watcherEditedFile->removePath(_editFilename);
|
||||
|
||||
sender()->deleteLater();
|
||||
core->killTempFile();
|
||||
_editFilename.clear();
|
||||
}
|
||||
|
||||
void ExtEdit::editedFileChanged(const QString&)
|
||||
{
|
||||
_fileIsChanged = true;
|
||||
}
|
||||
|
||||
void ExtEdit::createAppList()
|
||||
{
|
||||
Core *core = Core::instance();
|
||||
QString format = core->config()->getSaveFormat();
|
||||
if (format.isEmpty())
|
||||
format = "png";
|
||||
|
||||
QString fileName = _editFilename.isEmpty() ? core->getTempFilename(format) : _editFilename;
|
||||
QMimeDatabase db;
|
||||
QMimeType mt = db.mimeTypeForFile(fileName);
|
||||
_appList = XdgDesktopFileCache::getApps(mt.name());
|
||||
|
||||
foreach (XdgDesktopFile *app, _appList)
|
||||
_actionList << new XdgAction(app);
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef EXTEDIT_H
|
||||
#define EXTEDIT_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QProcess>
|
||||
#include <QFileSystemWatcher>
|
||||
#include <QAction>
|
||||
#include <qt5xdg/XdgDesktopFile>
|
||||
#include <qt5xdg/XdgAction>
|
||||
|
||||
class ExtEdit : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ExtEdit(QObject *parent = 0);
|
||||
QList<XdgAction*> getActions();
|
||||
|
||||
public Q_SLOTS:
|
||||
void runExternalEditor();
|
||||
|
||||
private Q_SLOTS:
|
||||
void closedExternalEditor(int exitCode, QProcess::ExitStatus exitStatus);
|
||||
void editedFileChanged(const QString & path);
|
||||
|
||||
private:
|
||||
void createAppList();
|
||||
|
||||
QList<XdgDesktopFile*> _appList;
|
||||
QList<XdgAction*> _actionList;
|
||||
QString _editFilename;
|
||||
bool _fileIsChanged;
|
||||
QFileSystemWatcher *_watcherEditedFile;
|
||||
};
|
||||
|
||||
#endif // EXTEDIT_H
|
@ -1,77 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "moduleextedit.h"
|
||||
|
||||
#include <QObject>
|
||||
|
||||
ModuleExtEdit::ModuleExtEdit()
|
||||
{
|
||||
_extEdit = new ExtEdit();
|
||||
}
|
||||
|
||||
ModuleExtEdit::~ModuleExtEdit()
|
||||
{
|
||||
if (_extEdit)
|
||||
{
|
||||
delete _extEdit;
|
||||
}
|
||||
}
|
||||
|
||||
QString ModuleExtEdit::moduleName()
|
||||
{
|
||||
return QObject::tr("External edit");
|
||||
}
|
||||
|
||||
|
||||
void ModuleExtEdit::init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
QMenu* ModuleExtEdit::initModuleMenu()
|
||||
{
|
||||
QMenu *menu = new QMenu(QObject::tr("Edit in..."), 0);
|
||||
QList<XdgAction*> actionsList = _extEdit->getActions();
|
||||
|
||||
foreach (XdgAction *appAction, actionsList)
|
||||
{
|
||||
menu->addAction(appAction);
|
||||
appAction->disconnect(SIGNAL(triggered()));
|
||||
QObject::connect(appAction, SIGNAL(triggered()), _extEdit, SLOT(runExternalEditor()));
|
||||
}
|
||||
|
||||
menu->setObjectName("menuExtedit");
|
||||
return menu;
|
||||
}
|
||||
|
||||
QWidget* ModuleExtEdit::initConfigWidget()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ModuleExtEdit::defaultSettings()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
QAction* ModuleExtEdit::initModuleAction()
|
||||
{
|
||||
return 0;
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef MODULEEXTEDIT_H
|
||||
#define MODULEEXTEDIT_H
|
||||
|
||||
#include "modules/abstractmodule.h"
|
||||
|
||||
#include "extedit.h"
|
||||
#include <QAction>
|
||||
|
||||
class ModuleExtEdit: public AbstractModule
|
||||
{
|
||||
public:
|
||||
ModuleExtEdit();
|
||||
virtual ~ModuleExtEdit();
|
||||
QString moduleName();
|
||||
void init();
|
||||
QMenu* initModuleMenu();
|
||||
QWidget* initConfigWidget();
|
||||
void defaultSettings();
|
||||
QAction* initModuleAction();
|
||||
|
||||
private:
|
||||
ExtEdit *_extEdit;
|
||||
};
|
||||
|
||||
#endif // MODULEEXTEDIT_H
|
@ -1,51 +0,0 @@
|
||||
set(uploader_SRC
|
||||
moduleuploader.cpp
|
||||
uploader.cpp
|
||||
imgur/uploader_imgur.cpp
|
||||
uploaderconfig.cpp
|
||||
dialoguploader.cpp
|
||||
uploaderconfigwidget.cpp
|
||||
imgur/uploader_imgur_widget.cpp
|
||||
imgur/uploaderconfigwidget_imgur.cpp
|
||||
mediacrush/uploader_mediacrush.cpp
|
||||
mediacrush/uploader_mediacrush_widget.cpp
|
||||
mediacrush/uploaderconfigwidget_mediacrush.cpp
|
||||
)
|
||||
|
||||
set(uploader_UI
|
||||
dialoguploader.ui
|
||||
uploaderconfigwidget.ui
|
||||
imgur/uploader_imgur_widget.ui
|
||||
imgur/uploaderconfigwidget_imgur.ui
|
||||
mediacrush/uploader_mediacrush_widget.ui
|
||||
mediacrush/uploaderconfigwidget_mediacrush.ui
|
||||
)
|
||||
|
||||
lxqt_translate_ts(uploader_QMS
|
||||
USE_QT5 TRUE
|
||||
UPDATE_TRANSLATIONS ${UPDATE_TRANSLATIONS}
|
||||
TEMPLATE "uploader"
|
||||
TRANSLATION_DIR "${CMAKE_SOURCE_DIR}/translations"
|
||||
SOURCES
|
||||
${uploader_SRC}
|
||||
${uploader_UI}
|
||||
INSTALL_DIR "${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME}/translations"
|
||||
)
|
||||
|
||||
qt5_translation_loader(uploader_QM_LOADER
|
||||
"${CMAKE_INSTALL_FULL_DATADIR}/${PROJECT_NAME}/translations"
|
||||
"uploader"
|
||||
)
|
||||
|
||||
add_library(uploader
|
||||
SHARED
|
||||
${uploader_SRC}
|
||||
${uploader_UI}
|
||||
${uploader_QMS}
|
||||
${uploader_QM_LOADER}
|
||||
)
|
||||
|
||||
set_property (TARGET uploader PROPERTY SOVERSION 1.0.0)
|
||||
install(TARGETS uploader DESTINATION ${SG_LIBDIR})
|
||||
|
||||
target_link_libraries(uploader Qt5::Widgets Qt5::Network Qt5::X11Extras)
|
@ -1,262 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "dialoguploader.h"
|
||||
#include "ui_dialoguploader.h"
|
||||
|
||||
#include "uploaderconfig.h"
|
||||
#include "imgur/uploader_imgur.h"
|
||||
#include "imgur/uploader_imgur_widget.h"
|
||||
#include "mediacrush/uploader_mediacrush.h"
|
||||
#include "mediacrush/uploader_mediacrush_widget.h"
|
||||
#include <core/core.h>
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QDesktopServices>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
DialogUploader::DialogUploader(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
_ui(new Ui::DialogUploader)
|
||||
{
|
||||
_ui->setupUi(this);
|
||||
_ui->stackedWidget->setCurrentIndex(0);
|
||||
_uploader = 0;
|
||||
_uploaderWidget = 0;
|
||||
slotSeletHost(0);
|
||||
|
||||
_ui->cbxUploaderList->addItems(UploaderConfig::labelsList());
|
||||
|
||||
UploaderConfig config;
|
||||
QString defaultHost = config.loadSingleParam(QByteArray("common"), QByteArray(KEY_DEFAULT_HOST)).toString();
|
||||
|
||||
if (defaultHost.isEmpty())
|
||||
_selectedHost = 0;
|
||||
else
|
||||
{
|
||||
_selectedHost = config.labelsList().indexOf(defaultHost);
|
||||
if (_selectedHost == -1)
|
||||
_selectedHost = 0;
|
||||
}
|
||||
|
||||
// load ishot preview
|
||||
QSize imgSize = Core::instance()->getPixmap()->size();
|
||||
QString pixmapSize = tr("Size: ") + QString::number(imgSize.width()) + "x" + QString::number(imgSize.height()) + tr(" pixel");
|
||||
_ui->labImgSize->setText(pixmapSize);
|
||||
|
||||
_ui->labImage->setFixedWidth(256);
|
||||
_ui->labImage->setFixedHeight(192);
|
||||
_ui->labImage->setPixmap(Core::instance()->getPixmap()->scaled(_ui->labImage->size(),
|
||||
Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||
|
||||
// progressbar
|
||||
_ui->progressBar->setVisible(false);
|
||||
_ui->progressBar->setFormat(tr("Uploaded ") + "%p%" + " (" + "%v" + " of " + "%m bytes");
|
||||
|
||||
// upload staus labelsList
|
||||
_ui->labUploadStatus->setText(tr("Ready to upload"));
|
||||
|
||||
connect(_ui->butClose, &QPushButton::clicked, this, &DialogUploader::close);
|
||||
connect(_ui->butUpload, &QPushButton::clicked, this, &DialogUploader::slotUploadStart);
|
||||
|
||||
void (QComboBox::*uploaderChnage)(int) = &QComboBox::currentIndexChanged;
|
||||
connect(_ui->cbxUploaderList, uploaderChnage, this, &DialogUploader::slotSeletHost);
|
||||
|
||||
_ui->cbxUploaderList->setCurrentIndex(_selectedHost);
|
||||
}
|
||||
|
||||
DialogUploader::~DialogUploader()
|
||||
{
|
||||
qDebug() << "delete dialog upload";
|
||||
|
||||
if (_uploader)
|
||||
delete _uploader;
|
||||
delete _uploaderWidget;
|
||||
delete _ui;
|
||||
}
|
||||
|
||||
void DialogUploader::changeEvent(QEvent *e)
|
||||
{
|
||||
QDialog::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
case QEvent::LanguageChange:
|
||||
_ui->retranslateUi(this);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DialogUploader::slotUploadStart()
|
||||
{
|
||||
_ui->progressBar->setVisible(true);
|
||||
_ui->butUpload->setEnabled(false);
|
||||
_ui->labUploadStatus->setText(tr("Upload processing... Please wait"));
|
||||
|
||||
switch(_selectedHost)
|
||||
{
|
||||
case 0:
|
||||
_uploader = new Uploader_MediaCrush(Core::instance()->config()->getSaveFormat());
|
||||
break;
|
||||
case 1:
|
||||
_uploader = new Uploader_ImgUr;
|
||||
break;
|
||||
default:
|
||||
_uploader = new Uploader_ImgUr;
|
||||
}
|
||||
|
||||
QVariantMap userSettings;
|
||||
_uploader->getUserSettings(userSettings);;
|
||||
|
||||
_uploader->startUploading();
|
||||
|
||||
connect(_uploader, &Uploader::uploadProgress, this, &DialogUploader::slotUploadProgress);
|
||||
|
||||
void (Uploader::*uploadDone)() = &Uploader::uploadDone;
|
||||
connect(_uploader, uploadDone, this, &DialogUploader::slotUploadDone);
|
||||
connect(_uploader, &Uploader::uploadFail, this, &DialogUploader::slotUploadFail);
|
||||
connect(_ui->butCopyLink, &QPushButton::clicked, this, &DialogUploader::slotCopyLink);
|
||||
connect(_ui->butCopyExtCode, &QPushButton::clicked, this, &DialogUploader::slotCopyLink);
|
||||
connect(_ui->butOpenDirectLink, &QPushButton::clicked, this, &DialogUploader::slotOpenDirectLink);
|
||||
connect(_ui->butDeleteLink, &QPushButton::clicked, this, &DialogUploader::slotOpenDeleteLink);
|
||||
}
|
||||
|
||||
void DialogUploader::slotSeletHost(int type)
|
||||
{
|
||||
_selectedHost = type;
|
||||
|
||||
if (_uploaderWidget)
|
||||
delete _uploaderWidget;
|
||||
|
||||
switch(_selectedHost)
|
||||
{
|
||||
case 0:
|
||||
_uploaderWidget = new Uploader_MediaCrush_Widget();
|
||||
break;
|
||||
case 1:
|
||||
_uploaderWidget = new Uploader_ImgUr_Widget();
|
||||
break;
|
||||
default:
|
||||
_uploaderWidget = new Uploader_MediaCrush_Widget();
|
||||
}
|
||||
|
||||
_ui->stackedWidget->addWidget(_uploaderWidget);
|
||||
_ui->stackedWidget->setCurrentWidget(_uploaderWidget);
|
||||
}
|
||||
|
||||
void DialogUploader::slotUploadProgress(qint64 bytesSent, qint64 bytesTotal)
|
||||
{
|
||||
_ui->progressBar->setMaximum(bytesTotal);
|
||||
_ui->progressBar->setValue(bytesSent);
|
||||
|
||||
if (bytesSent == bytesTotal)
|
||||
_ui->progressBar->setFormat(tr("Receiving a response from the server"));
|
||||
}
|
||||
|
||||
void DialogUploader::slotUploadDone()
|
||||
{
|
||||
qDebug() << "start dialog uploader done";
|
||||
QList<ResultString_t> links = _uploader->parsedLinksToGui();
|
||||
_ui->editDirectLink->setText(links.first().first);
|
||||
_ui->editDeleteLink->setText(links.last().first);
|
||||
|
||||
for (int i =1; i < links.count()-1; ++i)
|
||||
{
|
||||
_ui->cbxExtCode->addItem(links.at(i).second);
|
||||
_resultLinks << links.at(i).first;
|
||||
}
|
||||
|
||||
_ui->stackedWidget->setCurrentIndex(0);
|
||||
_ui->labUploadStatus->setText(tr("Upload completed"));
|
||||
_ui->progressBar->setVisible(false);
|
||||
_ui->cbxUploaderList->setEnabled(false);
|
||||
|
||||
UploaderConfig config;
|
||||
if (config.autoCopyResultLink())
|
||||
QApplication::clipboard()->setText(_ui->editDirectLink->text());
|
||||
|
||||
if (_resultLinks.count() > 0)
|
||||
{
|
||||
connect(_ui->cbxExtCode, SIGNAL(currentIndexChanged(int)), this, SLOT(slotChangeExtCode(int)));
|
||||
_ui->cbxExtCode->setCurrentIndex(0);
|
||||
_ui->editExtCode->setText(_resultLinks.at(0));
|
||||
}
|
||||
else
|
||||
{
|
||||
_ui->editExtCode->setVisible(false);
|
||||
_ui->cbxExtCode->setVisible(false);
|
||||
_ui->butCopyExtCode->setVisible(false);
|
||||
_ui->labExtCode_2->setVisible(false);
|
||||
}
|
||||
|
||||
_ui->butClose->setText(tr("Close"));
|
||||
}
|
||||
|
||||
void DialogUploader::slotUploadFail(const QByteArray& error)
|
||||
{
|
||||
Q_UNUSED(error);
|
||||
QMessageBox msg(this);
|
||||
msg.setText(tr("Error uploading screenshot"));
|
||||
msg.setWindowTitle(tr("Error"));
|
||||
msg.setIcon(QMessageBox::Critical);
|
||||
msg.exec();
|
||||
|
||||
_ui->progressBar->setVisible(false);
|
||||
_ui->labUploadStatus->setText(tr("Ready to upload"));
|
||||
_ui->butUpload->setEnabled(true);
|
||||
_ui->butClose->setText(tr("Close"));
|
||||
}
|
||||
|
||||
void DialogUploader::slotChangeExtCode(int code)
|
||||
{
|
||||
_ui->editExtCode->setText(_resultLinks.at(code));
|
||||
}
|
||||
|
||||
void DialogUploader::slotCopyLink()
|
||||
{
|
||||
QString objName = sender()->objectName();
|
||||
QString copyText;
|
||||
|
||||
if (objName == "butCopyLink")
|
||||
copyText = _ui->editDirectLink->text();
|
||||
|
||||
if (objName == "butCopyExtCode")
|
||||
copyText = _ui->editExtCode->text();
|
||||
|
||||
qApp->clipboard()->setText(copyText);
|
||||
}
|
||||
|
||||
void DialogUploader::slotOpenDirectLink()
|
||||
{
|
||||
QDesktopServices::openUrl(QUrl(_ui->editDirectLink->text()));
|
||||
}
|
||||
|
||||
void DialogUploader::slotOpenDeleteLink()
|
||||
{
|
||||
QMessageBox msg(this);
|
||||
msg.setText(tr("Open this link in your default web-browser, it may directly delete your uploaded image, without any warnings."));
|
||||
msg.setInformativeText(tr("Are you sure you want to continue?"));
|
||||
msg.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
|
||||
msg.setDefaultButton(QMessageBox::No);
|
||||
int result = msg.exec();
|
||||
|
||||
if (result == QMessageBox::Yes)
|
||||
QDesktopServices::openUrl(QUrl(_ui->editDeleteLink->text()));
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef DIALOGUPLOADER_H
|
||||
#define DIALOGUPLOADER_H
|
||||
|
||||
#include "uploader.h"
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
class DialogUploader;
|
||||
}
|
||||
|
||||
class DialogUploader : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit DialogUploader(QWidget *parent = 0);
|
||||
~DialogUploader();
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
private Q_SLOTS:
|
||||
void slotUploadStart();
|
||||
void slotSeletHost(int type);
|
||||
void slotUploadProgress(qint64 bytesSent, qint64 bytesTotal);
|
||||
void slotUploadDone();
|
||||
void slotUploadFail(const QByteArray &error);
|
||||
void slotChangeExtCode(int code);
|
||||
void slotCopyLink();
|
||||
void slotOpenDirectLink();
|
||||
void slotOpenDeleteLink();
|
||||
|
||||
private:
|
||||
Ui::DialogUploader *_ui;
|
||||
|
||||
Uploader* _uploader;
|
||||
QWidget* _uploaderWidget;
|
||||
|
||||
// storage id curren selected img sho
|
||||
qint8 _selectedHost;
|
||||
|
||||
QStringList _resultLinks;
|
||||
};
|
||||
|
||||
#endif // DIALOGUPLOADER_H
|
@ -1,339 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DialogUploader</class>
|
||||
<widget class="QDialog" name="DialogUploader">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>841</width>
|
||||
<height>340</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Upload to internet</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="labUploaderList">
|
||||
<property name="text">
|
||||
<string>Upload to</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="cbxUploaderList"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="labImage">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::Panel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labImgSize">
|
||||
<property name="text">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="resultPage">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="labDirectLink">
|
||||
<property name="text">
|
||||
<string>Direct link:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="editDirectLink">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="butOpenDirectLink">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>112</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Open this link in the default web-browser</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Open</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="butCopyLink">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>112</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Copy this link to the clipboard</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Copy</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<widget class="QLabel" name="labExtCode_2">
|
||||
<property name="text">
|
||||
<string>Extended preformed html or bb codes:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="cbxExtCode"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="editExtCode">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="butCopyExtCode">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>112</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Copy this link to the clipboard</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Copy</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labDeleteLink">
|
||||
<property name="text">
|
||||
<string>Link to delete image:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="editDeleteLink">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="butDeleteLink">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>112</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Open this link in the default web-browser</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Open</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>34</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
<zorder>labDirectLink</zorder>
|
||||
<zorder>labDeleteLink</zorder>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>96</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="labUploadStatus">
|
||||
<property name="text">
|
||||
<string notr="true">TextLabel</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QProgressBar" name="progressBar">
|
||||
<property name="value">
|
||||
<number>24</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>96</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="butUpload">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>112</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Upload</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="butClose">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>112</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Cancel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>12</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -1,103 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "uploader_imgur.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
Uploader_ImgUr::Uploader_ImgUr(QObject* parent): Uploader(parent)
|
||||
{
|
||||
qDebug() << " create Imgur uploader";
|
||||
}
|
||||
|
||||
Uploader_ImgUr::~Uploader_ImgUr()
|
||||
{
|
||||
qDebug() << " kill Imgur uploader";
|
||||
}
|
||||
|
||||
/*!
|
||||
* Start upload process
|
||||
*/
|
||||
void Uploader_ImgUr::startUploading()
|
||||
{
|
||||
createData();
|
||||
createRequest(imageData, apiUrl());
|
||||
_request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded");
|
||||
|
||||
Uploader::startUploading();
|
||||
}
|
||||
|
||||
/*!
|
||||
* Return url for upload image
|
||||
*/
|
||||
QUrl Uploader_ImgUr::apiUrl()
|
||||
{
|
||||
return QUrl("http://api.imgur.com/2/upload");
|
||||
}
|
||||
|
||||
/*!
|
||||
* Prepare image data for uploading
|
||||
*/
|
||||
void Uploader_ImgUr::createData(bool inBase64)
|
||||
{
|
||||
inBase64 = true;
|
||||
Uploader::createData(inBase64);
|
||||
|
||||
// create data for upload
|
||||
QByteArray uploadData;
|
||||
|
||||
uploadData.append(QString("key=").toUtf8());
|
||||
uploadData.append(QUrl::toPercentEncoding("6920a141451d125b3e1357ce0e432409"));
|
||||
uploadData.append(QString("&image=").toUtf8());
|
||||
uploadData.append(QUrl::toPercentEncoding(this->imageData));
|
||||
|
||||
this->imageData = uploadData;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Process server reply data
|
||||
*/
|
||||
void Uploader_ImgUr::replyFinished(QNetworkReply* reply)
|
||||
{
|
||||
if (reply->error() == QNetworkReply::NoError)
|
||||
{
|
||||
QByteArray replyXmalText = reply->readAll();
|
||||
|
||||
// creating list of element names
|
||||
QVector<QByteArray> listXmlNodes;
|
||||
listXmlNodes << "original" << "imgur_page" << "large_thumbnail" << "small_square" << "delete_page";
|
||||
|
||||
QMap<QByteArray, QByteArray> replyXmlMap = parseResultStrings(listXmlNodes, replyXmalText);
|
||||
|
||||
_uploadedStrings[UL_DIRECT_LINK].first = replyXmlMap["original"];
|
||||
_uploadedStrings[UL_HTML_CODE].first = "<img src=\"" + replyXmlMap["original"] + "\" />";
|
||||
_uploadedStrings[UL_BB_CODE].first = "[img]" + replyXmlMap["original"] +"[/img]";
|
||||
_uploadedStrings[UL_HTML_CODE_THUMB].first = "<a href=\"" + replyXmlMap["original"] + "\"><img src=\"" + replyXmlMap["small_square"] + "\" /></a>";
|
||||
_uploadedStrings[UL_BB_CODE_THUMB].first = "[url=" + replyXmlMap["original"] + "][img]"+ replyXmlMap["small_square"] +"[/img][/url]";
|
||||
_uploadedStrings[UL_DELETE_URL].first = replyXmlMap["delete_page"];
|
||||
qDebug() << "done" << _uploadedStrings[UL_DIRECT_LINK].first;
|
||||
Q_EMIT uploadDoneStr(_uploadedStrings[UL_DIRECT_LINK].first);
|
||||
Q_EMIT uploadDone();
|
||||
}
|
||||
else
|
||||
{
|
||||
Q_EMIT uploadFail(reply->errorString().toLatin1());
|
||||
}
|
||||
|
||||
reply->deleteLater();
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef UPLOADER_IMGUR_H
|
||||
#define UPLOADER_IMGUR_H
|
||||
|
||||
#include <uploader.h>
|
||||
|
||||
#include <QUrl>
|
||||
|
||||
namespace UploadImgUr {
|
||||
enum Error {
|
||||
ErrorFile,
|
||||
ErrorNetwork,
|
||||
ErrorCredits,
|
||||
ErrorUpload,
|
||||
ErrorCancel,
|
||||
};
|
||||
};
|
||||
|
||||
class Uploader_ImgUr : public Uploader
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Uploader_ImgUr(QObject* parent = 0);
|
||||
virtual ~Uploader_ImgUr();
|
||||
|
||||
virtual void startUploading();
|
||||
|
||||
protected:
|
||||
virtual QUrl apiUrl();
|
||||
virtual void createData(bool inBase64 = false);
|
||||
|
||||
protected Q_SLOTS:
|
||||
virtual void replyFinished(QNetworkReply* reply);
|
||||
};
|
||||
|
||||
#endif // UPLOADER_IMGUR_H
|
||||
|
@ -1,44 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "uploader_imgur_widget.h"
|
||||
#include "ui_uploader_imgur_widget.h"
|
||||
|
||||
Uploader_ImgUr_Widget::Uploader_ImgUr_Widget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
_ui(new Ui::Uploader_ImgUr_Widget)
|
||||
{
|
||||
_ui->setupUi(this);
|
||||
}
|
||||
|
||||
Uploader_ImgUr_Widget::~Uploader_ImgUr_Widget()
|
||||
{
|
||||
delete _ui;
|
||||
}
|
||||
|
||||
void Uploader_ImgUr_Widget::changeEvent(QEvent *e)
|
||||
{
|
||||
QWidget::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
case QEvent::LanguageChange:
|
||||
_ui->retranslateUi(this);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef UPLOADER_IMGUR_WIDGET_H
|
||||
#define UPLOADER_IMGUR_WIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QVariant>
|
||||
|
||||
namespace Ui {
|
||||
class Uploader_ImgUr_Widget;
|
||||
}
|
||||
|
||||
class Uploader_ImgUr_Widget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Uploader_ImgUr_Widget(QWidget *parent = 0);
|
||||
~Uploader_ImgUr_Widget();
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
private:
|
||||
Ui::Uploader_ImgUr_Widget *_ui;
|
||||
};
|
||||
|
||||
#endif // UPLOADER_IMGUR_WIDGET_H
|
@ -1,44 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Uploader_ImgUr_Widget</class>
|
||||
<widget class="QWidget" name="Uploader_ImgUr_Widget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>470</width>
|
||||
<height>222</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Upload to imgur.com</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="labTitle">
|
||||
<property name="text">
|
||||
<string>Upload to ImgUr.com</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>183</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -1,63 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "uploaderconfigwidget_imgur.h"
|
||||
#include "ui_uploaderconfigwidget_imgur.h"
|
||||
|
||||
#include "uploaderconfig.h"
|
||||
|
||||
#include <QVariant>
|
||||
|
||||
UploaderConfigWidget_ImgUr::UploaderConfigWidget_ImgUr(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
_ui(new Ui::UploaderConfigWidget_ImgUr)
|
||||
{
|
||||
_ui->setupUi(this);
|
||||
|
||||
// load settings
|
||||
UploaderConfig config;
|
||||
|
||||
QVariantMap loadedValues;
|
||||
// TODO add imgur settings load
|
||||
|
||||
}
|
||||
|
||||
UploaderConfigWidget_ImgUr::~UploaderConfigWidget_ImgUr()
|
||||
{
|
||||
delete _ui;
|
||||
}
|
||||
|
||||
void UploaderConfigWidget_ImgUr::saveSettings()
|
||||
{
|
||||
UploaderConfig config;
|
||||
|
||||
QVariantMap savingValues;
|
||||
}
|
||||
|
||||
|
||||
void UploaderConfigWidget_ImgUr::changeEvent(QEvent *e)
|
||||
{
|
||||
QWidget::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
case QEvent::LanguageChange:
|
||||
_ui->retranslateUi(this);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef UPLOADERCONFIGWIDGET_IMGUR_H
|
||||
#define UPLOADERCONFIGWIDGET_IMGUR_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class UploaderConfigWidget_ImgUr;
|
||||
}
|
||||
|
||||
class UploaderConfigWidget_ImgUr : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit UploaderConfigWidget_ImgUr(QWidget *parent = 0);
|
||||
~UploaderConfigWidget_ImgUr();
|
||||
|
||||
public Q_SLOTS:
|
||||
void saveSettings();
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
private:
|
||||
Ui::UploaderConfigWidget_ImgUr *_ui;
|
||||
};
|
||||
|
||||
#endif // UPLOADERCONFIGWIDGET_IMGUR_H
|
@ -1,67 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>UploaderConfigWidget_ImgUr</class>
|
||||
<widget class="QWidget" name="UploaderConfigWidget_ImgUr">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>320</width>
|
||||
<height>249</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Configuration for imgur.com</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="labTitle">
|
||||
<property name="text">
|
||||
<string>Configuration for imgur.com upload</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>88</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labImgurConfDescription">
|
||||
<property name="text">
|
||||
<string>Now is nothing yet</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>87</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -1,137 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "uploader_mediacrush.h"
|
||||
|
||||
#include <QStringList>
|
||||
#include <QtNetwork/QHttpMultiPart>
|
||||
#include <QtNetwork/QHttpPart>
|
||||
|
||||
#include "uploaderconfig.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
Uploader_MediaCrush::Uploader_MediaCrush(const QString& format, QObject* parent): Uploader(parent)
|
||||
{
|
||||
_host = "mediacru.sh";
|
||||
qDebug() << " create MediaCrush uploader";
|
||||
UpdateUploadedStrList();
|
||||
setCurrentFormat(format);
|
||||
}
|
||||
|
||||
Uploader_MediaCrush::~Uploader_MediaCrush()
|
||||
{
|
||||
qDebug() << " kill MediaCrush uploader";
|
||||
}
|
||||
|
||||
/*!
|
||||
* Start upload process
|
||||
*/
|
||||
void Uploader_MediaCrush::startUploading()
|
||||
{
|
||||
createData();
|
||||
createRequest(imageData, apiUrl());
|
||||
|
||||
_request.setRawHeader("Host", _host);
|
||||
Uploader::startUploading();
|
||||
}
|
||||
|
||||
/*!
|
||||
* Set type of uploading image, for generate right direct link on it.
|
||||
*/
|
||||
void Uploader_MediaCrush::setCurrentFormat(const QString& format)
|
||||
{
|
||||
_currentFormat = format.toLatin1();
|
||||
}
|
||||
|
||||
/*!
|
||||
* Return url for upload image
|
||||
*/
|
||||
QUrl Uploader_MediaCrush::apiUrl()
|
||||
{
|
||||
UploaderConfig config;
|
||||
// QUrl("https://mediacru.sh/api/upload/file")
|
||||
|
||||
return config.loadSingleParam("mediacru.sh", KEY_MCSH_URL).toUrl();
|
||||
}
|
||||
|
||||
/*!
|
||||
* Prepare image data for uploading
|
||||
*/
|
||||
void Uploader_MediaCrush::createData(bool inBase64)
|
||||
{
|
||||
Uploader::createData(inBase64);
|
||||
|
||||
_multipartData = new QHttpMultiPart(QHttpMultiPart::FormDataType);
|
||||
|
||||
QHttpPart imagePart;
|
||||
if (_formatString == "jpg")
|
||||
{
|
||||
imagePart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("image/jpeg"));
|
||||
}
|
||||
else
|
||||
{
|
||||
imagePart.setHeader(QNetworkRequest::ContentTypeHeader, QVariant("image/" + _formatString));
|
||||
}
|
||||
QByteArray disposition = "form-data; name=\"file\"; filename='"+ _uploadFilename.toLatin1() +"'";
|
||||
imagePart.setHeader(QNetworkRequest::ContentDispositionHeader, QVariant(disposition));
|
||||
imagePart.setBody(imageData);
|
||||
|
||||
_multipartData->append(imagePart);
|
||||
|
||||
imageData.clear();
|
||||
}
|
||||
|
||||
/*!
|
||||
* Process server reply data
|
||||
*/
|
||||
void Uploader_MediaCrush::replyFinished(QNetworkReply* reply)
|
||||
{
|
||||
if (reply->error() == QNetworkReply::NoError)
|
||||
{
|
||||
QByteArray response = reply->readAll();
|
||||
|
||||
if (response.split(':').count() >= 2)
|
||||
{
|
||||
response = response.split(':').at(1);
|
||||
response = response.mid(2, 12);
|
||||
}
|
||||
|
||||
_uploadedStrings[UL_DIRECT_LINK].first = "https://" + _host + "/" + response + "." + _currentFormat;
|
||||
_uploadedStrings[UL_DELETE_URL].first = "https://" + _host + "/" + response + "/delete";
|
||||
|
||||
Q_EMIT uploadDoneStr(_uploadedStrings[UL_DIRECT_LINK].first);
|
||||
Q_EMIT uploadDone();
|
||||
}
|
||||
else
|
||||
{
|
||||
Q_EMIT uploadFail(reply->errorString().toLatin1());
|
||||
}
|
||||
|
||||
reply->deleteLater();
|
||||
}
|
||||
|
||||
void Uploader_MediaCrush::UpdateUploadedStrList()
|
||||
{
|
||||
QStringList nonUsed = QStringList() << UL_BB_CODE << UL_BB_CODE_THUMB << UL_HTML_CODE << UL_HTML_CODE_THUMB;
|
||||
|
||||
for (int i =0; i < nonUsed.count(); ++i)
|
||||
{
|
||||
_uploadedStrings.remove(nonUsed.at(i).toLatin1());
|
||||
}
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef UPLOADER_MEDIACRUSH_H
|
||||
#define UPLOADER_MEDIACRUSH_H
|
||||
|
||||
#include <uploader.h>
|
||||
|
||||
#include <QUrl>
|
||||
|
||||
class Uploader_MediaCrush : public Uploader
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Uploader_MediaCrush(const QString& format, QObject* parent = 0);
|
||||
virtual ~Uploader_MediaCrush();
|
||||
|
||||
virtual void startUploading();
|
||||
|
||||
protected:
|
||||
virtual QUrl apiUrl();
|
||||
virtual void createData(bool inBase64 = false);
|
||||
|
||||
protected Q_SLOTS:
|
||||
virtual void replyFinished(QNetworkReply* reply);
|
||||
|
||||
private:
|
||||
void setCurrentFormat(const QString& format);
|
||||
|
||||
QByteArray _host;
|
||||
QByteArray _currentFormat;
|
||||
void UpdateUploadedStrList();
|
||||
};
|
||||
|
||||
#endif // UPLOADER_MEDIACRUSH_H
|
||||
|
@ -1,32 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "uploader_mediacrush_widget.h"
|
||||
#include "ui_uploader_mediacrush_widget.h"
|
||||
|
||||
Uploader_MediaCrush_Widget::Uploader_MediaCrush_Widget(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::Uploader_MediaCrush_Widget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
}
|
||||
|
||||
Uploader_MediaCrush_Widget::~Uploader_MediaCrush_Widget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef UPLOADER_MEDIACRUSH_WIDGET_H
|
||||
#define UPLOADER_MEDIACRUSH_WIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class Uploader_MediaCrush_Widget;
|
||||
}
|
||||
|
||||
class Uploader_MediaCrush_Widget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit Uploader_MediaCrush_Widget(QWidget *parent = 0);
|
||||
~Uploader_MediaCrush_Widget();
|
||||
|
||||
private:
|
||||
Ui::Uploader_MediaCrush_Widget *ui;
|
||||
};
|
||||
|
||||
#endif // UPLOADER_MEDIACRUSH_WIDGET_H
|
@ -1,44 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Uploader_MediaCrush_Widget</class>
|
||||
<widget class="QWidget" name="Uploader_MediaCrush_Widget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>417</width>
|
||||
<height>203</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="labTitle">
|
||||
<property name="text">
|
||||
<string>Upload to MediaCrush</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>168</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -1,56 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "uploaderconfigwidget_mediacrush.h"
|
||||
#include "ui_uploaderconfigwidget_mediacrush.h"
|
||||
|
||||
#include "uploaderconfig.h"
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
UploaderConfigWidget_MediaCrush::UploaderConfigWidget_MediaCrush(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::UploaderConfigWidget_MediaCrush)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
// load settings
|
||||
UploaderConfig config;
|
||||
|
||||
QVariantMap loadedValues;
|
||||
loadedValues.insert(KEY_MCSH_URL, "");
|
||||
|
||||
loadedValues = config.loadSettings("mediacru.sh", loadedValues);
|
||||
ui->editUrl->setText(loadedValues[KEY_MCSH_URL].toString());
|
||||
|
||||
}
|
||||
|
||||
UploaderConfigWidget_MediaCrush::~UploaderConfigWidget_MediaCrush()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void UploaderConfigWidget_MediaCrush::saveSettings()
|
||||
{
|
||||
UploaderConfig config;
|
||||
|
||||
QVariantMap savingValues;
|
||||
savingValues.insert(KEY_MCSH_URL, ui->editUrl->text());
|
||||
|
||||
config.saveSettings("mediacru.sh", savingValues);
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef UPLOADERCONFIGWIDGET_MEDIACRUSH_H
|
||||
#define UPLOADERCONFIGWIDGET_MEDIACRUSH_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
namespace Ui {
|
||||
class UploaderConfigWidget_MediaCrush;
|
||||
}
|
||||
|
||||
class UploaderConfigWidget_MediaCrush : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit UploaderConfigWidget_MediaCrush(QWidget *parent = 0);
|
||||
~UploaderConfigWidget_MediaCrush();
|
||||
|
||||
public Q_SLOTS:
|
||||
void saveSettings();
|
||||
|
||||
private:
|
||||
Ui::UploaderConfigWidget_MediaCrush *ui;
|
||||
};
|
||||
|
||||
#endif // UPLOADERCONFIGWIDGET_MEDIACRUSH_H
|
@ -1,87 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>UploaderConfigWidget_MediaCrush</class>
|
||||
<widget class="QWidget" name="UploaderConfigWidget_MediaCrush">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>320</width>
|
||||
<height>240</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="labTitle">
|
||||
<property name="text">
|
||||
<string>Configuration for mediacru.sh upload</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labDesclabUrlription">
|
||||
<property name="text">
|
||||
<string>URL forupload</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="editUrl"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labDescription">
|
||||
<property name="text">
|
||||
<string>Central server MediaCrush is down, but you can set up self-hosted instance. And add here url to it.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labUrlExample">
|
||||
<property name="text">
|
||||
<string notr="true">e.g. "https://mediacru.sh/api/upload/file"</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>87</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -1,130 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "moduleuploader.h"
|
||||
#include "dialoguploader.h"
|
||||
#include "uploaderconfigwidget.h"
|
||||
#include "uploaderconfig.h"
|
||||
#include "imgur/uploader_imgur.h"
|
||||
#include "mediacrush/uploader_mediacrush.h"
|
||||
|
||||
#include "core/core.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QWaitCondition>
|
||||
#include <QMutex>
|
||||
#include <QClipboard>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
const QString UPLOAD_CMD_PARAM = "upload";
|
||||
const QString UPLOAD_CMD_PARAM_SHORT = "u";
|
||||
|
||||
ModuleUploader::ModuleUploader(QObject *parent) :
|
||||
QObject(parent), _ignoreCmdParam(false),
|
||||
_optUpload(QStringList() << UPLOAD_CMD_PARAM_SHORT << UPLOAD_CMD_PARAM)
|
||||
{
|
||||
QString optUploadDescr = tr("Upload the screenshot to the default image host");
|
||||
_optUpload.setDescription(optUploadDescr);
|
||||
Core::instance()->addCmdLineOption(_optUpload);
|
||||
}
|
||||
|
||||
QString ModuleUploader::moduleName()
|
||||
{
|
||||
return tr("Uploading");
|
||||
}
|
||||
|
||||
void ModuleUploader::init()
|
||||
{
|
||||
Core *core = Core::instance();
|
||||
|
||||
if (core->checkCmdLineOption(_optUpload) == true && _ignoreCmdParam == false)
|
||||
{
|
||||
UploaderConfig config;
|
||||
QString selectedtHost = config.loadSingleParam(QByteArray("common"), QByteArray(KEY_DEFAULT_HOST)).toString();
|
||||
|
||||
Uploader *uploader = 0;
|
||||
switch(config.labelsList().indexOf(selectedtHost))
|
||||
{
|
||||
case 0:
|
||||
uploader = new Uploader_MediaCrush(core->config()->getSaveFormat());
|
||||
break;
|
||||
case 1:
|
||||
uploader = new Uploader_ImgUr;
|
||||
break;
|
||||
default:
|
||||
uploader = new Uploader_ImgUr;
|
||||
}
|
||||
|
||||
connect(uploader, &Uploader::uploadDoneStr, this, &ModuleUploader::shadowUploadDone);
|
||||
connect(uploader, &Uploader::uploadFail, this, &ModuleUploader::shadowUploadFail);
|
||||
|
||||
uploader->startUploading();
|
||||
|
||||
_ignoreCmdParam = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
DialogUploader *ui = new DialogUploader();
|
||||
ui->exec();
|
||||
}
|
||||
}
|
||||
|
||||
QWidget* ModuleUploader::initConfigWidget()
|
||||
{
|
||||
QWidget* configWidget = new UploaderConfigWidget;
|
||||
return configWidget;
|
||||
}
|
||||
|
||||
void ModuleUploader::defaultSettings()
|
||||
{
|
||||
UploaderConfig config;
|
||||
config.defaultSettings();
|
||||
}
|
||||
|
||||
QMenu* ModuleUploader::initModuleMenu()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
QAction* ModuleUploader::initModuleAction()
|
||||
{
|
||||
QAction *act = new QAction(QObject::tr("Upload"), 0);
|
||||
act->setObjectName("actUpload");
|
||||
connect(act, &QAction::triggered, this, &ModuleUploader::init);
|
||||
return act;
|
||||
}
|
||||
|
||||
|
||||
void ModuleUploader::shadowUploadDone(const QString& directLink)
|
||||
{
|
||||
sender()->deleteLater();
|
||||
QString str = "Upload done, direct link to image: " + directLink;
|
||||
qWarning() << str;
|
||||
|
||||
Q_EMIT uploadCompleteWithQuit();
|
||||
}
|
||||
|
||||
void ModuleUploader::shadowUploadFail(const QByteArray& error)
|
||||
{
|
||||
sender()->deleteLater();
|
||||
QString str = "Upload failed: " + error;
|
||||
qWarning() << str;
|
||||
|
||||
Q_EMIT uploadCompleteWithQuit();
|
||||
}
|
@ -1,54 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef MODULEUPLOADER_H
|
||||
#define MODULEUPLOADER_H
|
||||
|
||||
#include "modules/abstractmodule.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QCommandLineOption>
|
||||
#include <QWidget>
|
||||
|
||||
class ModuleUploader: public QObject, public AbstractModule
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ModuleUploader(QObject *parent = 0);
|
||||
QString moduleName();
|
||||
QWidget* initConfigWidget();
|
||||
void defaultSettings();
|
||||
QMenu* initModuleMenu();
|
||||
QAction* initModuleAction();
|
||||
|
||||
public Q_SLOTS:
|
||||
void init();
|
||||
|
||||
private Q_SLOTS:
|
||||
void shadowUploadDone(const QString &directLink);
|
||||
void shadowUploadFail(const QByteArray &error);
|
||||
|
||||
Q_SIGNALS:
|
||||
void uploadCompleteWithQuit();
|
||||
|
||||
private:
|
||||
bool _ignoreCmdParam;
|
||||
QCommandLineOption _optUpload;
|
||||
};
|
||||
|
||||
#endif // MODULEUPLOADER_H
|
@ -1,242 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#include "uploader.h"
|
||||
#include "core/core.h"
|
||||
#include "uploaderconfig.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QUuid>
|
||||
#include <QRegExp>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
Uploader::Uploader(QObject *parent) :
|
||||
QObject(parent), _multipartData(0)
|
||||
{
|
||||
qsrand(126);
|
||||
_strBoundary = "uploadbound" + QByteArray::number(qrand());
|
||||
_net = new QNetworkAccessManager(this);
|
||||
_serverReply = 0;
|
||||
initUploadedStrList();
|
||||
|
||||
UploaderConfig config;
|
||||
if (config.checkExistsConfigFile() == false)
|
||||
{
|
||||
config.defaultSettings();
|
||||
}
|
||||
}
|
||||
|
||||
Uploader::~Uploader()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/*!
|
||||
* Create boundary string
|
||||
* \param cleared -detect for str boundary line in httpRequest
|
||||
*/
|
||||
QByteArray Uploader::boundary(bool cleared)
|
||||
{
|
||||
QByteArray retBoundary = _strBoundary;
|
||||
|
||||
if (cleared == false)
|
||||
{
|
||||
retBoundary.append("\r\n");
|
||||
retBoundary.prepend("--");
|
||||
}
|
||||
|
||||
return retBoundary;
|
||||
}
|
||||
|
||||
void Uploader::replyProgress(qint64 bytesSent, qint64 bytesTotal)
|
||||
{
|
||||
Q_EMIT uploadProgress(bytesSent, bytesTotal);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Get user selected params from uploader widget (not from config file)
|
||||
*/
|
||||
void Uploader::getUserSettings(const QVariantMap& settings)
|
||||
{
|
||||
_userSettings = settings;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Start uploading base class
|
||||
*/
|
||||
void Uploader::startUploading()
|
||||
{
|
||||
connect(_net, &QNetworkAccessManager::finished, this, &Uploader::replyFinished);
|
||||
|
||||
if (!_multipartData && !imageData.isEmpty())
|
||||
{
|
||||
_serverReply = _net->post(_request, imageData);
|
||||
}
|
||||
if (_multipartData && imageData.isEmpty())
|
||||
{
|
||||
_serverReply = _net->post(_request, _multipartData);
|
||||
}
|
||||
|
||||
connect(_serverReply, &QNetworkReply::uploadProgress, this, &Uploader::replyProgress);
|
||||
}
|
||||
|
||||
QMap< QByteArray, ResultString_t > Uploader::parsedLinks()
|
||||
{
|
||||
return _uploadedStrings;
|
||||
}
|
||||
|
||||
QList<ResultString_t> Uploader::parsedLinksToGui()
|
||||
{
|
||||
QList<ResultString_t> list;
|
||||
ResultString_t delete_url;
|
||||
ResultString_t direct_link;
|
||||
|
||||
for (int i = 0; i < _uploadedStrings.count(); ++i)
|
||||
{
|
||||
QByteArray key = _uploadedStrings.keys().at(i);
|
||||
|
||||
if (key == "delete_url")
|
||||
{
|
||||
delete_url = _uploadedStrings[key];
|
||||
}
|
||||
else if(key == "direct_link")
|
||||
{
|
||||
direct_link = _uploadedStrings[key];
|
||||
}
|
||||
else
|
||||
{
|
||||
ResultString_t val = _uploadedStrings[key];
|
||||
list.append(val);
|
||||
}
|
||||
}
|
||||
|
||||
list.prepend(direct_link);
|
||||
|
||||
if (delete_url.first.isEmpty() == false)
|
||||
{
|
||||
list.append(delete_url);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
* Return url for uploaded image
|
||||
*/
|
||||
QUrl Uploader::apiUrl()
|
||||
{
|
||||
return QUrl();
|
||||
}
|
||||
|
||||
/*!
|
||||
* Prepare image data for uploading
|
||||
*/
|
||||
void Uploader::createData(bool inBase64)
|
||||
{
|
||||
Core *core = Core::instance();
|
||||
_formatString = core->config()->getSaveFormat();
|
||||
_uploadFilename = core->getTempFilename(_formatString);
|
||||
core->writeScreen(_uploadFilename, _formatString , true);
|
||||
|
||||
if (inBase64 == false)
|
||||
{
|
||||
imageData = core->getScreenData();
|
||||
}
|
||||
else
|
||||
{
|
||||
imageData = core->getScreenData().toBase64();
|
||||
}
|
||||
core->killTempFile();
|
||||
}
|
||||
|
||||
/*!
|
||||
* Create request for send to server.
|
||||
* this method called from subclasses.
|
||||
*/
|
||||
void Uploader::createRequest(const QByteArray& requestData, const QUrl url)
|
||||
{
|
||||
Q_UNUSED(requestData);
|
||||
_request.setUrl(url);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Parsing server reply and get map with server returned links
|
||||
* \param keytags List of tags for parsing
|
||||
* \param result String wuth server reply
|
||||
*/
|
||||
QMap<QByteArray, QByteArray> Uploader::parseResultStrings(const QVector< QByteArray >& keytags, const QByteArray& result)
|
||||
{
|
||||
QMap<QByteArray, QByteArray> replyMap;
|
||||
|
||||
QRegExp re;
|
||||
QRegExp re2;
|
||||
|
||||
int inStart = 0;
|
||||
int outStart = 0;
|
||||
int len = 0;
|
||||
|
||||
// parsing xml
|
||||
for (int i = 0; i < keytags.count(); ++i)
|
||||
{
|
||||
// set patterns for full lenght item
|
||||
re.setPattern("<"+keytags[i]+">"); // open tag
|
||||
re2.setPattern("</"+keytags[i]+">"); //close tag
|
||||
|
||||
// get start pos and lenght ite in xml
|
||||
inStart = re.indexIn(result); // ops open tag start
|
||||
outStart = re2.indexIn(result); // pos close tag start
|
||||
len = outStart - inStart + re2.matchedLength(); // length of full string
|
||||
|
||||
// extract item and replace spec html symbols
|
||||
QByteArray extractedText = result.mid(inStart, len);
|
||||
extractedText = extractedText.replace(""","'");
|
||||
extractedText = extractedText.replace("<","<");
|
||||
extractedText = extractedText.replace(">",">");
|
||||
extractedText = extractedText.replace("<"+keytags[i]+">","");
|
||||
extractedText = extractedText.replace("</"+keytags[i]+">","");
|
||||
|
||||
// to map
|
||||
replyMap.insert(keytags[i], extractedText);
|
||||
|
||||
}
|
||||
|
||||
return replyMap;
|
||||
}
|
||||
|
||||
void Uploader::initUploadedStrList()
|
||||
{
|
||||
ResultString_t strPair = qMakePair(QByteArray(), tr("Direct link"));
|
||||
_uploadedStrings.insert(UL_DIRECT_LINK, strPair);
|
||||
|
||||
strPair = qMakePair(QByteArray(), tr("HTML code"));
|
||||
_uploadedStrings.insert(UL_HTML_CODE ,strPair);
|
||||
|
||||
strPair = qMakePair(QByteArray(), tr("BB code"));
|
||||
_uploadedStrings.insert(UL_BB_CODE, strPair);
|
||||
|
||||
strPair = qMakePair(QByteArray(), tr("HTML code with thumb image"));
|
||||
_uploadedStrings.insert(UL_HTML_CODE_THUMB ,strPair);
|
||||
|
||||
strPair = qMakePair(QByteArray("bb_code_thumb"), tr("BB code with thumb image"));
|
||||
_uploadedStrings.insert(UL_BB_CODE_THUMB, strPair);
|
||||
|
||||
strPair = qMakePair(QByteArray(), tr("URl to delete image"));
|
||||
_uploadedStrings.insert(UL_DELETE_URL ,strPair);
|
||||
}
|
@ -1,91 +0,0 @@
|
||||
/***************************************************************************
|
||||
* Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin *
|
||||
* doomer3d@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 2 of the License, or *
|
||||
* (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef UPLOADER_H
|
||||
#define UPLOADER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QByteArray>
|
||||
#include <QMap>
|
||||
#include <QPair>
|
||||
#include <QNetworkAccessManager>
|
||||
#include <QNetworkReply>
|
||||
#include <QHttpMultiPart>
|
||||
#include <QUrl>
|
||||
|
||||
typedef QPair<QByteArray, QString> ResultString_t;
|
||||
|
||||
const QByteArray UL_DIRECT_LINK = "direct_link";
|
||||
const QByteArray UL_HTML_CODE = "html_code";
|
||||
const QByteArray UL_BB_CODE = "bb_code";
|
||||
const QByteArray UL_HTML_CODE_THUMB = "html_code_thumb";
|
||||
const QByteArray UL_BB_CODE_THUMB = "bb_code_thumb";
|
||||
const QByteArray UL_DELETE_URL = "delete_url";
|
||||
|
||||
class Uploader : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit Uploader(QObject *parent = 0);
|
||||
virtual ~Uploader();
|
||||
|
||||
// overriding methods
|
||||
void getUserSettings(const QVariantMap& settings);
|
||||
virtual void startUploading();
|
||||
QMap<QByteArray, ResultString_t> parsedLinks();
|
||||
QList<ResultString_t> parsedLinksToGui();
|
||||
|
||||
Q_SIGNALS:
|
||||
void uploadStart();
|
||||
void uploadFail(const QByteArray &error);
|
||||
void uploadDoneStr(const QString &directLink);
|
||||
void uploadDone();
|
||||
void uploadProgress(qint64 bytesSent, qint64 bytesTotal);
|
||||
|
||||
public Q_SLOTS:
|
||||
|
||||
protected Q_SLOTS:
|
||||
virtual void replyFinished(QNetworkReply* reply) {Q_UNUSED(reply)};
|
||||
void replyProgress(qint64 bytesSent, qint64 bytesTotal);
|
||||
|
||||
protected:
|
||||
// methods
|
||||
QByteArray boundary(bool cleared = false);
|
||||
QMap<QByteArray, QByteArray> parseResultStrings(const QVector<QByteArray>& keytags, const QByteArray& result);
|
||||
|
||||
virtual QUrl apiUrl();
|
||||
virtual void createData(bool inBase64 = false);
|
||||
virtual void createRequest(const QByteArray& requestData, const QUrl url);
|
||||
|
||||
// vars
|
||||
QByteArray imageData;
|
||||
QHttpMultiPart *_multipartData;
|
||||
QString _uploadFilename;
|
||||
QString _formatString;
|
||||
QByteArray _strBoundary;
|
||||
QMap<QByteArray, ResultString_t> _uploadedStrings;
|
||||
QVariantMap _userSettings;
|
||||
QNetworkAccessManager *_net;
|
||||
QNetworkRequest _request;
|
||||
QNetworkReply *_serverReply;
|
||||
|
||||
private:
|
||||
void initUploadedStrList();
|
||||
};
|
||||
|
||||
#endif // UPLOADER_H
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user