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
VideoToolsRebuild() {
echo "🔨 Rebuilding VideoTools..."
echo "Rebuilding VideoTools..."
bash "$PROJECT_ROOT/scripts/build.sh"
}
# Create a clean function
VideoToolsClean() {
echo "🧹 Cleaning VideoTools build artifacts..."
echo "Cleaning VideoTools build artifacts..."
cd "$PROJECT_ROOT"
go clean -cache -modcache -testcache
rm -f "$PROJECT_ROOT/VideoTools"
echo "Clean complete"
echo "Clean complete"
}
echo "════════════════════════════════════════════════════════════════"
echo "VideoTools Commands Available"
echo "VideoTools Commands Available"
echo "════════════════════════════════════════════════════════════════"
echo ""
echo "Commands:"

View File

@ -17,49 +17,49 @@ echo ""
# Check if go is installed
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
fi
echo "📦 Go version:"
echo "Go version:"
go version
echo ""
# Change to project directory
cd "$PROJECT_ROOT"
echo "🧹 Cleaning previous builds and cache..."
echo "Cleaning previous builds and cache..."
go clean -cache -testcache 2>/dev/null || true
rm -f "$BUILD_OUTPUT" 2>/dev/null || true
# Also clear build cache directory to avoid permission issues
rm -rf "${GOCACHE:-$HOME/.cache/go-build}" 2>/dev/null || true
echo "Cache cleaned"
echo "Cache cleaned"
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
echo "Dependencies already present"
echo "Dependencies already present"
else
if go mod download && go mod verify; then
echo "Dependencies downloaded and verified"
echo "Dependencies downloaded and verified"
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
fi
fi
echo ""
echo "🔨 Building VideoTools..."
echo "Building VideoTools..."
# Fyne needs cgo for GLFW/OpenGL bindings; build with CGO enabled.
export CGO_ENABLED=1
export GOCACHE="$PROJECT_ROOT/.cache/go-build"
export GOMODCACHE="$PROJECT_ROOT/.cache/go-mod"
mkdir -p "$GOCACHE" "$GOMODCACHE"
if go build -o "$BUILD_OUTPUT" .; then
echo "Build successful! (VideoTools $APP_VERSION)"
echo "Build successful! (VideoTools $APP_VERSION)"
echo ""
echo "════════════════════════════════════════════════════════════════"
echo "BUILD COMPLETE - $APP_VERSION"
echo "BUILD COMPLETE - $APP_VERSION"
echo "════════════════════════════════════════════════════════════════"
echo ""
echo "Output: $BUILD_OUTPUT"
@ -74,7 +74,7 @@ if go build -o "$BUILD_OUTPUT" .; then
echo " VideoTools"
echo ""
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 ""
echo "Help: check the Go error messages above."

View File

@ -15,17 +15,17 @@ echo ""
# Check if go is installed
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
fi
echo "📦 Go version:"
echo "Go version:"
go version
echo ""
# Check if MinGW-w64 is installed
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 "To install on Fedora/RHEL:"
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
fi
echo "🔧 MinGW-w64 detected:"
echo "MinGW-w64 detected:"
x86_64-w64-mingw32-gcc --version | head -1
echo ""
# Change to project directory
cd "$PROJECT_ROOT"
echo "🧹 Cleaning previous Windows builds..."
echo "Cleaning previous Windows builds..."
rm -f "$BUILD_OUTPUT" 2>/dev/null || true
rm -rf "$DIST_DIR" 2>/dev/null || true
echo "Previous builds cleaned"
echo "Previous builds cleaned"
echo ""
echo "⬇️ Downloading and verifying dependencies..."
echo "Downloading and verifying dependencies..."
go mod download
go mod verify
echo "Dependencies verified"
echo "Dependencies verified"
echo ""
echo "🔨 Cross-compiling for Windows (amd64)..."
echo "Cross-compiling for Windows (amd64)..."
echo " Target: windows/amd64"
echo " Compiler: x86_64-w64-mingw32-gcc"
echo ""
@ -73,27 +73,27 @@ export CXX=x86_64-w64-mingw32-g++
LDFLAGS="-H windowsgui -s -w"
if go build -ldflags="$LDFLAGS" -o "$BUILD_OUTPUT" .; then
echo "Cross-compilation successful!"
echo "Cross-compilation successful!"
echo ""
else
echo "Build failed!"
echo "Build failed!"
exit 1
fi
echo "📦 Creating distribution package..."
echo "Creating distribution package..."
mkdir -p "$DIST_DIR"
# Copy executable
cp "$BUILD_OUTPUT" "$DIST_DIR/"
echo "Copied VideoTools.exe"
echo "Copied VideoTools.exe"
# Copy documentation
cp README.md "$DIST_DIR/" 2>/dev/null || echo "⚠️ README.md not found"
cp LICENSE "$DIST_DIR/" 2>/dev/null || echo "⚠️ LICENSE not found"
cp README.md "$DIST_DIR/" 2>/dev/null || echo "WARNING: README.md not found"
cp LICENSE "$DIST_DIR/" 2>/dev/null || echo "WARNING: LICENSE not found"
# Download and bundle FFmpeg automatically
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_ZIP="$PROJECT_ROOT/ffmpeg-windows.zip"
@ -102,14 +102,14 @@ if [ ! -f "ffmpeg.exe" ]; then
elif command -v curl &> /dev/null; then
curl -L "$FFMPEG_URL" -o "$FFMPEG_ZIP" --progress-bar
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 " Extract ffmpeg.exe and ffprobe.exe to project root"
echo ""
fi
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"
# Find and copy the executables (they're nested in a versioned directory)
@ -118,28 +118,28 @@ if [ ! -f "ffmpeg.exe" ]; then
# Cleanup
rm -rf "$PROJECT_ROOT/ffmpeg-temp" "$FFMPEG_ZIP"
echo "FFmpeg downloaded and extracted"
echo "FFmpeg downloaded and extracted"
fi
fi
# Bundle FFmpeg with the distribution
if [ -f "ffmpeg.exe" ]; then
cp ffmpeg.exe "$DIST_DIR/"
echo "Bundled ffmpeg.exe"
echo "Bundled ffmpeg.exe"
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
if [ -f "ffprobe.exe" ]; then
cp ffprobe.exe "$DIST_DIR/"
echo "Bundled ffprobe.exe"
echo "Bundled ffprobe.exe"
else
echo "⚠️ ffprobe.exe not found"
echo "WARNING: ffprobe.exe not found"
fi
echo ""
echo "════════════════════════════════════════════════════════════════"
echo "WINDOWS BUILD COMPLETE"
echo "WINDOWS BUILD COMPLETE"
echo "════════════════════════════════════════════════════════════════"
echo ""
echo "Output directory: $DIST_DIR"

View File

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

View File

@ -488,8 +488,8 @@ func buildSubtitlesView(state *appState) fyne.CanvasObject {
rebuildCues()
content := container.NewGridWithColumns(2, left, right)
mainContent := container.NewBorder(topBar, bottomBar, nil, nil, content)
return ui.NewDroppable(mainContent, handleDrop)
droppableContent := ui.NewDroppable(content, handleDrop)
return container.NewBorder(topBar, bottomBar, nil, nil, droppableContent)
}
func (s *appState) setSubtitleStatus(msg string) {
@ -536,7 +536,11 @@ func (s *appState) handleSubtitlesModuleDrop(items []fyne.URI) {
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 {