Commit Graph

275 Commits

Author SHA1 Message Date
borgmanJeremy
0ac48f5c4b Clang tidy (#2372)
* Added missing braces

* applied some clang modernize

* clarified auto pointer

* clang-tidy
2022-02-06 12:12:09 -06:00
SilasDo
cf08755c8b Added magnifier for more precise selections (#2219)
* added a magnifierwidget

* added option to show magnifier and added option to switch to square shaped magnifier

* integrated magnifierwidget into capture

this could probably be done in a nicer way.
right now the magnifier wont show if you select via the move tool.

Co-authored-by: Silas Dohm <silas@sdohm.xyz>
2022-02-05 19:51:28 -06:00
borgmanJeremy
42917930ca Upload history UI (#2345)
* Refactored upload history widget to use qt ui files. Cleaned up clang
tidy warnings. Remove copied to clipboard notified.

* fixed some irregularities with the layout

* fixing forward declaration
2022-01-31 15:21:00 -06:00
Dearsh Oberoi
259e438f96 Customizable ColorPicker (#2202)
* Added spinbox, refactored colorpicker

* Added add preset functionality

* Added delete preset

* Refactored code

* Fix
2022-01-30 13:03:07 -06:00
borgmanJeremy
00685369a0 Wayland kde clipboard (#2305)
* working on wayland clipboard

* disabled wayland kde clipboard fix on snap until Kf5 tools are updated

* enable wayland clibboard on fedora

* drop fedora 34 and disable wayland clipboard on suse until it gets a new enough kf5
2022-01-22 09:57:10 -06:00
Andrea
31690b8506 Fixed Arch linux locale crash (#2304) 2022-01-22 08:18:32 -06:00
borgmanJeremy
24509e69d8 Revert "working on wayland clipboard (#2284)" (#2301)
This reverts commit 9005a14b3a.
2022-01-21 18:55:42 -06:00
borgmanJeremy
9005a14b3a working on wayland clipboard (#2284) 2022-01-21 15:57:27 -06:00
Haris Gušić
417a1534cf Introduce a config resolver (#2244)
* Add config resolver

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Enable resolver even when using systray

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix bugs

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Do not show resolver for shortcut conflicts

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix build error on MacOS and Windows

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Add missing translations

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Replace variable i with row

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Improve presentation

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Disambiguate shortcuts and general settings

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Wrap some strings in tr

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Update tooltips in ConfigResolver

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2022-01-13 16:01:56 -06:00
borgmanJeremy
179f658cd8 Fixing issue with unicode chars in XDG_PICTURE location (#2222)
* Fixing issue with unicode chars in XDG_PICTURE location

* cleaned up
2022-01-03 14:32:38 -06:00
Yurii Puchkov
493e0d8801 fix - crash on Windows if "setSaveAsFileExtension" is defined in the configuration file (#2204)
Co-authored-by: Yuriy Puchkov <yuriy.puchkov@namecheap.com>
2021-12-30 10:37:07 -06:00
borgmanJeremy
fcadc02a29 Fix recursive static init (#2196)
* Removed default config for abstract logger that sends a system notification, also cleaned up a useless ifdef

* Send notifications from event loop on Win and Mac (#2197)

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

Co-authored-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-12-28 08:43:17 -06:00
borgmanJeremy
ca70be773a remove SPD logging framework in favor of abstract logger (#2178) 2021-12-21 13:33:07 -06:00
Haris Gušić
36b3bd9639 Implement abstract logger (#2174)
* AbstractLogger base implementation

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Switch most system notifications to AbstractLogger

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Make CLI parser use AbstractLogger

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix annoying QPainter warning in QtColorWidgets

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Remove obsolete TODOs

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix failing windows build

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Add missing #include <cassert>

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-12-21 11:59:08 -06:00
Yurii Puchkov
c6bae91bd6 Automatically fix configuration file "flameshot.ini" (removes unused variables and groups) (#2169)
Co-authored-by: Yuriy Puchkov <yuriy.puchkov@namecheap.com>
2021-12-21 08:28:46 -06:00
Yurii Puchkov
bd4fc0047a Add option for using large color palette on right button click (#2171)
(cherry picked from commit 403a6474e7e8afeb7920fe39c8312481c21d0d1b)

Co-authored-by: Yuriy Puchkov <yuriy.puchkov@namecheap.com>
2021-12-21 08:27:13 -06:00
Haris Gušić
233c765b1f Reduce dependence on D-Bus (#2003)
* Handle captures without sigslots

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Set {app,organization}Name and version consistently

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Make 'full' dbus-free

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Move CaptureRequest::exportCapture to Controller

We need to wait until the upload widget (or similar widgets) have
finished before exiting. This must be done using a signal. The problem
is that CaptureRequest can't be guaranteed to survive until the widget
has finished what it's doing.

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Use QApplication with the 'full' subcommand

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Do unto 'screen' as we did to 'full'

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Add FlameshotDaemon singleton class

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Support clipboard hosting for both pixmaps and text

* Fix upload handling

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Do not show tray icon if not daemon

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Clean up handling of pin task

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Remove annoying Qt warning messages

The messages were caused by the color wheel.

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix small bug in Controller::exportCapture

* Fix --raw output

* Make 'gui' dbus-independent

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix accept on select bug

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix compile error on Windows

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Make it work on Windows

* Remove obsolete function in main.cpp

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Make 'launcher' work without dbus

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* clang-format, sigh

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Enable CLI parsing on MacOS

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Make 'config' work without dbus

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Small refactor of capture request handling

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Remove obsolete DBusUtils

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Remove unused D-Bus sigslots

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Remove D-Bus methods openConfig, autostartEnabled and trayIconEnabled

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Remove D-Bus method requestCapture

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Remove CaptureRequest id mechanism

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix 'launcher' crash

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Handle clipboard notifications properly

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Add 'autoCloseIdleDaemon' option

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Document FlameshotDaemon class

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Make 'flameshot gui' run in single-application mode

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Add `allowmultipleGuiInstances` config option

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix endless loop with multiple GUI instances

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Move upload confirmation dialog where it belongs

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Add the new config options to the GUI as well

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix failing build on Windows

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Handle persistence on MacOS

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* fixed notifications on macos

* Fixed display on macos

* Reformat tests/action_options.sh

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix infinite recursion in tests/action_options.sh

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

Co-authored-by: Dearsh Oberoi <59907159+deo002@users.noreply.github.com>
Co-authored-by: Jeremy Borgman <borgman.jeremy@pm.me>
2021-12-08 22:18:39 +01:00
Haris Gušić
6d9768445f Fix screen grab error (#2139)
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-12-02 17:30:57 -06:00
borgmanJeremy
b8c0b74ea2 Qt5 deprications (#2076)
* working on removing deprecated warnings for Qt6 migration

* tewsting 18.04 fix
2021-11-21 14:40:56 -06:00
LHBosssss
2283b3e783 Enable Screenshot & Screenshot history shortcut changing in MACOS (#2098)
* Enable Screenshot & Screenshot history shortcut changing in MACOS
From issue #1259 and my experience, I've fix and test this feature in my Hackintosh. So now you can change shortcut to take screenshot and show screenshot history (require restart flameshot).
- Default key to take screenshot is "Cmd + Shift + X", screenshot history is "Option + Shift + X".
- Added new translate text "Require restart flameshot".

* - Change message text for screenshot shortcut

* - Format code using clang-format

Co-authored-by: adrienpixodeo <adrien@pixodeo.net>
2021-11-20 20:44:39 -06:00
borgmanJeremy
f675123e0a working on monochrome icon (#2071)
* working on monochrome icon

* Update pipeline

* adjusted icns to be monochrome

* Added 1045 monochrome
2021-11-17 14:28:16 -06:00
Jeremy Borgman
58e37b092c Resolved seg fault on MacOs due to macro'd out config 2021-11-13 21:38:45 -06:00
Haris Gušić
6432490c31 Add --region option (#2013)
* Fix empty help message bug

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Add --region option

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix: initial selection even without --region

* Enable 'full --region'

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Enable 'screen --region'

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Allow negative width/height

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix screen intersection bug

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Change output format of --print-geometry

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-11-08 22:59:46 +01:00
Dearsh Oberoi
df5d99321a Added confirmation for Upload (#2037) 2021-11-08 13:33:50 -06:00
borgmanJeremy
445a4c68e8 Fixed Gnome File Extensions (#2047)
* Fixed Gnome File Extensions

* removed old comment
2021-11-05 13:35:30 -05:00
borgmanJeremy
e4e7c90109 Gnome41 (#2035)
* testing new portal on gnome41

* applied clang format

* macro out portal API on windows
2021-11-03 08:01:19 -05:00
Haris Gušić
c3cde5ab2f Fix segfault in ConfigHandler (#2029)
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-10-31 10:32:55 +01:00
borgmanJeremy
731b82a96d Changed initilization to remove deprecated warnings (#2023)
* Changed initilization to remove deprecated warnings

* fixing clang formate

* Need to do a Qt version check

* cleaned up formatting
2021-10-30 15:30:39 -05:00
borgmanJeremy
9346da5e20 stdexcept is explicetly required when building on msvc compiler (#2022) 2021-10-29 14:42:39 -05:00
Michael Bryan
65f8ac0414 Save by writing to a QFile so we can capture the error message (#2012) 2021-10-27 12:06:35 +02:00
Benja Appel
067f4a1914 Add default file extension configuration (#1995)
* Add default file extension configuration

* Format fix

* Implement ValueHandler for setSaveAsFileExtension

* Fix formatting issues

* Add format to properScreenshotPath call

* Fix SaveFileExtension::check

* Fix format

* Move extension layout to Save Path group
2021-10-25 19:24:46 +02:00
Haris Gušić
a487fb0257 Fix shortcut conflict when one is a default (#1989)
* Fix config checking on startup

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Handle conflicts when one shortcut is a default

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix bugs

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Refactor slot in ShortcutsWidget for consistency

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Update shortcut table on config file change

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix bounded int bug in config

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Revert changes manually

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Reimplement ConfigHandler::shortcut and setShortcut

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Handle Return/Numpad-Enter equivalently

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Re-enable user-configured Imgur upload shortcut

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Document copyAndCloseAfterUpload config option

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-10-24 16:48:30 +02:00
Mehrad Mahmoudian
08e532f787 Pin antialiasing option (#1997)
* adds a config option to toggle antialiasing for the pin zoom

* fix C++ scope error thanks for @veracioux

* set the default value of antialiasing of pin tool to be true

* fix the clang-format
2021-10-22 19:36:21 +02:00
Haris Gušić
988dcab9de Add --pin, --upload, --accept-on-select to CLI (#1970)
* Add --pin option

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Add --upload option

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Add --accept-on-select option

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix failing build on MacOS

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Clean up option variable names in main

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Remove missing --path error

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Add tests for action options

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix file extension config option

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix --print-geometry bug

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Replace Qt::endl with "\n"

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix copy/upload task clipboard conflict

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix endless loop when using --raw and --delay

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix bug in upload handling

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Show dialog after upload if --clipboard is set

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix failing build on Mac and Win

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-10-20 11:48:54 -05:00
Haris Gušić
534f05b238 Refactor tool size handling (#1969)
* Add ConfigHandler::toolSize and setToolSize

* Refactor thickness (now toolSize) in CaptureWidget

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix update of tool size while object is drawn

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Rename thickness to tool size across the board

Tool size is the generic term. Depending on the selected tool,
different specialized names are used. This has always been the case
in the config.

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Reorder circle count tool

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* clang-format

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-10-20 00:01:35 +02:00
Haris Gušić
b05b028861 Miscellaneous small fixes (#1972)
* m_captureWindow->activateWindow(), raise()

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Revert "m_captureWindow->activateWindow(), raise()"

This reverts commit 36320aa38a9584864a5fab32a2ce4872ff5ad072.

* screen --number: indicate 0-indexation

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix color update bug

Also refactored SidePanelWidget sigslots related to color change.

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Stop creating empty flameshot.conf file

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-10-17 17:38:16 +02:00
YizhePKU
7977cbb52c Fix autostart write path (#1979)
* Fix autostart write path (flameshot-org#1975)

* Fix formating
2021-10-16 14:17:02 +02:00
Haris Gušić
1e78d74e94 Fix Enter shortcut bug
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-10-08 19:11:23 +02:00
Haris Gušić
1f2afebaa5 Add standardized OverlayMessage
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-10-08 19:11:22 +02:00
Haris Gušić
a96c3302e9 Add accept tool
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-10-08 19:11:22 +02:00
Haris Gušić
fef7787011 Capture GUI refactor (#1939)
* Merge CTB::ButtonType into CaptureTool::Type

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Remove configshortcuts.cpp which I forgot to do earlier

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Add activeButtonTool & activeButtonToolType in CaptureWidget

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Rename slots in CaptureTool for better mnemonics

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix move tool bug

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Refactor ShortcutsWidget::initButtons

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Move code from CaptureWidget to SelectionWidget: part 1

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Move code from CaptureWidget to SelectionWidget: part 2

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Move code from CaptureWidget to SelectionWidget: part 3

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Move code from CaptureWidget to SelectionWidget: part 4

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Add SelectionWidget::updateCursor

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Move code from CaptureWidget to SelectionWidget: part 5

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Refactor mouse events in CaptureWidget

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Overlay message update

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Replace connect/disconnect with blockSignals

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* updateIcon on button animation finished

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Remove CaptureWidget::selectAll

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Move moveLeft and similar to SelectionWidget

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Mark update calls for removal

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Specialize CaptureWidget update to affected rects

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Tune update of tool objects

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Remove redundant CaptureTool requests

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Improve performance of update in CaptureWidget

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix failing builds

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix failing builds again

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix undo/redo update

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Undo/redo update workaround

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Extend capture tool update rects

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix circle count tool update bug

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Add 'Left Double-Click' tooltip to copy button

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Improve ColorPicker performance

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-10-08 11:04:06 -05:00
borgmanJeremy
a45c2f0f5c fixed a clang-formatting issue that was created during a merge (#1948) 2021-10-07 17:34:56 -05:00
GongHeng2017
c194d582bb Enhancement: add feature #1765 (#1812)
* Enhancement: add feature #1765

Double click replace Ctrl+C.
When Double Clicked, Copy the Screen to Clipboard.

* Enhancement: add feature #1765

Double click replace Ctrl+C.
When Double Clicked, Copy the Screen to Clipboard.
2021-10-07 12:07:57 -05:00
a1346054
b95e096136 Simple maintenance improvements (#1918)
* Use license file from gnu.org

Downloaded from:
https://www.gnu.org/licenses/gpl-3.0.txt

* Add missing final newline

* Fix link

* Fix shellcheck warnings

* Move donation header one level up

* Fix typos

* Stop mixing tabs and spaces

* Trim trailing whitespace
2021-09-27 20:33:45 -05:00
Haris Gušić
d1428889b9 Implement config checking (#1859)
* Add error handling functions to ConfigHandler

Refurbished functions setValue and value which were previously unused.
These functions now set/get a setting with error handling.
Currently recognizes only errors recognizable by QSettings.

* Make use of value and setValue in ConfigHandler

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Add checker for unrecognized general options

Extraneous config options in [General] will be reported as errors.
Added some placeholder functions to be implemented in future commits.

* Introduce keysFromGroup function

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Check shortcut names for duplicates

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix notification spam

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Implement shortcut conflict checking

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix reading of fallbacks on error

If there is a config error, some values would not be loaded correctly.
Using the newly implemented function ConfigHandler::contains instead of
QSettings::contains solves this issue.

These changes reveal u bug that causes a crash on startup.

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix crashes introduced in previous commit

Because ConfigHandler is a dependency of most other classes,
calling functions from those classes inside ConfigHandler caused
infinite recursions in some cases.

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Add config file watcher

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Add missing config options

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix bug in shortcut conflict detection

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Add error resolved notification

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Add GUI error message overlay

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Add indicator in config window

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Use ConfigHandler::fileChanged in ConfigWindow

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix watcher sometimes not firing

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Improve config file watching performance

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Add new way to handle config

This is only a fundamental implementation. Future commits will replace
everything with this new paradigm.

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix getButtons and related functions

Also refactored related code to use QList instead of QVector because
QSettings does not work well with QVector.

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Make good use of the new way

* Implement proper checking for basic types

Everything is covered, apart from KeySequence.

* Move fallback path to ExistingDir value handler

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Use consistent naming scheme in ConfigHandler

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Implement config getters/setters via macro

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Surround text with tr and clang-format

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix colors being saved obfuscated

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Add ValueHandler::represenation

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Move ValueHandler to separate files

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* confighandler.cpp: rename macro CUSTOM to OPTION

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix bug with shortcut conflict checker

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Update docs and fix setAllTheButtons

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Handle filenamePattern properly

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix failing build due to wrong function name

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix QSet error due to Qt version mismatch

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Replace QSharedPointer::get with data for older Qt versions

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix failing build on MacOS and ubuntu 18.04

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Add column headers to recognizedGeneralOptions map

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix ubuntu 18.04 error

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix false positive when shortcuts empty

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix wrong shortcut group prefix

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Implement proper shortcut checking

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Add shortcut map in ConfigHandler

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Move ConfigShortcuts functions to ShortcutsWidget

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix minor bugs

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Add fallback scheme: Pictures, HOME, TMP

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Add config --check CLI option

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Add config error log to GUI

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Rename ValueHandler::description to expected

* Convert Qt's #AARRGGBB to #RRGGBBAA and vice versa

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Remove obsolete `saveAfterCopyPath`

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix errors in example config

Also added an additional ; in front of actual comments to differentiate
them from commented options.

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Allow special value 'picker' in userColors

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Allow only name, #RRGGBB, and #RRGGBBAA color formats

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-09-15 11:56:01 -05:00
crackcat
df20c7ec8f Add a tool to take an inverted screenshot (#1849)
* Add invert tool to build commands

* Add icons for invert tool

* Integrate invert tool

* Add shortcut for invert tool

* Add invert tool

* Add translation for invert tool

* Run clang-format

* Update tool to invert a region instead of everything

* Update shortcut for invert tool

* Update button order of inverter and counter

* Update translations for invert tool

* Run clang-format

* Revert "Update translations for invert tool"

This reverts commit c1fd5a162be6c64b26790d53eab3749b3a124bcf.

* Revert "Add translation for invert tool"

This reverts commit b0c1da5f36e844fa8b5f1492f5f507d85bb7aa7b.

* Update drawSearchArea to match pixelate

* Update invert icon to one from Material Design

Co-authored-by: crackcat <>
2021-09-01 06:45:20 -05:00
Haris Gušić
d54a515574 Make CLI and GUI version info match (#1853)
`flameshot --version` now includes the git commit hash, same as the
About window.

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-08-30 08:39:59 -05:00
Haris Gušić
b4c6778a56 Fall back to default shortcuts (#1843)
* Fall back to default keyboard shortcuts

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Add missing shortcuts and clean up

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Remove obsolete method ConfigHandler::shortcuts

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-08-24 12:57:22 -05:00
Haris Gušić
41ca51bc10 Improve screenshot path handling (#1815)
* Make --path work correctly with relative paths

Relative paths are taken relative to the working directory of the calling
command, not relative to the daemon's working directory.

* Allow file paths in --path and refactor

* Remove some redundancy

These actions are already performed in the respective functions in
FlameshotDBusAdapter.

* Tweak --path error checker a bit more

* Rework FileNameHandler and update references

The class now has a much simpler interface.

- Screenshot paths are now universally determined by the function
  properScreenshotPath
- Some unreferenced methods have been removed
- The documentation of properScreenshotPath documents the changes well.

* Add crude tests for --path

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix failing build on Windows

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Add a test for invalid path

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Make tests clearer

Thanks to @mmahmoudian for his review and contribution.

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix bug in properScreenshotPath

Auto-numeration did not work when the screenshot was automatically
saved when copied to clipboard.

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fall back to default pictures location

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Revert "Remove some redundancy"

This was not redundancy. I had actually introduced a bug with this.

This reverts commit 011ef737564892e494518443e6b80ccf3d286ae1.

* Change default path only on interactive save

Previously, the default save path was changed every time a screenshot
was saved. Now, that only happens when it gets saved from the GUI.

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Change --path help text

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Allow other image formats

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-08-20 13:10:12 -05:00
Haris Gušić
908d918716 Refactor code related to CaptureWidget (#1801)
* Make CaptureWidget::initShortcuts uniform

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Disable window flags in debug builds

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Remove pointer in extendedRect parameter

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Move color initialization to the constructor

* Rename updateButtons to initButtons

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Rename handleButtonSignal to handleToolSignal

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Remove useless code in pixmap()

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Remove obsolete comment

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Move processTool definition inline

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Merge painter, aliasing and process into a function

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Fix inconsistent (non)usage of emit

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Rename nameID to type

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Remove some redundancy in confighandler.cpp

- In `getButtons`: instead of re-adding all the buttons manually, now
  the buttons are taken from
  `CaptureToolButton::getIterableButtonTypes()` and those we want
  unchecked are removed.
- Changed some parts to use `fromButtonToInt` instead of re-implementing
  it inline each time

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>

* Revert "Disable window flags in debug builds"

This reverts commit 2adb583359bc0a1fd2d335f2d0e88299a4d1dd65.

* Disable window flags in debug builds

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-08-08 12:57:40 -05:00