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).
* 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>
* 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>
* 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>
* 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 <>
* 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>
* 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>
* 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>
* Show shortcuts in CaptureToolButton tooltips
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
* Change size indicator tooltip to reduce ambiguity
* 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>
* Make `ShortcutsWidget` load all shortcuts
`ShortcutsWidget" now loads shortcuts for all capture widgets,
regardless of enabled state in 'Interface settings'.
Also removed unnecessary indirection which made the API confusing:
- Removed `ConfigHandler::setShortcutsDefault` which was only called
once on a temporary `ConfigHandler` and hence had no effect
- Removed function `ConfigHandler::shortcuts`
- `ShortcutsWidget` now calls `ConfigShortcuts::captureShortcutsDefault`
directly instead of through `ConfigHandler::shortcuts`
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
* Enable shortcuts for hidden buttons
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
* Fix crash if ButtonHandler has no buttons
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
* obligatory clang-format
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
* GeneralConf.cpp: Remove redundant initializations
Removed unnecessary setChecked and setValue calls in init* methods which
get called inside updateComponents anyway. Also added missing function
calls in updateComponents. This has exposed more bugs.
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
* Merge updateComponents and setActualFormData
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
* Fix useJpgForClipboard checkbox
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
* Fix crash when 'Automatic updates' is checked
The config window used to crash when 'Automatic updates' check box was
interacted with, if the application started with the system tray
disabled.
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
* Some cleanup
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
* Fix#1697 and #1726
Changed ConfigWindow to inherit QWidget and moved QTabWidget to be an
attribute. setMinimumSize is no longer necessary in ConfigWindow.
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
* Create scroll area around checkboxes
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
* Do not truncate tab bar anymore
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
* Set parent widget to prevent a memory leak
Signed-off-by: Haris Gušić <harisgusic.dev@gmail.com>
Using QFileInfo::baseName() discards everything after the first ., so
filenames like 1.2.3.4.png would be changed to 1.png. (See #1722).
Changing this to QFileInfo::completeBaseName() only discards the suffix,
so we have 1.2.3.4.jpg becoming 1.2.3.4.png, for example.