示例#1
0
文件: NetActivity.go 项目: sqp/godock
// buildMenu fills the menu with left and middle click actions if they're set.
//
func (app *Applet) buildMenu(menu cdtype.Menuer) {
	needSep := false
	if app.conf.LeftAction > 0 && app.conf.LeftCommand != "" {
		menu.AddEntry("Action left click", "system-run", app.Command().Callback(cmdLeft))
		needSep = true
	}
	if app.conf.MiddleAction > 0 && app.conf.MiddleCommand != "" {
		menu.AddEntry("Action middle click", "system-run", app.Command().Callback(cmdMiddle))
		needSep = true
	}
	if needSep {
		menu.AddSeparator()
	}
	subup := menu.AddSubMenu("Upload", "")
	for _, hist := range app.up.ListHistory() {
		hist := hist
		subup.AddEntry(hist["file"], "", func() {
			app.Log().Info(hist["link"])
			clipboard.Write(hist["link"])
			// app.ShowDialog(link, 5)
		})
	}

	menu.AddSeparator()
	app.video.Menu(menu)
}
示例#2
0
文件: manager.go 项目: sqp/godock
// MenuTypeDL fills the menu with a submenu to select TypeDL (audio, video or both).
//
func (m *Manager) MenuTypeDL(menu cdtype.Menuer, typ *TypeDL) {
	sub := menu.AddSubMenu("File Type: "+typ.String(), iconMenuTypeDL)

	for _, t := range []TypeDL{TypeDLAll, TypeDLAudio, TypeDLVideo, TypeDLVideoWithAudio} {
		stt := t // force static for the callback.
		sub.AddRadioEntry(
			t.String(),
			*typ == t,
			groupTypeDL,
			func() { *typ = stt },
		).SetTooltipText(t.Tooltip())
	}
}
示例#3
0
文件: manager.go 项目: sqp/godock
// MenuQuality returns the list of available streams and formats for the video.
//
func (m *Manager) MenuQuality(menu cdtype.Menuer, qual *Quality, list []Quality) {
	if len(list) == 0 {
		return
	}

	sub := menu.AddSubMenu("Quality: "+qual.String(), iconMenuQuality)

	for _, q := range list {
		stq := q // force static for the callback.
		sub.AddRadioEntry(
			q.String(),
			*qual == q,
			groupQuality,
			func() { *qual = stq },
		).SetTooltipText(q.Tooltip())
	}
}
示例#4
0
文件: manager.go 项目: sqp/godock
// Menu fills an applet actions list with videodl actions.
//
func (m *Manager) Menu(menu cdtype.Menuer) {
	m.control.Action().BuildMenu(menu, []int{m.firstID + ActionOpenFolder, m.firstID + ActionEnableDownload})

	if m.active {
		m.control.Action().BuildMenu(menu, []int{m.firstID + ActionCancelDownload})
	}

	subTitle := "Video Download"
	if !m.EnabledDL {
		subTitle += " (paused)"
	}
	sub := menu.AddSubMenu(subTitle, iconMenuMain)
	if m.history.Queued() > 0 {
		sub.AddEntry("Queued: "+strconv.Itoa(m.history.Queued()), "emblem-downloads", nil)
		sub.AddSeparator()
	}

	// sub.AddEntry("Edit list", "media-playlist-repeat", func() { m.log.ExecAsync(m.cmdOpenWeb, m.WebURL()) }).
	// 	SetTooltipText("Note that this will enable the web service\nYou may have to stop it manually when not needed anymore if you prefer.")
	m.control.Action().BuildMenu(sub, []int{m.firstID + ActionEditList, m.firstID + ActionEnableWeb})

	m.MenuTypeDL(sub, &m.TypeDL)
	m.MenuQuality(sub, &m.Quality, m.backend.MenuQuality())
}