diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 41b1005..0000000 --- a/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -build/ -*.qm -*.kdev4 diff --git a/CMakeLists.txt b/CMakeLists.txt index 9132780..7291b54 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.11) +cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) # set project's name project(screengrab) @@ -20,6 +20,24 @@ set(CMAKE_AUTOUIC ON) include(GNUInstallDirs) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +find_package(X11) +if (X11_FOUND) + set(HAVE_X11 1) +endif(X11_FOUND) + +# set up xcb and x11_xcb + +find_package( + XCB MODULE COMPONENTS + XCB + SHAPE + XFIXES +) + +find_package( + X11_XCB MODULE +) + # add version define set(SCREENGRAB_VERSION "1.95") set(SCREENGRAB_VERSION_DEV "2.0-beta1") @@ -65,6 +83,7 @@ message(STATUS "Library path: ${CMAKE_INSTALL_RPATH}") option(SG_GLOBALSHORTCUTS "Enable global shortcuts" OFF) option(SG_EXT_UPLOADS "Enable upload screenshots to MediaCrush and imgur" ON) option(SG_EXT_EDIT "Enable ability to edit screenshots in external editor" ON) +option(SG_DBUS_NOTIFY "Enable D-Bus notifications" ON) option(UPDATE_TRANSLATIONS "Update source translation translations/*.ts files" OFF) # Although the names, LXQtTranslateTs and LXQtTranslateDesktop, they don't @@ -90,12 +109,17 @@ endif() if(SG_EXT_EDIT) add_definitions( -DSG_EXT_EDIT="1") find_package(Qt5Xdg REQUIRED) - include(${QTXDG_USE_FILE}) +endif() + +if(SG_DBUS_NOTIFY) + find_package(Qt5DBus 5.2 REQUIRED) + add_definitions( -DSG_DBUS_NOTIFY="1") endif() message(STATUS "Global shortcuts support: " ${SG_GLOBALSHORTCUTS}) message(STATUS "Upload to MediaCrush and imgur support: " ${SG_EXT_UPLOADS}) message(STATUS "Editing screenshots in external editor support: " ${SG_EXT_EDIT}) +message(STATUS "Enable D-Bus notifications: " ${SG_DBUS_NOTIFY}) message(STATUS "Use system Qxt Library: " ${SG_USE_SYSTEM_QXT}) message(STATUS "Update source translation translations/*.ts files: " ${UPDATE_TRANSLATIONS}) @@ -104,6 +128,9 @@ message(STATUS "Update source translation translations/*.ts files: " ${UPDATE_TR message(STATUS "Documentation directory: " ${CMAKE_INSTALL_FULL_DOCDIR}) add_definitions(-DSG_DOCDIR="${CMAKE_INSTALL_FULL_DOCDIR}") +# app icon path +add_definitions(-DSG_ICONPATH="${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATADIR}/pixmaps/screengrab.png") + include_directories("${CMAKE_CURRENT_SOURCE_DIR}/src") add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/src/common/qkeysequencewidget") include_directories("${CMAKE_CURRENT_SOURCE_DIR}/src/common/qkeysequencewidget/src") @@ -128,9 +155,17 @@ set(SCREENGRAB_SRC src/core/modulemanager.cpp src/core/ui/configwidget.cpp src/core/ui/about.cpp - src/core/ui/mainwindow.cpp + src/core/ui/mainwindow.cpp ) +if(SG_DBUS_NOTIFY) + set(SCREENGRAB_SRC ${SCREENGRAB_SRC} src/core/dbusnotifier.cpp) +endif() + +if(X11_FOUND) + set(SCREENGRAB_SRC ${SCREENGRAB_SRC} src/core/x11utils.cpp) +endif() + set(SCREENGRAB_HDR src/core/singleapp.h ) @@ -195,8 +230,31 @@ if(SG_EXT_EDIT) target_link_libraries(screengrab extedit) endif() -target_link_libraries(screengrab qkeysequencewidget Qt5::Widgets KF5::WindowSystem) +if(SG_DBUS_NOTIFY) + target_link_libraries(screengrab Qt5::DBus) +endif() + +if (X11_XCB_FOUND) + add_definitions( -DX11_XCB_FOUND="1") + target_link_libraries(screengrab ${X11_XCB_LIBRARIES}) +endif() + +if (XCB_XCB_FOUND) + add_definitions( -DXCB_XCB_FOUND="1") + target_link_libraries(screengrab ${XCB_XCB_LIBRARY}) +endif() + +if (XCB_SHAPE_FOUND) + add_definitions( -DXCB_SHAPE_FOUND="1") + target_link_libraries(screengrab ${XCB_SHAPE_LIBRARY}) +endif() + +if (XCB_XFIXES_FOUND) + add_definitions( -DXCB_XFOXES_FOUND="1") + target_link_libraries(screengrab ${XCB_XFIXES_LIBRARY}) +endif() +target_link_libraries(screengrab qkeysequencewidget Qt5::Widgets KF5::WindowSystem ${X11_LIBRARIES}) # make src.tar.gz add_custom_target(dist @echo create source package) @@ -226,4 +284,4 @@ install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/docs/html" DESTINATION "${CMAKE_I # 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) +install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/img/screengrab.png" DESTINATION "${CMAKE_INSTALL_DATADIR}/icons/hicolor/32x32/apps") diff --git a/README.md b/README.md index efe33f0..d70e355 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,7 @@ You can use some or all of these parameters to customise your build. * **-DCMAKE_INSTALL_PREFIX** - Install prefix for Linux distro. Default setting: "/usr". * **-DSG_XDG_CONFIG_SUPPORT** - Place config files into XDGC_CONFIG_HOME directory (usually - ~/.config/${app_name) ). Default setting: ON. In previous versions the config files were stored in ~/.screengrab (Set this parameter to "OFF" to store the config files here). * **-DSG_EXT_UPLOADS** - Enable uploading screenshots to image hosting services. Default setting: ON. + * **-DSG_DBUS_NOTIFY** - Enable D-Bus notifications. * **-DSG_GLOBALSHORTCUTS** - Enable global shortcuts for main actions to create screenshots. Default setting: ON. * **-DSG_USE_SYSTEM_QXT** - Use system version Qxt Library for global shortcuts. Default setting: OFF. * **-DSG_DOCDIR** - Name for the directory of user's documentation. Default setting: "screengrab". diff --git a/cmake/FindX11_XCB.cmake b/cmake/FindX11_XCB.cmake new file mode 100644 index 0000000..e2c18a9 --- /dev/null +++ b/cmake/FindX11_XCB.cmake @@ -0,0 +1,31 @@ +# - Try to find libX11-xcb +# Once done this will define +# +# X11_XCB_FOUND - system has libX11-xcb +# X11_XCB_LIBRARIES - Link these to use libX11-xcb +# X11_XCB_INCLUDE_DIR - the libX11-xcb include dir +# X11_XCB_DEFINITIONS - compiler switches required for using libX11-xcb + +# Copyright (c) 2011 Fredrik Höglund +# Copyright (c) 2008 Helio Chissini de Castro, +# Copyright (c) 2007 Matthias Kretz, +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +IF (NOT WIN32) + # use pkg-config to get the directories and then use these values + # in the FIND_PATH() and FIND_LIBRARY() calls + FIND_PACKAGE(PkgConfig) + PKG_CHECK_MODULES(PKG_X11_XCB QUIET x11-xcb) + + SET(X11_XCB_DEFINITIONS ${PKG_X11_XCB_CFLAGS}) + + FIND_PATH(X11_XCB_INCLUDE_DIR NAMES X11/Xlib-xcb.h HINTS ${PKG_X11_XCB_INCLUDE_DIRS}) + FIND_LIBRARY(X11_XCB_LIBRARIES NAMES X11-xcb HINTS ${PKG_X11_XCB_LIBRARY_DIRS}) + + include(FindPackageHandleStandardArgs) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(X11_XCB DEFAULT_MSG X11_XCB_LIBRARIES X11_XCB_INCLUDE_DIR) + + MARK_AS_ADVANCED(X11_XCB_INCLUDE_DIR X11_XCB_LIBRARIES) +ENDIF (NOT WIN32) diff --git a/cmake/FindXCB.cmake b/cmake/FindXCB.cmake new file mode 100644 index 0000000..823d167 --- /dev/null +++ b/cmake/FindXCB.cmake @@ -0,0 +1,238 @@ +# Try to find XCB on a Unix system +# +# This will define: +# +# XCB_FOUND - True if xcb is available +# XCB_LIBRARIES - Link these to use xcb +# XCB_INCLUDE_DIRS - Include directory for xcb +# XCB_DEFINITIONS - Compiler flags for using xcb +# +# In addition the following more fine grained variables will be defined: +# +# XCB_XCB_FOUND XCB_XCB_INCLUDE_DIR XCB_XCB_LIBRARY +# XCB_UTIL_FOUND XCB_UTIL_INCLUDE_DIR XCB_UTIL_LIBRARY +# XCB_COMPOSITE_FOUND XCB_COMPOSITE_INCLUDE_DIR XCB_COMPOSITE_LIBRARY +# XCB_DAMAGE_FOUND XCB_DAMAGE_INCLUDE_DIR XCB_DAMAGE_LIBRARY +# XCB_XFIXES_FOUND XCB_XFIXES_INCLUDE_DIR XCB_XFIXES_LIBRARY +# XCB_RENDER_FOUND XCB_RENDER_INCLUDE_DIR XCB_RENDER_LIBRARY +# XCB_RANDR_FOUND XCB_RANDR_INCLUDE_DIR XCB_RANDR_LIBRARY +# XCB_SHAPE_FOUND XCB_SHAPE_INCLUDE_DIR XCB_SHAPE_LIBRARY +# XCB_DRI2_FOUND XCB_DRI2_INCLUDE_DIR XCB_DRI2_LIBRARY +# XCB_GLX_FOUND XCB_GLX_INCLUDE_DIR XCB_GLX_LIBRARY +# XCB_SHM_FOUND XCB_SHM_INCLUDE_DIR XCB_SHM_LIBRARY +# XCB_XV_FOUND XCB_XV_INCLUDE_DIR XCB_XV_LIBRARY +# XCB_SYNC_FOUND XCB_SYNC_INCLUDE_DIR XCB_SYNC_LIBRARY +# XCB_XTEST_FOUND XCB_XTEST_INCLUDE_DIR XCB_XTEST_LIBRARY +# XCB_ICCCM_FOUND XCB_ICCCM_INCLUDE_DIR XCB_ICCCM_LIBRARY +# XCB_EWMH_FOUND XCB_EWMH_INCLUDE_DIR XCB_EWMH_LIBRARY +# XCB_IMAGE_FOUND XCB_IMAGE_INCLUDE_DIR XCB_IMAGE_LIBRARY +# XCB_RENDERUTIL_FOUND XCB_RENDERUTIL_INCLUDE_DIR XCB_RENDERUTIL_LIBRARY +# XCB_KEYSYMS_FOUND XCB_KEYSYMS_INCLUDE_DIR XCB_KEYSYMS_LIBRARY +# +# Copyright (c) 2011 Fredrik Höglund +# Copyright (c) 2013 Martin Gräßlin +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +set(knownComponents XCB + COMPOSITE + DAMAGE + DRI2 + EWMH + GLX + ICCCM + IMAGE + KEYSYMS + RANDR + RENDER + RENDERUTIL + SHAPE + SHM + SYNC + UTIL + XFIXES + XTEST + XV) + +unset(unknownComponents) + +set(pkgConfigModules) +set(requiredComponents) + +if (XCB_FIND_COMPONENTS) + set(comps ${XCB_FIND_COMPONENTS}) +else() + set(comps ${knownComponents}) +endif() + +# iterate through the list of requested components, and check that we know them all. +# If not, fail. +foreach(comp ${comps}) + list(FIND knownComponents ${comp} index ) + if("${index}" STREQUAL "-1") + list(APPEND unknownComponents "${comp}") + else() + if("${comp}" STREQUAL "XCB") + list(APPEND pkgConfigModules "xcb") + elseif("${comp}" STREQUAL "COMPOSITE") + list(APPEND pkgConfigModules "xcb-composite") + elseif("${comp}" STREQUAL "DAMAGE") + list(APPEND pkgConfigModules "xcb-damage") + elseif("${comp}" STREQUAL "DRI2") + list(APPEND pkgConfigModules "xcb-dri2") + elseif("${comp}" STREQUAL "EWMH") + list(APPEND pkgConfigModules "xcb-ewmh") + elseif("${comp}" STREQUAL "GLX") + list(APPEND pkgConfigModules "xcb-glx") + elseif("${comp}" STREQUAL "ICCCM") + list(APPEND pkgConfigModules "xcb-icccm") + elseif("${comp}" STREQUAL "IMAGE") + list(APPEND pkgConfigModules "xcb-image") + elseif("${comp}" STREQUAL "KEYSYMS") + list(APPEND pkgConfigModules "xcb-keysyms") + elseif("${comp}" STREQUAL "RANDR") + list(APPEND pkgConfigModules "xcb-randr") + elseif("${comp}" STREQUAL "RENDER") + list(APPEND pkgConfigModules "xcb-render") + elseif("${comp}" STREQUAL "RENDERUTIL") + list(APPEND pkgConfigModules "xcb-renderutil") + elseif("${comp}" STREQUAL "SHAPE") + list(APPEND pkgConfigModules "xcb-shape") + elseif("${comp}" STREQUAL "SHM") + list(APPEND pkgConfigModules "xcb-shm") + elseif("${comp}" STREQUAL "SYNC") + list(APPEND pkgConfigModules "xcb-sync") + elseif("${comp}" STREQUAL "UTIL") + list(APPEND pkgConfigModules "xcb-util") + elseif("${comp}" STREQUAL "XFIXES") + list(APPEND pkgConfigModules "xcb-xfixes") + elseif("${comp}" STREQUAL "XTEST") + list(APPEND pkgConfigModules "xcb-xtest") + elseif("${comp}" STREQUAL "XV") + list(APPEND pkgConfigModules "xcb-xv") + endif() + endif() +endforeach() + + +if(DEFINED unknownComponents) + set(msgType STATUS) + if(XCB_FIND_REQUIRED) + set(msgType FATAL_ERROR) + endif() + if(NOT XCB_FIND_QUIETLY) + message(${msgType} "XCB: requested unknown components ${unknownComponents}") + endif() + return() +endif() + +macro(_XCB_HANDLE_COMPONENT _comp) + set(_header ) + set(_lib ) + if("${_comp}" STREQUAL "XCB") + set(_header "xcb/xcb.h") + set(_lib "xcb") + elseif("${_comp}" STREQUAL "COMPOSITE") + set(_header "xcb/composite.h") + set(_lib "xcb-composite") + elseif("${_comp}" STREQUAL "DAMAGE") + set(_header "xcb/damage.h") + set(_lib "xcb-damage") + elseif("${_comp}" STREQUAL "DRI2") + set(_header "xcb/dri2.h") + set(_lib "xcb-dri2") + elseif("${_comp}" STREQUAL "EWMH") + set(_header "xcb/xcb_ewmh.h") + set(_lib "xcb-ewmh") + elseif("${_comp}" STREQUAL "GLX") + set(_header "xcb/glx.h") + set(_lib "xcb-glx") + elseif("${_comp}" STREQUAL "ICCCM") + set(_header "xcb/xcb_icccm.h") + set(_lib "xcb-icccm") + elseif("${_comp}" STREQUAL "IMAGE") + set(_header "xcb/xcb_image.h") + set(_lib "xcb-image") + elseif("${_comp}" STREQUAL "KEYSYMS") + set(_header "xcb/xcb_keysyms.h") + set(_lib "xcb-keysyms") + elseif("${_comp}" STREQUAL "RANDR") + set(_header "xcb/randr.h") + set(_lib "xcb-randr") + elseif("${_comp}" STREQUAL "RENDER") + set(_header "xcb/render.h") + set(_lib "xcb-render") + elseif("${_comp}" STREQUAL "RENDERUTIL") + set(_header "xcb/xcb_renderutil.h") + set(_lib "xcb-render-util") + elseif("${_comp}" STREQUAL "SHAPE") + set(_header "xcb/shape.h") + set(_lib "xcb-shape") + elseif("${_comp}" STREQUAL "SHM") + set(_header "xcb/shm.h") + set(_lib "xcb-shm") + elseif("${_comp}" STREQUAL "SYNC") + set(_header "xcb/sync.h") + set(_lib "xcb-sync") + elseif("${_comp}" STREQUAL "UTIL") + set(_header "xcb/xcb_util.h") + set(_lib "xcb-util") + elseif("${_comp}" STREQUAL "XFIXES") + set(_header "xcb/xfixes.h") + set(_lib "xcb-xfixes") + elseif("${_comp}" STREQUAL "XTEST") + set(_header "xcb/xtest.h") + set(_lib "xcb-xtest") + elseif("${_comp}" STREQUAL "XV") + set(_header "xcb/xv.h") + set(_lib "xcb-xv") + endif() + + find_path(XCB_${_comp}_INCLUDE_DIR NAMES ${_header} HINTS ${PKG_XCB_INCLUDE_DIRS}) + find_library(XCB_${_comp}_LIBRARY NAMES ${_lib} HINTS ${PKG_XCB_LIBRARY_DIRS}) + + if(XCB_${_comp}_INCLUDE_DIR AND XCB_${_comp}_LIBRARY) + list(APPEND XCB_INCLUDE_DIRS ${XCB_${_comp}_INCLUDE_DIR}) + list(APPEND XCB_LIBRARIES ${XCB_${_comp}_LIBRARY}) + if (NOT XCB_FIND_QUIETLY) + message(STATUS "XCB[${_comp}]: Found component ${_comp}") + endif() + endif() + + if(XCB_FIND_REQUIRED_${_comp}) + list(APPEND requiredComponents XCB_${_comp}_FOUND) + endif() + + find_package_handle_standard_args(XCB_${_comp} DEFAULT_MSG XCB_${_comp}_LIBRARY XCB_${_comp}_INCLUDE_DIR) + + mark_as_advanced(XCB_${_comp}_LIBRARY XCB_${_comp}_INCLUDE_DIR) + + # compatibility for old variable naming + set(XCB_${_comp}_INCLUDE_DIRS ${XCB_${_comp}_INCLUDE_DIR}) + set(XCB_${_comp}_LIBRARIES ${XCB_${_comp}_LIBRARY}) +endmacro() + +IF (NOT WIN32) + include(FindPackageHandleStandardArgs) + # Use pkg-config to get the directories and then use these values + # in the FIND_PATH() and FIND_LIBRARY() calls + find_package(PkgConfig) + pkg_check_modules(PKG_XCB QUIET ${pkgConfigModules}) + + set(XCB_DEFINITIONS ${PKG_XCB_CFLAGS}) + + foreach(comp ${comps}) + _xcb_handle_component(${comp}) + endforeach() + + if(XCB_INCLUDE_DIRS) + list(REMOVE_DUPLICATES XCB_INCLUDE_DIRS) + endif() + + find_package_handle_standard_args(XCB DEFAULT_MSG XCB_LIBRARIES XCB_INCLUDE_DIRS ${requiredComponents}) + + # compatibility for old variable naming + set(XCB_INCLUDE_DIR ${XCB_INCLUDE_DIRS}) + +ENDIF (NOT WIN32) diff --git a/src/common/qkeysequencewidget/CMakeLists.txt b/src/common/qkeysequencewidget/CMakeLists.txt index 389fbf4..ced0544 100644 --- a/src/common/qkeysequencewidget/CMakeLists.txt +++ b/src/common/qkeysequencewidget/CMakeLists.txt @@ -1,5 +1,3 @@ -cmake_minimum_required(VERSION 2.8.11) - include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src) include_directories(${Qt5Widgets_INCLUDE_DIRS}) diff --git a/src/core/config.cpp b/src/core/config.cpp index a23ac58..774fc52 100644 --- a/src/core/config.cpp +++ b/src/core/config.cpp @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #include "src/core/config.h" @@ -56,6 +54,7 @@ #define KEY_TYPE_SCREEN "typeScreenDefault" #define KEY_ENABLE_EXT_VIEWER "enbaleExternalView" #define KEY_NODECOR "noDecorations" +#define KEY_INCLUDE_CURSOR "includeCursor" Config* Config::ptrInstance = 0; @@ -183,6 +182,16 @@ void Config::setEnableExtView(bool val) setValue(KEY_ENABLE_EXT_VIEWER, val); } +bool Config::getIncludeCursor() +{ + return value(KEY_INCLUDE_CURSOR).toBool(); +} + +void Config::setIncludeCursor(bool val) +{ + setValue(KEY_INCLUDE_CURSOR, val); +} + QString Config::getSaveDir() { return value(KEY_SAVEDIR).toString(); @@ -410,6 +419,7 @@ void Config::loadSettings() setAutoSaveFirst(_settings->value(KEY_AUTOSAVE_FIRST, DEF_AUTO_SAVE_FIRST).toBool()); setNoDecoration(_settings->value(KEY_NODECOR, DEF_X11_NODECOR).toBool()); setImageQuality(_settings->value(KEY_IMG_QUALITY, DEF_IMG_QUALITY).toInt()); + setIncludeCursor(_settings->value(KEY_INCLUDE_CURSOR, DEF_INCLUDE_CURSOR).toBool()); _settings->endGroup(); _settings->beginGroup("Display"); @@ -447,6 +457,7 @@ void Config::saveSettings() _settings->setValue(KEY_AUTOSAVE_FIRST, getAutoSaveFirst()); _settings->setValue(KEY_IMG_QUALITY, getImageQuality()); _settings->setValue(KEY_NODECOR, getNoDecoration()); + _settings->setValue(KEY_INCLUDE_CURSOR, getIncludeCursor()); _settings->endGroup(); _settings->beginGroup("Display"); @@ -482,6 +493,7 @@ void Config::setDefaultSettings() setAutoSave(DEF_AUTO_SAVE); setAutoSaveFirst(DEF_AUTO_SAVE_FIRST); setTrayMessages(DEF_TRAY_MESS_TYPE); + setIncludeCursor(DEF_INCLUDE_CURSOR); setZoomAroundMouse(DEF_ZOOM_AROUND_MOUSE); setCloseInTray(DEF_CLOSE_IN_TRAY); setTimeTrayMess(DEF_TIME_TRAY_MESS); diff --git a/src/core/config.h b/src/core/config.h index b9f4828..6740dc8 100644 --- a/src/core/config.h +++ b/src/core/config.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #ifndef CONFIG_H @@ -50,7 +48,8 @@ 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; +const bool DEF_ENABLE_EXT_VIEWER = true; +const bool DEF_INCLUDE_CURSOR = false; // class worker with conf data class Config @@ -219,6 +218,9 @@ public: bool getEnableExtView(); void setEnableExtView(bool val); + bool getIncludeCursor(); + void setIncludeCursor(bool val); + static QString getSysLang(); ShortcutManager* shortcuts(); diff --git a/src/core/core.cpp b/src/core/core.cpp index 5fa4588..ca5c4e6 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #include @@ -31,8 +29,18 @@ #include -#include "core/core.h" #include +#include + +#ifdef X11_XCB_FOUND +#include "x11utils.h" +#endif + +#include "core/core.h" + +#ifdef SG_DBUS_NOTIFY +#include "dbusnotifier.h" +#endif #ifdef SG_EXT_UPLOADS #include "modules/uploader/moduleuploader.h" @@ -183,6 +191,7 @@ void Core::screenShot(bool first) const QDesktopWidget *desktop = QApplication::desktop(); const int screenNum = desktop->screenNumber(QCursor::pos()); *_pixelMap = screens[screenNum]->grabWindow(desktop->winId()); + grabCursor(0, 0); checkAutoSave(first); _wnd->updatePixmap(_pixelMap); @@ -212,6 +221,8 @@ void Core::screenShot(bool first) break; } + + _wnd->updatePixmap(_pixelMap); _wnd->restoreFromShot(); } @@ -234,7 +245,7 @@ void Core::checkAutoSave(bool first) if (!first) { StateNotifyMessage message(tr("New screen"), tr("New screen is getted!")); - _wnd->showTrayMessage(message.header, message.message); + sendNotify(message); } } } @@ -270,7 +281,26 @@ void Core::getActiveWindow() geometry.x(), geometry.y(), geometry.width(), - geometry.height()); + geometry.height()); + grabCursor(geometry.x(), geometry.y()); +} + +void Core::grabCursor(int offsetX, int offsetY) +{ +#ifdef XCB_XFOXES_FOUND + if (_conf->getIncludeCursor()) + X11Utils::compositePointer(offsetX, offsetY, _pixelMap); +#else + Q_UNUSED(offsetx); + Q_UNUSED(offsety); +#endif + + +} + +void Core::sendSystemNotify(const StateNotifyMessage ¬ify) +{ + qDebug() << "Send system notification"; } QString Core::getSaveFilePath(QString format) @@ -377,7 +407,7 @@ bool Core::writeScreen(QString& fileName, QString& format, bool tmpScreen) message.message = message.message + copyFileNameToCliipboard(fileName); _conf->updateLastSaveDate(); - _wnd->showTrayMessage(message.header, message.message); + sendNotify(message); } else qWarning() << "Error saving file " << fileName; @@ -410,11 +440,21 @@ QString Core::copyFileNameToCliipboard(QString file) return retString; } +void Core::sendNotify(const StateNotifyMessage &message) +{ +#ifdef SG_DBUS_NOTIFY + DBusNotifier *notifier = new DBusNotifier(); + notifier->displayNotify(message); +#else + _wnd->showTrayMessage(message.header, message.message); +#endif +} + void Core::copyScreen() { QApplication::clipboard()->setPixmap(*_pixelMap, QClipboard::Clipboard); StateNotifyMessage message(tr("Copied"), tr("Screenshot is copied to clipboard")); - _wnd->showTrayMessage(message.header, message.message); + sendNotify(message); } void Core::openInExtViewer() @@ -519,7 +559,7 @@ QPixmap* Core::getPixmap() return _pixelMap; } -QByteArray Core::getScreen() +QByteArray Core::getScreenData() { QByteArray bytes; QBuffer buffer(&bytes); diff --git a/src/core/core.h b/src/core/core.h index d606d5c..041b980 100644 --- a/src/core/core.h +++ b/src/core/core.h @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #ifndef SCREENGRAB_H #define SCREENGRAB_H @@ -26,7 +24,6 @@ #include "config.h" #include "regionselect.h" - #include "modulemanager.h" #include "ui/mainwindow.h" @@ -84,7 +81,7 @@ public: static QString getVersionPrintable(); QPixmap* getPixmap(); - QByteArray getScreen(); + QByteArray getScreenData(); void updatePixmap(); QString getTempFilename(const QString& format); @@ -115,9 +112,12 @@ private: void checkAutoSave(bool first = false); void getActiveWindow(); - + void grabCursor(int offsetX, int offsetY); + void sendSystemNotify(const StateNotifyMessage& notify); bool checkExsistFile(QString path); QString copyFileNameToCliipboard(QString file); + void sendNotify(const StateNotifyMessage& message); + QPixmap *_pixelMap; // pixel map RegionSelect *_selector; // region grabber widget QRect _lastSelectedArea; diff --git a/src/core/dbusnotifier.cpp b/src/core/dbusnotifier.cpp new file mode 100644 index 0000000..d022095 --- /dev/null +++ b/src/core/dbusnotifier.cpp @@ -0,0 +1,106 @@ +/*************************************************************************** + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * doomer3d@gmail.com * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +#include +#include +#include +#include +#include + +#include + +#include "dbusnotifier.h" + +#include "config.h" + +#define SERVICE_FREEDESKTOP "org.freedesktop.Notifications" +#define PATH_FREEDESKTOP "/org/freedesktop/Notifications" ,"org.freedesktop.Notifications" + +#define CACHE_DIR "notify-cache" +#define CACHE_PREV "preview.jpg" + +DBusNotifier::DBusNotifier(QObject *parent) : QObject(parent) +{ + _notifier = new QDBusInterface(SERVICE_FREEDESKTOP, PATH_FREEDESKTOP, + QDBusConnection::sessionBus(), this); + if (_notifier->lastError().type() != QDBusError::NoError) { + qWarning() << "Notify: Unable to create interface."; + return; + } + + qWarning() << "Notify: DBus interfece created successfully."; + + QDir dir(Config::getConfigDir()); + if (!dir.exists(CACHE_DIR)) + dir.mkdir(CACHE_DIR); + + _previewPath = dir.absolutePath() + QDir::toNativeSeparators(QDir::separator()) + CACHE_PREV; + _appIconPath = QString(SG_ICONPATH); + + _notifyDuration = Config::instance()->getTimeTrayMess() * 1000; + +} + +DBusNotifier::~DBusNotifier() +{ + if (!_previewPath.isEmpty()) { + QDir dir(QDir::home()); + dir.remove(_previewPath); + } +} + + +void DBusNotifier::displayNotify(const StateNotifyMessage &message) +{ + QList n = prepareNotification(message); + + if (!n.isEmpty()) { + QDBusReply reply = _notifier->callWithArgumentList(QDBus::Block,"Notify",n); + } + + deleteLater(); +} + +QList DBusNotifier::prepareNotification(const StateNotifyMessage& message) +{ + QList args; + + args << "Screen Grab"; + args << QVariant(QVariant::UInt); // id + + // app-icon(path to icon on disk) + args << _appIconPath; + + // summary (notification title) + args << message.header; + + // message text + args << message.message; + + // actions is none + args << QStringList(); + + // hints + args << QVariantMap(); + + // timeout + args << _notifyDuration; + + return args; +} + diff --git a/src/core/dbusnotifier.h b/src/core/dbusnotifier.h new file mode 100644 index 0000000..3bb8148 --- /dev/null +++ b/src/core/dbusnotifier.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, see . * + ***************************************************************************/ + +#ifndef DBUSNOTIFIER_H +#define DBUSNOTIFIER_H + +#include + +#include "core.h" + +class QDBusInterface; + +class DBusNotifier : public QObject +{ + Q_OBJECT +public: + explicit DBusNotifier(QObject *parent = 0); + ~DBusNotifier(); + + void displayNotify(const StateNotifyMessage& message); + +private: + QList prepareNotification(const StateNotifyMessage& message); + + QDBusInterface *_notifier; + int _notifyDuration; + QString _appIconPath; + QString _previewPath; +}; + +#endif // DBUSNOTIFIER_H diff --git a/src/core/main.cpp b/src/core/main.cpp index 24a533c..8b45656 100644 --- a/src/core/main.cpp +++ b/src/core/main.cpp @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #include "singleapp.h" diff --git a/src/core/modulemanager.cpp b/src/core/modulemanager.cpp index b2273b3..8778e93 100644 --- a/src/core/modulemanager.cpp +++ b/src/core/modulemanager.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #include "modulemanager.h" diff --git a/src/core/modulemanager.h b/src/core/modulemanager.h index b11c6bc..6ae7cfb 100644 --- a/src/core/modulemanager.h +++ b/src/core/modulemanager.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #ifndef MODULEMANAGER_H diff --git a/src/core/regionselect.cpp b/src/core/regionselect.cpp index f7d94e7..8a10455 100644 --- a/src/core/regionselect.cpp +++ b/src/core/regionselect.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #include "src/core/regionselect.h" diff --git a/src/core/regionselect.h b/src/core/regionselect.h index 7baf17e..56ecf22 100644 --- a/src/core/regionselect.h +++ b/src/core/regionselect.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #ifndef REGIONSELECT_H diff --git a/src/core/shortcutmanager.cpp b/src/core/shortcutmanager.cpp index 437c99a..c457872 100644 --- a/src/core/shortcutmanager.cpp +++ b/src/core/shortcutmanager.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #include "shortcutmanager.h" diff --git a/src/core/shortcutmanager.h b/src/core/shortcutmanager.h index e4adef8..6f77b8a 100644 --- a/src/core/shortcutmanager.h +++ b/src/core/shortcutmanager.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #ifndef SHORTCUTMANAGER_H diff --git a/src/core/singleapp.cpp b/src/core/singleapp.cpp index ed60db0..a1de86a 100644 --- a/src/core/singleapp.cpp +++ b/src/core/singleapp.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2010 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2010 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #include diff --git a/src/core/singleapp.h b/src/core/singleapp.h index 3a6ed13..c162a57 100644 --- a/src/core/singleapp.h +++ b/src/core/singleapp.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2010 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2010 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #ifndef SINGLEAPP_H diff --git a/src/core/ui/about.cpp b/src/core/ui/about.cpp index f3ee334..33f2b15 100644 --- a/src/core/ui/about.cpp +++ b/src/core/ui/about.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #include "about.h" diff --git a/src/core/ui/about.h b/src/core/ui/about.h index 8aa641b..5797e68 100644 --- a/src/core/ui/about.h +++ b/src/core/ui/about.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #ifndef ABOUT_H diff --git a/src/core/ui/configwidget.cpp b/src/core/ui/configwidget.cpp index ccc38f2..3fb63b7 100644 --- a/src/core/ui/configwidget.cpp +++ b/src/core/ui/configwidget.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,10 +13,8 @@ * 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. * - ***************************************************************************/ + * along with this program. If not, see . * +***************************************************************************/ #include @@ -167,8 +165,8 @@ void ConfigDialog::loadSettings() _ui->checkAutoSave->setChecked(conf->getAutoSave());; _ui->checkAutoSaveFirst->setChecked(conf->getAutoSaveFirst());; _ui->checkZommMouseArea->setChecked(conf->getZoomAroundMouse()); + _ui->cbxIncludeCursor->setChecked(conf->getIncludeCursor()); - // integration tab _ui->checkInTray->setChecked(conf->getCloseInTray()); _ui->checkAllowCopies->setChecked(conf->getAllowMultipleInstance()); @@ -261,6 +259,7 @@ void ConfigDialog::saveSettings() conf->setAutoSaveFirst(_ui->checkAutoSaveFirst->isChecked()); conf->setTrayMessages(_ui->cbxTrayMsg->currentIndex()); conf->setCloseInTray(_ui->checkInTray->isChecked()); + conf->setIncludeCursor(_ui->cbxIncludeCursor->isChecked()); conf->setZoomAroundMouse(_ui->checkZommMouseArea->isChecked()); conf->setAllowMultipleInstance(_ui->checkAllowCopies->isChecked()); conf->setTimeTrayMess(_ui->timeTrayMess->value()); diff --git a/src/core/ui/configwidget.h b/src/core/ui/configwidget.h index 5c9ff5f..1f0033c 100644 --- a/src/core/ui/configwidget.h +++ b/src/core/ui/configwidget.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #ifndef CONFIGWIDGET_H diff --git a/src/core/ui/configwidget.ui b/src/core/ui/configwidget.ui index 8cc8133..181a70b 100644 --- a/src/core/ui/configwidget.ui +++ b/src/core/ui/configwidget.ui @@ -6,8 +6,8 @@ 0 0 - 554 - 278 + 634 + 294 @@ -106,7 +106,7 @@ - 3 + 0 @@ -368,6 +368,13 @@ + + + + Include mouse pointer + + + diff --git a/src/core/ui/mainwindow.cpp b/src/core/ui/mainwindow.cpp index f67af6b..13bed8e 100644 --- a/src/core/ui/mainwindow.cpp +++ b/src/core/ui/mainwindow.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,10 +13,8 @@ * 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. * - ***************************************************************************/ + * along with this program. If not, see . * +***************************************************************************/ #include "mainwindow.h" #include "ui_mainwindow.h" @@ -96,12 +94,18 @@ MainWindow::MainWindow(QWidget* parent) : QMainWindow(parent), help->setMenu(menuInfo); _ui->toolBar->addWidget(help); + + QWidget* spacer = new QWidget(); + spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + _ui->toolBar->addWidget(spacer); + _ui->toolBar->addAction(actQuit); void (QSpinBox::*delayChange)(int) = &QSpinBox::valueChanged; connect(_ui->delayBox, delayChange, this, &MainWindow::delayBoxChange); void (QComboBox::*typeScr)(int) = &QComboBox::currentIndexChanged; connect(_ui->cbxTypeScr, typeScr, this, &MainWindow::typeScreenShotChange); + connect(_ui->checkIncludeCursor, &QCheckBox::toggled, this, &MainWindow::checkIncludeCursor); QIcon icon(":/res/img/logo.png"); setWindowIcon(icon); @@ -398,11 +402,17 @@ void MainWindow::typeScreenShotChange(int type) _conf->setTypeScreen(type); } +void MainWindow::checkIncludeCursor(bool include) +{ + _conf->setIncludeCursor(include); +} + // updating UI from configdata void MainWindow::updateUI() { _ui->cbxTypeScr->setCurrentIndex(_conf->getTypeScreen()); _ui->delayBox->setValue(_conf->getDelay()); + _ui->checkIncludeCursor->setChecked(_conf->getIncludeCursor()); updateShortcuts(); diff --git a/src/core/ui/mainwindow.h b/src/core/ui/mainwindow.h index 64feb8b..7a774a9 100644 --- a/src/core/ui/mainwindow.h +++ b/src/core/ui/mainwindow.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #ifndef MAINWINDOW_H @@ -106,6 +104,7 @@ private Q_SLOTS: void showAbout(); void delayBoxChange(int); void typeScreenShotChange(int type); + void checkIncludeCursor(bool include); void updateUI(); void trayClick(QSystemTrayIcon::ActivationReason reason); diff --git a/src/core/ui/mainwindow.ui b/src/core/ui/mainwindow.ui index 8228725..af1abe3 100644 --- a/src/core/ui/mainwindow.ui +++ b/src/core/ui/mainwindow.ui @@ -7,7 +7,7 @@ 0 0 480 - 299 + 343 @@ -30,9 +30,6 @@ Qt::RightToLeft - - QLayout::SetMaximumSize - @@ -201,6 +198,43 @@ + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Include mouse pointer + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + diff --git a/src/core/x11utils.cpp b/src/core/x11utils.cpp new file mode 100644 index 0000000..23a60a0 --- /dev/null +++ b/src/core/x11utils.cpp @@ -0,0 +1,43 @@ +/*************************************************************************** + * Copyright (C) 2010 - 2013 by Artem 'DOOMer' Galichkin * + * doomer3d@gmail.com * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +#include "x11utils.h" + +#include + +#include +#include + +void X11Utils::compositePointer(int offsetX, int offsetY, QPixmap *snapshot) +{ + Xcb::ScopedCPointer cursor( + xcb_xfixes_get_cursor_image_reply(Xcb::connection(), + xcb_xfixes_get_cursor_image_unchecked(Xcb::connection()), + NULL)); + + if (cursor.isNull()) { + return; + } + + QImage qcursorimg((uchar *) xcb_xfixes_get_cursor_image_cursor_image(cursor.data()), + cursor->width, cursor->height, + QImage::Format_ARGB32_Premultiplied); + + QPainter painter(snapshot); + painter.drawImage(QPointF(cursor->x - cursor->xhot - offsetX, cursor->y - cursor ->yhot - offsetY), qcursorimg); +} diff --git a/src/core/x11utils.h b/src/core/x11utils.h new file mode 100644 index 0000000..f30de39 --- /dev/null +++ b/src/core/x11utils.h @@ -0,0 +1,50 @@ +/*************************************************************************** + * Copyright (C) 2010 - 2013 by Artem 'DOOMer' Galichkin * + * doomer3d@gmail.com * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + +#ifndef X11UTILS_H +#define X11UTILS_H + +#include +#include +#include + +#include +#include +#include + +namespace X11Utils { + void compositePointer(int offsetX, int offsetY, QPixmap *snapshot); +} + + +namespace Xcb { + template + class ScopedCPointer : public QScopedPointer + { + public: + ScopedCPointer(T *p = 0) : QScopedPointer(p) {} + }; + + inline xcb_connection_t *connection() + { + return XGetXCBConnection(QX11Info::display()); + } +} // namespace Xcb + +#endif // X11UTILS_H + diff --git a/src/modules/abstractmodule.h b/src/modules/abstractmodule.h index e75771b..bef4723 100644 --- a/src/modules/abstractmodule.h +++ b/src/modules/abstractmodule.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #ifndef ABSTRACTMODULE_H diff --git a/src/modules/extedit/CMakeLists.txt b/src/modules/extedit/CMakeLists.txt index 5d26626..3b56ea1 100644 --- a/src/modules/extedit/CMakeLists.txt +++ b/src/modules/extedit/CMakeLists.txt @@ -1,5 +1,3 @@ -cmake_minimum_required(VERSION 2.8.11) - set (extedit_SRC moduleextedit.cpp extedit.cpp @@ -34,4 +32,4 @@ add_library(extedit 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}) +target_link_libraries(extedit Qt5::Widgets Qt5::X11Extras Qt5Xdg) diff --git a/src/modules/extedit/extedit.cpp b/src/modules/extedit/extedit.cpp index dcdac7b..aea43d9 100644 --- a/src/modules/extedit/extedit.cpp +++ b/src/modules/extedit/extedit.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #include "extedit.h" diff --git a/src/modules/extedit/extedit.h b/src/modules/extedit/extedit.h index e2c666c..41cc737 100644 --- a/src/modules/extedit/extedit.h +++ b/src/modules/extedit/extedit.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #ifndef EXTEDIT_H diff --git a/src/modules/extedit/moduleextedit.cpp b/src/modules/extedit/moduleextedit.cpp index 054d36a..09eb09b 100644 --- a/src/modules/extedit/moduleextedit.cpp +++ b/src/modules/extedit/moduleextedit.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,10 +13,8 @@ * 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. * - ***************************************************************************/ + * along with this program. If not, see . * +***************************************************************************/ #include "moduleextedit.h" diff --git a/src/modules/extedit/moduleextedit.h b/src/modules/extedit/moduleextedit.h index cefae82..90f7a90 100644 --- a/src/modules/extedit/moduleextedit.h +++ b/src/modules/extedit/moduleextedit.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #ifndef MODULEEXTEDIT_H diff --git a/src/modules/uploader/CMakeLists.txt b/src/modules/uploader/CMakeLists.txt index d2f3a96..fbd6b7f 100644 --- a/src/modules/uploader/CMakeLists.txt +++ b/src/modules/uploader/CMakeLists.txt @@ -1,5 +1,3 @@ -cmake_minimum_required(VERSION 2.8.11) - set(uploader_SRC moduleuploader.cpp uploader.cpp diff --git a/src/modules/uploader/dialoguploader.cpp b/src/modules/uploader/dialoguploader.cpp index cd727e3..ccf84c1 100644 --- a/src/modules/uploader/dialoguploader.cpp +++ b/src/modules/uploader/dialoguploader.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #include "dialoguploader.h" diff --git a/src/modules/uploader/dialoguploader.h b/src/modules/uploader/dialoguploader.h index 33c7fc7..9b1c1b0 100644 --- a/src/modules/uploader/dialoguploader.h +++ b/src/modules/uploader/dialoguploader.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #ifndef DIALOGUPLOADER_H diff --git a/src/modules/uploader/imgur/uploader_imgur.cpp b/src/modules/uploader/imgur/uploader_imgur.cpp index 17ef49c..5fd5b52 100644 --- a/src/modules/uploader/imgur/uploader_imgur.cpp +++ b/src/modules/uploader/imgur/uploader_imgur.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #include "uploader_imgur.h" diff --git a/src/modules/uploader/imgur/uploader_imgur.h b/src/modules/uploader/imgur/uploader_imgur.h index 85a152b..a113932 100644 --- a/src/modules/uploader/imgur/uploader_imgur.h +++ b/src/modules/uploader/imgur/uploader_imgur.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #ifndef UPLOADER_IMGUR_H diff --git a/src/modules/uploader/imgur/uploader_imgur_widget.cpp b/src/modules/uploader/imgur/uploader_imgur_widget.cpp index 8be1832..b3bf0c7 100644 --- a/src/modules/uploader/imgur/uploader_imgur_widget.cpp +++ b/src/modules/uploader/imgur/uploader_imgur_widget.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #include "uploader_imgur_widget.h" diff --git a/src/modules/uploader/imgur/uploader_imgur_widget.h b/src/modules/uploader/imgur/uploader_imgur_widget.h index f3e39b1..b5e0382 100644 --- a/src/modules/uploader/imgur/uploader_imgur_widget.h +++ b/src/modules/uploader/imgur/uploader_imgur_widget.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #ifndef UPLOADER_IMGUR_WIDGET_H diff --git a/src/modules/uploader/imgur/uploaderconfigwidget_imgur.cpp b/src/modules/uploader/imgur/uploaderconfigwidget_imgur.cpp index 4242f2f..f34757a 100644 --- a/src/modules/uploader/imgur/uploaderconfigwidget_imgur.cpp +++ b/src/modules/uploader/imgur/uploaderconfigwidget_imgur.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #include "uploaderconfigwidget_imgur.h" diff --git a/src/modules/uploader/imgur/uploaderconfigwidget_imgur.h b/src/modules/uploader/imgur/uploaderconfigwidget_imgur.h index 8a5d59f..a5608b6 100644 --- a/src/modules/uploader/imgur/uploaderconfigwidget_imgur.h +++ b/src/modules/uploader/imgur/uploaderconfigwidget_imgur.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #ifndef UPLOADERCONFIGWIDGET_IMGUR_H diff --git a/src/modules/uploader/mediacrush/uploader_mediacrush.cpp b/src/modules/uploader/mediacrush/uploader_mediacrush.cpp index daebc39..c56a701 100644 --- a/src/modules/uploader/mediacrush/uploader_mediacrush.cpp +++ b/src/modules/uploader/mediacrush/uploader_mediacrush.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #include "uploader_mediacrush.h" @@ -24,6 +22,8 @@ #include #include +#include "uploaderconfig.h" + #include Uploader_MediaCrush::Uploader_MediaCrush(const QString& format, QObject* parent): Uploader(parent) @@ -64,7 +64,10 @@ void Uploader_MediaCrush::setCurrentFormat(const QString& format) */ QUrl Uploader_MediaCrush::apiUrl() { - return QUrl("https://mediacru.sh/api/upload/file"); + UploaderConfig config; + // QUrl("https://mediacru.sh/api/upload/file") + + return config.loadSingleParam("mediacru.sh", KEY_MCSH_URL).toUrl(); } /*! diff --git a/src/modules/uploader/mediacrush/uploader_mediacrush.h b/src/modules/uploader/mediacrush/uploader_mediacrush.h index 322d6aa..3f15c51 100644 --- a/src/modules/uploader/mediacrush/uploader_mediacrush.h +++ b/src/modules/uploader/mediacrush/uploader_mediacrush.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #ifndef UPLOADER_MEDIACRUSH_H diff --git a/src/modules/uploader/mediacrush/uploader_mediacrush_widget.cpp b/src/modules/uploader/mediacrush/uploader_mediacrush_widget.cpp index bf3ca44..20de3bc 100644 --- a/src/modules/uploader/mediacrush/uploader_mediacrush_widget.cpp +++ b/src/modules/uploader/mediacrush/uploader_mediacrush_widget.cpp @@ -1,3 +1,21 @@ +/*************************************************************************** + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * doomer3d@gmail.com * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + #include "uploader_mediacrush_widget.h" #include "ui_uploader_mediacrush_widget.h" diff --git a/src/modules/uploader/mediacrush/uploader_mediacrush_widget.h b/src/modules/uploader/mediacrush/uploader_mediacrush_widget.h index eb57c7c..6b8397b 100644 --- a/src/modules/uploader/mediacrush/uploader_mediacrush_widget.h +++ b/src/modules/uploader/mediacrush/uploader_mediacrush_widget.h @@ -1,3 +1,21 @@ +/*************************************************************************** + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * doomer3d@gmail.com * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + #ifndef UPLOADER_MEDIACRUSH_WIDGET_H #define UPLOADER_MEDIACRUSH_WIDGET_H diff --git a/src/modules/uploader/mediacrush/uploaderconfigwidget_mediacrush.cpp b/src/modules/uploader/mediacrush/uploaderconfigwidget_mediacrush.cpp index 0621441..0dcdf89 100644 --- a/src/modules/uploader/mediacrush/uploaderconfigwidget_mediacrush.cpp +++ b/src/modules/uploader/mediacrush/uploaderconfigwidget_mediacrush.cpp @@ -1,14 +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, see . * + ***************************************************************************/ + #include "uploaderconfigwidget_mediacrush.h" #include "ui_uploaderconfigwidget_mediacrush.h" +#include "uploaderconfig.h" + +#include + UploaderConfigWidget_MediaCrush::UploaderConfigWidget_MediaCrush(QWidget *parent) : QWidget(parent), ui(new Ui::UploaderConfigWidget_MediaCrush) { ui->setupUi(this); + + // load settings + UploaderConfig config; + + QVariantMap loadedValues; + loadedValues.insert(KEY_MCSH_URL, ""); + + loadedValues = config.loadSettings("mediacru.sh", loadedValues); + ui->editUrl->setText(loadedValues[KEY_MCSH_URL].toString()); + } UploaderConfigWidget_MediaCrush::~UploaderConfigWidget_MediaCrush() { delete ui; } + +void UploaderConfigWidget_MediaCrush::saveSettings() +{ + UploaderConfig config; + + QVariantMap savingValues; + savingValues.insert(KEY_MCSH_URL, ui->editUrl->text()); + + config.saveSettings("mediacru.sh", savingValues); +} diff --git a/src/modules/uploader/mediacrush/uploaderconfigwidget_mediacrush.h b/src/modules/uploader/mediacrush/uploaderconfigwidget_mediacrush.h index 9fe701d..533e6a8 100644 --- a/src/modules/uploader/mediacrush/uploaderconfigwidget_mediacrush.h +++ b/src/modules/uploader/mediacrush/uploaderconfigwidget_mediacrush.h @@ -1,3 +1,21 @@ +/*************************************************************************** + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * doomer3d@gmail.com * + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + ***************************************************************************/ + #ifndef UPLOADERCONFIGWIDGET_MEDIACRUSH_H #define UPLOADERCONFIGWIDGET_MEDIACRUSH_H @@ -15,6 +33,9 @@ public: explicit UploaderConfigWidget_MediaCrush(QWidget *parent = 0); ~UploaderConfigWidget_MediaCrush(); +public Q_SLOTS: + void saveSettings(); + private: Ui::UploaderConfigWidget_MediaCrush *ui; }; diff --git a/src/modules/uploader/mediacrush/uploaderconfigwidget_mediacrush.ui b/src/modules/uploader/mediacrush/uploaderconfigwidget_mediacrush.ui index 03e6839..2685a18 100644 --- a/src/modules/uploader/mediacrush/uploaderconfigwidget_mediacrush.ui +++ b/src/modules/uploader/mediacrush/uploaderconfigwidget_mediacrush.ui @@ -29,24 +29,44 @@ Qt::Vertical + + QSizePolicy::Minimum + 20 - 87 + 10 - + - Now is nothing yet + URL forupload Qt::AlignCenter + + + + + + + Central server MediaCrush is down, but you can set up self-hosted instance. And add here url to it. + + + + + + + e.g. "https://mediacru.sh/api/upload/file" + + + diff --git a/src/modules/uploader/moduleuploader.cpp b/src/modules/uploader/moduleuploader.cpp index 1c7ddec..344fe72 100644 --- a/src/modules/uploader/moduleuploader.cpp +++ b/src/modules/uploader/moduleuploader.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #include "moduleuploader.h" diff --git a/src/modules/uploader/moduleuploader.h b/src/modules/uploader/moduleuploader.h index 9a7ac29..440d81e 100644 --- a/src/modules/uploader/moduleuploader.h +++ b/src/modules/uploader/moduleuploader.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #ifndef MODULEUPLOADER_H diff --git a/src/modules/uploader/uploader.cpp b/src/modules/uploader/uploader.cpp index f000ea6..40e9200 100644 --- a/src/modules/uploader/uploader.cpp +++ b/src/modules/uploader/uploader.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #include "uploader.h" @@ -159,11 +157,11 @@ void Uploader::createData(bool inBase64) if (inBase64 == false) { - imageData = core->getScreen(); + imageData = core->getScreenData(); } else { - imageData = core->getScreen().toBase64(); + imageData = core->getScreenData().toBase64(); } core->killTempFile(); } diff --git a/src/modules/uploader/uploader.h b/src/modules/uploader/uploader.h index 666c64c..7b49ad4 100644 --- a/src/modules/uploader/uploader.h +++ b/src/modules/uploader/uploader.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #ifndef UPLOADER_H diff --git a/src/modules/uploader/uploaderconfig.cpp b/src/modules/uploader/uploaderconfig.cpp index fe3bd3c..4fa075f 100644 --- a/src/modules/uploader/uploaderconfig.cpp +++ b/src/modules/uploader/uploaderconfig.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #include "uploaderconfig.h" @@ -28,7 +26,10 @@ // common defaults #define DEF_AUTO_COPY_RESULT_LIMK false -#define DEF_DEFAULT_HOST "MediaCrush" +#define DEF_DEFAULT_HOST "Imgur" + +// mediacru.sh settings +#define DEF_MCSH_URL "https://mediacru.sh/api/upload/file" QStringList UploaderConfig::_labelsList = QStringList() << "MediaCrush" << "Imgur"; @@ -103,8 +104,13 @@ void UploaderConfig::defaultSettings() _settings->setValue(KEY_DEFAULT_HOST, DEF_DEFAULT_HOST); _settings->endGroup(); - // imgur.com settings + // mediacru.sh settings _settings->beginGroup(_groupsList[0]); + _settings->setValue(KEY_MCSH_URL, DEF_MCSH_URL); + _settings->endGroup(); + + // imgur.com settings + _settings->beginGroup(_groupsList[1]); _settings->endGroup(); } diff --git a/src/modules/uploader/uploaderconfig.h b/src/modules/uploader/uploaderconfig.h index 9d074d6..6b0fff5 100644 --- a/src/modules/uploader/uploaderconfig.h +++ b/src/modules/uploader/uploaderconfig.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #ifndef UPLOADERCONFIG_H @@ -30,6 +28,9 @@ #define KEY_AUTO_COPY_RESULT_LIMK "autoCopyDirectLink" #define KEY_DEFAULT_HOST "defaultHost" +// Uploader config file mediacru.sh keys +#define KEY_MCSH_URL "uploadUrl" + class UploaderConfig { diff --git a/src/modules/uploader/uploaderconfigwidget.cpp b/src/modules/uploader/uploaderconfigwidget.cpp index 33dac20..0536661 100644 --- a/src/modules/uploader/uploaderconfigwidget.cpp +++ b/src/modules/uploader/uploaderconfigwidget.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #include "uploaderconfigwidget.h" @@ -50,6 +48,8 @@ UploaderConfigWidget::UploaderConfigWidget(QWidget *parent) : void (QComboBox::*hostChanged)(int) = &QComboBox::currentIndexChanged; connect(_ui->cbxHosts, hostChanged, _ui->stackedHosts, &QStackedWidget::setCurrentIndex); + + _ui->stackedHosts->setCurrentIndex(_ui->cbxDefaultHost->currentIndex()); } UploaderConfigWidget::~UploaderConfigWidget() @@ -83,6 +83,7 @@ void UploaderConfigWidget::loadSettings() _ui->cbxDefaultHost->setCurrentIndex(index); } + _ui->cbxHosts->setCurrentIndex(_ui->cbxDefaultHost->currentIndex()); _ui->checkAutoCopyMainLink->setChecked(loadValues["autoCopyDirectLink"].toBool()); } @@ -99,7 +100,7 @@ void UploaderConfigWidget::saveSettings() config.saveSettings("common", savingValues); QMetaObject::invokeMethod(_imgur, "saveSettings"); - + QMetaObject::invokeMethod(_crush, "saveSettings"); } void UploaderConfigWidget::changeEvent(QEvent *e) diff --git a/src/modules/uploader/uploaderconfigwidget.h b/src/modules/uploader/uploaderconfigwidget.h index aea00c8..63eb96d 100644 --- a/src/modules/uploader/uploaderconfigwidget.h +++ b/src/modules/uploader/uploaderconfigwidget.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * + * Copyright (C) 2009 - 2013 by Artem 'DOOMer' Galichkin * * doomer3d@gmail.com * * * * This program is free software; you can redistribute it and/or modify * @@ -13,9 +13,7 @@ * 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. * + * along with this program. If not, see . * ***************************************************************************/ #ifndef UPLOADERCONFIGWIDGET_H diff --git a/src/modules/uploader/uploaderconfigwidget.ui b/src/modules/uploader/uploaderconfigwidget.ui index 2d73cf7..7147a27 100644 --- a/src/modules/uploader/uploaderconfigwidget.ui +++ b/src/modules/uploader/uploaderconfigwidget.ui @@ -17,7 +17,7 @@ - 0 + 1 diff --git a/translations/screengrab_it.desktop b/translations/screengrab_it.desktop new file mode 100644 index 0000000..937e266 --- /dev/null +++ b/translations/screengrab_it.desktop @@ -0,0 +1,3 @@ +# Translations +Comment[it]=Catturare schermate e condividerle in rete +GenericName[it]=Cattura schermata diff --git a/translations/screengrab_it_IT.ts b/translations/screengrab_it_IT.ts index 4dc7bf4..eb6285d 100644 --- a/translations/screengrab_it_IT.ts +++ b/translations/screengrab_it_IT.ts @@ -6,12 +6,12 @@ built on - compilato in + compilato il using Qt - usando QT + usando le librerie QT @@ -26,63 +26,64 @@ Licensed under the - Rilasciato sotto licensa + Rilasciato sotto licenza E-Mail - + email Help us - + Contribuisci Web site - + Sito web Copyright &copy; 2009-2013, Artem 'DOOMer' Galichkin - Copyright &copy; 2009-2010, Artem 'DOOMer' Galichkin {2009-2012,?} {2009-2013,?} + copyright updated to 2015, ok? + Copyright &copy; 2009-2015, Artem 'DOOMer' Galichkin What you can do? - + Cosa puoi fare? is a crossplatform application for fast creating screenshots of your desktop. - + è una applicazione per catturare velocemente schermate per tutte le piattaforme. 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' una applicazione leggera e e potente ed è stato scritta usando il Qt-framework, così puoi usarla in Windows e Linux You can join us and help us if you want. This is an invitation if you like this application. - + Se ti piace questa applicazione puoi aiutarci! Translate ScreenGrab to other languages - + Puoi tradurre ScreenGrab in altre lingue Make suggestions for next releases - + Fai proposte per le prossime versioni Report bugs and issues - + Segnala problemi e bug @@ -117,7 +118,7 @@ Spanish translation - + @@ -127,22 +128,22 @@ Italian translation - + Traduziona italiana Testing: - + Test: Dual monitor support and other in Linux - + Supporto per due monitor e altro in Linux Dual monitor support in Linux - + Supporto dual monitor in Linux @@ -152,7 +153,7 @@ old win32-build [Windows Vista] - + win32-build vecchio[Windows Vista] @@ -176,12 +177,12 @@ Directory %1 does not exist. Do you want to create it? - + La cartella %1 non esiste. Vuoi crearla? Do you want to reset the settings to the defaults? - + Vuoi ripristinare la configurazione iniziale? @@ -196,12 +197,12 @@ This key is already used in your system! Please select another. - + Questa scorciatoia è già in uso. Seleziona un altra per favore. This key is already used in ScreenGrab! Please select another. - + Questa scorciatoia è già usata in ScreenGrab. Seleziona un altra. @@ -234,7 +235,7 @@ Name of saved file is copied to the clipboard - + Il nome del file salvato è stato copiato negli appunti @@ -249,7 +250,7 @@ Path to saved file is copied to the clipboard - + Il percorso del file salvato è stato copiato negli appunti @@ -296,7 +297,7 @@ Full screen - Tutto schermo + Schermo intero @@ -311,12 +312,12 @@ Previous selection - + Selezione precedente toolBar - + Barra degli strumenti Getting new screenshot @@ -415,12 +416,12 @@ Screenshot - + Schermata Double click for open screenshot in external default image viewer - + Doppio clic per aprire la cattura in un editor esterno @@ -507,7 +508,7 @@ un tasto qualsiasi o usando il tasto destro o centrale del mouse. Insert current date and time in file name - + Inserisci data e ora nel nome del file @@ -522,37 +523,37 @@ un tasto qualsiasi o usando il tasto destro o centrale del mouse. Image quality - + Qualità imagine Image quality (1 - small file, 100 - high quality) - + Qualità immagine (1 -bassa, 100 massima qualità) Allow run multiplies copy of ScreenGrab - + Permetti istanze multiple di ScreenGrab Enable external viewer - + Abilita visualizzatore esterno Show ScreenGrab in the system tray - + Mostra ScreenGrab nel vassoio di sistema Minimize to tray on click close button - + Minimizza nel vassoio di sistema cliccando il pulsante chiudi Minimize to tray when closing - + Minimizza nel vassoio alla chiusura @@ -582,7 +583,7 @@ un tasto qualsiasi o usando il tasto destro o centrale del mouse. Local shortcuts - + Scorciatoie locali @@ -651,12 +652,12 @@ un tasto qualsiasi o usando il tasto destro o centrale del mouse. System tray - + Vassoio Saving - + Salvataggio @@ -696,27 +697,27 @@ un tasto qualsiasi o usando il tasto destro o centrale del mouse. Copy file name to the clipboard when saving - + Copia nome del file negli appunti quando salvi Do not copy - + Non copiare Copy file name only - + Copia solo il nome del file Copy full file path - + Copia il percorso completo Screenshot - + Cattura @@ -797,12 +798,12 @@ un tasto qualsiasi o usando il tasto destro o centrale del mouse. Allow multiple instances of ScreenGrab - + Permetti istanze multiple di ScreenGrab Open in external viewer on double click - + Apri la cattura in un visualizzatore esterno con doppio clic @@ -812,7 +813,7 @@ un tasto qualsiasi o usando il tasto destro o centrale del mouse. Quit - Esci + Esci