diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml new file mode 100644 index 0000000..2f7de04 --- /dev/null +++ b/.github/workflows/windows.yml @@ -0,0 +1,73 @@ +name: 🏁 Windows +on: + push: + pull_request: + schedule: + - cron: '0 0 * * 2' + +env: + CARGO_TERM_COLOR: always + +jobs: + container: + runs-on: ubuntu-22.04 + container: + image: ghcr.io/piegamesde/gtk4-cross:gtk-4.6 + steps: + - uses: actions/checkout@v1 + - name: Install additional dependencies + # gio is for the build script + run: dnf install wget2 unzip mingw64-bzip2.noarch mingw64-poppler mingw64-poppler-glib mingw32-python3 rust-gio-devel adwaita-icon-theme -y && dnf clean all -y + - uses: actions-rs/toolchain@v1 + with: + profile: minimal + toolchain: stable + target: x86_64-pc-windows-gnu + - name: Cache ~/.cargo + uses: actions/cache@v1 + with: + path: ~/.cargo + key: windows-dotcargo + - name: Cache cargo build + uses: actions/cache@v1 + with: + path: target + key: windows-build-target + - name: Cross compile for Windows + run: | + #!/bin/bash + set -euo pipefail + export PKG_CONFIG_PATH=/usr/lib64/pkgconfig:/usr/share/pkgconfig:$MINGW_PREFIX/lib/pkgconfig/:/usr/x86_64-w64-mingw32/lib/pkgconfig/ + cargo build --target=x86_64-pc-windows-gnu --release --locked + mkdir -p package + cp target/x86_64-pc-windows-gnu/release/czkawka_gui.exe package/ + cp target/x86_64-pc-windows-gnu/release/czkawka_cli.exe package/ + - name: Package + run: | + #!/bin/bash + set -euo pipefail + cp -t package $(pds -vv -f package/*.exe) + # Add gdbus which is recommended on Windows (why?) + cp $MINGW_PREFIX/bin/gdbus.exe package + # Handle the glib schema compilation as well + glib-compile-schemas $MINGW_PREFIX/share/glib-2.0/schemas/ + mkdir -p package/share/glib-2.0/schemas/ + cp -T $MINGW_PREFIX/share/glib-2.0/schemas/gschemas.compiled package/share/glib-2.0/schemas/gschemas.compiled + # Pixbuf stuff, in order to get SVGs (scalable icons) to load + mkdir -p package/lib/gdk-pixbuf-2.0 + cp -rT $MINGW_PREFIX/lib/gdk-pixbuf-2.0 package/lib/gdk-pixbuf-2.0 + cp -f -t package $(pds -vv -f $MINGW_PREFIX/lib/gdk-pixbuf-2.0/2.10.0/loaders/*) + find package -iname "*.dll" -or -iname "*.exe" -type f -exec mingw-strip {} + + + cd package/share + wget2 https://github.com/qarmin/czkawka/files/8880216/gtk4_theme.zip + unzip gtk4_theme.zip + rm gtk4_theme.zip + cd ../.. + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: czkawka-windows-${{ github.sha }} + path: | + ./package + if-no-files-found: error \ No newline at end of file diff --git a/.github/workflows/windows.yml.disabled b/.github/workflows/windows.yml.disabled deleted file mode 100644 index cd150e6..0000000 --- a/.github/workflows/windows.yml.disabled +++ /dev/null @@ -1,511 +0,0 @@ -name: 🏁 Windows -on: - push: - pull_request: - schedule: - - cron: '0 0 * * 2' - -env: - CARGO_TERM_COLOR: always - -jobs: - windows-cli: - strategy: - matrix: - toolchain: [ stable ] - type: [ release ] - runs-on: windows-2019 - steps: - - uses: actions/checkout@v2 - - - uses: actions/setup-python@v1 - - - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.toolchain }} - override: true - - - uses: actions/cache@v2 - with: - path: | - target - key: windows-cli-${{github.ref}}-${{github.sha}} - restore-keys: | - windows-cli-${{github.ref}}-${{github.sha}} - - - name: Build CLI Debug - run: cargo build --bin czkawka_cli - env: - CARGO_INCREMENTAL: 0 - RUSTFLAGS: "-C debuginfo=0 -D warnings" - if: ${{ matrix.type == 'debug'}} - - - name: Build CLI Release - run: cargo build --release --bin czkawka_cli - env: - CARGO_INCREMENTAL: 0 - RUSTFLAGS: "-C debuginfo=0 -D warnings" - if: ${{ matrix.type == 'release'}} - - - name: Store Windows CLI - uses: actions/upload-artifact@v2 - with: - name: czkawka_cli-${{ runner.os }}-${{ matrix.toolchain }} - path: target/release/czkawka_cli.exe - if: ${{ matrix.type == 'release' }} - - # Duplicate finder checks included and excluded directories - # Others are just check delete files number - # Windows build have some elements changed like powershell before wget and unzip, python instead python3, rm -r instead rm -r and one (at the top) additional test which check size of characters - - name: test - run: | - powershell wget https://github.com/qarmin/czkawka/releases/download/1.1.0/TestSuite.zip -O TestSuite.zip - powershell unzip TestSuite.zip -d TestSuite - python misc/check_results.py TestSuite 15 8 - - - target/release/czkawka_cli dup -d "$(pwd)/TestSuite" "$(pwd)\testsuite" -e "$(pwd)/TestSuite/subFolder" -D aeo -m 1024 - python misc/check_results.py TestSuite 13 8 - - rm -r TestSuite - unzip TestSuite.zip -d TestSuite - - target/release/czkawka_cli dup -d "$(pwd)/TestSuite" "$(pwd)/teStSuite" -D aen -m 1024 - python misc/check_results.py TestSuite 7 8 - - rm -r TestSuite - unzip TestSuite.zip -d TestSuite - - target/release/czkawka_cli dup -d "$(pwd)\TestSuite" "$(pwd)/TESTSUITE" -D aen -m 1024 - python misc/check_results.py TestSuite 7 8 - - rm -r TestSuite - unzip TestSuite.zip -d TestSuite - - - - target/release/czkawka_cli dup -d "$(pwd)/TestSuite" -D aen -m 1024 - python misc/check_results.py TestSuite 7 8 - - rm -r TestSuite - unzip TestSuite.zip -d TestSuite - - target/release/czkawka_cli dup -d "$(pwd)/TestSuite" -D aen -m 1024 - python misc/check_results.py TestSuite 7 8 - - rm -r TestSuite - unzip TestSuite.zip -d TestSuite - - target/release/czkawka_cli dup -d "$(pwd)/TestSuite" -x TEXT -D aeo -m 1024 - python misc/check_results.py TestSuite 14 8 - - rm -r TestSuite - unzip TestSuite.zip -d TestSuite - - target/release/czkawka_cli dup -d "$(pwd)/TestSuite" -e "$(pwd)/TestSuite/SubFolder" -D aeo -m 1024 - python misc/check_results.py TestSuite 13 8 - - rm -r TestSuite - unzip TestSuite.zip -d TestSuite - - target/release/czkawka_cli dup -d "$(pwd)/TestSuite" -m 1500 -D aeo - python misc/check_results.py TestSuite 8 8 - - rm -r TestSuite - unzip TestSuite.zip -d TestSuite - - target/release/czkawka_cli dup -d "$(pwd)/TestSuite" -R -m 1024 - python misc/check_results.py TestSuite 15 8 - target/release/czkawka_cli dup -d "$(pwd)/TestSuite" -R -D aeo -m 1024 - python misc/check_results.py TestSuite 13 8 - - - target/release/czkawka_cli big -d "$(pwd)/TestSuite" - - rm -r TestSuite - unzip TestSuite.zip -d TestSuite - - target/release/czkawka_cli empty-files -d "$(pwd)/TestSuite" - python misc/check_results.py TestSuite 15 8 - target/release/czkawka_cli empty-files -d "$(pwd)/TestSuite" -D - python misc/check_results.py TestSuite 13 8 - - rm -r TestSuite - unzip TestSuite.zip -d TestSuite - - target/release/czkawka_cli empty-folders -d "$(pwd)/TestSuite" - python misc/check_results.py TestSuite 15 8 - target/release/czkawka_cli empty-folders -d "$(pwd)/TestSuite" -D - python misc/check_results.py TestSuite 15 2 - - rm -r TestSuite - unzip TestSuite.zip -d TestSuite - - target/release/czkawka_cli temp -d "$(pwd)/TestSuite" - python misc/check_results.py TestSuite 15 8 - target/release/czkawka_cli temp -d "$(pwd)/TestSuite" -D - python misc/check_results.py TestSuite 14 8 - if: ${{ matrix.type == 'release' }} - - windows-gui-release-normal-app: - strategy: - matrix: - toolchain: [ stable ] - type: [ release ] - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v2 - - - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.toolchain }} - override: true - - - name: Install Gtk, Mingw, unzip, zip and wget - run: sudo apt-get update; sudo apt install mingw-w64 libgtk-4-dev unzip wget zip -y - - - name: Build GUI Release Cross Compile - run: | - rustup target add x86_64-pc-windows-gnu - - echo "[target.x86_64-pc-windows-gnu]" > ~/.cargo/config - echo "linker = \"x86_64-w64-mingw32-gcc\"" >> ~/.cargo/config - echo "ar = \"x86_64-w64-mingw32-gcc-ar\"" >> ~/.cargo/config - - GTK_LIBRARY="$(pwd)/gtk_library" - GTK_APP="$(pwd)/gtk_app" - GTK_THEME="$(pwd)/gtk_theme" - - wget https://github.com/qarmin/gtk_library_store/releases/download/3.24.0/gtk4_4_2_test.zip - unzip gtk4_4_2_test.zip -d $GTK_LIBRARY - GTK_LIBRARY="$GTK_LIBRARY/mingw64" - - wget https://github.com/nrhodes91/AdMin/archive/master.zip - unzip master.zip -d $GTK_THEME - - PKG_CONFIG_ALLOW_CROSS=1 PKG_CONFIG_PATH="$GTK_LIBRARY/lib/pkgconfig" RUSTFLAGS="-L $GTK_LIBRARY/lib" cargo build --target=x86_64-pc-windows-gnu --bin czkawka_gui --release - - strip target/x86_64-pc-windows-gnu/release/czkawka_gui.exe - - mkdir $GTK_APP - cp target/x86_64-pc-windows-gnu/release/czkawka_gui.exe $GTK_APP - cp $GTK_LIBRARY/bin/*.dll $GTK_APP - mkdir -p $GTK_APP/share/glib-2.0/schemas - mkdir $GTK_APP/share/icons - cp $GTK_LIBRARY/share/glib-2.0/schemas/* $GTK_APP/share/glib-2.0/schemas - cp -r $GTK_LIBRARY/share/icons/* $GTK_APP/share/icons - mkdir $GTK_APP/lib - cp -r $GTK_LIBRARY/lib/gdk-pixbuf-2.0 $GTK_APP/lib - - mkdir -p $GTK_APP/share/themes - mkdir -p $GTK_APP/share/gtk-3.0 - echo "[Settings]" > $GTK_APP/share/gtk-3.0/settings.ini - echo "gtk-theme-name = admin-gtk3-dark-osx" >> $GTK_APP/share/gtk-3.0/settings.ini - echo "gtk-font-name = Segoe UI 10" >> $GTK_APP/share/gtk-3.0/settings.ini - echo "gtk-xft-rgba = rgb" >> $GTK_APP/share/gtk-3.0/settings.ini - cp $GTK_THEME/AdMin-master/admin-gtk3-dark-osx $GTK_APP/share/themes -r -L - - # This part is only unique for Czkawka - # This code allows to check which icons are used in Czkawka - # cd czkawka/ui - # rg icon-name - rm -rf $GTK_APP/share/icons/Adwaita/16x16 - rm -rf $GTK_APP/share/icons/Adwaita/22x22 - rm -rf $GTK_APP/share/icons/Adwaita/24x24 - rm -rf $GTK_APP/share/icons/Adwaita/256x256 - rm -rf $GTK_APP/share/icons/Adwaita/32x32 - rm -rf $GTK_APP/share/icons/Adwaita/48x48 - rm -rf $GTK_APP/share/icons/Adwaita/512x512 - rm -rf $GTK_APP/share/icons/Adwaita/64x64 - rm -rf $GTK_APP/share/icons/Adwaita/8x8 - rm -rf $GTK_APP/share/icons/Adwaita/96x96 - rm -rf $GTK_APP/share/icons/Adwaita/cursors - rm -rf $GTK_APP/share/icons/Adwaita/scalable - rm -rf $GTK_APP/share/icons/Adwaita/scalable-up-to-32 - rm -rf $GTK_APP/share/icons/hicolor - wget https://github.com/qarmin/gtk_library_store/releases/download/3.24.0/czkawka_icons.zip - unzip czkawka_icons.zip -d $GTK_APP/share/icons/Adwaita - - zip -r gtk_app.zip $GTK_APP - env: - CARGO_INCREMENTAL: 0 - RUSTFLAGS: "-C debuginfo=0 -D warnings" - - - name: Store Windows GUI CrossComplile - uses: actions/upload-artifact@v2 - with: - name: czkawka_gui-release-normal-app-${{ matrix.toolchain }} - path: gtk_app.zip - - windows-gui-release-console: - strategy: - matrix: - toolchain: [ stable ] - type: [ release ] - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v2 - - - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.toolchain }} - override: true - - - name: Install Gtk, Mingw, unzip, zip and wget - run: sudo apt-get update; sudo apt install mingw-w64 libgtk-4-dev unzip wget zip -y - - - name: Build GUI Release Cross Compile - run: | - sed -i 's/windows_subsystem = "windows"/windows_subsystem = "console"/' czkawka_gui/src/main.rs - rustup target add x86_64-pc-windows-gnu - - echo "[target.x86_64-pc-windows-gnu]" > ~/.cargo/config - echo "linker = \"x86_64-w64-mingw32-gcc\"" >> ~/.cargo/config - echo "ar = \"x86_64-w64-mingw32-gcc-ar\"" >> ~/.cargo/config - - GTK_LIBRARY="$(pwd)/gtk_library" - GTK_APP="$(pwd)/gtk_app" - GTK_THEME="$(pwd)/gtk_theme" - - wget https://github.com/qarmin/gtk_library_store/releases/download/3.24.0/mingw64.zip - unzip mingw64.zip -d $GTK_LIBRARY - GTK_LIBRARY="$GTK_LIBRARY/mingw64" - - wget https://github.com/nrhodes91/AdMin/archive/master.zip - unzip master.zip -d $GTK_THEME - - PKG_CONFIG_ALLOW_CROSS=1 PKG_CONFIG_PATH="$GTK_LIBRARY/lib/pkgconfig" RUSTFLAGS="-L $GTK_LIBRARY/lib" cargo build --target=x86_64-pc-windows-gnu --bin czkawka_gui --release - - strip target/x86_64-pc-windows-gnu/release/czkawka_gui.exe - - mkdir $GTK_APP - cp target/x86_64-pc-windows-gnu/release/czkawka_gui.exe $GTK_APP - cp $GTK_LIBRARY/bin/*.dll $GTK_APP - mkdir -p $GTK_APP/share/glib-2.0/schemas - mkdir $GTK_APP/share/icons - cp $GTK_LIBRARY/share/glib-2.0/schemas/* $GTK_APP/share/glib-2.0/schemas - cp -r $GTK_LIBRARY/share/icons/* $GTK_APP/share/icons - mkdir $GTK_APP/lib - cp -r $GTK_LIBRARY/lib/gdk-pixbuf-2.0 $GTK_APP/lib - - mkdir -p $GTK_APP/share/themes - mkdir -p $GTK_APP/share/gtk-3.0 - echo "[Settings]" > $GTK_APP/share/gtk-3.0/settings.ini - echo "gtk-theme-name = admin-gtk3-dark-osx" >> $GTK_APP/share/gtk-3.0/settings.ini - echo "gtk-font-name = Segoe UI 10" >> $GTK_APP/share/gtk-3.0/settings.ini - echo "gtk-xft-rgba = rgb" >> $GTK_APP/share/gtk-3.0/settings.ini - cp $GTK_THEME/AdMin-master/admin-gtk3-dark-osx $GTK_APP/share/themes -r -L - - # This part is only unique for Czkawka - # This code allows to check which icons are used in Czkawka - # cd czkawka/ui - # rg icon-name - rm -rf $GTK_APP/share/icons/Adwaita/16x16 - rm -rf $GTK_APP/share/icons/Adwaita/22x22 - rm -rf $GTK_APP/share/icons/Adwaita/24x24 - rm -rf $GTK_APP/share/icons/Adwaita/256x256 - rm -rf $GTK_APP/share/icons/Adwaita/32x32 - rm -rf $GTK_APP/share/icons/Adwaita/48x48 - rm -rf $GTK_APP/share/icons/Adwaita/512x512 - rm -rf $GTK_APP/share/icons/Adwaita/64x64 - rm -rf $GTK_APP/share/icons/Adwaita/8x8 - rm -rf $GTK_APP/share/icons/Adwaita/96x96 - rm -rf $GTK_APP/share/icons/Adwaita/cursors - rm -rf $GTK_APP/share/icons/Adwaita/scalable - rm -rf $GTK_APP/share/icons/Adwaita/scalable-up-to-32 - rm -rf $GTK_APP/share/icons/hicolor - wget https://github.com/qarmin/gtk_library_store/releases/download/3.24.0/czkawka_icons.zip - unzip czkawka_icons.zip -d $GTK_APP/share/icons/Adwaita - - zip -r gtk_app.zip $GTK_APP - env: - CARGO_INCREMENTAL: 0 - RUSTFLAGS: "-C debuginfo=0 -D warnings" - - - name: Store Windows GUI CrossComplile - uses: actions/upload-artifact@v2 - with: - name: czkawka_gui-release-console-${{ matrix.toolchain }} - path: gtk_app.zip - -# windows-gui-debug-normal-app: -# strategy: -# matrix: -# toolchain: [ stable ] -# type: [ release ] -# runs-on: ubuntu-22.04 -# steps: -# - uses: actions/checkout@v2 -# -# - uses: actions-rs/toolchain@v1 -# with: -# toolchain: ${{ matrix.toolchain }} -# override: true -# -# - name: Install Gtk, Mingw, unzip, zip and wget -# run: sudo apt-get update; sudo apt install mingw-w64 libgtk-4-dev unzip wget zip -y -# -# - name: Build GUI Debug Cross Compile -# run: | -# rustup target add x86_64-pc-windows-gnu -# -# echo "[target.x86_64-pc-windows-gnu]" > ~/.cargo/config -# echo "linker = \"x86_64-w64-mingw32-gcc\"" >> ~/.cargo/config -# echo "ar = \"x86_64-w64-mingw32-gcc-ar\"" >> ~/.cargo/config -# -# GTK_LIBRARY="$(pwd)/gtk_library" -# GTK_APP="$(pwd)/gtk_app" -# GTK_THEME="$(pwd)/gtk_theme" -# -# wget https://github.com/qarmin/gtk_library_store/releases/download/3.24.0/mingw64.zip -# unzip mingw64.zip -d $GTK_LIBRARY -# GTK_LIBRARY="$GTK_LIBRARY/mingw64" -# -# wget https://github.com/nrhodes91/AdMin/archive/master.zip -# unzip master.zip -d $GTK_THEME -# -# PKG_CONFIG_ALLOW_CROSS=1 PKG_CONFIG_PATH="$GTK_LIBRARY/lib/pkgconfig" RUSTFLAGS="-L $GTK_LIBRARY/lib" cargo build --target=x86_64-pc-windows-gnu --bin czkawka_gui -# -# strip target/x86_64-pc-windows-gnu/debug/czkawka_gui.exe -# -# mkdir $GTK_APP -# cp target/x86_64-pc-windows-gnu/debug/czkawka_gui.exe $GTK_APP -# cp $GTK_LIBRARY/bin/*.dll $GTK_APP -# mkdir -p $GTK_APP/share/glib-2.0/schemas -# mkdir $GTK_APP/share/icons -# cp $GTK_LIBRARY/share/glib-2.0/schemas/* $GTK_APP/share/glib-2.0/schemas -# cp -r $GTK_LIBRARY/share/icons/* $GTK_APP/share/icons -# mkdir $GTK_APP/lib -# cp -r $GTK_LIBRARY/lib/gdk-pixbuf-2.0 $GTK_APP/lib -# -# mkdir -p $GTK_APP/share/themes -# mkdir -p $GTK_APP/share/gtk-3.0 -# echo "[Settings]" > $GTK_APP/share/gtk-3.0/settings.ini -# echo "gtk-theme-name = admin-gtk3-dark-osx" >> $GTK_APP/share/gtk-3.0/settings.ini -# echo "gtk-font-name = Segoe UI 10" >> $GTK_APP/share/gtk-3.0/settings.ini -# echo "gtk-xft-rgba = rgb" >> $GTK_APP/share/gtk-3.0/settings.ini -# cp $GTK_THEME/AdMin-master/admin-gtk3-dark-osx $GTK_APP/share/themes -r -L -# -# # This part is only unique for Czkawka -# # This code allows to check which icons are used in Czkawka -# # cd czkawka/ui -# # rg icon-name -# rm -rf $GTK_APP/share/icons/Adwaita/16x16 -# rm -rf $GTK_APP/share/icons/Adwaita/22x22 -# rm -rf $GTK_APP/share/icons/Adwaita/24x24 -# rm -rf $GTK_APP/share/icons/Adwaita/256x256 -# rm -rf $GTK_APP/share/icons/Adwaita/32x32 -# rm -rf $GTK_APP/share/icons/Adwaita/48x48 -# rm -rf $GTK_APP/share/icons/Adwaita/512x512 -# rm -rf $GTK_APP/share/icons/Adwaita/64x64 -# rm -rf $GTK_APP/share/icons/Adwaita/8x8 -# rm -rf $GTK_APP/share/icons/Adwaita/96x96 -# rm -rf $GTK_APP/share/icons/Adwaita/cursors -# rm -rf $GTK_APP/share/icons/Adwaita/scalable -# rm -rf $GTK_APP/share/icons/Adwaita/scalable-up-to-32 -# rm -rf $GTK_APP/share/icons/hicolor -# wget https://github.com/qarmin/gtk_library_store/releases/download/3.24.0/czkawka_icons.zip -# unzip czkawka_icons.zip -d $GTK_APP/share/icons/Adwaita -# -# zip -r gtk_app.zip $GTK_APP -# env: -# CARGO_INCREMENTAL: 0 -# RUSTFLAGS: "-C debuginfo=0 -D warnings" -# -# - name: Store Windows GUI CrossComplile -# uses: actions/upload-artifact@v2 -# with: -# name: czkawka_gui-debug-normal-app-${{ matrix.toolchain }} -# path: gtk_app.zip -# -# -# windows-gui-debug-console: -# strategy: -# matrix: -# toolchain: [ stable ] -# type: [ release ] -# runs-on: ubuntu-22.04 -# steps: -# - uses: actions/checkout@v2 -# -# - uses: actions-rs/toolchain@v1 -# with: -# toolchain: ${{ matrix.toolchain }} -# override: true -# -# - name: Install Gtk, Mingw, unzip, zip and wget -# run: sudo apt-get update; sudo apt install mingw-w64 libgtk-4-dev unzip wget zip -y -# -# - name: Build GUI Debug Cross Compile -# run: | -# sed -i 's/windows_subsystem = "windows"/windows_subsystem = "console"/' czkawka_gui/src/main.rs -# rustup target add x86_64-pc-windows-gnu -# -# echo "[target.x86_64-pc-windows-gnu]" > ~/.cargo/config -# echo "linker = \"x86_64-w64-mingw32-gcc\"" >> ~/.cargo/config -# echo "ar = \"x86_64-w64-mingw32-gcc-ar\"" >> ~/.cargo/config -# -# GTK_LIBRARY="$(pwd)/gtk_library" -# GTK_APP="$(pwd)/gtk_app" -# GTK_THEME="$(pwd)/gtk_theme" -# -# wget https://github.com/qarmin/gtk_library_store/releases/download/3.24.0/mingw64.zip -# unzip mingw64.zip -d $GTK_LIBRARY -# GTK_LIBRARY="$GTK_LIBRARY/mingw64" -# -# wget https://github.com/nrhodes91/AdMin/archive/master.zip -# unzip master.zip -d $GTK_THEME -# -# PKG_CONFIG_ALLOW_CROSS=1 PKG_CONFIG_PATH="$GTK_LIBRARY/lib/pkgconfig" RUSTFLAGS="-L $GTK_LIBRARY/lib" cargo build --target=x86_64-pc-windows-gnu --bin czkawka_gui -# -# strip target/x86_64-pc-windows-gnu/debug/czkawka_gui.exe -# -# mkdir $GTK_APP -# cp target/x86_64-pc-windows-gnu/debug/czkawka_gui.exe $GTK_APP -# cp $GTK_LIBRARY/bin/*.dll $GTK_APP -# mkdir -p $GTK_APP/share/glib-2.0/schemas -# mkdir $GTK_APP/share/icons -# cp $GTK_LIBRARY/share/glib-2.0/schemas/* $GTK_APP/share/glib-2.0/schemas -# cp -r $GTK_LIBRARY/share/icons/* $GTK_APP/share/icons -# mkdir $GTK_APP/lib -# cp -r $GTK_LIBRARY/lib/gdk-pixbuf-2.0 $GTK_APP/lib -# -# mkdir -p $GTK_APP/share/themes -# mkdir -p $GTK_APP/share/gtk-3.0 -# echo "[Settings]" > $GTK_APP/share/gtk-3.0/settings.ini -# echo "gtk-theme-name = admin-gtk3-dark-osx" >> $GTK_APP/share/gtk-3.0/settings.ini -# echo "gtk-font-name = Segoe UI 10" >> $GTK_APP/share/gtk-3.0/settings.ini -# echo "gtk-xft-rgba = rgb" >> $GTK_APP/share/gtk-3.0/settings.ini -# cp $GTK_THEME/AdMin-master/admin-gtk3-dark-osx $GTK_APP/share/themes -r -L -# -# # This part is only unique for Czkawka -# # This code allows to check which icons are used in Czkawka -# # cd czkawka/ui -# # rg icon-name -# rm -rf $GTK_APP/share/icons/Adwaita/16x16 -# rm -rf $GTK_APP/share/icons/Adwaita/22x22 -# rm -rf $GTK_APP/share/icons/Adwaita/24x24 -# rm -rf $GTK_APP/share/icons/Adwaita/256x256 -# rm -rf $GTK_APP/share/icons/Adwaita/32x32 -# rm -rf $GTK_APP/share/icons/Adwaita/48x48 -# rm -rf $GTK_APP/share/icons/Adwaita/512x512 -# rm -rf $GTK_APP/share/icons/Adwaita/64x64 -# rm -rf $GTK_APP/share/icons/Adwaita/8x8 -# rm -rf $GTK_APP/share/icons/Adwaita/96x96 -# rm -rf $GTK_APP/share/icons/Adwaita/cursors -# rm -rf $GTK_APP/share/icons/Adwaita/scalable -# rm -rf $GTK_APP/share/icons/Adwaita/scalable-up-to-32 -# rm -rf $GTK_APP/share/icons/hicolor -# wget https://github.com/qarmin/gtk_library_store/releases/download/3.24.0/czkawka_icons.zip -# unzip czkawka_icons.zip -d $GTK_APP/share/icons/Adwaita -# -# zip -r gtk_app.zip $GTK_APP -# env: -# CARGO_INCREMENTAL: 0 -# RUSTFLAGS: "-C debuginfo=0 -D warnings" -# -# - name: Store Windows GUI CrossComplile -# uses: actions/upload-artifact@v2 -# with: -# name: czkawka_gui-debug-console-${{ matrix.toolchain }} -# path: gtk_app.zip \ No newline at end of file diff --git a/czkawka_core/i18n/en/czkawka_core.ftl b/czkawka_core/i18n/en/czkawka_core.ftl index fd44161..d523ab4 100644 --- a/czkawka_core/i18n/en/czkawka_core.ftl +++ b/czkawka_core/i18n/en/czkawka_core.ftl @@ -26,6 +26,7 @@ core_directory_overlap = Directories: All directories to search overlaps with ex core_directory_unable_to_get_device_id = Directories: Unable to get device id from folder { $path } core_ffmpeg_not_found = Cannot find proper installation of FFmpeg +core_ffmpeg_not_found_windows = When using Windows be sure that ffmpeg.exe and ffprobe.exe are available in PATH or are put directly to same folder where is app executable core_ffmpeg_missing_in_snap = Similar Videos don't work currently with snap, if you want help look at - { $url } core_saving_to_cache = Saved to file { $number } cache entries diff --git a/czkawka_core/src/bad_extensions.rs b/czkawka_core/src/bad_extensions.rs index a5cc195..8f5df4b 100644 --- a/czkawka_core/src/bad_extensions.rs +++ b/czkawka_core/src/bad_extensions.rs @@ -21,7 +21,7 @@ use crate::common_items::ExcludedItems; use crate::common_messages::Messages; use crate::common_traits::*; -static DISABLED_EXTENSIONS: &[&str] = &["file", "cache", "bak"]; // Such files can have any type inside +static DISABLED_EXTENSIONS: &[&str] = &["file", "cache", "bak", "data"]; // Such files can have any type inside // This adds several workarounds for bugs/invalid recognizing types by external libraries // ("real_content_extension", "current_file_extension") @@ -33,10 +33,10 @@ static WORKAROUNDS: &[(&str, &str)] = &[ ("exe", "bck"), ("exe", "com"), ("exe", "cpl"), - ("exe", "dll"), ("exe", "dll16"), - ("exe", "drv"), + ("exe", "dll"), ("exe", "drv16"), + ("exe", "drv"), ("exe", "ds"), ("exe", "efi"), ("exe", "exe16"), @@ -44,20 +44,43 @@ static WORKAROUNDS: &[(&str, &str)] = &[ ("exe", "mod16"), ("exe", "msstyles"), ("exe", "mui"), + ("exe", "mun"), ("exe", "orig"), + ("exe", "ps1xml"), + ("exe", "rll"), + ("exe", "rs"), + ("exe", "scr"), ("exe", "signed"), ("exe", "sys"), ("exe", "tlb"), + ("exe", "tsp"), + ("exe", "vdm"), ("exe", "vxd"), ("exe", "winmd"), + ("gz", "loggz"), ("xml", "adml"), + ("xml", "admx"), + ("xml", "camp"), + ("xml", "cdmp"), + ("xml", "cdxml"), + ("xml", "dgml"), + ("xml", "diagpkg"), + ("xml", "gmmp"), + ("xml", "library-ms"), + ("xml", "man"), ("xml", "manifest"), + ("xml", "msc"), ("xml", "mum"), + ("xml", "resx"), + ("zip", "wmz"), // Other + ("exe", "pyd"), // Python/Mingw ("gz", "blend"), // Blender ("gz", "crate"), // Cargo ("gz", "svgz"), // Archive svg ("gz", "tgz"), // Archive + ("html", "dtd"), // Mingw + ("html", "ent"), // Mingw ("html", "md"), // Markdown ("jpg", "jfif"), // Photo format ("mobi", "azw3"), // Ebook format @@ -70,6 +93,7 @@ static WORKAROUNDS: &[(&str, &str)] = &[ ("ogg", "ogv"), // Audio format ("pptx", "ppsx"), // Powerpoint ("sh", "bash"), // Linux + ("sh", "guess"), // GNU ("sh", "pl"), // Gnome/Linux ("sh", "pm"), // Gnome/Linux ("sh", "py"), // Python @@ -90,6 +114,7 @@ static WORKAROUNDS: &[(&str, &str)] = &[ ("xml", "iml"), // Intelij Idea ("xml", "kdenlive"), // KDenLive ("xml", "lang"), // ? + ("xml", "nuspec"), // Nuget ("xml", "policy"), // SystemD ("xml", "qsys"), // Quartus ("xml", "sopcinfo"), // Quartus @@ -112,12 +137,14 @@ static WORKAROUNDS: &[(&str, &str)] = &[ ("zip", "odg"), // Libreoffice ("zip", "pptx"), // Powerpoint ("zip", "whl"), // Python packages + ("zip", "xlsx"), // Excel ("zip", "xpi"), // Firefox extensions ("zip", "zcos"), // Scilab // Probably invalid ("html", "svg"), ("xml", "html"), // Probably bug in external library + ("msi", "ppt"), // Not sure whe ppt is not recognized ("msi", "doc"), // Not sure whe doc is not recognized ("exe", "xls"), // Not sure whe xls is not recognized ]; diff --git a/czkawka_core/src/broken_files.rs b/czkawka_core/src/broken_files.rs index 069300b..f2ebf11 100644 --- a/czkawka_core/src/broken_files.rs +++ b/czkawka_core/src/broken_files.rs @@ -48,7 +48,7 @@ pub struct FileEntry { pub error_string: String, } -#[derive(Copy, Clone, PartialEq, Eq, Serialize, Deserialize)] +#[derive(Copy, Clone, PartialEq, Eq, Serialize, Deserialize, Debug)] pub enum TypeOfFile { Unknown = -1, Image = 0, @@ -57,6 +57,17 @@ pub enum TypeOfFile { PDF, } +bitflags! { + pub struct CheckedTypes : u32 { + const NONE = 0; + + const PDF = 0b1; + const AUDIO = 0b10; + const IMAGE = 0b100; + const ARCHIVE = 0b1000; + } +} + /// Info struck with helpful information's about results #[derive(Default)] pub struct Info { @@ -80,6 +91,7 @@ pub struct BrokenFiles { recursive_search: bool, delete_method: DeleteMethod, stopped_search: bool, + checked_types: CheckedTypes, use_cache: bool, delete_outdated_cache: bool, // TODO add this to GUI save_also_as_json: bool, @@ -101,6 +113,7 @@ impl BrokenFiles { use_cache: true, delete_outdated_cache: true, save_also_as_json: false, + checked_types: CheckedTypes::PDF | CheckedTypes::AUDIO | CheckedTypes::IMAGE | CheckedTypes::ARCHIVE, } } @@ -126,6 +139,10 @@ impl BrokenFiles { &self.broken_files } + pub fn set_checked_types(&mut self, checked_types: CheckedTypes) { + self.checked_types = checked_types; + } + pub const fn get_text_messages(&self) -> &Messages { &self.text_messages } @@ -303,6 +320,10 @@ impl BrokenFiles { continue 'dir; } + if !check_extension_allowed(&type_of_file, &self.checked_types) { + continue 'dir; + } + let current_file_name = current_folder.join(entry_data.file_name()); if self.excluded_items.is_excluded(¤t_file_name) { continue 'dir; @@ -368,6 +389,8 @@ impl BrokenFiles { let mut records_already_cached: BTreeMap = Default::default(); let mut non_cached_files_to_check: BTreeMap = Default::default(); + let mut files_to_check = Default::default(); + mem::swap(&mut self.files_to_check, &mut files_to_check); if self.use_cache { loaded_hash_map = match load_cache_from_file(&mut self.text_messages, self.delete_outdated_cache) { @@ -375,22 +398,26 @@ impl BrokenFiles { None => Default::default(), }; - for (name, file_entry) in &self.files_to_check { + for (name, file_entry) in files_to_check { + let checked_extension = check_extension_allowed(&file_entry.type_of_file, &self.checked_types); // Only broken + #[allow(clippy::if_same_then_else)] - if !loaded_hash_map.contains_key(name) { - // If loaded data doesn't contains current image info - non_cached_files_to_check.insert(name.clone(), file_entry.clone()); - } else if file_entry.size != loaded_hash_map.get(name).unwrap().size || file_entry.modified_date != loaded_hash_map.get(name).unwrap().modified_date { + if checked_extension && !loaded_hash_map.contains_key(&name) { + // If loaded data doesn't contains current info + non_cached_files_to_check.insert(name, file_entry.clone()); + } else if checked_extension && file_entry.size != loaded_hash_map.get(&name).unwrap().size + || file_entry.modified_date != loaded_hash_map.get(&name).unwrap().modified_date + { // When size or modification date of image changed, then it is clear that is different image - non_cached_files_to_check.insert(name.clone(), file_entry.clone()); + non_cached_files_to_check.insert(name, file_entry); } else { // Checking may be omitted when already there is entry with same size and modification date - records_already_cached.insert(name.clone(), loaded_hash_map.get(name).unwrap().clone()); + records_already_cached.insert(name.clone(), loaded_hash_map.get(&name).unwrap().clone()); } } } else { loaded_hash_map = Default::default(); - mem::swap(&mut self.files_to_check, &mut non_cached_files_to_check); + non_cached_files_to_check = files_to_check; } //// PROGRESS THREAD START @@ -765,6 +792,12 @@ fn check_extension_availability(file_name_lowercase: &str) -> TypeOfFile { TypeOfFile::Unknown } } +fn check_extension_allowed(type_of_file: &TypeOfFile, checked_types: &CheckedTypes) -> bool { + ((*type_of_file == TypeOfFile::Image) && ((*checked_types & CheckedTypes::IMAGE) == CheckedTypes::IMAGE)) + || ((*type_of_file == TypeOfFile::PDF) && ((*checked_types & CheckedTypes::PDF) == CheckedTypes::PDF)) + || ((*type_of_file == TypeOfFile::ArchiveZip) && ((*checked_types & CheckedTypes::ARCHIVE) == CheckedTypes::ARCHIVE)) + || ((*type_of_file == TypeOfFile::Audio) && ((*checked_types & CheckedTypes::AUDIO) == CheckedTypes::AUDIO)) +} fn unpack_pdf_error(e: PdfError) -> PdfError { if let Try { diff --git a/czkawka_core/src/similar_videos.rs b/czkawka_core/src/similar_videos.rs index 3cda46f..39591a0 100644 --- a/czkawka_core/src/similar_videos.rs +++ b/czkawka_core/src/similar_videos.rs @@ -203,6 +203,7 @@ impl SimilarVideos { pub fn find_similar_videos(&mut self, stop_receiver: Option<&Receiver<()>>, progress_sender: Option<&futures::channel::mpsc::UnboundedSender>) { if !check_if_ffmpeg_is_installed() { self.text_messages.errors.push(flc!("core_ffmpeg_not_found")); + self.text_messages.errors.push(flc!("core_ffmpeg_not_found_windows")); self.text_messages.errors.push(flc!( "core_ffmpeg_missing_in_snap", generate_translation_hashmap(vec![("url", "https://github.com/snapcrafters/ffmpeg/issues/73".to_string())]) diff --git a/czkawka_gui/i18n/en/czkawka_gui.ftl b/czkawka_gui/i18n/en/czkawka_gui.ftl index e0450da..31baf01 100644 --- a/czkawka_gui/i18n/en/czkawka_gui.ftl +++ b/czkawka_gui/i18n/en/czkawka_gui.ftl @@ -116,6 +116,11 @@ main_label_shown_files = Number of shown files main_label_resize_algorithm = Resize algorithm main_label_similarity = Similarity{" "} +main_check_box_broken_files_audio = Audio +main_check_box_broken_files_pdf = Pdf +main_check_box_broken_files_archive = Archive +main_check_box_broken_files_image = Image + check_button_general_same_size = Ignore same size check_button_general_same_size_tooltip = Ignore from results, files which have identical size - usually this are 1:1 duplicates @@ -474,6 +479,7 @@ move_stats = Properly moved {$num_files}/{$all_files} items save_results_to_file = Saved results to file {$name} search_not_choosing_any_music = ERROR: You must select at least one checkbox with music searching types. +search_not_choosing_any_broken_files = ERROR: You must select at least one checkbox with type of checked broken files. include_folders_dialog_title = Folders to include exclude_folders_dialog_title = Folders to exclude diff --git a/czkawka_gui/src/connect_things/connect_button_search.rs b/czkawka_gui/src/connect_things/connect_button_search.rs index 860c648..112c624 100644 --- a/czkawka_gui/src/connect_things/connect_button_search.rs +++ b/czkawka_gui/src/connect_things/connect_button_search.rs @@ -7,7 +7,7 @@ use gtk4::prelude::*; use czkawka_core::bad_extensions::BadExtensions; use czkawka_core::big_file::BigFile; -use czkawka_core::broken_files::BrokenFiles; +use czkawka_core::broken_files::{BrokenFiles, CheckedTypes}; use czkawka_core::common_dir_traversal; use czkawka_core::duplicate::DuplicateFinder; use czkawka_core::empty_files::EmptyFiles; @@ -64,6 +64,10 @@ pub fn connect_button_search( let check_button_music_genre: gtk4::CheckButton = gui_data.main_notebook.check_button_music_genre.clone(); let check_button_music_length: gtk4::CheckButton = gui_data.main_notebook.check_button_music_length.clone(); let check_button_music_bitrate: gtk4::CheckButton = gui_data.main_notebook.check_button_music_bitrate.clone(); + let check_button_broken_files_archive: gtk4::CheckButton = gui_data.main_notebook.check_button_broken_files_archive.clone(); + let check_button_broken_files_pdf: gtk4::CheckButton = gui_data.main_notebook.check_button_broken_files_pdf.clone(); + let check_button_broken_files_audio: gtk4::CheckButton = gui_data.main_notebook.check_button_broken_files_audio.clone(); + let check_button_broken_files_image: gtk4::CheckButton = gui_data.main_notebook.check_button_broken_files_image.clone(); let check_button_recursive = gui_data.upper_notebook.check_button_recursive.clone(); let check_button_settings_duplicates_delete_outdated_cache = gui_data.settings.check_button_settings_duplicates_delete_outdated_cache.clone(); let check_button_settings_hide_hard_links = gui_data.settings.check_button_settings_hide_hard_links.clone(); @@ -484,19 +488,50 @@ pub fn connect_button_search( let futures_sender_broken_files = futures_sender_broken_files.clone(); - thread::spawn(move || { - let mut br = BrokenFiles::new(); + let mut checked_types: CheckedTypes = CheckedTypes::NONE; - br.set_included_directory(included_directories); - br.set_excluded_directory(excluded_directories); - br.set_recursive_search(recursive_search); - br.set_excluded_items(excluded_items); - br.set_use_cache(use_cache); - br.set_allowed_extensions(allowed_extensions); - br.set_save_also_as_json(save_also_as_json); - br.find_broken_files(Some(&stop_receiver), Some(&futures_sender_broken_files)); - let _ = glib_stop_sender.send(Message::BrokenFiles(br)); - }); + if check_button_broken_files_audio.is_active() { + checked_types |= CheckedTypes::AUDIO; + } + if check_button_broken_files_pdf.is_active() { + checked_types |= CheckedTypes::PDF; + } + if check_button_broken_files_image.is_active() { + checked_types |= CheckedTypes::IMAGE; + } + if check_button_broken_files_archive.is_active() { + checked_types |= CheckedTypes::ARCHIVE; + } + + if checked_types != CheckedTypes::NONE { + thread::spawn(move || { + let mut br = BrokenFiles::new(); + + br.set_included_directory(included_directories); + br.set_excluded_directory(excluded_directories); + br.set_recursive_search(recursive_search); + br.set_excluded_items(excluded_items); + br.set_use_cache(use_cache); + br.set_allowed_extensions(allowed_extensions); + br.set_save_also_as_json(save_also_as_json); + br.set_checked_types(checked_types); + br.find_broken_files(Some(&stop_receiver), Some(&futures_sender_broken_files)); + let _ = glib_stop_sender.send(Message::BrokenFiles(br)); + }); + } else { + set_buttons( + &mut *shared_buttons.borrow_mut().get_mut(&NotebookMainEnum::BrokenFiles).unwrap(), + &buttons_array, + &buttons_names, + ); + entry_info.set_text(&flg!("search_not_choosing_any_broken_files")); + show_dialog.store(false, Ordering::Relaxed); + + notebook_main.set_sensitive(true); + notebook_upper.set_sensitive(true); + button_settings.set_sensitive(true); + button_app_info.set_sensitive(true); + } } NotebookMainEnum::BadExtensions => { label_stage.show(); diff --git a/czkawka_gui/src/gui_structs/gui_main_notebook.rs b/czkawka_gui/src/gui_structs/gui_main_notebook.rs index d01a5c4..301692b 100644 --- a/czkawka_gui/src/gui_structs/gui_main_notebook.rs +++ b/czkawka_gui/src/gui_structs/gui_main_notebook.rs @@ -109,6 +109,12 @@ pub struct GuiMainNotebook { pub scale_similarity_similar_videos: Scale, + // Broken Files + pub check_button_broken_files_audio: CheckButton, + pub check_button_broken_files_pdf: CheckButton, + pub check_button_broken_files_archive: CheckButton, + pub check_button_broken_files_image: CheckButton, + // Music pub check_button_music_title: CheckButton, pub check_button_music_artist: CheckButton, @@ -209,6 +215,11 @@ impl GuiMainNotebook { let check_button_music_length: CheckButton = builder.object("check_button_music_length").unwrap(); let check_button_music_approximate_comparison: CheckButton = builder.object("check_button_music_approximate_comparison").unwrap(); + let check_button_broken_files_audio: CheckButton = builder.object("check_button_broken_files_audio").unwrap(); + let check_button_broken_files_pdf: CheckButton = builder.object("check_button_broken_files_pdf").unwrap(); + let check_button_broken_files_archive: CheckButton = builder.object("check_button_broken_files_archive").unwrap(); + let check_button_broken_files_image: CheckButton = builder.object("check_button_broken_files_image").unwrap(); + let scale_similarity_similar_images: Scale = builder.object("scale_similarity_similar_images").unwrap(); let scale_similarity_similar_videos: Scale = builder.object("scale_similarity_similar_videos").unwrap(); @@ -284,6 +295,9 @@ impl GuiMainNotebook { check_button_music_approximate_comparison, scale_similarity_similar_images, scale_similarity_similar_videos, + check_button_broken_files_audio, + check_button_broken_files_pdf, + check_button_broken_files_archive, check_button_image_ignore_same_size, label_similar_images_minimal_similarity, label_duplicate_check_method, @@ -321,6 +335,7 @@ impl GuiMainNotebook { gc_tree_view_bad_extensions, combo_box_big_files_mode, label_big_files_mode, + check_button_broken_files_image, } } @@ -396,6 +411,11 @@ impl GuiMainNotebook { self.check_button_image_fast_compare .set_tooltip_text(Some(&flg!("main_notebook_image_fast_compare_tooltip"))); + self.check_button_broken_files_audio.set_label(Some(&flg!("main_check_box_broken_files_audio"))); + self.check_button_broken_files_archive.set_label(Some(&flg!("main_check_box_broken_files_archive"))); + self.check_button_broken_files_image.set_label(Some(&flg!("main_check_box_broken_files_image"))); + self.check_button_broken_files_pdf.set_label(Some(&flg!("main_check_box_broken_files_pdf"))); + { let hash_size_index = self.combo_box_image_hash_size.active().unwrap() as usize; let hash_size = IMAGES_HASH_SIZE_COMBO_BOX[hash_size_index]; diff --git a/czkawka_gui/src/saving_loading.rs b/czkawka_gui/src/saving_loading.rs index 8de7b40..d47959a 100644 --- a/czkawka_gui/src/saving_loading.rs +++ b/czkawka_gui/src/saving_loading.rs @@ -42,6 +42,11 @@ const DEFAULT_IMAGE_REMOVE_AUTO_OUTDATED_CACHE: bool = true; const DEFAULT_DUPLICATE_REMOVE_AUTO_OUTDATED_CACHE: bool = true; const DEFAULT_DUPLICATE_CASE_SENSITIVE_NAME_CHECKING: bool = false; +const DEFAULT_BROKEN_FILES_PDF: bool = true; +const DEFAULT_BROKEN_FILES_AUDIO: bool = true; +const DEFAULT_BROKEN_FILES_ARCHIVE: bool = true; +const DEFAULT_BROKEN_FILES_IMAGE: bool = true; + const DEFAULT_NUMBER_OF_BIGGEST_FILES: &str = "50"; const DEFAULT_SIMILAR_IMAGES_SIMILARITY: i32 = 0; const DEFAULT_SIMILAR_IMAGES_IGNORE_SAME_SIZE: bool = false; @@ -427,6 +432,10 @@ enum LoadText { SimilarVideosIgnoreSameSize, MusicApproximateComparison, DuplicateNameCaseSensitive, + BrokenFilesPdf, + BrokenFilesAudio, + BrokenFilesImage, + BrokenFilesArchive, } fn create_hash_map() -> (HashMap, HashMap) { @@ -469,6 +478,10 @@ fn create_hash_map() -> (HashMap, HashMap) { (LoadText::MusicApproximateComparison, "music_approximate_comparison"), (LoadText::DuplicateNameCaseSensitive, "duplicate_name_case_sensitive"), (LoadText::ComboBoxBigFiles, "combo_box_big_files_mode"), + (LoadText::BrokenFilesPdf, "broken_files_pdf"), + (LoadText::BrokenFilesAudio, "broken_files_audio"), + (LoadText::BrokenFilesImage, "broken_files_image"), + (LoadText::BrokenFilesArchive, "broken_files_archive"), ]; let mut hashmap_ls: HashMap = Default::default(); let mut hashmap_sl: HashMap = Default::default(); @@ -583,6 +596,23 @@ pub fn save_configuration(manual_execution: bool, upper_notebook: &GuiUpperNoteb settings.check_button_settings_show_text_view.is_active(), ); + saving_struct.save_var( + hashmap_ls.get(&LoadText::BrokenFilesArchive).unwrap().to_string(), + main_notebook.check_button_broken_files_archive.is_active(), + ); + saving_struct.save_var( + hashmap_ls.get(&LoadText::BrokenFilesImage).unwrap().to_string(), + main_notebook.check_button_broken_files_image.is_active(), + ); + saving_struct.save_var( + hashmap_ls.get(&LoadText::BrokenFilesAudio).unwrap().to_string(), + main_notebook.check_button_broken_files_audio.is_active(), + ); + saving_struct.save_var( + hashmap_ls.get(&LoadText::BrokenFilesPdf).unwrap().to_string(), + main_notebook.check_button_broken_files_pdf.is_active(), + ); + // Others saving_struct.save_var( hashmap_ls.get(&LoadText::MinimalCacheSize).unwrap().to_string(), @@ -756,6 +786,11 @@ pub fn load_configuration( DEFAULT_DUPLICATE_CASE_SENSITIVE_NAME_CHECKING, ); + let check_button_broken_files_archive = loaded_entries.get_integer(hashmap_ls.get(&LoadText::BrokenFilesArchive).unwrap().clone(), DEFAULT_BROKEN_FILES_ARCHIVE); + let check_button_broken_files_pdf = loaded_entries.get_integer(hashmap_ls.get(&LoadText::BrokenFilesPdf).unwrap().clone(), DEFAULT_BROKEN_FILES_ARCHIVE); + let check_button_broken_files_image = loaded_entries.get_integer(hashmap_ls.get(&LoadText::BrokenFilesImage).unwrap().clone(), DEFAULT_BROKEN_FILES_ARCHIVE); + let check_button_broken_files_audio = loaded_entries.get_integer(hashmap_ls.get(&LoadText::BrokenFilesAudio).unwrap().clone(), DEFAULT_BROKEN_FILES_ARCHIVE); + // Setting data if manual_execution || loading_at_start { { @@ -880,6 +915,11 @@ pub fn load_configuration( main_notebook.check_button_video_ignore_same_size.set_active(similar_videos_ignore_same_size); main_notebook.scale_similarity_similar_videos.set_value(similar_videos_similarity as f64); + main_notebook.check_button_broken_files_audio.set_active(check_button_broken_files_audio); + main_notebook.check_button_broken_files_pdf.set_active(check_button_broken_files_pdf); + main_notebook.check_button_broken_files_image.set_active(check_button_broken_files_image); + main_notebook.check_button_broken_files_archive.set_active(check_button_broken_files_archive); + { let combo_chosen_index = main_notebook.combo_box_duplicate_check_method.active().unwrap(); @@ -1004,6 +1044,11 @@ pub fn reset_configuration(manual_clearing: bool, upper_notebook: &GuiUpperNoteb main_notebook.combo_box_image_hash_size.set_active(Some(0)); main_notebook.combo_box_big_files_mode.set_active(Some(0)); + main_notebook.check_button_broken_files_audio.set_active(DEFAULT_BROKEN_FILES_AUDIO); + main_notebook.check_button_broken_files_pdf.set_active(DEFAULT_BROKEN_FILES_PDF); + main_notebook.check_button_broken_files_archive.set_active(DEFAULT_BROKEN_FILES_ARCHIVE); + main_notebook.check_button_broken_files_image.set_active(DEFAULT_BROKEN_FILES_IMAGE); + main_notebook.scale_similarity_similar_images.set_range(0_f64, SIMILAR_VALUES[0][5] as f64); // DEFAULT FOR MAX of 8 main_notebook.scale_similarity_similar_images.set_fill_level(SIMILAR_VALUES[0][5] as f64); diff --git a/czkawka_gui/ui/czkawka.cmb b/czkawka_gui/ui/czkawka.cmb index 548c1ee..30fb4c0 100755 --- a/czkawka_gui/ui/czkawka.cmb +++ b/czkawka_gui/ui/czkawka.cmb @@ -167,7 +167,7 @@ (5,129,"GtkScrolledWindow","scrolled_window_invalid_symlinks",128,None,None,None,None), (5,130,"GtkLabel",None,128,None,None,None,None), (5,131,"GtkNotebookPage",None,56,None,None,None,9), - (5,132,"GtkScrolledWindow","scrolled_window_broken_files",131,None,None,None,None), + (5,132,"GtkBox",None,131,None,None,None,None), (5,133,"GtkLabel",None,131,None,None,None,None), (5,134,"GtkNotebookPage",None,56,None,None,None,10), (5,135,"GtkScrolledWindow","scrolled_window_bad_extensions",134,None,None,None,None), @@ -225,6 +225,12 @@ (5,220,"GtkImage",None,219,None,None,None,None), (5,221,"GtkComboBoxText","combo_box_big_files_mode",74,None,None,None,1), (5,222,"GtkLabel","label_big_files_mode",74,None,None,None,None), + (5,223,"GtkScrolledWindow","scrolled_window_broken_files",132,None,None,None,1), + (5,224,"GtkBox",None,132,None,None,None,None), + (5,225,"GtkCheckButton","check_button_broken_files_audio",224,None,None,None,None), + (5,226,"GtkCheckButton","check_button_broken_files_pdf",224,None,None,None,1), + (5,227,"GtkCheckButton","check_button_broken_files_archive",224,None,None,None,2), + (5,228,"GtkCheckButton","check_button_broken_files_image",224,None,None,None,3), (6,1,"GtkPopover","popover_right_click",None,None,None,None,None), (6,2,"GtkBox",None,1,None,None,None,None), (6,3,"GtkButton","buttons_popover_right_click_open_file",2,None,None,None,None), @@ -284,12 +290,12 @@ (9,27,"GtkBox",None,26,None,None,None,None), (9,28,"GtkCheckButton","check_button_settings_hide_hard_links",27,None,None,None,None), (9,29,"GtkCheckButton","check_button_settings_show_preview_duplicates",27,None,None,None,1), - (9,30,"GtkCheckButton","check_button_settings_duplicates_delete_outdated_cache",27,None,None,None,2), + (9,30,"GtkCheckButton","check_button_settings_duplicates_delete_outdated_cache",27,None,None,None,8), (9,31,"GtkBox",None,27,None,None,None,3), (9,32,"GtkLabel","label_settings_duplicate_minimal_size_cache",31,None,None,None,None), (9,33,"GtkEntry","entry_settings_cache_file_minimal_size",31,None,None,None,1), (9,34,"GtkCheckButton","check_button_duplicates_use_prehash_cache",27,None,None,None,4), - (9,35,"GtkButton","button_settings_duplicates_clear_cache",27,None,None,None,5), + (9,35,"GtkButton","button_settings_duplicates_clear_cache",27,None,None,None,9), (9,36,"GtkBox",None,27,None,None,None,6), (9,37,"GtkLabel","label_settings_duplicate_minimal_size_cache_prehash",36,None,None,None,None), (9,38,"GtkEntry","entry_settings_prehash_cache_file_minimal_size",36,None,None,None,1), @@ -302,7 +308,7 @@ (9,45,"GtkLabel",None,40,None,None,None,None), (9,46,"GtkNotebookPage",None,6,None,None,None,3), (9,47,"GtkBox",None,46,None,None,None,None), - (9,48,"GtkButton","button_settings_similar_videos_clear_cache",47,None,None,None,None), + (9,48,"GtkButton","button_settings_similar_videos_clear_cache",47,None,None,None,3), (9,49,"GtkCheckButton","check_button_settings_similar_videos_delete_outdated_cache",47,None,None,None,1), (9,50,"GtkLabel",None,46,None,None,None,None), (9,51,"GtkBox",None,3,None,None,None,2), @@ -629,6 +635,7 @@ (5,131,"GtkNotebookPage","child",None,None,None,None,None,132), (5,131,"GtkNotebookPage","position","9",None,None,None,None,None), (5,131,"GtkNotebookPage","tab",None,None,None,None,None,133), + (5,132,"GtkOrientable","orientation","vertical",None,None,None,None,None), (5,132,"GtkWidget","focusable","1",None,None,None,None,None), (5,133,"GtkLabel","label","Broken Files",1,None,None,None,None), (5,134,"GtkNotebookPage","child",None,None,None,None,None,135), @@ -729,6 +736,15 @@ (5,220,"GtkImage","icon-name","image-missing",None,None,None,None,None), (5,220,"GtkWidget","halign","center",None,None,None,None,None), (5,222,"GtkLabel","label","VVV",None,None,None,None,None), + (5,223,"GtkWidget","vexpand","True",None,None,None,None,None), + (5,225,"GtkCheckButton","active","True",None,None,None,None,None), + (5,225,"GtkCheckButton","label","Audio",None,None,None,None,None), + (5,226,"GtkCheckButton","active","True",None,None,None,None,None), + (5,226,"GtkCheckButton","label","PDF",None,None,None,None,None), + (5,227,"GtkCheckButton","active","True",None,None,None,None,None), + (5,227,"GtkCheckButton","label","Archive",None,None,None,None,None), + (5,228,"GtkCheckButton","active","True",None,None,None,None,None), + (5,228,"GtkCheckButton","label","Image",None,None,None,None,None), (6,1,"GtkPopover","child",None,None,None,None,None,2), (6,1,"GtkPopover","position","left",None,None,None,None,None), (6,2,"GtkOrientable","orientation","vertical",None,None,None,None,None), diff --git a/czkawka_gui/ui/main_window.ui b/czkawka_gui/ui/main_window.ui index 17fed1f..9097abc 100644 --- a/czkawka_gui/ui/main_window.ui +++ b/czkawka_gui/ui/main_window.ui @@ -778,8 +778,42 @@ - + 1 + vertical + + + + + True + Audio + + + + + True + PDF + + + + + True + Archive + + + + + True + Image + + + + + + + True + + 9 diff --git a/czkawka_gui/ui/settings.ui b/czkawka_gui/ui/settings.ui index 7cf49dd..5333862 100644 --- a/czkawka_gui/ui/settings.ui +++ b/czkawka_gui/ui/settings.ui @@ -156,13 +156,6 @@ Show image preview - - - 1 - 1 - Delete outdated cache entries automatically - - 4 @@ -190,14 +183,6 @@ Use prehash cache - - - 1 - Remove outdated results from duplicates cache - 1 - center - - 4 @@ -219,6 +204,21 @@ + + + 1 + 1 + Delete outdated cache entries automatically + + + + + 1 + Remove outdated results from duplicates cache + 1 + center + + 1 @@ -271,6 +271,12 @@ vertical + + + 1 + Delete outdated cache entries automatically + + 1 @@ -279,12 +285,6 @@ center - - - 1 - Delete outdated cache entries automatically - - 3