#include "MidiPlayerApp.h"
#include <AboutWindow.h>
#include <Alert.h>
#include <Catalog.h>
#include <Locale.h>
#include <StorageKit.h>
#include "MidiPlayerWindow.h"
#undef B_TRANSLATION_CONTEXT
#define B_TRANSLATION_CONTEXT "Main Application"
MidiPlayerApp::MidiPlayerApp()
:
BApplication(MIDI_PLAYER_SIGNATURE)
{
window = new MidiPlayerWindow();
}
void
MidiPlayerApp::ReadyToRun()
{
window->Show();
}
void
MidiPlayerApp::AboutRequested()
{
BAboutWindow* window = new BAboutWindow(B_TRANSLATE_SYSTEM_NAME("MidiPlayer"),
MIDI_PLAYER_SIGNATURE);
const char* extraCopyrights[] = {
"2008-2014 Haiku, Inc.",
NULL
};
window->AddCopyright(2004, "Matthijs Hollemans", extraCopyrights);
const char* authors[] = {
"Adrien Destugues",
"Axel Dörfler",
"Matthijs Hollemans",
"Humdinger",
"Ryan Leavengood",
"Matt Madia",
"John Scipione",
"Jonas Sundström",
"Oliver Tappe",
NULL
};
window->AddAuthors(authors);
window->AddDescription(B_TRANSLATE_COMMENT(
"This tiny program\n"
"Knows how to play thousands of\n"
"Cheesy sounding songs",
"This is a haiku. First line has five syllables, "
"second has seven and last has five again. "
"Create your own."));
window->Show();
}
void
MidiPlayerApp::RefsReceived(BMessage* message)
{
message->what = B_SIMPLE_DATA;
window->PostMessage(message);
}
void
MidiPlayerApp::ArgvReceived(int32 argc, char** argv)
{
if (argc > 1) {
BMessage msg;
msg.what = B_SIMPLE_DATA;
BEntry entry(argv[1]);
entry_ref ref;
entry.GetRef(&ref);
msg.AddRef("refs", &ref);
window->PostMessage(&msg);
}
}
int
main()
{
MidiPlayerApp app;
app.Run();
return 0;
}