diff --git a/.gitignore b/.gitignore index a886f32c..78489381 100644 --- a/.gitignore +++ b/.gitignore @@ -50,4 +50,7 @@ stage/ flameshot*.tar.bz2 +# NVIM +*~ + # End of https://www.gitignore.io/api/snapcraft diff --git a/build/.qmake.stash b/build/.qmake.stash new file mode 100644 index 00000000..e16983a0 --- /dev/null +++ b/build/.qmake.stash @@ -0,0 +1,21 @@ +QMAKE_CXX.QT_COMPILER_STDCXX = 201402L +QMAKE_CXX.QMAKE_GCC_MAJOR_VERSION = 9 +QMAKE_CXX.QMAKE_GCC_MINOR_VERSION = 3 +QMAKE_CXX.QMAKE_GCC_PATCH_VERSION = 0 +QMAKE_CXX.COMPILER_MACROS = \ + QT_COMPILER_STDCXX \ + QMAKE_GCC_MAJOR_VERSION \ + QMAKE_GCC_MINOR_VERSION \ + QMAKE_GCC_PATCH_VERSION +QMAKE_CXX.INCDIRS = \ + /usr/include/c++/9.3.0 \ + /usr/include/c++/9.3.0/x86_64-pc-linux-gnu \ + /usr/include/c++/9.3.0/backward \ + /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include \ + /usr/local/include \ + /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0/include-fixed \ + /usr/include +QMAKE_CXX.LIBDIRS = \ + /usr/lib/gcc/x86_64-pc-linux-gnu/9.3.0 \ + /usr/lib \ + /lib diff --git a/build/flameshot b/build/flameshot new file mode 100755 index 00000000..0719e496 Binary files /dev/null and b/build/flameshot differ diff --git a/build/moc_predefs.h b/build/moc_predefs.h new file mode 100644 index 00000000..8f265ab9 --- /dev/null +++ b/build/moc_predefs.h @@ -0,0 +1,381 @@ +#define __SSP_STRONG__ 3 +#define __DBL_MIN_EXP__ (-1021) +#define __FLT32X_MAX_EXP__ 1024 +#define __cpp_attributes 200809 +#define __UINT_LEAST16_MAX__ 0xffff +#define __ATOMIC_ACQUIRE 2 +#define __FLT128_MAX_10_EXP__ 4932 +#define __FLT_MIN__ 1.17549435082228750796873653722224568e-38F +#define __GCC_IEC_559_COMPLEX 2 +#define __UINT_LEAST8_TYPE__ unsigned char +#define __SIZEOF_FLOAT80__ 16 +#define __INTMAX_C(c) c ## L +#define __CHAR_BIT__ 8 +#define __UINT8_MAX__ 0xff +#define __WINT_MAX__ 0xffffffffU +#define __FLT32_MIN_EXP__ (-125) +#define __cpp_static_assert 200410 +#define __ORDER_LITTLE_ENDIAN__ 1234 +#define __SIZE_MAX__ 0xffffffffffffffffUL +#define __WCHAR_MAX__ 0x7fffffff +#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1 1 +#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_2 1 +#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 1 +#define __DBL_DENORM_MIN__ double(4.94065645841246544176568792868221372e-324L) +#define __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 1 +#define __GCC_ATOMIC_CHAR_LOCK_FREE 2 +#define __GCC_IEC_559 2 +#define __FLT32X_DECIMAL_DIG__ 17 +#define __FLT_EVAL_METHOD__ 0 +#define __unix__ 1 +#define __cpp_binary_literals 201304 +#define __FLT64_DECIMAL_DIG__ 17 +#define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 2 +#define __x86_64 1 +#define __cpp_variadic_templates 200704 +#define __UINT_FAST64_MAX__ 0xffffffffffffffffUL +#define __SIG_ATOMIC_TYPE__ int +#define __DBL_MIN_10_EXP__ (-307) +#define __FINITE_MATH_ONLY__ 0 +#define __GNUC_PATCHLEVEL__ 0 +#define __FLT32_HAS_DENORM__ 1 +#define __UINT_FAST8_MAX__ 0xff +#define __cpp_rvalue_reference 200610 +#define __has_include(STR) __has_include__(STR) +#define __DEC64_MAX_EXP__ 385 +#define __INT8_C(c) c +#define __INT_LEAST8_WIDTH__ 8 +#define __UINT_LEAST64_MAX__ 0xffffffffffffffffUL +#define __SHRT_MAX__ 0x7fff +#define __LDBL_MAX__ 1.18973149535723176502126385303097021e+4932L +#define __FLT64X_MAX_10_EXP__ 4932 +#define __UINT_LEAST8_MAX__ 0xff +#define __GCC_ATOMIC_BOOL_LOCK_FREE 2 +#define __FLT128_DENORM_MIN__ 6.47517511943802511092443895822764655e-4966F128 +#define __UINTMAX_TYPE__ long unsigned int +#define __linux 1 +#define __DEC32_EPSILON__ 1E-6DF +#define __FLT_EVAL_METHOD_TS_18661_3__ 0 +#define __unix 1 +#define __UINT32_MAX__ 0xffffffffU +#define __GXX_EXPERIMENTAL_CXX0X__ 1 +#define __LDBL_MAX_EXP__ 16384 +#define __FLT128_MIN_EXP__ (-16381) +#define __WINT_MIN__ 0U +#define __linux__ 1 +#define __FLT128_MIN_10_EXP__ (-4931) +#define __INT_LEAST16_WIDTH__ 16 +#define __SCHAR_MAX__ 0x7f +#define __FLT128_MANT_DIG__ 113 +#define __WCHAR_MIN__ (-__WCHAR_MAX__ - 1) +#define __INT64_C(c) c ## L +#define __DBL_DIG__ 15 +#define __GCC_ATOMIC_POINTER_LOCK_FREE 2 +#define __FLT64X_MANT_DIG__ 64 +#define __SIZEOF_INT__ 4 +#define __SIZEOF_POINTER__ 8 +#define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 2 +#define __USER_LABEL_PREFIX__ +#define __FLT64X_EPSILON__ 1.08420217248550443400745280086994171e-19F64x +#define __STDC_HOSTED__ 1 +#define __LDBL_HAS_INFINITY__ 1 +#define __FLT32_DIG__ 6 +#define __FLT_EPSILON__ 1.19209289550781250000000000000000000e-7F +#define __GXX_WEAK__ 1 +#define __SHRT_WIDTH__ 16 +#define __LDBL_MIN__ 3.36210314311209350626267781732175260e-4932L +#define __DEC32_MAX__ 9.999999E96DF +#define __cpp_threadsafe_static_init 200806 +#define __FLT64X_DENORM_MIN__ 3.64519953188247460252840593361941982e-4951F64x +#define __FLT32X_HAS_INFINITY__ 1 +#define __INT32_MAX__ 0x7fffffff +#define __INT_WIDTH__ 32 +#define __SIZEOF_LONG__ 8 +#define __STDC_IEC_559__ 1 +#define __STDC_ISO_10646__ 201706L +#define __UINT16_C(c) c +#define __PTRDIFF_WIDTH__ 64 +#define __DECIMAL_DIG__ 21 +#define __FLT64_EPSILON__ 2.22044604925031308084726333618164062e-16F64 +#define __gnu_linux__ 1 +#define __INTMAX_WIDTH__ 64 +#define __FLT64_MIN_EXP__ (-1021) +#define __has_include_next(STR) __has_include_next__(STR) +#define __FLT64X_MIN_10_EXP__ (-4931) +#define __LDBL_HAS_QUIET_NAN__ 1 +#define __FLT64_MANT_DIG__ 53 +#define __GNUC__ 9 +#define __GXX_RTTI 1 +#define __pie__ 2 +#define __MMX__ 1 +#define __cpp_delegating_constructors 200604 +#define __FLT_HAS_DENORM__ 1 +#define __SIZEOF_LONG_DOUBLE__ 16 +#define __BIGGEST_ALIGNMENT__ 16 +#define __STDC_UTF_16__ 1 +#define __FLT64_MAX_10_EXP__ 308 +#define __FLT32_HAS_INFINITY__ 1 +#define __DBL_MAX__ double(1.79769313486231570814527423731704357e+308L) +#define __cpp_raw_strings 200710 +#define __INT_FAST32_MAX__ 0x7fffffffffffffffL +#define __DBL_HAS_INFINITY__ 1 +#define __HAVE_SPECULATION_SAFE_VALUE 1 +#define __DEC32_MIN_EXP__ (-94) +#define __INTPTR_WIDTH__ 64 +#define __FLT32X_HAS_DENORM__ 1 +#define __INT_FAST16_TYPE__ long int +#define __LDBL_HAS_DENORM__ 1 +#define __cplusplus 201103L +#define __cpp_ref_qualifiers 200710 +#define __DEC128_MAX__ 9.999999999999999999999999999999999E6144DL +#define __INT_LEAST32_MAX__ 0x7fffffff +#define __DEC32_MIN__ 1E-95DF +#define __DEPRECATED 1 +#define __cpp_rvalue_references 200610 +#define __DBL_MAX_EXP__ 1024 +#define __WCHAR_WIDTH__ 32 +#define __FLT32_MAX__ 3.40282346638528859811704183484516925e+38F32 +#define __DEC128_EPSILON__ 1E-33DL +#define __SSE2_MATH__ 1 +#define __ATOMIC_HLE_RELEASE 131072 +#define __PTRDIFF_MAX__ 0x7fffffffffffffffL +#define __amd64 1 +#define __ATOMIC_HLE_ACQUIRE 65536 +#define __FLT32_HAS_QUIET_NAN__ 1 +#define __GNUG__ 9 +#define __LONG_LONG_MAX__ 0x7fffffffffffffffLL +#define __SIZEOF_SIZE_T__ 8 +#define __cpp_nsdmi 200809 +#define __FLT64X_MIN_EXP__ (-16381) +#define __SIZEOF_WINT_T__ 4 +#define __LONG_LONG_WIDTH__ 64 +#define __cpp_initializer_lists 200806 +#define __FLT32_MAX_EXP__ 128 +#define __cpp_hex_float 201603 +#define __GCC_HAVE_DWARF2_CFI_ASM 1 +#define __GXX_ABI_VERSION 1013 +#define __FLT128_HAS_INFINITY__ 1 +#define __FLT_MIN_EXP__ (-125) +#define __cpp_lambdas 200907 +#define __FLT64X_HAS_QUIET_NAN__ 1 +#define __INT_FAST64_TYPE__ long int +#define __FLT64_DENORM_MIN__ 4.94065645841246544176568792868221372e-324F64 +#define __DBL_MIN__ double(2.22507385850720138309023271733240406e-308L) +#define __PIE__ 2 +#define __LP64__ 1 +#define __FLT32X_EPSILON__ 2.22044604925031308084726333618164062e-16F32x +#define __DECIMAL_BID_FORMAT__ 1 +#define __FLT64_MIN_10_EXP__ (-307) +#define __FLT64X_DECIMAL_DIG__ 21 +#define __DEC128_MIN__ 1E-6143DL +#define __REGISTER_PREFIX__ +#define __UINT16_MAX__ 0xffff +#define __FLT32_MIN__ 1.17549435082228750796873653722224568e-38F32 +#define __UINT8_TYPE__ unsigned char +#define __NO_INLINE__ 1 +#define __FLT_MANT_DIG__ 24 +#define __LDBL_DECIMAL_DIG__ 21 +#define __VERSION__ "9.3.0" +#define __UINT64_C(c) c ## UL +#define __cpp_unicode_characters 200704 +#define _STDC_PREDEF_H 1 +#define __GCC_ATOMIC_INT_LOCK_FREE 2 +#define __FLT128_MAX_EXP__ 16384 +#define __FLT32_MANT_DIG__ 24 +#define __FLOAT_WORD_ORDER__ __ORDER_LITTLE_ENDIAN__ +#define __STDC_IEC_559_COMPLEX__ 1 +#define __FLT128_HAS_DENORM__ 1 +#define __FLT128_DIG__ 33 +#define __SCHAR_WIDTH__ 8 +#define __INT32_C(c) c +#define __DEC64_EPSILON__ 1E-15DD +#define __ORDER_PDP_ENDIAN__ 3412 +#define __DEC128_MIN_EXP__ (-6142) +#define __FLT32_MAX_10_EXP__ 38 +#define __INT_FAST32_TYPE__ long int +#define __UINT_LEAST16_TYPE__ short unsigned int +#define __FLT64X_HAS_INFINITY__ 1 +#define unix 1 +#define __DBL_HAS_DENORM__ 1 +#define __INT16_MAX__ 0x7fff +#define __cpp_rtti 199711 +#define __SIZE_TYPE__ long unsigned int +#define __UINT64_MAX__ 0xffffffffffffffffUL +#define __FLT64X_DIG__ 18 +#define __INT8_TYPE__ signed char +#define __ELF__ 1 +#define __GCC_ASM_FLAG_OUTPUTS__ 1 +#define __FLT_RADIX__ 2 +#define __INT_LEAST16_TYPE__ short int +#define __LDBL_EPSILON__ 1.08420217248550443400745280086994171e-19L +#define __UINTMAX_C(c) c ## UL +#define __GLIBCXX_BITSIZE_INT_N_0 128 +#define __k8 1 +#define __SIG_ATOMIC_MAX__ 0x7fffffff +#define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2 +#define __SIZEOF_PTRDIFF_T__ 8 +#define __FLT32X_MANT_DIG__ 53 +#define __x86_64__ 1 +#define __FLT32X_MIN_EXP__ (-1021) +#define __DEC32_SUBNORMAL_MIN__ 0.000001E-95DF +#define __INT_FAST16_MAX__ 0x7fffffffffffffffL +#define __FLT64_DIG__ 15 +#define __UINT_FAST32_MAX__ 0xffffffffffffffffUL +#define __UINT_LEAST64_TYPE__ long unsigned int +#define __FLT_HAS_QUIET_NAN__ 1 +#define __FLT_MAX_10_EXP__ 38 +#define __LONG_MAX__ 0x7fffffffffffffffL +#define __FLT64X_HAS_DENORM__ 1 +#define __DEC128_SUBNORMAL_MIN__ 0.000000000000000000000000000000001E-6143DL +#define __FLT_HAS_INFINITY__ 1 +#define __cpp_unicode_literals 200710 +#define __UINT_FAST16_TYPE__ long unsigned int +#define __DEC64_MAX__ 9.999999999999999E384DD +#define __INT_FAST32_WIDTH__ 64 +#define __CHAR16_TYPE__ short unsigned int +#define __PRAGMA_REDEFINE_EXTNAME 1 +#define __SIZE_WIDTH__ 64 +#define __SEG_FS 1 +#define __INT_LEAST16_MAX__ 0x7fff +#define __DEC64_MANT_DIG__ 16 +#define __INT64_MAX__ 0x7fffffffffffffffL +#define __UINT_LEAST32_MAX__ 0xffffffffU +#define __SEG_GS 1 +#define __FLT32_DENORM_MIN__ 1.40129846432481707092372958328991613e-45F32 +#define __GCC_ATOMIC_LONG_LOCK_FREE 2 +#define __SIG_ATOMIC_WIDTH__ 32 +#define __INT_LEAST64_TYPE__ long int +#define __INT16_TYPE__ short int +#define __INT_LEAST8_TYPE__ signed char +#define __DEC32_MAX_EXP__ 97 +#define __INT_FAST8_MAX__ 0x7f +#define __FLT128_MAX__ 1.18973149535723176508575932662800702e+4932F128 +#define __INTPTR_MAX__ 0x7fffffffffffffffL +#define linux 1 +#define __cpp_range_based_for 200907 +#define __FLT64_HAS_QUIET_NAN__ 1 +#define __FLT32_MIN_10_EXP__ (-37) +#define __SSE2__ 1 +#define __EXCEPTIONS 1 +#define __LDBL_MANT_DIG__ 64 +#define __DBL_HAS_QUIET_NAN__ 1 +#define __FLT64_HAS_INFINITY__ 1 +#define __FLT64X_MAX__ 1.18973149535723176502126385303097021e+4932F64x +#define __SIG_ATOMIC_MIN__ (-__SIG_ATOMIC_MAX__ - 1) +#define __code_model_small__ 1 +#define __k8__ 1 +#define __INTPTR_TYPE__ long int +#define __UINT16_TYPE__ short unsigned int +#define __WCHAR_TYPE__ int +#define __SIZEOF_FLOAT__ 4 +#define __pic__ 2 +#define __UINTPTR_MAX__ 0xffffffffffffffffUL +#define __INT_FAST64_WIDTH__ 64 +#define __DEC64_MIN_EXP__ (-382) +#define __cpp_decltype 200707 +#define __FLT32_DECIMAL_DIG__ 9 +#define __INT_FAST64_MAX__ 0x7fffffffffffffffL +#define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1 +#define __FLT_DIG__ 6 +#define __FLT64X_MAX_EXP__ 16384 +#define __UINT_FAST64_TYPE__ long unsigned int +#define __INT_MAX__ 0x7fffffff +#define __amd64__ 1 +#define __INT64_TYPE__ long int +#define __FLT_MAX_EXP__ 128 +#define __ORDER_BIG_ENDIAN__ 4321 +#define __DBL_MANT_DIG__ 53 +#define __cpp_inheriting_constructors 201511 +#define __SIZEOF_FLOAT128__ 16 +#define __INT_LEAST64_MAX__ 0x7fffffffffffffffL +#define __DEC64_MIN__ 1E-383DD +#define __WINT_TYPE__ unsigned int +#define __UINT_LEAST32_TYPE__ unsigned int +#define __SIZEOF_SHORT__ 2 +#define __SSE__ 1 +#define __LDBL_MIN_EXP__ (-16381) +#define __FLT64_MAX__ 1.79769313486231570814527423731704357e+308F64 +#define __WINT_WIDTH__ 32 +#define __INT_LEAST8_MAX__ 0x7f +#define __FLT32X_MAX_10_EXP__ 308 +#define __SIZEOF_INT128__ 16 +#define __LDBL_MAX_10_EXP__ 4932 +#define __ATOMIC_RELAXED 0 +#define __DBL_EPSILON__ double(2.22044604925031308084726333618164062e-16L) +#define __FLT128_MIN__ 3.36210314311209350626267781732175260e-4932F128 +#define _LP64 1 +#define __UINT8_C(c) c +#define __FLT64_MAX_EXP__ 1024 +#define __INT_LEAST32_TYPE__ int +#define __SIZEOF_WCHAR_T__ 4 +#define __FLT128_HAS_QUIET_NAN__ 1 +#define __INT_FAST8_TYPE__ signed char +#define __FLT64X_MIN__ 3.36210314311209350626267781732175260e-4932F64x +#define __GNUC_STDC_INLINE__ 1 +#define __FLT64_HAS_DENORM__ 1 +#define __FLT32_EPSILON__ 1.19209289550781250000000000000000000e-7F32 +#define __DBL_DECIMAL_DIG__ 17 +#define __STDC_UTF_32__ 1 +#define __INT_FAST8_WIDTH__ 8 +#define __FXSR__ 1 +#define __DEC_EVAL_METHOD__ 2 +#define __FLT32X_MAX__ 1.79769313486231570814527423731704357e+308F32x +#define __cpp_runtime_arrays 198712 +#define __UINT64_TYPE__ long unsigned int +#define __UINT32_C(c) c ## U +#define __INTMAX_MAX__ 0x7fffffffffffffffL +#define __cpp_alias_templates 200704 +#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__ +#define __FLT_DENORM_MIN__ 1.40129846432481707092372958328991613e-45F +#define __INT8_MAX__ 0x7f +#define __LONG_WIDTH__ 64 +#define __PIC__ 2 +#define __UINT_FAST32_TYPE__ long unsigned int +#define __CHAR32_TYPE__ unsigned int +#define __FLT_MAX__ 3.40282346638528859811704183484516925e+38F +#define __cpp_constexpr 200704 +#define __INT32_TYPE__ int +#define __SIZEOF_DOUBLE__ 8 +#define __cpp_exceptions 199711 +#define __FLT_MIN_10_EXP__ (-37) +#define __FLT64_MIN__ 2.22507385850720138309023271733240406e-308F64 +#define __INT_LEAST32_WIDTH__ 32 +#define __INTMAX_TYPE__ long int +#define __DEC128_MAX_EXP__ 6145 +#define __FLT32X_HAS_QUIET_NAN__ 1 +#define __ATOMIC_CONSUME 1 +#define __GNUC_MINOR__ 3 +#define __GLIBCXX_TYPE_INT_N_0 __int128 +#define __INT_FAST16_WIDTH__ 64 +#define __UINTMAX_MAX__ 0xffffffffffffffffUL +#define __DEC32_MANT_DIG__ 7 +#define __FLT32X_DENORM_MIN__ 4.94065645841246544176568792868221372e-324F32x +#define __DBL_MAX_10_EXP__ 308 +#define __LDBL_DENORM_MIN__ 3.64519953188247460252840593361941982e-4951L +#define __INT16_C(c) c +#define __STDC__ 1 +#define __FLT32X_DIG__ 15 +#define __PTRDIFF_TYPE__ long int +#define __ATOMIC_SEQ_CST 5 +#define __UINT32_TYPE__ unsigned int +#define __FLT32X_MIN_10_EXP__ (-307) +#define __UINTPTR_TYPE__ long unsigned int +#define __DEC64_SUBNORMAL_MIN__ 0.000000000000001E-383DD +#define __DEC128_MANT_DIG__ 34 +#define __LDBL_MIN_10_EXP__ (-4931) +#define __FLT128_EPSILON__ 1.92592994438723585305597794258492732e-34F128 +#define __SSE_MATH__ 1 +#define __SIZEOF_LONG_LONG__ 8 +#define __cpp_user_defined_literals 200809 +#define __FLT128_DECIMAL_DIG__ 36 +#define __GCC_ATOMIC_LLONG_LOCK_FREE 2 +#define __FLT32X_MIN__ 2.22507385850720138309023271733240406e-308F32x +#define __LDBL_DIG__ 18 +#define __FLT_DECIMAL_DIG__ 9 +#define __UINT_FAST16_MAX__ 0xffffffffffffffffUL +#define __GCC_ATOMIC_SHORT_LOCK_FREE 2 +#define __INT_LEAST64_WIDTH__ 64 +#define __UINT_FAST8_TYPE__ unsigned char +#define _GNU_SOURCE 1 +#define __ATOMIC_ACQ_REL 4 +#define __ATOMIC_RELEASE 3 diff --git a/flameshot.pro b/flameshot.pro index 84a2e65b..bf3f80af 100644 --- a/flameshot.pro +++ b/flameshot.pro @@ -75,6 +75,7 @@ include(src/third-party/Qt-Color-Widgets//color_widgets.pri) DEFINES += QAPPLICATION_CLASS=QApplication SOURCES += src/main.cpp \ + src/tools/circlecount/circlecounttool.cpp \ src/widgets/capture/buttonhandler.cpp \ src/widgets/infowindow.cpp \ src/config/configwindow.cpp \ @@ -148,6 +149,7 @@ SOURCES += src/main.cpp \ src/widgets/panel/sidepanelwidget.cpp HEADERS += src/widgets/capture/buttonhandler.h \ + src/tools/circlecount/circlecounttool.h \ src/widgets/infowindow.h \ src/config/configwindow.h \ src/widgets/capture/capturewidget.h \ diff --git a/graphics.qrc b/graphics.qrc index 87a2a790..14e7d803 100644 --- a/graphics.qrc +++ b/graphics.qrc @@ -64,5 +64,7 @@ img/material/white/circle-outline.svg img/material/white/blur.svg img/material/white/arrow-bottom-left.svg + img/material/black/circlecount-outline.svg + img/material/white/circlecount-outline.svg diff --git a/img/material/black/circlecount-outline.png b/img/material/black/circlecount-outline.png new file mode 100644 index 00000000..d81063cd Binary files /dev/null and b/img/material/black/circlecount-outline.png differ diff --git a/img/material/black/circlecount-outline.svg b/img/material/black/circlecount-outline.svg new file mode 100644 index 00000000..e9273516 --- /dev/null +++ b/img/material/black/circlecount-outline.svg @@ -0,0 +1,79 @@ + + + + + + image/svg+xml + + + + + + + + + + + 1 + diff --git a/img/material/white/circlecount-outline.png b/img/material/white/circlecount-outline.png new file mode 100644 index 00000000..e6156ae8 Binary files /dev/null and b/img/material/white/circlecount-outline.png differ diff --git a/img/material/white/circlecount-outline.svg b/img/material/white/circlecount-outline.svg new file mode 100644 index 00000000..e19f14e8 --- /dev/null +++ b/img/material/white/circlecount-outline.svg @@ -0,0 +1,79 @@ + + + + + + image/svg+xml + + + + + + + + + + + 1 + diff --git a/src/third-party/Qt-Color-Widgets/src/color_wheel.cpp b/src/third-party/Qt-Color-Widgets/src/color_wheel.cpp index 335b29ce..21a490aa 100644 --- a/src/third-party/Qt-Color-Widgets/src/color_wheel.cpp +++ b/src/third-party/Qt-Color-Widgets/src/color_wheel.cpp @@ -23,6 +23,7 @@ #include #include +#include #include #include #include diff --git a/src/tools/arrow/arrowtool.h b/src/tools/arrow/arrowtool.h index 9d81452a..801b7944 100644 --- a/src/tools/arrow/arrowtool.h +++ b/src/tools/arrow/arrowtool.h @@ -19,7 +19,7 @@ #include "src/tools/abstracttwopointtool.h" #include - +#include class ArrowTool : public AbstractTwoPointTool { Q_OBJECT public: diff --git a/src/tools/capturecontext.cpp b/src/tools/capturecontext.cpp index 4e3c9773..2af6593e 100644 --- a/src/tools/capturecontext.cpp +++ b/src/tools/capturecontext.cpp @@ -24,3 +24,4 @@ QPixmap CaptureContext::selectedScreenshotArea() const { return screenshot.copy(selection); } } + diff --git a/src/tools/capturecontext.h b/src/tools/capturecontext.h index 0175fe16..9ce19148 100644 --- a/src/tools/capturecontext.h +++ b/src/tools/capturecontext.h @@ -41,6 +41,7 @@ struct CaptureContext { QPoint mousePos; // Value of the desired thickness int thickness; + int circleCount; // Mode of the capture widget bool fullscreen; diff --git a/src/tools/capturetool.h b/src/tools/capturetool.h index ae1a70c0..9f2382af 100644 --- a/src/tools/capturetool.h +++ b/src/tools/capturetool.h @@ -62,6 +62,8 @@ public: REQ_ADD_CHILD_WINDOW, // Instance this->widget()'s widget which handles its own lifetime. REQ_ADD_EXTERNAL_WIDGETS, + + REQ_INCREMENT_CIRCLE_COUNT, }; explicit CaptureTool(QObject *parent = nullptr) : QObject(parent){} diff --git a/src/tools/circlecount/circlecounttool.cpp b/src/tools/circlecount/circlecounttool.cpp new file mode 100644 index 00000000..25494158 --- /dev/null +++ b/src/tools/circlecount/circlecounttool.cpp @@ -0,0 +1,75 @@ +// Copyright(c) 2017-2019 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot 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 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#include "circlecounttool.h" +#include +namespace { +#define PADDING_VALUE 2 +} + +CircleCountTool::CircleCountTool(QObject *parent) : AbstractTwoPointTool(parent) { + m_count = 0; +} + +QIcon CircleCountTool::icon(const QColor &background, bool inEditor) const { + Q_UNUSED(inEditor); + return QIcon(iconPath(background) + "circlecount-outline.svg"); +} +QString CircleCountTool::name() const { + return tr("Circle Counter"); +} + +QString CircleCountTool::nameID() { + return QLatin1String(""); +} + +QString CircleCountTool::description() const { + return tr("Add an autoincrementing counter bubble"); +} + +CaptureTool* CircleCountTool::copy(QObject *parent) { + return new CircleCountTool(parent); +} + +void CircleCountTool::process(QPainter &painter, const QPixmap &pixmap, bool recordUndo) { + if (recordUndo) { + updateBackup(pixmap); + } + painter.setBrush(m_color); + + int bubble_size=16; + painter.drawEllipse(m_points.first,bubble_size,bubble_size); + painter.drawText(QRectF(m_points.first.x()-bubble_size/2, m_points.first.y()-bubble_size/2, bubble_size, bubble_size), Qt::AlignCenter, QString::number(m_count)); +} + +void CircleCountTool::paintMousePreview(QPainter &painter, const CaptureContext &context) { + painter.setPen(QPen(context.color, PADDING_VALUE + context.thickness)); + painter.drawLine(context.mousePos, context.mousePos); +} + +void CircleCountTool::drawStart(const CaptureContext &context) { + m_color = context.color; + m_thickness = context.thickness + PADDING_VALUE; + m_points.first = context.mousePos; + m_count = context.circleCount; + emit requestAction(REQ_INCREMENT_CIRCLE_COUNT); + +} + +void CircleCountTool::pressed(const CaptureContext &context) { + Q_UNUSED(context); +} diff --git a/src/tools/circlecount/circlecounttool.h b/src/tools/circlecount/circlecounttool.h new file mode 100644 index 00000000..7893384a --- /dev/null +++ b/src/tools/circlecount/circlecounttool.h @@ -0,0 +1,41 @@ +// Copyright(c) 2017-2019 Alejandro Sirgo Rica & Contributors +// +// This file is part of Flameshot. +// +// Flameshot 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 3 of the License, or +// (at your option) any later version. +// +// Flameshot 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 Flameshot. If not, see . + +#pragma once + +#include "src/tools/abstracttwopointtool.h" + +class CircleCountTool : public AbstractTwoPointTool { + Q_OBJECT +public: + explicit CircleCountTool(QObject *parent = nullptr); + + QIcon icon(const QColor &background, bool inEditor) const override; + QString name() const override; + static QString nameID(); + QString description() const override; + + CaptureTool* copy(QObject *parent = nullptr) override; + void process( + QPainter &painter, const QPixmap &pixmap, bool recordUndo = false) override; + void paintMousePreview(QPainter &painter, const CaptureContext &context) override; +private: + unsigned int m_count; +public slots: + void drawStart(const CaptureContext &context) override; + void pressed(const CaptureContext &context) override; +}; diff --git a/src/tools/toolfactory.cpp b/src/tools/toolfactory.cpp index 23c5032b..588df1b1 100644 --- a/src/tools/toolfactory.cpp +++ b/src/tools/toolfactory.cpp @@ -18,6 +18,7 @@ #include "toolfactory.h" #include "arrow/arrowtool.h" #include "circle/circletool.h" +#include "circlecount/circlecounttool.h" #include "copy/copytool.h" #include "exit/exittool.h" #include "imgur/imguruploadertool.h" @@ -103,6 +104,10 @@ CaptureTool* ToolFactory::CreateTool( case CaptureButton::TYPE_TEXT: tool = new TextTool(parent); break; + case CaptureButton::TYPE_CIRCLECOUNT: + tool = new CircleCountTool(parent); + break; + default: tool = nullptr; break; diff --git a/src/utils/confighandler.cpp b/src/utils/confighandler.cpp index 14f3e55f..15c4194b 100644 --- a/src/utils/confighandler.cpp +++ b/src/utils/confighandler.cpp @@ -56,7 +56,8 @@ QVector ConfigHandler::getButtons() { << CaptureButton::TYPE_IMAGEUPLOADER << CaptureButton::TYPE_OPEN_APP << CaptureButton::TYPE_PIN - << CaptureButton::TYPE_TEXT; + << CaptureButton::TYPE_TEXT + << CaptureButton::TYPE_CIRCLECOUNT; } using bt = CaptureButton::ButtonType; diff --git a/src/widgets/capture/capturebutton.cpp b/src/widgets/capture/capturebutton.cpp index 8a809660..8dde6768 100644 --- a/src/widgets/capture/capturebutton.cpp +++ b/src/widgets/capture/capturebutton.cpp @@ -166,6 +166,7 @@ static std::map buttonTypeOrder { { CaptureButton::TYPE_IMAGEUPLOADER, 16 }, { CaptureButton::TYPE_OPEN_APP, 17 }, { CaptureButton::TYPE_PIN, 18 }, + { CaptureButton::TYPE_CIRCLECOUNT, 19 }, }; int CaptureButton::getPriorityByButton(CaptureButton::ButtonType b) { @@ -193,4 +194,5 @@ QVector CaptureButton::iterableButtonTypes = { CaptureButton::TYPE_IMAGEUPLOADER, CaptureButton::TYPE_OPEN_APP, CaptureButton::TYPE_PIN, + CaptureButton::TYPE_CIRCLECOUNT, }; diff --git a/src/widgets/capture/capturebutton.h b/src/widgets/capture/capturebutton.h index 4ca4b880..4bc9f96e 100644 --- a/src/widgets/capture/capturebutton.h +++ b/src/widgets/capture/capturebutton.h @@ -51,6 +51,8 @@ public: TYPE_REDO = 16, TYPE_PIN = 17, TYPE_TEXT = 18, + TYPE_CIRCLECOUNT = 19, + }; #if QT_VERSION < QT_VERSION_CHECK(5, 5, 0) diff --git a/src/widgets/capture/capturewidget.cpp b/src/widgets/capture/capturewidget.cpp index 1db615bb..cb2a1740 100644 --- a/src/widgets/capture/capturewidget.cpp +++ b/src/widgets/capture/capturewidget.cpp @@ -68,7 +68,7 @@ CaptureWidget::CaptureWidget(const uint id, const QString &savePath, setMouseTracking(true); initContext(savePath, fullScreen); initShortcuts(); - + m_context.circleCount=1; #ifdef Q_OS_WIN // Top left of the whole set of screens QPoint topLeft(0,0); @@ -636,6 +636,11 @@ void CaptureWidget::handleButtonSignal(CaptureTool::Request r) { m_undoStack.setIndex(0); update(); break; + + case CaptureTool::REQ_INCREMENT_CIRCLE_COUNT: + incrementCircleCount(); + break; + case CaptureTool::REQ_CLOSE_GUI: close(); break; @@ -715,7 +720,12 @@ void CaptureWidget::setDrawColor(const QColor &c) { emit colorChanged(c); } -void CaptureWidget::setDrawThickness(const int &t) +void CaptureWidget::incrementCircleCount() +{ + m_context.circleCount++; +} + + void CaptureWidget::setDrawThickness(const int &t) { m_context.thickness = qBound(0, t, 100); ConfigHandler().setdrawThickness(m_context.thickness); diff --git a/src/widgets/capture/capturewidget.h b/src/widgets/capture/capturewidget.h index 171ab33c..c33157c4 100644 --- a/src/widgets/capture/capturewidget.h +++ b/src/widgets/capture/capturewidget.h @@ -90,7 +90,7 @@ private slots: void handleButtonSignal(CaptureTool::Request r); void setDrawColor(const QColor &c); void setDrawThickness(const int &t); - + void incrementCircleCount(); protected: void paintEvent(QPaintEvent *); void mousePressEvent(QMouseEvent *); @@ -112,6 +112,7 @@ protected: // Outside selection opacity int m_opacity; + // utility flags bool m_mouseIsClicked; bool m_rightClick; @@ -122,6 +123,8 @@ protected: bool m_previewEnabled; bool m_adjustmentButtonPressed; + + private: void initContext(const QString &savePath, bool fullscreen); void initPanel();