Leonid Nikitin b24155caf6
Refactor application structure and initialize core components
I decided to rewrite the program taking into account the experience gained.
2025-06-06 14:50:16 +05:00

52 lines
1.2 KiB
Go

package application
import (
"fyne.io/fyne/v2"
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/application/setting"
"git.kor-elf.net/kor-elf/gui-for-ffmpeg/internal/ffmpeg"
)
type AppContract interface {
FyneApp() fyne.App
GetSetting() setting.SettingContract
GetProgressBarService() ProgressBarContract
GetFFmpegService() ffmpeg.UtilitiesContract
Run()
}
type application struct {
fyneApp fyne.App
setting setting.SettingContract
progressBarService ProgressBarContract
ffmpegService ffmpeg.UtilitiesContract
}
func NewApp(fyneApp fyne.App, setting setting.SettingContract, progressBarService ProgressBarContract, ffmpegService ffmpeg.UtilitiesContract) AppContract {
return &application{
fyneApp: fyneApp,
setting: setting,
progressBarService: progressBarService,
ffmpegService: ffmpegService,
}
}
func (a *application) FyneApp() fyne.App {
return a.fyneApp
}
func (a *application) GetSetting() setting.SettingContract {
return a.setting
}
func (a *application) GetProgressBarService() ProgressBarContract {
return a.progressBarService
}
func (a *application) GetFFmpegService() ffmpeg.UtilitiesContract {
return a.ffmpegService
}
func (a *application) Run() {
a.fyneApp.Run()
}