1 /* 2 * Copyright 2009, Stephan Aßmus <superstippi@gmx.de> 3 * Copyright 2005, Jérôme DUVAL. 4 * All rights reserved. Distributed under the terms of the MIT License. 5 */ 6 7 #include "InstallerApp.h" 8 9 #include <Alert.h> 10 #include <TextView.h> 11 12 #include "tracker_private.h" 13 14 15 static const uint32 kMsgAgree = 'agre'; 16 static const uint32 kMsgNext = 'next'; 17 18 //static const char* kEULAText = 19 //"NOTICE: READ THIS BEFORE INSTALLING OR USING HAIKU\n\n" 20 // 21 //"Copyright " B_UTF8_COPYRIGHT " 2001-2009 The Haiku Project. All rights " 22 //"reserved. The copyright to the Haiku code is property of Haiku, Inc. or of " 23 //"the respective authors where expressly noted in the source.\n\n" 24 // 25 //"Permission is hereby granted, free of charge, to any person obtaining a " 26 //"copy of this software and associated documentation files (the \"Software\"), " 27 //"to deal in the Software without restriction, including without limitation " 28 //"the rights to use, copy, modify, merge, publish, distribute, sublicense, " 29 //"and/or sell copies of the Software, and to permit persons to whom the " 30 //"Software is furnished to do so, subject to the following conditions:\n\n" 31 //"The above copyright notice and this permission notice shall be included in " 32 //"all copies or substantial portions of the Software.\n\n" 33 // 34 //"THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS " 35 //"OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, " 36 //"FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE " 37 //"AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER " 38 //"LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING " 39 //"FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS " 40 //"IN THE SOFTWARE."; 41 42 43 #undef B_TRANSLATION_CONTEXT 44 #define B_TRANSLATION_CONTEXT "InstallerApp" 45 46 47 int main(int, char **) 48 { 49 InstallerApp theApp; 50 theApp.Run(); 51 return 0; 52 } 53 54 55 InstallerApp::InstallerApp() 56 : 57 BApplication("application/x-vnd.Haiku-Installer") 58 { 59 } 60 61 62 void 63 InstallerApp::MessageReceived(BMessage* message) 64 { 65 switch (message->what) { 66 case kMsgAgree: 67 fEULAWindow->Lock(); 68 fEULAWindow->Quit(); 69 case kMsgNext: 70 new InstallerWindow(); 71 break; 72 73 default: 74 BApplication::MessageReceived(message); 75 } 76 } 77 78 79 void 80 InstallerApp::AboutRequested() 81 { 82 BAlert *alert = new BAlert("about", B_TRANSLATE("Installer\n" 83 "\twritten by Jérôme Duval and Stephan Aßmus\n" 84 "\tCopyright 2005-2010, Haiku.\n\n"), B_TRANSLATE("OK")); 85 alert->SetFlags(alert->Flags() | B_CLOSE_ON_ESCAPE); 86 BTextView *view = alert->TextView(); 87 BFont font; 88 89 view->SetStylable(true); 90 91 view->GetFont(&font); 92 font.SetSize(18); 93 font.SetFace(B_BOLD_FACE); 94 view->SetFontAndColor(0, 9, &font); 95 96 alert->Go(); 97 } 98 99 100 void 101 InstallerApp::ReadyToRun() 102 { 103 #if 1 104 // Show the EULA first. 105 fEULAWindow = new EULAWindow(); 106 #else 107 // Show the installer window without EULA. 108 new InstallerWindow(); 109 #endif 110 } 111