# vim:syntax=make
## Howto
# For each Q_OBJECT:
#   - Add it without extension to TOMOC
#   - Add the moc.cpp to BUILT_SOURCES and nodist_SOURCES_qt4
#   - Add the cpp to SOURCES_qt4
#   - Add the hpp to EXTRA_DIST
# For each UI
#   - Add it without extension to TOUI
#   - Add it to EXTRA_DIST

AUTOMAKE_OPTIONS = subdir-objects

TOUI = 	\
	ui/equalizer \
	ui/video_effects \
	ui/open_file \
	ui/open_disk \
	ui/open_net \
	ui/open \
	ui/main_interface \
	ui/sprefs_audio \
	ui/sprefs_input \
	ui/sprefs_interface \
	ui/sprefs_playlist \
	ui/sprefs_subtitles \
	ui/sprefs_video \
	ui/streampanel \
	ui/sout


UIH = $(TOUI:%=%.h)

TOMOC = main_interface \
	menus \
	dialogs_provider \
	input_manager \
	playlist_model \
	dialogs/playlist \
	dialogs/prefs_dialog \
	dialogs/messages \
	dialogs/errors \
	dialogs/mediainfo \
	dialogs/extended \
	dialogs/interaction \
	dialogs/sout \
	dialogs/help \
    dialogs/open \
	components/extended_panels \
	components/infopanels \
	components/preferences_widgets \
	components/preferences \
	components/simple_preferences \
	components/open \
	components/interface_widgets \
	components/playlist/panels \
	components/playlist/selector \
	util/input_slider \
	util/customwidgets
MOCCPP = $(TOMOC:%=%.moc.cpp)

nodist_SOURCES_qt4 = \
		main_interface.moc.cpp \
		menus.moc.cpp \
		dialogs_provider.moc.cpp \
		input_manager.moc.cpp \
		playlist_model.moc.cpp \
		dialogs/playlist.moc.cpp \
		dialogs/mediainfo.moc.cpp \
		dialogs/extended.moc.cpp \
		dialogs/messages.moc.cpp \
		dialogs/errors.moc.cpp \
		dialogs/prefs_dialog.moc.cpp \
		dialogs/interaction.moc.cpp \
		dialogs/sout.moc.cpp \
		dialogs/help.moc.cpp \
		dialogs/open.moc.cpp \
		components/extended_panels.moc.cpp \
		components/infopanels.moc.cpp \
	 	components/preferences_widgets.moc.cpp \
	 	components/preferences.moc.cpp \
		components/simple_preferences.moc.cpp \
		components/open.moc.cpp \
		components/interface_widgets.moc.cpp \
		components/playlist/panels.moc.cpp \
		components/playlist/selector.moc.cpp \
		util/input_slider.moc.cpp \
		util/customwidgets.moc.cpp \
		resources.cpp

if ENABLE_QT4
BUILT_SOURCES += $(UIH) $(nodist_SOURCES_qt4)
endif

resources.cpp: res.qrc
	$(RCC) -name vlc -o $@ $<

$(MOCCPP): %.moc.cpp: %.hpp
	@echo "$(MOC) $< -> $@"
	$(MOC) -o $@ $<

$(UIH): %.h: %.ui
	mkdir -p -- ui
	@echo "$(UIC) $< -> $@"
	rm -f $@
	echo "#define Q_(a,b) QString::fromUtf8(_(a))" > $@
	$(UIC) -tr "Q_" $< >> $@
	sed -i -e 's/Q_(\"_(\\\"\(.*\)\\\")"/Q_("\1"/' $@


SOURCES_qt4 = 	qt4.cpp \
		menus.cpp \
		main_interface.cpp \
		dialogs_provider.cpp \
		input_manager.cpp \
		playlist_model.cpp \
		dialogs/playlist.cpp \
		dialogs/prefs_dialog.cpp \
		dialogs/mediainfo.cpp \
		dialogs/extended.cpp \
		dialogs/messages.cpp \
		dialogs/errors.cpp \
		dialogs/interaction.cpp \
		dialogs/sout.cpp \
		dialogs/help.cpp \
		dialogs/open.cpp \
		components/extended_panels.cpp \
		components/infopanels.cpp \
		components/preferences_widgets.cpp \
		components/preferences.cpp \
		components/simple_preferences.cpp \
		components/open.cpp \
		components/interface_widgets.cpp \
		components/playlist/standardpanel.cpp \
		components/playlist/selector.cpp \
		util/input_slider.cpp \
		util/customwidgets.cpp \
		$(NULL)

EXTRA_DIST += \
	qt4.hpp \
	menus.hpp \
	main_interface.hpp \
	dialogs_provider.hpp \
	input_manager.hpp \
	playlist_model.hpp \
	res.qrc \
	dialogs/playlist.hpp \
	dialogs/mediainfo.hpp \
	dialogs/extended.hpp \
	dialogs/messages.hpp \
	dialogs/errors.hpp \
	dialogs/prefs_dialog.hpp \
	dialogs/interaction.hpp \
	dialogs/sout.hpp \
	dialogs/help.hpp \
	dialogs/open.hpp \
	components/extended_panels.hpp \
	components/infopanels.hpp \
	components/preferences_widgets.hpp \
	components/preferences.hpp \
	components/simple_preferences.hpp \
	components/open.hpp \
	components/interface_widgets.hpp \
	components/playlist/panels.hpp \
	components/playlist/selector.hpp \
	util/input_slider.hpp \
	util/directslider.hpp \
	util/customwidgets.hpp \
	util/qvlcframe.hpp \
	ui/equalizer.ui \
	ui/video_effects.ui \
	ui/open_file.ui \
	ui/open_disk.ui \
	ui/open_net.ui \
	ui/open.ui \
	ui/main_interface.ui \
	ui/sprefs_audio.ui \
	ui/sprefs_input.ui \
	ui/sprefs_interface.ui \
	ui/sprefs_playlist.ui \
	ui/sprefs_subtitles.ui \
	ui/sprefs_video.ui \
	ui/streampanel.ui \
	ui/sout.ui \
	pixmaps/advanced.xpm \
	pixmaps/audio.xpm \
	pixmaps/codec.xpm \
	pixmaps/intf.xpm \
	pixmaps/type_net.xpm \
	pixmaps/type_playlist.xpm \
	pixmaps/video.xpm \
	pixmaps/advanced_50x50.xpm \
	pixmaps/audio_50x50.xpm \
	pixmaps/input_and_codecs_50x50.xpm \
	pixmaps/interface_50x50.xpm \
	pixmaps/playlist_50x50.xpm \
	pixmaps/subtitles_50x50.xpm \
	pixmaps/video_50x50.xpm
