#!/bin/bash

cd "$(dirname "$0")"
ADAPTOR_DIR="../cadMousePro-daemon/src/generated-sources"
PROXY_DIR="../cadMousePro-gui/src/generated-sources"
XML="info.globalcode.mouse.cadMousePro.xml"

case "$1" in
	adaptor)
		qdbusxml2cpp -a DBusAdaptor.h:DBusAdaptor.cpp -c DBusAdaptor -l Daemon -i ../Daemon.h "$XML"
		mkdir -p "$ADAPTOR_DIR"
		mv DBusAdaptor.h DBusAdaptor.cpp "$ADAPTOR_DIR"
		;;
	proxy)
		qdbusxml2cpp -l Daemon -i ../Daemon.h -p Proxy.h "$XML"
		mkdir -p "$PROXY_DIR"
		mv Proxy.h "$PROXY_DIR"
		;;
	*)
		echo $"Usage: $0 (adaptor|proxy)"
		exit 1
esac
