Skip to content

Commit

Permalink
Adds Mac GUI (#160)
Browse files Browse the repository at this point in the history
* Adds Mac GUI

* Update Rust to 1.4.9
  • Loading branch information
qarmin authored Dec 31, 2020
1 parent 4eefe11 commit 72d74dd
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 28 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,47 @@ jobs:
name: czkawka_cli-${{ runner.os }}-${{ matrix.toolchain }}
path: target/release/czkawka_cli
if: ${{ matrix.type == 'release' }}

macos-gui:
strategy:
matrix:
toolchain: [ stable ]
type: [ release ]
runs-on: macos-latest
steps:
- uses: actions/checkout@v2

- uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
override: true

- name: Install Homebrew
run: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

- name: Override link[WORKAROUND] # Looks that this is a bug with current homebrew or Github CI
run: rm '/usr/local/bin/2to3'

- name: Install GTK3
run: brew install rust gtk+3

- name: Build GUI Debug
run: cargo build --bin czkawka_gui
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-C debuginfo=0 -D warnings"
if: ${{ matrix.type == 'debug'}}

- name: Build GUI Release
run: cargo build --release --bin czkawka_gui
env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-C debuginfo=0 -D warnings"
if: ${{ matrix.type == 'release'}}

- name: Store MacOS GUI
uses: actions/upload-artifact@v2
with:
name: czkawka_gui-${{ runner.os }}-${{ matrix.toolchain }}
path: target/release/czkawka_gui
if: ${{ matrix.type == 'release' }}
34 changes: 33 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,30 @@ After that the latest GTK 3 runtime must be installed from https://github.com/ts
## Usage
### Precompiled binaries
Precompiled binaries are available here - https://github.com/qarmin/czkawka/releases/.
If the app does not run when clicking at a launcher, run it through a terminal.
If the app does not run when clicking at a launcher, run it through a terminal.
You don't need to have any additional libraries for CLI Czkawka
#### GUI Requirements
##### Linux
For Czkawka GUI you need to have at least GTK 3.22.
It should be installed by default on all the most popular distros.
##### Windows
`czkawka_gui.exe` extracted from zip file `windows_czkawka_gui.zip` needs to have all files inside around, because use them.
If you want to move somewhere else exe binary and open it, you need to install GTK 3 runtime from site https://github.com/tschoonj/GTK-for-Windows-Runtime-Environment-Installer/releases
##### MacOS
For now you need to install manually GTK 3 libraries, because are dynamically loaded from OS(Help needed to use static linking).
To install it you need to type this commands in terminal
```shell
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install gtk+3
```
Next you need to go to place where you downloaded app and add executable bit
```shell
chmod +x mac_czkawka_gui
```
At the end you can open this app
```shell
./mac_czkawka_gui
```

### Appimage
Appimage files are available in release page - https://github.com/qarmin/czkawka/releases/
Expand Down Expand Up @@ -112,6 +135,12 @@ sudo apt install -y libgtk-3-dev
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh # Download the latest stable Rust
sudo yum install gtk3-devel glib2-devel
```
#### MacOS
You need to install Homebrew and GTK Libraries
```shell
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install rust gtk+3
```

### Compilation from source
- Download the source
Expand Down Expand Up @@ -228,3 +257,6 @@ Windows dark theme is used from AdMin repo - https://github.com/nrhodes91/AdMin
Program is completely free to use.

"Gratis to uczciwa cena" - "Free is a fair price"

## Dotations
If you are using the app, I would appreciate a donation for its further development - https://github.com/sponsors/qarmin.
2 changes: 1 addition & 1 deletion czkawka_core/src/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ impl Common {
let temp_splits: Vec<&str> = expression.split('*').collect();
let mut splits: Vec<&str> = Vec::new();
for i in temp_splits {
if i != "" {
if !i.is_empty() {
splits.push(i);
}
}
Expand Down
2 changes: 1 addition & 1 deletion czkawka_core/src/common_extensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl Extensions {

let extensions: Vec<String> = allowed_extensions.split(',').map(String::from).collect();
for mut extension in extensions {
if extension == "" || extension.replace('.', "").trim() == "" {
if extension.is_empty() || extension.replace('.', "").trim() == "" {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion czkawka_core/src/common_items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ impl ExcludedItems {
for expression in expressions {
let expression: String = expression.trim().to_string();

if expression == "" {
if expression.is_empty() {
continue;
}
if expression == "DEFAULT" {
Expand Down
13 changes: 5 additions & 8 deletions czkawka_core/src/same_music.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,10 +395,7 @@ impl SameMusic {
Some(t) => t.to_string(),
None => "".to_string(),
};
file_entry.year = match tag.year() {
Some(t) => t,
None => 0,
};
file_entry.year = tag.year().unwrap_or(0);

Some(Some(file_entry))
})
Expand Down Expand Up @@ -474,7 +471,7 @@ impl SameMusic {
let mut hash_map: HashMap<String, Vec<FileEntry>> = Default::default();
for file_entry in vec_file_entry {
let title = file_entry.title.to_lowercase().trim().to_string();
if title != "" {
if !title.is_empty() {
hash_map.entry(title.clone()).or_insert_with(Vec::new);
hash_map.get_mut(title.as_str()).unwrap().push(file_entry);
}
Expand All @@ -501,7 +498,7 @@ impl SameMusic {
let mut hash_map: HashMap<String, Vec<FileEntry>> = Default::default();
for file_entry in vec_file_entry {
let artist = file_entry.artist.to_lowercase().trim().to_string();
if artist != "" {
if !artist.is_empty() {
hash_map.entry(artist.clone()).or_insert_with(Vec::new);
hash_map.get_mut(artist.as_str()).unwrap().push(file_entry);
}
Expand All @@ -528,7 +525,7 @@ impl SameMusic {
let mut hash_map: HashMap<String, Vec<FileEntry>> = Default::default();
for file_entry in vec_file_entry {
let album_title = file_entry.album_title.to_lowercase().trim().to_string();
if album_title != "" {
if !album_title.is_empty() {
hash_map.entry(album_title.clone()).or_insert_with(Vec::new);
hash_map.get_mut(album_title.as_str()).unwrap().push(file_entry);
}
Expand All @@ -555,7 +552,7 @@ impl SameMusic {
let mut hash_map: HashMap<String, Vec<FileEntry>> = Default::default();
for file_entry in vec_file_entry {
let album_artist = file_entry.album_artist.to_lowercase().trim().to_string();
if album_artist != "" {
if !album_artist.is_empty() {
hash_map.entry(album_artist.clone()).or_insert_with(Vec::new);
hash_map.get_mut(album_artist.as_str()).unwrap().push(file_entry);
}
Expand Down
21 changes: 5 additions & 16 deletions czkawka_gui/src/connect_button_search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,7 @@ pub fn connect_button_search(
} else {
panic!("No radio button is pressed");
}
let minimal_file_size = match entry_duplicate_minimal_size.get_text().as_str().parse::<u64>() {
Ok(t) => t,
Err(_) => 1024, // By default
};
let minimal_file_size = entry_duplicate_minimal_size.get_text().as_str().parse::<u64>().unwrap_or(1024);

let glib_stop_sender = glib_stop_sender.clone();
let stop_receiver = stop_receiver.clone();
Expand Down Expand Up @@ -202,10 +199,7 @@ pub fn connect_button_search(

get_list_store(&scrolled_window_big_files_finder).clear();

let numbers_of_files_to_check = match entry_big_files_number.get_text().as_str().parse::<usize>() {
Ok(t) => t,
Err(_) => 50, // By default
};
let numbers_of_files_to_check = entry_big_files_number.get_text().as_str().parse::<usize>().unwrap_or(50);

let glib_stop_sender = glib_stop_sender.clone();
let stop_receiver = stop_receiver.clone();
Expand Down Expand Up @@ -258,10 +252,7 @@ pub fn connect_button_search(
let glib_stop_sender = glib_stop_sender.clone();
let stop_receiver = stop_receiver.clone();

let minimal_file_size = match entry_similar_images_minimal_size.get_text().as_str().parse::<u64>() {
Ok(t) => t,
Err(_) => 1024 * 16, // By default
};
let minimal_file_size = entry_similar_images_minimal_size.get_text().as_str().parse::<u64>().unwrap_or(1024 * 16);

let similarity;
if radio_button_similar_images_minimal.get_active() {
Expand Down Expand Up @@ -326,10 +317,8 @@ pub fn connect_button_search(

get_list_store(&scrolled_window_same_music_finder).clear();

let minimal_file_size = match entry_same_music_minimal_size.get_text().as_str().parse::<u64>() {
Ok(t) => t,
Err(_) => 1024, // By default
};
let minimal_file_size = entry_same_music_minimal_size.get_text().as_str().parse::<u64>().unwrap_or(1024);

let mut music_similarity: MusicSimilarity = MusicSimilarity::NONE;

if check_button_music_title.get_active() {
Expand Down

0 comments on commit 72d74dd

Please sign in to comment.