# Copyright 2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=7

inherit desktop git-r3 qmake-utils

DESCRIPTION="Data Analyser for CPAP machines"
HOMEPAGE="https://www.apneaboard.com/wiki/index.php?title=OSCAR_Help"
EGIT_REPO_URI="https://gitlab.com/pholy/OSCAR-code.git"
EGIT_CHECKOUT_DIR=${WORKDIR}/${P}
EGIT_COMMIT="v${PV}"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~ppc64"
IUSE=""

RDEPEND="
	dev-qt/qtopengl:5
	dev-qt/qtxml:5
	dev-qt/qtprintsupport:5
	dev-qt/qtserialport:5
	"
DEPEND="${RDEPEND}"

src_prepare() {
	mkdir build
	eapply_user
	pushd build
	eqmake5 ../OSCAR_QT.pro
	popd
}

src_compile() {
	pushd build
	emake
	popd
}

src_install() {
	doicon -s 48 Building/Linux/OSCAR.png
	dodoc README
	pushd build/oscar
	exeinto /usr/bin
	newexe OSCAR oscar
	insinto /usr/share/OSCAR
	doins -r Translations
	insinto /usr/share/OSCAR/Html
	doins Html/{about,credits,release_notes}.html
	popd
	make_desktop_entry \
		oscar \
		OSCAR \
		"/usr/share/icons/hicolor/48x48/apps/OSCAR.png" \
		"Science;DataVisualization;MedicalSoftware"
}