-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
144 lines (120 loc) · 3.27 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
package main
import (
. "SMS/app"
. "SMS/app/dialog"
"SMS/app/util"
"github.com/lxn/walk"
. "github.com/lxn/walk/declarative"
)
//应用版本号
const APP_VERSION = "0.1.1"
var AppRootDir string
var mw *MyMainWindow
var (
outputSrtChecked *walk.CheckBox
outputLrcChecked *walk.CheckBox
outputTxtChecked *walk.CheckBox
globalFilterChecked *walk.CheckBox
definedFilterChecked *walk.CheckBox
)
func init() {
//主 Window
mw = new(MyMainWindow)
AppRootDir = util.AppRoorDir
}
func main() {
// var taskFiles = new(TaskHandleFile)
util.LogToFile("--1|2|5--", "<ruier>", 19)
var logText *walk.TextEdit
// var operateEngineDb *walk.DataBinder
// var operateTranslateEngineDb *walk.DataBinder
// var operateTranslateDb *walk.DataBinder
// var operateDb *walk.DataBinder
// var operateFilter *walk.DataBinder
// var operateFrom = new(OperateFrom)
// var startBtn *walk.PushButton //生成字幕Btn
// var startTranslateBtn *walk.PushButton //字幕翻译Btn
// var engineOptionsBox *walk.ComboBox
// var translateEngineOptionsBox *walk.ComboBox
// var dropFilesEdit *walk.TextEdit
// var appSetings = Setings.GetCacheAppSetingsData()
// var appFilter = Filter.GetCacheAppFilterData()
//初始化展示配置
// operateFrom.Init(appSetings)
//日志
var tasklog = util.NewTasklog(logText)
//字幕生成应用
// var videosrt = NewApp(AppRootDir)
//注册日志事件
// videosrt.SetLogHandler(func(s string, video string) {
// baseName := tool.GetFileBaseName(video)
// strs := strings.Join([]string{"【", baseName, "】", s}, "")
// //追加日志
// tasklog.AppendLogText(strs)
// })
//字幕输出目录
// videosrt.SetSrtDir(appSetings.SrtFileDir)
//注册[字幕生成]多任务
// var multitask = NewVideoMultitask(appSetings.MaxConcurrency)
//字幕翻译应用
// var srtTranslateApp = NewSrtTranslateApp(AppRootDir)
//注册日志回调事件
// srtTranslateApp.SetLogHandler(func(s string, file string) {
// baseName := tool.GetFileBaseName(file)
// strs := strings.Join([]string{"【", baseName, "】", s}, "")
// //追加日志
// tasklog.AppendLogText(strs)
// })
//文件输出目录
// srtTranslateApp.SetSrtDir(appSetings.SrtFileDir)
//注册[字幕翻译]多任务
// var srtTranslateMultitask = NewTranslateMultitask(appSetings.MaxConcurrency)
// var dakaiAction *walk.Action
cfg := &MultiPageMainWindowConfig{
Name: "mainWindow",
MinSize: Size{600, 400},
MaxSize: Size{600, 600},
MenuItems: []MenuItem{
Menu{
Text: "&Help",
Items: []MenuItem{
Action{
Text: "About",
OnTriggered: func() {},
},
},
},
Menu{
Text: "&Help",
Items: []MenuItem{
Action{
Text: "About",
OnTriggered: func() {},
},
},
},
},
OnCurrentPageChanged: func() {
mw.UpdateTitle(mw.CurrentPageTitle())
},
}
mpmw, err := NewMultiPageMainWindow(cfg)
if err != nil {
panic(err)
}
mw.MultiPageMainWindow = mpmw
mw.UpdateTitle(mw.CurrentPageTitle())
//更新
tasklog.SetTextEdit(logText)
//尝试校验新版本
go func() {
if CheckNewVersionMessage {
appV := new(AppVersion)
vtag := appV.GetAppVersion()
if vtag != "" && CompareVersion(vtag, APP_VERSION) == 1 {
_ = appV.ShowVersionNotifyInfo(vtag, mw)
}
}
}()
mw.Run()
}