Add recipe for Fortuna

This commit is contained in:
Puck Meerburg
2013-12-02 23:18:26 +01:00
parent 664e3c050d
commit 8e554bea72
2 changed files with 146 additions and 0 deletions

View File

@@ -0,0 +1,49 @@
SUMMARY="A small GUI for showing the well known fortunes"
DESCRIPTION="
Fortuna is a nice-looking graphical program which displays a fortune when you open it.
Yeah, sure, there is already a fortune program, but it only shows from the command line,
you'll get a lot of repeats, it's quite a bit of work to install more,
and you have to muck around with your UserBootScript. Lots of messing around.
Then again, you can use Fortuna, which has none of this.
" # Taken from homepage
HOMEPAGE="http://darkwyrm.beemulated.net/apps/fortuna.htm"
SRC_URI="git://github.com/HaikuArchives/Fortuna.git#eacb3689800064b948d3b943302b2d4bf18c9dbc"
REVISION="1"
LICENSE="MIT"
COPYRIGHT="2006 DarkWyrm"
ARCHITECTURES="x86 x86_gcc2"
PATCHES="fortuna-1.0.0.patch"
PROVIDES="
fortuna = $portVersion
app:fortuna = $portVersion
"
REQUIRES="
haiku >= $haikuVersion
"
BUILD_REQUIRES="
haiku_devel >= $haikuVersion
cmd:gcc
cmd:xres
"
BUILD()
{
gcc -o Fortuna -lbe src/main.cpp src/FortuneWindow.cpp src/FortuneFunctions.cpp
xres -o Fortuna src/Fortuna.rsrc
mimeset -f Fortuna
}
INSTALL()
{
mkdir -p $appsDir/Fortuna
cp Fortuna $appsDir/Fortuna
addAppDeskbarSymlink $appsDir/Fortuna/Fortuna
}

View File

@@ -0,0 +1,97 @@
diff --git a/src/FortuneFunctions.cpp b/src/FortuneFunctions.cpp
index 5fc031a..c083cee 100644
--- a/src/FortuneFunctions.cpp
+++ b/src/FortuneFunctions.cpp
@@ -13,6 +13,11 @@ FortuneAccess::FortuneAccess(const char *folder)
SetFolder(folder);
}
+FortuneAccess::FortuneAccess()
+{
+
+}
+
FortuneAccess::~FortuneAccess(void)
{
MakeEmpty();
diff --git a/src/FortuneFunctions.h b/src/FortuneFunctions.h
index 07cb8f5..85eb1e0 100644
--- a/src/FortuneFunctions.h
+++ b/src/FortuneFunctions.h
@@ -8,6 +8,7 @@ class FortuneAccess
{
public:
FortuneAccess(const char *folder);
+ FortuneAccess();
~FortuneAccess(void);
status_t SetFolder(const char *folder);
diff --git a/src/FortuneWindow.cpp b/src/FortuneWindow.cpp
index d79c7f5..0f3bcf8 100644
--- a/src/FortuneWindow.cpp
+++ b/src/FortuneWindow.cpp
@@ -1,22 +1,30 @@
#include "FortuneWindow.h"
#include <Alert.h>
-#include <View.h>
-#include <Button.h>
-#include <ScrollView.h>
#include <Application.h>
+#include <Button.h>
+#include <FindDirectory.h>
+#include <Path.h>
#include <Screen.h>
+#include <ScrollView.h>
+#include <View.h>
#define M_GET_ANOTHER_FORTUNE 'gafn'
#define M_ABOUT_REQUESTED 'abrq'
FortuneWindow::FortuneWindow(void)
- : BWindow(BRect(0,0,300,300),"Fortune",B_DOCUMENT_WINDOW,B_ASYNCHRONOUS_CONTROLS),
- fFortune("/boot/beos/etc/fortunes")
+ : BWindow(BRect(0,0,300,300),"Fortune",B_DOCUMENT_WINDOW,B_ASYNCHRONOUS_CONTROLS),
+ fFortune()
{
+ BPath path;
+ find_directory(B_SYSTEM_DATA_DIRECTORY, &path);
+ path.Append("fortunes");
+
+ fFortune.SetFolder(path.Path());
+
BView *back = new BView(Bounds(),"background",B_FOLLOW_ALL, B_WILL_DRAW);
back->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR));
AddChild(back);
-
+
BButton *close = new BButton(BRect(0,0,1,1),"closebutton","Close",
new BMessage(B_QUIT_REQUESTED), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
close->ResizeToPreferred();
@@ -63,7 +71,9 @@ FortuneWindow::FortuneWindow(void)
{
fTextView->SetText("Fortuna had a problem getting a fortune.\n\n"
"Please make sure that you have installed fortune files to "
- "the folder /boot/beos/etc/fortunes.");
+ "the folder ");
+ fTextView->Insert(path.Path());
+ fTextView->Insert(".");
}
next->MakeFocus(true);
@@ -100,9 +110,15 @@ void FortuneWindow::MessageReceived(BMessage *msg)
}
else
{
+ BPath path;
+ find_directory(B_SYSTEM_DATA_DIRECTORY, &path);
+ path.Append("fortunes");
+
fTextView->SetText("Fortuna had a problem getting a fortune.\n\n"
"Please make sure that you have installed fortune files to "
- "the folder /boot/beos/etc/fortunes.");
+ "the folder ");
+ fTextView->Insert(path.Path());
+ fTextView->Insert(".");
}
}
else