Ticket #9982: 0001-installer-eula-fix.patch
File 0001-installer-eula-fix.patch, 17.1 KB (added by , 11 years ago) |
---|
-
new file src/apps/installer/EULAWindow.cpp
From 135911218c23b5123f913fb1dd48724c5765da72 Mon Sep 17 00:00:00 2001 From: Freeman Lou <freemanlou2430@Yahoo.com> Date: Tue, 17 Dec 2013 02:25:14 +0000 Subject: [PATCH] installer eula fix --- src/apps/installer/EULAWindow.cpp | 198 ++++++++++++++++++++++++++++++++++++ src/apps/installer/EULAWindow.h | 30 ++++++ src/apps/installer/InstallerApp.cpp | 169 +----------------------------- src/apps/installer/InstallerApp.h | 3 +- src/apps/installer/Jamfile | 2 + 5 files changed, 235 insertions(+), 167 deletions(-) create mode 100644 src/apps/installer/EULAWindow.cpp create mode 100644 src/apps/installer/EULAWindow.h diff --git a/src/apps/installer/EULAWindow.cpp b/src/apps/installer/EULAWindow.cpp new file mode 100644 index 0000000..7fb853f
- + 1 /* 2 * Copyright 2013 Jérôme DUVAL 3 * All rights reserved. Distributed under the terms of the MIT license. 4 */ 5 #include "EULAWindow.h" 6 7 #include <Application.h> 8 #include <Box.h> 9 #include <Button.h> 10 #include <Catalog.h> 11 #include <LayoutBuilder.h> 12 #include <LayoutUtils.h> 13 #include <Locale.h> 14 #include <Roster.h> 15 #include <ScrollView.h> 16 #include <SpaceLayoutItem.h> 17 18 #include "tracker_private.h" 19 20 #undef B_TRANSLATION_CONTEXT 21 #define B_TRANSLATION_CONTEXT "EULAWindow" 22 23 24 static const uint32 kMsgAgree = 'agre'; 25 26 EULAWindow::EULAWindow() 27 : 28 BWindow(BRect(0,0,600,450), B_TRANSLATE("README"), 29 B_MODAL_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_NOT_ZOOMABLE 30 | B_NOT_MINIMIZABLE | B_AUTO_UPDATE_SIZE_LIMITS) 31 { 32 BString infoText; 33 infoText << B_TRANSLATE( 34 "Welcome to the Haiku Installer!\n\n"); 35 infoText << B_TRANSLATE( 36 "IMPORTANT INFORMATION BEFORE INSTALLING HAIKU\n\n"); 37 infoText << B_TRANSLATE( 38 "This is alpha-quality software! It means there is a high risk of " 39 "losing important data. Make frequent backups! You have been " 40 "warned.\n\n\n"); 41 infoText << B_TRANSLATE( 42 "1) If you are installing Haiku onto real hardware (not inside an " 43 "emulator) it is recommended that you have already prepared a hard " 44 "disk partition. The Installer and the DriveSetup tool offer to " 45 "initialize existing partitions with the Haiku native file system, " 46 "but the options to change the actual partition layout may not have " 47 "been tested on a sufficiently great variety of computer " 48 "configurations so we do not recommend using it.\n"); 49 infoText << B_TRANSLATE( 50 "If you have not created a partition yet, simply reboot, create the " 51 "partition using whatever tool you feel most comfortable with, and " 52 "reboot into Haiku to continue with the installation. You could for " 53 "example use the GParted Live-CD, it can also resize existing " 54 "partitions to make room.\n\n\n"); 55 infoText << B_TRANSLATE( 56 "2) The Installer will make the Haiku partition itself bootable, " 57 "but takes no steps to integrate Haiku into an existing boot menu. " 58 "If you have GRUB already installed, you can add Haiku to its boot " 59 "menu. Depending on what version of GRUB you use, this is done " 60 "differently.\n\n\n"); 61 infoText << B_TRANSLATE( 62 "2.1) GRUB (since os-prober v1.44)\n"); 63 infoText << B_TRANSLATE( 64 "Starting with os-prober v1.44 (e.g. in Ubuntu 11.04 or later), Haiku " 65 "should be recognized out of the box. To add Haiku to the GRUB menu, " 66 "open a Terminal and enter:\n\n"); 67 infoText << B_TRANSLATE( 68 "\tsudo update-grub\n\n\n"); 69 infoText << B_TRANSLATE( 70 "2.2) GRUB 1\n"); 71 infoText << B_TRANSLATE( 72 "Configure your /boot/grub/menu.lst by launching your favorite " 73 "editor from a Terminal like this:\n\n"); 74 infoText << B_TRANSLATE( 75 "\tsudo <your favorite text editor> /boot/grub/menu.lst\n\n"); 76 infoText << B_TRANSLATE( 77 "You'll note that GRUB uses a different naming strategy for hard " 78 "drives than Linux.\n\n"); 79 infoText << B_TRANSLATE( 80 "With GRUB it's: (hdN,n)\n\n"); 81 infoText << B_TRANSLATE( 82 "All hard disks start with \"hd\".\n"); 83 infoText << B_TRANSLATE( 84 "\"N\" is the hard disk number, starting with \"0\".\n"); 85 infoText << B_TRANSLATE( 86 "\"n\" is the partition number, also starting with \"0\".\n"); 87 infoText << B_TRANSLATE( 88 "The first logical partition always has the number \"4\", regardless " 89 "of the number of primary partitions.\n\n"); 90 infoText << B_TRANSLATE( 91 "So behind the other menu entries towards the bottom of the file, add " 92 "something similar to these lines:\n\n"); 93 infoText << B_TRANSLATE( 94 "\t# Haiku on /dev/sda7\n"); 95 infoText << B_TRANSLATE( 96 "\ttitle\t\t\t\tHaiku\n"); 97 infoText << B_TRANSLATE( 98 "\trootnoverify\t\t(hd0,6)\n"); 99 infoText << B_TRANSLATE( 100 "\tchainloader\t\t+1\n\n"); 101 infoText << B_TRANSLATE( 102 "You can see the correct partition in GParted for example.\n\n\n"); 103 infoText << B_TRANSLATE( 104 "2.3) GRUB 2\n"); 105 infoText << B_TRANSLATE( 106 "Newer versions of GRUB use an extra configuration file to add " 107 "custom entries to the boot menu. To add them to the top, you have " 108 "to create/edit a file by launching your favorite editor from a " 109 "Terminal like this:\n\n"); 110 infoText << B_TRANSLATE( 111 "\tsudo <your favorite text editor> /etc/grub.d/40_custom\n\n"); 112 infoText << B_TRANSLATE( 113 "NOTE: While the naming strategy for hard disks is still as described " 114 "under 2.1) the naming scheme for partitions has changed.\n\n"); 115 infoText << B_TRANSLATE( 116 "GRUB's naming scheme is still: (hdN,n)\n\n"); 117 infoText << B_TRANSLATE( 118 "All hard disks start with \"hd\".\n"); 119 infoText << B_TRANSLATE( 120 "\"N\" is the hard disk number, starting with \"0\".\n"); 121 infoText << B_TRANSLATE( 122 "\"n\" is the partition number, which for GRUB 2 starts with \"1\"\n"); 123 infoText << B_TRANSLATE( 124 "With GRUB 2 the first logical partition always has the number \"5\", " 125 "regardless of the number of primary partitions.\n\n"); 126 infoText << B_TRANSLATE( 127 "So below the heading that must not be edited, add something similar " 128 "to these lines:\n\n"); 129 infoText << B_TRANSLATE( 130 "\t# Haiku on /dev/sda7\n"); 131 infoText << B_TRANSLATE( 132 "\tmenuentry \"Haiku Alpha\" {\n"); 133 infoText << B_TRANSLATE( 134 "\t\tset root=(hd0,7)\n"); 135 infoText << B_TRANSLATE( 136 "\t\tchainloader +1\n"); 137 infoText << B_TRANSLATE( 138 "\t}\n\n"); 139 infoText << B_TRANSLATE( 140 "Additionally you have to edit another file to actually display the " 141 "boot menu:\n\n"); 142 infoText << B_TRANSLATE( 143 "\tsudo <your favorite text editor> /etc/default/grub\n\n"); 144 infoText << B_TRANSLATE( 145 "Here you have to comment out the line \"GRUB_HIDDEN_TIMEOUT=0\" by " 146 "putting a \"#\" in front of it in order to actually display the " 147 "boot menu.\n\n"); 148 infoText << B_TRANSLATE( 149 "Finally, you have to update the boot menu by entering:\n\n"); 150 infoText << B_TRANSLATE( 151 "\tsudo update-grub\n\n\n"); 152 infoText << B_TRANSLATE( 153 "3) When you successfully boot into Haiku for the first time, make " 154 "sure to read our \"Welcome\" and \"Userguide\" documentation. There " 155 "are links on the Desktop and in WebPositive's bookmarks.\n\n"); 156 infoText << B_TRANSLATE( 157 "Have fun and thanks a lot for trying out Haiku! We hope you like it!"); 158 159 fTextView = new BTextView("eula", be_plain_font, NULL, B_WILL_DRAW); 160 fTextView->SetInsets(10, 10, 10, 10); 161 fTextView->MakeEditable(false); 162 fTextView->MakeSelectable(false); 163 fTextView->SetText(infoText); 164 165 fScrollView = new BScrollView("eulaScroll", fTextView, B_WILL_DRAW, false, 166 true); 167 168 fCancelButton = new BButton(B_TRANSLATE("Quit"), 169 new BMessage(B_QUIT_REQUESTED)); 170 fCancelButton->SetTarget(be_app); 171 172 fContinueButton = new BButton(B_TRANSLATE("Continue"), 173 new BMessage(kMsgAgree)); 174 fContinueButton->SetTarget(be_app); 175 fContinueButton->MakeDefault(true); 176 177 if (!be_roster->IsRunning(kTrackerSignature)) 178 SetWorkspaces(B_ALL_WORKSPACES); 179 180 BLayoutBuilder::Group<>(this, B_VERTICAL, 10) 181 .SetInsets(10) 182 .Add(fScrollView) 183 .AddGroup(B_HORIZONTAL, 10) 184 .AddGlue() 185 .Add(fCancelButton) 186 .Add(fContinueButton); 187 188 CenterOnScreen(); 189 Show(); 190 } 191 192 193 bool 194 EULAWindow::QuitRequested() 195 { 196 be_app->PostMessage(B_QUIT_REQUESTED); 197 return true; 198 } -
new file src/apps/installer/EULAWindow.h
diff --git a/src/apps/installer/EULAWindow.h b/src/apps/installer/EULAWindow.h new file mode 100644 index 0000000..57a1087
- + 1 /* 2 * Copyright 2013 Jérôme DUVAL 3 * All rights reserved. Distributed under the terms of the MIT license. 4 */ 5 #ifndef EULA_WINDOW_H 6 #define EULA_WINDOW_H 7 8 #include <Window.h> 9 10 class BButton; 11 class BScrollView; 12 class BTextView; 13 14 class EULAWindow : public BWindow { 15 public: 16 EULAWindow(); 17 18 virtual bool QuitRequested(); 19 20 private: 21 BTextView* fTextView; 22 23 BScrollView* fScrollView; 24 25 BButton* fCancelButton; 26 BButton* fContinueButton; 27 28 }; 29 30 #endif // EULA_WINDOW_H -
src/apps/installer/InstallerApp.cpp
diff --git a/src/apps/installer/InstallerApp.cpp b/src/apps/installer/InstallerApp.cpp index 8f16d34..dfd1b5e 100644
a b InstallerApp::MessageReceived(BMessage* message) 68 68 { 69 69 switch (message->what) { 70 70 case kMsgAgree: 71 { 71 72 fEULAWindow->Lock(); 72 73 fEULAWindow->Quit(); 73 74 new InstallerWindow(); 74 75 break; 75 76 } 76 77 default: 77 78 BApplication::MessageReceived(message); 78 79 } … … InstallerApp::AboutRequested() 103 104 void 104 105 InstallerApp::ReadyToRun() 105 106 { 106 BString infoText;107 infoText << B_TRANSLATE(108 "Welcome to the Haiku Installer!\n\n");109 infoText << B_TRANSLATE(110 "IMPORTANT INFORMATION BEFORE INSTALLING HAIKU\n\n");111 infoText << B_TRANSLATE(112 "This is alpha-quality software! It means there is a high risk of "113 "losing important data. Make frequent backups! You have been "114 "warned.\n\n\n");115 infoText << B_TRANSLATE(116 "1) If you are installing Haiku onto real hardware (not inside an "117 "emulator) it is recommended that you have already prepared a hard "118 "disk partition. The Installer and the DriveSetup tool offer to "119 "initialize existing partitions with the Haiku native file system, "120 "but the options to change the actual partition layout may not have "121 "been tested on a sufficiently great variety of computer "122 "configurations so we do not recommend using it.\n");123 infoText << B_TRANSLATE(124 "If you have not created a partition yet, simply reboot, create the "125 "partition using whatever tool you feel most comfortable with, and "126 "reboot into Haiku to continue with the installation. You could for "127 "example use the GParted Live-CD, it can also resize existing "128 "partitions to make room.\n\n\n");129 infoText << B_TRANSLATE(130 "2) The Installer will make the Haiku partition itself bootable, "131 "but takes no steps to integrate Haiku into an existing boot menu. "132 "If you have GRUB already installed, you can add Haiku to its boot "133 "menu. Depending on what version of GRUB you use, this is done "134 "differently.\n\n\n");135 infoText << B_TRANSLATE(136 "2.1) GRUB (since os-prober v1.44)\n");137 infoText << B_TRANSLATE(138 "Starting with os-prober v1.44 (e.g. in Ubuntu 11.04 or later), Haiku "139 "should be recognized out of the box. To add Haiku to the GRUB menu, "140 "open a Terminal and enter:\n\n");141 infoText << B_TRANSLATE(142 "\tsudo update-grub\n\n\n");143 infoText << B_TRANSLATE(144 "2.2) GRUB 1\n");145 infoText << B_TRANSLATE(146 "Configure your /boot/grub/menu.lst by launching your favorite "147 "editor from a Terminal like this:\n\n");148 infoText << B_TRANSLATE(149 "\tsudo <your favorite text editor> /boot/grub/menu.lst\n\n");150 infoText << B_TRANSLATE(151 "You'll note that GRUB uses a different naming strategy for hard "152 "drives than Linux.\n\n");153 infoText << B_TRANSLATE(154 "With GRUB it's: (hdN,n)\n\n");155 infoText << B_TRANSLATE(156 "All hard disks start with \"hd\".\n");157 infoText << B_TRANSLATE(158 "\"N\" is the hard disk number, starting with \"0\".\n");159 infoText << B_TRANSLATE(160 "\"n\" is the partition number, also starting with \"0\".\n");161 infoText << B_TRANSLATE(162 "The first logical partition always has the number \"4\", regardless "163 "of the number of primary partitions.\n\n");164 infoText << B_TRANSLATE(165 "So behind the other menu entries towards the bottom of the file, add "166 "something similar to these lines:\n\n");167 infoText << B_TRANSLATE(168 "\t# Haiku on /dev/sda7\n");169 infoText << B_TRANSLATE(170 "\ttitle\t\t\t\tHaiku\n");171 infoText << B_TRANSLATE(172 "\trootnoverify\t\t(hd0,6)\n");173 infoText << B_TRANSLATE(174 "\tchainloader\t\t+1\n\n");175 infoText << B_TRANSLATE(176 "You can see the correct partition in GParted for example.\n\n\n");177 infoText << B_TRANSLATE(178 "2.3) GRUB 2\n");179 infoText << B_TRANSLATE(180 "Newer versions of GRUB use an extra configuration file to add "181 "custom entries to the boot menu. To add them to the top, you have "182 "to create/edit a file by launching your favorite editor from a "183 "Terminal like this:\n\n");184 infoText << B_TRANSLATE(185 "\tsudo <your favorite text editor> /etc/grub.d/40_custom\n\n");186 infoText << B_TRANSLATE(187 "NOTE: While the naming strategy for hard disks is still as described "188 "under 2.1) the naming scheme for partitions has changed.\n\n");189 infoText << B_TRANSLATE(190 "GRUB's naming scheme is still: (hdN,n)\n\n");191 infoText << B_TRANSLATE(192 "All hard disks start with \"hd\".\n");193 infoText << B_TRANSLATE(194 "\"N\" is the hard disk number, starting with \"0\".\n");195 infoText << B_TRANSLATE(196 "\"n\" is the partition number, which for GRUB 2 starts with \"1\"\n");197 infoText << B_TRANSLATE(198 "With GRUB 2 the first logical partition always has the number \"5\", "199 "regardless of the number of primary partitions.\n\n");200 infoText << B_TRANSLATE(201 "So below the heading that must not be edited, add something similar "202 "to these lines:\n\n");203 infoText << B_TRANSLATE(204 "\t# Haiku on /dev/sda7\n");205 infoText << B_TRANSLATE(206 "\tmenuentry \"Haiku Alpha\" {\n");207 infoText << B_TRANSLATE(208 "\t\tset root=(hd0,7)\n");209 infoText << B_TRANSLATE(210 "\t\tchainloader +1\n");211 infoText << B_TRANSLATE(212 "\t}\n\n");213 infoText << B_TRANSLATE(214 "Additionally you have to edit another file to actually display the "215 "boot menu:\n\n");216 infoText << B_TRANSLATE(217 "\tsudo <your favorite text editor> /etc/default/grub\n\n");218 infoText << B_TRANSLATE(219 "Here you have to comment out the line \"GRUB_HIDDEN_TIMEOUT=0\" by "220 "putting a \"#\" in front of it in order to actually display the "221 "boot menu.\n\n");222 infoText << B_TRANSLATE(223 "Finally, you have to update the boot menu by entering:\n\n");224 infoText << B_TRANSLATE(225 "\tsudo update-grub\n\n\n");226 infoText << B_TRANSLATE(227 "3) When you successfully boot into Haiku for the first time, make "228 "sure to read our \"Welcome\" and \"Userguide\" documentation. There "229 "are links on the Desktop and in WebPositive's bookmarks.\n\n");230 infoText << B_TRANSLATE(231 "Have fun and thanks a lot for trying out Haiku! We hope you like it!");232 233 107 #if 1 234 108 // Show the EULA first. 235 BTextView* textView = new BTextView("eula", be_plain_font, NULL, 236 B_WILL_DRAW); 237 textView->SetInsets(10, 10, 10, 10); 238 textView->MakeEditable(false); 239 textView->MakeSelectable(false); 240 textView->SetText(infoText); 241 242 BScrollView* scrollView = new BScrollView("eulaScroll", 243 textView, B_WILL_DRAW, false, true); 244 245 BButton* cancelButton = new BButton(B_TRANSLATE("Quit"), 246 new BMessage(B_QUIT_REQUESTED)); 247 cancelButton->SetTarget(this); 248 249 BButton* continueButton = new BButton(B_TRANSLATE("Continue"), 250 new BMessage(kMsgAgree)); 251 continueButton->SetTarget(this); 252 continueButton->MakeDefault(true); 253 254 BRect eulaFrame = BRect(0, 0, 600, 450); 255 fEULAWindow = new BWindow(eulaFrame, B_TRANSLATE("README"), 256 B_MODAL_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_NOT_ZOOMABLE 257 | B_NOT_MINIMIZABLE | B_AUTO_UPDATE_SIZE_LIMITS); 258 259 if (!be_roster->IsRunning(kTrackerSignature)) 260 fEULAWindow->SetWorkspaces(B_ALL_WORKSPACES); 261 262 BLayoutBuilder::Group<>(fEULAWindow, B_VERTICAL, 10) 263 .SetInsets(10) 264 .Add(scrollView) 265 .AddGroup(B_HORIZONTAL, 10) 266 .AddGlue() 267 .Add(cancelButton) 268 .Add(continueButton); 269 270 fEULAWindow->CenterOnScreen(); 271 fEULAWindow->Show(); 109 fEULAWindow = new EULAWindow(); 272 110 #else 273 111 // Show the installer window without EULA. 274 112 new InstallerWindow(); 275 113 #endif 276 114 } 277 -
src/apps/installer/InstallerApp.h
diff --git a/src/apps/installer/InstallerApp.h b/src/apps/installer/InstallerApp.h index de068ab..105acc5 100644
a b 8 8 #include <Application.h> 9 9 #include <Catalog.h> 10 10 11 #include "EULAWindow.h" 11 12 #include "InstallerWindow.h" 12 13 13 14 … … public: 20 21 virtual void ReadyToRun(); 21 22 22 23 private: 23 BWindow* fEULAWindow;24 EULAWindow* fEULAWindow; 24 25 }; 25 26 26 27 #endif // INSTALLER_APP_H -
src/apps/installer/Jamfile
diff --git a/src/apps/installer/Jamfile b/src/apps/installer/Jamfile index b5843f2..9d9b4d19 100644
a b SubDirHdrs [ FDirName $(HAIKU_TOP) src kits tracker ] ; 5 5 6 6 Application Installer : 7 7 CopyEngine.cpp 8 EULAWindow.cpp 8 9 InstallerApp.cpp 9 10 InstallerDefs.cpp 10 11 InstallerWindow.cpp … … Application Installer : 21 22 DoCatalogs Installer : 22 23 x-vnd.Haiku-Installer 23 24 : 25 EULAWindow.cpp 24 26 InstallerApp.cpp 25 27 InstallerWindow.cpp 26 28 PackageViews.cpp