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

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

GuiAppName=Dragon
GuiAppBinary=dragon
GuiAppRun=echo 'A=`qdbus 2> /dev/null|grep dragon`; if [ "x$A" = "x" ]; then echo NOK; else echo OK; fi'|sh -s
GuiAppIcon=dragon.png
GuiAppType=Application
GuiAppProtocols=Server
GuiAppDesc=Dragon Player is a simple video player.
GuiAppVersion=echo 'V=`dragon -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);\
	Macro(SETUP_DEFAULT_MIXER);\
	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,dragon);\
	Macro(TEST_KDE4_APP);\
	Make(var,app_name,by_value,Dragon);\
	Make(var,do_app_init,by_value,1);\
	Make(var,open_file,by_value,);\
	Make(var,dragon_layout,\
	     V=`$(CfgDir)/Utils/registry.sh $(TmpDir) get dragon_layout`;\
	     if [ "x$V" = "x" ]; then echo "3x4"; else echo $V; fi);\
	Make(var,app_manage_mode,by_value,dragon_$(dragon_layout));

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

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

[Mode]=dragon_init : default_video_player_init

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

[ModeEnd]

[Mode]=dragon_general

APP_START_IF=\
	Exec(P=`qdbus|grep dragon`;\
	     if [ "x$P" = "x" ]; then cd "$(fbrowser_dir)";dragon $(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 dragon);

APP_QUIT=\
	Exec(qdbus org.mpris.dragonplayer-`qdbus 2> /dev/null|grep dragon|cut -f 2 -d '-'` /MainApplication org.kde.KApplication.quit > /dev/null);

APP_FULLSCREEN=\
	Exec(qdbus org.mpris.dragonplayer-`qdbus 2> /dev/null|grep dragon|cut -f 2 -d '-'` /dragonplayer/MainWindow_1 activateAction fullscreen > /dev/null);
	
PLAY=\
	Exec(qdbus org.mpris.dragonplayer-`qdbus|grep dragon|cut -f 2 -d '-'` /Player org.freedesktop.MediaPlayer.Play > /dev/null);

RWD=\
	Exec(qdbus org.mpris.dragonplayer-`qdbus 2> /dev/null|grep dragon|cut -f 2 -d '-'` /dragonplayer/MainWindow_1 activateAction ten_seconds_back > /dev/null)

FF=\
	Exec(qdbus org.mpris.dragonplayer-`qdbus 2> /dev/null|grep dragon|cut -f 2 -d '-'` /dragonplayer/MainWindow_1 activateAction ten_seconds_forward > /dev/null)

STOP=\
	Exec(qdbus org.mpris.dragonplayer-`qdbus|grep dragon|cut -f 2 -d '-'` /Player org.freedesktop.MediaPlayer.Stop > /dev/null)

PAUSE=\
	Exec(qdbus org.mpris.dragonplayer-`qdbus|grep dragon|cut -f 2 -d '-'` /Player org.freedesktop.MediaPlayer.Pause > /dev/null)

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

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

[ModeEnd]

[Mode]=dragon_3x4 : dragon_general,default_video_player 

APP_POST_SETUP=\
	Make(var,dragon_layout,by_value,3x4);\
	Make(var,app_manage_mode,by_value,dragon_$(dragon_layout));

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

* *=Set(text,replace,Help,1 Vol-\n2 Mute\n3 Vol+\n4 Rewind\n5 Play\n6 FF\n7 File Browser\n8 Stop\n9 Fullscreen\n** Help\n0 Pause\n# Exit\nIf Rewind/FF does not work properly \nthen it is Dragon bug.)

[ModeEnd]

[Mode]=dragon_5x1 : dragon_general,default_video_player_5x1 

APP_POST_SETUP=\
	Make(var,dragon_layout,by_value,5x1);\
	Make(var,app_manage_mode,by_value,dragon_$(dragon_layout));

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

DEFAULT_HELP=\
	Set(text,replace,Help,Joystick Down Vol-\nJoystick Up Vol+\n1 Rewind\n2 Play\n3 FastForward\n4 Pause\n5 Stop and quit $(app_name)\nIf Rewind/FF does not work properly \nthen it is Dragon bug.);

[ModeEnd]

[End]
