⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 taskbaricon.cpp

📁 linux下实现视频播放的播放器
💻 CPP
字号:
/* *  Copyright (C) 2008  mtrooper * *  This program is free software; you can redistribute it and/or modify *  it under the terms of the GNU General Public License as published by *  the Free Software Foundation; either version 2 of the License, or *  (at your option) any later version. * *  This program is distributed in the hope that it will be useful, *  but WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *  GNU General Public License for more details. * *  You should have received a copy of the GNU General Public License *  along with this program; if not, write to the Free Software *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *//* $Id$ */#include "main.h"#include "video.h"#if (C_HAVE_WXGUI)#include "Channel_List.h"#include "TaskBarIcon.h"#include "StreamInfo.h"#include "Settings.h"#include "../resource/friptv.xpm"#include "../resource/logo64x64.xpm"#include <wx/aboutdlg.h>TaskBarIcon::TaskBarIcon():wxTaskBarIcon(){    SetIcon(wxIcon(friptv_xpm));}TaskBarIcon::~TaskBarIcon(){}wxMenu *TaskBarIcon::CreatePopupMenu(){    wxMenu *menu = new wxMenu();    wxMenuItem *item;    if(!sdl.silent) {	menu->AppendCheckItem(ID_MUTE, "&Mute");	Connect(ID_MUTE, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TaskBarIcon::OnMute));	Connect(ID_MUTE, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TaskBarIcon::OnMuteUpdateUI));	menu->AppendCheckItem(ID_FULLSCREEN, "&Fullscreen");	Connect(ID_FULLSCREEN, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TaskBarIcon::OnFullscreen));	Connect(ID_FULLSCREEN, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TaskBarIcon::OnFullscreenUpdateUI));#ifdef WIN32	menu->AppendCheckItem(ID_ALWAYS_ON_TOP, "Always on top");	Connect(ID_ALWAYS_ON_TOP, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TaskBarIcon::OnAlwaysOnTop));	Connect(ID_ALWAYS_ON_TOP, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TaskBarIcon::OnAlwaysOnTopUpdateUI));#endif	menu->AppendSeparator();	menu->AppendCheckItem(ID_CHANNEL_SURFING, "Channel &surfing");	Connect(ID_CHANNEL_SURFING, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TaskBarIcon::OnChannelSurfing));	Connect(ID_CHANNEL_SURFING, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TaskBarIcon::OnChannelSurfingUpdateUI));#if (C_HAS_LIBPOSTPROC)	menu->AppendSeparator();	menu->AppendCheckItem(ID_POSTPROCESS, "Postprocessing");	Connect(ID_POSTPROCESS, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TaskBarIcon::OnPostProcessing));	Connect(ID_POSTPROCESS, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TaskBarIcon::OnPostProcessingUpdateUI));#endif	menu->AppendSeparator();    }    menu->AppendCheckItem(ID_RECORDING, "&Recording");    Connect(ID_RECORDING, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TaskBarIcon::OnRecording));    Connect(ID_RECORDING, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TaskBarIcon::OnRecordingUpdateUI));    menu->AppendSeparator();    menu->AppendCheckItem(ID_CHANNEL_LIST, "Channel &list");    Connect(ID_CHANNEL_LIST, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TaskBarIcon::OnChannelList));    Connect(ID_CHANNEL_LIST, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TaskBarIcon::OnChannelListUpdateUI));    menu->AppendCheckItem(ID_STREAM_INFO, "S&tream info");    Connect(ID_STREAM_INFO, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TaskBarIcon::OnStreamInfo));    Connect(ID_STREAM_INFO, wxEVT_UPDATE_UI, wxUpdateUIEventHandler(TaskBarIcon::OnStreamInfoUpdateUI));    menu->AppendSeparator();    menu->Append(ID_SETTINGS, "Se&ttings");    Connect(ID_SETTINGS, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TaskBarIcon::OnSettings));    menu->AppendSeparator();    menu->Append(wxID_ABOUT, "&About");    Connect(wxID_ABOUT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TaskBarIcon::OnAbout));    menu->AppendSeparator();    menu->Append(wxID_EXIT, "E&xit");    Connect(wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(TaskBarIcon::OnExit));    return menu;}void TaskBarIcon::OnChannelList(wxCommandEvent & event){    if(gui.wxChannelList->IsVisible()) {	gui.wxChannelList->Show(false);    } else {	gui.wxChannelList->Show(true);	gui.wxChannelList->FocusChanel(sdl.channel->GetNum());    }}void TaskBarIcon::OnChannelListUpdateUI(wxUpdateUIEvent & event){    event.Check(gui.wxChannelList->IsVisible());}void TaskBarIcon::OnStreamInfo(wxCommandEvent & event){    gui.wxStreamInfo->Show(!gui.wxStreamInfo->IsVisible());}void TaskBarIcon::OnStreamInfoUpdateUI(wxUpdateUIEvent & event){    event.Check(gui.wxStreamInfo->IsVisible());}void TaskBarIcon::OnChannelSurfing(wxCommandEvent & event){    if(sdl.channelSurfing)	sdl.channelSurfing = 0;    else	sdl.channelSurfing = SDL_GetTicks();    sdl_bar.SetChannelSurfing(sdl.channelSurfing != 0);}void TaskBarIcon::OnChannelSurfingUpdateUI(wxUpdateUIEvent & event){    event.Check(sdl.channelSurfing != 0);}void TaskBarIcon::OnMute(wxCommandEvent & event){    if(sdl.audio->volume > 0.0f)	sdl.audio->volume = 0.0f;    else	sdl.audio->volume = sdl.audio->prevVolume;    sdl_bar.SetVolume(lrintf(sdl.audio->volume * 100), sdl.audio->mode);}void TaskBarIcon::OnMuteUpdateUI(wxUpdateUIEvent & event){    event.Check(sdl.audio->volume == 0.0f);}void TaskBarIcon::OnRecording(wxCommandEvent & event){    sdl.channel->ToggleRecord();    sdl_bar.SetRec(sdl.recording);}void TaskBarIcon::OnRecordingUpdateUI(wxUpdateUIEvent & event){    event.Check(sdl.recording == true);}void TaskBarIcon::OnFullscreen(wxCommandEvent & event){    if(!sdl.silent) {	sdl.screen.fullscreen = !sdl.screen.fullscreen;	SetupScreen(0, 0, false);    }}void TaskBarIcon::OnFullscreenUpdateUI(wxUpdateUIEvent & event){    event.Check(sdl.screen.fullscreen);}void TaskBarIcon::OnAbout(wxCommandEvent & event){    wxAboutDialogInfo about;    about.SetVersion(wxT("0.18"));    about.SetCopyright(wxT("(c) 2008 gulikoza, mtrooper"));    about.SetIcon(wxIcon(logo64x64_xpm));    about.SetLicence(wxT("GNU GPL v2"));    about.SetWebSite(wxT("http://sourceforge.net/projects/friptv"));    about.AddDeveloper(wxT("gulikoza"));    about.AddDeveloper(wxT("mtrooper"));    about.SetDescription(wxT("FripTV is a free, opensource, SDL based IP TV player.\nIt supports MPEG2 and h264 transport streams."));    wxAboutBox(about);}void TaskBarIcon::OnExit(wxCommandEvent & event){    sdl.time = 1;}void TaskBarIcon::OnAlwaysOnTop(wxCommandEvent & event){#ifdef WIN32    if((!sdl.silent) && (sdl.hwnd)) {	if(sdl.topmost) {	    SetWindowPos(sdl.hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);	    sdl.topmost = false;	} else {	    SetWindowPos(sdl.hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);	    sdl.topmost = true;	}    }#endif}void TaskBarIcon::OnAlwaysOnTopUpdateUI(wxUpdateUIEvent & event){#ifdef WIN32    event.Check(sdl.topmost);#endif}void TaskBarIcon::OnSettings(wxCommandEvent & event){    gui.wxSettings->LoadSettings();    gui.wxSettings->Show(true);}void TaskBarIcon::OnPostProcessing(wxCommandEvent & event){#if (C_HAS_LIBPOSTPROC)    sdl.ppEnabled = !sdl.ppEnabled;#endif}void TaskBarIcon::OnPostProcessingUpdateUI(wxUpdateUIEvent & event){#if (C_HAS_LIBPOSTPROC)    event.Check(sdl.ppEnabled);#endif}#endif // C_HAVE_WXGUI

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -