%
% anyremote configuration file for kplayer management. (Server-mode)
%

% STATUS stable
% XTEST no
% SOUND app
% ENV no
% FBROWSER v.3i
% DEF_VIDEO_PLAYER   
% ALL_IN_ONE 
% MEDIACENTER video

GuiAppName=Kplayer
GuiAppBinary=kplayer
GuiAppRun=echo 'A=`qdbus 2> /dev/null|grep kplayer`; if [ "x$A" = "x" ]; then echo NOK; else echo OK; fi'|sh -s
GuiAppIcon=kplayer.png
GuiAppType=Application
GuiAppProtocols=Server
GuiAppDesc=KPlayer is a KDE multimedia player.
GuiAppVersion=echo 'V=`kplayer -v|grep KDE|tr -d " "|cut -f 2 -d ":"|cut -f 1 -d "."`; if [ "x$V" = "x4" ]; then echo OK; else echo NOK; fi'|sh -s

[Protocol]=Server

(Init)=\
	Include($(CfgDir)/Utils/aliases-server.cfg);\
	Include($(CfgDir)/Utils/aliases-server-fbrowser-v3i.cfg);\
	Macro(FBROWSER_IC_INIT);\
	Include($(CfgDir)/Utils/aliases-server-video-player.cfg);\
	Make(var,kde4_app,by_value,kplayer);\
	Macro(TEST_KDE4_APP);\
	Make(var,app_name,by_value,Kplayer);\
	Make(var,open_file,by_value,);\
	Make(var,do_app_init,by_value,1);\
	Make(var,kplayer_layout,\
	     V=`$(CfgDir)/Utils/registry.sh $(TmpDir) get kplayer_layout`;\
	     if [ "x$V" = "x" ]; then echo "3x4"; else echo $V; fi);\
	Make(var,app_manage_mode,by_value,kplayer_$(kplayer_layout));

(Exit)=\
	Macro(FBROWSER_IC_EXIT);\
	Exec($(CfgDir)/Utils/registry.sh $(TmpDir) set kplayer_layout $(kplayer_layout));

(Connect)=\
	Make(mode,kplayer_init);

[Mode]=kplayer_init : default_video_player_init

APP_IS_RUN=\
	Make(var,app_run,A=`qdbus 2> /dev/null|grep kplayer`; if [ "x$A" = "x" ]; then echo 0; else echo 1; fi);

[ModeEnd]

[Mode]=kplayer_general

APP_START_IF=\
	Set(title,$(open_file));\
	Exec(P=`qdbus|grep kplayer`;\
	     if [ "x$P" = "x" ]; then \
	         cd "$(fbrowser_dir)"; kplayer $(open_file) 2> /dev/null & \
	     fi);

% Application window should be present in output of "wmctrl -l"
APP_RAISE=\
	Exec($(CfgDir)/Utils/run-or-switch-to.sh -switch kplayer);

APP_QUIT=\
	Exec(qdbus net.sourceforge.kplayer /kplayer/MainWindow_1 activateAction file_quit 2> /dev/null;killall mplayer 2> /dev/null);

APP_FULLSCREEN=\
	Exec(qdbus net.sourceforge.kplayer /kplayer/MainWindow_1 activateAction view_full_screen > /dev/null);

PLAY=\
	Exec(qdbus net.sourceforge.kplayer /kplayer/MainWindow_1 activateAction player_play > /dev/null);

RWD=\
	Exec(qdbus net.sourceforge.kplayer /kplayer/MainWindow_1 activateAction player_backward > /dev/null)

FF=\
	Exec(qdbus net.sourceforge.kplayer /kplayer/MainWindow_1 activateAction player_forward > /dev/null)

STOP=\
	Exec(qdbus net.sourceforge.kplayer /kplayer/MainWindow_1 activateAction player_stop > /dev/null)

PAUSE=\
	Exec(qdbus net.sourceforge.kplayer /kplayer/MainWindow_1 activateAction player_pause > /dev/null)

Layout 3x4=\
	Make(mode,kplayer_3x4);

Layout 5x1=\
	Make(mode,kplayer_5x1);

[ModeEnd]

[Mode]=kplayer_3x4 : kplayer_general,default_video_player

% (EnterMode) by Utils/aliases-server-video-player.cfg

% Override
1=Exec(qdbus net.sourceforge.kplayer /kplayer/MainWindow_1 activateAction audio_volume_down > /dev/null)
2=Exec(qdbus net.sourceforge.kplayer /kplayer/MainWindow_1 activateAction audio_mute > /dev/null)
3=Exec(qdbus net.sourceforge.kplayer /kplayer/MainWindow_1 activateAction audio_volume_up > /dev/null)

APP_POST_SETUP=\
	Make(var,kplayer_layout,by_value,3x4);\
	Make(var,app_manage_mode,by_value,kplayer_$(kplayer_layout));

APP_MENU=\
	Set(menu,replace,Layout 5x1,PowerMgmt);\
	Macro(ALLIN1MENU);\
	Macro(MEDIACENTER_MENU);

[ModeEnd]

[Mode]=kplayer_5x1 : kplayer_general,default_video_player_5x1 

APP_POST_SETUP=\
	Make(var,kplayer_layout,by_value,5x1);\
	Make(var,app_manage_mode,by_value,kplayer_$(kplayer_layout));

APP_MENU=\
	Set(menu,replace,Help,Mute,Quit,Files,Layout 3x4,IMDB,PowerMgmt);\
	Macro(ALLIN1MENU);\
	Macro(MEDIACENTER_MENU);

% Override
VOL-=\
	Exec(qdbus net.sourceforge.kplayer /kplayer/MainWindow_1 activateAction audio_volume_down > /dev/null)

Mute=\
	Exec(qdbus net.sourceforge.kplayer /kplayer/MainWindow_1 activateAction audio_mute > /dev/null)

VOL+=\
	Exec(qdbus net.sourceforge.kplayer /kplayer/MainWindow_1 activateAction audio_volume_up > /dev/null)

[ModeEnd]

[End]
