Commit Graph

777 Commits

Author SHA1 Message Date
Giancarlo França
d446f13cc8 Make text alignment buttons mutually exclusive (#1981) 2021-10-16 10:19:17 +02:00
Haris Gušić
0854fa8b84 Change help message from static to a CaptureWidget attribute
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-10-12 22:25:44 +02:00
Haris Gušić
4df2447b3e Show dyanamic panel shortcut in help message
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-10-12 17:50:03 +02:00
Haris Gušić
0aa315908d Cleanup
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-10-12 14:24:09 +02:00
Haris Gušić
5b815e83d3 Reappear help message when selection hidden
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-10-12 13:35:57 +02:00
Haris Gušić
0b31fcf4cb Change ColorGrabWidget overlay message
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-10-11 22:46:06 +02:00
Haris Gušić
6f132b77c6 Disappear OverlayMessage on select
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-10-11 22:46:06 +02:00
Haris Gušić
d89fe10079 Change overlay message style
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-10-11 22:46:00 +02:00
Haris Gušić
d17d200a28 Merge branch 'master' into capture_requests
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-10-11 21:11:20 +02:00
Haris Gušić
82096a6301 Fix capture launched from system tray
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-10-11 21:04:04 +02:00
Haris Gušić
0e43d4b36f Fix boundary bug with pixelate and invert tools (#1957)
* Fix invert tool selection

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

* Fix pixelate tool

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-10-10 20:32:00 -05:00
Haris Gušić
454e8f887a Workaround for focus problem (#1958)
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-10-10 20:27:23 -05:00
Haris Gušić
1d334d372b Disable remaining action buttons when accept is active
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-10-09 20:42:53 +02:00
Haris Gušić
b650231fa5 Improve tool object performance (#1954)
* Update tool object thickness in real time

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

* Fix update when drawing with modifier key

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

* Rename updateToolMousePreview to updateTool

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

* Fix update bug when changing tool size

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-10-08 15:24:27 -05:00
Haris Gušić
f0adfabd47 Fix failing builds
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-10-08 22:08:35 +02:00
Haris Gušić
c59cd049b7 Add icon for accept tool
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-10-08 19:11:23 +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ć
73e6762e3d Remove redundant DBus methods
NOTE: This breaks KDE shortcuts
2021-10-08 19:11:22 +02:00
Haris Gušić
6d29e133d3 Remove irrelevant shortcut descriptions
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-10-08 19:11:22 +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ć
5ee85ed5c0 Add requestCapture DBus call
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-10-08 19:11:22 +02:00
Haris Gušić
f2c5641046 Remove irrelevant buttons
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-10-08 19:11:22 +02:00
Haris Gušić
d39737fd46 Refactor CaptureTool::pressed and derivatives
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-10-08 19:11:22 +02:00
Haris Gušić
151f6e35b4 Refactor CaptureRequest
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-10-08 19:11:22 +02:00
Haris Gušić
60d2d8c33d Stop special treatment of some buttons
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-10-08 19:11:22 +02:00
Haris Gušić
85352ff72f Add accept button to CaptureWidget
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
Mitchel Humpherys
c2ea8b6f61 Reduce max thickness (#1940)
The thickness slider is fairly small, so it's difficult to make small
adjustments. The max value of the thickness slider is currently 100, which
is actually pretty huge.

Since most common use cases involve smaller pixel values (closer to the
0-10 range, I suspect), reduce the maximum slider value to 25, allowing for
easier fine grained control of the drawing thickness.

Although fine grained control is already possible via the scroll wheel,
this change improves the overall usability of the tool, especially for new
users who many not know that thickness can be adjusted with the scroll
wheel (or for users who don't have a scroll wheel).
2021-10-06 19:50:54 -05:00
borgmanJeremy
0b777c4558 Added text alignment (#1892) 2021-10-06 13:23:54 -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ć
7199fd392c Remove ConfigHandler refs in static initializers (#1908)
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-09-23 15:05:52 -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
Haris Gušić
e0cd397dc1 Make m_context.selection synced with m_selection (#1894) 2021-09-14 08:16:03 -05:00
Haris Gušić
aca0db963b Color grabber zoom preview (#1869)
* Add ColorGrabWidget

The new widget aims to decouple color grabbing from the SidePanelWidget.

* Refactor SidePanelWidget to use ColorGrabWidget

- All color grabbing functionality is now moved to ColorGrabWidget
- SidePanelWidget now uses a more organized sigslot approach
- Removed QColorPickingEventFilter

* Fix bug and complete implementation

Timer not yet implemented.

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

* Add 0.5s timer

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

* Fix failing builds

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

* Add hex color editor

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

* Add right mouse button instant preview

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

* Make zoom widget toggle-able

* Implement OverlayMessage class

* Make Right click do the same as Space

* Unzoom widget when mouse leaves it

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

* Fix some small issues

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

* Toggle panel when grabbing color

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

* Show with timer even if magnifier active

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

* Reduce timer delay

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

* Fix OverlayMessage bug

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-09-13 09:09:25 -05:00
Haris Gušić
327e42d842 Fix drag behavior of Tool Settings button (#1891)
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-09-13 09:09:02 -05:00
Haris Gušić
d13501cea8 Fix FLAMESHOT_DEBUG_CAPTURE cmake option (#1888)
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-09-13 08:14:01 -05:00
Haris Gušić
9147d4ea03 Implement tool thickness via keyboard (#1882)
* Implement changing tool size by keyboard

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

* Fix very poor performance when changing thickness

* Make thickness get saved to config

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-09-11 12:57:43 -05:00
Yurii Puchkov
23cf19308b The "copy to clipboard" button keeps the margin of the selected annotation #1879 (#1881)
Co-authored-by: Yuriy Puchkov <yuriy.puchkov@namecheap.com>
2021-09-11 12:55:13 -05:00
Haris Gušić
accfeee022 Fix debug option for capture mode (#1884)
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-09-11 12:54:38 -05:00
Haris Gušić
d8d428f568 Move TYPE_INVERT to bottom of enum (#1880)
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-09-10 09:04:47 -05:00
James Tai
ec70df1067 Fix edit buttons appearing inside selection (#1856)
* Fix edit buttons appearing inside selection

* Reformat files
2021-09-01 06:48:19 -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ć
29c7a5f781 Fix selection bug introduced in ac3e9189 (#1860)
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-08-31 15:00:58 -05:00
Haris Gušić
e4f067b86d Fix wrong default config export path (#1848)
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-08-30 11:11:52 -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ć
ac3e918960 Some tweaks to the capture GUI (#1841)
* Don't show buttons if selection is inactive

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

* Move tool creates new selection if not visible

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

* Make thickness adjustment methods uniform

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

* Hide  cursor while changing thickness

Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
2021-08-24 10:28:48 -05:00