Commit graph

13 commits

Author SHA1 Message Date
Stefan Markovic 5cfbd72fa8
[PowerRename] Fluent UX (#13678)
* PowerRename new UI

* Add scrollviewer

* Don't deploy PowerRenameUI_new

* Visual updates

* Visual updates

* Updates

* Update Resources.resw

* Added docs button

* Update MainWindow.xaml

* Wire Docs button

* RegEx -> regular expressions

* Update Show only renamed list on search/replace text changed

* Update Show only renamed list on search/replace text changed - proper fix
Set searchTerm to NULL when cleared - fix Show only renamed files on clear searchTerm

* Files/folders input error handling

* Fix renaming with keeping UI window opened

After renaming folder, all of it's children need path update.
Without path update, further renaming of children items would
fail.

* Update only children, not all items with greater depth

* Fix dictionary false positives

* Remove .NET dep

* Rename PowerRenameUI_new to PowerRenameUILib
Rename executable PowerRenameUIHost to PowerRename

Co-authored-by: Laute <Niels.Laute@philips.com>
2021-10-25 14:40:19 +01:00
Andrey Nekrasov 063e704321
build: Treat warnings as errors in the remaining projects (#8689)
* build: remove #pragma comment(lib

* build: treat warnings as errors for all src projects
2020-12-21 18:51:48 +03:00
Mehmet Murat Akburak da22e21a0e
[PowerRename] Fix tests inconsistency, improve test performance (#8129)
* Move retrieveing file attibutes to PowerRenameRegex
Move file attributes unit tests to PowerRenameRegexTests
Add file time field to MockPowerRenameItem

* Add file attributes unittests to PowerRenameManagerTests

* Change variable name

* Rearrange function arguments

* Check if file attributes are used only once

* Change variable name LocalTime -> fileTime, date -> time

* Set fileTime as a member of PowerRenameRegEx rather than passing as an argument

* Change function name isFileAttributesUsed() -> isFileTimeUsed()
Check before resetting fileTime

* Fix small bugs

* Fix typos

* Refactor for readability, move free calls to reachable places

* Fix search for area empty bug
searchTerm being empty is not an invalid argument rather it must return OK without any operation
Tests must check if Replace()  returns S_OK becuase later it checks its result

* Check return values of method calls in PowerRenameManager
Remove received argments checks from some methods because argument being null or empty string doesnt mean it is invalid or method fails

* Fix formatting. Remove overlooked comment. Fix error message.

* Change HRESULT declarations according to coding style

* Fix unhandled case. Refactor.
2020-12-14 10:28:12 +01:00
Raphael Horber 8c7f2b6a74
PowerRename: Add Lookbehind (#7571)
* Add boost-regex library

* If enabled use boost lib for regex

Add property `_useBoostLib` to `CPowerRenameRegEx`. If enabled for
replacements with regular expressions the Boost Library is used instead
of the Standard Library.

* Extend signatures to create RegEx with Boost

Extend create and constructor singatures of `CPowerRenameRegEx` with an
option to enable (or disabled, which is default) the Boost Library.

* Verify Lookbehind fails with STD library

To verify that the boost library is disabled as expected, check if a
lookbehind fails.

* Add Unit tests for RegEx with Boost

Add unit tests to verify regex replacement with Boost Library. They are
copied and adapted from the Standard Library tests.

* Improve verify capturing groups test with Boost

It is possible to use a capturing group followed by numbers as
replacement if the group number is enclosed in curly braces.
Added test cases based on the Standard Library tests.

* Add useBoostLib to settings interface

* Get library option from settings object

* Reduce signatures of RegEx by "useBoost"

Remove the parameter added in 19105cf, as it became obsolete.

* Settings: Read useBoostLib from JSON file

* Add UseBoostLib Option to UI

* Boost Lib label states the regex syntax difference

* Fix Regex with Boost Lib tests

- Do not load settings another time in CPowerRenameRegEx ctor
- Set flag correctly in standard library regex tests

* Add "lookbehind" to dictionary

* change Library to lowercase, and also add a comment

As suggested by @enricogior.

Co-authored-by: Enrico Giordani <enricogior@users.noreply.github.com>

* Change Library to lowercase and add a comment

 As suggested by @enricogior.

Co-authored-by: Enrico Giordani <enricogior@users.noreply.github.com>
2020-11-09 19:13:43 +01:00
Mehmet Murat Akburak d3b80b26e3
[PowerRename] Add Filtering Feature (#6017)
* Implement basic functionality

* Change approach.
move filter controls to manager
edit redrawing to always work with new GetVisibleItemCount() and GetVisibleItemByIndex() calls

* Fix performance issues. Some refactoring.

* Handle toggleAll correctly

* Handle dangling elements when filter is on

Make an item visible if it has at least one visible subitem

* Support filtering for selected and shouldRename

* Refactor for readability, remove useless member from PowerRenameUI

* Change variable names in PowerRenameUI for clarity

Use wrapper function RedrawItems() and SetItemCount() for consistency

* Handle result value properly in getVisibleItemByIndex()

* Add FlagsApplicable filter

* Add visual indication of filters

* Improve performance

Check if no filter is selected
Call SetItemCount() only when necessary

* Refactor for readability

* Get lock in setVisible()

* Change function names to camel case

* Change function names to start with uppercase

* Change filter behaviour when search area is empty

Show all elements when search area is empty and ShouldRename filter is selected
Avoid warnings

* Resolve conflicts
2020-08-25 08:22:05 +03:00
Mehmet Murat Akburak 35a214603f
[PowerRename] Clear capturing groups with more than 1 digit (#5116)
User has actually signed CLA, see #4722

* Clear capturing groups with more than 1 digit

* Fix issue in regex pattern

* Add unittest

* Fix regex patterns

* Edit unittest

* Fix regex pattern, add some tests
2020-07-22 14:12:46 -07:00
Mehmet Murat Akburak 30f442d774
[PowerRename] upper/lower/titlecase transform feature (#4183)
* Add basic transform functionality

* Add basic transform functionality

* Change toupper/tolower/isspace to towupper/towlower/towisspace. For loops omitted if possible.

* Avoid wcslen() in for statement

* Avoid wcslen() in for statement

* Add basic transform functionality

* Change toupper/tolower/isspace to towupper/towlower/towisspace. For loops omitted if possible.

* Avoid wcslen() in for statement

* Avoid wcslen() in for statement

* Add basic transform functionality

* Change toupper/tolower/isspace to towupper/towlower/towisspace. For loops omitted if possible.

* Avoid wcslen() in for statement

* Adjust Powerrename Interface

* Add trimming rename string

* Remove leading and trailing spaces from rename string

* Add support for transforming only item name or extension. Temporarily remove trimming to refactor. Change CAPITALIZED to TITLECASE

* Fix bug when search for area is empty

* Add trimming back with refactor(leading spaces, trailing spaces, trailing dots)

* Now supports transforming when search area is empty

* Add smarter titlecase

Transformation breaks when new filename contains an unusable character (\/?:*?"<>|)
These characters need to be removed from new name anyway.

* minor bugfix

* Add unittests, contains failing tests

* Remove unnecessary/failing tests

* remove generated file

* some code formatting and fix memory leak issues

* Use proper allocation, change int to size_t

* Refactor. Move transforming to Helpers.cpp

* Refactor. Move trimming to Helpers.cpp

* Change StrDup to SHStrDup. Some refactoring.

* Fix memery leak, add proper result controls, use newNameToUse in functon calls becaause it is where the final form of the string is tracked

* Change declarations of strings, add proper result controls

* Slightly widen the labels to cover the whole text

* Add extended characters support

* Rename a variable

* Correctly identify the last word for titlecase

* Add empty line to last line of resource.h
2020-07-02 11:52:01 +03:00
Mehmet Murat Akburak 014f3b9873
[PowerRename] capturing groups fix (#4181)
* Fix capturing group bug when Match All Occurrences is not checked

* Capture groups are now available when Match All Occurences option is not selected

* Bug fix when capture group is indicated with leading zeros. $01 should be considered as $1 etc

* Use flags in regex_replace() when Match All Occurences is not selected

Now the behaviour is consistent with how regex works when Match All Occurences is selected.
2020-06-16 11:04:14 +03:00
Rafael Rivera d16ebba9e0
Move from sdk-provided cppwinrt-1.x to cppwinrt-2.x nuget package (#2246) 2020-04-29 22:02:18 +02:00
Chris Davis e328c5d505 * Fix crashing bug in event vector cleanup
* Fix warnings in settings.cpp
* Add settings to ui of powertoys
2019-11-11 20:58:39 -08:00
Chris Davis 1e89054897 * Ensure rename dialog is centered
* Ensure children are renamed before parent items
* Add settings handler
* Replace old text referencing smart rename with power rename
2019-11-11 11:00:42 -08:00
Chris Davis 1efe5bff9f Fix single regex search replace
Fix an issue where regular expression search and replace was not being done correctly when MatchAllOccurences is not specified.
2019-11-01 23:56:29 -07:00
Chris Davis e1d5dd263a
Initial add of PowerRename from SmartRename repo (#499)
* Initial add of PowerRename from SmartRename repo
2019-10-17 20:57:19 -07:00