2 * Copyright 2008-10, Oliver Ruiz Dorantes, <oliver.ruiz.dorantes_at_gmail.com>
3 * All rights reserved. Distributed under the terms of the MIT License.
9 #include <MessageRunner.h>
11 #include <private/interface/AboutWindow.h>
13 #include "BluetoothMain.h"
14 #include "BluetoothWindow.h"
18 #undef B_TRANSLATION_CONTEXT
19 #define B_TRANSLATION_CONTEXT "main"
21 BluetoothApplication::BluetoothApplication()
23 BApplication(BLUETOOTH_APP_SIGNATURE
)
29 BluetoothApplication::ReadyToRun()
31 if (!be_roster
->IsRunning(BLUETOOTH_SIGNATURE
)) {
32 BAlert
* alert
= new BAlert("Services not running",
33 B_TRANSLATE("The Bluetooth services are not currently running "
35 B_TRANSLATE("Launch now"), B_TRANSLATE("Quit"), "",
36 B_WIDTH_AS_USUAL
, B_WARNING_ALERT
);
37 alert
->SetShortcut(1, B_ESCAPE
);
38 int32 choice
= alert
->Go();
44 error
= be_roster
->Launch(BLUETOOTH_SIGNATURE
);
45 printf("kMsgStartServices: %s\n", strerror(error
));
46 // TODO: This is temporal
47 // BMessage handcheck: use the version of Launch()
48 // that includes a BMessage in that message include
49 // a BMessenger to yourself and the BT server could
50 // use that messenger to send back a reply indicating
51 // when it's ready and you could just create window
52 BMessageRunner::StartSending(be_app_messenger
,
53 new BMessage('Xtmp'), 2 * 1000000, 1);
57 PostMessage(B_QUIT_REQUESTED
);
64 PostMessage(new BMessage('Xtmp'));
69 BluetoothApplication::MessageReceived(BMessage
* message
)
71 switch (message
->what
) {
72 case kMsgAddToRemoteList
:
73 fWindow
->PostMessage(message
);
77 if (!be_roster
->IsRunning(BLUETOOTH_SIGNATURE
)) {
78 // Give another chance
79 BMessageRunner::StartSending(be_app_messenger
,
80 new BMessage('Xtmp'), 2 * 1000000, 1);
82 fWindow
= new BluetoothWindow(BRect(100, 100, 750, 420));
88 BApplication::MessageReceived(message
);
94 BluetoothApplication::AboutRequested()
96 BAboutWindow
* about
= new BAboutWindow("Bluetooth", BLUETOOTH_APP_SIGNATURE
);
97 about
->AddCopyright(2010, "Oliver Ruiz Dorantes");
98 about
->AddText(B_TRANSLATE(
100 " - Mika Lindqvist\n"
101 " - Adrien Destugues\n"
102 " - Maksym Yevmenkin\n\n"
103 "Thanks to the individuals who helped...\n\n"
104 "Shipping/donating hardware:\n"
105 " - Henry Jair Abril Florez (el Colombian)\n"
106 " & Stefanie Bartolich\n"
107 " - Edwin Erik Amsler\n"
108 " - Dennis d'Entremont\n"
110 " - Pieter Panman\n\n"
112 " - Karl vom Dorff, Andrea Bernardi (OSDrawer),\n"
113 " - Matt M, Doug F, Hubert H,\n"
114 " - Sebastian B, Andrew M, Jared E,\n"
115 " - Frederik H, Tom S, Ferry B,\n"
116 " - Greg G, David F, Richard S, Martin W:\n\n"
118 " - Michael Weirauch\n"
119 " - Fredrik Ekdahl\n"
120 " - Raynald Lesieur\n"
121 " - Andreas Färber\n"
124 " - Petter H. Juliussen\n"
125 "Who gave me all the knowledge:\n"
126 " - the yellowTAB team"));
134 BluetoothApplication app
;