From e77d40ab65ade8a83e7aae6ad2b532283ca8221b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrew=20Lee=20=28=E6=9D=8E=E5=81=A5=E7=A7=8B=29?= Date: Sun, 16 Aug 2015 17:50:22 +0800 Subject: [PATCH] Adding upstream version 1.95_pr1. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Andrew Lee (李健秋) --- .gitignore | 3 + AUTHORS | 11 + CHANGELOG | 119 ++ CMakeLists.txt | 229 ++++ COPYING | 280 +++++ README.md | 61 + cmake/FindQxt.cmake | 155 +++ cmake/LXQtTranslateDesktop.cmake | 107 ++ cmake/LXQtTranslateTs.cmake | 129 ++ cmake/Qt5TranslationLoader.cmake | 49 + cmake/Qt5TranslationLoader.cpp.in | 33 + docs/html/default.css | 142 +++ docs/html/en/index.html | 444 +++++++ docs/html/pt_BR/index.html | 435 +++++++ docs/html/ru/index.html | 487 ++++++++ img/logo.png | Bin 0 -> 6817 bytes img/screengrab.png | Bin 0 -> 1947 bytes img/trayicon.png | Bin 0 -> 764 bytes screengrab.desktop.in | 12 + screengrab.qrc | 6 + src/common/qkeysequencewidget/CMakeLists.txt | 31 + .../qkeysequencewidget/img/delete_32.png | Bin 0 -> 4479 bytes .../qkeysequencewidget/qkeysequencewidget.pri | 7 + .../qkeysequencewidget/qkeysequencewidget.qrc | 5 + .../src/qkeysequencewidget.cpp | 578 +++++++++ .../src/qkeysequencewidget.h | 127 ++ .../src/qkeysequencewidget_p.h | 120 ++ src/core/config.cpp | 535 +++++++++ src/core/config.h | 260 ++++ src/core/core.cpp | 548 +++++++++ src/core/core.h | 142 +++ src/core/main.cpp | 45 + src/core/modulemanager.cpp | 120 ++ src/core/modulemanager.h | 53 + src/core/regionselect.cpp | 231 ++++ src/core/regionselect.h | 77 ++ src/core/shortcutmanager.cpp | 149 +++ src/core/shortcutmanager.h | 66 ++ src/core/singleapp.cpp | 105 ++ src/core/singleapp.h | 52 + src/core/ui/about.cpp | 188 +++ src/core/ui/about.h | 57 + src/core/ui/aboutwidget.ui | 167 +++ src/core/ui/configwidget.cpp | 521 ++++++++ src/core/ui/configwidget.h | 81 ++ src/core/ui/configwidget.ui | 836 +++++++++++++ src/core/ui/mainwindow.cpp | 560 +++++++++ src/core/ui/mainwindow.h | 118 ++ src/core/ui/mainwindow.ui | 229 ++++ src/modules/abstractmodule.h | 45 + src/modules/extedit/CMakeLists.txt | 37 + src/modules/extedit/extedit.cpp | 95 ++ src/modules/extedit/extedit.h | 55 + src/modules/extedit/moduleextedit.cpp | 79 ++ src/modules/extedit/moduleextedit.h | 45 + src/modules/uploader/CMakeLists.txt | 53 + src/modules/uploader/dialoguploader.cpp | 264 +++++ src/modules/uploader/dialoguploader.h | 66 ++ src/modules/uploader/dialoguploader.ui | 339 ++++++ src/modules/uploader/imgur/uploader_imgur.cpp | 105 ++ src/modules/uploader/imgur/uploader_imgur.h | 56 + .../uploader/imgur/uploader_imgur_widget.cpp | 46 + .../uploader/imgur/uploader_imgur_widget.h | 46 + .../uploader/imgur/uploader_imgur_widget.ui | 44 + .../imgur/uploaderconfigwidget_imgur.cpp | 65 + .../imgur/uploaderconfigwidget_imgur.h | 48 + .../imgur/uploaderconfigwidget_imgur.ui | 67 ++ .../mediacrush/uploader_mediacrush.cpp | 134 +++ .../uploader/mediacrush/uploader_mediacrush.h | 53 + .../mediacrush/uploader_mediacrush_widget.cpp | 14 + .../mediacrush/uploader_mediacrush_widget.h | 22 + .../mediacrush/uploader_mediacrush_widget.ui | 44 + .../uploaderconfigwidget_mediacrush.cpp | 14 + .../uploaderconfigwidget_mediacrush.h | 22 + .../uploaderconfigwidget_mediacrush.ui | 67 ++ src/modules/uploader/moduleuploader.cpp | 132 +++ src/modules/uploader/moduleuploader.h | 56 + src/modules/uploader/uploader.cpp | 244 ++++ src/modules/uploader/uploader.h | 93 ++ src/modules/uploader/uploaderconfig.cpp | 124 ++ src/modules/uploader/uploaderconfig.h | 56 + src/modules/uploader/uploaderconfigwidget.cpp | 115 ++ src/modules/uploader/uploaderconfigwidget.h | 56 + src/modules/uploader/uploaderconfigwidget.ui | 96 ++ translations/extedit.ts | 17 + translations/screengrab.ts | 768 ++++++++++++ translations/screengrab_de.desktop | 3 + translations/screengrab_de_DE.ts | 1048 +++++++++++++++++ translations/screengrab_es_ES.ts | 874 ++++++++++++++ translations/screengrab_it_IT.ts | 828 +++++++++++++ translations/screengrab_pt_BR.ts | 852 ++++++++++++++ translations/screengrab_ru.desktop | 3 + translations/screengrab_ru.ts | 1033 ++++++++++++++++ translations/screengrab_uk.desktop | 3 + translations/screengrab_uk_UA.ts | 958 +++++++++++++++ translations/uploader.ts | 257 ++++ 96 files changed, 18251 insertions(+) create mode 100644 .gitignore create mode 100644 AUTHORS create mode 100644 CHANGELOG create mode 100644 CMakeLists.txt create mode 100644 COPYING create mode 100644 README.md create mode 100644 cmake/FindQxt.cmake create mode 100644 cmake/LXQtTranslateDesktop.cmake create mode 100644 cmake/LXQtTranslateTs.cmake create mode 100644 cmake/Qt5TranslationLoader.cmake create mode 100644 cmake/Qt5TranslationLoader.cpp.in create mode 100644 docs/html/default.css create mode 100644 docs/html/en/index.html create mode 100644 docs/html/pt_BR/index.html create mode 100644 docs/html/ru/index.html create mode 100644 img/logo.png create mode 100644 img/screengrab.png create mode 100644 img/trayicon.png create mode 100644 screengrab.desktop.in create mode 100644 screengrab.qrc create mode 100644 src/common/qkeysequencewidget/CMakeLists.txt create mode 100644 src/common/qkeysequencewidget/img/delete_32.png create mode 100644 src/common/qkeysequencewidget/qkeysequencewidget.pri create mode 100644 src/common/qkeysequencewidget/qkeysequencewidget.qrc create mode 100644 src/common/qkeysequencewidget/src/qkeysequencewidget.cpp create mode 100644 src/common/qkeysequencewidget/src/qkeysequencewidget.h create mode 100644 src/common/qkeysequencewidget/src/qkeysequencewidget_p.h create mode 100644 src/core/config.cpp create mode 100644 src/core/config.h create mode 100644 src/core/core.cpp create mode 100644 src/core/core.h create mode 100644 src/core/main.cpp create mode 100644 src/core/modulemanager.cpp create mode 100644 src/core/modulemanager.h create mode 100644 src/core/regionselect.cpp create mode 100644 src/core/regionselect.h create mode 100644 src/core/shortcutmanager.cpp create mode 100644 src/core/shortcutmanager.h create mode 100644 src/core/singleapp.cpp create mode 100644 src/core/singleapp.h create mode 100644 src/core/ui/about.cpp create mode 100644 src/core/ui/about.h create mode 100644 src/core/ui/aboutwidget.ui create mode 100644 src/core/ui/configwidget.cpp create mode 100644 src/core/ui/configwidget.h create mode 100644 src/core/ui/configwidget.ui create mode 100644 src/core/ui/mainwindow.cpp create mode 100644 src/core/ui/mainwindow.h create mode 100644 src/core/ui/mainwindow.ui create mode 100644 src/modules/abstractmodule.h create mode 100644 src/modules/extedit/CMakeLists.txt create mode 100644 src/modules/extedit/extedit.cpp create mode 100644 src/modules/extedit/extedit.h create mode 100644 src/modules/extedit/moduleextedit.cpp create mode 100644 src/modules/extedit/moduleextedit.h create mode 100644 src/modules/uploader/CMakeLists.txt create mode 100644 src/modules/uploader/dialoguploader.cpp create mode 100644 src/modules/uploader/dialoguploader.h create mode 100644 src/modules/uploader/dialoguploader.ui create mode 100644 src/modules/uploader/imgur/uploader_imgur.cpp create mode 100644 src/modules/uploader/imgur/uploader_imgur.h create mode 100644 src/modules/uploader/imgur/uploader_imgur_widget.cpp create mode 100644 src/modules/uploader/imgur/uploader_imgur_widget.h create mode 100644 src/modules/uploader/imgur/uploader_imgur_widget.ui create mode 100644 src/modules/uploader/imgur/uploaderconfigwidget_imgur.cpp create mode 100644 src/modules/uploader/imgur/uploaderconfigwidget_imgur.h create mode 100644 src/modules/uploader/imgur/uploaderconfigwidget_imgur.ui create mode 100644 src/modules/uploader/mediacrush/uploader_mediacrush.cpp create mode 100644 src/modules/uploader/mediacrush/uploader_mediacrush.h create mode 100644 src/modules/uploader/mediacrush/uploader_mediacrush_widget.cpp create mode 100644 src/modules/uploader/mediacrush/uploader_mediacrush_widget.h create mode 100644 src/modules/uploader/mediacrush/uploader_mediacrush_widget.ui create mode 100644 src/modules/uploader/mediacrush/uploaderconfigwidget_mediacrush.cpp create mode 100644 src/modules/uploader/mediacrush/uploaderconfigwidget_mediacrush.h create mode 100644 src/modules/uploader/mediacrush/uploaderconfigwidget_mediacrush.ui create mode 100644 src/modules/uploader/moduleuploader.cpp create mode 100644 src/modules/uploader/moduleuploader.h create mode 100644 src/modules/uploader/uploader.cpp create mode 100644 src/modules/uploader/uploader.h create mode 100644 src/modules/uploader/uploaderconfig.cpp create mode 100644 src/modules/uploader/uploaderconfig.h create mode 100644 src/modules/uploader/uploaderconfigwidget.cpp create mode 100644 src/modules/uploader/uploaderconfigwidget.h create mode 100644 src/modules/uploader/uploaderconfigwidget.ui create mode 100644 translations/extedit.ts create mode 100644 translations/screengrab.ts create mode 100644 translations/screengrab_de.desktop create mode 100644 translations/screengrab_de_DE.ts create mode 100644 translations/screengrab_es_ES.ts create mode 100644 translations/screengrab_it_IT.ts create mode 100644 translations/screengrab_pt_BR.ts create mode 100644 translations/screengrab_ru.desktop create mode 100644 translations/screengrab_ru.ts create mode 100644 translations/screengrab_uk.desktop create mode 100644 translations/screengrab_uk_UA.ts create mode 100644 translations/uploader.ts diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..41b1005 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +build/ +*.qm +*.kdev4 diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..736871c --- /dev/null +++ b/AUTHORS @@ -0,0 +1,11 @@ +Upstream author: + Artem Galichkin + +Contributors: + Jerome Leclanche + Alexander Sokolov + Alf Gaida + Ilya87 + Jonathan Hooverman + Paulo Lieuthier + diff --git a/CHANGELOG b/CHANGELOG new file mode 100644 index 0000000..5c0295e --- /dev/null +++ b/CHANGELOG @@ -0,0 +1,119 @@ +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 diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..9132780 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,229 @@ +cmake_minimum_required(VERSION 2.8.11) + +# 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") + +# 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(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) + include(${QTXDG_USE_FILE}) +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 "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}") + +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 +) + +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() + +target_link_libraries(screengrab qkeysequencewidget Qt5::Widgets KF5::WindowSystem) + + +# 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}/pixmaps) diff --git a/COPYING b/COPYING new file mode 100644 index 0000000..62e1242 --- /dev/null +++ b/COPYING @@ -0,0 +1,280 @@ + 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 diff --git a/README.md b/README.md new file mode 100644 index 0000000..efe33f0 --- /dev/null +++ b/README.md @@ -0,0 +1,61 @@ +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_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 + diff --git a/cmake/FindQxt.cmake b/cmake/FindQxt.cmake new file mode 100644 index 0000000..8698fc7 --- /dev/null +++ b/cmake/FindQxt.cmake @@ -0,0 +1,155 @@ +############# +## 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}") diff --git a/cmake/LXQtTranslateDesktop.cmake b/cmake/LXQtTranslateDesktop.cmake new file mode 100644 index 0000000..522ed68 --- /dev/null +++ b/cmake/LXQtTranslateDesktop.cmake @@ -0,0 +1,107 @@ +#============================================================================= +# The lxqt_translate_desktop() function was copied from the the +# LXQt LxQtTranste.cmake +# +# Original Author: Alexander Sokolov +# +# funtion lxqt_translate_desktop(_RESULT +# 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}_${_fileExt}'\n" + "echo ''\n" + ) + + endforeach() + + set(${_RESULT} ${__result} PARENT_SCOPE) +endfunction(lxqt_translate_desktop) diff --git a/cmake/LXQtTranslateTs.cmake b/cmake/LXQtTranslateTs.cmake new file mode 100644 index 0000000..f6d3215 --- /dev/null +++ b/cmake/LXQtTranslateTs.cmake @@ -0,0 +1,129 @@ +#============================================================================= +# Copyright 2014 Luís Pereira +# +# 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 +# [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() diff --git a/cmake/Qt5TranslationLoader.cmake b/cmake/Qt5TranslationLoader.cmake new file mode 100644 index 0000000..24ba88d --- /dev/null +++ b/cmake/Qt5TranslationLoader.cmake @@ -0,0 +1,49 @@ +#============================================================================= +# Copyright 2014 Luís Pereira +# +# 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( ) +# +# Output: +# Appends the generated file to this variable. +# +# Input: +# Full path name to the translations dir. +# 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() diff --git a/cmake/Qt5TranslationLoader.cpp.in b/cmake/Qt5TranslationLoader.cpp.in new file mode 100644 index 0000000..ffdfcb4 --- /dev/null +++ b/cmake/Qt5TranslationLoader.cpp.in @@ -0,0 +1,33 @@ +/* This file has been generated by the CMake qt_translation_loader(). + * It loads Qt application translations. + * + * Attention: All changes will be overwritten!!! + */ + +#include +#include +#include +#include + +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) diff --git a/docs/html/default.css b/docs/html/default.css new file mode 100644 index 0000000..2844492 --- /dev/null +++ b/docs/html/default.css @@ -0,0 +1,142 @@ +/** 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; +} \ No newline at end of file diff --git a/docs/html/en/index.html b/docs/html/en/index.html new file mode 100644 index 0000000..0dbb479 --- /dev/null +++ b/docs/html/en/index.html @@ -0,0 +1,444 @@ + + + + + +ScreenGrab -- Fast creation of screenshots + + + + + + +
+
+

ScreenGrab - fast creation of screenshots

+

+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. +

+

+ Main features: +

+
    +
  • Supports Windows & Linux
  • +
  • Get desktop screenshots
  • +
  • Get active window screenshots
  • +
  • Get screenshots of selected desktop areas
  • +
  • Copy screenshots into the clipboard
  • +
  • Save your image files in PNG, JPEG or BMP format
  • +
  • Ability to view and edit screenshots in an external editor
  • +
  • Ability to upload screenshots to MediaCrush and imgur
  • +
  • Ability to set delay before getting screenshots +(from 1 to 90 seconds)
  • +
  • Hide the main window (with recovery) at the time of the screenshot
  • +
  • Ability to minimize ScreenGrab to the system tray, and +control it via a context menu
  • +
  • Getting screenshots using global shortcuts
  • +
  • Auto-save screenshot when captured
  • +
  • Ability to insert the current date and time in the filename when saving it
  • +
+ + + +

Usage To start page

+

+ It is very simple. +

+

+ 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. +

+

+ Buttons in main window: +

+
    +
  • New Screen [Ctrl+N] -- Take a new screenshot
  • +
  • Save Screen [Ctrl+S] -- Write a captured screenshot + on your hard disk (in PNG or JPEG format).
  • +
  • Copy Screen [Ctrl+C] -- Copy a screenshot to the clipboard.
  • + +
  • Edit in ... -- Open and edit screenshots in an image editor. +
    +
    + NOTE: In the current version for Microsoft Windows only MS Paint is supported. +
    +
    +
  • +
  • Options [Ctrl+O] -- Show program options window.
  • +
  • Help [Ctrl+H] -- Access help and information about ScreenGrab, its developer and license.
  • +
  • Quit [Ctrl+Q] -- Exit ScreenGrab
  • +
+

+ These buttons can be accessed via right-click on the ScreenGrab icon in the systemtray menu as well. +

+

+ Additional controls, located in main window. +

+
    +
  • Delay -- Delay in seconds before grabbing the screen.
  • +
  • Type -- Type of grabbing [full screen +or active window].
  • +
+

+ Main settings: +

+
    +
  • Default directory -- Default directory to save screenshots
  • +
  • Default filename -- Default name of the saved file
  • +
  • Format -- Default saving image format (you can select other formats)
  • +
  • No window decoration -- Grab a screenshot of the active window without window decorations (only for linux version).
  • +
+

+ Advanced settings: +

+
    + +
  • Insert DateTime in filename -- Insert date and time in the filename to be saved +
    +
    These expressions may be used for the date part of the format string: +
    + + + + + + + + + + + + + + +
    ParameterOutput
    dDay as number without a leading zero (1 to 31)
    ddDay as number with a leading zero (01 to 31)
    dddAbbreviated localized day name (e.g. 'Mon' to 'Sun').
    ddddLong localized day name (e.g. 'Monday' to 'Sunday').
    MMonth as number without a leading zero (1-12)
    MMMonth as number with a leading zero (01-12)
    MMMAbbreviated localized month name (e.g. 'Jan' to 'Dec').
    MMMMLong localized month name (e.g. 'January' to 'December').
    yyYear as two digit number (00-99)
    yyyyYear as four digit number
    +
    +
    These expressions may be used for the time part of the format string: +
    + + + + + + + + + + + + + + + + +
    ParameterOutput
    hHour without a leading zero (0 to 23 or 1 to 12 if AM/PM display)
    hhHour with a leading zero (00 to 23 or 01 to 12 if AM/PM display)
    HHour without a leading zero (0 to 23, even with AM/PM display)
    HHHour with a leading zero (00 to 23, even with AM/PM display)
    mMinute without a leading zero (0 to 59)
    mmMinute with a leading zero (00 to 59)
    sSecond without a leading zero (0 to 59)
    ssSecond with a leading zero (00 to 59)
    zMilliseconds without leading zeroes (0 to 999)
    zzzMilliseconds with leading zeroes (000 to 999)
    AP or AInterpret as an AM/PM time. AP must be either "AM" or "PM".
    ap or aInterpret as an AM/PM time. ap must be either "am" or "pm".
    +
    +
  • +
  • Autosave screen -- Automatically save +the screenshot in the grab process
  • +
  • Save first screenshot -- enabled | disabled automatically saves the first screenshot, which is captured on program start
  • +
  • Filenames to clipboard on saving -- Send the name of the saved file to the clipboard . You can select these parameters:
  • +
      +
    • No copy - The name of saved file will not be transferred to the clipboard.
    • +
    • Only filename - Send only the file name to the clipboard.
    • +
    • Full path to file - Send the full path to the file to the clipboard.
    • +
    + +
  • Allow multiple copies -- Allow run multiple copies of ScreenGrab.
  • +
  • Enable external viewer -- Enable or disable the preview of the screenshot in the default image viewer (by double click on screenshot area in the main window).
  • +
+

+ Display settings: +

+
    +
  • Save window size on exit -- Save the current size of main window +when exiting ScreenGrab (and restore it at next run)
  • +
  • Zoom area around mouse in selection mode -- Display the magnified area around the mouse pointer when receiving a screenshot of a selected area.
  • +
+

+ System tray settings: +

+
    +
  • Use tray -- Use the notification area (system tray) of the operating system (desktop environment) for displaying messages and application management.
  • +
  • Tray messages -- Mode of displaying tray messages on grab|save events. Can be "none" +or "if hidden" or "always"
  • +
  • Time to display tray messages -- Time within a specific notification is displayed
  • +
  • Close in tray -- Minimize the main window into the systemtray +by click on the close window button.
  • + +
+

+ Shortcut Settings: +

+

+ 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. +

+

+ Local duplicate actions performed by pressing the button in the main window. They will only work when the ScreenGrab main window is active. +

+

+ Global shortcuts can be used the get a new screenshot when you have opened other application windows. +

+

+ Command line parameters: +

+
    +
  • --fullscreen -- Set the fullscreen mode [default].
  • +
  • --active -- Set the active window mode.
  • +
  • --region -- Set the screen region select mode.
  • +
  • --minimized -- Open ScreenGrab minimized in the tray (or taskbar, if tray is disabled).
  • +
  • --upload -- Automatically upload a screenshot to the selected image hosting service and display the direct link to the image after completion.
  • +
  • --version -- Display version information [Linux only].
  • +
  • --help -- Display command line parameters information [Linux only].
  • +
+ + + +

License To start page

+

+ Copyright: +

+

+ Artem 'DOOMer' Galichkin doomer3d@gmail.com +

+

+License: +

+

+ ScreenGrab is a freeware licensed by GNU General Public License version 2 +

+

+ Thanks to: +

+ +

+ Translators: +

+
    +
  • Marcio Moraes -- Brazilian Portuguese translation
  • +
  • Gennadi Motsyo -- Ukrainian translation
  • +
+

+ Beta-testers: +

+
    +
  • Alexantia
  • +
  • iNight
  • +
+ +

+And all those who use ScreenGrab :) +

+ +

Version history To start page

+

+ Version 1.2: +

+
    +
  • Added ability for autosaving type of the last created screenshot.
  • +
  • Some small fixes.
  • +
+

+ Version 1.1.1: +

+
    +
  • Fixed wrong 'imgur' uploading result string for bb-code with preview.
  • +
  • Fixed segfault when exist configuration file contains "showTrayIcon=false".
  • +
+

+ Version 1.1: +

+
    +
  • Added ability to upload to MediaCrush (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).
  • +
+

+ Version 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
  • +
  • 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 capture 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 the application
  • +
  • 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
  • +
+

+ Version 0.9.1: +

+
    +
  • Fixed non-switching combo-box "Type of Screeen" when grab screenshot from signal by another instance
  • +
  • Fixed incorect grab active window screens in GNOME (when disabled "Allow multiple copies" option and run another instance)
  • +
+

+ Version 0.9: +

+
    +
  • added global shortcuts
  • +
  • added option for 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 config dialog UI
  • +
+ +

+

+ Version 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
  • +
+

+ Version 0.8: +

+
    +
  • added command line parameters + for grab modes (fullscren, active window, selection area)
  • +
  • added BMP support
  • +
  • added Brazilian Portuguese translation
  • +
  • added automatically hiding main window on grab process
  • +
  • [Linux] fixed grab active window screenshot without decorations
  • +
  • [Linux] add option "no window decoration"
  • +
  • added shortcuts for main window buttons
  • +
+ +

+ Version 0.6.2 [Linux only]: +

+
    +
  • fixed non-translated tray menu (closed issue #7)
  • +
+

+ Version 0.6.1 [Linux only]: +

+
    +
  • fixed incorrect detection of the system language in some Linux distributions
  • +
+

+ Version 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)
  • +
+ + +

+ Version 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
  • + +
+ + + +

+ Version 0.4: +

+
    +
  • added grabbing selection screen area
  • +
  • added ability to copy image files into the clipboard
  • +
  • added saving size of 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 (work with config data)
  • +
  • change buttons tab order of main window
  • +
  • new application icon
  • +
  • some fixes
  • +
+ +

+ Version 0.3.1: +

+
    +
  • fixed bug with non-displayed main window icon
  • +
+ +

+ Version 0.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 + (by close window button).
  • +
+ +

+ Version 0.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 INI-file
  • +
  • added i18n support and Russian localisation
  • +
  • some fixes and changes in code
  • +
  • now available as installer (Windows) and deb packages (ubuntu 9.04)
  • +
+

x + Version 0.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
  • +
+

+ Version 0.0.3: +

+
    +
  • first working build with minimal features.
  • +
+ +
+ + +
+ + + diff --git a/docs/html/pt_BR/index.html b/docs/html/pt_BR/index.html new file mode 100644 index 0000000..00d72a9 --- /dev/null +++ b/docs/html/pt_BR/index.html @@ -0,0 +1,435 @@ + + + + + +ScreenGrab -- programa para captura rápida de imagens + + + + + + +
+
+

ScreenGrab - rápida criação de capturas de telas

+

+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. +

+

+ Principais características: +

+
    +
  • Funciona no Windows & Linux
  • +
  • Obtém captura de telas do desktop
  • +
  • Obtém captura de tela da janela ativa
  • +
  • Obtém captura de tela de uma região do desktop
  • +
  • Copia a captura de tela para a área de transferência
  • +
  • Salva seus arquivos de imagens no formato PNG +ou JPEG ou BMP
  • +
  • Ability to view and edit screenshots in an external editor
  • +
  • Ability to upload screenshots on several image hostings (mediacru.sh, imgur.com)
  • +
  • Habilidade em definir atraso ao obter as capturas de telas +(de 1 até 90 segundos)
  • +
  • Ocultando a janela principal (com recuperação) do +ScreenGrab no momento da captura de tela
  • + +
  • Habilidade para minimizar o programa para a área de notificação do sistema, e +controlá-lo via menu de contexto
  • +
  • Obtém a captura de tela usando atalhos globais
  • +
  • Salva automaticamente a captura de tela ao ser recebido
  • +
  • Habilidade de inserir data e hora no nome do arquivo e salvar
  • +
+ + + +

Uso Para o início da página

+

+ É muito simples. +

+

+ 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. +

+

+ Botões na janela principal: +

+
    +
  • Nova tela [Ctrl+N] -- obtém nova captura de tela.
  • +
  • Salvar tela [Ctrl+S] -- salva a captura da tela obtida no disco rígido (no formato PNG ou JPEG).
  • +
  • Copiar tela [Ctrl+C] -- copia tela para a área de transferência.
  • +
  • Upload - upload screenshots on several image hosting services, currently ScreenGrab supports mediacru.sh, imgur.com and imageshack.us, in the future, the list will be expanded.
  • +
  • Edit in ... - the ability to open (and edit) screenshots in an image editor. +
    +
    + NOTE: In the current version for Microsoft Windows only MS Paint is supported. +
  • +
  • Opções [Ctrl+O] -- mostra a janela de opções do programa.
  • +
  • Ajuda [Ctrl+H] -- exibe informações de ajuda e exibe informações sobre o ScreenGrab, desenvolvedor e licença.
  • +
  • Sair [Ctrl+Q] -- sai do programa.
  • +
+

+ Estes botões também estão disponíveis no menu do programa na área de notficação do sistema. +

+

+ Controles adicionais, localizado na janela principal. +

+
    +
  • Atraso -- atrasa em segundos antes de capturar a tela.
  • +
  • Tipo -- tipo de obtenção [tela cheia +ou janela ativa].
  • +
+

+ Configurações principais: +

+
    +
  • Diretório padrão -- diretório padrão para salvar as capturas de telas.
  • +
  • Nome do arquivo padrão -- nome do arquivo salvo por padrão.
  • +
  • Formato -- padrão do formato da imagem salva (você pode selecionar outro formato ao salvar).
  • +
  • Nenhuma decoração da janela -- captura a janela ativa sem as decoraçãos da janela (only for linux version).
  • +
+

+ Configurações avançadas: +

+
    +
  • Inserir Data/Hora no nome do arquivo -- inseri data e hora no nome do arquivo salvo. +
    +
    Estas expressões podem ser utilizadas como parte dos caracteres do formato da data:: +
    + + + + + + + + + + + + + + +
    Saída dasexpressões
    do dia como número sem um zero à esquerda (1 a 31)
    ddo dia como número com um zero à esquerda (01 a 31)
    dddo nome abreviado do dia localizado. (ex. 'Seg' a 'Dog')
    ddddo nome longo do dia localizado (ex. 'Segunda' a 'Domingo')
    Mo mês como número sem um zero à esquerda (1-12)
    MMo mês como número com um zero à esquerda (01-12)
    MMMo nome abrevido do mês localizado (ex. 'Jan' a 'Dez')
    MMMMo nome longo do mês localizado (ex. 'Janeiro' a 'Dezembro')
    yyo ano como número de dois dígitos (00-99)
    yyyyo ano como número de quatro dígitos
    +
    +
    Estas exepressões podem ser utilizadas como parte dos caracteres do formato da hora:: +

    + + + + + + + + + + + + + + + + +
    Saída dasexpressões
    ha hora sem um zero à esquerda (0 a 23 ou 1 a 12 se AM/PM for exibido)
    hha hora com um zero à esquerda (00 a 23 ou 01 a 12 se AM/PM for exibido)
    Ha hora sem um zero à esquerda (0 a 23, até quando AM/PM for exibido)
    HHa hora com um zero à esquerda (00 a 23, até quando AM/PM for exibido)
    mo minuto sem um zero à esquerda (0 a 59)
    mmo minuto com um zero à esquerda (00 a 59)
    so segunddo sem um zero à esquerda (0 a 59)
    sso segundo com um zero à esquerda (00 a 59)
    zos milisegundos sem unz zeros à esquerda (0 a 999)
    zzzos milisegundos com unz zeros à esquerda (000 a 999)
    AP ou Ainterpreta com uma hora AM/PM. AP deve ser um "AM" or "PM"
    ap ou ainterpreta com uma hora AM/PM. ap deve ser um "am" ou "pm"
    +
    +
  • +
  • Auto-salvar tela -- salva automaticamente capturas de telas no processo de captura.
  • +
  • Salvar a primeira captura de tela -- habilitado | desabilitado automaticamente ao salvar a primeira captura de tela, que se obtém ao executar o programa.
  • +
  • Filenames to clipboard on saving - send to the clipboard name of the saved file. You can select these params:
  • +
      +
    • No copy - the name of saved file will not be transferred to the clipboard.
    • +
    • Only filename - send to the clipboard only the file name.
    • +
    • Full path to file - send to the clipboard full path to the file.
    • +
    +
  • Permitir múltiplas instâncias -- permite executar múltiplas instâncias do ScreenGrab.
  • +
  • Enable external viewer -- enable or disable ability for preview screenshot in default image viewer (by double click on screenshot area in main window).
  • +
+

+ Exibir configurações: +

+
    +
  • Salvar o tamanho da janela ao sair -- salva o tamanho da janela principal ao sair (e restaura na próxima execução).
  • +
  • Zoom da área ao redor do mouse no modo de seleção -- a capacidade de exibir a área ampliada em torno do ponteiro do mouse ao receber uma tela de área selecionada.
  • +
+

+ Configurações da área de notificação dos sistema: +

+
    +
  • Usar a área de notificação -- usar a área de notificação (system tray) do sistema operacional (ambiente de trabalho) para mostrar as mensagens e gerenciar o programa. +
  • Mensagens na área de notificação -- modo de exibir as mensagens na área de notificação ao tirar|salvar os eventos. Pode ser "nenhum" ou "ocultar" ou "sempre".
  • +
  • Tempo de exibição das mensagens na área de notificação -- tempo em que as mensagens são exibidas.
  • +
  • Fechar para área de notificação -- minimiza a janela principal para a área de notificação ao clicar no botão fechar da janela.
  • +
+

+ configurações dos atalhos: +

+

+ 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. +

+

+ 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. +

+

+ Atalhos globais podem ser usados para se obter uma nova captura de tela, ao trabalhar com outra aplicação no seu sistema operacional. +

+

+ Parâmetros da linha de comando: +

+
    +
  • --fullscreen -- define o modo tela cheia [padrão].
  • +
  • --active -- define o modo janela ativa.
  • +
  • --region -- define o modo selecionar área da tela.
  • +
  • --minimized -- run in minimized to the tray (or taskar, if tray is disabled).
  • +
  • --upload -- automatically uploading screenshot on selected image hosting. And display after it direct link to image.
  • +
  • --version -- exibe informações da versão {somente linux].
  • +
  • --help -- mostra informações dos parâmetros de linha de comando {somente linux].
  • +
+ + + +

Licença Para o início da página

+

+ Copyright: +

+

+ Artem 'DOOMer' Galichkin doomer3d@gmail.com +

+

+Licença: +

+

+ ScreenGrab é um freeware licenciado sob os termos da Licença Pública Geral GNU versão 2 +

+

+ Agradecimentos aos:: +

+ +

+ Tradutores: +

+
    +
  • Márcio Moraes -- Tradução para o Português do Brasil
  • +
  • Gennadi Motsyo -- Tradução para o Ucraniano
  • +
+

+ Beta-testers: +

    +
  • Alexantia
  • +
  • iNight
  • +
+ +

+E a todos aqueles que utilizam ScreenGrab :) +

+ +

Histórico das versões Para o início da página

+

+ Versão 1.2: +

+
    +
  • Added ability for autosaving type of the last created screenshot.
  • +
  • Some small fixes.
  • +
+

+ Version 1.1.1: +

+
    +
  • Fixed wrong 'imgur' uploading result string for bb-code with preview.
  • +
  • Fixed segfault when exist configuration file contains "showTrayIcon=false".
  • +
+

+ Version 1.1: +

+
    +
  • Added ability to upload to MediaCrush (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).
  • +
+

+ Versão 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 hosts (imgur.com and imgshack.us)
  • +
  • Added build option for compile without upload feature (SG_EXT_UPLOADS bulld option)
  • +
  • Added "Previous selection" mode
  • +
  • Added ability to edit screenshot in 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 use "Minimize to tray" option
  • +
  • Fixed bug with cut button text on mainwindow
  • +
  • Fixed regression with not capture screenshot when second instance running
  • +
  • Fixed bug with not create path to autosave screenshots (when it is typed manually in configuration dialog)
  • +
  • Added build option SG_GLOBALSHORTCUTS for turn on/off build with global shortcuts support
  • +
  • Autoincrement filenames when saving screenshots in manual mode (in one running session)
  • +
  • Added the ability to customize shortcut to close the application
  • +
  • Added ability to run in minimized to tray (or taskar, if tray is disabled) with "--minimized" comand line option
  • +
  • Added ability to automatically upload the screenshot via the command line "--upload" param
  • +
+

+ Versão 0.9.1: +

+
    +
  • 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.
  • +
  • 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).
  • +
+

+ Versão 0.9: +

+
    +
  • adicionados atalhos globais.
  • +
  • adicionado a opção habilitar|desabilitar na área de notificação do sistema.
  • +
  • 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).
  • +
  • adicionado salvar automaticmente a primeira captura de tela que foi obtida no início do programa (ocional habilitar | desabilitar).
  • +
  • redesenhada a interface do diálogo de configuração.
  • +
+ +

+

+ Versão 0.8.1: +

+
    +
  • [Linux] corrigido a incorreta seleção padrão ao salvar o formato no KDE 4.4.x no diálogo salvar arquivo.
  • +
  • adicionada a tradução de_DE.
  • +
+

+

+ Versão 0.8: +

+
    +
  • adicionado parâmetros de linha de comando + para obtenção dos modos (tela cheia, janela ativa, área da seleção).
  • +
  • adicionado o suporte a BMP.
  • +
  • adicionado a tradução para o Português do Brasil.
  • +
  • adicionado ocultando automaticamente janela principal no processo de captura.
  • +
  • {linux] corrigido obtenção da captura da janela sem decorações.
  • +
  • [linux] adicionado opção "sem decoração da janela".
  • +
  • adicionado atalhos para os botões da janela principal.
  • +
+ +

+ Versão 0.6.2 [Somente Linux]: +

+
    +
  • corrigido o não traduzido menu da área de notificação (publicação fechada #7).
  • +
+

+ Versão 0.6.1 [Somente Linux]: +

+
    +
  • corrido a incorreta detecção do idioma do sistema em algumas distribuições Linux.
  • +
+

+ Versão 0.6: +

+
    +
  • o valor padrão de "ocultar janela principal" foi alterado para true (ativado).
  • +
  • adicionado entrada modelo para inserir data-hora no nome do arquivo salvo.
  • +
  • adicionado zoom ao redor do cursor do mouse no modo de seleção de área.
  • +
  • pequena moficaição no diálogo de configuração.
  • +
  • adicionado ajuda html em (inglês & russo).
  • +
+ + +

+ Versão 0.5: +

+
    +
  • adicionado inserir data|hora ao salvar nome do arquivo [opcional].
  • +
  • adicionado auto salvar telas no processo de obtenção [opção].
  • +
  • adicionado alterar tempo de exibição das mensagenas na área de notificação [1 - 10 src].
  • +
  • adicionado informações de ajuda.
  • +
  • adicionado dicas de ferramentas para os elementos UI.
  • +
  • pequenas correções na sintaxe do arquivo de configuração.
  • + +
+ + + +

+ Versão 0.4: +

+
    +
  • adicionado obter região de uma área selecionada.
  • +
  • adicionado copiar para a área de transferência.
  • +
  • adicionado salvar tamanho da janela principal ao sair [padrão está desabilitado].
  • +
  • decrementado em 2 tempos os volumes ocupados pela memória ao iniciar.
  • +
  • [win32] falha corrigida com a localização de screengrab.ini.
  • +
  • alterada estrutura de algumas linhas do código fonte (para trabalhar com configuração de data).
  • +
  • alterada a ordem da aba dos botões da janela principal.
  • +
  • novo ícone do programa.
  • +
  • algumas correções.
  • +
+ +

+ Versão 0.3.1: +

+
    +
  • corrigida falha com a não exibição do ícone da janela principal.
  • +
+ +

+ Versão 0.3: +

+
    +
  • janela principal agora baseada no arquivo UI (recriado UI).
  • +
  • adicionado captura da janela ativa.
  • +
  • adicionado opção para permitir múltiplas instâncias do ScreenGrab.
  • +
  • adicionado opção para selecionar entre minimiizar no área de notificação e fechar (botão fechar da janela).
  • +
+ +

+ Versão 0.2: +

+
    +
  • adicionado suporte a JPEG.
  • +
  • adicionado diálogo de opções.
  • +
  • adicionado configurações ao salvar diretório, nome do arquivo e formato da imagem por padrão.
  • +
  • adicionado opções de salvar no arquivo INI.
  • +
  • adicionado suporte a i18n e localização Russa.
  • +
  • algumas correções e alterações no código.
  • +
  • disponível agora com um instalador (Windows) e pacotes deb (ubuntu 9.04).
  • +
+

+ Versão 0.1: +

+
    +
  • primeira versão pública.
  • +
  • adicionado ícone e menu na área de notificação do sistema.
  • +
  • adicionado ocultar na área de notificação do sistema.
  • +
  • adicionado o bloqueio de uma segunda instância do programa.
  • +
+

+ Versão 0.0.3: +

+
    +
  • primeira construção trabalhada com recursos mínimos.
  • +
+ +
+ + +
+ + + diff --git a/docs/html/ru/index.html b/docs/html/ru/index.html new file mode 100644 index 0000000..8db19d4 --- /dev/null +++ b/docs/html/ru/index.html @@ -0,0 +1,487 @@ + + + + + +ScreenGrab -- программа для быстрого создания скриншотов + + + + + + +
+
+

ScreenGrab - быстрое создание скриншотов

+

+ Данная программа является кроссплатформенным приложением, + предназначенным для быстрого получения снимков экрана +(скриншотов) . + ScreenGrab создана с использованием фреймворка Qt, за счёт +которого + достигается работоспособность приложения в операционных +системах Microsoft Windows и GNU/Linux. +

+

+ Основные возможности программы: +

+
    +
  • Работа в операционных систмах Windows и Linux
  • +
  • Получение снимков рабочего стола
  • +
  • Получение снимков отдельного активного окна
  • +
  • Получение снимков выделенной области экрана
  • +
  • Копирование скриншотов в буфер обмена
  • +
  • Сохранение полученных изображений в файлы форматов PNG, PEG или BMP
  • +
  • Возможность просмотра и редактирования скриншота во внешнем редакторе
  • +
  • Ввозможность загрузки скриншотов на несколько хостингов изображений (на данный момент mediacru.sh и imgur.com)
  • +
  • Возможность установки задержки при получении скриншотов +(от 1 до 90 секнд)
  • +
  • Скрытие главного окна (с последующим восстановлением) +ScreenGrab в момент + получения скриншота
  • +
  • Возможность сворачивания приложения в системный трей, и +управление через контекстное меню
  • +
  • Получение скриншотов при помощи глобальных клавиш быстрого доступа
  • +
  • Автоматическое сохранение скриншотов при их получении
  • +
  • Возможность вставки текущей даты и времени в имя сохраняемого файла
  • +
+ + + +

Использование В начало

+

+ Все очень просто. +

+

+ При первом запуске программы, вы получаете снимок + текущего состояния вшего рабочего стола. Вы можете увидеть это в + окне программы. + Все дальнейшее управление программой может быть осуществлено +через кнопки + или контекстное меню в области уведомлений рабочего стола. +

+

+ Назначение кнопок окна программы. +

+
    +
  • Новый снимок [Ctrl+N] -- получение нового скриншота
  • +
  • Сохранить [Ctrl+S] -- запись полученного снимка на жесткий +диск, + в виде графического файла.
  • +
  • Копировать [Ctrl+C] -- Копирование скриншота в буфер обмена.
  • +
  • Опубликовать - загрузить полученный скриншот на один из поддерживаемых хостингов изображений. На данный момент поддерживаются mediacru.sh, imgur.com и imageshack.us, в дальнейшем список будет расширен
  • +
  • Открыть в ... - возможность открытия (и редактирования) полученного скриншота в одном из установленных в системе приложений для работы с изображениями. +
    + Заимечание: В версии для Microsoft Windows поддерживается только Microsoft Paint. +
  • +
  • Настройки [Ctrl+O] -- настрйоки программы
  • +
  • Справка [Ctrl+H] -- отображение справочной информации и вывод окна с информацией о +разработчике и лицензии
  • +
  • Выход [Ctrl+Q] -- выход из программы (при закрытии через +"крестик" в верхнем правом углу, + программа всего лишь свернётся в убласть +уведомлений)
  • +
+

+ Все это также продублировано в контекстном меню приложения. +

+

+ Дополнительные элементы управления приложением, расположенный в +главном окне. +

+
    +
  • Задержка -- величина задержки (в секундах) + перед получением нового снимка экрана.
  • +
  • Тип -- выбор типа скриншота (полный экран, +снимок отдельного активного окна или выделенная область экрана).
  • +
+

+ Основные параметры: +

+

+ Основные параметры разделены на две вкладки: +

+
    +
  • Каталог по умолчанию -- директория для сохранения +файлов, + открываемая в окне сохранения файлов.
  • +
  • Имя файла по умолчанию -- исходное имя файла при +сохранении..
  • +
  • Формат -- формат изображения, + который будет автоматически выбираться при сохранении. + Возможность выбра другого формата при сохранении
  • +
  • Без декораций окна -- получение скриншота активного окна без рамки и строки заголовка (только для Linux-версии).
  • +
  • Копировать имя сохранённого файла в буфер обмена - передача в буфер обмена имени сохраняемого файла. Можно выбрать следующие варианты:
  • +
      +
    • Не копировать - имя сохранённого файла не будет передано в буфер обмена.
    • +
    • Только имя файла - передать в буфер обмена только имя файла.
    • +
    • Весь путь к файлу - передать в буфер обмена полный путь к файлу.
    • +
    +
+ +

+ Основные параметры: +

+ +

+ Расширенные параметры: +

+
    +
  • Дата и время в имени файла -- возможность автоматическойй + вставки текущей даты и времени в имя сохраняемого файла +
    +
    Эти выражения могут быть использованы для форматирования вывода даты: +
    + + + + + + + + + + + + + + +
    ВыражениеВывод
    dthe day as number without a leading zero (1 to 31)
    ddдень в виде цифр, с нулем в начале, если требуется (01-31)
    dddназвание для в сокращенном виде (напр. 'Пн' или 'Вс').
    ddddполное название дня (напр. 'Понедельник').
    Mмесяц в виде цифр, без нуля в начале (1-12)
    MMмесяц в виде цифр, с нулем в начале, если требуется (01-12)
    MMMназвание месяца в сокращенном виде (напр. 'Янв').
    MMMMполное название месяца (e.g. 'Январь').
    yyгод в виде двух цифр (00-99)
    yyyyгод в виде четырех цифр (0000-9999)
    + +
    Эти выражения могут быть использованы для форматирования вывода времени: +

    + + + + + + + + + + + + + + + + +
    ВыражениеВывод
    hthe hour without a leading zero (0 to 23 or 1 to 12 if AM/PM display)
    hhthe hour with a leading zero (00 to 23 or 01 to 12 if AM/PM display)
    Hthe hour without a leading zero (0 to 23, even with AM/PM display)
    HHthe hour with a leading zero (00 to 23, even with AM/PM display)
    mthe minute without a leading zero (0 to 59)
    mmthe minute with a leading zero (00 to 59)
    sthe second without a leading zero (0 to 59)
    ssthe second with a leading zero (00 to 59)
    zthe milliseconds without leading zeroes (0 to 999)
    zzzthe milliseconds with leading zeroes (000 to 999)
    AP or Ainterpret as an AM/PM time. AP must be either "AM" or "PM".
    ap or aInterpret as an AM/PM time. ap must be either "am" or "pm".
    +
    +
  • +
  • Автосохранение скриншотов -- автоматическое сохранение + скриншотов при их получении (можно совмещать с предыдущей настройкой)
  • +
  • Сохранять первый скриншот -- возможность автоматического сохранения скриншота, получаемого при запуске приложения
  • + + +
  • Несколько копий программы -- возможность +запуска нескольких экземпляров ScreenGrab одновременно.
  • +
  • Enable external viewer -- включить или выключить просмотр скриншота во внешней программе просмотра графических файлов (двойным кликом по скриншоту в клавном окне).
  • +
+

+ Параметры отображения приложения: +

+
    +
  • Сохранять размеры окна при выходе -- сохранение размеров основного окна при выходе, с восстановлением при последующем запуске.
  • +
  • Масштабирование области курсора в режиме выбора -- возможность отображения увеличенной области вокруг курсора мыши при получении скриншота выбранной области экрана.
  • +
+

+ Параметры использования области уведомлений (трей): +

+
    +
  • Использовать трей -- возможность использования области уведомлений операционной системы (десктопного окружения) для отображения сообщений и управления приложением.
  • +
  • Всплывающие уведомления -- режим отображения +всплывющих уведомлений. Имеет три вида - отображать всегда, отображать +только при свёрнутом главном окне и не отображаить никогда.
  • +
  • Время отображения уведомлений -- время (в секундах), в + течении которого будут отображяться всплывающие уведомления
  • +
  • Сворачивать в область уедомлений -- сворачивание +прпограммы в область уведомлений (трей) при назатии на кнопку закрытия (ту +что в правом верхнем углу окна).
  • + +
+

+ Комбинации клавиш: +

+

+ На вкладке "Комбинации клавиш" в окне настроек вы можете установить сочетания клавиш для быстрого доступа к основным функциям приложения. Существует два вида комбинаций клавиш, используемых в screenGrab -- локальные и глобальные. +

+

+ Локальные дублируют действия выполняемые при нажатии на кнопки в главном окне приложения. Они работают только когда окно ScreenGrab является активным. +

+

+ Глобальные комбинации клавиш позволяют воспользоваться функцией получения нового скриншота при работе с другим приложением в вашей операционной системе. +

+

+ Параметры командной строки: +

+
    +
  • --fullscreen -- скриншот всего экрана [по умолчанию].
  • +
  • --active -- скриншот активного окна.
  • +
  • --region -- скриншот выделенной области экрана.
  • +
  • --minimized -- запуск с автоматическим сворачиванием в трей (или на панель задач, если тподдержка трея выключена).
  • +
  • --upload -- автоматическая загрузка скриншота на выбраный в настрйоках хостинг изображений. И отображение прямой ссылки на изображение после завершения загрузки.
  • +
  • --version -- вывод информации о версии ScreenGrab {только linux].
  • +
  • --help -- вывод информации о параметрах командной строки {только linux].
  • +
+ + +

Лицензия В начало

+

+ Авторские права: +

+

+ Артём 'DOOMer' Галичкин doomer3d@gmail.com +

+

+Лицензия: +

+

+ Программа ScreenGrab распространяется бесплатно по условиям GNU General Public License version 2 +

+

+ Благодарности: +

+ +

+ Локализации: +

+
    +
  • Márcio Moraes -- Бразильская Португальская локализация
  • +
  • Геннадий Моцьо -- Украинская локализация
  • +
+

+ Бета-тестеры +

+
    +
  • Alexantia
  • +
  • iNight
  • +
+ +

+ А также всем тем, кто использует ScreenGrab :) +

+ +

История версий В начало

+

+ версия 1.2: +

+
    +
  • Добавлена возможность запоминания типа последнего сделанного скриншота.
  • +
  • Несколько небольших исправлений.
  • +
+

+ Версия 1.1.1: +

+
    +
  • Исправлена неправильная строка bb-ода с превью скриншота, загружаемого на 'imgur'.
  • +
  • справлено аварийное завершение приложения при наличии в конфигурационном файле параметра "showTrayIcon=false".
  • +
+

+ Версия 1.1: +

+
    +
  • Добавлена возможность автоматической загрузки скриншота на MediaCreush (http://mediacru.sh).
  • +
  • Опция "Всегда сохранять размер окна" заменена на "Автодобавление размера окна при выходе из ScreenGrab".
  • +
  • Перервботан интерфейс главного окна (изменен некоторые кнопки).
  • +
  • Переработан диалог настроек (уменьшено число секций и некоторые настройки были перемещены между секциями).
  • +
+

+ Версия 1.0: +

+
    +
  • Исправлены баги с поддержкой двух мониторов в Linux.
  • +
  • Добавлена поддержка XDG_CONFIG_HOME (конфигурационные файлы теперь хранятся в ~/.config/screengrab/), отключается опцией сборки SG_XDG_CONFIG_SUPPORT
  • +
  • Добавлена возможность загрузки скриншотов на несколько хостингов (на данный момент imgur.com and imgshack.us, в дальнейшем список будет расширен)
  • +
  • Добавлена возможность сборки без модуля загрузки скриншотов в интернет (опция сборки SG_EXT_UPLOADS)
  • +
  • Добавлен режим "Ранее выбранная область"
  • +
  • Добавлена возможность редактирования скриншота во внешнем редакторе
  • +
  • Добавлена опция просмотра скриншота во внешней программе просмотра графических файлов (двойным кликом по скриншоту)
  • +
  • Исправлена ошибка сворачивания главного окна при использовани шортката "Exit", если включена опция "Сворачивать в область уведомлений"
  • +
  • Исправлен баг с невлезанием некоторых локализаованных надписей на кнопки в главном окне.
  • +
  • Исправлена регрессия с неполучениемм скриншота при запуске второго экземпляра приложения.
  • +
  • Исправлена ошибка несоздавания несуществоввашего ранее каталога для автосохранения скриншотов (при ручном вводе имени каталога в диалоге натроек)
  • +
  • Добавлена опция сборки SG_GLOBALSHORTCUTS для возможности сборки без поддержки глобальных горячих клавиш
  • +
  • Автодобавление номеров скриншотов при сохранении, если файл с выбранным именем уже существет в данном каталоге.
  • +
  • Возможность изменить комбинацию клавиш для действия "выход"
  • +
  • Возможность запуска с автоматическим сворачиванием в трей (или на панель задач, если тподдержка трея выключена) при помощи параметра командной строки "--minimized"
  • +
  • Добавлена возможность автоматической загрузки скриншота на выбранный в настройках хотсинг изображений (парметр командной строки "--upload")
  • +
+

+ Версия 0.9.1: +

+
    +
  • Исправлено не-переключение типа скриншота (в GUI) при снятии скриншота по сигналу от другого экземпляра приложения (запущенного при выключенной опции "Несколько копий приложения").
  • +
  • Исправлено некорректное получение скриншота активного окна в среде GNOME (при выключенной опции "Несколько копий приложения" и запуске второго экземпляра ScreenGrab)..
  • +
+

+ Версия 0.9: +

+
    +
  • Добавлены глобальные клавиши быстрого доступа.
  • +
  • Добавлена возможность отключения трея.
  • +
  • Дабвлено активирование узе запущенной копии ScreenGrab при попытке запуска второго экземаляра приложения (при отключенной опции "Несколько копий программы").
  • +
  • Добавлено автосохранение первого скриншота, получаемого при старте приложения (в виде опции)).
  • +
  • Изменен дизайн диалога настроек.
  • +
+ +

+

+ Версия 0.8.1: +

+
    +
  • [Linux] Исправлен некорректный выболр формата сохраняемого файла в KDE 4.4. и выше
  • +
  • Добавлена немецкая локализация
  • +
+

+ Версия 0.8: +

+
    +
  • Добавлены параметры командной строки для установки режима получения скриншотов + (весь экран, активное окно, область экрана).
  • +
  • Добавлена поддержка формата BMP.
  • +
  • Добавлена Бразильская Португальская локализация.
  • +
  • Окно программы теперь автоматически скрывается в процессе получения скриншота.
  • +
  • {linux] Исправлено не совсем корректно получение скриншотов активного окна.
  • +
  • [linux] Добавлен параметр "без декораций окна".
  • +
  • Добавлены "горячие клавиши" для кнопок главного окна.
  • +
+ +

+ Версия 0.6.2 [Linux only]: +

+
    +
  • Исправлена некорректная загрузка локализации для меню области уведомлений.
  • +
+

+ Version 0.6.1 [Linux only]: +

+
    +
  • Исправлено некорректное определение системной локали в некоторых Linux-дистрибутивах..
  • +
+ +

+ Версия 0.6: +

+
    +
  • Параметр "скрывать главное окно" по умолчанию теперь включен.
  • +
  • Добавлена возможность редактировать шаблон даты И времени, +вставляемых в имя сохраняемого файла.
  • +
  • Добавлено мастабирование экранной области вокруг курсора +в режиме "область экрана".
  • +
  • Немного улучшен внешний вид диалога настроек..
  • +
  • Добавлена справочная информация в html-формате (на английском и русском языках).
  • +
+ +

+ Версия 0.5: +

+
    +
  • Добавлена возможность автосохранения скриншотов.
  • +
  • Добавлена возможность вставки текущей даты и времени в имя сохраняемог файла.
  • +
  • Добавлена возможность изменения времени отображения всплывающих уведомлений (1 - 10 секунд).
  • +
  • Добавлена возможность просмотра справочной информации по использованию программы.
  • +
  • Добавлены всплывающие подсказки (tool tips) ко всем элементам пользовательского интерфейса .
  • +
  • Несколько мелких исправлений в коде и конфигурационном файле.
  • + +
+ + + +

+ Версия 0.4: +

+
    +
  • Добавлена вохзможность захвата выделенной области экрана.
  • +
  • Добавлена возможность копирования скриншотов в буфер обмена.
  • +
  • Возможность сохранения текущих размеров окна приложения +при выходе (по умолчанию выключено).
  • +
  • Уменьшен объём оперативной памяти, занимаемой при запуске.
  • +
  • [Win32] Исправлен баг с размещением конфигурационного файла.
  • +
  • Немного оптимизирован код работы с конфигурационными параметрами.
  • +
  • Оптимизирован процесс работы с главным окном при помощи клавиатуры.
  • +
  • Новая иконка приложения.
  • +
  • Несколько мелких исправлений.
  • +
+ +

+ Версия 0.3.1: +

+
    +
  • Устранён баг с неотображением иконки приложения в +заголовке главного окна
  • +
+ +

+ Версия 0.3: +

+
    +
  • Полностью переработан интерфейс главного кона, +программмный код которого отделен от основного класса приложения.
  • +
  • Несколько других изменений в интерфейсе +пользователя.
  • +
  • Добавлена возможность получения скриншота +отдельного активного окна.
  • +
  • Добавлена опция включения возможность запуска +нескольких копий ScreenGrab.
  • +
  • Добавлена возможность выбора между сворачиванием в +область уведомлений и закрытие программы (при нажатии кнопки закрытия +окна).
  • +
+ +

+ Версия 0.2: +

+
    +
  • Сохранение в формат JPEG.
  • +
  • Добавлен диалог настроек.
  • +
  • Добавлены параметры для каталога сохраняемых файлов, +дефолтного + имени файла и предпочитаемого формата.
  • +
  • Сохранение настроек в INI-файл
  • +
  • Добавлена поддержка интернационализации и +ru-lang-package.
  • +
  • Немного изменений и фиксов в стурктуре кода.
  • +
  • Инстялятор для Windows-версии + пакеты для Ubuntu +9.04.
  • +
+

x + Версия 0.1: +

+
    +
  • Первая публичная версия.
  • +
  • Добавлена иконка в убластиуведомлений и контекстное +меню.
  • +
  • Возможность скрытия окна программы в область +уведомлений.
  • +
  • Запуск только одного экземпляра приложения
  • +
+

+ Версия 0.0.3: +

+
    +
  • Первая работоспособная версия с минимальной +функциональностью.
  • +
+ +
+ + +
+ + + diff --git a/img/logo.png b/img/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..e6b70fdf6c6e92010ac8091b2a93e7424d9362df GIT binary patch literal 6817 zcmV;S8eZjzP)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iXc4 z6fOjb0U>Gt02(1lL_t(|+U=ZqkY!hW-#@?KIrnY7OmEZb8I5M2(MY3ZW)PM@vQ&g6 z2D8WnLm=RQ<8p|T*cCeg+r$K@V5qVv$7N$G1WW~7Ax;WmL{bU6jm%~Q(rA}Pnw9CE zp6UJV_ug|({y6u&?ir0hlWJp%nlp9#^<7@ycfR-g`~H^mdjprp<#Bmj9+$`Eae4fd z4*6-F*xP^m_iAaHPUKlOmgV_W+U@GGlgGaM{V#v<+)pJyZ+QE!$)26NlHf@KzSK?A za;MWSr)hSBRdaO^4yv#Xkv-nINfn`-SVlK&;L52S98g<(3 z4l64woOtSKo_P2X@;paG$g+&3r6p!&rsd3;S*E9_*}8ojH(YnUq-px&1L&^*{9gud zzxkG_Ql+w~WXvQ+CtRLiIls6#xwtUDbAEn)V>eBArD=D_h|;JpQ!bS#mr9fpOD$2x zhbF@4-rbVegj%&qr_-TPuhVQcIX5@Q)92=Bwwh#FMxN)i+ih7`SYU2$j^*WL>Wv1X zN~KmMsL)zmp|jY)c0B`2z4Buh4F_$n%WBfq^ixVT0`3xq}TGhMAhY0_Pm{ zdY#3^Mds({nV+Ah)oPKZskGZ|(lo_6N1CQ|Ivv`b4()cEPPaq1+ojoPGJkH4yxnDd zY?P}uZf4iOBqJj`>6}|+;fYh!r{@^WpfohVhLKUmueyS%ottqhbygY+EICJ>yY*wx zCqMJquTKt^$Dcg%B*s|w?%u_gE4Q$H>sEGc+r{MMBuk5n)a!K?=I1##H^uyfaLZoBO^o_FvdfmOs+&ICe?N_n&Rl69O9H(5V;Bto#0jq-1K&4#c zTc7?*79W_$xg77^`Z35kxAMf1Bjf+}*ZvjXzyE&HG^M_<$OGr*xbHiEi*v3&X%Rt0 z$n%`JxjBv>Kh6_RJi!l6pC-@qr~%jCzzd%LGbA3unMG=I4F--Zu&o`~rJG5Pr7U;v z=kVcac3!`aiA_`NKXem^ZoL(oBqT|KDOWJoBBF={tSE?*wz_296eEhFkSHo;ykw;H zF1ZWjc}@tpbpuFL>xj^7wV0iqC4|82>@0J0=Qw-z9H(byu+~zpR4Chos!hOqlHAj6 zw-{V$v%fmdaCMlZZD`+jgnJL4V#CBJlbbei!~R3O@aEeY7#?O|aDYm!f~tWKAOx%k zq5`6*3f>3kruZ~NRZ%qrQPe0nhpItDu!%+U1k{n6l)UB0gTpybAmr-_P)k&qoSY=f zGQRZXFLC^lCmGo=%*fynTTGRZWwg)Dlcilkk}y~sVsLznJ=^y)xoMK&(NQYZN@Q4w z=A{ARybVSbqe`B3Y2`Uu>>E*nRTM!~@uG+-st(o28q^U~@x~x(KpjchqOCHh$Cn^a zQ(T(U@LinC3CQ{Zq#~&?hDxPEmSt2bRfZcmH{NhHo3>s_bzlHR@ZO^$C?F_e3`Pw` zg>I`u-pNoER1H=HH71&ZIw&Tusu=MY6B$Dy1ZU8~ghT|RLQqQ(B@_%&qo_izIn`={ zX;ul66O1PqkLzT(6c&93xxDv02NMvakGFoWgDqVHx*DrCJv*D zXcSXb?VC@0uVB<8LCKw9QDF6aP>I*8f(_s-Mgl=0VUQ3UBp}}6a{&V0IK0m(xf(t= zT%OZS)Aa;M+g1&Ep2sj=g{+g3XI%`2Obx+=xQQhw1Pzf*;t_Fp6`V#*ay_9Hht;Sr zK^0>nK%$BdQJ9?yKE!K86|d2gMUNFg!Q-ivEHo4uaEJgNLJENhssJ{#%s>c_C96eO@I9lim8oiJv zpiappg5=dBg%>j_U=*8Dz9$Y{Jsg zQgr1;>E=SWks?7b8b5f{R0D-ThgADssTa^0lOt=qmG)SnE=I*Rx^(s9DH;Ts2~9d4oyoCK&uAp9jSLX=jgQC>zd6sRShdED>0`6I+-JF zwowth3RX>j65c3Y488!t6>*9c2Sp%fR0$?B47CLHU<~2~7jlFmNQ{DpCo<58B3|*% zVvJzaVcaN!LmUJTl7L7cI7PaK5CS%}Bp6bc;k~EbSx113F)d8gpghmi|zPNP9$ zEM9HFnh2H`8yR9O!J6o;`d-KojN&DNiW-7=j2f^WO#+T+UIfJu85M{w->F5MVy#0G z#ae@O10oKwpaG<#U_6os)Pc_g?UX2sA+0rhVv90HEJg*NlQ-H>DwDf5 zEA|O1Z)I?TD&@}F$B#aGdL&Y2qFeWzzKK-F}M&J z<9!r($qlAjL0cY4K!acuv@K}afD;r?)(zOD5|wJD4^ZaTF`EZT)mWPCHqJRt|KK#5 z2wA&Jx7k60#}J>k6yOL35NrTn@3K@s%L?aEO(>U2)P|}Ij*L*QmdLVba)?87Au&qO z95I4%N}k2c+=b}o%NUF|F?mf&NY@wPR@5=)Jk~0t1`)7bkQ9c?8%WcXJkKHcbxbv^ z<^*UqSGfD`yJNKo*C?F!;!sF0~(gGFo+5BUm``FQ65DgiZuv_hd*;DR6ys`F!XyRjhW zonOCl2SHMRZl^=JT&CUWka>p|Jn2CajY0?oi&nvj|11_+1D^uoJl*9c-Fl1q>9f=Z zYK(0eM8*>as}`dM4G=N~XQ|W_Z924U(ZmB)Gz%E-5x`r6@d3Z$DQyr!DkK(MQ%D*$ z(r&ki<$_<=NIH0r^BxhQTq@zxyw4Zg2SEu1V5T?{xnl|trGIo`vc`iWfyR|1Olld% zhw&n~;OVqmw3;nkV;%{CaV#rFaV3k2;;RNl@y4P{i%97dqS0%LPcQ)-7FH}3EysX# zFoA0(;w%q_kZO7M}s;=*&~)4O!PcOmeiBu z0t~Qg%#HJ45zg+LWO@G;9J=ELTst@bKsU=svy3duNS!0gb8_eDW+{zUn|i%Ysa|Jc zd4*Q9L90;*pT}~DO(03Y7)VSJMwqy-TD-3PT}jgv>MP^S&5vUYlq)bYvW*?Pp2tT% z@g5$0;3a(Ij~==dH=nr>NDB{Ut;La@H+4`dTc^lR&aP1*?X!uI0ZzW+8lHE{AzpmT z%{1F>vOFivbF$o#x|}S_ierw9W{t(5yFTHybQA8syy! zmu1n6yu-6)r76vCOL5EL4NCZck-d%KlWS$#k`lv zhY;VWN+TV4oF{YnTn10+W{ipZ+{o~Xt!fW3D0Y3HCw{Uy;@2@xFVn#g? z0{?8=7C!d5&r%s2fVnxSRQM+^c@fXM>Pp%dDOu|evDvO_JgutH#Ed}*1t8J~O9&{! zOf6ssYW(g??%;~VBJ$(ut_c^>xZa(8v09h|PJ~>9R}EJA#b5d5SYKM0=fIBbWGJZ* zmr@UsJa|D>u*P7m#gBZRQ-0EG)0ntI-?-fD5@t6%ku zbAtne{KY-@#Hd`(7wk9w;_La;?|-0J4idaT_ad3dvujW=8H88|F5)27wPwYd6g7g> z8mh2i$BuZ-vw(9UaK6}=wQN|kzt&trEIaqNP#nDP(Z_iBzV9+IF?Qa)ym#c!(j_)E zJOHIq42_K7MCf>b36ZqWRaHC^*Ts!Nty#mMm}J;~CRRM(@S~r8JIk40S|TfA6X!jm z%J}FABjs`*hzkMn7ci%1OC4Zx;{+3vljq;ldr}_@X>tKfD!mUC!SNz=@=E~7Skopz zx7(#sE>kL%u!+SKe^>ivwp!@;p>8+?+F8blGqX%hj59Sh8kd5Kpf2~Gdb`8nGbfoG zA7{hRAR&Yz7^L5I5H17=7#$m@QmrvMHg+LhAwVwYvq&y9RS|MkGM_znfd1v{?#%!6 zGxyMJwu3Q7dKx5axL{WE^Mcdv*;JJIMw8jaMfPmDl0=mUA9;k&-*XRh3k!^F80H`T z{44pHg9owI3deqMnnso~IyTk^!(YVQdSlDZ9sKzhzQWnF=l5sUYE>3;$6(n!qajn* zz~#l@5Zoo1SP^`-IvoL`NGBE{@23m0rj95VJeRc-$wJ`i>1hsKy_Zg&^VYY%mH+ms zPr<+dRH^{H=RNP`HNWr+{OKn@$<$R>@zj$~UM zj3|i_+(mRv*8Jj4T)EBNB?F{%vsmyhl}aR~1l642>DPS}M~sY2J6Q%3&O9MznJh3KTFeo9I4$TB6uinn~ zL)WtBrt8_ZZ#SDdbrwGQQGy7a;sb;b=w=z!YL&cP=H2gmA2YMF@RFB7r&EBl3J`h5 z(RQ2PdgpKRj`x26=R7O*CZ$>}8g^I(1z81wBAw9Cca43|D8)4*{kIf>?wV#XjV9L4 zE)gJ98mJvM#*icliA~53Y~>@L_!EX~nRcT|yV<5TTtknaV_VgIZCH2qjglDkW7aMk!lMNrbWytVV6>p_dzj zhf5b}V>In~kt9hdl}nIzm^(E?xm>~)tufitM|kK>pJHI!PP`}|e*9>xM5;1>{3NsE z6D%w&LZt#rixCi)Gg7NDGPD8X9nHl>7MIQag0~XYeZi01k&u%8Puid@JNz`Bq`zZIs{MFP3bn< zxGZPWn}3!1-+Y7R;bDdf`iG(pR303_IFD|e1eYO=I@UXOZ{5m{EnAoz8NmuH&ChfE z*inu=@g(J1i8Lvbx7$=oNi3$UVUI1?vkFdR&?-1u?8h~;RkrnB3k^~QAu=dH%ehPR zVk)hqTqYD=tXwY9$WodM%Q3*qV$;&G%(MAjALRM>e~ZVprxnr0OQYi?3-h!mH?imW zH*@0Q!|d3+nFBj^aP2kMuzB-lM1?amGt_D|y4?=Btx|8bn0f3`Zu{BWIMbi_>Lg78 zgn5Sc6yRv@nlQIh;tlVlV^nxNCpQnr;if`hPmU{f0Ms>^Xu3$ImwRg+t_!_wd~ou7Zv5HBTv$9 zwK;k07$w zVvYDe!p-YaQYsM$F%Gf`b7jXz@B3>OmzG&xsbfXhwQC3ackkiI?96$=qDU-`G=@hh zFPtO4{s8az-2dfoKJ)>GhK8A#m|*vwy%=LyT3(`DF7vwIdoRmZZD;z?M|kBOw=?Tp z6jc#45StgotT8$ILY)*Eq|Y#`Xrd}T^IO9pF$6I@I=8SIg>WD~AQSVj>3Z|hzsw@gFvgJQjwDGK8yn-6Tb@UjcBxj&{aSpvoN)5wN$hg-82|-| zeLE*MZ{ztVk81$93fh0+2Gy+RY%bY%a zn(5QiwAw9hy6L9nvC#<&3|y?Tx0L0uV-K&}+~6~x|16!U&7?bbF;_0*(=H1qj&uCm z-{e8)IwDD8y>>MJW$$3~dC=4H5l^jf~RxWu<-&r;DIbA+V$ zIzsG+WR(?#U~7*##R_kaIX!La3${X1BaR_0JNx;#1gOjQZ zmItV9+JFF$wYvC5o5UC_F;)>(k{$zCH7Tn?Vhnfx-|oDE%GlFn3}wTx4rf? zbX_Qz6g!Buh=GnTuR!i`0w?OtfcHYP{zsPt(3@U#+u=`t{hJ53U$gJJZkB!H(;xfz zu^$R(tv3ABqmSWV>-*I@2?1+XwIL}Q!>vH(JWZcrP3#isfnzlG10-uT$E;z7D&PL@ zclqSqpT!tmn{xHbxt&fIM0m@cuf`S=RRJ3!VDJ9eCtzq0D%C*lgm&xK`Hg>m=90g0 z_{Q5`_yF+0bE>M3j@`=q9DntdukhlRz6|diYIOApo+q@?6MwwpirP1}{(Vs>Dvamd!`j&XGBNSr`QUrs_@meS z|E|V6-+eQx@51}t{G|K`1|lBO?-1N?^1=5lad})Gm&fICd0ZYp)#LvGmR`QM_#{y= P00000NkvXXu0mjfo-p!u literal 0 HcmV?d00001 diff --git a/img/screengrab.png b/img/screengrab.png new file mode 100644 index 0000000000000000000000000000000000000000..12d7f37712b6061294fb0888c2773d4727103079 GIT binary patch literal 1947 zcmV;M2W0q(P)Px#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iXc4 z6fPcgW7rS?00$dML_t(o!|j(_h+Wkg$A9a(_t|I8naND%KFN#*ry?Q|wOVhL5(}*& z6beNs($+#j#GozMhh8Xsv4RmqAFB4DH;YhP^Uz|I($?A(kx|ZX^Eo?2iUj!A1Eo0ohk480G@sBci&iBTirA~I5cgnos~jtcFvC# zdB*agg9PuG9IP`|O*pi)6kdJ%pTb(piN(XD%{6)_TIB7NdQxL*;}}z8Q*7NZLg!G6 zKa8vu=LGos8+*Qe?PZtN7Y-g||A7NEnoaUvkD`~-IC2a!&p@R@tx{!rWJ1i1jFK*Q zm>-{KmVsspEu*)@X<{K^TNm7;Ug7!W+v#br4ieo(GCTkruu3 zoB$xwEX&9`9lEVG3Kii@iBkoo%5mC|X@gaU$XJ3=s7T?^NNw;&6O6-Hf$%vffm0G& zR_Jy+=k5W7$Xl%z!AaVU6e9{sol$5_tPO=RMA{Iv25nKXCO4XZMQeqR3>c5GH6$4* zP_B-UkoJ1#1<-3YniM@p`}hj6GB~MlQH+bCzPQqOWANId6NRp5gfn=l5s_seR!C8R z2U(HOQA9}E?M{A903F$E|H1-A)?;8+A3ud!-l zhKD1P3t|$H5SIpBSVBFaa3v*z5|4Ery*fbQ3eO#1Rs7^hcUA!J=?WoGQlcFQp)oa=Wv!Re&0C~dgOa__){q&5wJ;eI=01HrgM&E_ zKC&0B@8rI_c6|WAL{XmSIYLQ{siL(-uVow?ue1M}P0Y?zaf^#M?l_0Mj1;P+E18YJ%4qIt4N~I&s9lD<`<` z&M$G%|YWPLQs0o^M8AdAN}kp$|&NR(c!6GXZi(k9Cxj?2xHJepn!d|Ret{H zBW#=7^r3deqsNcqy(dW$>h(IeU3CRYDSq?X>s))`1?)Nv^1ZOOl4)&FrtjktiJqC{ z>P=JcOP&=4-7KSY{eB972TC9Z-aWp|jaOgEwi`ad_IvK84fKHPF5imOnobC3ZbB2; zZd|DZZH-WXM!fd`^zxjnC^)jT#Paeo^Os&qiJ&%E$E`yIz*nn$kNS~vBlFS7Zu`KLJ6cHu-tC*$c`QC`1MXgk}y}V@zckD$WZW9hlY4B zZ8hQZ_kMkSW%sKh0WSnWO44w4Crp!MfMqMWcjpsKPfzi^U;Tm>fy0ee4jo+JpyvRex@!AP5Lj(su65078f~ieqdXqfe$B z+rLEnl~;K3okh}>6CB<97NW?QEK+7hM>zUUlXu_P&D)J8N@`-Qh@>P^idd@tT%DRr zQs)U$(kb29oKR#@rNY2Km1Fx3u-IB*dG;cvixL^dOwWIeElGvjKl>T3zu`t+c>XzB za~ENp!|J|Bq!h7Ir;U1b0f!DBVWo5g?;kiLz#TVTcNo|P@anFO<#$F}eS{Lv-3tP!zWkyy=%}eIbX?cOFiS9-IeP{`jos+R4R`%x8+;h he^36=o$&uA{sm(o>AXNIK%M{q002ovPDHLkV1jZQptt}4 literal 0 HcmV?d00001 diff --git a/img/trayicon.png b/img/trayicon.png new file mode 100644 index 0000000000000000000000000000000000000000..cac2e3f96e3052ed38dbcda082a6860b4170ca5c GIT binary patch literal 764 zcmVPx#24YJ`L;(K){{a7>y{D4^000SaNLh0L01FcU01FcV0GgZ_00007bV*G`2iXc4 z6fQbQU_8M900MkTL_t(I%f*vBOjBVPhM&`(|NQ6lw6vgrMNkk0D!R#FqE2d}j>OU1 zppiv`gW}*Vad2?K(aFTb1SS*XB|3Q@G%j8P7=bF-0=DJUwtsuhse?gGU^MX?zkGS# zeD9kV{`Y9hEr;$tXr7+>+T6Lmy`@sAv?x_<%4Ks+lgVUU1cH%s0|Q$YZgqg0L&ML# zvTDs{vrSGW!~4gNk($n{ccTQoDj{K3W09D)Yi&1=9^K3REv5rFd1v$OYu6*)8#-Cl z5GP){5>uMkDwCDaPoXr0ibrDh$j8BoW%*?Y>c6wl zN@hSJiay&eALGiYE#0CacfyvYyds^b`+_8gcEx?y~hp1r?H4MtWN741k zdDTTg$hOtwhtJhP$I-^OZ>1v=W&4?PRDF-GmNiJjpx(BrGbNHLx@j<7Qr;hcF7y#4 zz2aQv+rv-aQ~ilxaHD8zr&bCgLJ$*z;o)Is(kad!ImG=Z&u|>);__YS>t9Fa#~!M_ uhVO&tgYSVMzz0+rBK8EgZru4NZTtmKZvSlml*RA>0000 + + img/trayicon.png + img/logo.png + + diff --git a/src/common/qkeysequencewidget/CMakeLists.txt b/src/common/qkeysequencewidget/CMakeLists.txt new file mode 100644 index 0000000..389fbf4 --- /dev/null +++ b/src/common/qkeysequencewidget/CMakeLists.txt @@ -0,0 +1,31 @@ +cmake_minimum_required(VERSION 2.8.11) + +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) diff --git a/src/common/qkeysequencewidget/img/delete_32.png b/src/common/qkeysequencewidget/img/delete_32.png new file mode 100644 index 0000000000000000000000000000000000000000..4f1cde2ff830df6e9fc69e253394cce4dc2fedee GIT binary patch literal 4479 zcmV-_5rFQAP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-5DT&Z2n+x)QHX^p z00esgV8|mQcmRZ%02D^@S3L16t`O%c004NIvOKvYIYoh62rY33S640`D9%Y2D-rV&neh&#Q1i z007~1e$oCcFS8neI|hJl{-P!B1ZZ9hpmq0)X0i`JwE&>$+E?>%_LC6RbVIkUx0b+_+BaR3cnT7Zv!AJxW zizFb)h!jyGOOZ85F;a?DAXP{m@;!0_IfqH8(HlgRxt7s3}k3K`kFu>>-2Q$QMFfPW!La{h336o>X zu_CMttHv6zR;&ZNiS=X8v3CR#fknUxHUxJ0uoBa_M6WNWeqIg~6QE69c9o#eyhGvpiOA@W-aonk<7r1(?fC{oI5N*U!4 zfg=2N-7=cNnjjOr{yriy6mMFgG#l znCF=fnQv8CDz++o6_Lscl}eQ+l^ZHARH>?_s@|##Rr6KLRFA1%Q+=*RRWnoLsR`7U zt5vFIcfW3@?wFpwUVxrVZ>QdQz32KIeJ}k~{cZZE^+ya? z2D1z#2HOnI7(B%_ac?{wFUQ;QQA1tBKtrWrm0_3Rgps+?Jfqb{jYbcQX~taRB;#$y zZN{S}1|}gUOHJxc?wV3fxuz+mJ4`!F$IZ;mqRrNsHJd##*D~ju=bP7?-?v~|cv>vB zsJ6IeNwVZxrdjT`yl#bBIa#GxRa#xMMy;K#CDyyGyQdMSxlWT#tDe?p!?5wT$+oGt z8L;Kp2HUQ-ZMJ=3XJQv;x5ci*?vuTfeY$;({XGW_huIFR9a(?@3)XSs8O^N5RyOM=TTmp(3=8^+zpz2r)C z^>JO{deZfso3oq3?Wo(Y?l$ge?uXo;%ru`Vo>?<<(8I_>;8Eq#KMS9gFl*neeosSB zfoHYnBQIkwkyowPu(zdms`p{<7e4kra-ZWq<2*OsGTvEV%s0Td$hXT+!*8Bnh2KMe zBmZRodjHV?r+_5^X9J0WL4jKW`}lf%A-|44I@@LTvf1rHjG(ze6+w@Jt%Bvjts!X0 z?2xS?_ve_-kiKB_KiJlZ$9G`c^=E@oNG)mWWaNo-3TIW8)$Hg0Ub-~8?KhvJ>$ z3*&nim@mj(aCxE5!t{lw7O5^0EIO7zOo&c6l<+|iDySBWCGrz@C5{St!X3hAA}`T4 z(TLbXTq+(;@<=L8dXnssyft|w#WSTW<++3>sgS%(4NTpeI-VAqb|7ssJvzNHgOZVu zaYCvgO_R1~>SyL=cFU|~g|hy|Zi}}s9+d~lYqOB71z9Z$wnC=pR9Yz4DhIM>Wmjgu z&56o6maCpC&F##y%G;1PobR9i?GnNg;gYtchD%p19a!eQtZF&3JaKv33gZ<8D~47E ztUS1iwkmDaPpj=$m#%)jCVEY4fnLGNg2A-`YwHVD3gv};>)hAvT~AmqS>Lr``i7kw zJ{5_It`yrBmlc25DBO7E8;5VoznR>Ww5hAaxn$2~(q`%A-YuS64wkBy=9dm`4cXeX z4c}I@?e+FW+b@^RDBHV(wnMq2zdX3SWv9u`%{xC-q*U}&`cyXV(%rRT*Z6MH?i+i& z_B8C(+grT%{XWUQ+f@NoP1R=AW&26{v-dx)iK^-Nmiuj8txj!m?Z*Ss1N{dh4z}01 z)YTo*JycSU)+_5r4#yw9{+;i4Ee$peRgIj+;v;ZGdF1K$3E%e~4LaI(jC-u%2h$&R z9cLXcYC@Xwnns&bn)_Q~Te?roKGD|d-g^8;+aC{{G(1^(O7m37Y1-+6)01cN&y1aw zoqc{T`P^XJqPBbIW6s}d4{z_f5Om?vMgNQEJG?v2T=KYd^0M3I6IZxbny)%vZR&LD zJpPl@Psh8QyPB@KTx+@RdcC!KX7}kEo;S|j^u2lU7XQ}Oo;f|;z4Ll+_r>@1-xl3| zawq-H%e&ckC+@AhPrP6BKT#_XdT7&;F71j}Joy zkC~6lh7E@6o;W@^IpRNZ{ptLtL(gQ-CY~4mqW;US7Zxvm_|@yz&e53Bp_lTPlfP|z zrTyx_>lv@x#=^!PzR7qqF<$gm`|ZJZ+;<)Cqu&ot2z=0000WV@Og>004R=004l4008;_004mL004C`008P>0026e000+nl3&F} z000K6Nklo46FujgqCc)b%BkyF3<=q$#RLToM+K_kV-ZA9mDhqm z-&z0u>!h211uu!&_ev zzIb8u7z2QFL?Zf5@1=93n;+u#_t4=(rkj7E_tH6nfW$c>LohS+F(#Z!6a<#^UOq>< z`Dff{4;}52&hVBvC(+|c9{{LIgpl;kzCwESZ@AGOm=zlh_eif^q<8jZL`YPr=mgr! zM;fXUNr}I95jT1W2BzSKd!*Mc(mVSKB9=In=&&kC*3Z01dgC%~w2P@>3g(S)!#&a) zm+75(5g;)mQUg_CG?@MbNO~oHuvg$sEBv6ue+z@;Nd^qkTi0q}ss+?jJlrL{b)B`- zr%@vjhy9XH(bSo2ulN+)hzeB`MxaKPCbO+dC8H8Wu0LTOa&qH+%Gz-wwI- zYNyhHD{;F-vCy<=k_E|$XPTJI)WSF>hG zXb7sp{#5$&O^xsDq*W|cF;!IY?`51R@@AH>#kiI+-!3-ap9X!?B1DCTfU2Q7(*Y0i zQahRi{l%8WTie-eF*QR?QE!m?F;h@ynA0k0Rk^dBv)HnDGzt1<-bn?g!q?s%6nzt~ zgeo&5)K4CagZ|RIzIJCPN3Ec#%xo=Oz??V8%o|o1dwa*xp4WIV4*F_BsTo>33%>r| z09P8IR?wq93}w5y)ymCe=J6~X=DjzoLSlx_<_R~qS_i1slKLvK_{Q(|N(0Pq>OC~L zKM13v9haP3sR>HCQC(zIeZMl~f77qDvkO8<8`?l?T`78DM6tA9anr{UGWrx@2v|RTR6L zw=<=zhs7tMH>$`JWogO z0!Eg)*Y_!(RP$PM`AI3`y+7~;N0T_;hXmMVXUUzC{3XWNP@w8&b zWLUX#%{i1aW6_9sEKFsDhcJHZT@(OgSB zGh;f=Q8kVpF|OWU;_A*4M;8s3D^qWTsU6UWqObJ26OPPjvOfu)ybsK`ELmS37YusU zE6S}9do^P^$#J=ItPTIzUSd26;_)hn7B=rKF-?Q`%j?tkT21RuGKn|uwK>)X=Zd*zwc}WgEOSgJ zIm^xb@cTfTN&N9vo0HuDGe~Dfz+^u|opQ1paOG~BGz;Qp!}>SxwNf>q*|2_^NqpsQ zi8rQ`tjGgX@?6QLj^iESF(VQ?S&5Fr=U75?|ixaAG+CgXtt^@+c>pI*;#Q%8$aZ`bK#Fo2$if{K1(OKu{%; zfaLk!fUO6vD5KSokM49(B@P1m2kzmugSWig1_8;b&&69GgfDa+9{etN|I7+v<>iA& z0!yCn4FR}xyMr0ANU^zzd2Il(ngQZ(3`&Gp^40aj@c`fb;{)n9jTX=Z=79yE@%E|C zx1a5V=K*dE+)saVd-SJ^+d2jukk^_3p*uGy zq_&O|zj@hOenA7+XiMX>q2;xl(ON6VLyrv)#N*&&wM|q1u7H!L{dxZ10RZSe-|4B{ RFAD$w002ovPDHLkV1nU5e*FLd literal 0 HcmV?d00001 diff --git a/src/common/qkeysequencewidget/qkeysequencewidget.pri b/src/common/qkeysequencewidget/qkeysequencewidget.pri new file mode 100644 index 0000000..da8adbc --- /dev/null +++ b/src/common/qkeysequencewidget/qkeysequencewidget.pri @@ -0,0 +1,7 @@ +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 \ No newline at end of file diff --git a/src/common/qkeysequencewidget/qkeysequencewidget.qrc b/src/common/qkeysequencewidget/qkeysequencewidget.qrc new file mode 100644 index 0000000..497bd2f --- /dev/null +++ b/src/common/qkeysequencewidget/qkeysequencewidget.qrc @@ -0,0 +1,5 @@ + + + img/delete_32.png + + diff --git a/src/common/qkeysequencewidget/src/qkeysequencewidget.cpp b/src/common/qkeysequencewidget/src/qkeysequencewidget.cpp new file mode 100644 index 0000000..55f0679 --- /dev/null +++ b/src/common/qkeysequencewidget/src/qkeysequencewidget.cpp @@ -0,0 +1,578 @@ +/****************************************************************************** +Copyright (c) 2010, Artem Galichkin +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 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 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 +#include +#include + +#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(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(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(); + } +} diff --git a/src/common/qkeysequencewidget/src/qkeysequencewidget.h b/src/common/qkeysequencewidget/src/qkeysequencewidget.h new file mode 100644 index 0000000..1bdb7ce --- /dev/null +++ b/src/common/qkeysequencewidget/src/qkeysequencewidget.h @@ -0,0 +1,127 @@ +/****************************************************************************** +Copyright (c) 2010, Artem Galichkin +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 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 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 +#include + +#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 diff --git a/src/common/qkeysequencewidget/src/qkeysequencewidget_p.h b/src/common/qkeysequencewidget/src/qkeysequencewidget_p.h new file mode 100644 index 0000000..b788237 --- /dev/null +++ b/src/common/qkeysequencewidget/src/qkeysequencewidget_p.h @@ -0,0 +1,120 @@ +/****************************************************************************** +Copyright (c) 2010, Artem Galichkin +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 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 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 +#include +#include +#include +#include +#include +#include + +#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 diff --git a/src/core/config.cpp b/src/core/config.cpp new file mode 100644 index 0000000..a23ac58 --- /dev/null +++ b/src/core/config.cpp @@ -0,0 +1,535 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include "src/core/config.h" +#include "core.h" + +#include +#include +#include +#include +#include +#include +#include + +#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" + +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); +} + +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()); + _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->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); + 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; +} diff --git a/src/core/config.h b/src/core/config.h new file mode 100644 index 0000000..b9f4828 --- /dev/null +++ b/src/core/config.h @@ -0,0 +1,260 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef CONFIG_H +#define CONFIG_H + +#include "shortcutmanager.h" + +#include +#include +#include +#include +#include +#include + +// 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 = 1; + +// 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); + + 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 _confData; + + ShortcutManager *_shortcuts; + + QVector _imageFormats; + + int _scrNum; // screen num in session + QDateTime _dateLastSaving; +}; + +#endif // CONFIG_H diff --git a/src/core/core.cpp b/src/core/core.cpp new file mode 100644 index 0000000..5fa4588 --- /dev/null +++ b/src/core/core.cpp @@ -0,0 +1,548 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "core/core.h" +#include + +#ifdef SG_EXT_UPLOADS +#include "modules/uploader/moduleuploader.h" +#endif + +Core* Core::corePtr = 0; + +Core::Core() +{ + qRegisterMetaType("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 screens = qApp->screens(); + const QDesktopWidget *desktop = QApplication::desktop(); + const int screenNum = desktop->screenNumber(QCursor::pos()); + *_pixelMap = screens[screenNum]->grabWindow(desktop->winId()); + + 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!")); + _wnd->showTrayMessage(message.header, message.message); + } + } +} + +void Core::getActiveWindow() +{ + const QList 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()); +} + +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(); + _wnd->showTrayMessage(message.header, message.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::copyScreen() +{ + QApplication::clipboard()->setPixmap(*_pixelMap, QClipboard::Clipboard); + StateNotifyMessage message(tr("Copied"), tr("Screenshot is copied to clipboard")); + _wnd->showTrayMessage(message.header, message.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(_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::getScreen() +{ + 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(); +} diff --git a/src/core/core.h b/src/core/core.h new file mode 100644 index 0000000..d606d5c --- /dev/null +++ b/src/core/core.h @@ -0,0 +1,142 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ +#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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +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 getScreen(); + + 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(); + + bool checkExsistFile(QString path); + QString copyFileNameToCliipboard(QString file); + 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 _screenTypeOpts; + +private Q_SLOTS: + void regionGrabbed(bool grabbed); + void closeExtViewer(int exitCode, QProcess::ExitStatus exitStatus); + +}; + +#endif // SCREENGRAB_H diff --git a/src/core/main.cpp b/src/core/main.cpp new file mode 100644 index 0000000..24a533c --- /dev/null +++ b/src/core/main.cpp @@ -0,0 +1,45 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include "singleapp.h" +#include "core/core.h" +#include "ui/mainwindow.h" + +#include + +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(); +} diff --git a/src/core/modulemanager.cpp b/src/core/modulemanager.cpp new file mode 100644 index 0000000..b2273b3 --- /dev/null +++ b/src/core/modulemanager.cpp @@ -0,0 +1,120 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#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 + +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 ModuleManager::generateModulesMenus(QStringList modules) +{ + QList 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 ModuleManager::generateModulesActions(QStringList modules) +{ + QList 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(); +} diff --git a/src/core/modulemanager.h b/src/core/modulemanager.h new file mode 100644 index 0000000..b11c6bc --- /dev/null +++ b/src/core/modulemanager.h @@ -0,0 +1,53 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef MODULEMANAGER_H +#define MODULEMANAGER_H + +#include "modules/abstractmodule.h" + +#include +#include +#include +#include + +#include + +const QByteArray MOD_UPLOADER = "uploader"; +const QByteArray MOD_EXT_EDIT = "extedit"; + +typedef QMap ModuleList_t; + +class ModuleManager +{ +public: + ModuleManager(); + void initModules(); + AbstractModule* getModule(const QByteArray& name); + AbstractModule* getModule(const quint8 numid); + QList generateModulesMenus(QStringList modules = QStringList()); + QList generateModulesActions(QStringList modules = QStringList()); + quint8 count(); + +private: + ModuleList_t *_modules; +}; + +#endif // MODULEMANAGER_H diff --git a/src/core/regionselect.cpp b/src/core/regionselect.cpp new file mode 100644 index 0000000..f7d94e7 --- /dev/null +++ b/src/core/regionselect.cpp @@ -0,0 +1,231 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include "src/core/regionselect.h" + +#include +#include +#include + +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 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(); +} diff --git a/src/core/regionselect.h b/src/core/regionselect.h new file mode 100644 index 0000000..7baf17e --- /dev/null +++ b/src/core/regionselect.h @@ -0,0 +1,77 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef REGIONSELECT_H +#define REGIONSELECT_H + +#include "config.h" + +//#include +#include + +#include +#include +#include +#include +#include + +// 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 diff --git a/src/core/shortcutmanager.cpp b/src/core/shortcutmanager.cpp new file mode 100644 index 0000000..437c99a --- /dev/null +++ b/src/core/shortcutmanager.cpp @@ -0,0 +1,149 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#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; +} diff --git a/src/core/shortcutmanager.h b/src/core/shortcutmanager.h new file mode 100644 index 0000000..e4adef8 --- /dev/null +++ b/src/core/shortcutmanager.h @@ -0,0 +1,66 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef SHORTCUTMANAGER_H +#define SHORTCUTMANAGER_H + +#include +#include +#include +#include + +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 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 diff --git a/src/core/singleapp.cpp b/src/core/singleapp.cpp new file mode 100644 index 0000000..ed60db0 --- /dev/null +++ b/src/core/singleapp.cpp @@ -0,0 +1,105 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include +#include + +#include +#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; +} diff --git a/src/core/singleapp.h b/src/core/singleapp.h new file mode 100644 index 0000000..3a6ed13 --- /dev/null +++ b/src/core/singleapp.h @@ -0,0 +1,52 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef SINGLEAPP_H +#define SINGLEAPP_H + +#include +#include +#include + +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 diff --git a/src/core/ui/about.cpp b/src/core/ui/about.cpp new file mode 100644 index 0000000..f3ee334 --- /dev/null +++ b/src/core/ui/about.cpp @@ -0,0 +1,188 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include "about.h" +#include "ui_aboutwidget.h" + +#include "../core.h" +#include + +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(" ") + qApp->applicationVersion() + QString("")); + + 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 += "ScreenGrab "; + str += tr("is a crossplatform application for fast creating screenshots of your desktop."); + str += "

"; + 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 += "

"; + + str += tr("E-Mail")+" - "; + str += "
doomer3d@gmail.com"; + str += "
"; + str += tr("Web site")+" - "; + str += "http://screengrab.doomer.org/"; + str += "

"; + + str += tr("Licensed under the "); + str += " GPL v2"; + str += "

"; + + 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 += "

"; + + str += tr("What you can do?"); + + str += "
    "; + str += "
  • " + tr("Translate ScreenGrab to other languages") + "
  • "; + str += "
  • " + tr("Make suggestions for next releases") + "
  • "; + str += "
  • " + tr("Report bugs and issues") + "
  • "; + str += "
"; + + str += tr("E-Mail"); + str += "
"; + str += "mailto:doomer3d@gmail.com"; + str += "

"; + str += tr("Bug tracker"); + str += "
"; + str += "https://github.com/DOOMer/screengrab/issues/"; + + return str; +} + +QString AboutDialog::tabThanks() +{ + QString str; + str += "" + tr("Translate:") + ""; + str += "
"; + str += tr(" Brazilian Portuguese translation") + "
"; + str += tr("Marcio Moraes") + " <marciopanto@gmail.com>
"; + str += "
"; + str += tr(" Ukrainian translation") + "
"; + str += tr("Gennadi Motsyo") + " <drool@altlinux.ru>
"; + str += "
"; + str += tr(" Spanish translation") + "
"; + str += tr("Burjans L García D") + " <burjans@gmail.com>
"; + str += "
"; + str += tr(" Italian translation") + "
"; + str += "speps <dreamspepser@yahoo.it>
"; + str += "
"; + + str += "" + tr("Testing:") + ""; + str += "
"; + str += "Jerome Leclanche - " + tr("Dual monitor support and other in Linux") + "
"; + str += "Alexander Sokolov - " + tr("Dual monitor support in Linux") + "
"; + str += "Alexantia - " + tr("win32-build [Windows XP and 7]") + "
"; + str += "iNight - " + tr("old win32-build [Windows Vista]") + "
"; + str += "burjans - " + tr("win32-build [Windows 7]") + "
"; + + return str; +} + +void AboutDialog::on_txtArea_anchorClicked(QUrl url) +{ + QDesktopServices::openUrl(url); +} diff --git a/src/core/ui/about.h b/src/core/ui/about.h new file mode 100644 index 0000000..8aa641b --- /dev/null +++ b/src/core/ui/about.h @@ -0,0 +1,57 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef ABOUT_H +#define ABOUT_H + +#include +#include +#include + + +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 diff --git a/src/core/ui/aboutwidget.ui b/src/core/ui/aboutwidget.ui new file mode 100644 index 0000000..d6c17e2 --- /dev/null +++ b/src/core/ui/aboutwidget.ui @@ -0,0 +1,167 @@ + + + aboutWidget + + + + 0 + 0 + 559 + 314 + + + + + 0 + 0 + + + + + 559 + 314 + + + + + 16777215 + 16777215 + + + + About ScreenGrab + + + + QLayout::SetDefaultConstraint + + + + + + + + 0 + 0 + + + + QFrame::Plain + + + + + + :/res/img/logo.png + + + + + + + + + <b>ScreenGrab</b> + + + Qt::AlignCenter + + + + + + + + + + Qt::AlignCenter + + + + + + + + + + Qt::AlignCenter + + + + + + + + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + false + + + false + + + + + + + + + + + + + 112 + 0 + + + + About Qt + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 112 + 0 + + + + Close + + + + + + + + + + + + + diff --git a/src/core/ui/configwidget.cpp b/src/core/ui/configwidget.cpp new file mode 100644 index 0000000..ccc38f2 --- /dev/null +++ b/src/core/ui/configwidget.cpp @@ -0,0 +1,521 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include + +#include "configwidget.h" +#include "ui_configwidget.h" +#include "../core.h" + +#ifdef SG_GLOBAL_SHORTCUTS +#include +#endif + +#include +#include +#include +#include +#include + +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()); + + // integration tab + _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->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(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(); +} diff --git a/src/core/ui/configwidget.h b/src/core/ui/configwidget.h new file mode 100644 index 0000000..5c9ff5f --- /dev/null +++ b/src/core/ui/configwidget.h @@ -0,0 +1,81 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef CONFIGWIDGET_H +#define CONFIGWIDGET_H + +#include "../config.h" + +#include +#include +#include +#include +#include + +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 diff --git a/src/core/ui/configwidget.ui b/src/core/ui/configwidget.ui new file mode 100644 index 0000000..8cc8133 --- /dev/null +++ b/src/core/ui/configwidget.ui @@ -0,0 +1,836 @@ + + + configwidget + + + + 0 + 0 + 554 + 278 + + + + + 0 + 0 + + + + + 16777215 + 16777215 + + + + Options + + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + 160 + 16777215 + + + + + 32 + 32 + + + + Qt::ElideNone + + + QListView::TopToBottom + + + false + + + QListView::Adjust + + + QListView::ListMode + + + false + + + true + + + + Main + + + + + Advanced + + + + + System tray + + + + + Shortcuts + + + + + + + + + 0 + 0 + + + + 3 + + + + + 0 + + + 0 + + + 0 + + + + + 1 + + + + Saving + + + + + + 4 + + + 0 + + + + + Default save directory: + + + + + + + + + Path to default selection dir for saving + + + + + + + + 112 + 0 + + + + Browse filesystem + + + Browse + + + + + + + + + + + 0 + + + + + + + Default filename: + + + + + + + Default filename + + + + + + + + + + + Format + + + + + + + + 112 + 0 + + + + Default saving image format + + + + + + + + + + + 4 + + + + + Copy file name to the clipboard when saving + + + + + + + + 0 + 0 + + + + + Do not copy + + + + + Copy file name only + + + + + Copy full file path + + + + + + + + + + Qt::Vertical + + + + 20 + 82 + + + + + + + + + Screenshot + + + + + + + + Delay: + + + + + + + Default delay before grabbing screen + + + false + + + sec + + + + + + 90 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + No window decoration + + + + + + + + + Image quality + + + + + + + + + Image quality (1 - small file, 100 - high quality) + + + 100 + + + 1 + + + Qt::Horizontal + + + + + + + Current + + + Qt::AlignCenter + + + + + + + + + Zoom area around mouse in selection mode + + + + + + + Qt::Vertical + + + + 20 + 117 + + + + + + + + + + + + + + 0 + + + 0 + + + 0 + + + + + 16 + + + + + + + Inserting current date time into saved filename + + + Insert current date and time in file name + + + + + + + + + Template: + + + + + + + + 0 + 0 + + + + + 256 + 0 + + + + + + + + + + Example: + + + Qt::AlignCenter + + + + + + + Automatically saving screenshots in grabbing process + + + Autosave screenshot + + + + + + + 16 + + + + + Save first screenshot + + + + + + + + + Allow run multiplies copy of ScreenGrab + + + Allow multiple instances of ScreenGrab + + + + + + + Open in external viewer on double click + + + Enable external viewer + + + + + + + Qt::Vertical + + + + 20 + 66 + + + + + + + + + + 0 + + + 0 + + + 0 + + + + + + + Show ScreenGrab in the system tray + + + + + + + + + Tray messages: + + + + + + + + 0 + 0 + + + + Tray messages display mode + + + + Never + + + + + Tray mode + + + + + Always + + + + + + + + + + + + Time of display tray messages + + + Qt::PlainText + + + + + + + + 0 + 0 + + + + Time to display tray messages + + + sec + + + 1 + + + 10 + + + 5 + + + + + + + + + Minimize to tray on click close button + + + Minimize to tray when closing + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + 0 + + + 0 + + + 0 + + + + + QAbstractItemView::NoEditTriggers + + + + Action + + + + + Shortcut + + + + + Global shortcuts + + + + + + + Fill screen + + + + + Active window + + + + + Area select + + + + + + Local shortcuts + + + + New screen + + + + + Save screen + + + + + Copy screen + + + + + Options + + + + + Help + + + + + Quit + + + + + + + + + + + Selected shortcut: + + + + + + + Not defined + + + + + + + + + + + + + + + + + + 112 + 0 + + + + Restore default settings + + + Defaults + + + + + + + Qt::Horizontal + + + + 88 + 20 + + + + + + + + + 112 + 0 + + + + Save settings + + + Save + + + + + + + + 112 + 0 + + + + Discard changes + + + Cancel + + + + + + + + + + QKeySequenceWidget + QWidget +
qkeysequencewidget.h
+
+
+ + butSaveOpt + butCancel + + + +
diff --git a/src/core/ui/mainwindow.cpp b/src/core/ui/mainwindow.cpp new file mode 100644 index 0000000..f67af6b --- /dev/null +++ b/src/core/ui/mainwindow.cpp @@ -0,0 +1,560 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include "mainwindow.h" +#include "ui_mainwindow.h" +#include "../core.h" +#include "../shortcutmanager.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +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); + _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); + + 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 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 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); +} + +// updating UI from configdata +void MainWindow::updateUI() +{ + _ui->cbxTypeScr->setCurrentIndex(_conf->getTypeScreen()); + _ui->delayBox->setValue(_conf->getDelay()); + + 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 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::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 diff --git a/src/core/ui/mainwindow.h b/src/core/ui/mainwindow.h new file mode 100644 index 0000000..64feb8b --- /dev/null +++ b/src/core/ui/mainwindow.h @@ -0,0 +1,118 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include + +#include "about.h" +#include "configwidget.h" + +#ifdef SG_GLOBAL_SHORTCUTS +#include +#endif + +#include +#include +#include +#include +#include +#include +#include + +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 list); + void updateModulesenus(QList 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 _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 updateUI(); + void trayClick(QSystemTrayIcon::ActivationReason reason); + +#ifdef SG_GLOBAL_SHORTCUTS + void globalShortcutActivate(int type); + void globalShortcutBlock(bool state); +#endif +}; + +#endif // MAINWINDOW_H diff --git a/src/core/ui/mainwindow.ui b/src/core/ui/mainwindow.ui new file mode 100644 index 0000000..8228725 --- /dev/null +++ b/src/core/ui/mainwindow.ui @@ -0,0 +1,229 @@ + + + MainWindow + + + + 0 + 0 + 480 + 299 + + + + + 480 + 299 + + + + ScreenGrab + + + + + 0 + 0 + + + + Qt::RightToLeft + + + + QLayout::SetMaximumSize + + + + + + 0 + 0 + + + + + 450 + 190 + + + + QFrame::StyledPanel + + + QFrame::Sunken + + + + + + Qt::AlignCenter + + + + + + + + 0 + 0 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Qt::Horizontal + + + + 40 + 13 + + + + + + + + true + + + Type of screenshot + + + 0 + + + + Full screen + + + + + Window + + + + + Screen area + + + + + Previous selection + + + + + + + + + 0 + 0 + + + + Qt::LeftToRight + + + Type: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + Delay in seconds before taking screenshot + + + sec + + + 90 + + + + + + + + 0 + 0 + + + + Delay + + + + + + + Qt::Horizontal + + + + 40 + 13 + + + + + + + + + + + + + 0 + 0 + + + + toolBar + + + false + + + TopToolBarArea + + + false + + + + + + diff --git a/src/modules/abstractmodule.h b/src/modules/abstractmodule.h new file mode 100644 index 0000000..e75771b --- /dev/null +++ b/src/modules/abstractmodule.h @@ -0,0 +1,45 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef ABSTRACTMODULE_H +#define ABSTRACTMODULE_H + +#include +#include +#include +#include + +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 diff --git a/src/modules/extedit/CMakeLists.txt b/src/modules/extedit/CMakeLists.txt new file mode 100644 index 0000000..5d26626 --- /dev/null +++ b/src/modules/extedit/CMakeLists.txt @@ -0,0 +1,37 @@ +cmake_minimum_required(VERSION 2.8.11) + +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 ${QTXDG_LIBRARIES}) diff --git a/src/modules/extedit/extedit.cpp b/src/modules/extedit/extedit.cpp new file mode 100644 index 0000000..dcdac7b --- /dev/null +++ b/src/modules/extedit/extedit.cpp @@ -0,0 +1,95 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include "extedit.h" +#include "core/core.h" + +#include +#include + +ExtEdit::ExtEdit(QObject *parent) : + QObject(parent), _watcherEditedFile(new QFileSystemWatcher(this)) +{ + createAppList(); + _fileIsChanged = false; + connect(_watcherEditedFile, &QFileSystemWatcher::fileChanged, this, &ExtEdit::editedFileChanged); +} + +QList ExtEdit::getActions() +{ + return _actionList; +} + +void ExtEdit::runExternalEditor() +{ + XdgAction *action = static_cast(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); +} diff --git a/src/modules/extedit/extedit.h b/src/modules/extedit/extedit.h new file mode 100644 index 0000000..e2c666c --- /dev/null +++ b/src/modules/extedit/extedit.h @@ -0,0 +1,55 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef EXTEDIT_H +#define EXTEDIT_H + +#include +#include +#include +#include +#include +#include + +class ExtEdit : public QObject +{ + Q_OBJECT +public: + explicit ExtEdit(QObject *parent = 0); + QList 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 _appList; + QList _actionList; + QString _editFilename; + bool _fileIsChanged; + QFileSystemWatcher *_watcherEditedFile; +}; + +#endif // EXTEDIT_H diff --git a/src/modules/extedit/moduleextedit.cpp b/src/modules/extedit/moduleextedit.cpp new file mode 100644 index 0000000..054d36a --- /dev/null +++ b/src/modules/extedit/moduleextedit.cpp @@ -0,0 +1,79 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include "moduleextedit.h" + +#include + +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 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; +} diff --git a/src/modules/extedit/moduleextedit.h b/src/modules/extedit/moduleextedit.h new file mode 100644 index 0000000..cefae82 --- /dev/null +++ b/src/modules/extedit/moduleextedit.h @@ -0,0 +1,45 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef MODULEEXTEDIT_H +#define MODULEEXTEDIT_H + +#include "modules/abstractmodule.h" + +#include "extedit.h" +#include + +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 diff --git a/src/modules/uploader/CMakeLists.txt b/src/modules/uploader/CMakeLists.txt new file mode 100644 index 0000000..d2f3a96 --- /dev/null +++ b/src/modules/uploader/CMakeLists.txt @@ -0,0 +1,53 @@ +cmake_minimum_required(VERSION 2.8.11) + +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) diff --git a/src/modules/uploader/dialoguploader.cpp b/src/modules/uploader/dialoguploader.cpp new file mode 100644 index 0000000..cd727e3 --- /dev/null +++ b/src/modules/uploader/dialoguploader.cpp @@ -0,0 +1,264 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#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 + +#include +#include + +#include + +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 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())); +} diff --git a/src/modules/uploader/dialoguploader.h b/src/modules/uploader/dialoguploader.h new file mode 100644 index 0000000..33c7fc7 --- /dev/null +++ b/src/modules/uploader/dialoguploader.h @@ -0,0 +1,66 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef DIALOGUPLOADER_H +#define DIALOGUPLOADER_H + +#include "uploader.h" + +#include + +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 diff --git a/src/modules/uploader/dialoguploader.ui b/src/modules/uploader/dialoguploader.ui new file mode 100644 index 0000000..0b06346 --- /dev/null +++ b/src/modules/uploader/dialoguploader.ui @@ -0,0 +1,339 @@ + + + DialogUploader + + + + 0 + 0 + 841 + 340 + + + + Upload to internet + + + + + + + + Upload to + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + + + + + + QFrame::Panel + + + QFrame::Raised + + + + + + Qt::AlignCenter + + + + + + + + + + Qt::AlignCenter + + + + + + + + + 0 + + + + + + + Direct link: + + + + + + + + + true + + + + + + + + 112 + 0 + + + + Open this link in the default web-browser + + + Open + + + + + + + + 112 + 0 + + + + Copy this link to the clipboard + + + Copy + + + + + + + + + + + Extended preformed html or bb codes: + + + + + + + + + + + + + + true + + + + + + + + 112 + 0 + + + + Copy this link to the clipboard + + + Copy + + + + + + + + + Link to delete image: + + + + + + + + + true + + + + + + + + 112 + 0 + + + + Open this link in the default web-browser + + + Open + + + + + + + + + Qt::Vertical + + + + 20 + 34 + + + + + + labDirectLink + labDeleteLink + + + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 96 + 20 + + + + + + + + + + TextLabel + + + Qt::AlignCenter + + + + + + + 24 + + + + + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 96 + 20 + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 112 + 0 + + + + Upload + + + + + + + + 112 + 0 + + + + Cancel + + + + + + + Qt::Horizontal + + + QSizePolicy::Minimum + + + + 12 + 20 + + + + + + + + + + + diff --git a/src/modules/uploader/imgur/uploader_imgur.cpp b/src/modules/uploader/imgur/uploader_imgur.cpp new file mode 100644 index 0000000..17ef49c --- /dev/null +++ b/src/modules/uploader/imgur/uploader_imgur.cpp @@ -0,0 +1,105 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include "uploader_imgur.h" + +#include + +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 listXmlNodes; + listXmlNodes << "original" << "imgur_page" << "large_thumbnail" << "small_square" << "delete_page"; + + QMap replyXmlMap = parseResultStrings(listXmlNodes, replyXmalText); + + _uploadedStrings[UL_DIRECT_LINK].first = replyXmlMap["original"]; + _uploadedStrings[UL_HTML_CODE].first = ""; + _uploadedStrings[UL_BB_CODE].first = "[img]" + replyXmlMap["original"] +"[/img]"; + _uploadedStrings[UL_HTML_CODE_THUMB].first = ""; + _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(); +} diff --git a/src/modules/uploader/imgur/uploader_imgur.h b/src/modules/uploader/imgur/uploader_imgur.h new file mode 100644 index 0000000..85a152b --- /dev/null +++ b/src/modules/uploader/imgur/uploader_imgur.h @@ -0,0 +1,56 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef UPLOADER_IMGUR_H +#define UPLOADER_IMGUR_H + +#include + +#include + +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 + diff --git a/src/modules/uploader/imgur/uploader_imgur_widget.cpp b/src/modules/uploader/imgur/uploader_imgur_widget.cpp new file mode 100644 index 0000000..8be1832 --- /dev/null +++ b/src/modules/uploader/imgur/uploader_imgur_widget.cpp @@ -0,0 +1,46 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#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; + } +} diff --git a/src/modules/uploader/imgur/uploader_imgur_widget.h b/src/modules/uploader/imgur/uploader_imgur_widget.h new file mode 100644 index 0000000..f3e39b1 --- /dev/null +++ b/src/modules/uploader/imgur/uploader_imgur_widget.h @@ -0,0 +1,46 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef UPLOADER_IMGUR_WIDGET_H +#define UPLOADER_IMGUR_WIDGET_H + +#include +#include + +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 diff --git a/src/modules/uploader/imgur/uploader_imgur_widget.ui b/src/modules/uploader/imgur/uploader_imgur_widget.ui new file mode 100644 index 0000000..b002ada --- /dev/null +++ b/src/modules/uploader/imgur/uploader_imgur_widget.ui @@ -0,0 +1,44 @@ + + + Uploader_ImgUr_Widget + + + + 0 + 0 + 470 + 222 + + + + Upload to imgur.com + + + + + + Upload to ImgUr.com + + + Qt::AlignCenter + + + + + + + Qt::Vertical + + + + 20 + 183 + + + + + + + + + diff --git a/src/modules/uploader/imgur/uploaderconfigwidget_imgur.cpp b/src/modules/uploader/imgur/uploaderconfigwidget_imgur.cpp new file mode 100644 index 0000000..4242f2f --- /dev/null +++ b/src/modules/uploader/imgur/uploaderconfigwidget_imgur.cpp @@ -0,0 +1,65 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include "uploaderconfigwidget_imgur.h" +#include "ui_uploaderconfigwidget_imgur.h" + +#include "uploaderconfig.h" + +#include + +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; + } +} diff --git a/src/modules/uploader/imgur/uploaderconfigwidget_imgur.h b/src/modules/uploader/imgur/uploaderconfigwidget_imgur.h new file mode 100644 index 0000000..8a5d59f --- /dev/null +++ b/src/modules/uploader/imgur/uploaderconfigwidget_imgur.h @@ -0,0 +1,48 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef UPLOADERCONFIGWIDGET_IMGUR_H +#define UPLOADERCONFIGWIDGET_IMGUR_H + +#include + +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 diff --git a/src/modules/uploader/imgur/uploaderconfigwidget_imgur.ui b/src/modules/uploader/imgur/uploaderconfigwidget_imgur.ui new file mode 100644 index 0000000..90ceca9 --- /dev/null +++ b/src/modules/uploader/imgur/uploaderconfigwidget_imgur.ui @@ -0,0 +1,67 @@ + + + UploaderConfigWidget_ImgUr + + + + 0 + 0 + 320 + 249 + + + + Configuration for imgur.com + + + + + + Configuration for imgur.com upload + + + Qt::AlignCenter + + + + + + + Qt::Vertical + + + + 20 + 88 + + + + + + + + Now is nothing yet + + + Qt::AlignCenter + + + + + + + Qt::Vertical + + + + 20 + 87 + + + + + + + + + diff --git a/src/modules/uploader/mediacrush/uploader_mediacrush.cpp b/src/modules/uploader/mediacrush/uploader_mediacrush.cpp new file mode 100644 index 0000000..daebc39 --- /dev/null +++ b/src/modules/uploader/mediacrush/uploader_mediacrush.cpp @@ -0,0 +1,134 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include "uploader_mediacrush.h" + +#include +#include +#include + +#include + +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() +{ + return QUrl("https://mediacru.sh/api/upload/file"); +} + +/*! + * 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()); + } +} diff --git a/src/modules/uploader/mediacrush/uploader_mediacrush.h b/src/modules/uploader/mediacrush/uploader_mediacrush.h new file mode 100644 index 0000000..322d6aa --- /dev/null +++ b/src/modules/uploader/mediacrush/uploader_mediacrush.h @@ -0,0 +1,53 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef UPLOADER_MEDIACRUSH_H +#define UPLOADER_MEDIACRUSH_H + +#include + +#include + +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 + diff --git a/src/modules/uploader/mediacrush/uploader_mediacrush_widget.cpp b/src/modules/uploader/mediacrush/uploader_mediacrush_widget.cpp new file mode 100644 index 0000000..bf3ca44 --- /dev/null +++ b/src/modules/uploader/mediacrush/uploader_mediacrush_widget.cpp @@ -0,0 +1,14 @@ +#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; +} diff --git a/src/modules/uploader/mediacrush/uploader_mediacrush_widget.h b/src/modules/uploader/mediacrush/uploader_mediacrush_widget.h new file mode 100644 index 0000000..eb57c7c --- /dev/null +++ b/src/modules/uploader/mediacrush/uploader_mediacrush_widget.h @@ -0,0 +1,22 @@ +#ifndef UPLOADER_MEDIACRUSH_WIDGET_H +#define UPLOADER_MEDIACRUSH_WIDGET_H + +#include + +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 diff --git a/src/modules/uploader/mediacrush/uploader_mediacrush_widget.ui b/src/modules/uploader/mediacrush/uploader_mediacrush_widget.ui new file mode 100644 index 0000000..68767fe --- /dev/null +++ b/src/modules/uploader/mediacrush/uploader_mediacrush_widget.ui @@ -0,0 +1,44 @@ + + + Uploader_MediaCrush_Widget + + + + 0 + 0 + 417 + 203 + + + + Form + + + + + + Upload to MediaCrush + + + Qt::AlignCenter + + + + + + + Qt::Vertical + + + + 20 + 168 + + + + + + + + + diff --git a/src/modules/uploader/mediacrush/uploaderconfigwidget_mediacrush.cpp b/src/modules/uploader/mediacrush/uploaderconfigwidget_mediacrush.cpp new file mode 100644 index 0000000..0621441 --- /dev/null +++ b/src/modules/uploader/mediacrush/uploaderconfigwidget_mediacrush.cpp @@ -0,0 +1,14 @@ +#include "uploaderconfigwidget_mediacrush.h" +#include "ui_uploaderconfigwidget_mediacrush.h" + +UploaderConfigWidget_MediaCrush::UploaderConfigWidget_MediaCrush(QWidget *parent) : + QWidget(parent), + ui(new Ui::UploaderConfigWidget_MediaCrush) +{ + ui->setupUi(this); +} + +UploaderConfigWidget_MediaCrush::~UploaderConfigWidget_MediaCrush() +{ + delete ui; +} diff --git a/src/modules/uploader/mediacrush/uploaderconfigwidget_mediacrush.h b/src/modules/uploader/mediacrush/uploaderconfigwidget_mediacrush.h new file mode 100644 index 0000000..9fe701d --- /dev/null +++ b/src/modules/uploader/mediacrush/uploaderconfigwidget_mediacrush.h @@ -0,0 +1,22 @@ +#ifndef UPLOADERCONFIGWIDGET_MEDIACRUSH_H +#define UPLOADERCONFIGWIDGET_MEDIACRUSH_H + +#include + +namespace Ui { +class UploaderConfigWidget_MediaCrush; +} + +class UploaderConfigWidget_MediaCrush : public QWidget +{ + Q_OBJECT + +public: + explicit UploaderConfigWidget_MediaCrush(QWidget *parent = 0); + ~UploaderConfigWidget_MediaCrush(); + +private: + Ui::UploaderConfigWidget_MediaCrush *ui; +}; + +#endif // UPLOADERCONFIGWIDGET_MEDIACRUSH_H diff --git a/src/modules/uploader/mediacrush/uploaderconfigwidget_mediacrush.ui b/src/modules/uploader/mediacrush/uploaderconfigwidget_mediacrush.ui new file mode 100644 index 0000000..03e6839 --- /dev/null +++ b/src/modules/uploader/mediacrush/uploaderconfigwidget_mediacrush.ui @@ -0,0 +1,67 @@ + + + UploaderConfigWidget_MediaCrush + + + + 0 + 0 + 320 + 240 + + + + Form + + + + + + Configuration for mediacru.sh upload + + + Qt::AlignCenter + + + + + + + Qt::Vertical + + + + 20 + 87 + + + + + + + + Now is nothing yet + + + Qt::AlignCenter + + + + + + + Qt::Vertical + + + + 20 + 87 + + + + + + + + + diff --git a/src/modules/uploader/moduleuploader.cpp b/src/modules/uploader/moduleuploader.cpp new file mode 100644 index 0000000..1c7ddec --- /dev/null +++ b/src/modules/uploader/moduleuploader.cpp @@ -0,0 +1,132 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#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 +#include +#include +#include + +#include + +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(); +} diff --git a/src/modules/uploader/moduleuploader.h b/src/modules/uploader/moduleuploader.h new file mode 100644 index 0000000..9a7ac29 --- /dev/null +++ b/src/modules/uploader/moduleuploader.h @@ -0,0 +1,56 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef MODULEUPLOADER_H +#define MODULEUPLOADER_H + +#include "modules/abstractmodule.h" + +#include +#include +#include + +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 diff --git a/src/modules/uploader/uploader.cpp b/src/modules/uploader/uploader.cpp new file mode 100644 index 0000000..f000ea6 --- /dev/null +++ b/src/modules/uploader/uploader.cpp @@ -0,0 +1,244 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include "uploader.h" +#include "core/core.h" +#include "uploaderconfig.h" + +#include +#include +#include + +#include + +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 Uploader::parsedLinksToGui() +{ + QList 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->getScreen(); + } + else + { + imageData = core->getScreen().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 Uploader::parseResultStrings(const QVector< QByteArray >& keytags, const QByteArray& result) +{ + QMap 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(""); //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("",""); + + // 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); +} diff --git a/src/modules/uploader/uploader.h b/src/modules/uploader/uploader.h new file mode 100644 index 0000000..666c64c --- /dev/null +++ b/src/modules/uploader/uploader.h @@ -0,0 +1,93 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef UPLOADER_H +#define UPLOADER_H + +#include +#include +#include +#include +#include +#include +#include +#include + +typedef QPair 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 parsedLinks(); + QList 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 parseResultStrings(const QVector& 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 _uploadedStrings; + QVariantMap _userSettings; + QNetworkAccessManager *_net; + QNetworkRequest _request; + QNetworkReply *_serverReply; + +private: + void initUploadedStrList(); +}; + +#endif // UPLOADER_H diff --git a/src/modules/uploader/uploaderconfig.cpp b/src/modules/uploader/uploaderconfig.cpp new file mode 100644 index 0000000..fe3bd3c --- /dev/null +++ b/src/modules/uploader/uploaderconfig.cpp @@ -0,0 +1,124 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include "uploaderconfig.h" +#include "core/config.h" + +#include + +#include +#include + +// common defaults +#define DEF_AUTO_COPY_RESULT_LIMK false +#define DEF_DEFAULT_HOST "MediaCrush" + +QStringList UploaderConfig::_labelsList = QStringList() << "MediaCrush" << "Imgur"; + +UploaderConfig::UploaderConfig() +{ + QString configFile = Config::getConfigDir() + QDir::separator() + "uploader.conf"; + _settings = new QSettings(configFile, QSettings::IniFormat); + _groupsList << "mediacru.sh" << "imgur.com"; +} + +UploaderConfig::~UploaderConfig() +{ + delete _settings; +} + +QStringList UploaderConfig::labelsList() +{ + return _labelsList; +} + +QVariantMap UploaderConfig::loadSettings(const QByteArray& group, QVariantMap& mapValues) +{ + QVariantMap map; + + _settings->beginGroup(group); + + QVariant defValue, iterValue; + QVariantMap::iterator iter = mapValues.begin(); + while(iter != mapValues.end()) + { + defValue = iter.value(); + iterValue = _settings->value(iter.key(), defValue); + map.insert(iter.key(), iterValue); + ++iter; + } + + _settings->endGroup(); + + return map; +} + +QVariant UploaderConfig::loadSingleParam(const QByteArray& group, const QByteArray& param) +{ + QVariant var; + + _settings->beginGroup(group); + var = _settings->value(param); + _settings->endGroup(); + + return var; +} + + +void UploaderConfig::saveSettings(const QByteArray& group, QVariantMap& mapValues) +{ + _settings->beginGroup(group); + + QVariantMap::iterator iter = mapValues.begin(); + while(iter != mapValues.end()) + { + _settings->setValue(iter.key(), iter.value()); + ++iter; + } + + _settings->endGroup(); +} + +void UploaderConfig::defaultSettings() +{ + _settings->beginGroup("common"); + _settings->setValue(KEY_AUTO_COPY_RESULT_LIMK, DEF_AUTO_COPY_RESULT_LIMK); + _settings->setValue(KEY_DEFAULT_HOST, DEF_DEFAULT_HOST); + _settings->endGroup(); + + // imgur.com settings + _settings->beginGroup(_groupsList[0]); + _settings->endGroup(); +} + +bool UploaderConfig::autoCopyResultLink() +{ + _settings->beginGroup("common"); + bool ret = _settings->value(KEY_AUTO_COPY_RESULT_LIMK, DEF_AUTO_COPY_RESULT_LIMK).toBool(); + _settings->endGroup(); + + return ret; +} + + +bool UploaderConfig::checkExistsConfigFile() const +{ + return QFile::exists(_settings->fileName()); +} diff --git a/src/modules/uploader/uploaderconfig.h b/src/modules/uploader/uploaderconfig.h new file mode 100644 index 0000000..9d074d6 --- /dev/null +++ b/src/modules/uploader/uploaderconfig.h @@ -0,0 +1,56 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef UPLOADERCONFIG_H +#define UPLOADERCONFIG_H + +#include +#include +#include +#include + +// Uploader config file common keys +#define KEY_AUTO_COPY_RESULT_LIMK "autoCopyDirectLink" +#define KEY_DEFAULT_HOST "defaultHost" + +class UploaderConfig +{ + +public: + UploaderConfig(); + ~UploaderConfig(); + + static QStringList labelsList(); + + QVariantMap loadSettings(const QByteArray& group, QVariantMap& mapValues); + QVariant loadSingleParam(const QByteArray& group, const QByteArray& param); + void saveSettings(const QByteArray& group, QVariantMap& mapValues); + void defaultSettings(); + bool checkExistsConfigFile() const; + bool autoCopyResultLink(); + +private: + QSettings *_settings; + + QStringList _groupsList; + static QStringList _labelsList; +}; + +#endif // UPLOADERCONFIG_H diff --git a/src/modules/uploader/uploaderconfigwidget.cpp b/src/modules/uploader/uploaderconfigwidget.cpp new file mode 100644 index 0000000..33dac20 --- /dev/null +++ b/src/modules/uploader/uploaderconfigwidget.cpp @@ -0,0 +1,115 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#include "uploaderconfigwidget.h" +#include "ui_uploaderconfigwidget.h" + +#include "uploaderconfig.h" + +#include + +#include + + +UploaderConfigWidget::UploaderConfigWidget(QWidget *parent) : + QWidget(parent), + _ui(new Ui::UploaderConfigWidget) +{ + _ui->setupUi(this); + + _ui->settings->setCurrentWidget(_ui->commonSettings); + + QStringList hosts = UploaderConfig::labelsList(); + _ui->cbxHosts->addItems(hosts); + _ui->cbxDefaultHost->addItems(hosts); + + loadSettings(); + + _crush = new UploaderConfigWidget_MediaCrush(this); + _imgur = new UploaderConfigWidget_ImgUr(this); + + _ui->stackedHosts->addWidget(_crush); + _ui->stackedHosts->addWidget(_imgur); + + void (QComboBox::*hostChanged)(int) = &QComboBox::currentIndexChanged; + connect(_ui->cbxHosts, hostChanged, _ui->stackedHosts, &QStackedWidget::setCurrentIndex); +} + +UploaderConfigWidget::~UploaderConfigWidget() +{ + delete _ui; +} + +void UploaderConfigWidget::loadSettings() +{ + qDebug() << "load uploder common settings"; + + UploaderConfig config; + QVariantMap loadValues; + loadValues.insert("autoCopyDirectLink", QVariant(false)); + loadValues.insert(KEY_DEFAULT_HOST, ""); + loadValues = config.loadSettings("common", loadValues); + + QString defaultHost = loadValues[KEY_DEFAULT_HOST].toString(); + if (defaultHost.isEmpty() == true) + { + _ui->cbxDefaultHost->setCurrentIndex(0); + } + else + { + qint8 index = config.labelsList().indexOf(defaultHost); + + if (index == -1) + { + index++; + } + + _ui->cbxDefaultHost->setCurrentIndex(index); + } + + _ui->checkAutoCopyMainLink->setChecked(loadValues["autoCopyDirectLink"].toBool()); +} + +void UploaderConfigWidget::saveSettings() +{ + UploaderConfig config; + QVariantMap savingValues; + savingValues.insert(KEY_AUTO_COPY_RESULT_LIMK, _ui->checkAutoCopyMainLink->isChecked()); + + QString defaultHost = config.labelsList().at(_ui->cbxDefaultHost->currentIndex()); + savingValues.insert(KEY_DEFAULT_HOST, defaultHost); + + config.saveSettings("common", savingValues); + + QMetaObject::invokeMethod(_imgur, "saveSettings"); + +} + +void UploaderConfigWidget::changeEvent(QEvent *e) +{ + QWidget::changeEvent(e); + switch (e->type()) { + case QEvent::LanguageChange: + _ui->retranslateUi(this); + break; + default: + break; + } +} diff --git a/src/modules/uploader/uploaderconfigwidget.h b/src/modules/uploader/uploaderconfigwidget.h new file mode 100644 index 0000000..aea00c8 --- /dev/null +++ b/src/modules/uploader/uploaderconfigwidget.h @@ -0,0 +1,56 @@ +/*************************************************************************** + * 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, write to the * + * Free Software Foundation, Inc., * + * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + ***************************************************************************/ + +#ifndef UPLOADERCONFIGWIDGET_H +#define UPLOADERCONFIGWIDGET_H + +#include + +#include "imgur/uploaderconfigwidget_imgur.h" +#include "mediacrush/uploaderconfigwidget_mediacrush.h" + +namespace Ui { +class UploaderConfigWidget; +} + +class UploaderConfigWidget : public QWidget +{ + Q_OBJECT + +public: + explicit UploaderConfigWidget(QWidget *parent = 0); + ~UploaderConfigWidget(); + +public Q_SLOTS: + void loadSettings(); + void saveSettings(); + +protected: + void changeEvent(QEvent *e); + +private: + Ui::UploaderConfigWidget *_ui; + + // services widgets + UploaderConfigWidget_MediaCrush *_crush; + UploaderConfigWidget_ImgUr *_imgur; +}; + +#endif // UPLOADERCONFIGWIDGET_H diff --git a/src/modules/uploader/uploaderconfigwidget.ui b/src/modules/uploader/uploaderconfigwidget.ui new file mode 100644 index 0000000..2d73cf7 --- /dev/null +++ b/src/modules/uploader/uploaderconfigwidget.ui @@ -0,0 +1,96 @@ + + + UploaderConfigWidget + + + + 0 + 0 + 586 + 290 + + + + Uploader configuration + + + + + + 0 + + + + Common settings + + + + + + + + Default image host + + + + + + + + + + + + Always copy the link to the clipboard + + + + + + + Qt::Vertical + + + + 20 + 165 + + + + + + + + + Hosts settings + + + + + + + + Settings for: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + + + + + + + + + + diff --git a/translations/extedit.ts b/translations/extedit.ts new file mode 100644 index 0000000..ff9fc3f --- /dev/null +++ b/translations/extedit.ts @@ -0,0 +1,17 @@ + + + + + QObject + + + External edit + + + + + Edit in... + + + + diff --git a/translations/screengrab.ts b/translations/screengrab.ts new file mode 100644 index 0000000..3c0ca26 --- /dev/null +++ b/translations/screengrab.ts @@ -0,0 +1,768 @@ + + + + + AboutDialog + + + built on + + + + + using Qt + + + + + About + + + + + Thanks + + + + + Help us + + + + + is a crossplatform application for fast creating screenshots of your desktop. + + + + + 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. + + + + + + E-Mail + + + + + Web site + + + + + Licensed under the + + + + + Copyright &copy; 2009-2013, Artem 'DOOMer' Galichkin + + + + + You can join us and help us if you want. This is an invitation if you like this application. + + + + + What you can do? + + + + + Translate ScreenGrab to other languages + + + + + Make suggestions for next releases + + + + + Report bugs and issues + + + + + Bug tracker + + + + + Translate: + + + + + Brazilian Portuguese translation + + + + + Marcio Moraes + + + + + Ukrainian translation + + + + + Gennadi Motsyo + + + + + Spanish translation + + + + + Burjans L García D + + + + + Italian translation + + + + + Testing: + + + + + Dual monitor support and other in Linux + + + + + Dual monitor support in Linux + + + + + win32-build [Windows XP and 7] + + + + + old win32-build [Windows Vista] + + + + + win32-build [Windows 7] + + + + + ConfigDialog + + + Directory %1 does not exist. Do you want to create it? + + + + + + Warning + + + + + Select directory + + + + + Do you want to reset the settings to the defaults? + + + + + None + + + + + Example: + + + + + This key is already used in your system! Please select another. + + + + + This key is already used in ScreenGrab! Please select another. + + + + + This key is not supported on your system! + + + + + Error + + + + + Core + + + New screen + + + + + New screen is getted! + + + + + Saved + + + + + Saved to + + + + + Name of saved file is copied to the clipboard + + + + + Path to saved file is copied to the clipboard + + + + + Copied + + + + + Screenshot is copied to clipboard + + + + + MainWindow + + + ScreenGrab + + + + + Type: + + + + + Type of screenshot + + + + + Full screen + + + + + Window + + + + + Screen area + + + + + Previous selection + + + + + Delay + + + + + Delay in seconds before taking screenshot + + + + + sec + + + + + toolBar + + + + + New + + + + + Save + + + + + Copy + + + + + Options + + + + + + Help + + + + + About + + + + + Quit + + + + + Screenshot + + + + + Double click for open screenshot in external default image viewer + + + + + + + Hide + + + + + None + + + + + Show + + + + + PNG Files + + + + + JPEG Files + + + + + BMP Files + + + + + Save As... + + + + + QApplication + + + Use your mouse to draw a rectangle to screenshot or exit pressing +any key or using the right or middle mouse buttons. + + + + + %1 x %2 pixels + + + + + aboutWidget + + + About Qt + + + + + Close + + + + + configwidget + + + + Options + + + + + Main + + + + + Advanced + + + + + System tray + + + + + Shortcuts + + + + + Saving + + + + + Default save directory: + + + + + Path to default selection dir for saving + + + + + Browse filesystem + + + + + Browse + + + + + Default filename: + + + + + Default filename + + + + + Format + + + + + Default saving image format + + + + + Copy file name to the clipboard when saving + + + + + Do not copy + + + + + Copy file name only + + + + + Copy full file path + + + + + Screenshot + + + + + Delay: + + + + + Default delay before grabbing screen + + + + + + sec + + + + + No window decoration + + + + + Image quality + + + + + Image quality (1 - small file, 100 - high quality) + + + + + Zoom area around mouse in selection mode + + + + + Inserting current date time into saved filename + + + + + Insert current date and time in file name + + + + + Template: + + + + + Example: + + + + + Automatically saving screenshots in grabbing process + + + + + Autosave screenshot + + + + + Save first screenshot + + + + + Allow run multiplies copy of ScreenGrab + + + + + Allow multiple instances of ScreenGrab + + + + + Open in external viewer on double click + + + + + Enable external viewer + + + + + Show ScreenGrab in the system tray + + + + + Tray messages: + + + + + Tray messages display mode + + + + + Never + + + + + Tray mode + + + + + Always + + + + + Time of display tray messages + + + + + Time to display tray messages + + + + + Minimize to tray on click close button + + + + + Minimize to tray when closing + + + + + Action + + + + + Shortcut + + + + + Global shortcuts + + + + + Fill screen + + + + + Active window + + + + + Area select + + + + + Local shortcuts + + + + + New screen + + + + + Save screen + + + + + Copy screen + + + + + Help + + + + + Quit + + + + + Selected shortcut: + + + + + Not defined + + + + + Restore default settings + + + + + Defaults + + + + + Save settings + + + + + Save + + + + + Discard changes + + + + + Cancel + + + + diff --git a/translations/screengrab_de.desktop b/translations/screengrab_de.desktop new file mode 100644 index 0000000..cbd3306 --- /dev/null +++ b/translations/screengrab_de.desktop @@ -0,0 +1,3 @@ +# Translations +Comment[de]=Bildschirmfotos aufnehmen und mit anderen teilen +GenericName[de]=Anwendung für Bildschirmfotos diff --git a/translations/screengrab_de_DE.ts b/translations/screengrab_de_DE.ts new file mode 100644 index 0000000..94644f1 --- /dev/null +++ b/translations/screengrab_de_DE.ts @@ -0,0 +1,1048 @@ + + + + + AboutDialog + + + built on + erstellt + + + + using Qt + mit Qt + + + + About + Über + + + + Thanks + Dank an + + + + Licensed under the + Lizensiert unter + + + + + E-Mail + E-Mail + + + + Help us + Unterstützen Sie uns + + + + Web site + Webseite + + + + Copyright &copy; 2009-2013, Artem 'DOOMer' Galichkin + Copyright &copy; 2009-2013, Artem 'DOOMer' Galichkin + + + + What you can do? + Was können Sie tun? + + + + is a crossplatform application for fast creating screenshots of your desktop. + ist eine plattformunabhängige Anwendung, um Bildschirmfotos aufzunehmen. + + + + 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. + ScreenGrab ist eine einfache, aber leistungsstarke Anwendung, die auf die Qt-Bibliotheken aufsetzt. Daher kann sie unter Windows und Linux genutzt werden. + + + + You can join us and help us if you want. This is an invitation if you like this application. + Sie können sich anschließen und mithelfen, wenn Sie wollen. Dies ist eine Einladung dazu, wenn Sie ScreenGrab mögen. + + + + Translate ScreenGrab to other languages + Übersetzen Sie ScreenGrab in andere Sprachen + + + + Make suggestions for next releases + Machen Sie Verbesserungsvorschläge für nächste Versionen + + + + Report bugs and issues + Melden Sie Problem und Fehler + + + + Bug tracker + Bug-Tracker + + + + Translate: + Übersetzung: + + + + Brazilian Portuguese translation + Portugiesisch-Brasilianische Übersetzung + + + + Marcio Moraes + Marcio Moraes + + + + Ukrainian translation + Ukrainische Übersetzung + + + + Gennadi Motsyo + Gennadi Motsyo + + + + Spanish translation + Spanische Übersetzung + + + + Burjans L García D + + + + Burjans L García D + Burjans L García D + + + + Italian translation + Italienische Übersetzung + + + + Testing: + Tester: + + + + Dual monitor support and other in Linux + Dual-Monitor Unterstützung unter Linux und anderes + + + + Dual monitor support in Linux + Dual-Monitor Unterstützung unter Linux + + + + win32-build [Windows XP and 7] + win32-build [Windows XP and 7] + + + + old win32-build [Windows Vista] + Vorheriger win32-build [Windows Vista] + + + + win32-build [Windows 7] + win32-build [Windows 7] + + + + ConfigDialog + + + Select directory + Ordner wählen + + + + + Warning + Warnung + + + + Directory %1 does not exist. Do you want to create it? + Der Ordner %1 existiert nicht. Möchten Sie ihn erstellen? + + + + Do you want to reset the settings to the defaults? + Möchten Sie die Standardeinstellungen wieder herstellen? + + + + None + Keine + + + + Example: + Beispiel: + + + + This key is already used in your system! Please select another. + Diese Tastenkombination ist bereits von Ihrem System belegt! Bitte wählen Sie eine andere. + + + + This key is already used in ScreenGrab! Please select another. + Diese Tastenkombination wird bereits von ScreenGrab verwendet! Bitte wählen Sie eine andere. + + + + This key is not supported on your system! + Diese Tastenkombination wird von Ihrem System nicht unterstützt! + + + + Error + Fehler + + + + Core + + + New screen + Neues Foto + + + + New screen is getted! + Ein neues Foto wird aufgenommen! + + + + Saved + Gespeichert + + + + Name of saved file is copied to the clipboard + Der Name der gespeicherten Datei wird in die Zwischenablage kopiert + + + + Copied + Kopiert + + + + Saved to + Gespeichert nach + + + + Path to saved file is copied to the clipboard + Der Pfad zur gespeicherten Datei wird in die Zwischenablage kopiert + + + + Screenshot is copied to clipboard + Das Bildschirmfoto wird in die Zwischenablage kopiert + + + + DialogUploader + + Upload to internet + Ins Internet hochladen + + + Upload to + Hochladen nach + + + Direct link: + Direkter Link: + + + Open this link in the default web-browser + Diesen Link im Standard-Browser öffnen + + + Open + Öffnen + + + Copy this link to the clipboard + Diesen Link in die Zwischenablage kopieren + + + Copy + Kopieren + + + Extended preformed html or bb codes: + Erweiterte vorgeformte HTML- oder BB-Codes: + + + Link to delete image: + Link, um das Bild zu löschen: + + + Upload + Hochladen + + + Cancel + Abbrechen + + + Close + Schließen + + + Size: + Größe: + + + pixel + Pixel + + + Uploaded + Hochgeladen + + + Ready to upload + Bereit zum Hochladen + + + Upload processing... Please wait + Das Hochladen wird bearbeitet...bitte warten + + + Open this link in your default web-browser, it may directly delete your uploaded image, without any warnings. + Öffnen Sie diesen Link in Ihrem Standard-Web-Browser, so kann Ihr hochgeladenes Bild ohne jede Warnung gelöscht werden. + + + Receiving a response from the server + Antwort vom Server erhalten + + + Upload completed + Hochladen abgeschlossen + + + Error uploading screenshot + Beim Hochladen ist ein Fehler aufgetreten + + + Error + Fehler + + + Are you sure you want to continue? + Möchten Sie wirklich fortfahren? + + + + MainWindow + + + ScreenGrab + ScreenGrab + + + + Type: + Aufnahme: + + + + Type of screenshot + Art des Bildschirmfotos + + + + Full screen + Vollbild + + + + Window + Aktives Fenster + + + + Screen area + Bildschirm-Bereich + + + + Previous selection + Vorige Auswahl + + + + toolBar + + + + Getting new screenshot + Erstelle neues Bildschirmfoto + + + New Screen + Neues Foto + + + Ctrl+N + Strg+N + + + + Delay + Verzögerung + + + + Delay in seconds before taking screenshot + Aufnahme-Verzögerung in Sekunden + + + + sec + Sek + + + Save current screenshot into graphical file + Aktuelles Bildschirmfoto in Datei speichern + + + Save Screen + Foto speichern + + + Ctrl+S + Strg+S + + + Copy current screenshot into clipboard + Aktuelles Bildschirmfoto in die Zwischenablage kopieren + + + Copy Screen + Bildschirmfoto kopieren + + + Ctrl+C + Strg+C + + + Options dialog + Optionen-Dialog + + + + Options + Optionen + + + Ctrl+O + Strg+O + + + Show help information + Hilfe anzeigen + + + + + Help + Hilfe + + + F1 + F1 + + + Exit from ScreenGrab + ScreenGrab beenden + + + Ctrl+Q + Strg+Q + + + + Quit + Beenden + + + + Save + Speichern + + + + New + Neu + + + + Copy + Kopieren + + + + + + Hide + Verbergen + + + + About + Über + + + + Screenshot + Bildschirmfoto + + + + Double click for open screenshot in external default image viewer + Doppelklicken, um das Bildschirmfoto in einem externen Bildbetrachter zu öffnen + + + + None + Keine + + + + Show + Anzeigen + + + + PNG Files + PNG-Dateien + + + + JPEG Files + JPEG-Dateien + + + + BMP Files + BMP-Dateien + + + + Save As... + Speichern als... + + + + ModuleUploader + + Uploading + Hochladen + + + + QApplication + + + Use your mouse to draw a rectangle to screenshot or exit pressing +any key or using the right or middle mouse buttons. + Markieren Sie mit der Maus einen rechteckigen Ausschnitt oder beenden Sie den Vorgang, +indem Sie die <Esc>-Taste oder die mittlere Maustaste drücken. + + + + %1 x %2 pixels + %1 x %2 Pixel + + + + QObject + + External edit + Externer Editor + + + Edit in... + Bearbeiten in... + + + Upload + Hochladen + + + + Uploader + + Direct link + Direkter Link + + + HTML code + HTML-Code + + + BB code + BB-Code + + + HTML code with thumb image + HTML-Code mit Miniaturansicht + + + BB code with thumb image + BB-Code mit Miniaturansicht + + + URl to delete image + URI für das Löschen des Bildes + + + + UploaderConfigWidget + + Common settings + Allgemein + + + Default image host + Standard-Service + + + Always copy the link to the clipboard + Immer den Link in die Zwischenablage kopieren + + + Hosts settings + Host-Einstellungen + + + Settings for: + Einstellungen für: + + + + UploaderConfigWidget_ImgUr + + Configuration for imgur.com upload + Konfiguration für <imgur.com> + + + Now is nothing yet + Keine Konfiguration vorhanden + + + + UploaderConfigWidget_MediaCrush + + Form + Formular + + + Configuration for mediacru.sh upload + Konfiguration für <mediacru.sh> + + + Now is nothing yet + Keine Konfiguration vorhanden + + + + Uploader_ImgUr_Widget + + Upload to ImgUr.com + Nach <ImgUr.com> hochladen + + + + Uploader_MediaCrush_Widget + + Form + Formular + + + Upload to MediaCrush + Nach <MediaCrush> hochladen + + + + aboutWidget + + + About Qt + Über Qt + + + + Close + Schließen + + + + configwidget + + + + Options + Optionen + + + + Default saving image format + Standard-Bildformat + + + + Default delay before grabbing screen + Standard-Verzögerung vor der Aufnahme + + + + Inserting current date time into saved filename + Aktuelles Datum und Uhrzeit in den Dateinamen einfügen + + + + Insert current date and time in file name + Aktuelles Datum und Uhrzeit in den Dateinamen einfügen + + + + Autosave screenshot + Foto automatisch speichern + + + + Save first screenshot + Erstes Foto speichern + + + + Image quality + Bildqualität + + + + Image quality (1 - small file, 100 - high quality) + Bildqualität (1 - kleine Datei, 100 - hohe Qualität) + + + + Allow run multiplies copy of ScreenGrab + Mehrere Instanzen von ScreenGrab zulassen + + + + Enable external viewer + Externen Bildbetrachter aktivieren + + + + Show ScreenGrab in the system tray + Screengrab im Systemtray anzeigen + + + + Minimize to tray on click close button + Beim Schließen in den Systemtray minimieren + + + + Minimize to tray when closing + Beim Beenden in den Systemtray minimieren + + + + Action + Aktion + + + + Global shortcuts + Globale Tastenkombinationen + + + + Fill screen + Bildschirmfoto ausfüllen + + + + Active window + Aktives Fenster + + + + Area select + Bereich wählen + + + + Local shortcuts + Lokale Tastenkombinationen + + + + New screen + Neues Bildschirmfoto + + + + Save screen + Bildschirmfoto speichern + + + + Copy screen + Bildschirmfoto kopieren + + + + Help + Hilfe + + + Exit + Beenden + + + + Not defined + Nicht definiert + + + + Restore default settings + Standard-Einstellungen wieder herstellen + + + + Defaults + Standardwerte + + + + Save settings + Einstellungen speichern + + + + Save + Speichern + + + + Discard changes + Änderungen verwerfen + + + + Cancel + Abbrechen + + + + Main + Allgemein + + + + System tray + Systemtray + + + + Saving + Speichere + + + + Default save directory: + Standard-Speicherordner: + + + + Path to default selection dir for saving + Pfad zum Standard-Speicherordner + + + + Browse filesystem + Dateisystem durchsuchen + + + + Browse + Durchsuchen + + + + Default filename: + Standard-Dateiname: + + + + Default filename + Standard-Dateiname + + + + Format + Format + + + + Copy file name to the clipboard when saving + Dateinamen beim Speichern in die Zwischenablage kopieren + + + + Do not copy + Nicht kopieren + + + + Copy file name only + Nur den Dateinamen kopieren + + + + Copy full file path + Den vollständigen Dateipfad kopieren + + + + Screenshot + Bildschirmfoto + + + + Delay: + Verzögerung: + + + + + sec + Sek + + + + No window decoration + Keine Fensterdekoration + + + + Advanced + Erweitert + + + + Template: + Vorlage: + + + + Example: + Beispiel: + + + + Automatically saving screenshots in grabbing process + Fotos während der Aufnahme automatisch speichern + + + + Tray messages: + Symbolleisten-Meldungen: + + + + Tray messages display mode + Meldungen in der Symbolleiste anzeigen + + + + Never + Keine + + + + Tray mode + Systemtray-Modus + + + + Always + Immer + + + + Time of display tray messages + Anzeigedauer in der Symbolleiste + + + + Time to display tray messages + Anzeigedauer der Symbolleisten-Meldungen + + + + Shortcuts + Tastenkombinationen + + + + Allow multiple instances of ScreenGrab + Mehrere Instanzen von ScreenGrab zulassen + + + + Open in external viewer on double click + Bei Doppel-Klick in externem Bildbetrachter öffnen + + + + Shortcut + Tastenkombination + + + + Quit + Beenden + + + + Selected shortcut: + Ausgewählte Tastenkombination: + + + + Zoom area around mouse in selection mode + Bereich um den Mauszeiger beim Auswählen vergrößern + + + diff --git a/translations/screengrab_es_ES.ts b/translations/screengrab_es_ES.ts new file mode 100644 index 0000000..639f65e --- /dev/null +++ b/translations/screengrab_es_ES.ts @@ -0,0 +1,874 @@ + + + + + AboutDialog + + + built on + construído en + + + + using Qt + usando Qt + + + + About + Acerca + + + + Thanks + Agradecimientos + + + + Licensed under the + Licencia bajo la + + + + Help us + + + + + + E-Mail + Correo E + + + + Web site + + + + + Copyright &copy; 2009-2013, Artem 'DOOMer' Galichkin + Copyright &copy; 2009-2012, Artem 'DOOMer' Galichkin {2009-2013,?} + + + + What you can do? + + + + + is a crossplatform application for fast creating screenshots of your desktop. + + + + + 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. + + + + + You can join us and help us if you want. This is an invitation if you like this application. + + + + + Translate ScreenGrab to other languages + + + + + Make suggestions for next releases + + + + + Report bugs and issues + + + + + Bug tracker + + + + + Translate: + Traducciones: + + + + Brazilian Portuguese translation + Brasil - Portugués + + + + Marcio Moraes + Marcio Moraes + + + + Ukrainian translation + Ucraniano + + + + Gennadi Motsyo + Gennadi Motsyo + + + + Spanish translation + + + + + Burjans L García D + + + + + Italian translation + + + + + Testing: + Pruebas: + + + + Dual monitor support and other in Linux + + + + + Dual monitor support in Linux + + + + + win32-build [Windows XP and 7] + + + + + old win32-build [Windows Vista] + + + + + win32-build [Windows 7] + + + + + ConfigDialog + + + Select directory + Selecciona el directorio + + + + + Warning + Cuidado + + + + Directory %1 does not exist. Do you want to create it? + + + + + Do you want to reset the settings to the defaults? + + + + + None + No + + + + Example: + Ejemplo: + + + + This key is already used in your system! Please select another. + + + + + This key is already used in ScreenGrab! Please select another. + + + + + This key is not supported on your system! + Esta tecla nos es admitida en su sistema! + + + + Error + Error + + + + Core + + + New screen + Nueva captura + + + + New screen is getted! + Nueva captura obtenida + + + + Saved + Guardado + + + + Name of saved file is copied to the clipboard + + + + + Copied + Copiado + + + + Saved to + + + + + Path to saved file is copied to the clipboard + + + + + Screenshot is copied to clipboard + Captura copiada al portapapeles + + + + DialogUploader + + Direct link: + Enlace directo: + + + Copy + Copiar + + + Upload + Subir + + + Cancel + Cancelar + + + Close + Cerrar + + + Uploaded + Subido + + + Receiving a response from the server + Recibiendo respuesta desde el servidor + + + Error + Error + + + + MainWindow + + + Screenshot + + + + + Double click for open screenshot in external default image viewer + + + + + Quit + Salir + + + + Save + Guardar + + + + New + Nuevo + + + + Copy + Copiar + + + + + + Hide + Ocultar + + + + About + Acerca de SG + + + + PNG Files + Archivo PNG + + + + JPEG Files + Archivo JPEG + + + + BMP Files + Archivo BMP + + + + Options + Opciones + + + + None + No + + + + Show + Ver + + + + Save As... + Guardar como... + + + + ScreenGrab + + + + + Type: + Tipo: + + + + Type of screenshot + Tipo de captura + + + + Full screen + Pantalla completa + + + + Window + Ventana + + + + Screen area + Area o porción + + + + Previous selection + + + + + toolBar + + + + Getting new screenshot + Obtener nueva captura + + + New Screen + Nueva captura + + + Ctrl+N + Ctrl+N + + + + Delay + Retardo + + + + Delay in seconds before taking screenshot + Demora en segundos antes hacer la captura + + + + sec + seg + + + Save current screenshot into graphical file + Guardar actual captura como + + + Save Screen + Guardar captura + + + Ctrl+S + Ctrl+S + + + Copy current screenshot into clipboard + Copiar captura al portapapeles + + + Copy Screen + Copiar captura + + + Ctrl+C + Ctrl+C + + + Options dialog + Opciones de configuración + + + Ctrl+O + Ctrl+O + + + Show help information + Ver información de ayuda + + + + + Help + Ayuda + + + F1 + F1 + + + Exit from ScreenGrab + Salir de ScreenGrab + + + Ctrl+Q + Ctrl+Q + + + + QApplication + + + Use your mouse to draw a rectangle to screenshot or exit pressing +any key or using the right or middle mouse buttons. + Use el arrastre del ratón para marcar el área y luego presione cualquier tecla. + + + + %1 x %2 pixels + + + + + QObject + + Upload + Subir + + + + aboutWidget + + + About Qt + Acerca de Qt + + + + Close + Cerrar + + + + configwidget + + + + Options + Opciones + + + + Default saving image format + Formato por defecto para salvar imagen + + + + Default delay before grabbing screen + Tiempo predeterminando antes de grabar la captura + + + + Inserting current date time into saved filename + Agregando fecha y tiempo actual al nombre de archivo + + + + Insert current date and time in file name + + + + + Autosave screenshot + Autosalvar captura + + + + Save first screenshot + Salvar primera captura + + + + Image quality + Calidad de la imagen + + + + Image quality (1 - small file, 100 - high quality) + Calidad de imagen (1 - archivo pequeño, 100 - alta calidad) + + + + Allow run multiplies copy of ScreenGrab + + + + + Enable external viewer + + + + + Show ScreenGrab in the system tray + + + + + Minimize to tray on click close button + + + + + Minimize to tray when closing + + + + + Action + Acción + + + + Global shortcuts + Atajos globales + + + + Fill screen + Pantalla completa + + + + Active window + Ventana activa + + + + Area select + Seleccione area + + + + Local shortcuts + + + + + New screen + Nueva captura + + + + Save screen + Guardar captura + + + + Copy screen + Copiar captura + + + + Help + Ayuda + + + Exit + Salir + + + + Not defined + No definido + + + + Restore default settings + Restaurar configuración por defecto + + + + Defaults + Predeterminado + + + + Save settings + Guardar configuración + + + + Save + Guardar + + + + Discard changes + Descartar cambios + + + + Cancel + Cancelar + + + + Main + Principal + + + + System tray + + + + + Saving + + + + + Default save directory: + Directorio de salva por defecto: + + + + Path to default selection dir for saving + Camino elegido por defecto para salvar + + + + Browse filesystem + Elije otro dir y carpeta + + + + Browse + Cambiar + + + + Default filename: + Nombre por defecto: + + + + Default filename + Nombre por defecto + + + + Format + Formato + + + + Copy file name to the clipboard when saving + + + + + Do not copy + + + + + Copy file name only + + + + + Copy full file path + + + + + Screenshot + + + + + Delay: + Demorar: + + + + + sec + seg + + + + No window decoration + Sin decoración de ventana + + + + Advanced + Avanzado + + + + Template: + Plantilla: + + + + Example: + Ejemplo: + + + + Automatically saving screenshots in grabbing process + Salvar captura automaticamente en el proceso de grabacion + + + + Tray messages: + Notificar mensajes + + + + Tray messages display mode + Mostrar notificación de mensajes + + + + Never + Nunca + + + + Tray mode + Notificar + + + + Always + Siempre + + + + Shortcuts + Atajos de teclado + + + + Allow multiple instances of ScreenGrab + + + + + Open in external viewer on double click + + + + + Shortcut + Atajos + + + + Quit + Salir + + + + Selected shortcut: + Atajo seleccionado: + + + + Time of display tray messages + Tiempo que muestra la notificación + + + + Time to display tray messages + Tiempo que muestra la notificación + + + + Zoom area around mouse in selection mode + Ampliar el área cerca del ratón en el modo de selección + + + diff --git a/translations/screengrab_it_IT.ts b/translations/screengrab_it_IT.ts new file mode 100644 index 0000000..4dc7bf4 --- /dev/null +++ b/translations/screengrab_it_IT.ts @@ -0,0 +1,828 @@ + + + + + AboutDialog + + + built on + compilato in + + + + using Qt + usando QT + + + + About + Informazioni su + + + + Thanks + Grazie a + + + + Licensed under the + Rilasciato sotto licensa + + + + + E-Mail + + + + + Help us + + + + + Web site + + + + + Copyright &copy; 2009-2013, Artem 'DOOMer' Galichkin + Copyright &copy; 2009-2010, Artem 'DOOMer' Galichkin {2009-2012,?} {2009-2013,?} + + + + What you can do? + + + + + is a crossplatform application for fast creating screenshots of your desktop. + + + + + 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. + + + + + You can join us and help us if you want. This is an invitation if you like this application. + + + + + Translate ScreenGrab to other languages + + + + + Make suggestions for next releases + + + + + Report bugs and issues + + + + + Bug tracker + + + + + Translate: + Traduzioni: + + + + Brazilian Portuguese translation + Traduzioni in Portoghese Brasiliano + + + + Marcio Moraes + + + + + Ukrainian translation + Traduzioni in Ucraino + + + + Gennadi Motsyo + + + + + Spanish translation + + + + + Burjans L García D + + + + + Italian translation + + + + + Testing: + + + + + Dual monitor support and other in Linux + + + + + Dual monitor support in Linux + + + + + win32-build [Windows XP and 7] + + + + + old win32-build [Windows Vista] + + + + + win32-build [Windows 7] + + + + + ConfigDialog + + + Select directory + Selezionare la cartella + + + + + Warning + Attenzione + + + + Directory %1 does not exist. Do you want to create it? + + + + + Do you want to reset the settings to the defaults? + + + + + None + Nessuno + + + + Example: + Esempio: + + + + This key is already used in your system! Please select another. + + + + + This key is already used in ScreenGrab! Please select another. + + + + + This key is not supported on your system! + Questa chiave non è supportata dal tuo sistema! + + + + Error + Errore + + + + Core + + + New screen + Nuova cattura + + + + New screen is getted! + Nuova cattura ottenuta! + + + + Saved + Salvata + + + + Name of saved file is copied to the clipboard + + + + + Copied + Copiata + + + + Saved to + Salvata in + + + + Path to saved file is copied to the clipboard + + + + + Screenshot is copied to clipboard + La schermata è stata copiata negli appunti + + + + DialogUploader + + Copy + Copia + + + Cancel + Annulla + + + Close + Chiudi + + + Error + Errore + + + + MainWindow + + + ScreenGrab + ScreenGrab + + + + Type: + Tipo: + + + + Type of screenshot + Tipo di cattura + + + + Full screen + Tutto schermo + + + + Window + Finestra + + + + Screen area + Area dello schermo + + + + Previous selection + + + + + toolBar + + + + Getting new screenshot + Effettua una nuova cattura + + + New Screen + Nuova Cattura + + + + Delay + Ritardo + + + + Delay in seconds before taking screenshot + Ritardo in secondi prima di effettuare la cattura + + + + sec + sec + + + Save current screenshot into graphical file + Salva la cattura corrente in un file + + + Save Screen + Salva Cattura + + + Copy current screenshot into clipboard + Copia la cattura corrente negli appunti + + + Copy Screen + Copia Cattura + + + Options dialog + Finestra delle impostazioni + + + + Options + Impostazioni + + + Show help information + Mosta la guida in linea + + + + + Help + Guida + + + Exit from ScreenGrab + Esci da ScreenGrab + + + + Quit + Esci + + + + Save + Salva + + + + New + Nuovo + + + + Copy + Copia + + + + + + Hide + Nascondi + + + + About + Informazioni su + + + + Screenshot + + + + + Double click for open screenshot in external default image viewer + + + + + None + Nessuno + + + + Show + Mostra + + + + PNG Files + File PNG + + + + JPEG Files + File JPEG + + + + BMP Files + File BMP + + + + Save As... + Salva con nome... + + + + QApplication + + + Use your mouse to draw a rectangle to screenshot or exit pressing +any key or using the right or middle mouse buttons. + Usa il mouse per delineare un rettangolo da catturare o esci premendo +un tasto qualsiasi o usando il tasto destro o centrale del mouse. + + + + %1 x %2 pixels + %1 x %2 pixel + + + + aboutWidget + + + About Qt + Informazioni su QT + + + + Close + Chiudi + + + + configwidget + + + + Options + Impostazioni + + + + Default saving image format + Formato standard di salvataggio immagine + + + + Default delay before grabbing screen + Ritardo prima della cattura predefinito + + + + Inserting current date time into saved filename + Inserisci la data e l'orario corrente nel nome file + + + + Insert current date and time in file name + + + + + Autosave screenshot + Salva la cattura automaticamente + + + + Save first screenshot + Salva la prima cattura + + + + Image quality + + + + + Image quality (1 - small file, 100 - high quality) + + + + + Allow run multiplies copy of ScreenGrab + + + + + Enable external viewer + + + + + Show ScreenGrab in the system tray + + + + + Minimize to tray on click close button + + + + + Minimize to tray when closing + + + + + Action + Azione + + + + Global shortcuts + Scorciatoie globali + + + + Fill screen + Tutto schermo + + + + Active window + Finestra attiva + + + + Area select + Selezione area + + + + Local shortcuts + + + + + New screen + Nuova cattura + + + + Save screen + Salva cattura + + + + Copy screen + Copia cattura + + + + Help + Guida + + + Exit + Esci + + + + Not defined + Non definito + + + + Restore default settings + Ripristina le impostazioni di fabbrica + + + + Defaults + Ripristina + + + + Save settings + Salva le impostazioni + + + + Save + Salva + + + + Discard changes + Annulla le modifiche + + + + Cancel + Annulla + + + + Main + Generale + + + + System tray + + + + + Saving + + + + + Default save directory: + Cartella dei salvataggi predefinita: + + + + Path to default selection dir for saving + Percorso per i salvataggi predefinito + + + + Browse filesystem + Sfoglia le cartelle + + + + Browse + Sfoglia + + + + Default filename: + Nome file predefinito: + + + + Default filename + Nome file predefinito + + + + Format + Formato + + + + Copy file name to the clipboard when saving + + + + + Do not copy + + + + + Copy file name only + + + + + Copy full file path + + + + + Screenshot + + + + + Delay: + Ritardo: + + + + + sec + + + + + No window decoration + Escludi le decorazioni delle finestre + + + + Advanced + Avanzate + + + + Template: + Modello: + + + + Example: + Esempio: + + + + Automatically saving screenshots in grabbing process + Salva la schermata automaticamente durante la cattura + + + + Tray messages: + Messaggi nell'area di notifica: + + + + Tray messages display mode + Modalità di visualizzazione nell'area di notifica + + + + Never + Mai + + + + Tray mode + Modalità area di notifica + + + + Always + Sempre + + + + Time of display tray messages + Tempo di esposizione dei messaggi + + + + Time to display tray messages + Tempo di esposizione dei messaggi nell'area di notifica + + + + Shortcuts + Scorciatoie + + + + Allow multiple instances of ScreenGrab + + + + + Open in external viewer on double click + + + + + Shortcut + Scorciatoia + + + + Quit + Esci + + + + Selected shortcut: + Seleziona scorciatoia: + + + + Zoom area around mouse in selection mode + Ingrandisci l'area attorno al puntatore nella modalità selezione + + + diff --git a/translations/screengrab_pt_BR.ts b/translations/screengrab_pt_BR.ts new file mode 100644 index 0000000..4a935e9 --- /dev/null +++ b/translations/screengrab_pt_BR.ts @@ -0,0 +1,852 @@ + + + + + AboutDialog + + + built on + construído em + + + + using Qt + usando o QT + + + + About + Sobre + + + + Thanks + Agradecimentos + + + + Licensed under the + Licenciado sob a + + + + + E-Mail + E-Mail + + + + Help us + + + + + Web site + + + + + Copyright &copy; 2009-2013, Artem 'DOOMer' Galichkin + Copyright &copy; 2009-2011, Artem 'DOOMer' Galichkin {2009-2010,?} {2009-2012,?} {2009-2013,?} + + + + What you can do? + + + + + is a crossplatform application for fast creating screenshots of your desktop. + + + + + 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. + + + + + You can join us and help us if you want. This is an invitation if you like this application. + + + + + Translate ScreenGrab to other languages + + + + + Make suggestions for next releases + + + + + Report bugs and issues + + + + + Bug tracker + + + + + Translate: + Tradução: + + + + Brazilian Portuguese translation + Tradução para o Português do Brasil + + + + Marcio Moraes + Márcio Moraes + + + + Ukrainian translation + Tradução para o Ucraniano + + + + Gennadi Motsyo + Gennadi Motsyo + + + + Spanish translation + + + + + Burjans L García D + + + + + Italian translation + + + + + Testing: + Testado em: + + + + Dual monitor support and other in Linux + + + + + Dual monitor support in Linux + + + + + win32-build [Windows XP and 7] + + + + + old win32-build [Windows Vista] + + + + + win32-build [Windows 7] + + + + + ConfigDialog + + + Select directory + Selecionar diretório + + + + + Warning + Aviso + + + + Directory %1 does not exist. Do you want to create it? + + + + + Do you want to reset the settings to the defaults? + + + + + None + Nenhum + + + + Example: + Exemplo: + + + + This key is already used in your system! Please select another. + + + + + This key is already used in ScreenGrab! Please select another. + + + + + This key is not supported on your system! + Esta tecla não é suportada no seu sistema! + + + + Error + Erro + + + + Core + + + New screen + Nova tela + + + + New screen is getted! + A nova tela foi obtida! + + + + Saved + Salva + + + + Name of saved file is copied to the clipboard + + + + + Copied + Copiada + + + + Saved to + Salva em + + + + Path to saved file is copied to the clipboard + + + + + Screenshot is copied to clipboard + A captura de tela foi copiada para a área de transferência + + + + DialogUploader + + Copy + Copiar + + + Cancel + Cancelar + + + Close + Fechar + + + Error + Erro + + + + MainWindow + + + ScreenGrab + ScreenGrab + + + + Type: + Tipo: + + + + Type of screenshot + Tipo de captura de tela + + + + Full screen + Tela cheia + + + + Window + Janela ativa + + + + Screen area + Área da tela + + + + Previous selection + + + + + toolBar + + + + Getting new screenshot + Obtendo uma nova captura de tela + + + New Screen + Nova + + + Ctrl+N + Ctrl+N + + + + Delay + Atraso + + + + Delay in seconds before taking screenshot + Atrasar em segundos antes de obter a captura de tela + + + + sec + seg + + + Save current screenshot into graphical file + Salvar tela atual para um arquivo + + + Save Screen + Salvar tela + + + Ctrl+S + Ctrl+S + + + Copy current screenshot into clipboard + Copiar captura de tela atual para a área de transferência + + + Copy Screen + Copiar tela + + + Ctrl+C + Ctrl+C + + + Options dialog + Opções + + + + Options + Opções + + + Ctrl+O + Ctrl+O + + + Show help information + Mostrar informações de ajuda + + + + + Help + Ajuda + + + F1 + F1 + + + Exit from ScreenGrab + Sair do ScreenGrab + + + Ctrl+Q + Ctrl+Q + + + + Quit + Sair + + + + Save + Salvar + + + + New + Nova + + + + Copy + Copiar + + + + + + Hide + Ocultar + + + + About + Sobre + + + + Screenshot + + + + + Double click for open screenshot in external default image viewer + + + + + None + Nenhum + + + + Show + Mostrar + + + + PNG Files + Arquivos PNG + + + + JPEG Files + Arquivos JPEG + + + + BMP Files + Arquivos BMP + + + + Save As... + Salvar Como... + + + + QApplication + + + Use your mouse to draw a rectangle to screenshot or exit pressing +any key or using the right or middle mouse buttons. + Use o mouse para desenhar um retângulo na tela ou saia pressionando +qualquer tecla ou usando os botões direito ou do meio do mouse. + + + + %1 x %2 pixels + %1 x %2 pixels + + + + aboutWidget + + + About Qt + Sobre o QT + + + + Close + Fechar + + + + configwidget + + + + Options + Opções + + + + Default saving image format + Salvando formato de imagem padrão + + + + Default delay before grabbing screen + Atraso padrão antes de capturar a tela + + + + Inserting current date time into saved filename + Inserindo data atual no nome do arquivo salvo + + + + Insert current date and time in file name + + + + + Autosave screenshot + Salvar automaticamente a captura de tela + + + + Save first screenshot + Salvar primeiro a captura de tela + + + + Image quality + + + + + Image quality (1 - small file, 100 - high quality) + + + + + Allow run multiplies copy of ScreenGrab + + + + + Enable external viewer + + + + + Show ScreenGrab in the system tray + + + + + Minimize to tray on click close button + + + + + Minimize to tray when closing + + + + + Action + Ação + + + + Global shortcuts + Atalhos globais + + + + Fill screen + Toda a tela + + + + Active window + Janela ativa + + + + Area select + Selecionar área + + + + Local shortcuts + + + + + New screen + Nova tela + + + + Save screen + Salvar tela + + + + Copy screen + Copiar tela + + + + Help + Ajuda + + + Exit + Sair + + + + Not defined + Não definida + + + + Restore default settings + Restaurar configurações padrões + + + + Defaults + Padrões + + + + Save settings + Salvar configurações + + + + Save + Salvar + + + + Discard changes + Descartar alterações + + + + Cancel + Cancelar + + + + Main + Principal + + + + System tray + + + + + Saving + + + + + Default save directory: + Salvar no diretório padrão: + + + + Path to default selection dir for saving + Caminho do diretório padrão para salvar + + + + Browse filesystem + Navegar no sistema de arquivos + + + + Browse + Navegar + + + + Default filename: + Nome do arquivo padrão: + + + + Default filename + Nome do arquivo padrão + + + + Format + Formato + + + + Copy file name to the clipboard when saving + + + + + Do not copy + + + + + Copy file name only + + + + + Copy full file path + + + + + Screenshot + + + + + Delay: + Atraso: + + + + + sec + seg + + + + No window decoration + Sem decoração da janela + + + + Advanced + Avançado + + + + Template: + Modelo: + + + + Example: + Exemplo: + + + + Automatically saving screenshots in grabbing process + Salvar automaticamente capturas de telas no processo de obtenção + + + + Tray messages: + Mensagens na área de notificação: + + + + Tray messages display mode + Modo de exibição das mensagens na área de notificação + + + + Never + Nunca + + + + Tray mode + Modo da área de notificação + + + + Always + Sempre + + + + Time of display tray messages + Tempo de exibição das mensagens na área de notificação + + + + Time to display tray messages + Tempo para exibir as mensagens na área de notificação + + + + Shortcuts + Atalhos + + + + Allow multiple instances of ScreenGrab + + + + + Open in external viewer on double click + + + + + Shortcut + Atalho + + + + Quit + Sair + + + + Selected shortcut: + Atalho selecionado: + + + + Zoom area around mouse in selection mode + Zoom na área ao redor do mouse no modo de seleção + + + diff --git a/translations/screengrab_ru.desktop b/translations/screengrab_ru.desktop new file mode 100644 index 0000000..32cf956 --- /dev/null +++ b/translations/screengrab_ru.desktop @@ -0,0 +1,3 @@ +# Translations +Comment[ru]=Программа для создания снимков экрана +GenericName[ru]=Создание снимков экрана diff --git a/translations/screengrab_ru.ts b/translations/screengrab_ru.ts new file mode 100644 index 0000000..5471149 --- /dev/null +++ b/translations/screengrab_ru.ts @@ -0,0 +1,1033 @@ + + + + + AboutDialog + + + built on + дата сборки + + + + using Qt + использует Qt + + + + About + О программе + + + + Thanks + Благодарности + + + + Licensed under the + Лицензировано по + + + + + E-Mail + Электронная почта + + + + Help us + Помощь проекту + + + + Web site + Сайт + + + + Copyright &copy; 2009-2013, Artem 'DOOMer' Galichkin + Copyright &copy; 2009-2010, Артём 'DOOMer' Галичкин {2009-2012,?} {2009-2013,?} + + + + What you can do? + Чем можно помочь? + + + + is a crossplatform application for fast creating screenshots of your desktop. + кроссплатформенное приложение для быстрого создания снимков вашего рабочего стола. + + + + 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. + Это лёгкое и мощное приложение, написанное с помощью библиотек Qt, так что вы можете использовать его в Windows и Linux. + + + + You can join us and help us if you want. This is an invitation if you like this application. + Если хотите, вы можете присоединиться к нам и помочь. Это приглашение, если вам понравилось приложение. + + + + Translate ScreenGrab to other languages + Перевести ScreenGrab на другие языки + + + + Make suggestions for next releases + Выразить пожелания для следующих выпусков + + + + Report bugs and issues + Сообщать об ошибках в работе приложения + + + + Bug tracker + Баг-трекер + + + + Translate: + Переводы: + + + + Brazilian Portuguese translation + Бразильская Португальская локализация + + + + Marcio Moraes + + + + + Ukrainian translation + Украинская локализация + + + + Gennadi Motsyo + Геннадий Моцьо + + + + Spanish translation + Испанская локализация + + + + Burjans L García D + + + + + Italian translation + Итальянская локализация + + + + Testing: + Тестирование: + + + + Dual monitor support and other in Linux + Поддержка работы на двух мониторах и другие тесты в Linux + + + + Dual monitor support in Linux + Поддержка работы на двух мониторах в Linux + + + + win32-build [Windows XP and 7] + win32-версии [Windows XP and 7] + + + + old win32-build [Windows Vista] + Ранние win32-версии [Windows Vista] + + + + win32-build [Windows 7] + win32-версии [Windows 7] + + + + ConfigDialog + + + Select directory + Выбрать папку + + + + + Warning + Предупрждение + + + + Directory %1 does not exist. Do you want to create it? + Папка %1 не существует. Вы хотите создать её? + + + + Do you want to reset the settings to the defaults? + Сбросить настройки на настройки по умолчанию? + + + + None + Нет + + + + Example: + Пример: + + + + This key is already used in your system! Please select another. + Эта комбинация уже используется в вашей системе! Выберите другую. + + + + This key is already used in ScreenGrab! Please select another. + Эта комбинация уже используется в ScreenGrab! Выберите другую. + + + + This key is not supported on your system! + Эта комбинация не поддерживается вашей системой! + + + + Error + Ошибка + + + + Core + + + New screen + Новый скриншот + + + + New screen is getted! + Получен новый скриншот! + + + + Saved + Сохранено + + + + Name of saved file is copied to the clipboard + Имя сохранённого файла скопировано в буфер обмена + + + + Copied + Скопировано + + + + Saved to + Слхранено в + + + + Path to saved file is copied to the clipboard + Путь к сохранённому файлу скопирован в буфер обмена + + + + Screenshot is copied to clipboard + Скриншот скопирован в буфер обмена + + + + DialogUploader + + Upload to internet + Загрузить в интернет + + + Upload to + Загрузить на + + + Direct link: + Прямая ссылка: + + + Open this link in the default web-browser + Открыть эту ссылку в браузере по умолчанию + + + Open + Открыть + + + Copy this link to the clipboard + Копировать эту ссылку в буфер обмена + + + Copy + Копировать + + + Extended preformed html or bb codes: + Предварительно отформатированный html и bb-код: + + + Link to delete image: + Ссылка на удаление изображения: + + + Upload + Загрузить + + + Cancel + Отмена + + + Close + Закрыть + + + Size: + Размер: + + + pixel + пикс + + + Uploaded + Загружено + + + Ready to upload + Готово к загрузке + + + Upload processing... Please wait + Происходит загрузка... Подождите пожалуйста + + + Open this link in your default web-browser, it may directly delete your uploaded image, without any warnings. + Открыть эту ссылку в вашем браузере по умолчанию, это может удалить загруженное вами изображение без предупреждений. + + + Receiving a response from the server + Получение ответа от сервера + + + Upload completed + Загрузка завершена + + + Error uploading screenshot + Ошибка загрузки скриншота + + + Error + Ошибка + + + Are you sure you want to continue? + Вы действительно хотите продолжить? + + + + MainWindow + + + Screenshot + Скриншот + + + + Double click for open screenshot in external default image viewer + Двойной клик откроет скриншот во внешнем вьювере изображений + + + + Quit + Выход + + + + Save + Сохранить + + + + New + Новый + + + + Copy + Копировать + + + + + + Hide + Скрыть окно + + + + About + О программе + + + + PNG Files + файлы PNG + + + + JPEG Files + файлы JPEG + + + + BMP Files + файлы BMP + + + + Options + Настройки + + + + None + Нет + + + + Show + Показать окно + + + + Save As... + Сохранить как... + + + + ScreenGrab + + + + + Type: + Тип: + + + + Type of screenshot + Тип скриншота + + + + Full screen + Весь экран + + + + Window + Окно + + + + Screen area + Область экрана + + + + Previous selection + Предыдущая выбрананя область + + + + toolBar + + + + Getting new screenshot + Получить новый скриншот + + + New Screen + Новый снимок + + + Ctrl+N + Ctrl+N + + + + Delay + Задержка + + + + Delay in seconds before taking screenshot + Задержка в секундах перед получением скриншота + + + + sec + сек + + + Save current screenshot into graphical file + Сохранить скриншот в графический файл + + + Save Screen + Сохранить + + + Ctrl+S + Ctrl+S + + + Copy current screenshot into clipboard + Копировать скриншот в буфер обмена + + + Copy Screen + Копировать + + + Ctrl+C + Ctrl+C + + + Options dialog + Настрйоки программы + + + Ctrl+O + Ctrl+O + + + Show help information + Показать справочную информацию + + + + + Help + Справка + + + F1 + F1 + + + Exit from ScreenGrab + Выход из программы + + + Ctrl+Q + Ctrl+Q + + + + ModuleUploader + + Uploading + Загружается + + + + QApplication + + + Use your mouse to draw a rectangle to screenshot or exit pressing +any key or using the right or middle mouse buttons. + Используйте левую клавишу мыши для выделения области экрана. +Клавиатурные клавиши и правая кнопка мыши отменяют режим выделения области. + + + + %1 x %2 pixels + %1 x %2 пиксел + + + + QObject + + External edit + Внешнее редактирование + + + Edit in... + Открыть в ... + + + Upload + Загрузить + + + + Uploader + + Direct link + Прямая ссылка + + + HTML code + HTML-код + + + BB code + BB-код + + + HTML code with thumb image + HTML-код с превью-изображением + + + BB code with thumb image + BB-код с превью-изображением + + + URl to delete image + URL для удаления изображения + + + + UploaderConfigWidget + + Common settings + Общие настройки + + + Default image host + Хостинг изображений +по умолчанию + + + Always copy the link to the clipboard + Всегда копировать ссылку в буфер обмена + + + Hosts settings + Настройки сервисов + + + Settings for: + Настройки для: + + + + UploaderConfigWidget_ImgUr + + Configuration for imgur.com upload + Настройки для загрузки на imgur.com + + + Now is nothing yet + Пока ничего нет + + + + UploaderConfigWidget_MediaCrush + + Configuration for mediacru.sh upload + Настройка загрузки для mediacru.sh + + + Now is nothing yet + Пока ничего нет + + + + Uploader_ImgUr_Widget + + Upload to ImgUr.com + Загрузка на ImgUr.com + + + + Uploader_MediaCrush_Widget + + Upload to MediaCrush + Загрузить на MediaCrush + + + + aboutWidget + + + About Qt + О библиотеке Qt + + + + Close + Закрыть + + + + configwidget + + + + Options + Настройки + + + + Default saving image format + Формат скриншотов по умолчанию + + + + Default delay before grabbing screen + Задержка перед получением скриншота + + + + Inserting current date time into saved filename + Вставка даты и времени в имя сохраняемого файла + + + + Insert current date and time in file name + Добавить текущую дату и время к имени файла + + + + Autosave screenshot + Австосохранение скриншота + + + + Save first screenshot + Сохранять первый скриншот + + + + Image quality + Качество изображения + + + + Image quality (1 - small file, 100 - high quality) + Качество изображения (1 - меньший размер файла, 100 - лучшее качество) + + + + Allow run multiplies copy of ScreenGrab + Разрешить запускать несколько копий ScreenGrab + + + + Enable external viewer + Использовать внешний просмотрщик + + + + Show ScreenGrab in the system tray + Показывать ScreenGrab в системном трее + + + + Minimize to tray on click close button + Сворачивает в трей по клику на кнопку закрытия + + + + Minimize to tray when closing + Сворачивать в трей при закрытии + + + + Action + Действие + + + + Global shortcuts + Глобальные комбинации + + + + Fill screen + Весь экран + + + + Active window + Активное окно + + + + Area select + Выбранная область + + + + Local shortcuts + Внутренние комбинации + + + + New screen + Новый скриншот + + + + Save screen + Сохранить скриншот + + + + Copy screen + Копировать скриншот + + + + Help + Справка + + + + Not defined + Не определена + + + + Restore default settings + Восстановить исходные настройки + + + + Defaults + По умолчанию + + + + Save settings + Сохранить настройки + + + + Save + Сохранить + + + + Discard changes + Закрыть без изменений + + + + Cancel + Отмена + + + + Main + Основные + + + + System tray + Системный трей + + + + Saving + Сохранение + + + + Default save directory: + Исходный каталог: + + + + Path to default selection dir for saving + Исходный каталог для сохраняемых файлов + + + + Browse filesystem + Обзор файловой системы + + + + Browse + Обзор + + + + Default filename: + Исходное имя файла: + + + + Default filename + Имя файла по умолчанию + + + + Format + Формат + + + + Copy file name to the clipboard when saving + Копировать имя файла в буфер обмена при сохранении + + + + Do not copy + Не копировать + + + + Copy file name only + Копировать только имя файла + + + + Copy full file path + Копировать полный путь файла + + + + Screenshot + Скриншот + + + + Delay: + Задержка: + + + + + sec + сек + + + + No window decoration + Без декораций окна + + + + Advanced + Расширенные + + + + Template: + Шаблон: + + + + Example: + Пример: + + + + Automatically saving screenshots in grabbing process + Автоматическое сохранение скриншотов при их получении + + + + Tray messages: + Всплывающие уведомления: + + + + Tray messages display mode + Режим отображения всплывающих уведомлений + + + + Never + Никогда + + + + Tray mode + Если свёрнуто + + + + Always + Всегда + + + + Shortcuts + Комбинации клавиш + + + + Allow multiple instances of ScreenGrab + Разрешить несколько копий ScreenGrab + + + + Open in external viewer on double click + Открывать во внешнем просмотрщике по двойному щелчку + + + + Shortcut + Клавиши + + + + Quit + Выход + + + + Selected shortcut: + Выбранная комбинация: + + + + Time of display tray messages + Время отображения всплывающих уведомлений + + + + Time to display tray messages + Время отображения всплывающих уведомлений + + + + Zoom area around mouse in selection mode + Масштабирование области курсора в режиме выбора + + + diff --git a/translations/screengrab_uk.desktop b/translations/screengrab_uk.desktop new file mode 100644 index 0000000..eb285c3 --- /dev/null +++ b/translations/screengrab_uk.desktop @@ -0,0 +1,3 @@ +# Translations +Comment[uk]=Програма для створення знімків екрану +GenericName[uk]=Створення знімків екрану diff --git a/translations/screengrab_uk_UA.ts b/translations/screengrab_uk_UA.ts new file mode 100644 index 0000000..dafafce --- /dev/null +++ b/translations/screengrab_uk_UA.ts @@ -0,0 +1,958 @@ + + + + + AboutDialog + + + built on + дата збірки + + + + using Qt + використовує Qt + + + + About + Про програму + + + + Thanks + Подяки + + + + Licensed under the + За ліцензією + + + + + E-Mail + + + + + Help us + Допомога проекту + + + + Web site + Сайт + + + + Copyright &copy; 2009-2013, Artem 'DOOMer' Galichkin + Авторські права &copy; 2009-2012, Артем 'DOOMer' Галічкін {2009-2013,?} + + + + What you can do? + Чим можна допомогти? + + + + is a crossplatform application for fast creating screenshots of your desktop. + + + + + 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. + + + + + You can join us and help us if you want. This is an invitation if you like this application. + + + + + Translate ScreenGrab to other languages + + + + + Make suggestions for next releases + Побажання для майбутніх версій + + + + Report bugs and issues + Повідомлення про помилки та проблеми + + + + Bug tracker + Баг-трекер + + + + Translate: + Переклади: + + + + Brazilian Portuguese translation + Бразильський португальський переклад + + + + Marcio Moraes + + + + + Ukrainian translation + Український переклад + + + + Gennadi Motsyo + + + + + Spanish translation + Іспанський переклад + + + + Burjans L García D + + + + + Italian translation + Італійський переклад + + + + Testing: + Тестування: + + + + Dual monitor support and other in Linux + Двомоніторну підтримку та інші тести в Linux + + + + Dual monitor support in Linux + Двомоніторну підтримку в Linux + + + + win32-build [Windows XP and 7] + win32-версії [Windows XP and 7] + + + + old win32-build [Windows Vista] + Ранні win32-версії [Windows Vista] + + + + win32-build [Windows 7] + win32-версії [Windows 7] + + + + ConfigDialog + + + Select directory + Вибір теки + + + + + Warning + Попередження + + + + Directory %1 does not exist. Do you want to create it? + + + + + Do you want to reset the settings to the defaults? + + + + + None + Немає + + + + Example: + Приклад: + + + + This key is already used in your system! Please select another. + + + + + This key is already used in ScreenGrab! Please select another. + + + + + This key is not supported on your system! + Ця комбінація не підтримується вашою системою! + + + + Error + Помилка + + + + Core + + + New screen + Новий скріншот + + + + New screen is getted! + Новий знімок отримано! + + + + Saved + Збережено + + + + Name of saved file is copied to the clipboard + Ім'я збереженого файлу скопійовано в буфер обміну + + + + Copied + Скопійовано + + + + Saved to + Збережено до + + + + Path to saved file is copied to the clipboard + + + + + Screenshot is copied to clipboard + Скріншот скопійовано до кишені + + + + DialogUploader + + Upload to internet + Завантажити в інтернет + + + Upload to + Завантажити до + + + Direct link: + Пряме посилання: + + + Copy + Копіювати + + + Extended preformed html or bb codes: + Попередньо відформатований html та bb-код: + + + Upload + Завантажити + + + Cancel + Відміна + + + Close + Закрити + + + Size: + Розмір: + + + pixel + піксель + + + Uploaded + Завантажено + + + Ready to upload + Готово до завантаження + + + Receiving a response from the server + Отримання відповіді від сервера + + + Upload completed + Завантаження завершено + + + Error uploading screenshot + Помилка завантаження скріншота + + + Error + Помилка + + + + MainWindow + + + Screenshot + Скріншот + + + + Double click for open screenshot in external default image viewer + Подвійний клік відкриє скріншот у зовнішньому переглядачі + + + + Quit + Вихід + + + + Save + Зберегти + + + + New + Новий + + + + Copy + Копіювати + + + + + + Hide + Сховати вікно + + + + About + Про програму + + + + PNG Files + файли PNG + + + + JPEG Files + файли JPEG + + + + BMP Files + файли BMP + + + + Options + Налаштування + + + + None + Немає + + + + Show + Показати вікно + + + + Save As... + Зберегти як... + + + + ScreenGrab + + + + + Type: + Тип: + + + + Type of screenshot + Тип скріншоту + + + + Full screen + Весь екран + + + + Window + Вікно + + + + Screen area + Частина екрану + + + + Previous selection + Попередня вибрана частина + + + + toolBar + + + + Getting new screenshot + Отримати новий скріншот + + + New Screen + Новий знімок + + + + Delay + Затримка + + + + Delay in seconds before taking screenshot + Затримка в секундах перед отримання скріншоту + + + + sec + сек + + + Save current screenshot into graphical file + Зберегти скріншот в графічний файл + + + Save Screen + Зберегти + + + Copy current screenshot into clipboard + Копіювати скріншот до кишені + + + Copy Screen + Копіювати + + + Options dialog + Параметри програми + + + Show help information + Показати довідкову інформацію + + + + + Help + Довідка + + + Exit from ScreenGrab + Вийти з програми + + + + QApplication + + + Use your mouse to draw a rectangle to screenshot or exit pressing +any key or using the right or middle mouse buttons. + Використовуйте ліву клавішу мишки для виділення частини екрану. +Клавіатурні клавіші і права кнопка мишки відміняють режим виділення області. + + + + %1 x %2 pixels + %1 x %2 піксел + + + + QObject + + External edit + Зовнішнє редагування + + + Edit in... + Редагувати в... + + + Upload + Завантажити + + + + Uploader + + Direct link + Пряме посилання + + + HTML code + HTML-код + + + BB code + BB-код + + + HTML code with thumb image + HTML-код з попереднім переглядом + + + BB code with thumb image + BB-код з попереднім переглядом + + + URl to delete image + URL для видалення зображення + + + + UploaderConfigWidget + + Common settings + Загальні налаштування + + + Hosts settings + Налаштування сервісів + + + Settings for: + Налаштування для: + + + + UploaderConfigWidget_ImgUr + + Configuration for imgur.com upload + Налаштування для завантаження на imgur.com + + + Now is nothing yet + Ще нічого немає + + + + UploaderConfigWidget_MediaCrush + + Now is nothing yet + Ще нічого немає + + + + Uploader_ImgUr_Widget + + Upload to ImgUr.com + Завантаження на ImgUr.com + + + + aboutWidget + + + About Qt + Про Qt + + + + Close + Закрити + + + + configwidget + + + + Options + Налаштування + + + + Default saving image format + Формат зображень за замовчанням + + + + Default delay before grabbing screen + Затримка перед отримання скріншоту + + + + Inserting current date time into saved filename + Вставка дати та часу в ім'я файлу при збереженні + + + + Insert current date and time in file name + + + + + Autosave screenshot + Автозберігання скріншотів + + + + Save first screenshot + Зберігати перший скріншот + + + + Image quality + Якість картинки + + + + Image quality (1 - small file, 100 - high quality) + Якість картинки (1--меньшийрозмір файла, 100--найкраща якість) + + + + Allow run multiplies copy of ScreenGrab + + + + + Enable external viewer + Дозволити зовнішній переглядач + + + + Show ScreenGrab in the system tray + + + + + Minimize to tray on click close button + + + + + Minimize to tray when closing + + + + + Action + Дія + + + + Global shortcuts + Глобальні + + + + Fill screen + Весь екран + + + + Active window + Активне вікно + + + + Area select + Вибрану ділянку + + + + Local shortcuts + + + + + New screen + Новий скріншот + + + + Save screen + Зберегти скріншот + + + + Copy screen + Копіювати скріншот + + + + Help + Довідка + + + Exit + Вихід + + + + Not defined + Не вибрана + + + + Restore default settings + Відновити початкові налаштування + + + + Defaults + За умовчанням + + + + Save settings + Зберегти налаштування + + + + Save + Зберегти + + + + Discard changes + Закрити без змін + + + + Cancel + Відміна + + + + Main + Головні + + + + System tray + + + + + Saving + + + + + Default save directory: + Тека для збереження: + + + + Path to default selection dir for saving + Шлях до теки для збереження + + + + Browse filesystem + Огляд файлової системи + + + + Browse + Огляд + + + + Default filename: + Вихідне ім'я файлу: + + + + Default filename + Вихідне ім'я файлу + + + + Format + Формат + + + + Copy file name to the clipboard when saving + + + + + Do not copy + + + + + Copy file name only + + + + + Copy full file path + + + + + Screenshot + + + + + Delay: + Затримка: + + + + + sec + сек + + + + No window decoration + Без декорацій вікна + + + + Advanced + Розширені + + + + Template: + Шаблон: + + + + Example: + Приклад: + + + + Automatically saving screenshots in grabbing process + Автоматичне збереження скріншотів при їх отриманні + + + + Tray messages: + Спливаючі повідомлення: + + + + Tray messages display mode + Режим відображення спливаючих повідомлень + + + + Never + Ніколи + + + + Tray mode + Якщо згорнуто + + + + Always + Завжди + + + + Shortcuts + Комбінації клавіш + + + + Allow multiple instances of ScreenGrab + + + + + Open in external viewer on double click + + + + + Shortcut + Клавіші + + + + Quit + Вихід + + + + Selected shortcut: + Вибрана комбінація: + + + + Time of display tray messages + Час показу спливаючих повідомлень + + + + Time to display tray messages + Час показу спливаючих повідомлень + + + + Zoom area around mouse in selection mode + Масштаб області курсора в режимі вибору + + + diff --git a/translations/uploader.ts b/translations/uploader.ts new file mode 100644 index 0000000..8b51f29 --- /dev/null +++ b/translations/uploader.ts @@ -0,0 +1,257 @@ + + + + + DialogUploader + + + Upload to internet + + + + + Upload to + + + + + Direct link: + + + + + + Open this link in the default web-browser + + + + + + Open + + + + + + Copy this link to the clipboard + + + + + + Copy + + + + + Extended preformed html or bb codes: + + + + + Link to delete image: + + + + + Upload + + + + + Cancel + + + + + Size: + + + + + pixel + + + + + Uploaded + + + + + + Ready to upload + + + + + Upload processing... Please wait + + + + + Receiving a response from the server + + + + + Upload completed + + + + + + Close + + + + + Error uploading screenshot + + + + + Error + + + + + Open this link in your default web-browser, it may directly delete your uploaded image, without any warnings. + + + + + Are you sure you want to continue? + + + + + ModuleUploader + + + Uploading + + + + + QObject + + + Upload + + + + + Uploader + + + Direct link + + + + + HTML code + + + + + BB code + + + + + HTML code with thumb image + + + + + BB code with thumb image + + + + + URl to delete image + + + + + UploaderConfigWidget + + + Common settings + + + + + Default image host + + + + + Always copy the link to the clipboard + + + + + Hosts settings + + + + + Settings for: + + + + + UploaderConfigWidget_ImgUr + + + Configuration for imgur.com upload + + + + + Now is nothing yet + + + + + UploaderConfigWidget_MediaCrush + + + Form + + + + + Configuration for mediacru.sh upload + + + + + Now is nothing yet + + + + + Uploader_ImgUr_Widget + + + Upload to ImgUr.com + + + + + Uploader_MediaCrush_Widget + + + Form + + + + + Upload to MediaCrush + + + +