Skip to content

Commit 32135ea

Browse files
committed
Implement GUI
1 parent 6c9848d commit 32135ea

File tree

27 files changed

+2526
-201
lines changed

27 files changed

+2526
-201
lines changed

.github/workflows/ci.yml

Lines changed: 72 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,27 @@ jobs:
1919
rust: [stable]
2020

2121
steps:
22-
- uses: actions/checkout@v3
22+
- uses: actions/checkout@v4
2323

2424
- name: Install Rust
25-
uses: actions-rs/toolchain@v1
25+
uses: dtolnay/rust-toolchain@stable
2626
with:
27-
toolchain: ${{ matrix.rust }}
28-
override: true
2927
components: rustfmt, clippy
3028

3129
- name: Cache cargo registry
32-
uses: actions/cache@v3
30+
uses: actions/cache@v4
3331
with:
3432
path: ~/.cargo/registry
3533
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
3634

3735
- name: Cache cargo index
38-
uses: actions/cache@v3
36+
uses: actions/cache@v4
3937
with:
4038
path: ~/.cargo/git
4139
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
4240

4341
- name: Cache cargo build
44-
uses: actions/cache@v3
42+
uses: actions/cache@v4
4543
with:
4644
path: target
4745
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
@@ -58,18 +56,80 @@ jobs:
5856
- name: Run tests
5957
run: cargo test --verbose --all-features
6058

59+
build-binaries:
60+
name: Build Binaries
61+
runs-on: ${{ matrix.os }}
62+
strategy:
63+
matrix:
64+
include:
65+
- os: ubuntu-latest
66+
target: x86_64-unknown-linux-gnu
67+
artifact_name: p2p-transfer
68+
asset_name: p2p-transfer-linux-x86_64
69+
- os: windows-latest
70+
target: x86_64-pc-windows-msvc
71+
artifact_name: p2p-transfer.exe
72+
asset_name: p2p-transfer-windows-x86_64
73+
- os: macos-latest
74+
target: x86_64-apple-darwin
75+
artifact_name: p2p-transfer
76+
asset_name: p2p-transfer-macos-x86_64
77+
- os: macos-latest
78+
target: aarch64-apple-darwin
79+
artifact_name: p2p-transfer
80+
asset_name: p2p-transfer-macos-aarch64
81+
82+
steps:
83+
- uses: actions/checkout@v4
84+
85+
- name: Install Rust
86+
uses: dtolnay/rust-toolchain@stable
87+
with:
88+
targets: ${{ matrix.target }}
89+
90+
- name: Build release binary
91+
run: cargo build --release --target ${{ matrix.target }}
92+
93+
- name: Strip binary (Linux/macOS)
94+
if: matrix.os != 'windows-latest'
95+
run: strip target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
96+
97+
- name: Create archive (Linux/macOS)
98+
if: matrix.os != 'windows-latest'
99+
run: |
100+
cd target/${{ matrix.target }}/release
101+
tar czf ${{ matrix.asset_name }}.tar.gz ${{ matrix.artifact_name }}
102+
cd -
103+
mv target/${{ matrix.target }}/release/${{ matrix.asset_name }}.tar.gz .
104+
105+
- name: Create archive (Windows)
106+
if: matrix.os == 'windows-latest'
107+
shell: pwsh
108+
run: |
109+
cd target/${{ matrix.target }}/release
110+
Compress-Archive -Path ${{ matrix.artifact_name }} -DestinationPath ${{ matrix.asset_name }}.zip
111+
cd ../../../
112+
Move-Item target/${{ matrix.target }}/release/${{ matrix.asset_name }}.zip .
113+
114+
- name: Upload binary archive
115+
uses: actions/upload-artifact@v4
116+
with:
117+
name: ${{ matrix.asset_name }}
118+
path: |
119+
${{ matrix.asset_name }}.tar.gz
120+
${{ matrix.asset_name }}.zip
121+
if-no-files-found: ignore
122+
retention-days: 30
123+
61124
coverage:
62125
name: Code Coverage
63126
runs-on: ubuntu-latest
64127

65128
steps:
66-
- uses: actions/checkout@v3
129+
- uses: actions/checkout@v4
67130

68131
- name: Install Rust
69-
uses: actions-rs/toolchain@v1
70-
with:
71-
toolchain: stable
72-
override: true
132+
uses: dtolnay/rust-toolchain@stable
73133

74134
- name: Install tarpaulin
75135
run: cargo install cargo-tarpaulin

.github/workflows/release.yml

Lines changed: 53 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,60 +18,97 @@ jobs:
1818
- os: ubuntu-latest
1919
target: x86_64-unknown-linux-gnu
2020
artifact_name: p2p-transfer
21-
asset_name: p2p-transfer-linux-amd64
21+
asset_name: p2p-transfer-linux-x86_64
2222
- os: windows-latest
2323
target: x86_64-pc-windows-msvc
2424
artifact_name: p2p-transfer.exe
25-
asset_name: p2p-transfer-windows-amd64.exe
25+
asset_name: p2p-transfer-windows-x86_64
2626
- os: macos-latest
2727
target: x86_64-apple-darwin
2828
artifact_name: p2p-transfer
29-
asset_name: p2p-transfer-macos-amd64
29+
asset_name: p2p-transfer-macos-x86_64
3030
- os: macos-latest
3131
target: aarch64-apple-darwin
3232
artifact_name: p2p-transfer
33-
asset_name: p2p-transfer-macos-arm64
33+
asset_name: p2p-transfer-macos-aarch64
3434

3535
steps:
36-
- uses: actions/checkout@v3
36+
- uses: actions/checkout@v4
3737

3838
- name: Install Rust
39-
uses: actions-rs/toolchain@v1
39+
uses: dtolnay/rust-toolchain@stable
4040
with:
41-
toolchain: stable
42-
target: ${{ matrix.target }}
43-
override: true
41+
targets: ${{ matrix.target }}
4442

4543
- name: Build release
46-
run: cargo build --release --target ${{ matrix.target }} --features cli
44+
run: cargo build --release --target ${{ matrix.target }}
4745

4846
- name: Strip binary (Linux/macOS)
4947
if: matrix.os != 'windows-latest'
5048
run: strip target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
5149

52-
- name: Upload artifact
53-
uses: actions/upload-artifact@v3
50+
- name: Create release package (Linux/macOS)
51+
if: matrix.os != 'windows-latest'
52+
run: |
53+
mkdir -p release-package
54+
cp target/${{ matrix.target }}/release/${{ matrix.artifact_name }} release-package/
55+
cp README.md LICENSE CHANGELOG.md release-package/
56+
cd release-package
57+
tar czf ../${{ matrix.asset_name }}.tar.gz *
58+
cd ..
59+
sha256sum ${{ matrix.asset_name }}.tar.gz > ${{ matrix.asset_name }}.tar.gz.sha256
60+
61+
- name: Create release package (Windows)
62+
if: matrix.os == 'windows-latest'
63+
shell: pwsh
64+
run: |
65+
New-Item -ItemType Directory -Force -Path release-package
66+
Copy-Item target/${{ matrix.target }}/release/${{ matrix.artifact_name }} release-package/
67+
Copy-Item README.md, LICENSE, CHANGELOG.md release-package/
68+
Compress-Archive -Path release-package/* -DestinationPath ${{ matrix.asset_name }}.zip
69+
$hash = (Get-FileHash -Algorithm SHA256 ${{ matrix.asset_name }}.zip).Hash.ToLower()
70+
"$hash ${{ matrix.asset_name }}.zip" | Out-File -Encoding ascii ${{ matrix.asset_name }}.zip.sha256
71+
72+
- name: Upload release archive
73+
uses: actions/upload-artifact@v4
5474
with:
5575
name: ${{ matrix.asset_name }}
56-
path: target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
76+
path: |
77+
${{ matrix.asset_name }}.tar.gz
78+
${{ matrix.asset_name }}.tar.gz.sha256
79+
${{ matrix.asset_name }}.zip
80+
${{ matrix.asset_name }}.zip.sha256
81+
if-no-files-found: ignore
5782

5883
create-release:
5984
name: Create Release
6085
needs: build-release
6186
runs-on: ubuntu-latest
87+
permissions:
88+
contents: write
6289

6390
steps:
64-
- uses: actions/checkout@v3
91+
- uses: actions/checkout@v4
6592

6693
- name: Download artifacts
67-
uses: actions/download-artifact@v3
94+
uses: actions/download-artifact@v4
95+
with:
96+
path: artifacts
97+
98+
- name: Display structure of downloaded files
99+
run: ls -R artifacts/
68100

69101
- name: Create Release
70102
uses: softprops/action-gh-release@v1
71103
with:
72104
files: |
73-
**/p2p-transfer*
105+
artifacts/**/*.tar.gz
106+
artifacts/**/*.tar.gz.sha256
107+
artifacts/**/*.zip
108+
artifacts/**/*.zip.sha256
74109
draft: false
75110
prerelease: false
111+
body_path: CHANGELOG.md
112+
generate_release_notes: true
76113
env:
77114
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CHANGELOG.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,24 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8-
## [Unreleased]
9-
108
### Added
9+
- **GUI Implementation** (2025-10-10): Complete graphical user interface using Iced framework
10+
- Tabbed interface with Connection, Send, Receive, Settings, and History tabs
11+
- Connection management: Start listener or connect to peers with discovery support
12+
- Send tab: File/folder picker with browse buttons and transfer initiation
13+
- Receive tab: Output directory selection and auto-accept toggle
14+
- Settings tab: All CLI settings available (compression, window size, chunk size, bandwidth limit, etc.)
15+
- History tab: Display past transfers with statistics and completion status
16+
- Progress tracking: Real-time progress bar with speed, ETA, percentage, and bytes transferred
17+
- Dark theme UI with clean, intuitive design
18+
- Async-compatible architecture using tokio::Mutex for session management
19+
- **Modular GUI Architecture** (2025-10-10): Refactored GUI into organized module structure
20+
- Split monolithic 1224-line file into 10+ focused modules
21+
- Created module structure: app.rs, state.rs, message.rs, operations.rs, utils.rs, styles.rs, views/
22+
- Separated view rendering from business logic for better maintainability
23+
- Simplified styling to use Iced 0.12 built-in themes (Primary, Secondary, Destructive)
24+
- Added chrono dependency for timestamp handling in history view
25+
- Professional appearance with smaller text sizes (12-18px), consistent spacing, and card-like containers
1126
- **Chunk-level resume** (2025-10-10): Transfer now resumes from exact chunk where interrupted, not from beginning
1227
- Chunk completions tracked in memory during transfer
1328
- State automatically saved to disk when connection error detected (before reconnection attempt)

Cargo.toml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
# P2P File Transfer
2+
#
3+
# Build Options:
4+
# cargo build --release # CLI only (default, ~3 MB)
5+
# cargo build --release --features full # CLI + GUI (~7 MB)
6+
# cargo build --release --features gui --no-default-features # GUI only (~6 MB)
7+
# cargo build --release --features cli --no-default-features # CLI only (explicit, ~3 MB)
8+
19
[package]
210
name = "p2p-transfer"
311
version = "0.1.0"
@@ -25,9 +33,14 @@ env_logger = "0.11"
2533
tracing = "0.1"
2634

2735
[features]
36+
# Default: CLI only (small binary, ~5-10 MB)
2837
default = ["cli"]
38+
# CLI interface with all core features
2939
cli = ["p2p-cli"]
30-
gui = ["p2p-gui"]
40+
# GUI interface with Iced framework (large binary, ~60+ MB due to graphics dependencies)
41+
gui = ["p2p-gui", "p2p-cli/gui"]
42+
# Build both CLI and GUI
43+
full = ["cli", "gui"]
3144

3245
[profile.release]
3346
opt-level = 3

0 commit comments

Comments
 (0)