Fix subtitle module drag and drop and remove emojis from scripts

- Wrap entire subtitle module content in droppable container for drag and drop anywhere
- Remove all emojis from build scripts (build-linux.sh, build.sh, build-windows.sh, alias.sh)
- Subtitle module now accepts video/subtitle file drops on any part of the view

Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Stu Leak 2025-12-26 20:17:24 -05:00
parent 9257cc79f0
commit e3aebdcbb7
5 changed files with 60 additions and 56 deletions

View File

@ -9,21 +9,21 @@ alias VideoTools="bash $PROJECT_ROOT/scripts/run.sh"
# Also create a rebuild function for quick rebuilds # Also create a rebuild function for quick rebuilds
VideoToolsRebuild() { VideoToolsRebuild() {
echo "🔨 Rebuilding VideoTools..." echo "Rebuilding VideoTools..."
bash "$PROJECT_ROOT/scripts/build.sh" bash "$PROJECT_ROOT/scripts/build.sh"
} }
# Create a clean function # Create a clean function
VideoToolsClean() { VideoToolsClean() {
echo "🧹 Cleaning VideoTools build artifacts..." echo "Cleaning VideoTools build artifacts..."
cd "$PROJECT_ROOT" cd "$PROJECT_ROOT"
go clean -cache -modcache -testcache go clean -cache -modcache -testcache
rm -f "$PROJECT_ROOT/VideoTools" rm -f "$PROJECT_ROOT/VideoTools"
echo "Clean complete" echo "Clean complete"
} }
echo "════════════════════════════════════════════════════════════════" echo "════════════════════════════════════════════════════════════════"
echo "VideoTools Commands Available" echo "VideoTools Commands Available"
echo "════════════════════════════════════════════════════════════════" echo "════════════════════════════════════════════════════════════════"
echo "" echo ""
echo "Commands:" echo "Commands:"

View File

@ -17,49 +17,49 @@ echo ""
# Check if go is installed # Check if go is installed
if ! command -v go &> /dev/null; then if ! command -v go &> /dev/null; then
echo "ERROR: Go is not installed. Please install Go 1.21 or later." echo "ERROR: Go is not installed. Please install Go 1.21 or later."
exit 1 exit 1
fi fi
echo "📦 Go version:" echo "Go version:"
go version go version
echo "" echo ""
# Change to project directory # Change to project directory
cd "$PROJECT_ROOT" cd "$PROJECT_ROOT"
echo "🧹 Cleaning previous builds and cache..." echo "Cleaning previous builds and cache..."
go clean -cache -testcache 2>/dev/null || true go clean -cache -testcache 2>/dev/null || true
rm -f "$BUILD_OUTPUT" 2>/dev/null || true rm -f "$BUILD_OUTPUT" 2>/dev/null || true
# Also clear build cache directory to avoid permission issues # Also clear build cache directory to avoid permission issues
rm -rf "${GOCACHE:-$HOME/.cache/go-build}" 2>/dev/null || true rm -rf "${GOCACHE:-$HOME/.cache/go-build}" 2>/dev/null || true
echo "Cache cleaned" echo "Cache cleaned"
echo "" echo ""
echo "⬇️ Downloading and verifying dependencies (skips if already cached)..." echo "Downloading and verifying dependencies (skips if already cached)..."
if go list -m all >/dev/null 2>&1; then if go list -m all >/dev/null 2>&1; then
echo "Dependencies already present" echo "Dependencies already present"
else else
if go mod download && go mod verify; then if go mod download && go mod verify; then
echo "Dependencies downloaded and verified" echo "Dependencies downloaded and verified"
else else
echo "Failed to download/verify modules. Check network/GOPROXY or try again." echo "Failed to download/verify modules. Check network/GOPROXY or try again."
exit 1 exit 1
fi fi
fi fi
echo "" echo ""
echo "🔨 Building VideoTools..." echo "Building VideoTools..."
# Fyne needs cgo for GLFW/OpenGL bindings; build with CGO enabled. # Fyne needs cgo for GLFW/OpenGL bindings; build with CGO enabled.
export CGO_ENABLED=1 export CGO_ENABLED=1
export GOCACHE="$PROJECT_ROOT/.cache/go-build" export GOCACHE="$PROJECT_ROOT/.cache/go-build"
export GOMODCACHE="$PROJECT_ROOT/.cache/go-mod" export GOMODCACHE="$PROJECT_ROOT/.cache/go-mod"
mkdir -p "$GOCACHE" "$GOMODCACHE" mkdir -p "$GOCACHE" "$GOMODCACHE"
if go build -o "$BUILD_OUTPUT" .; then if go build -o "$BUILD_OUTPUT" .; then
echo "Build successful! (VideoTools $APP_VERSION)" echo "Build successful! (VideoTools $APP_VERSION)"
echo "" echo ""
echo "════════════════════════════════════════════════════════════════" echo "════════════════════════════════════════════════════════════════"
echo "BUILD COMPLETE - $APP_VERSION" echo "BUILD COMPLETE - $APP_VERSION"
echo "════════════════════════════════════════════════════════════════" echo "════════════════════════════════════════════════════════════════"
echo "" echo ""
echo "Output: $BUILD_OUTPUT" echo "Output: $BUILD_OUTPUT"
@ -74,7 +74,7 @@ if go build -o "$BUILD_OUTPUT" .; then
echo " VideoTools" echo " VideoTools"
echo "" echo ""
else else
echo "Build failed! (VideoTools $APP_VERSION)" echo "Build failed! (VideoTools $APP_VERSION)"
echo "Diagnostics: version=$APP_VERSION os=$(uname -s) arch=$(uname -m) go=$(go version | awk '{print $3}')" echo "Diagnostics: version=$APP_VERSION os=$(uname -s) arch=$(uname -m) go=$(go version | awk '{print $3}')"
echo "" echo ""
echo "Help: check the Go error messages above." echo "Help: check the Go error messages above."

View File

@ -15,17 +15,17 @@ echo ""
# Check if go is installed # Check if go is installed
if ! command -v go &> /dev/null; then if ! command -v go &> /dev/null; then
echo "ERROR: Go is not installed. Please install Go 1.21 or later." echo "ERROR: Go is not installed. Please install Go 1.21 or later."
exit 1 exit 1
fi fi
echo "📦 Go version:" echo "Go version:"
go version go version
echo "" echo ""
# Check if MinGW-w64 is installed # Check if MinGW-w64 is installed
if ! command -v x86_64-w64-mingw32-gcc &> /dev/null; then if ! command -v x86_64-w64-mingw32-gcc &> /dev/null; then
echo "ERROR: MinGW-w64 cross-compiler not found!" echo "ERROR: MinGW-w64 cross-compiler not found!"
echo "" echo ""
echo "To install on Fedora/RHEL:" echo "To install on Fedora/RHEL:"
echo " sudo dnf install mingw64-gcc mingw64-winpthreads-static" echo " sudo dnf install mingw64-gcc mingw64-winpthreads-static"
@ -36,26 +36,26 @@ if ! command -v x86_64-w64-mingw32-gcc &> /dev/null; then
exit 1 exit 1
fi fi
echo "🔧 MinGW-w64 detected:" echo "MinGW-w64 detected:"
x86_64-w64-mingw32-gcc --version | head -1 x86_64-w64-mingw32-gcc --version | head -1
echo "" echo ""
# Change to project directory # Change to project directory
cd "$PROJECT_ROOT" cd "$PROJECT_ROOT"
echo "🧹 Cleaning previous Windows builds..." echo "Cleaning previous Windows builds..."
rm -f "$BUILD_OUTPUT" 2>/dev/null || true rm -f "$BUILD_OUTPUT" 2>/dev/null || true
rm -rf "$DIST_DIR" 2>/dev/null || true rm -rf "$DIST_DIR" 2>/dev/null || true
echo "Previous builds cleaned" echo "Previous builds cleaned"
echo "" echo ""
echo "⬇️ Downloading and verifying dependencies..." echo "Downloading and verifying dependencies..."
go mod download go mod download
go mod verify go mod verify
echo "Dependencies verified" echo "Dependencies verified"
echo "" echo ""
echo "🔨 Cross-compiling for Windows (amd64)..." echo "Cross-compiling for Windows (amd64)..."
echo " Target: windows/amd64" echo " Target: windows/amd64"
echo " Compiler: x86_64-w64-mingw32-gcc" echo " Compiler: x86_64-w64-mingw32-gcc"
echo "" echo ""
@ -73,27 +73,27 @@ export CXX=x86_64-w64-mingw32-g++
LDFLAGS="-H windowsgui -s -w" LDFLAGS="-H windowsgui -s -w"
if go build -ldflags="$LDFLAGS" -o "$BUILD_OUTPUT" .; then if go build -ldflags="$LDFLAGS" -o "$BUILD_OUTPUT" .; then
echo "Cross-compilation successful!" echo "Cross-compilation successful!"
echo "" echo ""
else else
echo "Build failed!" echo "Build failed!"
exit 1 exit 1
fi fi
echo "📦 Creating distribution package..." echo "Creating distribution package..."
mkdir -p "$DIST_DIR" mkdir -p "$DIST_DIR"
# Copy executable # Copy executable
cp "$BUILD_OUTPUT" "$DIST_DIR/" cp "$BUILD_OUTPUT" "$DIST_DIR/"
echo "Copied VideoTools.exe" echo "Copied VideoTools.exe"
# Copy documentation # Copy documentation
cp README.md "$DIST_DIR/" 2>/dev/null || echo "⚠️ README.md not found" cp README.md "$DIST_DIR/" 2>/dev/null || echo "WARNING: README.md not found"
cp LICENSE "$DIST_DIR/" 2>/dev/null || echo "⚠️ LICENSE not found" cp LICENSE "$DIST_DIR/" 2>/dev/null || echo "WARNING: LICENSE not found"
# Download and bundle FFmpeg automatically # Download and bundle FFmpeg automatically
if [ ! -f "ffmpeg.exe" ]; then if [ ! -f "ffmpeg.exe" ]; then
echo "📥 FFmpeg not found locally, downloading..." echo "FFmpeg not found locally, downloading..."
FFMPEG_URL="https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl.zip" FFMPEG_URL="https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl.zip"
FFMPEG_ZIP="$PROJECT_ROOT/ffmpeg-windows.zip" FFMPEG_ZIP="$PROJECT_ROOT/ffmpeg-windows.zip"
@ -102,14 +102,14 @@ if [ ! -f "ffmpeg.exe" ]; then
elif command -v curl &> /dev/null; then elif command -v curl &> /dev/null; then
curl -L "$FFMPEG_URL" -o "$FFMPEG_ZIP" --progress-bar curl -L "$FFMPEG_URL" -o "$FFMPEG_ZIP" --progress-bar
else else
echo "⚠️ wget or curl not found. Cannot download FFmpeg automatically." echo "WARNING: wget or curl not found. Cannot download FFmpeg automatically."
echo " Please download manually from: $FFMPEG_URL" echo " Please download manually from: $FFMPEG_URL"
echo " Extract ffmpeg.exe and ffprobe.exe to project root" echo " Extract ffmpeg.exe and ffprobe.exe to project root"
echo "" echo ""
fi fi
if [ -f "$FFMPEG_ZIP" ]; then if [ -f "$FFMPEG_ZIP" ]; then
echo "📦 Extracting FFmpeg..." echo "Extracting FFmpeg..."
unzip -q "$FFMPEG_ZIP" "*/bin/ffmpeg.exe" "*/bin/ffprobe.exe" -d "$PROJECT_ROOT/ffmpeg-temp" unzip -q "$FFMPEG_ZIP" "*/bin/ffmpeg.exe" "*/bin/ffprobe.exe" -d "$PROJECT_ROOT/ffmpeg-temp"
# Find and copy the executables (they're nested in a versioned directory) # Find and copy the executables (they're nested in a versioned directory)
@ -118,28 +118,28 @@ if [ ! -f "ffmpeg.exe" ]; then
# Cleanup # Cleanup
rm -rf "$PROJECT_ROOT/ffmpeg-temp" "$FFMPEG_ZIP" rm -rf "$PROJECT_ROOT/ffmpeg-temp" "$FFMPEG_ZIP"
echo "FFmpeg downloaded and extracted" echo "FFmpeg downloaded and extracted"
fi fi
fi fi
# Bundle FFmpeg with the distribution # Bundle FFmpeg with the distribution
if [ -f "ffmpeg.exe" ]; then if [ -f "ffmpeg.exe" ]; then
cp ffmpeg.exe "$DIST_DIR/" cp ffmpeg.exe "$DIST_DIR/"
echo "Bundled ffmpeg.exe" echo "Bundled ffmpeg.exe"
else else
echo "⚠️ ffmpeg.exe not found - distribution will require separate FFmpeg installation" echo "WARNING: ffmpeg.exe not found - distribution will require separate FFmpeg installation"
fi fi
if [ -f "ffprobe.exe" ]; then if [ -f "ffprobe.exe" ]; then
cp ffprobe.exe "$DIST_DIR/" cp ffprobe.exe "$DIST_DIR/"
echo "Bundled ffprobe.exe" echo "Bundled ffprobe.exe"
else else
echo "⚠️ ffprobe.exe not found" echo "WARNING: ffprobe.exe not found"
fi fi
echo "" echo ""
echo "════════════════════════════════════════════════════════════════" echo "════════════════════════════════════════════════════════════════"
echo "WINDOWS BUILD COMPLETE" echo "WINDOWS BUILD COMPLETE"
echo "════════════════════════════════════════════════════════════════" echo "════════════════════════════════════════════════════════════════"
echo "" echo ""
echo "Output directory: $DIST_DIR" echo "Output directory: $DIST_DIR"

View File

@ -15,23 +15,23 @@ case "$PLATFORM" in
Linux*) OS="Linux" ;; Linux*) OS="Linux" ;;
Darwin*) OS="macOS" ;; Darwin*) OS="macOS" ;;
CYGWIN*|MINGW*|MSYS*) OS="Windows" ;; CYGWIN*|MINGW*|MSYS*) OS="Windows" ;;
*) echo "Unknown platform: $PLATFORM"; exit 1 ;; *) echo "Unknown platform: $PLATFORM"; exit 1 ;;
esac esac
echo "════════════════════════════════════════════════════════════════" echo "════════════════════════════════════════════════════════════════"
echo " VideoTools ${OS} Build" echo " VideoTools ${OS} Build"
echo "════════════════════════════════════════════════════════════════" echo "════════════════════════════════════════════════════════════════"
echo "" echo ""
echo "🔍 Detected platform: $OS" echo "Detected platform: $OS"
echo "" echo ""
# Go check # Go check
if ! command -v go >/dev/null 2>&1; then if ! command -v go >/dev/null 2>&1; then
echo "ERROR: Go is not installed. Please install Go 1.21+ (go version currently missing)." echo "ERROR: Go is not installed. Please install Go 1.21+ (go version currently missing)."
exit 1 exit 1
fi fi
echo "📦 Go version:" echo "Go version:"
go version go version
echo "" echo ""
@ -50,26 +50,26 @@ case "$OS" in
echo "" echo ""
cd "$PROJECT_ROOT" cd "$PROJECT_ROOT"
echo "🧹 Cleaning previous builds..." echo "Cleaning previous builds..."
rm -f VideoTools.exe 2>/dev/null || true rm -f VideoTools.exe 2>/dev/null || true
# Clear Go cache to avoid permission issues # Clear Go cache to avoid permission issues
go clean -cache -modcache -testcache 2>/dev/null || true go clean -cache -modcache -testcache 2>/dev/null || true
echo "Cache cleaned" echo "Cache cleaned"
echo "" echo ""
echo "⬇️ Downloading dependencies..." echo "Downloading dependencies..."
go mod download go mod download
echo "Dependencies downloaded" echo "Dependencies downloaded"
echo "" echo ""
echo "🔨 Building VideoTools $APP_VERSION for Windows..." echo "Building VideoTools $APP_VERSION for Windows..."
export CGO_ENABLED=1 export CGO_ENABLED=1
if go build -ldflags="-H windowsgui -s -w" -o VideoTools.exe .; then if go build -ldflags="-H windowsgui -s -w" -o VideoTools.exe .; then
echo "Build successful! (VideoTools $APP_VERSION)" echo "Build successful! (VideoTools $APP_VERSION)"
echo "" echo ""
if [ -f "setup-windows.bat" ]; then if [ -f "setup-windows.bat" ]; then
echo "════════════════════════════════════════════════════════════════" echo "════════════════════════════════════════════════════════════════"
echo "BUILD COMPLETE - $APP_VERSION" echo "BUILD COMPLETE - $APP_VERSION"
echo "════════════════════════════════════════════════════════════════" echo "════════════════════════════════════════════════════════════════"
echo "" echo ""
echo "Output: VideoTools.exe" echo "Output: VideoTools.exe"
@ -93,11 +93,11 @@ case "$OS" in
echo "You can skip if FFmpeg is already installed elsewhere." echo "You can skip if FFmpeg is already installed elsewhere."
fi fi
else else
echo "Build complete: VideoTools.exe" echo "Build complete: VideoTools.exe"
diagnostics diagnostics
fi fi
else else
echo "Build failed! (VideoTools $APP_VERSION)" echo "Build failed! (VideoTools $APP_VERSION)"
diagnostics diagnostics
echo "" echo ""
echo "Help: check the Go error messages above." echo "Help: check the Go error messages above."

View File

@ -488,8 +488,8 @@ func buildSubtitlesView(state *appState) fyne.CanvasObject {
rebuildCues() rebuildCues()
content := container.NewGridWithColumns(2, left, right) content := container.NewGridWithColumns(2, left, right)
mainContent := container.NewBorder(topBar, bottomBar, nil, nil, content) droppableContent := ui.NewDroppable(content, handleDrop)
return ui.NewDroppable(mainContent, handleDrop) return container.NewBorder(topBar, bottomBar, nil, nil, droppableContent)
} }
func (s *appState) setSubtitleStatus(msg string) { func (s *appState) setSubtitleStatus(msg string) {
@ -536,7 +536,11 @@ func (s *appState) handleSubtitlesModuleDrop(items []fyne.URI) {
s.setSubtitleStatus(err.Error()) s.setSubtitleStatus(err.Error())
} }
} }
s.showSubtitlesView()
// Refresh the view to show the loaded files
if s.active == "subtitles" {
s.showSubtitlesView()
}
} }
func (s *appState) loadSubtitleFile(path string) error { func (s *appState) loadSubtitleFile(path string) error {