SUMMARY="Note taking application, write down your thoughts"
DESCRIPTION="Notes is an open source and cross-platform note-taking app that is both beautiful \
and powerful.

Features:
- Native app (written in C++ with Qt).
- Fast with a low memory footprint.
- Fully open source and cross-platform (Linux, macOS, Windows).
- Completely private - tracks nothing.
- Beautiful and sleek looking, yet still powerful.
- Folders and tags. Organize your ideas hierarchically using nested folders and universally \
using tags.
- Markdown Support. Format text without lifting your hands from the keyboard.
- Different themes. Switch between Light, Dark, and Sepia.
- Feed View. Select multiple notes to see them all one after another in the editor.
- Always runs in the background. Use the hotkey Win+Shift+N to summon Notes. Ctrl+N for macOS.
- Keyboard shortcuts. Meant to have the option to be used solely with a keyboard (but more work \
needs to be done there).
- What feature will you contribute?"
HOMEPAGE="https://get-notes.com"
COPYRIGHT="2023 nuttyartist et all"
LICENSE="MPL v2.0"
REVISION="2"
SOURCE_URI="https://github.com/nuttyartist/notes/archive/refs/tags/v2.1.0.tar.gz"
CHECKSUM_SHA256="8a8ae079fad6d9d5e9206acf5f4d19e1e73e1196e6c27408072b5cccf8778b95"
srcGitRev_2="efdb2e5a25e5646390f8658e3321f6e9a4c3561a"
SOURCE_URI_2="https://github.com/b00f/qautostart/archive/$srcGitRev_2.tar.gz"
CHECKSUM_SHA256_2="5eb501b31916fdb516979c6a19dc17a64711186090a29f92be4a6f0704e819cd"
SOURCE_DIR_2="qautostart-$srcGitRev_2"
srcGitRev_3="b2926abe78a98d79290106b17016e99a251f4a8c"
SOURCE_URI_3="https://github.com/pbek/qmarkdowntextedit/archive/$srcGitRev_3.tar.gz"
CHECKSUM_SHA256_3="c1af63c7be3444ee3df848a11371e121f504d7fed7483bbac0f90e9fd7fe07f8"
SOURCE_DIR_3="qmarkdowntextedit-$srcGitRev_3"
srcGitRev_4="14c1bef71d26c915eeaa05c988c55bdad98e1d75"
SOURCE_URI_4="https://github.com/alex-spataru/QSimpleUpdater/archive/$srcGitRev_4.tar.gz"
CHECKSUM_SHA256_4="a23f78f846b9dfb4074d2371923c76dc5c7415548056ecb3454189bb02e8e8f4"
SOURCE_DIR_4="QSimpleUpdater-$srcGitRev_4"
ADDITIONAL_FILES="notes.rdef.in"

ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	notes$secondaryArchSuffix = $portVersion
	app:Notes = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libGL$secondaryArchSuffix
	lib:libQt6Concurrent$secondaryArchSuffix
	lib:libQt6Core$secondaryArchSuffix
	lib:libQt6Gui$secondaryArchSuffix
	lib:libQt6Network$secondaryArchSuffix
	lib:libQt6Sql$secondaryArchSuffix
	lib:libQt6Widgets$secondaryArchSuffix
	lib:libX11$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	xlibe${secondaryArchSuffix}_devel
	devel:libQt6Concurrent$secondaryArchSuffix
	devel:libQt6Core$secondaryArchSuffix
	devel:libQt6DBus$secondaryArchSuffix
	devel:libQt6Gui$secondaryArchSuffix
	devel:libQt6Network$secondaryArchSuffix
	devel:libQt6Sql$secondaryArchSuffix
	devel:libQt6Test$secondaryArchSuffix
	devel:libQt6Widgets$secondaryArchSuffix
	devel:libxcb$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:make
	"

BUILD()
{
	cp -rf $sourceDir2/* 3rdParty/qautostart
	cp -rf $sourceDir3/* 3rdParty/qmarkdowntextedit
	cp -rf $sourceDir4/* 3rdParty/QSimpleUpdater
	cmake -Bbuild -S. -DCMAKE_BUILD_TYPE=Release \
		$cmakeDirArgs \
		-DUPDATE_CHECKER=OFF
	make -C build $jobArgs
}

INSTALL()
{
	make -C build install
	mkdir -p $appsDir
	mv $prefix/bin/notes $appsDir/Notes
	rm -rf $dataDir

	local MAJOR="`echo "$portVersion" | cut -d. -f1`"
	local MIDDLE="`echo "$portVersion" | cut -d. -f2`"
	local MINOR="`echo "$portVersion" | cut -d. -f3`"
	local APP_NAME="Notes"
	local LONG_INFO="$SUMMARY"
	local APP_SIGNATURE="application/x-vnd.notes"
	sed \
		-e "s|@MAJOR@|$MAJOR|" \
		-e "s|@MIDDLE@|$MIDDLE|" \
		-e "s|@MINOR@|$MINOR|" \
		-e "s|@LONG_INFO@|$LONG_INFO|" \
		-e "s|@APP_NAME@|$APP_NAME|" \
		-e "s|@APP_SIGNATURE@|$APP_SIGNATURE|" \
		$portDir/additional-files/notes.rdef.in > notes.rdef

	addResourcesToBinaries notes.rdef $appsDir/Notes

	addAppDeskbarSymlink $appsDir/Notes Notes
}
